2025-07-17T06:38:23.4031921Z Current runner version: '2.326.0' 2025-07-17T06:38:23.4055712Z ##[group]Runner Image Provisioner 2025-07-17T06:38:23.4056466Z Hosted Compute Agent 2025-07-17T06:38:23.4057096Z Version: 20250711.363 2025-07-17T06:38:23.4057812Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:38:23.4058497Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:38:23.4059090Z ##[endgroup] 2025-07-17T06:38:23.4059671Z ##[group]Operating System 2025-07-17T06:38:23.4060201Z Ubuntu 2025-07-17T06:38:23.4060745Z 24.04.2 2025-07-17T06:38:23.4061221Z LTS 2025-07-17T06:38:23.4061638Z ##[endgroup] 2025-07-17T06:38:23.4062160Z ##[group]Runner Image 2025-07-17T06:38:23.4062711Z Image: ubuntu-24.04 2025-07-17T06:38:23.4063235Z Version: 20250710.1.0 2025-07-17T06:38:23.4064156Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:38:23.4065698Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:38:23.4066699Z ##[endgroup] 2025-07-17T06:38:23.4067885Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:38:23.4070015Z Contents: read 2025-07-17T06:38:23.4070549Z Metadata: read 2025-07-17T06:38:23.4071037Z ##[endgroup] 2025-07-17T06:38:23.4072921Z Secret source: Actions 2025-07-17T06:38:23.4073963Z Prepare workflow directory 2025-07-17T06:38:23.4575713Z Prepare all required actions 2025-07-17T06:38:23.4632634Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:38:23.4638180Z ##[group] Inputs 2025-07-17T06:38:23.4638877Z check_experiments: 2025-07-17T06:38:23.4639418Z opt_out_experiments: 2025-07-17T06:38:23.4639982Z triggering_actor: pytorchmergebot 2025-07-17T06:38:23.4640653Z issue_owner: 2025-07-17T06:38:23.4641134Z curr_branch: main 2025-07-17T06:38:23.4641667Z curr_ref_type: branch 2025-07-17T06:38:23.4642306Z issue_number: 5132 2025-07-17T06:38:23.4642855Z ##[endgroup] 2025-07-17T06:38:23.4643528Z Complete job name: before-test / get-label-type / runner-determinator 2025-07-17T06:38:24.0101996Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:38:24.0105368Z cat < runner_determinator.py 2025-07-17T06:38:24.0106509Z # flake8: noqa: G004 2025-07-17T06:38:24.0107280Z  2025-07-17T06:38:24.0108979Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:38:24.0110880Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:38:24.0112501Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:38:24.0113900Z  2025-07-17T06:38:24.0114710Z """ 2025-07-17T06:38:24.0115975Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:38:24.0117849Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:38:24.0119987Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:38:24.0121647Z of which runners should be used to run which job. 2025-07-17T06:38:24.0122939Z  2025-07-17T06:38:24.0124170Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:38:24.0126057Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:38:24.0128168Z settings are considered to be empty with only the second part, the user 2025-07-17T06:38:24.0129684Z list, defined. 2025-07-17T06:38:24.0130664Z  2025-07-17T06:38:24.0131765Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:38:24.0133721Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:38:24.0135422Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:38:24.0136753Z  2025-07-17T06:38:24.0138574Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:38:24.0140357Z The user list is also a comma separated list of additional features or 2025-07-17T06:38:24.0141998Z experiments which the user could be opted in to. 2025-07-17T06:38:24.0143195Z  2025-07-17T06:38:24.0144073Z The user list has the following rules: 2025-07-17T06:38:24.0145208Z  2025-07-17T06:38:24.0146332Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:38:24.0148313Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:38:24.0150037Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:38:24.0151131Z  2025-07-17T06:38:24.0151915Z Example config: 2025-07-17T06:38:24.0153091Z  # A list of experiments that can be opted into. 2025-07-17T06:38:24.0154601Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:38:24.0155788Z  # Expected syntax is: 2025-07-17T06:38:24.0157331Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:38:24.0159546Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:38:24.0161021Z  2025-07-17T06:38:24.0161949Z  experiments: 2025-07-17T06:38:24.0162894Z  lf: 2025-07-17T06:38:24.0163810Z  rollout_percent: 25 2025-07-17T06:38:24.0164813Z  all_branches: false 2025-07-17T06:38:24.0165962Z  default: true 2025-07-17T06:38:24.0166890Z  --- 2025-07-17T06:38:24.0259983Z  2025-07-17T06:38:24.0260951Z  # Opt-ins: 2025-07-17T06:38:24.0262116Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:38:24.0264169Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:38:24.0265727Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:38:24.0266959Z  # Experiments should be from the above list. 2025-07-17T06:38:24.0268267Z  2025-07-17T06:38:24.0268993Z  @User1,-lf,split_build 2025-07-17T06:38:24.0269895Z  @User2,lf 2025-07-17T06:38:24.0270682Z  @User3,split_build 2025-07-17T06:38:24.0271516Z """ 2025-07-17T06:38:24.0272029Z  2025-07-17T06:38:24.0272728Z import json 2025-07-17T06:38:24.0273501Z import logging 2025-07-17T06:38:24.0274283Z import os 2025-07-17T06:38:24.0275017Z import random 2025-07-17T06:38:24.0275785Z import re 2025-07-17T06:38:24.0276504Z import sys 2025-07-17T06:38:24.0277164Z from argparse import ArgumentParser 2025-07-17T06:38:24.0278519Z from collections.abc import Iterable 2025-07-17T06:38:24.0279619Z from functools import cache 2025-07-17T06:38:24.0280569Z from logging import LogRecord 2025-07-17T06:38:24.0281542Z from typing import Any, NamedTuple 2025-07-17T06:38:24.0282546Z from urllib.request import Request, urlopen 2025-07-17T06:38:24.0283594Z  2025-07-17T06:38:24.0284259Z import yaml 2025-07-17T06:38:24.0285062Z from github import Auth, Github 2025-07-17T06:38:24.0286041Z from github.Issue import Issue 2025-07-17T06:38:24.0286694Z  2025-07-17T06:38:24.0287282Z  2025-07-17T06:38:24.0288252Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:38:24.0289625Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:38:24.0291319Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:38:24.0292388Z  2025-07-17T06:38:24.0293513Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:38:24.0294640Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:38:24.0295689Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:38:24.0296675Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:38:24.0297869Z  2025-07-17T06:38:24.0298502Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:38:24.0299083Z  2025-07-17T06:38:24.0299500Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:38:24.0300045Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:38:24.0300559Z  2025-07-17T06:38:24.0301081Z  2025-07-17T06:38:24.0301513Z class Experiment(NamedTuple): 2025-07-17T06:38:24.0302083Z  rollout_perc: float = ( 2025-07-17T06:38:24.0302856Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:38:24.0303620Z  ) 2025-07-17T06:38:24.0304084Z  all_branches: bool = ( 2025-07-17T06:38:24.0304941Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:38:24.0305700Z  ) 2025-07-17T06:38:24.0306122Z  default: bool = ( 2025-07-17T06:38:24.0306793Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:38:24.0307792Z  ) 2025-07-17T06:38:24.0308221Z  2025-07-17T06:38:24.0308632Z  # Add more fields as needed 2025-07-17T06:38:24.0309152Z  2025-07-17T06:38:24.0309531Z  2025-07-17T06:38:24.0309935Z class Settings(NamedTuple): 2025-07-17T06:38:24.0310462Z  """ 2025-07-17T06:38:24.0311141Z  Settings for the experiments that can be opted into. 2025-07-17T06:38:24.0311791Z  """ 2025-07-17T06:38:24.0312188Z  2025-07-17T06:38:24.0312632Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:38:24.0313234Z  2025-07-17T06:38:24.0313772Z  2025-07-17T06:38:24.0314399Z class ColorFormatter(logging.Formatter): 2025-07-17T06:38:24.0315152Z  """Color codes the log messages based on the log level""" 2025-07-17T06:38:24.0315801Z  2025-07-17T06:38:24.0316193Z  COLORS = { 2025-07-17T06:38:24.0316672Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:38:24.0317251Z  "ERROR": "\033[31m", # Red 2025-07-17T06:38:24.0318110Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:38:24.0318693Z  "INFO": "\033[0m", # Reset 2025-07-17T06:38:24.0319244Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:38:24.0319777Z  } 2025-07-17T06:38:24.0320164Z  2025-07-17T06:38:24.0320630Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:38:24.0321609Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:38:24.0322495Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:38:24.0323141Z  return super().format(record) 2025-07-17T06:38:24.0323689Z  2025-07-17T06:38:24.0324063Z  2025-07-17T06:38:24.0324485Z handler = logging.StreamHandler() 2025-07-17T06:38:24.0325527Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:38:24.0326320Z  2025-07-17T06:38:24.0326827Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:38:24.0327493Z log.addHandler(handler) 2025-07-17T06:38:24.0328337Z log.setLevel(logging.INFO) 2025-07-17T06:38:24.0328877Z  2025-07-17T06:38:24.0329247Z  2025-07-17T06:38:24.0329755Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:38:24.0330386Z  """ 2025-07-17T06:38:24.0330968Z  Defines outputs of the github action that invokes this script 2025-07-17T06:38:24.0331994Z  """ 2025-07-17T06:38:24.0332429Z  if not GITHUB_OUTPUT: 2025-07-17T06:38:24.0333617Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:38:24.0335019Z  log.warning( 2025-07-17T06:38:24.0335997Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:38:24.0337011Z  ) 2025-07-17T06:38:24.0337668Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:38:24.0338495Z  return 2025-07-17T06:38:24.0338946Z  2025-07-17T06:38:24.0339386Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:38:24.0340038Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:38:24.0340681Z  f.write(f"{key}={value}\n") 2025-07-17T06:38:24.0341306Z  2025-07-17T06:38:24.0341764Z  2025-07-17T06:38:24.0342327Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:38:24.0343056Z  return frozenset( 2025-07-17T06:38:24.0343763Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:38:24.0344506Z  ) 2025-07-17T06:38:24.0344922Z  2025-07-17T06:38:24.0345445Z  2025-07-17T06:38:24.0345863Z def parse_args() -> Any: 2025-07-17T06:38:24.0346539Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:38:24.0347616Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:38:24.0348478Z  parser.add_argument( 2025-07-17T06:38:24.0349162Z  "--github-issue-repo", 2025-07-17T06:38:24.0349733Z  type=str, 2025-07-17T06:38:24.0350229Z  required=False, 2025-07-17T06:38:24.0350922Z  default="pytorch/test-infra", 2025-07-17T06:38:24.0351557Z  help="GitHub repo to get the issue", 2025-07-17T06:38:24.0352131Z  ) 2025-07-17T06:38:24.0352696Z  parser.add_argument( 2025-07-17T06:38:24.0353252Z  "--github-repo", 2025-07-17T06:38:24.0353767Z  type=str, 2025-07-17T06:38:24.0354246Z  required=True, 2025-07-17T06:38:24.0354810Z  help="GitHub repo where CI is running", 2025-07-17T06:38:24.0355392Z  ) 2025-07-17T06:38:24.0355816Z  parser.add_argument( 2025-07-17T06:38:24.0356661Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:38:24.0357411Z  ) 2025-07-17T06:38:24.0358026Z  parser.add_argument( 2025-07-17T06:38:24.0358767Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:38:24.0359538Z  ) 2025-07-17T06:38:24.0359959Z  parser.add_argument( 2025-07-17T06:38:24.0360853Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:38:24.0361618Z  ) 2025-07-17T06:38:24.0362059Z  parser.add_argument( 2025-07-17T06:38:24.0362826Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:38:24.0363601Z  ) 2025-07-17T06:38:24.0364047Z  parser.add_argument( 2025-07-17T06:38:24.0364718Z  "--github-ref-type", 2025-07-17T06:38:24.0365268Z  type=str, 2025-07-17T06:38:24.0365765Z  required=True, 2025-07-17T06:38:24.0366368Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:38:24.0366985Z  ) 2025-07-17T06:38:24.0367409Z  parser.add_argument( 2025-07-17T06:38:24.0368805Z  "--eligible-experiments", 2025-07-17T06:38:24.0369439Z  type=_str_comma_separated_to_set, 2025-07-17T06:38:24.0370040Z  required=False, 2025-07-17T06:38:24.0370554Z  default="", 2025-07-17T06:38:24.0371514Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:38:24.0372653Z  ) 2025-07-17T06:38:24.0373109Z  parser.add_argument( 2025-07-17T06:38:24.0373647Z  "--opt-out-experiments", 2025-07-17T06:38:24.0374238Z  type=_str_comma_separated_to_set, 2025-07-17T06:38:24.0374817Z  required=False, 2025-07-17T06:38:24.0375454Z  default="", 2025-07-17T06:38:24.0375945Z  help=( 2025-07-17T06:38:24.0376705Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:38:24.0378154Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:38:24.0379202Z  ), 2025-07-17T06:38:24.0379688Z  ) 2025-07-17T06:38:24.0380118Z  parser.add_argument( 2025-07-17T06:38:24.0380645Z  "--pr-number", 2025-07-17T06:38:24.0381147Z  type=str, 2025-07-17T06:38:24.0381625Z  required=False, 2025-07-17T06:38:24.0382135Z  default="", 2025-07-17T06:38:24.0382833Z  help="the optional PR number where this is run", 2025-07-17T06:38:24.0383489Z  ) 2025-07-17T06:38:24.0383888Z  2025-07-17T06:38:24.0384312Z  return parser.parse_args() 2025-07-17T06:38:24.0384844Z  2025-07-17T06:38:24.0385218Z  2025-07-17T06:38:24.0385884Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:38:24.0387044Z  auth = Auth.Token(github_token) 2025-07-17T06:38:24.0387869Z  return Github(auth=auth) 2025-07-17T06:38:24.0388393Z  2025-07-17T06:38:24.0388779Z  2025-07-17T06:38:24.0389487Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:38:24.0390537Z  repo = gh.get_repo(repo) 2025-07-17T06:38:24.0391143Z  return repo.get_issue(number=issue_num) 2025-07-17T06:38:24.0391726Z  2025-07-17T06:38:24.0392114Z  2025-07-17T06:38:24.0392524Z def get_potential_pr_author( 2025-07-17T06:38:24.0393332Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:38:24.0394152Z ) -> str: 2025-07-17T06:38:24.0394769Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:38:24.0395683Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:38:24.0396547Z  # embedded in the tag name: ciflow// 2025-07-17T06:38:24.0397338Z  2025-07-17T06:38:24.0397956Z  gh = get_gh_client(github_token) 2025-07-17T06:38:24.0398518Z  2025-07-17T06:38:24.0399029Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:38:24.0399736Z  split_tag = ref_name.split("/") 2025-07-17T06:38:24.0400309Z  if ( 2025-07-17T06:38:24.0400761Z  len(split_tag) == 3 2025-07-17T06:38:24.0401335Z  and split_tag[0] == "ciflow" 2025-07-17T06:38:24.0401939Z  and split_tag[2].isnumeric() 2025-07-17T06:38:24.0402496Z  ): 2025-07-17T06:38:24.0402963Z  pr_number = split_tag[2] 2025-07-17T06:38:24.0403518Z  try: 2025-07-17T06:38:24.0404029Z  repository = gh.get_repo(repo) 2025-07-17T06:38:24.0404890Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:38:24.0405578Z  except Exception as e: 2025-07-17T06:38:24.0406182Z  raise Exception( # noqa: TRY002 2025-07-17T06:38:24.0406931Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:38:24.0407820Z  ) from e 2025-07-17T06:38:24.0408474Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:38:24.0409262Z  # In all other cases, return the original input username 2025-07-17T06:38:24.0409917Z  return username 2025-07-17T06:38:24.0410389Z  2025-07-17T06:38:24.0410758Z  2025-07-17T06:38:24.0411229Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:38:24.0411831Z  """ 2025-07-17T06:38:24.0412576Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:38:24.0413438Z  """ 2025-07-17T06:38:24.0414056Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:38:24.0414788Z  2025-07-17T06:38:24.0415160Z  2025-07-17T06:38:24.0415618Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:38:24.0416183Z  try: 2025-07-17T06:38:24.0416642Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:38:24.0417221Z  return data 2025-07-17T06:38:24.0417909Z  except yaml.YAMLError: 2025-07-17T06:38:24.0418501Z  log.exception("Error loading YAML") 2025-07-17T06:38:24.0419085Z  raise 2025-07-17T06:38:24.0419520Z  2025-07-17T06:38:24.0419884Z  2025-07-17T06:38:24.0420562Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:38:24.0421479Z  """ 2025-07-17T06:38:24.0422723Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:38:24.0424241Z  2025-07-17T06:38:24.0425391Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:24.0427054Z  and the text below is the list of opted in users. 2025-07-17T06:38:24.0427914Z  2025-07-17T06:38:24.0428553Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:38:24.0429326Z  """ 2025-07-17T06:38:24.0429840Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:38:24.0430546Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:38:24.0431494Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:38:24.0432156Z  else: 2025-07-17T06:38:24.0432604Z  return "", rollout_state 2025-07-17T06:38:24.0433162Z  2025-07-17T06:38:24.0433528Z  2025-07-17T06:38:24.0433973Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:38:24.0434619Z  """ 2025-07-17T06:38:24.0435314Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:38:24.0436021Z  """ 2025-07-17T06:38:24.0436407Z  2025-07-17T06:38:24.0436774Z  2025-07-17T06:38:24.0437359Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:38:24.0438493Z  """ 2025-07-17T06:38:24.0439319Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:38:24.0440236Z  2025-07-17T06:38:24.0441108Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:38:24.0442351Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:38:24.0443334Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:38:24.0444031Z  2025-07-17T06:38:24.0444404Z  2025-07-17T06:38:24.0444770Z  """ 2025-07-17T06:38:24.0445333Z  optins = UserOptins() 2025-07-17T06:38:24.0445946Z  for user in user_optin_text.split("\n"): 2025-07-17T06:38:24.0446582Z  user = user.strip("\r\n\t -") 2025-07-17T06:38:24.0447206Z  if not user or not user.startswith("@"): 2025-07-17T06:38:24.0447959Z  # Not a valid user. Skip 2025-07-17T06:38:24.0448605Z  continue 2025-07-17T06:38:24.0449164Z  2025-07-17T06:38:24.0449551Z  if user: 2025-07-17T06:38:24.0450075Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:38:24.0450862Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:38:24.0451580Z  2025-07-17T06:38:24.0452101Z  return optins 2025-07-17T06:38:24.0452577Z  2025-07-17T06:38:24.0452933Z  2025-07-17T06:38:24.0453483Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:38:24.0454161Z  """ 2025-07-17T06:38:24.0454622Z  Check if the experiment name is valid. 2025-07-17T06:38:24.0455335Z  A valid name: 2025-07-17T06:38:24.0456085Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:38:24.0457115Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:38:24.0458104Z  - Cannot contain spaces 2025-07-17T06:38:24.0458773Z  """ 2025-07-17T06:38:24.0459176Z  2025-07-17T06:38:24.0459703Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:38:24.0460565Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:38:24.0461479Z  2025-07-17T06:38:24.0462035Z  if valid: 2025-07-17T06:38:24.0462493Z  return True 2025-07-17T06:38:24.0462953Z  2025-07-17T06:38:24.0463328Z  log.error( 2025-07-17T06:38:24.0464908Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:38:24.0466673Z  ) 2025-07-17T06:38:24.0467093Z  return False 2025-07-17T06:38:24.0467723Z  2025-07-17T06:38:24.0468119Z  2025-07-17T06:38:24.0468831Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:38:24.0469532Z  """ 2025-07-17T06:38:24.0470203Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:38:24.0471000Z  """ 2025-07-17T06:38:24.0471490Z  try: 2025-07-17T06:38:24.0471973Z  if settings_text: 2025-07-17T06:38:24.0472808Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:38:24.0473686Z  # for easy reading 2025-07-17T06:38:24.0474631Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:38:24.0475699Z  # the backtick character in shell commands. 2025-07-17T06:38:24.0476383Z  backtick = chr(96) # backtick character 2025-07-17T06:38:24.0477144Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:38:24.0478175Z  settings = load_yaml(settings_text) 2025-07-17T06:38:24.0478749Z  2025-07-17T06:38:24.0479434Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:38:24.0480650Z  experiments = {} 2025-07-17T06:38:24.0481314Z  2025-07-17T06:38:24.0481940Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:38:24.0482788Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:38:24.0483995Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:38:24.0485290Z  continue 2025-07-17T06:38:24.0485812Z  2025-07-17T06:38:24.0486225Z  valid_settings = {} 2025-07-17T06:38:24.0486824Z  for setting in exp_settings: 2025-07-17T06:38:24.0487661Z  if setting not in Experiment._fields: 2025-07-17T06:38:24.0488401Z  log.warning( 2025-07-17T06:38:24.0489222Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:38:24.0490004Z  ) 2025-07-17T06:38:24.0490498Z  else: 2025-07-17T06:38:24.0491455Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:38:24.0492111Z  2025-07-17T06:38:24.0492642Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:38:24.0493375Z  return Settings(experiments) 2025-07-17T06:38:24.0493940Z  2025-07-17T06:38:24.0494357Z  except Exception: 2025-07-17T06:38:24.0495062Z  log.exception("Failed to parse settings") 2025-07-17T06:38:24.0495674Z  2025-07-17T06:38:24.0496075Z  return Settings() 2025-07-17T06:38:24.0496551Z  2025-07-17T06:38:24.0496931Z  2025-07-17T06:38:24.0497837Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:38:24.0498566Z  """ 2025-07-17T06:38:24.0499079Z  Parse settings, if any, from the rollout state. 2025-07-17T06:38:24.0499694Z  2025-07-17T06:38:24.0500293Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:24.0501296Z  and the text below is the list of opted in users. 2025-07-17T06:38:24.0501908Z  2025-07-17T06:38:24.0502562Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:38:24.0503356Z  """ 2025-07-17T06:38:24.0503986Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:24.0504978Z  return parse_settings_from_text(settings_text) 2025-07-17T06:38:24.0505586Z  2025-07-17T06:38:24.0505954Z  2025-07-17T06:38:24.0506470Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:38:24.0507102Z  """ 2025-07-17T06:38:24.0507812Z  Parse users from the rollout state. 2025-07-17T06:38:24.0508415Z  2025-07-17T06:38:24.0508783Z  """ 2025-07-17T06:38:24.0509396Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:24.0510226Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:38:24.0510853Z  2025-07-17T06:38:24.0511371Z  2025-07-17T06:38:24.0512106Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:24.0512920Z  """ 2025-07-17T06:38:24.0513401Z  Check if a user is opted into an experiment 2025-07-17T06:38:24.0513995Z  """ 2025-07-17T06:38:24.0514657Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:38:24.0515301Z  2025-07-17T06:38:24.0515846Z  2025-07-17T06:38:24.0516536Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:24.0517426Z  """ 2025-07-17T06:38:24.0518226Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:38:24.0518869Z  """ 2025-07-17T06:38:24.0519439Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:38:24.0520217Z  experiment_optout = "-" + experiment_name 2025-07-17T06:38:24.0521084Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:38:24.0521760Z  return False 2025-07-17T06:38:24.0522229Z  2025-07-17T06:38:24.0522733Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:38:24.0523393Z  log.warning( 2025-07-17T06:38:24.0524460Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:38:24.0525432Z  ) 2025-07-17T06:38:24.0525849Z  2025-07-17T06:38:24.0526233Z  return True 2025-07-17T06:38:24.0526677Z  2025-07-17T06:38:24.0527044Z  2025-07-17T06:38:24.0527747Z def get_runner_prefix( 2025-07-17T06:38:24.0528287Z  rollout_state: str, 2025-07-17T06:38:24.0528836Z  workflow_requestors: Iterable[str], 2025-07-17T06:38:24.0529406Z  branch: str, 2025-07-17T06:38:24.0529987Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:24.0530898Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:24.0531553Z  is_canary: bool = False, 2025-07-17T06:38:24.0532076Z ) -> str: 2025-07-17T06:38:24.0532574Z  settings = parse_settings(rollout_state) 2025-07-17T06:38:24.0533226Z  user_optins = parse_users(rollout_state) 2025-07-17T06:38:24.0533932Z  2025-07-17T06:38:24.0534499Z  fleet_prefix = "" 2025-07-17T06:38:24.0535018Z  prefixes = [] 2025-07-17T06:38:24.0535741Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:38:24.0536771Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:38:24.0537859Z  log.info( 2025-07-17T06:38:24.0538642Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:38:24.0539463Z  ) 2025-07-17T06:38:24.0539933Z  continue 2025-07-17T06:38:24.0540518Z  2025-07-17T06:38:24.0540944Z  if opt_out_experiments: 2025-07-17T06:38:24.0541579Z  if experiment_name in opt_out_experiments: 2025-07-17T06:38:24.0542318Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:38:24.0542979Z  log.info( 2025-07-17T06:38:24.0544112Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:38:24.0545164Z  ) 2025-07-17T06:38:24.0545629Z  continue 2025-07-17T06:38:24.0546152Z  2025-07-17T06:38:24.0546569Z  if eligible_experiments: 2025-07-17T06:38:24.0547318Z  if experiment_name not in eligible_experiments: 2025-07-17T06:38:24.0548256Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:38:24.0548871Z  log.info( 2025-07-17T06:38:24.0549737Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:38:24.0550804Z  ) 2025-07-17T06:38:24.0551652Z  continue 2025-07-17T06:38:24.0552218Z  elif not experiment_settings.default: 2025-07-17T06:38:24.0552804Z  log.info( 2025-07-17T06:38:24.0553654Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:38:24.0554500Z  ) 2025-07-17T06:38:24.0554952Z  continue 2025-07-17T06:38:24.0555420Z  2025-07-17T06:38:24.0555928Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:38:24.0556615Z  opted_out_users = [ 2025-07-17T06:38:24.0557290Z  requestor 2025-07-17T06:38:24.0558037Z  for requestor in workflow_requestors 2025-07-17T06:38:24.0558791Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:38:24.0559484Z  ] 2025-07-17T06:38:24.0559895Z  2025-07-17T06:38:24.0560451Z  if opted_out_users: 2025-07-17T06:38:24.0561014Z  log.info( 2025-07-17T06:38:24.0561730Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:38:24.0562491Z  ) 2025-07-17T06:38:24.0562930Z  continue 2025-07-17T06:38:24.0563396Z  2025-07-17T06:38:24.0563909Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:38:24.0564594Z  opted_in_users = [ 2025-07-17T06:38:24.0565143Z  requestor 2025-07-17T06:38:24.0565821Z  for requestor in workflow_requestors 2025-07-17T06:38:24.0566572Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:38:24.0567252Z  ] 2025-07-17T06:38:24.0567839Z  2025-07-17T06:38:24.0568255Z  enabled = False 2025-07-17T06:38:24.0568782Z  if opted_in_users: 2025-07-17T06:38:24.0569434Z  log.info( 2025-07-17T06:38:24.0570141Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:38:24.0570886Z  ) 2025-07-17T06:38:24.0571326Z  enabled = True 2025-07-17T06:38:24.0571971Z  2025-07-17T06:38:24.0572444Z  elif experiment_settings.rollout_perc: 2025-07-17T06:38:24.0573360Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:38:24.0574392Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:38:24.0575131Z  log.info( 2025-07-17T06:38:24.0576090Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:38:24.0577081Z  ) 2025-07-17T06:38:24.0577804Z  enabled = True 2025-07-17T06:38:24.0578409Z  2025-07-17T06:38:24.0578807Z  if enabled: 2025-07-17T06:38:24.0579347Z  label = experiment_name 2025-07-17T06:38:24.0579978Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:38:24.0580880Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:38:24.0581904Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:38:24.0582827Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:38:24.0583550Z  if is_canary: 2025-07-17T06:38:24.0584113Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:38:24.0584717Z  fleet_prefix = label 2025-07-17T06:38:24.0585259Z  else: 2025-07-17T06:38:24.0586020Z  prefixes.append(label) 2025-07-17T06:38:24.0586648Z  2025-07-17T06:38:24.0587049Z  if len(prefixes) > 1: 2025-07-17T06:38:24.0587758Z  log.error( 2025-07-17T06:38:24.0589086Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:38:24.0590458Z  ) 2025-07-17T06:38:24.0590915Z  prefixes = prefixes[:1] 2025-07-17T06:38:24.0591453Z  2025-07-17T06:38:24.0591858Z  # Fleet always comes first 2025-07-17T06:38:24.0592399Z  if fleet_prefix: 2025-07-17T06:38:24.0592925Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:38:24.0593472Z  2025-07-17T06:38:24.0594104Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:38:24.0594748Z  2025-07-17T06:38:24.0595125Z  2025-07-17T06:38:24.0595808Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:38:24.0596640Z  """ 2025-07-17T06:38:24.0597285Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:38:24.0598390Z  2025-07-17T06:38:24.0599037Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:38:24.0599799Z  """ 2025-07-17T06:38:24.0600259Z  gh = get_gh_client(github_token) 2025-07-17T06:38:24.0600879Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:38:24.0601677Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:38:24.0602384Z  2025-07-17T06:38:24.0602756Z  2025-07-17T06:38:24.0603404Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:38:24.0604390Z  for _ in range(num_retries): 2025-07-17T06:38:24.0604949Z  try: 2025-07-17T06:38:24.0605614Z  req = Request(url=url, headers=headers) 2025-07-17T06:38:24.0606348Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:38:24.0607061Z  return json.loads(content) 2025-07-17T06:38:24.0607893Z  except Exception as e: 2025-07-17T06:38:24.0608539Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:38:24.0609291Z  2025-07-17T06:38:24.0609925Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:38:24.0610704Z  return {} 2025-07-17T06:38:24.0611145Z  2025-07-17T06:38:24.0611509Z  2025-07-17T06:38:24.0611884Z @cache 2025-07-17T06:38:24.0612711Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:38:24.0613562Z  """ 2025-07-17T06:38:24.0614017Z  Dynamically get PR information 2025-07-17T06:38:24.0614557Z  """ 2025-07-17T06:38:24.0615130Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:38:24.0615810Z  headers = { 2025-07-17T06:38:24.0616350Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:38:24.0617016Z  "Authorization": f"token {github_token}", 2025-07-17T06:38:24.0617785Z  } 2025-07-17T06:38:24.0618298Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:38:24.0618963Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:38:24.0619548Z  headers=headers, 2025-07-17T06:38:24.0620035Z  ) 2025-07-17T06:38:24.0620442Z  2025-07-17T06:38:24.0620840Z  if not json_response: 2025-07-17T06:38:24.0621497Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:38:24.0622353Z  return {} 2025-07-17T06:38:24.0622818Z  2025-07-17T06:38:24.0623226Z  return json_response 2025-07-17T06:38:24.0623714Z  2025-07-17T06:38:24.0624083Z  2025-07-17T06:38:24.0624715Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:38:24.0625510Z  """ 2025-07-17T06:38:24.0626111Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:38:24.0626830Z  """ 2025-07-17T06:38:24.0627383Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:38:24.0628167Z  return { 2025-07-17T06:38:24.0628825Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:38:24.0629582Z  } 2025-07-17T06:38:24.0629974Z  2025-07-17T06:38:24.0630346Z  2025-07-17T06:38:24.0630740Z def main() -> None: 2025-07-17T06:38:24.0631232Z  args = parse_args() 2025-07-17T06:38:24.0631717Z  2025-07-17T06:38:24.0632183Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:38:24.0632767Z  2025-07-17T06:38:24.0633175Z  # Check if the PR is opt-out 2025-07-17T06:38:24.0633726Z  if args.pr_number: 2025-07-17T06:38:24.0634471Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:38:24.0635284Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:38:24.0635845Z  log.info( 2025-07-17T06:38:24.0636622Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:38:24.0637449Z  ) 2025-07-17T06:38:24.0638191Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:24.0638948Z  sys.exit() 2025-07-17T06:38:24.0639546Z  2025-07-17T06:38:24.0639930Z  try: 2025-07-17T06:38:24.0640440Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:38:24.0641233Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:38:24.0641938Z  ) 2025-07-17T06:38:24.0642351Z  2025-07-17T06:38:24.0642785Z  username = get_potential_pr_author( 2025-07-17T06:38:24.0643381Z  args.github_token, 2025-07-17T06:38:24.0643921Z  args.github_repo, 2025-07-17T06:38:24.0644459Z  args.github_actor, 2025-07-17T06:38:24.0645014Z  args.github_ref_type, 2025-07-17T06:38:24.0645580Z  args.github_branch, 2025-07-17T06:38:24.0646102Z  ) 2025-07-17T06:38:24.0646506Z  2025-07-17T06:38:24.0647037Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:38:24.0647813Z  2025-07-17T06:38:24.0648272Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:38:24.0648881Z  rollout_state, 2025-07-17T06:38:24.0649446Z  (args.github_issue_owner, username), 2025-07-17T06:38:24.0650044Z  args.github_branch, 2025-07-17T06:38:24.0650614Z  args.eligible_experiments, 2025-07-17T06:38:24.0651223Z  args.opt_out_experiments, 2025-07-17T06:38:24.0651794Z  is_canary, 2025-07-17T06:38:24.0652276Z  ) 2025-07-17T06:38:24.0652684Z  2025-07-17T06:38:24.0653088Z  except Exception as e: 2025-07-17T06:38:24.0653609Z  log.error( 2025-07-17T06:38:24.0654386Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:38:24.0655337Z  ) 2025-07-17T06:38:24.0655754Z  2025-07-17T06:38:24.0656343Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:24.0657069Z  2025-07-17T06:38:24.0657443Z  2025-07-17T06:38:24.0657942Z if __name__ == "__main__": 2025-07-17T06:38:24.0658452Z  main() 2025-07-17T06:38:24.0658867Z  2025-07-17T06:38:24.0659243Z EOF 2025-07-17T06:38:24.0659627Z  2025-07-17T06:38:24.0660038Z cat runner_determinator.py 2025-07-17T06:38:24.0908136Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:24.0909015Z env: 2025-07-17T06:38:24.0909746Z GITHUB_TOKEN: *** 2025-07-17T06:38:24.0910186Z ISSUE_NUMBER: 5132 2025-07-17T06:38:24.0910652Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:24.0911179Z ISSUE_OWNER: 2025-07-17T06:38:24.0911598Z CHECK_EXPERIMENTS: 2025-07-17T06:38:24.0912055Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:24.0912492Z PR_NUMBER: 2025-07-17T06:38:24.0912910Z ##[endgroup] 2025-07-17T06:38:24.1113391Z # flake8: noqa: G004 2025-07-17T06:38:24.1113741Z 2025-07-17T06:38:24.1114171Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:38:24.1115135Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:38:24.1115946Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:38:24.1116387Z 2025-07-17T06:38:24.1116548Z """ 2025-07-17T06:38:24.1117123Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:38:24.1118333Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:38:24.1119259Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:38:24.1120080Z of which runners should be used to run which job. 2025-07-17T06:38:24.1120476Z 2025-07-17T06:38:24.1120858Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:38:24.1121924Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:38:24.1122841Z settings are considered to be empty with only the second part, the user 2025-07-17T06:38:24.1123536Z list, defined. 2025-07-17T06:38:24.1123764Z 2025-07-17T06:38:24.1124125Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:38:24.1125044Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:38:24.1125868Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:38:24.1126304Z 2025-07-17T06:38:24.1126674Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:38:24.1128291Z The user list is also a comma separated list of additional features or 2025-07-17T06:38:24.1129103Z experiments which the user could be opted in to. 2025-07-17T06:38:24.1129501Z 2025-07-17T06:38:24.1129702Z The user list has the following rules: 2025-07-17T06:38:24.1130049Z 2025-07-17T06:38:24.1130379Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:38:24.1131239Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:38:24.1131988Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:38:24.1132374Z 2025-07-17T06:38:24.1132547Z Example config: 2025-07-17T06:38:24.1132982Z # A list of experiments that can be opted into. 2025-07-17T06:38:24.1133643Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:38:24.1134254Z # Expected syntax is: 2025-07-17T06:38:24.1134897Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:38:24.1135855Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:38:24.1136459Z 2025-07-17T06:38:24.1136628Z experiments: 2025-07-17T06:38:24.1137011Z lf: 2025-07-17T06:38:24.1137382Z rollout_percent: 25 2025-07-17T06:38:24.1138248Z all_branches: false 2025-07-17T06:38:24.1138692Z default: true 2025-07-17T06:38:24.1139102Z --- 2025-07-17T06:38:24.1139300Z 2025-07-17T06:38:24.1139461Z # Opt-ins: 2025-07-17T06:38:24.1140032Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:38:24.1140878Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:38:24.1141711Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:38:24.1142399Z # Experiments should be from the above list. 2025-07-17T06:38:24.1142775Z 2025-07-17T06:38:24.1142955Z @User1,-lf,split_build 2025-07-17T06:38:24.1143385Z @User2,lf 2025-07-17T06:38:24.1143801Z @User3,split_build 2025-07-17T06:38:24.1144208Z """ 2025-07-17T06:38:24.1144403Z 2025-07-17T06:38:24.1144565Z import json 2025-07-17T06:38:24.1144934Z import logging 2025-07-17T06:38:24.1145305Z import os 2025-07-17T06:38:24.1145666Z import random 2025-07-17T06:38:24.1146041Z import re 2025-07-17T06:38:24.1146397Z import sys 2025-07-17T06:38:24.1146799Z from argparse import ArgumentParser 2025-07-17T06:38:24.1147319Z from collections.abc import Iterable 2025-07-17T06:38:24.1148034Z from functools import cache 2025-07-17T06:38:24.1148514Z from logging import LogRecord 2025-07-17T06:38:24.1149003Z from typing import Any, NamedTuple 2025-07-17T06:38:24.1149530Z from urllib.request import Request, urlopen 2025-07-17T06:38:24.1149902Z 2025-07-17T06:38:24.1150065Z import yaml 2025-07-17T06:38:24.1150448Z from github import Auth, Github 2025-07-17T06:38:24.1150936Z from github.Issue import Issue 2025-07-17T06:38:24.1151232Z 2025-07-17T06:38:24.1151238Z 2025-07-17T06:38:24.1151458Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:38:24.1152138Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:38:24.1152999Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:38:24.1153551Z 2025-07-17T06:38:24.1153782Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:38:24.1154498Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:38:24.1155013Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:38:24.1155562Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:38:24.1155911Z 2025-07-17T06:38:24.1156110Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:38:24.1156441Z 2025-07-17T06:38:24.1156622Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:38:24.1157077Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:38:24.1157350Z 2025-07-17T06:38:24.1157357Z 2025-07-17T06:38:24.1157713Z class Experiment(NamedTuple): 2025-07-17T06:38:24.1158250Z rollout_perc: float = ( 2025-07-17T06:38:24.1158877Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:38:24.1159561Z ) 2025-07-17T06:38:24.1159930Z all_branches: bool = ( 2025-07-17T06:38:24.1160554Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:38:24.1161226Z ) 2025-07-17T06:38:24.1161583Z default: bool = ( 2025-07-17T06:38:24.1162152Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:38:24.1162793Z ) 2025-07-17T06:38:24.1162990Z 2025-07-17T06:38:24.1163174Z # Add more fields as needed 2025-07-17T06:38:24.1163477Z 2025-07-17T06:38:24.1163483Z 2025-07-17T06:38:24.1163670Z class Settings(NamedTuple): 2025-07-17T06:38:24.1164110Z """ 2025-07-17T06:38:24.1164560Z Settings for the experiments that can be opted into. 2025-07-17T06:38:24.1165128Z """ 2025-07-17T06:38:24.1165322Z 2025-07-17T06:38:24.1165533Z experiments: dict[str, Experiment] = {} 2025-07-17T06:38:24.1165889Z 2025-07-17T06:38:24.1165895Z 2025-07-17T06:38:24.1166102Z class ColorFormatter(logging.Formatter): 2025-07-17T06:38:24.1166717Z """Color codes the log messages based on the log level""" 2025-07-17T06:38:24.1167144Z 2025-07-17T06:38:24.1167308Z COLORS = { 2025-07-17T06:38:24.1167906Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:38:24.1168586Z "ERROR": "\033[31m", # Red 2025-07-17T06:38:24.1169072Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:38:24.1169564Z "INFO": "\033[0m", # Reset 2025-07-17T06:38:24.1170038Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:38:24.1170514Z } 2025-07-17T06:38:24.1170709Z 2025-07-17T06:38:24.1170933Z def format(self, record: LogRecord) -> str: 2025-07-17T06:38:24.1171678Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:38:24.1172453Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:38:24.1173021Z return super().format(record) 2025-07-17T06:38:24.1173351Z 2025-07-17T06:38:24.1173358Z 2025-07-17T06:38:24.1173562Z handler = logging.StreamHandler() 2025-07-17T06:38:24.1174257Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:38:24.1174814Z 2025-07-17T06:38:24.1175063Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:38:24.1175645Z log.addHandler(handler) 2025-07-17T06:38:24.1176093Z log.setLevel(logging.INFO) 2025-07-17T06:38:24.1176377Z 2025-07-17T06:38:24.1176384Z 2025-07-17T06:38:24.1176636Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:38:24.1177189Z """ 2025-07-17T06:38:24.1177912Z Defines outputs of the github action that invokes this script 2025-07-17T06:38:24.1178539Z """ 2025-07-17T06:38:24.1178905Z if not GITHUB_OUTPUT: 2025-07-17T06:38:24.1179971Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:38:24.1181082Z log.warning( 2025-07-17T06:38:24.1181936Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:38:24.1182853Z ) 2025-07-17T06:38:24.1193182Z print(f"::set-output name={key}::{value}") 2025-07-17T06:38:24.1193804Z return 2025-07-17T06:38:24.1194041Z 2025-07-17T06:38:24.1194450Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:38:24.1195060Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:38:24.1195637Z f.write(f"{key}={value}\n") 2025-07-17T06:38:24.1195960Z 2025-07-17T06:38:24.1195967Z 2025-07-17T06:38:24.1196279Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:38:24.1196897Z return frozenset( 2025-07-17T06:38:24.1197741Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:38:24.1198511Z ) 2025-07-17T06:38:24.1198717Z 2025-07-17T06:38:24.1198725Z 2025-07-17T06:38:24.1198911Z def parse_args() -> Any: 2025-07-17T06:38:24.1199447Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:38:24.1200316Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:38:24.1201074Z parser.add_argument( 2025-07-17T06:38:24.1201519Z "--github-issue-repo", 2025-07-17T06:38:24.1201986Z type=str, 2025-07-17T06:38:24.1202380Z required=False, 2025-07-17T06:38:24.1202856Z default="pytorch/test-infra", 2025-07-17T06:38:24.1203388Z help="GitHub repo to get the issue", 2025-07-17T06:38:24.1203891Z ) 2025-07-17T06:38:24.1204252Z parser.add_argument( 2025-07-17T06:38:24.1204685Z "--github-repo", 2025-07-17T06:38:24.1205093Z type=str, 2025-07-17T06:38:24.1205485Z required=True, 2025-07-17T06:38:24.1205957Z help="GitHub repo where CI is running", 2025-07-17T06:38:24.1206484Z ) 2025-07-17T06:38:24.1206854Z parser.add_argument( 2025-07-17T06:38:24.1207447Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:38:24.1208293Z ) 2025-07-17T06:38:24.1208661Z parser.add_argument( 2025-07-17T06:38:24.1209279Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:38:24.1209944Z ) 2025-07-17T06:38:24.1210306Z parser.add_argument( 2025-07-17T06:38:24.1211095Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:38:24.1211790Z ) 2025-07-17T06:38:24.1212152Z parser.add_argument( 2025-07-17T06:38:24.1212793Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:38:24.1213496Z ) 2025-07-17T06:38:24.1213849Z parser.add_argument( 2025-07-17T06:38:24.1214294Z "--github-ref-type", 2025-07-17T06:38:24.1214737Z type=str, 2025-07-17T06:38:24.1215132Z required=True, 2025-07-17T06:38:24.1215614Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:38:24.1216169Z ) 2025-07-17T06:38:24.1216531Z parser.add_argument( 2025-07-17T06:38:24.1216996Z "--eligible-experiments", 2025-07-17T06:38:24.1217501Z type=_str_comma_separated_to_set, 2025-07-17T06:38:24.1218268Z required=False, 2025-07-17T06:38:24.1218685Z default="", 2025-07-17T06:38:24.1219542Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:38:24.1220488Z ) 2025-07-17T06:38:24.1270064Z parser.add_argument( 2025-07-17T06:38:24.1271213Z "--opt-out-experiments", 2025-07-17T06:38:24.1272218Z type=_str_comma_separated_to_set, 2025-07-17T06:38:24.1272784Z required=False, 2025-07-17T06:38:24.1273203Z default="", 2025-07-17T06:38:24.1273586Z help=( 2025-07-17T06:38:24.1274291Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:38:24.1275446Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:38:24.1276276Z ), 2025-07-17T06:38:24.1276631Z ) 2025-07-17T06:38:24.1277011Z parser.add_argument( 2025-07-17T06:38:24.1277454Z "--pr-number", 2025-07-17T06:38:24.1278126Z type=str, 2025-07-17T06:38:24.1278525Z required=False, 2025-07-17T06:38:24.1278971Z default="", 2025-07-17T06:38:24.1279624Z help="the optional PR number where this is run", 2025-07-17T06:38:24.1280199Z ) 2025-07-17T06:38:24.1280400Z 2025-07-17T06:38:24.1280602Z return parser.parse_args() 2025-07-17T06:38:24.1280909Z 2025-07-17T06:38:24.1280916Z 2025-07-17T06:38:24.1281324Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:38:24.1282080Z auth = Auth.Token(github_token) 2025-07-17T06:38:24.1282584Z return Github(auth=auth) 2025-07-17T06:38:24.1282892Z 2025-07-17T06:38:24.1282900Z 2025-07-17T06:38:24.1283359Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:38:24.1284164Z repo = gh.get_repo(repo) 2025-07-17T06:38:24.1284657Z return repo.get_issue(number=issue_num) 2025-07-17T06:38:24.1285013Z 2025-07-17T06:38:24.1285019Z 2025-07-17T06:38:24.1285213Z def get_potential_pr_author( 2025-07-17T06:38:24.1285849Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:38:24.1286525Z ) -> str: 2025-07-17T06:38:24.1287048Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:38:24.1288090Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:38:24.1288849Z # embedded in the tag name: ciflow// 2025-07-17T06:38:24.1289261Z 2025-07-17T06:38:24.1289452Z gh = get_gh_client(github_token) 2025-07-17T06:38:24.1289783Z 2025-07-17T06:38:24.1290054Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:38:24.1290665Z split_tag = ref_name.split("/") 2025-07-17T06:38:24.1291167Z if ( 2025-07-17T06:38:24.1291547Z len(split_tag) == 3 2025-07-17T06:38:24.1292103Z and split_tag[0] == "ciflow" 2025-07-17T06:38:24.1292654Z and split_tag[2].isnumeric() 2025-07-17T06:38:24.1293285Z ): 2025-07-17T06:38:24.1293670Z pr_number = split_tag[2] 2025-07-17T06:38:24.1294318Z try: 2025-07-17T06:38:24.1294739Z repository = gh.get_repo(repo) 2025-07-17T06:38:24.1295340Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:38:24.1295932Z except Exception as e: 2025-07-17T06:38:24.1296443Z raise Exception( # noqa: TRY002 2025-07-17T06:38:24.1297093Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:38:24.1297996Z ) from e 2025-07-17T06:38:24.1298603Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:38:24.1299294Z # In all other cases, return the original input username 2025-07-17T06:38:24.1299863Z return username 2025-07-17T06:38:24.1300106Z 2025-07-17T06:38:24.1300112Z 2025-07-17T06:38:24.1300333Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:38:24.1300860Z """ 2025-07-17T06:38:24.1301483Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:38:24.1302257Z """ 2025-07-17T06:38:24.1302792Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:38:24.1303313Z 2025-07-17T06:38:24.1303320Z 2025-07-17T06:38:24.1303510Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:38:24.1303984Z try: 2025-07-17T06:38:24.1304367Z data = yaml.safe_load(yaml_text) 2025-07-17T06:38:24.1304872Z return data 2025-07-17T06:38:24.1305272Z except yaml.YAMLError: 2025-07-17T06:38:24.1305755Z log.exception("Error loading YAML") 2025-07-17T06:38:24.1306251Z raise 2025-07-17T06:38:24.1306462Z 2025-07-17T06:38:24.1306475Z 2025-07-17T06:38:24.1306893Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:38:24.1308175Z """ 2025-07-17T06:38:24.1308924Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:38:24.1309522Z 2025-07-17T06:38:24.1310036Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:24.1310799Z and the text below is the list of opted in users. 2025-07-17T06:38:24.1311201Z 2025-07-17T06:38:24.1311581Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:38:24.1312270Z """ 2025-07-17T06:38:24.1312712Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:38:24.1313318Z if len(rollout_state_parts) >= 2: 2025-07-17T06:38:24.1313923Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:38:24.1314504Z else: 2025-07-17T06:38:24.1314887Z return "", rollout_state 2025-07-17T06:38:24.1315192Z 2025-07-17T06:38:24.1315199Z 2025-07-17T06:38:24.1315405Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:38:24.1315899Z """ 2025-07-17T06:38:24.1316411Z Dictionary of users with a list of features they have opted into 2025-07-17T06:38:24.1317047Z """ 2025-07-17T06:38:24.1317252Z 2025-07-17T06:38:24.1317258Z 2025-07-17T06:38:24.1317802Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:38:24.1318492Z """ 2025-07-17T06:38:24.1319201Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:38:24.1319887Z 2025-07-17T06:38:24.1320510Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:38:24.1321500Z - Example line: "@User1,lf,split_build" 2025-07-17T06:38:24.1322181Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:38:24.1322659Z 2025-07-17T06:38:24.1322666Z 2025-07-17T06:38:24.1322823Z """ 2025-07-17T06:38:24.1323193Z optins = UserOptins() 2025-07-17T06:38:24.1323673Z for user in user_optin_text.split("\n"): 2025-07-17T06:38:24.1324223Z user = user.strip("\r\n\t -") 2025-07-17T06:38:24.1324759Z if not user or not user.startswith("@"): 2025-07-17T06:38:24.1325452Z # Not a valid user. Skip 2025-07-17T06:38:24.1325931Z continue 2025-07-17T06:38:24.1326175Z 2025-07-17T06:38:24.1326331Z if user: 2025-07-17T06:38:24.1326761Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:38:24.1327452Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:38:24.1328136Z 2025-07-17T06:38:24.1328307Z return optins 2025-07-17T06:38:24.1328544Z 2025-07-17T06:38:24.1328551Z 2025-07-17T06:38:24.1328839Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:38:24.1329428Z """ 2025-07-17T06:38:24.1329821Z Check if the experiment name is valid. 2025-07-17T06:38:24.1330330Z A valid name: 2025-07-17T06:38:24.1330963Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:38:24.1331912Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:38:24.1332633Z - Cannot contain spaces 2025-07-17T06:38:24.1333090Z """ 2025-07-17T06:38:24.1333286Z 2025-07-17T06:38:24.1333544Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:38:24.1334237Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:38:24.1334673Z 2025-07-17T06:38:24.1334832Z if valid: 2025-07-17T06:38:24.1335211Z return True 2025-07-17T06:38:24.1335445Z 2025-07-17T06:38:24.1335605Z log.error( 2025-07-17T06:38:24.1337057Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:38:24.1338919Z ) 2025-07-17T06:38:24.1339283Z return False 2025-07-17T06:38:24.1339522Z 2025-07-17T06:38:24.1339528Z 2025-07-17T06:38:24.1339832Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:38:24.1340449Z """ 2025-07-17T06:38:24.1341184Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:38:24.1341923Z """ 2025-07-17T06:38:24.1342311Z try: 2025-07-17T06:38:24.1342688Z if settings_text: 2025-07-17T06:38:24.1343406Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:38:24.1344193Z # for easy reading 2025-07-17T06:38:24.1344968Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:38:24.1345852Z # the backtick character in shell commands. 2025-07-17T06:38:24.1346454Z backtick = chr(96) # backtick character 2025-07-17T06:38:24.1347113Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:38:24.1348097Z settings = load_yaml(settings_text) 2025-07-17T06:38:24.1348478Z 2025-07-17T06:38:24.1348897Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:38:24.1349673Z experiments = {} 2025-07-17T06:38:24.1349972Z 2025-07-17T06:38:24.1350351Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:38:24.1351112Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:38:24.1352216Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:38:24.1353249Z continue 2025-07-17T06:38:24.1353535Z 2025-07-17T06:38:24.1353716Z valid_settings = {} 2025-07-17T06:38:24.1354231Z for setting in exp_settings: 2025-07-17T06:38:24.1354792Z if setting not in Experiment._fields: 2025-07-17T06:38:24.1355340Z log.warning( 2025-07-17T06:38:24.1356033Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:38:24.1356894Z ) 2025-07-17T06:38:24.1357321Z else: 2025-07-17T06:38:24.1357989Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:38:24.1358412Z 2025-07-17T06:38:24.1358697Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:38:24.1359339Z return Settings(experiments) 2025-07-17T06:38:24.1359687Z 2025-07-17T06:38:24.1359868Z except Exception: 2025-07-17T06:38:24.1360341Z log.exception("Failed to parse settings") 2025-07-17T06:38:24.1360729Z 2025-07-17T06:38:24.1360902Z return Settings() 2025-07-17T06:38:24.1361156Z 2025-07-17T06:38:24.1361162Z 2025-07-17T06:38:24.1361406Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:38:24.1361971Z """ 2025-07-17T06:38:24.1362402Z Parse settings, if any, from the rollout state. 2025-07-17T06:38:24.1362806Z 2025-07-17T06:38:24.1363153Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:24.1363919Z and the text below is the list of opted in users. 2025-07-17T06:38:24.1364318Z 2025-07-17T06:38:24.1364726Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:38:24.1365456Z """ 2025-07-17T06:38:24.1365999Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:24.1366750Z return parse_settings_from_text(settings_text) 2025-07-17T06:38:24.1367143Z 2025-07-17T06:38:24.1367149Z 2025-07-17T06:38:24.1367397Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:38:24.1368060Z """ 2025-07-17T06:38:24.1368449Z Parse users from the rollout state. 2025-07-17T06:38:24.1368803Z 2025-07-17T06:38:24.1368959Z """ 2025-07-17T06:38:24.1369488Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:24.1370216Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:38:24.1370630Z 2025-07-17T06:38:24.1370638Z 2025-07-17T06:38:24.1371173Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:24.1371928Z """ 2025-07-17T06:38:24.1372336Z Check if a user is opted into an experiment 2025-07-17T06:38:24.1372872Z """ 2025-07-17T06:38:24.1373319Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:38:24.1373739Z 2025-07-17T06:38:24.1373750Z 2025-07-17T06:38:24.1374168Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:24.1374912Z """ 2025-07-17T06:38:24.1375371Z Check if a user explicitly opted out of an experiment 2025-07-17T06:38:24.1375942Z """ 2025-07-17T06:38:24.1376443Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:38:24.1377128Z experiment_optout = "-" + experiment_name 2025-07-17T06:38:24.1377865Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:38:24.1378473Z return False 2025-07-17T06:38:24.1378729Z 2025-07-17T06:38:24.1379001Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:38:24.1379594Z log.warning( 2025-07-17T06:38:24.1380390Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:38:24.1381267Z ) 2025-07-17T06:38:24.1381469Z 2025-07-17T06:38:24.1381636Z return True 2025-07-17T06:38:24.1381865Z 2025-07-17T06:38:24.1381872Z 2025-07-17T06:38:24.1382046Z def get_runner_prefix( 2025-07-17T06:38:24.1382494Z rollout_state: str, 2025-07-17T06:38:24.1382941Z workflow_requestors: Iterable[str], 2025-07-17T06:38:24.1383454Z branch: str, 2025-07-17T06:38:24.1383934Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:24.1384593Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:24.1385173Z is_canary: bool = False, 2025-07-17T06:38:24.1385627Z ) -> str: 2025-07-17T06:38:24.1386185Z settings = parse_settings(rollout_state) 2025-07-17T06:38:24.1386764Z user_optins = parse_users(rollout_state) 2025-07-17T06:38:24.1387132Z 2025-07-17T06:38:24.1387304Z fleet_prefix = "" 2025-07-17T06:38:24.1387834Z prefixes = [] 2025-07-17T06:38:24.1388451Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:38:24.1389393Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:38:24.1390101Z log.info( 2025-07-17T06:38:24.1390774Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:38:24.1391524Z ) 2025-07-17T06:38:24.1391893Z continue 2025-07-17T06:38:24.1392139Z 2025-07-17T06:38:24.1392323Z if opt_out_experiments: 2025-07-17T06:38:24.1392844Z if experiment_name in opt_out_experiments: 2025-07-17T06:38:24.1393478Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:38:24.1394060Z log.info( 2025-07-17T06:38:24.1394979Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:38:24.1395953Z ) 2025-07-17T06:38:24.1396338Z continue 2025-07-17T06:38:24.1396603Z 2025-07-17T06:38:24.1396786Z if eligible_experiments: 2025-07-17T06:38:24.1397361Z if experiment_name not in eligible_experiments: 2025-07-17T06:38:24.1398093Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:38:24.1398646Z log.info( 2025-07-17T06:38:24.1399408Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:38:24.1400235Z ) 2025-07-17T06:38:24.1400620Z continue 2025-07-17T06:38:24.1401076Z elif not experiment_settings.default: 2025-07-17T06:38:24.1401596Z log.info( 2025-07-17T06:38:24.1402373Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:38:24.1403106Z ) 2025-07-17T06:38:24.1403475Z continue 2025-07-17T06:38:24.1403717Z 2025-07-17T06:38:24.1403990Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:38:24.1404596Z opted_out_users = [ 2025-07-17T06:38:24.1405027Z requestor 2025-07-17T06:38:24.1405465Z for requestor in workflow_requestors 2025-07-17T06:38:24.1406125Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:38:24.1406741Z ] 2025-07-17T06:38:24.1406946Z 2025-07-17T06:38:24.1407118Z if opted_out_users: 2025-07-17T06:38:24.1407674Z log.info( 2025-07-17T06:38:24.1408298Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:38:24.1408992Z ) 2025-07-17T06:38:24.1409357Z continue 2025-07-17T06:38:24.1409603Z 2025-07-17T06:38:24.1409887Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:38:24.1410506Z opted_in_users = [ 2025-07-17T06:38:24.1410950Z requestor 2025-07-17T06:38:24.1411396Z for requestor in workflow_requestors 2025-07-17T06:38:24.1412052Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:38:24.1412675Z ] 2025-07-17T06:38:24.1412876Z 2025-07-17T06:38:24.1413046Z enabled = False 2025-07-17T06:38:24.1413477Z if opted_in_users: 2025-07-17T06:38:24.1413907Z log.info( 2025-07-17T06:38:24.1414501Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:38:24.1415175Z ) 2025-07-17T06:38:24.1415560Z enabled = True 2025-07-17T06:38:24.1415836Z 2025-07-17T06:38:24.1416045Z elif experiment_settings.rollout_perc: 2025-07-17T06:38:24.1416873Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:38:24.1418094Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:38:24.1418740Z log.info( 2025-07-17T06:38:24.1419611Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:38:24.1420522Z ) 2025-07-17T06:38:24.1420915Z enabled = True 2025-07-17T06:38:24.1421205Z 2025-07-17T06:38:24.1421369Z if enabled: 2025-07-17T06:38:24.1421788Z label = experiment_name 2025-07-17T06:38:24.1422325Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:38:24.1423154Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:38:24.1424041Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:38:24.1424793Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:38:24.1425456Z if is_canary: 2025-07-17T06:38:24.1425938Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:38:24.1426485Z fleet_prefix = label 2025-07-17T06:38:24.1426962Z else: 2025-07-17T06:38:24.1427384Z prefixes.append(label) 2025-07-17T06:38:24.1427825Z 2025-07-17T06:38:24.1428013Z if len(prefixes) > 1: 2025-07-17T06:38:24.1428448Z log.error( 2025-07-17T06:38:24.1429481Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:38:24.1430606Z ) 2025-07-17T06:38:24.1430989Z prefixes = prefixes[:1] 2025-07-17T06:38:24.1431294Z 2025-07-17T06:38:24.1431480Z # Fleet always comes first 2025-07-17T06:38:24.1431953Z if fleet_prefix: 2025-07-17T06:38:24.1432395Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:38:24.1432757Z 2025-07-17T06:38:24.1433121Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:38:24.1433539Z 2025-07-17T06:38:24.1433550Z 2025-07-17T06:38:24.1433999Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:38:24.1434763Z """ 2025-07-17T06:38:24.1435335Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:38:24.1435898Z 2025-07-17T06:38:24.1436283Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:38:24.1436980Z """ 2025-07-17T06:38:24.1437366Z gh = get_gh_client(github_token) 2025-07-17T06:38:24.1438002Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:38:24.1438636Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:38:24.1439077Z 2025-07-17T06:38:24.1439083Z 2025-07-17T06:38:24.1439481Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:38:24.1440242Z for _ in range(num_retries): 2025-07-17T06:38:24.1440716Z try: 2025-07-17T06:38:24.1441127Z req = Request(url=url, headers=headers) 2025-07-17T06:38:24.1441785Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:38:24.1442451Z return json.loads(content) 2025-07-17T06:38:24.1442974Z except Exception as e: 2025-07-17T06:38:24.1443508Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:38:24.1443908Z 2025-07-17T06:38:24.1444283Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:38:24.1444982Z return {} 2025-07-17T06:38:24.1445204Z 2025-07-17T06:38:24.1445210Z 2025-07-17T06:38:24.1445362Z @cache 2025-07-17T06:38:24.1445972Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:38:24.1446720Z """ 2025-07-17T06:38:24.1447103Z Dynamically get PR information 2025-07-17T06:38:24.1447673Z """ 2025-07-17T06:38:24.1448323Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:38:24.1448947Z headers = { 2025-07-17T06:38:24.1449401Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:38:24.1449997Z "Authorization": f"token {github_token}", 2025-07-17T06:38:24.1450526Z } 2025-07-17T06:38:24.1450950Z json_response: dict[str, Any] = download_json( 2025-07-17T06:38:24.1451543Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:38:24.1452083Z headers=headers, 2025-07-17T06:38:24.1452492Z ) 2025-07-17T06:38:24.1452683Z 2025-07-17T06:38:24.1452866Z if not json_response: 2025-07-17T06:38:24.1453423Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:38:24.1454037Z return {} 2025-07-17T06:38:24.1454266Z 2025-07-17T06:38:24.1454441Z return json_response 2025-07-17T06:38:24.1454714Z 2025-07-17T06:38:24.1454721Z 2025-07-17T06:38:24.1455113Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:38:24.1455839Z """ 2025-07-17T06:38:24.1456347Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:38:24.1456994Z """ 2025-07-17T06:38:24.1457471Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:38:24.1458178Z return { 2025-07-17T06:38:24.1458762Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:38:24.1459463Z } 2025-07-17T06:38:24.1459660Z 2025-07-17T06:38:24.1459666Z 2025-07-17T06:38:24.1459838Z def main() -> None: 2025-07-17T06:38:24.1460249Z args = parse_args() 2025-07-17T06:38:24.1460514Z 2025-07-17T06:38:24.1460737Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:38:24.1461120Z 2025-07-17T06:38:24.1461308Z # Check if the PR is opt-out 2025-07-17T06:38:24.1461789Z if args.pr_number: 2025-07-17T06:38:24.1462425Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:38:24.1463328Z if OPT_OUT_LABEL in labels: 2025-07-17T06:38:24.1463832Z log.info( 2025-07-17T06:38:24.1464511Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:38:24.1465268Z ) 2025-07-17T06:38:24.1465806Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:24.1466469Z sys.exit() 2025-07-17T06:38:24.1466723Z 2025-07-17T06:38:24.1466880Z try: 2025-07-17T06:38:24.1467307Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:38:24.1468151Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:38:24.1468839Z ) 2025-07-17T06:38:24.1469042Z 2025-07-17T06:38:24.1469249Z username = get_potential_pr_author( 2025-07-17T06:38:24.1469782Z args.github_token, 2025-07-17T06:38:24.1470255Z args.github_repo, 2025-07-17T06:38:24.1470718Z args.github_actor, 2025-07-17T06:38:24.1471192Z args.github_ref_type, 2025-07-17T06:38:24.1471674Z args.github_branch, 2025-07-17T06:38:24.1472132Z ) 2025-07-17T06:38:24.1472332Z 2025-07-17T06:38:24.1472612Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:38:24.1473065Z 2025-07-17T06:38:24.1473278Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:38:24.1473831Z rollout_state, 2025-07-17T06:38:24.1474297Z (args.github_issue_owner, username), 2025-07-17T06:38:24.1474838Z args.github_branch, 2025-07-17T06:38:24.1475319Z args.eligible_experiments, 2025-07-17T06:38:24.1475844Z args.opt_out_experiments, 2025-07-17T06:38:24.1476333Z is_canary, 2025-07-17T06:38:24.1476734Z ) 2025-07-17T06:38:24.1476932Z 2025-07-17T06:38:24.1477113Z except Exception as e: 2025-07-17T06:38:24.1477649Z log.error( 2025-07-17T06:38:24.1478319Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:38:24.1479209Z ) 2025-07-17T06:38:24.1479415Z 2025-07-17T06:38:24.1479745Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:24.1480240Z 2025-07-17T06:38:24.1480246Z 2025-07-17T06:38:24.1480424Z if __name__ == "__main__": 2025-07-17T06:38:24.1480851Z main() 2025-07-17T06:38:24.1481052Z 2025-07-17T06:38:24.1569913Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:38:24.1570822Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:38:24.1598264Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:24.1598734Z env: 2025-07-17T06:38:24.1599343Z GITHUB_TOKEN: *** 2025-07-17T06:38:24.1599756Z ISSUE_NUMBER: 5132 2025-07-17T06:38:24.1600194Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:24.1600686Z ISSUE_OWNER: 2025-07-17T06:38:24.1601077Z CHECK_EXPERIMENTS: 2025-07-17T06:38:24.1601492Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:24.1601922Z PR_NUMBER: 2025-07-17T06:38:24.1602284Z ##[endgroup] 2025-07-17T06:38:24.5142766Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:38:24.8205856Z Collecting urllib3==1.26.18 2025-07-17T06:38:24.8551339Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:38:24.8746158Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.5 MB/s eta 0:00:00 2025-07-17T06:38:24.8961170Z Collecting PyGithub==2.3.0 2025-07-17T06:38:24.8994336Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:38:24.9405125Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:38:24.9443414Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-07-17T06:38:24.9486397Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:38:24.9503008Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-07-17T06:38:24.9517740Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:38:24.9753710Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:38:24.9785258Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:38:25.0011815Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-07-17T06:38:25.1063359Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:38:25.1099074Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:38:25.2122315Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:38:25.2160701Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:38:25.2334447Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:38:25.2366926Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:38:25.2590852Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:38:25.2655230Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 28.9 MB/s eta 0:00:00 2025-07-17T06:38:25.2688409Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:38:25.2745294Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 88.9 MB/s eta 0:00:00 2025-07-17T06:38:25.2790400Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:38:25.2872372Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 132.1 MB/s eta 0:00:00 2025-07-17T06:38:25.2901911Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:38:25.2959312Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:38:25.3025287Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 95.1 MB/s eta 0:00:00 2025-07-17T06:38:25.3059150Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:38:25.3100214Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 31.0 MB/s eta 0:00:00 2025-07-17T06:38:25.3132497Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:38:25.3173810Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 42.2 MB/s eta 0:00:00 2025-07-17T06:38:25.6048932Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:38:26.1342074Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-07-17T06:38:26.2119235Z ##[group]Run curr_branch="main" 2025-07-17T06:38:26.2119578Z curr_branch="main" 2025-07-17T06:38:26.2119835Z curr_ref_type="branch" 2025-07-17T06:38:26.2120087Z echo "Current branch is '$curr_branch'" 2025-07-17T06:38:26.2120345Z  2025-07-17T06:38:26.2120533Z python3 runner_determinator.py \ 2025-07-17T06:38:26.2120824Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:38:26.2121101Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:38:26.2121364Z  --github-branch "$curr_branch" \ 2025-07-17T06:38:26.2121630Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:38:26.2121921Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:38:26.2122213Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:38:26.2122507Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:38:26.2122849Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:38:26.2123219Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:38:26.2123511Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:38:26.2151976Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:26.2152213Z env: 2025-07-17T06:38:26.2152751Z GITHUB_TOKEN: *** 2025-07-17T06:38:26.2152945Z ISSUE_NUMBER: 5132 2025-07-17T06:38:26.2153156Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:26.2153417Z ISSUE_OWNER: 2025-07-17T06:38:26.2153610Z CHECK_EXPERIMENTS: 2025-07-17T06:38:26.2153809Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:26.2154009Z PR_NUMBER: 2025-07-17T06:38:26.2154181Z ##[endgroup] 2025-07-17T06:38:26.2201737Z Current branch is 'main' 2025-07-17T06:38:27.7582567Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:38:27.7583856Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:38:27.7584543Z INFO : Setting output: label-type='' 2025-07-17T06:38:27.7895767Z Evaluate and set job outputs 2025-07-17T06:38:27.7902078Z Cleaning up orphan processes