2025-10-10T00:01:08.7636775Z Current runner version: '2.328.0' 2025-10-10T00:01:08.7659968Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.7660768Z Hosted Compute Agent 2025-10-10T00:01:08.7661260Z Version: 20250912.392 2025-10-10T00:01:08.7661989Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.7662864Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.7663451Z ##[endgroup] 2025-10-10T00:01:08.7664026Z ##[group]Operating System 2025-10-10T00:01:08.7664585Z Ubuntu 2025-10-10T00:01:08.7665019Z 24.04.3 2025-10-10T00:01:08.7665545Z LTS 2025-10-10T00:01:08.7666038Z ##[endgroup] 2025-10-10T00:01:08.7666482Z ##[group]Runner Image 2025-10-10T00:01:08.7667078Z Image: ubuntu-24.04 2025-10-10T00:01:08.7667534Z Version: 20250929.60.1 2025-10-10T00:01:08.7668529Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.7670088Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.7671505Z ##[endgroup] 2025-10-10T00:01:08.7672654Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.7674770Z Contents: read 2025-10-10T00:01:08.7675404Z Metadata: read 2025-10-10T00:01:08.7675897Z ##[endgroup] 2025-10-10T00:01:08.7677888Z Secret source: Actions 2025-10-10T00:01:08.7678709Z Prepare workflow directory 2025-10-10T00:01:08.8237389Z Prepare all required actions 2025-10-10T00:01:08.8315940Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.8322764Z ##[group] Inputs 2025-10-10T00:01:08.8323673Z check_experiments: 2025-10-10T00:01:08.8324745Z opt_out_experiments: lf 2025-10-10T00:01:08.8325605Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.8326530Z issue_owner: 2025-10-10T00:01:08.8327427Z curr_branch: main 2025-10-10T00:01:08.8328236Z curr_ref_type: branch 2025-10-10T00:01:08.8329154Z issue_number: 5132 2025-10-10T00:01:08.8330155Z ##[endgroup] 2025-10-10T00:01:08.8331109Z Complete job name: get-label-type / runner-determinator 2025-10-10T00:01:09.5465303Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:09.5467839Z cat < runner_determinator.py 2025-10-10T00:01:09.5468576Z # flake8: noqa: G004 2025-10-10T00:01:09.5469180Z  2025-10-10T00:01:09.5469986Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.5471106Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.5472121Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.5473001Z  2025-10-10T00:01:09.5473537Z """ 2025-10-10T00:01:09.5474257Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.5475305Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.5476566Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.5477597Z of which runners should be used to run which job. 2025-10-10T00:01:09.5478291Z  2025-10-10T00:01:09.5479080Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.5480159Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.5481168Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.5482109Z list, defined. 2025-10-10T00:01:09.5482956Z  2025-10-10T00:01:09.5483665Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.5484874Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.5485852Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.5486603Z  2025-10-10T00:01:09.5487691Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.5488726Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.5489645Z experiments which the user could be opted in to. 2025-10-10T00:01:09.5490366Z  2025-10-10T00:01:09.5490927Z The user list has the following rules: 2025-10-10T00:01:09.5491537Z  2025-10-10T00:01:09.5573403Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.5574536Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.5575412Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.5576011Z  2025-10-10T00:01:09.5576397Z Example config: 2025-10-10T00:01:09.5576928Z  # A list of experiments that can be opted into. 2025-10-10T00:01:09.5577684Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.5578396Z  # Expected syntax is: 2025-10-10T00:01:09.5579117Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.5580150Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.5580936Z  2025-10-10T00:01:09.5581310Z  experiments: 2025-10-10T00:01:09.5581755Z  lf: 2025-10-10T00:01:09.5582181Z  rollout_percent: 25 2025-10-10T00:01:09.5582846Z  all_branches: false 2025-10-10T00:01:09.5583375Z  default: true 2025-10-10T00:01:09.5583848Z  --- 2025-10-10T00:01:09.5584244Z  2025-10-10T00:01:09.5584617Z  # Opt-ins: 2025-10-10T00:01:09.5585291Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.5586456Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.5587327Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.5588083Z  # Experiments should be from the above list. 2025-10-10T00:01:09.5588675Z  2025-10-10T00:01:09.5589083Z  @User1,-lf,split_build 2025-10-10T00:01:09.5589591Z  @User2,lf 2025-10-10T00:01:09.5590047Z  @User3,split_build 2025-10-10T00:01:09.5590528Z """ 2025-10-10T00:01:09.5590912Z  2025-10-10T00:01:09.5591289Z import json 2025-10-10T00:01:09.5591725Z import logging 2025-10-10T00:01:09.5592167Z import os 2025-10-10T00:01:09.5592708Z import random 2025-10-10T00:01:09.5593153Z import re 2025-10-10T00:01:09.5593567Z import sys 2025-10-10T00:01:09.5594045Z from argparse import ArgumentParser 2025-10-10T00:01:09.5594712Z from collections.abc import Iterable 2025-10-10T00:01:09.5595302Z from functools import cache 2025-10-10T00:01:09.5595838Z from logging import LogRecord 2025-10-10T00:01:09.5596400Z from typing import Any, NamedTuple 2025-10-10T00:01:09.5597018Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.5597592Z  2025-10-10T00:01:09.5597972Z import yaml 2025-10-10T00:01:09.5598429Z from github import Auth, Github 2025-10-10T00:01:09.5598992Z from github.Issue import Issue 2025-10-10T00:01:09.5599504Z  2025-10-10T00:01:09.5599876Z  2025-10-10T00:01:09.5600338Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.5601114Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.5602085Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.5602954Z  2025-10-10T00:01:09.5603638Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.5604277Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.5604878Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.5605533Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.5606089Z  2025-10-10T00:01:09.5606525Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.5607062Z  2025-10-10T00:01:09.5607469Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.5607991Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.5608485Z  2025-10-10T00:01:09.5608850Z  2025-10-10T00:01:09.5609266Z class Experiment(NamedTuple): 2025-10-10T00:01:09.5609809Z  rollout_perc: float = ( 2025-10-10T00:01:09.5610555Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.5611292Z  ) 2025-10-10T00:01:09.5611709Z  all_branches: bool = ( 2025-10-10T00:01:09.5612436Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.5613425Z  ) 2025-10-10T00:01:09.5613843Z  default: bool = ( 2025-10-10T00:01:09.5614518Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.5615218Z  ) 2025-10-10T00:01:09.5615604Z  2025-10-10T00:01:09.5616003Z  # Add more fields as needed 2025-10-10T00:01:09.5616520Z  2025-10-10T00:01:09.5616882Z  2025-10-10T00:01:09.5617286Z class Settings(NamedTuple): 2025-10-10T00:01:09.5617787Z  """ 2025-10-10T00:01:09.5618320Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:09.5618934Z  """ 2025-10-10T00:01:09.5619330Z  2025-10-10T00:01:09.5619771Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.5620336Z  2025-10-10T00:01:09.5620833Z  2025-10-10T00:01:09.5621292Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.5621995Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.5622738Z  2025-10-10T00:01:09.5623127Z  COLORS = { 2025-10-10T00:01:09.5623610Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.5624176Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.5624734Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.5625292Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.5625849Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.5626370Z  } 2025-10-10T00:01:09.5626754Z  2025-10-10T00:01:09.5627200Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.5628018Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.5628860Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.5629487Z  return super().format(record) 2025-10-10T00:01:09.5630036Z  2025-10-10T00:01:09.5630403Z  2025-10-10T00:01:09.5630824Z handler = logging.StreamHandler() 2025-10-10T00:01:09.5631621Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.5632387Z  2025-10-10T00:01:09.5632979Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.5633643Z log.addHandler(handler) 2025-10-10T00:01:09.5634158Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.5634652Z  2025-10-10T00:01:09.5635020Z  2025-10-10T00:01:09.5635512Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.5636131Z  """ 2025-10-10T00:01:09.5636710Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.5637536Z  """ 2025-10-10T00:01:09.5637956Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:09.5639114Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.5640308Z  log.warning( 2025-10-10T00:01:09.5641266Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.5642254Z  ) 2025-10-10T00:01:09.5642858Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.5643461Z  return 2025-10-10T00:01:09.5643907Z  2025-10-10T00:01:09.5644335Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.5644978Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.5645592Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:09.5646121Z  2025-10-10T00:01:09.5646486Z  2025-10-10T00:01:09.5647043Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.5647754Z  return frozenset( 2025-10-10T00:01:09.5648457Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.5649188Z  ) 2025-10-10T00:01:09.5649582Z  2025-10-10T00:01:09.5649953Z  2025-10-10T00:01:09.5650353Z def parse_args() -> Any: 2025-10-10T00:01:09.5651016Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.5651958Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.5653318Z  parser.add_argument( 2025-10-10T00:01:09.5653878Z  "--github-issue-repo", 2025-10-10T00:01:09.5654432Z  type=str, 2025-10-10T00:01:09.5654916Z  required=False, 2025-10-10T00:01:09.5655586Z  default="pytorch/test-infra", 2025-10-10T00:01:09.5656214Z  help="GitHub repo to get the issue", 2025-10-10T00:01:09.5656772Z  ) 2025-10-10T00:01:09.5657188Z  parser.add_argument( 2025-10-10T00:01:09.5657699Z  "--github-repo", 2025-10-10T00:01:09.5658194Z  type=str, 2025-10-10T00:01:09.5658672Z  required=True, 2025-10-10T00:01:09.5659217Z  help="GitHub repo where CI is running", 2025-10-10T00:01:09.5659787Z  ) 2025-10-10T00:01:09.5660214Z  parser.add_argument( 2025-10-10T00:01:09.5660918Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.5661619Z  ) 2025-10-10T00:01:09.5662046Z  parser.add_argument( 2025-10-10T00:01:09.5662881Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.5663669Z  ) 2025-10-10T00:01:09.5664096Z  parser.add_argument( 2025-10-10T00:01:09.5664825Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.5665567Z  ) 2025-10-10T00:01:09.5665988Z  parser.add_argument( 2025-10-10T00:01:09.5666755Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.5667518Z  ) 2025-10-10T00:01:09.5667954Z  parser.add_argument( 2025-10-10T00:01:09.5668475Z  "--github-ref-type", 2025-10-10T00:01:09.5668994Z  type=str, 2025-10-10T00:01:09.5669464Z  required=True, 2025-10-10T00:01:09.5670046Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.5670637Z  ) 2025-10-10T00:01:09.5671053Z  parser.add_argument( 2025-10-10T00:01:09.5671736Z  "--eligible-experiments", 2025-10-10T00:01:09.5672337Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.5673025Z  required=False, 2025-10-10T00:01:09.5673520Z  default="", 2025-10-10T00:01:09.5674472Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.5675444Z  ) 2025-10-10T00:01:09.5675863Z  parser.add_argument( 2025-10-10T00:01:09.5676397Z  "--opt-out-experiments", 2025-10-10T00:01:09.5676978Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.5677553Z  required=False, 2025-10-10T00:01:09.5678045Z  default="", 2025-10-10T00:01:09.5678513Z  help=( 2025-10-10T00:01:09.5679270Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.5680486Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.5681377Z  ), 2025-10-10T00:01:09.5681796Z  ) 2025-10-10T00:01:09.5682221Z  parser.add_argument( 2025-10-10T00:01:09.5682831Z  "--pr-number", 2025-10-10T00:01:09.5683331Z  type=str, 2025-10-10T00:01:09.5683802Z  required=False, 2025-10-10T00:01:09.5684302Z  default="", 2025-10-10T00:01:09.5684876Z  help="the optional PR number where this is run", 2025-10-10T00:01:09.5685493Z  ) 2025-10-10T00:01:09.5685886Z  2025-10-10T00:01:09.5686299Z  return parser.parse_args() 2025-10-10T00:01:09.5686828Z  2025-10-10T00:01:09.5687189Z  2025-10-10T00:01:09.5687841Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.5688786Z  auth = Auth.Token(github_token) 2025-10-10T00:01:09.5689387Z  return Github(auth=auth) 2025-10-10T00:01:09.5689895Z  2025-10-10T00:01:09.5690260Z  2025-10-10T00:01:09.5690984Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.5691852Z  repo = gh.get_repo(repo) 2025-10-10T00:01:09.5692444Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.5693128Z  2025-10-10T00:01:09.5693506Z  2025-10-10T00:01:09.5693906Z def get_potential_pr_author( 2025-10-10T00:01:09.5694645Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.5695379Z ) -> str: 2025-10-10T00:01:09.5695973Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.5696858Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.5697684Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:09.5698308Z  2025-10-10T00:01:09.5698729Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.5699264Z  2025-10-10T00:01:09.5699773Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.5700460Z  split_tag = ref_name.split("/") 2025-10-10T00:01:09.5701013Z  if ( 2025-10-10T00:01:09.5701461Z  len(split_tag) == 3 2025-10-10T00:01:09.5702028Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:09.5702705Z  and split_tag[2].isnumeric() 2025-10-10T00:01:09.5703260Z  ): 2025-10-10T00:01:09.5703723Z  pr_number = split_tag[2] 2025-10-10T00:01:09.5704265Z  try: 2025-10-10T00:01:09.5704775Z  repository = gh.get_repo(repo) 2025-10-10T00:01:09.5705593Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.5706267Z  except Exception as e: 2025-10-10T00:01:09.5706856Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:09.5707595Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.5708295Z  ) from e 2025-10-10T00:01:09.5708924Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.5709696Z  # In all other cases, return the original input username 2025-10-10T00:01:09.5710338Z  return username 2025-10-10T00:01:09.5710803Z  2025-10-10T00:01:09.5711171Z  2025-10-10T00:01:09.5711638Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.5712228Z  """ 2025-10-10T00:01:09.5713056Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.5713897Z  """ 2025-10-10T00:01:09.5714510Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.5715229Z  2025-10-10T00:01:09.5715596Z  2025-10-10T00:01:09.5716027Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.5716579Z  try: 2025-10-10T00:01:09.5717031Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.5717592Z  return data 2025-10-10T00:01:09.5718084Z  except yaml.YAMLError: 2025-10-10T00:01:09.5718649Z  log.exception("Error loading YAML") 2025-10-10T00:01:09.5719210Z  raise 2025-10-10T00:01:09.5719637Z  2025-10-10T00:01:09.5720003Z  2025-10-10T00:01:09.5720671Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.5721469Z  """ 2025-10-10T00:01:09.5722285Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.5723204Z  2025-10-10T00:01:09.5723791Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.5724640Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.5725247Z  2025-10-10T00:01:09.5725868Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.5726620Z  """ 2025-10-10T00:01:09.5727122Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.5728019Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.5728702Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.5729332Z  else: 2025-10-10T00:01:09.5729769Z  return "", rollout_state 2025-10-10T00:01:09.5730283Z  2025-10-10T00:01:09.5730655Z  2025-10-10T00:01:09.5731086Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.5731641Z  """ 2025-10-10T00:01:09.5732221Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.5733011Z  """ 2025-10-10T00:01:09.5733388Z  2025-10-10T00:01:09.5733748Z  2025-10-10T00:01:09.5734318Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.5735016Z  """ 2025-10-10T00:01:09.5735801Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.5736681Z  2025-10-10T00:01:09.5737538Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.5738596Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.5739485Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.5740169Z  2025-10-10T00:01:09.5740524Z  2025-10-10T00:01:09.5740885Z  """ 2025-10-10T00:01:09.5741296Z  optins = UserOptins() 2025-10-10T00:01:09.5741867Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.5742474Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:09.5743200Z  if not user or not user.startswith("@"): 2025-10-10T00:01:09.5743840Z  # Not a valid user. Skip 2025-10-10T00:01:09.5744384Z  continue 2025-10-10T00:01:09.5744837Z  2025-10-10T00:01:09.5745202Z  if user: 2025-10-10T00:01:09.5745718Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.5746468Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.5747148Z  2025-10-10T00:01:09.5747528Z  return optins 2025-10-10T00:01:09.5747978Z  2025-10-10T00:01:09.5748331Z  2025-10-10T00:01:09.5748866Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.5749520Z  """ 2025-10-10T00:01:09.5749973Z  Check if the experiment name is valid. 2025-10-10T00:01:09.5750547Z  A valid name: 2025-10-10T00:01:09.5751266Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.5752269Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.5753158Z  - Cannot contain spaces 2025-10-10T00:01:09.5753678Z  """ 2025-10-10T00:01:09.5754071Z  2025-10-10T00:01:09.5754561Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.5755512Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.5756374Z  2025-10-10T00:01:09.5756759Z  if valid: 2025-10-10T00:01:09.5757198Z  return True 2025-10-10T00:01:09.5757648Z  2025-10-10T00:01:09.5758019Z  log.error( 2025-10-10T00:01:09.5759561Z  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-10-10T00:01:09.5761171Z  ) 2025-10-10T00:01:09.5761567Z  return False 2025-10-10T00:01:09.5762011Z  2025-10-10T00:01:09.5762361Z  2025-10-10T00:01:09.5763041Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.5763757Z  """ 2025-10-10T00:01:09.5764408Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.5765179Z  """ 2025-10-10T00:01:09.5765568Z  try: 2025-10-10T00:01:09.5765987Z  if settings_text: 2025-10-10T00:01:09.5766791Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.5767636Z  # for easy reading 2025-10-10T00:01:09.5768546Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.5769506Z  # the backtick character in shell commands. 2025-10-10T00:01:09.5770176Z  backtick = chr(96) # backtick character 2025-10-10T00:01:09.5770907Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.5771631Z  settings = load_yaml(settings_text) 2025-10-10T00:01:09.5772175Z  2025-10-10T00:01:09.5773069Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.5774029Z  experiments = {} 2025-10-10T00:01:09.5774530Z  2025-10-10T00:01:09.5775135Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.5775952Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.5777123Z  # 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-10-10T00:01:09.5778223Z  continue 2025-10-10T00:01:09.5778709Z  2025-10-10T00:01:09.5779114Z  valid_settings = {} 2025-10-10T00:01:09.5779688Z  for setting in exp_settings: 2025-10-10T00:01:09.5780311Z  if setting not in Experiment._fields: 2025-10-10T00:01:09.5780924Z  log.warning( 2025-10-10T00:01:09.5781711Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.5782462Z  ) 2025-10-10T00:01:09.5783056Z  else: 2025-10-10T00:01:09.5783652Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.5784262Z  2025-10-10T00:01:09.5784771Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.5785469Z  return Settings(experiments) 2025-10-10T00:01:09.5786000Z  2025-10-10T00:01:09.5786392Z  except Exception: 2025-10-10T00:01:09.5786946Z  log.exception("Failed to parse settings") 2025-10-10T00:01:09.5787522Z  2025-10-10T00:01:09.5787898Z  return Settings() 2025-10-10T00:01:09.5788365Z  2025-10-10T00:01:09.5788716Z  2025-10-10T00:01:09.5789339Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.5789969Z  """ 2025-10-10T00:01:09.5790458Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.5791048Z  2025-10-10T00:01:09.5791624Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.5792439Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.5793142Z  2025-10-10T00:01:09.5793781Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.5794549Z  """ 2025-10-10T00:01:09.5795163Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.5795986Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.5796571Z  2025-10-10T00:01:09.5796931Z  2025-10-10T00:01:09.5797421Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.5798037Z  """ 2025-10-10T00:01:09.5798478Z  Parse users from the rollout state. 2025-10-10T00:01:09.5799020Z  2025-10-10T00:01:09.5799381Z  """ 2025-10-10T00:01:09.5799976Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.5800785Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.5801366Z  2025-10-10T00:01:09.5801728Z  2025-10-10T00:01:09.5802387Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.5803290Z  """ 2025-10-10T00:01:09.5803764Z  Check if a user is opted into an experiment 2025-10-10T00:01:09.5804333Z  """ 2025-10-10T00:01:09.5804851Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.5805460Z  2025-10-10T00:01:09.5805949Z  2025-10-10T00:01:09.5806621Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.5807424Z  """ 2025-10-10T00:01:09.5807936Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.5808559Z  """ 2025-10-10T00:01:09.5809133Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.5809879Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.5810584Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.5811225Z  return False 2025-10-10T00:01:09.5811681Z  2025-10-10T00:01:09.5812185Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.5812949Z  log.warning( 2025-10-10T00:01:09.5813852Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.5814775Z  ) 2025-10-10T00:01:09.5815176Z  2025-10-10T00:01:09.5815546Z  return True 2025-10-10T00:01:09.5815978Z  2025-10-10T00:01:09.5816331Z  2025-10-10T00:01:09.5816719Z def get_runner_prefix( 2025-10-10T00:01:09.5817218Z  rollout_state: str, 2025-10-10T00:01:09.5817753Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:09.5818311Z  branch: str, 2025-10-10T00:01:09.5818881Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.5819614Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.5820244Z  is_canary: bool = False, 2025-10-10T00:01:09.5820746Z ) -> str: 2025-10-10T00:01:09.5821244Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:09.5821889Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.5822446Z  2025-10-10T00:01:09.5823055Z  fleet_prefix = "" 2025-10-10T00:01:09.5823552Z  prefixes = [] 2025-10-10T00:01:09.5824261Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.5825264Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.5826015Z  log.info( 2025-10-10T00:01:09.5826774Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.5827563Z  ) 2025-10-10T00:01:09.5828005Z  continue 2025-10-10T00:01:09.5828461Z  2025-10-10T00:01:09.5828858Z  if opt_out_experiments: 2025-10-10T00:01:09.5829463Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.5830173Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.5830889Z  log.info( 2025-10-10T00:01:09.5831902Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.5833024Z  ) 2025-10-10T00:01:09.5833491Z  continue 2025-10-10T00:01:09.5833965Z  2025-10-10T00:01:09.5834373Z  if eligible_experiments: 2025-10-10T00:01:09.5835004Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.5835697Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.5836294Z  log.info( 2025-10-10T00:01:09.5837141Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.5838015Z  ) 2025-10-10T00:01:09.5838474Z  continue 2025-10-10T00:01:09.5839172Z  elif not experiment_settings.default: 2025-10-10T00:01:09.5839749Z  log.info( 2025-10-10T00:01:09.5840482Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.5841262Z  ) 2025-10-10T00:01:09.5841695Z  continue 2025-10-10T00:01:09.5842152Z  2025-10-10T00:01:09.5842759Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.5843430Z  opted_out_users = [ 2025-10-10T00:01:09.5843944Z  requestor 2025-10-10T00:01:09.5844469Z  for requestor in workflow_requestors 2025-10-10T00:01:09.5845213Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.5845883Z  ] 2025-10-10T00:01:09.5846282Z  2025-10-10T00:01:09.5846675Z  if opted_out_users: 2025-10-10T00:01:09.5847215Z  log.info( 2025-10-10T00:01:09.5847925Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.5848675Z  ) 2025-10-10T00:01:09.5849120Z  continue 2025-10-10T00:01:09.5849575Z  2025-10-10T00:01:09.5850084Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.5850737Z  opted_in_users = [ 2025-10-10T00:01:09.5851264Z  requestor 2025-10-10T00:01:09.5851788Z  for requestor in workflow_requestors 2025-10-10T00:01:09.5852617Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.5853292Z  ] 2025-10-10T00:01:09.5853693Z  2025-10-10T00:01:09.5854078Z  enabled = False 2025-10-10T00:01:09.5854576Z  if opted_in_users: 2025-10-10T00:01:09.5855214Z  log.info( 2025-10-10T00:01:09.5855903Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.5856626Z  ) 2025-10-10T00:01:09.5857070Z  enabled = True 2025-10-10T00:01:09.5857554Z  2025-10-10T00:01:09.5857997Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.5858885Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.5859887Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.5860591Z  log.info( 2025-10-10T00:01:09.5861540Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.5862606Z  ) 2025-10-10T00:01:09.5863088Z  enabled = True 2025-10-10T00:01:09.5863621Z  2025-10-10T00:01:09.5863999Z  if enabled: 2025-10-10T00:01:09.5864504Z  label = experiment_name 2025-10-10T00:01:09.5865116Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.5866008Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.5866941Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.5867751Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.5868460Z  if is_canary: 2025-10-10T00:01:09.5869018Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.5869610Z  fleet_prefix = label 2025-10-10T00:01:09.5870151Z  else: 2025-10-10T00:01:09.5870798Z  prefixes.append(label) 2025-10-10T00:01:09.5871341Z  2025-10-10T00:01:09.5871730Z  if len(prefixes) > 1: 2025-10-10T00:01:09.5872244Z  log.error( 2025-10-10T00:01:09.5873466Z  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-10-10T00:01:09.5874633Z  ) 2025-10-10T00:01:09.5875080Z  prefixes = prefixes[:1] 2025-10-10T00:01:09.5875590Z  2025-10-10T00:01:09.5875990Z  # Fleet always comes first 2025-10-10T00:01:09.5876517Z  if fleet_prefix: 2025-10-10T00:01:09.5877041Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.5877583Z  2025-10-10T00:01:09.5878071Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.5878679Z  2025-10-10T00:01:09.5879045Z  2025-10-10T00:01:09.5879727Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.5880538Z  """ 2025-10-10T00:01:09.5881189Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.5881934Z  2025-10-10T00:01:09.5882652Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.5883402Z  """ 2025-10-10T00:01:09.5883845Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.5884451Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.5885151Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.5885789Z  2025-10-10T00:01:09.5886150Z  2025-10-10T00:01:09.5886796Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.5887729Z  for _ in range(num_retries): 2025-10-10T00:01:09.5888263Z  try: 2025-10-10T00:01:09.5888761Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:09.5889472Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.5890180Z  return json.loads(content) 2025-10-10T00:01:09.5890750Z  except Exception as e: 2025-10-10T00:01:09.5891363Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.5891956Z  2025-10-10T00:01:09.5892672Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.5893445Z  return {} 2025-10-10T00:01:09.5893870Z  2025-10-10T00:01:09.5894234Z  2025-10-10T00:01:09.5894602Z @cache 2025-10-10T00:01:09.5895297Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.5896102Z  """ 2025-10-10T00:01:09.5896544Z  Dynamically get PR information 2025-10-10T00:01:09.5897075Z  """ 2025-10-10T00:01:09.5897638Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.5898309Z  headers = { 2025-10-10T00:01:09.5898836Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.5899496Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:09.5900064Z  } 2025-10-10T00:01:09.5900554Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.5901211Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.5901804Z  headers=headers, 2025-10-10T00:01:09.5902292Z  ) 2025-10-10T00:01:09.5902773Z  2025-10-10T00:01:09.5903167Z  if not json_response: 2025-10-10T00:01:09.5903817Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.5904624Z  return {} 2025-10-10T00:01:09.5905070Z  2025-10-10T00:01:09.5905462Z  return json_response 2025-10-10T00:01:09.5905940Z  2025-10-10T00:01:09.5906303Z  2025-10-10T00:01:09.5906939Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.5907706Z  """ 2025-10-10T00:01:09.5908293Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.5908983Z  """ 2025-10-10T00:01:09.5909525Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.5910170Z  return { 2025-10-10T00:01:09.5910826Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.5911560Z  } 2025-10-10T00:01:09.5911938Z  2025-10-10T00:01:09.5912304Z  2025-10-10T00:01:09.5912798Z def main() -> None: 2025-10-10T00:01:09.5913293Z  args = parse_args() 2025-10-10T00:01:09.5913767Z  2025-10-10T00:01:09.5914224Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.5914793Z  2025-10-10T00:01:09.5915198Z  # Check if the PR is opt-out 2025-10-10T00:01:09.5915740Z  if args.pr_number: 2025-10-10T00:01:09.5916478Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.5917282Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.5917821Z  log.info( 2025-10-10T00:01:09.5918584Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.5919380Z  ) 2025-10-10T00:01:09.5920005Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.5920733Z  sys.exit() 2025-10-10T00:01:09.5921317Z  2025-10-10T00:01:09.5921691Z  try: 2025-10-10T00:01:09.5922184Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.5923075Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.5923755Z  ) 2025-10-10T00:01:09.5924164Z  2025-10-10T00:01:09.5924589Z  username = get_potential_pr_author( 2025-10-10T00:01:09.5925181Z  args.github_token, 2025-10-10T00:01:09.5925725Z  args.github_repo, 2025-10-10T00:01:09.5926255Z  args.github_actor, 2025-10-10T00:01:09.5926811Z  args.github_ref_type, 2025-10-10T00:01:09.5927355Z  args.github_branch, 2025-10-10T00:01:09.5927875Z  ) 2025-10-10T00:01:09.5928280Z  2025-10-10T00:01:09.5928803Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.5929459Z  2025-10-10T00:01:09.5929904Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.5930502Z  rollout_state, 2025-10-10T00:01:09.5931060Z  (args.github_issue_owner, username), 2025-10-10T00:01:09.5931655Z  args.github_branch, 2025-10-10T00:01:09.5932217Z  args.eligible_experiments, 2025-10-10T00:01:09.5933116Z  args.opt_out_experiments, 2025-10-10T00:01:09.5933683Z  is_canary, 2025-10-10T00:01:09.5934171Z  ) 2025-10-10T00:01:09.5934577Z  2025-10-10T00:01:09.5934973Z  except Exception as e: 2025-10-10T00:01:09.5935490Z  log.error( 2025-10-10T00:01:09.5936248Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.5937062Z  ) 2025-10-10T00:01:09.5937619Z  2025-10-10T00:01:09.5938199Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.5938895Z  2025-10-10T00:01:09.5939256Z  2025-10-10T00:01:09.5939647Z if __name__ == "__main__": 2025-10-10T00:01:09.5940145Z  main() 2025-10-10T00:01:09.5940555Z  2025-10-10T00:01:09.5940915Z EOF 2025-10-10T00:01:09.5941291Z  2025-10-10T00:01:09.5941685Z cat runner_determinator.py 2025-10-10T00:01:09.7551874Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.7553096Z env: 2025-10-10T00:01:09.7553802Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.7554285Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.7554750Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.7555252Z ISSUE_OWNER: 2025-10-10T00:01:09.7555660Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.7556087Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:09.7556525Z PR_NUMBER: 2025-10-10T00:01:09.7556928Z ##[endgroup] 2025-10-10T00:01:09.7765201Z # flake8: noqa: G004 2025-10-10T00:01:09.7765557Z 2025-10-10T00:01:09.7765990Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.7766937Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.7767756Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.7768202Z 2025-10-10T00:01:09.7768363Z """ 2025-10-10T00:01:09.7768931Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.7769805Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.7770693Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.7771496Z of which runners should be used to run which job. 2025-10-10T00:01:09.7771896Z 2025-10-10T00:01:09.7772297Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.7773664Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.7774567Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.7775264Z list, defined. 2025-10-10T00:01:09.7775499Z 2025-10-10T00:01:09.7775867Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.7776791Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.7777619Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.7778064Z 2025-10-10T00:01:09.7778436Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.7779305Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.7780049Z experiments which the user could be opted in to. 2025-10-10T00:01:09.7780447Z 2025-10-10T00:01:09.7780646Z The user list has the following rules: 2025-10-10T00:01:09.7780997Z 2025-10-10T00:01:09.7781316Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.7782184Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.7783224Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.7783627Z 2025-10-10T00:01:09.7783804Z Example config: 2025-10-10T00:01:09.7784295Z # A list of experiments that can be opted into. 2025-10-10T00:01:09.7784967Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.7785584Z # Expected syntax is: 2025-10-10T00:01:09.7786243Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.7787216Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.7787821Z 2025-10-10T00:01:09.7787995Z experiments: 2025-10-10T00:01:09.7788391Z lf: 2025-10-10T00:01:09.7788763Z rollout_percent: 25 2025-10-10T00:01:09.7789397Z all_branches: false 2025-10-10T00:01:09.7789845Z default: true 2025-10-10T00:01:09.7790256Z --- 2025-10-10T00:01:09.7790458Z 2025-10-10T00:01:09.7790620Z # Opt-ins: 2025-10-10T00:01:09.7791191Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.7792045Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.7793068Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.7793727Z # Experiments should be from the above list. 2025-10-10T00:01:09.7794103Z 2025-10-10T00:01:09.7794283Z @User1,-lf,split_build 2025-10-10T00:01:09.7794712Z @User2,lf 2025-10-10T00:01:09.7795088Z @User3,split_build 2025-10-10T00:01:09.7795495Z """ 2025-10-10T00:01:09.7795683Z 2025-10-10T00:01:09.7795844Z import json 2025-10-10T00:01:09.7796218Z import logging 2025-10-10T00:01:09.7796595Z import os 2025-10-10T00:01:09.7796959Z import random 2025-10-10T00:01:09.7797335Z import re 2025-10-10T00:01:09.7797705Z import sys 2025-10-10T00:01:09.7798104Z from argparse import ArgumentParser 2025-10-10T00:01:09.7798631Z from collections.abc import Iterable 2025-10-10T00:01:09.7799149Z from functools import cache 2025-10-10T00:01:09.7799622Z from logging import LogRecord 2025-10-10T00:01:09.7800104Z from typing import Any, NamedTuple 2025-10-10T00:01:09.7800627Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.7801014Z 2025-10-10T00:01:09.7801174Z import yaml 2025-10-10T00:01:09.7801562Z from github import Auth, Github 2025-10-10T00:01:09.7802046Z from github.Issue import Issue 2025-10-10T00:01:09.7802350Z 2025-10-10T00:01:09.7802356Z 2025-10-10T00:01:09.7802796Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.7803509Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.7804386Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.7804944Z 2025-10-10T00:01:09.7805169Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.7805907Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.7806437Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.7806988Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.7807340Z 2025-10-10T00:01:09.7807544Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.7807872Z 2025-10-10T00:01:09.7808056Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.7808519Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.7808800Z 2025-10-10T00:01:09.7808805Z 2025-10-10T00:01:09.7808995Z class Experiment(NamedTuple): 2025-10-10T00:01:09.7809478Z rollout_perc: float = ( 2025-10-10T00:01:09.7810107Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.7810783Z ) 2025-10-10T00:01:09.7811151Z all_branches: bool = ( 2025-10-10T00:01:09.7811763Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.7812483Z ) 2025-10-10T00:01:09.7813077Z default: bool = ( 2025-10-10T00:01:09.7813652Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.7814309Z ) 2025-10-10T00:01:09.7814507Z 2025-10-10T00:01:09.7814682Z # Add more fields as needed 2025-10-10T00:01:09.7814981Z 2025-10-10T00:01:09.7814987Z 2025-10-10T00:01:09.7815180Z class Settings(NamedTuple): 2025-10-10T00:01:09.7815614Z """ 2025-10-10T00:01:09.7816060Z Settings for the experiments that can be opted into. 2025-10-10T00:01:09.7816617Z """ 2025-10-10T00:01:09.7816810Z 2025-10-10T00:01:09.7817014Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.7817372Z 2025-10-10T00:01:09.7817379Z 2025-10-10T00:01:09.7817586Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.7818204Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.7818631Z 2025-10-10T00:01:09.7818795Z COLORS = { 2025-10-10T00:01:09.7819184Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.7819842Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.7820336Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.7820826Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.7821296Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.7821753Z } 2025-10-10T00:01:09.7821942Z 2025-10-10T00:01:09.7822154Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.7823140Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.7823921Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.7824493Z return super().format(record) 2025-10-10T00:01:09.7824834Z 2025-10-10T00:01:09.7824841Z 2025-10-10T00:01:09.7825035Z handler = logging.StreamHandler() 2025-10-10T00:01:09.7825730Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.7826283Z 2025-10-10T00:01:09.7826527Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.7827097Z log.addHandler(handler) 2025-10-10T00:01:09.7827550Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.7827834Z 2025-10-10T00:01:09.7827840Z 2025-10-10T00:01:09.7828089Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.7828647Z """ 2025-10-10T00:01:09.7829156Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.7829775Z """ 2025-10-10T00:01:09.7830140Z if not GITHUB_OUTPUT: 2025-10-10T00:01:09.7831197Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.7832359Z log.warning( 2025-10-10T00:01:09.7833452Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.7834392Z ) 2025-10-10T00:01:09.7844581Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.7845206Z return 2025-10-10T00:01:09.7845447Z 2025-10-10T00:01:09.7845843Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.7846433Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.7847001Z f.write(f"{key}={value}\n") 2025-10-10T00:01:09.7847329Z 2025-10-10T00:01:09.7847336Z 2025-10-10T00:01:09.7847641Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.7848263Z return frozenset( 2025-10-10T00:01:09.7848866Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.7849598Z ) 2025-10-10T00:01:09.7849804Z 2025-10-10T00:01:09.7849810Z 2025-10-10T00:01:09.7849994Z def parse_args() -> Any: 2025-10-10T00:01:09.7850545Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.7851413Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.7852201Z parser.add_argument( 2025-10-10T00:01:09.7852942Z "--github-issue-repo", 2025-10-10T00:01:09.7853459Z type=str, 2025-10-10T00:01:09.7904924Z required=False, 2025-10-10T00:01:09.7905602Z default="pytorch/test-infra", 2025-10-10T00:01:09.7906218Z help="GitHub repo to get the issue", 2025-10-10T00:01:09.7906736Z ) 2025-10-10T00:01:09.7907108Z parser.add_argument( 2025-10-10T00:01:09.7907555Z "--github-repo", 2025-10-10T00:01:09.7907983Z type=str, 2025-10-10T00:01:09.7908376Z required=True, 2025-10-10T00:01:09.7908834Z help="GitHub repo where CI is running", 2025-10-10T00:01:09.7909363Z ) 2025-10-10T00:01:09.7909726Z parser.add_argument( 2025-10-10T00:01:09.7910330Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.7910987Z ) 2025-10-10T00:01:09.7911348Z parser.add_argument( 2025-10-10T00:01:09.7912001Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.7912802Z ) 2025-10-10T00:01:09.7913172Z parser.add_argument( 2025-10-10T00:01:09.7914064Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.7914770Z ) 2025-10-10T00:01:09.7915134Z parser.add_argument( 2025-10-10T00:01:09.7915788Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.7916495Z ) 2025-10-10T00:01:09.7916854Z parser.add_argument( 2025-10-10T00:01:09.7917300Z "--github-ref-type", 2025-10-10T00:01:09.7917751Z type=str, 2025-10-10T00:01:09.7918145Z required=True, 2025-10-10T00:01:09.7918623Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.7919177Z ) 2025-10-10T00:01:09.7919543Z parser.add_argument( 2025-10-10T00:01:09.7920003Z "--eligible-experiments", 2025-10-10T00:01:09.7920505Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.7921025Z required=False, 2025-10-10T00:01:09.7921443Z default="", 2025-10-10T00:01:09.7922284Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.7923360Z ) 2025-10-10T00:01:09.7923726Z parser.add_argument( 2025-10-10T00:01:09.7924177Z "--opt-out-experiments", 2025-10-10T00:01:09.7924675Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.7925189Z required=False, 2025-10-10T00:01:09.7925602Z default="", 2025-10-10T00:01:09.7925987Z help=( 2025-10-10T00:01:09.7926647Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.7927767Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.7928589Z ), 2025-10-10T00:01:09.7928934Z ) 2025-10-10T00:01:09.7929302Z parser.add_argument( 2025-10-10T00:01:09.7929731Z "--pr-number", 2025-10-10T00:01:09.7930138Z type=str, 2025-10-10T00:01:09.7930525Z required=False, 2025-10-10T00:01:09.7930949Z default="", 2025-10-10T00:01:09.7931542Z help="the optional PR number where this is run", 2025-10-10T00:01:09.7932109Z ) 2025-10-10T00:01:09.7932304Z 2025-10-10T00:01:09.7932496Z return parser.parse_args() 2025-10-10T00:01:09.7932920Z 2025-10-10T00:01:09.7932927Z 2025-10-10T00:01:09.7933337Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.7934096Z auth = Auth.Token(github_token) 2025-10-10T00:01:09.7934595Z return Github(auth=auth) 2025-10-10T00:01:09.7934893Z 2025-10-10T00:01:09.7934900Z 2025-10-10T00:01:09.7935351Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.7936147Z repo = gh.get_repo(repo) 2025-10-10T00:01:09.7936637Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.7936995Z 2025-10-10T00:01:09.7937002Z 2025-10-10T00:01:09.7937192Z def get_potential_pr_author( 2025-10-10T00:01:09.7937826Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.7938506Z ) -> str: 2025-10-10T00:01:09.7939008Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.7939797Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.7940528Z # embedded in the tag name: ciflow// 2025-10-10T00:01:09.7940938Z 2025-10-10T00:01:09.7941126Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.7941456Z 2025-10-10T00:01:09.7941729Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.7942339Z split_tag = ref_name.split("/") 2025-10-10T00:01:09.7942945Z if ( 2025-10-10T00:01:09.7943327Z len(split_tag) == 3 2025-10-10T00:01:09.7943808Z and split_tag[0] == "ciflow" 2025-10-10T00:01:09.7944330Z and split_tag[2].isnumeric() 2025-10-10T00:01:09.7944819Z ): 2025-10-10T00:01:09.7945197Z pr_number = split_tag[2] 2025-10-10T00:01:09.7945819Z try: 2025-10-10T00:01:09.7946242Z repository = gh.get_repo(repo) 2025-10-10T00:01:09.7946843Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.7947443Z except Exception as e: 2025-10-10T00:01:09.7947950Z raise Exception( # noqa: TRY002 2025-10-10T00:01:09.7948609Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.7949274Z ) from e 2025-10-10T00:01:09.7949809Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.7950497Z # In all other cases, return the original input username 2025-10-10T00:01:09.7951073Z return username 2025-10-10T00:01:09.7951311Z 2025-10-10T00:01:09.7951318Z 2025-10-10T00:01:09.7951541Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.7952068Z """ 2025-10-10T00:01:09.7952806Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.7953581Z """ 2025-10-10T00:01:09.7954119Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.7954644Z 2025-10-10T00:01:09.7954651Z 2025-10-10T00:01:09.7954847Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.7955332Z try: 2025-10-10T00:01:09.7955717Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.7956209Z return data 2025-10-10T00:01:09.7956619Z except yaml.YAMLError: 2025-10-10T00:01:09.7957101Z log.exception("Error loading YAML") 2025-10-10T00:01:09.7957616Z raise 2025-10-10T00:01:09.7957832Z 2025-10-10T00:01:09.7957838Z 2025-10-10T00:01:09.7958259Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.7958989Z """ 2025-10-10T00:01:09.7959605Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.7960193Z 2025-10-10T00:01:09.7960667Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.7961430Z and the text below is the list of opted in users. 2025-10-10T00:01:09.7961833Z 2025-10-10T00:01:09.7962202Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.7963383Z """ 2025-10-10T00:01:09.7963838Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.7964426Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.7965025Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.7965599Z else: 2025-10-10T00:01:09.7965976Z return "", rollout_state 2025-10-10T00:01:09.7966282Z 2025-10-10T00:01:09.7966289Z 2025-10-10T00:01:09.7966485Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.7966987Z """ 2025-10-10T00:01:09.7967495Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.7968133Z """ 2025-10-10T00:01:09.7968325Z 2025-10-10T00:01:09.7968341Z 2025-10-10T00:01:09.7968684Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.7969323Z """ 2025-10-10T00:01:09.7970032Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.7970708Z 2025-10-10T00:01:09.7971320Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.7972309Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.7973095Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.7973572Z 2025-10-10T00:01:09.7973579Z 2025-10-10T00:01:09.7973737Z """ 2025-10-10T00:01:09.7974105Z optins = UserOptins() 2025-10-10T00:01:09.7974585Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.7975131Z user = user.strip("\r\n\t -") 2025-10-10T00:01:09.7975657Z if not user or not user.startswith("@"): 2025-10-10T00:01:09.7976391Z # Not a valid user. Skip 2025-10-10T00:01:09.7976876Z continue 2025-10-10T00:01:09.7977115Z 2025-10-10T00:01:09.7977272Z if user: 2025-10-10T00:01:09.7977699Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.7978384Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.7978891Z 2025-10-10T00:01:09.7979055Z return optins 2025-10-10T00:01:09.7979295Z 2025-10-10T00:01:09.7979301Z 2025-10-10T00:01:09.7979585Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.7980189Z """ 2025-10-10T00:01:09.7980581Z Check if the experiment name is valid. 2025-10-10T00:01:09.7981096Z A valid name: 2025-10-10T00:01:09.7981722Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.7982758Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.7983493Z - Cannot contain spaces 2025-10-10T00:01:09.7983940Z """ 2025-10-10T00:01:09.7984143Z 2025-10-10T00:01:09.7984400Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.7985086Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.7985532Z 2025-10-10T00:01:09.7985690Z if valid: 2025-10-10T00:01:09.7986063Z return True 2025-10-10T00:01:09.7986294Z 2025-10-10T00:01:09.7986456Z log.error( 2025-10-10T00:01:09.7987903Z 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-10-10T00:01:09.7989463Z ) 2025-10-10T00:01:09.7989812Z return False 2025-10-10T00:01:09.7990041Z 2025-10-10T00:01:09.7990048Z 2025-10-10T00:01:09.7990366Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.7990980Z """ 2025-10-10T00:01:09.7991694Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.7992417Z """ 2025-10-10T00:01:09.7992934Z try: 2025-10-10T00:01:09.7993299Z if settings_text: 2025-10-10T00:01:09.7994023Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.7994814Z # for easy reading 2025-10-10T00:01:09.7995607Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.7996495Z # the backtick character in shell commands. 2025-10-10T00:01:09.7997105Z backtick = chr(96) # backtick character 2025-10-10T00:01:09.7997770Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.7998423Z settings = load_yaml(settings_text) 2025-10-10T00:01:09.7998797Z 2025-10-10T00:01:09.7999204Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.7999962Z experiments = {} 2025-10-10T00:01:09.8000256Z 2025-10-10T00:01:09.8000633Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.8001386Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.8002488Z # 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-10-10T00:01:09.8003671Z continue 2025-10-10T00:01:09.8003955Z 2025-10-10T00:01:09.8004141Z valid_settings = {} 2025-10-10T00:01:09.8004649Z for setting in exp_settings: 2025-10-10T00:01:09.8005209Z if setting not in Experiment._fields: 2025-10-10T00:01:09.8005758Z log.warning( 2025-10-10T00:01:09.8006461Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.8007325Z ) 2025-10-10T00:01:09.8007749Z else: 2025-10-10T00:01:09.8008251Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.8008676Z 2025-10-10T00:01:09.8008946Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.8009586Z return Settings(experiments) 2025-10-10T00:01:09.8009955Z 2025-10-10T00:01:09.8010127Z except Exception: 2025-10-10T00:01:09.8010600Z log.exception("Failed to parse settings") 2025-10-10T00:01:09.8010982Z 2025-10-10T00:01:09.8011151Z return Settings() 2025-10-10T00:01:09.8011410Z 2025-10-10T00:01:09.8011416Z 2025-10-10T00:01:09.8011659Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.8012221Z """ 2025-10-10T00:01:09.8012745Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.8013145Z 2025-10-10T00:01:09.8013496Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.8014258Z and the text below is the list of opted in users. 2025-10-10T00:01:09.8014668Z 2025-10-10T00:01:09.8015072Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.8015803Z """ 2025-10-10T00:01:09.8016352Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.8017107Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.8017504Z 2025-10-10T00:01:09.8017511Z 2025-10-10T00:01:09.8017752Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.8018306Z """ 2025-10-10T00:01:09.8018695Z Parse users from the rollout state. 2025-10-10T00:01:09.8019046Z 2025-10-10T00:01:09.8019210Z """ 2025-10-10T00:01:09.8019740Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.8020487Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.8020889Z 2025-10-10T00:01:09.8020896Z 2025-10-10T00:01:09.8021444Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.8022204Z """ 2025-10-10T00:01:09.8022735Z Check if a user is opted into an experiment 2025-10-10T00:01:09.8023283Z """ 2025-10-10T00:01:09.8023735Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.8024152Z 2025-10-10T00:01:09.8024158Z 2025-10-10T00:01:09.8024573Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.8025317Z """ 2025-10-10T00:01:09.8025783Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.8026361Z """ 2025-10-10T00:01:09.8026865Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.8027543Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.8028194Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.8028791Z return False 2025-10-10T00:01:09.8029056Z 2025-10-10T00:01:09.8029323Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.8029923Z log.warning( 2025-10-10T00:01:09.8030715Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.8031602Z ) 2025-10-10T00:01:09.8031808Z 2025-10-10T00:01:09.8031970Z return True 2025-10-10T00:01:09.8032206Z 2025-10-10T00:01:09.8032212Z 2025-10-10T00:01:09.8032385Z def get_runner_prefix( 2025-10-10T00:01:09.8032923Z rollout_state: str, 2025-10-10T00:01:09.8033384Z workflow_requestors: Iterable[str], 2025-10-10T00:01:09.8033905Z branch: str, 2025-10-10T00:01:09.8034385Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.8035049Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.8035631Z is_canary: bool = False, 2025-10-10T00:01:09.8036073Z ) -> str: 2025-10-10T00:01:09.8036480Z settings = parse_settings(rollout_state) 2025-10-10T00:01:09.8037198Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.8037566Z 2025-10-10T00:01:09.8037737Z fleet_prefix = "" 2025-10-10T00:01:09.8038184Z prefixes = [] 2025-10-10T00:01:09.8038811Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.8039744Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.8040453Z log.info( 2025-10-10T00:01:09.8041128Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.8041882Z ) 2025-10-10T00:01:09.8042252Z continue 2025-10-10T00:01:09.8042601Z 2025-10-10T00:01:09.8042794Z if opt_out_experiments: 2025-10-10T00:01:09.8043320Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.8043968Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.8044560Z log.info( 2025-10-10T00:01:09.8045476Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.8046451Z ) 2025-10-10T00:01:09.8046839Z continue 2025-10-10T00:01:09.8047107Z 2025-10-10T00:01:09.8047293Z if eligible_experiments: 2025-10-10T00:01:09.8047869Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.8048503Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.8049056Z log.info( 2025-10-10T00:01:09.8049868Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.8050701Z ) 2025-10-10T00:01:09.8051090Z continue 2025-10-10T00:01:09.8051591Z elif not experiment_settings.default: 2025-10-10T00:01:09.8052117Z log.info( 2025-10-10T00:01:09.8053000Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.8053764Z ) 2025-10-10T00:01:09.8054133Z continue 2025-10-10T00:01:09.8054381Z 2025-10-10T00:01:09.8054658Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.8055269Z opted_out_users = [ 2025-10-10T00:01:09.8055731Z requestor 2025-10-10T00:01:09.8056193Z for requestor in workflow_requestors 2025-10-10T00:01:09.8056871Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.8057500Z ] 2025-10-10T00:01:09.8057713Z 2025-10-10T00:01:09.8057890Z if opted_out_users: 2025-10-10T00:01:09.8058344Z log.info( 2025-10-10T00:01:09.8058958Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.8059655Z ) 2025-10-10T00:01:09.8060027Z continue 2025-10-10T00:01:09.8060277Z 2025-10-10T00:01:09.8060555Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.8061158Z opted_in_users = [ 2025-10-10T00:01:09.8061601Z requestor 2025-10-10T00:01:09.8062042Z for requestor in workflow_requestors 2025-10-10T00:01:09.8062808Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.8063421Z ] 2025-10-10T00:01:09.8063619Z 2025-10-10T00:01:09.8063787Z enabled = False 2025-10-10T00:01:09.8064229Z if opted_in_users: 2025-10-10T00:01:09.8064661Z log.info( 2025-10-10T00:01:09.8065256Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.8065921Z ) 2025-10-10T00:01:09.8066307Z enabled = True 2025-10-10T00:01:09.8066585Z 2025-10-10T00:01:09.8066802Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.8067636Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.8068721Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.8069368Z log.info( 2025-10-10T00:01:09.8070235Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.8071144Z ) 2025-10-10T00:01:09.8071546Z enabled = True 2025-10-10T00:01:09.8071842Z 2025-10-10T00:01:09.8072006Z if enabled: 2025-10-10T00:01:09.8072423Z label = experiment_name 2025-10-10T00:01:09.8073075Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.8073889Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.8074762Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.8075513Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.8076178Z if is_canary: 2025-10-10T00:01:09.8076663Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.8077211Z fleet_prefix = label 2025-10-10T00:01:09.8077696Z else: 2025-10-10T00:01:09.8078112Z prefixes.append(label) 2025-10-10T00:01:09.8078455Z 2025-10-10T00:01:09.8078639Z if len(prefixes) > 1: 2025-10-10T00:01:09.8079072Z log.error( 2025-10-10T00:01:09.8080108Z 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-10-10T00:01:09.8081213Z ) 2025-10-10T00:01:09.8081598Z prefixes = prefixes[:1] 2025-10-10T00:01:09.8081909Z 2025-10-10T00:01:09.8082093Z # Fleet always comes first 2025-10-10T00:01:09.8082654Z if fleet_prefix: 2025-10-10T00:01:09.8083107Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.8083471Z 2025-10-10T00:01:09.8083843Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.8084263Z 2025-10-10T00:01:09.8084276Z 2025-10-10T00:01:09.8084711Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.8085483Z """ 2025-10-10T00:01:09.8086062Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.8086625Z 2025-10-10T00:01:09.8087015Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.8087707Z """ 2025-10-10T00:01:09.8088088Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.8088619Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.8089249Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.8089690Z 2025-10-10T00:01:09.8089697Z 2025-10-10T00:01:09.8090090Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.8090852Z for _ in range(num_retries): 2025-10-10T00:01:09.8091329Z try: 2025-10-10T00:01:09.8091744Z req = Request(url=url, headers=headers) 2025-10-10T00:01:09.8092407Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.8093154Z return json.loads(content) 2025-10-10T00:01:09.8093677Z except Exception as e: 2025-10-10T00:01:09.8094202Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.8094610Z 2025-10-10T00:01:09.8094981Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.8095681Z return {} 2025-10-10T00:01:09.8095907Z 2025-10-10T00:01:09.8095914Z 2025-10-10T00:01:09.8096068Z @cache 2025-10-10T00:01:09.8096678Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.8097418Z """ 2025-10-10T00:01:09.8097803Z Dynamically get PR information 2025-10-10T00:01:09.8098282Z """ 2025-10-10T00:01:09.8098940Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.8099556Z headers = { 2025-10-10T00:01:09.8100009Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.8100606Z "Authorization": f"token {github_token}", 2025-10-10T00:01:09.8101137Z } 2025-10-10T00:01:09.8101558Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.8102164Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.8102817Z headers=headers, 2025-10-10T00:01:09.8103236Z ) 2025-10-10T00:01:09.8103434Z 2025-10-10T00:01:09.8103614Z if not json_response: 2025-10-10T00:01:09.8104173Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.8104783Z return {} 2025-10-10T00:01:09.8105019Z 2025-10-10T00:01:09.8105194Z return json_response 2025-10-10T00:01:09.8105476Z 2025-10-10T00:01:09.8105482Z 2025-10-10T00:01:09.8105879Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.8106610Z """ 2025-10-10T00:01:09.8107122Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.8107770Z """ 2025-10-10T00:01:09.8108251Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.8108857Z return { 2025-10-10T00:01:09.8109424Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.8110118Z } 2025-10-10T00:01:09.8110316Z 2025-10-10T00:01:09.8110322Z 2025-10-10T00:01:09.8110498Z def main() -> None: 2025-10-10T00:01:09.8110918Z args = parse_args() 2025-10-10T00:01:09.8111179Z 2025-10-10T00:01:09.8111405Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.8111783Z 2025-10-10T00:01:09.8111973Z # Check if the PR is opt-out 2025-10-10T00:01:09.8112456Z if args.pr_number: 2025-10-10T00:01:09.8113193Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.8114076Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.8114578Z log.info( 2025-10-10T00:01:09.8115260Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.8116018Z ) 2025-10-10T00:01:09.8116560Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.8117230Z sys.exit() 2025-10-10T00:01:09.8117485Z 2025-10-10T00:01:09.8117645Z try: 2025-10-10T00:01:09.8118077Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.8118771Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.8119406Z ) 2025-10-10T00:01:09.8119607Z 2025-10-10T00:01:09.8119813Z username = get_potential_pr_author( 2025-10-10T00:01:09.8120344Z args.github_token, 2025-10-10T00:01:09.8120821Z args.github_repo, 2025-10-10T00:01:09.8121286Z args.github_actor, 2025-10-10T00:01:09.8121764Z args.github_ref_type, 2025-10-10T00:01:09.8122252Z args.github_branch, 2025-10-10T00:01:09.8122804Z ) 2025-10-10T00:01:09.8123035Z 2025-10-10T00:01:09.8123315Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.8123770Z 2025-10-10T00:01:09.8123985Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.8124531Z rollout_state, 2025-10-10T00:01:09.8125000Z (args.github_issue_owner, username), 2025-10-10T00:01:09.8125541Z args.github_branch, 2025-10-10T00:01:09.8126020Z args.eligible_experiments, 2025-10-10T00:01:09.8126549Z args.opt_out_experiments, 2025-10-10T00:01:09.8127042Z is_canary, 2025-10-10T00:01:09.8127450Z ) 2025-10-10T00:01:09.8127654Z 2025-10-10T00:01:09.8127837Z except Exception as e: 2025-10-10T00:01:09.8128280Z log.error( 2025-10-10T00:01:09.8128936Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.8129818Z ) 2025-10-10T00:01:09.8130023Z 2025-10-10T00:01:09.8130355Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.8130850Z 2025-10-10T00:01:09.8130857Z 2025-10-10T00:01:09.8131029Z if __name__ == "__main__": 2025-10-10T00:01:09.8131456Z main() 2025-10-10T00:01:09.8131665Z 2025-10-10T00:01:09.8228100Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.8228985Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.8262333Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.8263003Z env: 2025-10-10T00:01:09.8263644Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.8264068Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.8264513Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.8265012Z ISSUE_OWNER: 2025-10-10T00:01:09.8265403Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.8265834Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:09.8266274Z PR_NUMBER: 2025-10-10T00:01:09.8266678Z ##[endgroup] 2025-10-10T00:01:11.9625300Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:12.9192075Z Collecting urllib3==1.26.18 2025-10-10T00:01:12.9599752Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:12.9824560Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-10-10T00:01:13.0073585Z Collecting PyGithub==2.3.0 2025-10-10T00:01:13.0133007Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:13.0583660Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:13.0620777Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:13.0669904Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:13.0687018Z 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-10-10T00:01:13.0702391Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:13.0976461Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:13.1037564Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:13.1281815Z 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-10-10T00:01:13.2501836Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.2534271Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:13.3899507Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:13.3953467Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-10-10T00:01:13.4157806Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.4190232Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:13.4424746Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:13.4484257Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 34.2 MB/s eta 0:00:00 2025-10-10T00:01:13.4602025Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:13.4669904Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 69.6 MB/s eta 0:00:00 2025-10-10T00:01:13.4741477Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:13.4859382Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 138.1 MB/s eta 0:00:00 2025-10-10T00:01:13.4900174Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:13.4954682Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:13.5013693Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 56.2 MB/s eta 0:00:00 2025-10-10T00:01:13.5041759Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:13.5088028Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 26.7 MB/s eta 0:00:00 2025-10-10T00:01:13.5121086Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:13.5169666Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 34.5 MB/s eta 0:00:00 2025-10-10T00:01:13.8841084Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:14.4411174Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:14.5324891Z ##[group]Run curr_branch="main" 2025-10-10T00:01:14.5325202Z curr_branch="main" 2025-10-10T00:01:14.5325434Z curr_ref_type="branch" 2025-10-10T00:01:14.5325683Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:14.5325983Z  2025-10-10T00:01:14.5326169Z python3 runner_determinator.py \ 2025-10-10T00:01:14.5326450Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:14.5326734Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:14.5326991Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:14.5327261Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:14.5327554Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:14.5327855Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:14.5328130Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:14.5328436Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:14.5328794Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:14.5329096Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:14.5362231Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:14.5362467Z env: 2025-10-10T00:01:14.5363079Z GITHUB_TOKEN: *** 2025-10-10T00:01:14.5363280Z ISSUE_NUMBER: 5132 2025-10-10T00:01:14.5363480Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:14.5363713Z ISSUE_OWNER: 2025-10-10T00:01:14.5363885Z CHECK_EXPERIMENTS: 2025-10-10T00:01:14.5364083Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:14.5364281Z PR_NUMBER: 2025-10-10T00:01:14.5364446Z ##[endgroup] 2025-10-10T00:01:14.5416414Z Current branch is 'main' 2025-10-10T00:01:16.5129308Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-10-10T00:01:16.5130344Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:16.5131039Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:16.5131767Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:16.5132314Z INFO : Setting output: label-type='' 2025-10-10T00:01:16.5456702Z Evaluate and set job outputs 2025-10-10T00:01:16.5463721Z Cleaning up orphan processes