2025-11-03T15:43:32.8523617Z Current runner version: '2.329.0' 2025-11-03T15:43:32.8547835Z ##[group]Runner Image Provisioner 2025-11-03T15:43:32.8548611Z Hosted Compute Agent 2025-11-03T15:43:32.8549224Z Version: 20251016.436 2025-11-03T15:43:32.8549796Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:32.8550475Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:32.8551008Z ##[endgroup] 2025-11-03T15:43:32.8551622Z ##[group]Operating System 2025-11-03T15:43:32.8552132Z Ubuntu 2025-11-03T15:43:32.8552580Z 24.04.3 2025-11-03T15:43:32.8553091Z LTS 2025-11-03T15:43:32.8553492Z ##[endgroup] 2025-11-03T15:43:32.8553960Z ##[group]Runner Image 2025-11-03T15:43:32.8554548Z Image: ubuntu-24.04 2025-11-03T15:43:32.8555287Z Version: 20251030.96.2 2025-11-03T15:43:32.8556240Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:32.8557812Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:32.8558727Z ##[endgroup] 2025-11-03T15:43:32.8559762Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:32.8561881Z Contents: read 2025-11-03T15:43:32.8562437Z Metadata: read 2025-11-03T15:43:32.8562937Z ##[endgroup] 2025-11-03T15:43:32.8565117Z Secret source: Actions 2025-11-03T15:43:32.8566234Z Prepare workflow directory 2025-11-03T15:43:32.9092378Z Prepare all required actions 2025-11-03T15:43:32.9149477Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:32.9154357Z ##[group] Inputs 2025-11-03T15:43:32.9155328Z check_experiments: 2025-11-03T15:43:32.9155931Z opt_out_experiments: 2025-11-03T15:43:32.9156522Z triggering_actor: pytorchmergebot 2025-11-03T15:43:32.9157078Z issue_owner: 2025-11-03T15:43:32.9157606Z curr_branch: main 2025-11-03T15:43:32.9158160Z curr_ref_type: branch 2025-11-03T15:43:32.9158762Z issue_number: 5132 2025-11-03T15:43:32.9159310Z ##[endgroup] 2025-11-03T15:43:32.9159954Z Complete job name: before-test / get-label-type / runner-determinator 2025-11-03T15:43:33.6361188Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:33.6363788Z cat < runner_determinator.py 2025-11-03T15:43:33.6364543Z # flake8: noqa: G004 2025-11-03T15:43:33.6365597Z  2025-11-03T15:43:33.6366433Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:33.6367489Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:33.6368578Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:33.6369321Z  2025-11-03T15:43:33.6369741Z """ 2025-11-03T15:43:33.6370564Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:33.6371588Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:33.6372883Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:33.6373900Z of which runners should be used to run which job. 2025-11-03T15:43:33.6374619Z  2025-11-03T15:43:33.6375496Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:33.6376621Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:33.6377685Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:33.6378529Z list, defined. 2025-11-03T15:43:33.6379113Z  2025-11-03T15:43:33.6379786Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:33.6380907Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:33.6381941Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:33.6382658Z  2025-11-03T15:43:33.6383736Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:33.6384888Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:33.6385828Z experiments which the user could be opted in to. 2025-11-03T15:43:33.6386574Z  2025-11-03T15:43:33.6387099Z The user list has the following rules: 2025-11-03T15:43:33.6387746Z  2025-11-03T15:43:33.6388422Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:33.6389538Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:33.6390438Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:33.6391112Z  2025-11-03T15:43:33.6391660Z Example config: 2025-11-03T15:43:33.6392262Z  # A list of experiments that can be opted into. 2025-11-03T15:43:33.6393114Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:33.6393938Z  # Expected syntax is: 2025-11-03T15:43:33.6394873Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:33.6395998Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:33.6396925Z  2025-11-03T15:43:33.6397401Z  experiments: 2025-11-03T15:43:33.6397942Z  lf: 2025-11-03T15:43:33.6492158Z  rollout_percent: 25 2025-11-03T15:43:33.6493273Z  all_branches: false 2025-11-03T15:43:33.6494200Z  default: true 2025-11-03T15:43:33.6495579Z  --- 2025-11-03T15:43:33.6496310Z  2025-11-03T15:43:33.6496968Z  # Opt-ins: 2025-11-03T15:43:33.6498270Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:33.6499753Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:33.6500651Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:33.6501417Z  # Experiments should be from the above list. 2025-11-03T15:43:33.6502015Z  2025-11-03T15:43:33.6502423Z  @User1,-lf,split_build 2025-11-03T15:43:33.6502949Z  @User2,lf 2025-11-03T15:43:33.6503422Z  @User3,split_build 2025-11-03T15:43:33.6503919Z """ 2025-11-03T15:43:33.6504306Z  2025-11-03T15:43:33.6504896Z import json 2025-11-03T15:43:33.6505386Z import logging 2025-11-03T15:43:33.6505835Z import os 2025-11-03T15:43:33.6506265Z import random 2025-11-03T15:43:33.6506705Z import re 2025-11-03T15:43:33.6507123Z import sys 2025-11-03T15:43:33.6507595Z from argparse import ArgumentParser 2025-11-03T15:43:33.6508287Z from collections.abc import Iterable 2025-11-03T15:43:33.6508887Z from functools import cache 2025-11-03T15:43:33.6509426Z from logging import LogRecord 2025-11-03T15:43:33.6509999Z from typing import Any, NamedTuple 2025-11-03T15:43:33.6510620Z from urllib.request import Request, urlopen 2025-11-03T15:43:33.6511222Z  2025-11-03T15:43:33.6511614Z import yaml 2025-11-03T15:43:33.6512079Z from github import Auth, Github 2025-11-03T15:43:33.6512645Z from github.Issue import Issue 2025-11-03T15:43:33.6513163Z  2025-11-03T15:43:33.6513534Z  2025-11-03T15:43:33.6514003Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:33.6514960Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:33.6515967Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:33.6516724Z  2025-11-03T15:43:33.6517433Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:33.6518077Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:33.6518691Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:33.6519344Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:33.6519920Z  2025-11-03T15:43:33.6520353Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:33.6520902Z  2025-11-03T15:43:33.6521315Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:33.6521847Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:33.6522352Z  2025-11-03T15:43:33.6522724Z  2025-11-03T15:43:33.6523140Z class Experiment(NamedTuple): 2025-11-03T15:43:33.6523685Z  rollout_perc: float = ( 2025-11-03T15:43:33.6524438Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:33.6525484Z  ) 2025-11-03T15:43:33.6525917Z  all_branches: bool = ( 2025-11-03T15:43:33.6526662Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:33.6527385Z  ) 2025-11-03T15:43:33.6527803Z  default: bool = ( 2025-11-03T15:43:33.6528470Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:33.6529187Z  ) 2025-11-03T15:43:33.6529577Z  2025-11-03T15:43:33.6529992Z  # Add more fields as needed 2025-11-03T15:43:33.6530514Z  2025-11-03T15:43:33.6530883Z  2025-11-03T15:43:33.6531288Z class Settings(NamedTuple): 2025-11-03T15:43:33.6531798Z  """ 2025-11-03T15:43:33.6532336Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:33.6532961Z  """ 2025-11-03T15:43:33.6533359Z  2025-11-03T15:43:33.6533797Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:33.6534376Z  2025-11-03T15:43:33.6535148Z  2025-11-03T15:43:33.6535661Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:33.6536390Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:33.6537028Z  2025-11-03T15:43:33.6537451Z  COLORS = { 2025-11-03T15:43:33.6537928Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:33.6538499Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:33.6539051Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:33.6539620Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:33.6540180Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:33.6540701Z  } 2025-11-03T15:43:33.6541093Z  2025-11-03T15:43:33.6541552Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:33.6542391Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:33.6543259Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:33.6543907Z  return super().format(record) 2025-11-03T15:43:33.6544445Z  2025-11-03T15:43:33.6545007Z  2025-11-03T15:43:33.6545439Z handler = logging.StreamHandler() 2025-11-03T15:43:33.6546245Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:33.6547018Z  2025-11-03T15:43:33.6547515Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:33.6548163Z log.addHandler(handler) 2025-11-03T15:43:33.6548684Z log.setLevel(logging.INFO) 2025-11-03T15:43:33.6549187Z  2025-11-03T15:43:33.6549565Z  2025-11-03T15:43:33.6550062Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:33.6550687Z  """ 2025-11-03T15:43:33.6551262Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:33.6552113Z  """ 2025-11-03T15:43:33.6552539Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:33.6553716Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:33.6555092Z  log.warning( 2025-11-03T15:43:33.6556056Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:33.6557043Z  ) 2025-11-03T15:43:33.6557539Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:33.6558125Z  return 2025-11-03T15:43:33.6558560Z  2025-11-03T15:43:33.6558992Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:33.6559642Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:33.6560266Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:33.6560803Z  2025-11-03T15:43:33.6561169Z  2025-11-03T15:43:33.6561730Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:33.6562435Z  return frozenset( 2025-11-03T15:43:33.6563137Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:33.6563867Z  ) 2025-11-03T15:43:33.6564278Z  2025-11-03T15:43:33.6564649Z  2025-11-03T15:43:33.6565276Z def parse_args() -> Any: 2025-11-03T15:43:33.6565972Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:33.6566925Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:33.6567774Z  parser.add_argument( 2025-11-03T15:43:33.6568308Z  "--github-issue-repo", 2025-11-03T15:43:33.6568857Z  type=str, 2025-11-03T15:43:33.6569357Z  required=False, 2025-11-03T15:43:33.6570048Z  default="pytorch/test-infra", 2025-11-03T15:43:33.6570693Z  help="GitHub repo to get the issue", 2025-11-03T15:43:33.6571257Z  ) 2025-11-03T15:43:33.6571691Z  parser.add_argument( 2025-11-03T15:43:33.6572207Z  "--github-repo", 2025-11-03T15:43:33.6572721Z  type=str, 2025-11-03T15:43:33.6573203Z  required=True, 2025-11-03T15:43:33.6573764Z  help="GitHub repo where CI is running", 2025-11-03T15:43:33.6574346Z  ) 2025-11-03T15:43:33.6575180Z  parser.add_argument( 2025-11-03T15:43:33.6575933Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:33.6576654Z  ) 2025-11-03T15:43:33.6577089Z  parser.add_argument( 2025-11-03T15:43:33.6577818Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:33.6578581Z  ) 2025-11-03T15:43:33.6579013Z  parser.add_argument( 2025-11-03T15:43:33.6579759Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:33.6580504Z  ) 2025-11-03T15:43:33.6580926Z  parser.add_argument( 2025-11-03T15:43:33.6581694Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:33.6582460Z  ) 2025-11-03T15:43:33.6582921Z  parser.add_argument( 2025-11-03T15:43:33.6583457Z  "--github-ref-type", 2025-11-03T15:43:33.6583986Z  type=str, 2025-11-03T15:43:33.6584475Z  required=True, 2025-11-03T15:43:33.6585274Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:33.6585875Z  ) 2025-11-03T15:43:33.6586307Z  parser.add_argument( 2025-11-03T15:43:33.6587009Z  "--eligible-experiments", 2025-11-03T15:43:33.6587623Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:33.6588218Z  required=False, 2025-11-03T15:43:33.6588720Z  default="", 2025-11-03T15:43:33.6589682Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:33.6590683Z  ) 2025-11-03T15:43:33.6591116Z  parser.add_argument( 2025-11-03T15:43:33.6591667Z  "--opt-out-experiments", 2025-11-03T15:43:33.6592266Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:33.6592842Z  required=False, 2025-11-03T15:43:33.6593337Z  default="", 2025-11-03T15:43:33.6593820Z  help=( 2025-11-03T15:43:33.6594581Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:33.6596038Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:33.6596933Z  ), 2025-11-03T15:43:33.6597358Z  ) 2025-11-03T15:43:33.6597782Z  parser.add_argument( 2025-11-03T15:43:33.6598305Z  "--pr-number", 2025-11-03T15:43:33.6598800Z  type=str, 2025-11-03T15:43:33.6599283Z  required=False, 2025-11-03T15:43:33.6599798Z  default="", 2025-11-03T15:43:33.6600377Z  help="the optional PR number where this is run", 2025-11-03T15:43:33.6600994Z  ) 2025-11-03T15:43:33.6601390Z  2025-11-03T15:43:33.6601815Z  return parser.parse_args() 2025-11-03T15:43:33.6602347Z  2025-11-03T15:43:33.6602717Z  2025-11-03T15:43:33.6603376Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:33.6604371Z  auth = Auth.Token(github_token) 2025-11-03T15:43:33.6605228Z  return Github(auth=auth) 2025-11-03T15:43:33.6605753Z  2025-11-03T15:43:33.6606134Z  2025-11-03T15:43:33.6606860Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:33.6607737Z  repo = gh.get_repo(repo) 2025-11-03T15:43:33.6608344Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:33.6608922Z  2025-11-03T15:43:33.6609301Z  2025-11-03T15:43:33.6609710Z def get_potential_pr_author( 2025-11-03T15:43:33.6610469Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:33.6611219Z ) -> str: 2025-11-03T15:43:33.6611836Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:33.6612740Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:33.6613592Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:33.6614225Z  2025-11-03T15:43:33.6614849Z  gh = get_gh_client(github_token) 2025-11-03T15:43:33.6615447Z  2025-11-03T15:43:33.6615975Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:33.6616687Z  split_tag = ref_name.split("/") 2025-11-03T15:43:33.6617249Z  if ( 2025-11-03T15:43:33.6617714Z  len(split_tag) == 3 2025-11-03T15:43:33.6618295Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:33.6618895Z  and split_tag[2].isnumeric() 2025-11-03T15:43:33.6619458Z  ): 2025-11-03T15:43:33.6619937Z  pr_number = split_tag[2] 2025-11-03T15:43:33.6620497Z  try: 2025-11-03T15:43:33.6621017Z  repository = gh.get_repo(repo) 2025-11-03T15:43:33.6621876Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:33.6622560Z  except Exception as e: 2025-11-03T15:43:33.6623167Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:33.6623925Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:33.6624627Z  ) from e 2025-11-03T15:43:33.6625472Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:33.6626264Z  # In all other cases, return the original input username 2025-11-03T15:43:33.6626923Z  return username 2025-11-03T15:43:33.6627393Z  2025-11-03T15:43:33.6627768Z  2025-11-03T15:43:33.6628245Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:33.6628839Z  """ 2025-11-03T15:43:33.6629576Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:33.6630426Z  """ 2025-11-03T15:43:33.6631043Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:33.6631770Z  2025-11-03T15:43:33.6632145Z  2025-11-03T15:43:33.6632580Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:33.6633132Z  try: 2025-11-03T15:43:33.6633600Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:33.6634174Z  return data 2025-11-03T15:43:33.6634837Z  except yaml.YAMLError: 2025-11-03T15:43:33.6635442Z  log.exception("Error loading YAML") 2025-11-03T15:43:33.6636013Z  raise 2025-11-03T15:43:33.6636445Z  2025-11-03T15:43:33.6636814Z  2025-11-03T15:43:33.6637523Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:33.6638320Z  """ 2025-11-03T15:43:33.6639174Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:33.6640001Z  2025-11-03T15:43:33.6640592Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:33.6641442Z  and the text below is the list of opted in users. 2025-11-03T15:43:33.6642047Z  2025-11-03T15:43:33.6642679Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:33.6643426Z  """ 2025-11-03T15:43:33.6643949Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:33.6644617Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:33.6645534Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:33.6646180Z  else: 2025-11-03T15:43:33.6646625Z  return "", rollout_state 2025-11-03T15:43:33.6647413Z  2025-11-03T15:43:33.6647824Z  2025-11-03T15:43:33.6648274Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:33.6648835Z  """ 2025-11-03T15:43:33.6649431Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:33.6650140Z  """ 2025-11-03T15:43:33.6650532Z  2025-11-03T15:43:33.6650904Z  2025-11-03T15:43:33.6651490Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:33.6652213Z  """ 2025-11-03T15:43:33.6652999Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:33.6653891Z  2025-11-03T15:43:33.6655357Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:33.6656473Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:33.6657403Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:33.6658086Z  2025-11-03T15:43:33.6658459Z  2025-11-03T15:43:33.6658828Z  """ 2025-11-03T15:43:33.6659255Z  optins = UserOptins() 2025-11-03T15:43:33.6659837Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:33.6660463Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:33.6661097Z  if not user or not user.startswith("@"): 2025-11-03T15:43:33.6661712Z  # Not a valid user. Skip 2025-11-03T15:43:33.6662260Z  continue 2025-11-03T15:43:33.6662716Z  2025-11-03T15:43:33.6663103Z  if user: 2025-11-03T15:43:33.6663676Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:33.6664437Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:33.6665412Z  2025-11-03T15:43:33.6665803Z  return optins 2025-11-03T15:43:33.6666260Z  2025-11-03T15:43:33.6666623Z  2025-11-03T15:43:33.6667171Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:33.6667830Z  """ 2025-11-03T15:43:33.6668296Z  Check if the experiment name is valid. 2025-11-03T15:43:33.6668875Z  A valid name: 2025-11-03T15:43:33.6669612Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:33.6670627Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:33.6671394Z  - Cannot contain spaces 2025-11-03T15:43:33.6671924Z  """ 2025-11-03T15:43:33.6672316Z  2025-11-03T15:43:33.6672830Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:33.6673619Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:33.6674400Z  2025-11-03T15:43:33.6675300Z  if valid: 2025-11-03T15:43:33.6675834Z  return True 2025-11-03T15:43:33.6676300Z  2025-11-03T15:43:33.6676667Z  log.error( 2025-11-03T15:43:33.6678224Z  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-11-03T15:43:33.6679844Z  ) 2025-11-03T15:43:33.6680246Z  return False 2025-11-03T15:43:33.6680688Z  2025-11-03T15:43:33.6681038Z  2025-11-03T15:43:33.6681597Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:33.6682268Z  """ 2025-11-03T15:43:33.6682919Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:33.6683689Z  """ 2025-11-03T15:43:33.6684086Z  try: 2025-11-03T15:43:33.6684510Z  if settings_text: 2025-11-03T15:43:33.6685473Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:33.6686304Z  # for easy reading 2025-11-03T15:43:33.6687217Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:33.6688158Z  # the backtick character in shell commands. 2025-11-03T15:43:33.6688813Z  backtick = chr(96) # backtick character 2025-11-03T15:43:33.6689574Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:33.6690298Z  settings = load_yaml(settings_text) 2025-11-03T15:43:33.6690849Z  2025-11-03T15:43:33.6691495Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:33.6692484Z  experiments = {} 2025-11-03T15:43:33.6692977Z  2025-11-03T15:43:33.6693580Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:33.6694397Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:33.6695694Z  # 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-11-03T15:43:33.6696808Z  continue 2025-11-03T15:43:33.6697308Z  2025-11-03T15:43:33.6697731Z  valid_settings = {} 2025-11-03T15:43:33.6698319Z  for setting in exp_settings: 2025-11-03T15:43:33.6698952Z  if setting not in Experiment._fields: 2025-11-03T15:43:33.6699583Z  log.warning( 2025-11-03T15:43:33.6700381Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:33.6701150Z  ) 2025-11-03T15:43:33.6701646Z  else: 2025-11-03T15:43:33.6702247Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:33.6702860Z  2025-11-03T15:43:33.6703389Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:33.6704090Z  return Settings(experiments) 2025-11-03T15:43:33.6704637Z  2025-11-03T15:43:33.6705160Z  except Exception: 2025-11-03T15:43:33.6705733Z  log.exception("Failed to parse settings") 2025-11-03T15:43:33.6706320Z  2025-11-03T15:43:33.6706703Z  return Settings() 2025-11-03T15:43:33.6707178Z  2025-11-03T15:43:33.6707554Z  2025-11-03T15:43:33.6708204Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:33.6708837Z  """ 2025-11-03T15:43:33.6709353Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:33.6709955Z  2025-11-03T15:43:33.6710551Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:33.6711389Z  and the text below is the list of opted in users. 2025-11-03T15:43:33.6711994Z  2025-11-03T15:43:33.6712653Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:33.6713430Z  """ 2025-11-03T15:43:33.6714071Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:33.6715025Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:33.6715624Z  2025-11-03T15:43:33.6716004Z  2025-11-03T15:43:33.6716513Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:33.6717130Z  """ 2025-11-03T15:43:33.6717584Z  Parse users from the rollout state. 2025-11-03T15:43:33.6718137Z  2025-11-03T15:43:33.6718507Z  """ 2025-11-03T15:43:33.6719137Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:33.6719967Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:33.6720565Z  2025-11-03T15:43:33.6720934Z  2025-11-03T15:43:33.6721605Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:33.6722421Z  """ 2025-11-03T15:43:33.6722906Z  Check if a user is opted into an experiment 2025-11-03T15:43:33.6723494Z  """ 2025-11-03T15:43:33.6724022Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:33.6724647Z  2025-11-03T15:43:33.6725284Z  2025-11-03T15:43:33.6725979Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:33.6726798Z  """ 2025-11-03T15:43:33.6727331Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:33.6727965Z  """ 2025-11-03T15:43:33.6728543Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:33.6729310Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:33.6730025Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:33.6730682Z  return False 2025-11-03T15:43:33.6731150Z  2025-11-03T15:43:33.6731662Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:33.6732324Z  log.warning( 2025-11-03T15:43:33.6733237Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:33.6734176Z  ) 2025-11-03T15:43:33.6734584Z  2025-11-03T15:43:33.6735069Z  return True 2025-11-03T15:43:33.6735517Z  2025-11-03T15:43:33.6735878Z  2025-11-03T15:43:33.6736279Z def get_runner_prefix( 2025-11-03T15:43:33.6736786Z  rollout_state: str, 2025-11-03T15:43:33.6737374Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:33.6737938Z  branch: str, 2025-11-03T15:43:33.6738524Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:33.6739272Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:33.6739909Z  is_canary: bool = False, 2025-11-03T15:43:33.6740422Z ) -> str: 2025-11-03T15:43:33.6740934Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:33.6741588Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:33.6742158Z  2025-11-03T15:43:33.6742680Z  fleet_prefix = "" 2025-11-03T15:43:33.6743189Z  prefixes = [] 2025-11-03T15:43:33.6743923Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:33.6745052Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:33.6745824Z  log.info( 2025-11-03T15:43:33.6746597Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:33.6747401Z  ) 2025-11-03T15:43:33.6747874Z  continue 2025-11-03T15:43:33.6748336Z  2025-11-03T15:43:33.6748746Z  if opt_out_experiments: 2025-11-03T15:43:33.6749357Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:33.6750087Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:33.6750741Z  log.info( 2025-11-03T15:43:33.6751758Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:33.6752783Z  ) 2025-11-03T15:43:33.6753250Z  continue 2025-11-03T15:43:33.6753727Z  2025-11-03T15:43:33.6754137Z  if eligible_experiments: 2025-11-03T15:43:33.6754877Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:33.6755591Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:33.6756203Z  log.info( 2025-11-03T15:43:33.6757070Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:33.6757959Z  ) 2025-11-03T15:43:33.6758554Z  continue 2025-11-03T15:43:33.6759123Z  elif not experiment_settings.default: 2025-11-03T15:43:33.6759704Z  log.info( 2025-11-03T15:43:33.6760456Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:33.6761242Z  ) 2025-11-03T15:43:33.6761682Z  continue 2025-11-03T15:43:33.6762141Z  2025-11-03T15:43:33.6762653Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:33.6763330Z  opted_out_users = [ 2025-11-03T15:43:33.6763851Z  requestor 2025-11-03T15:43:33.6764400Z  for requestor in workflow_requestors 2025-11-03T15:43:33.6765561Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:33.6766261Z  ] 2025-11-03T15:43:33.6766672Z  2025-11-03T15:43:33.6767096Z  if opted_out_users: 2025-11-03T15:43:33.6767655Z  log.info( 2025-11-03T15:43:33.6768378Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:33.6769134Z  ) 2025-11-03T15:43:33.6769578Z  continue 2025-11-03T15:43:33.6770053Z  2025-11-03T15:43:33.6770573Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:33.6771242Z  opted_in_users = [ 2025-11-03T15:43:33.6771803Z  requestor 2025-11-03T15:43:33.6772354Z  for requestor in workflow_requestors 2025-11-03T15:43:33.6773107Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:33.6773777Z  ] 2025-11-03T15:43:33.6774202Z  2025-11-03T15:43:33.6774602Z  enabled = False 2025-11-03T15:43:33.6775241Z  if opted_in_users: 2025-11-03T15:43:33.6775907Z  log.info( 2025-11-03T15:43:33.6776632Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:33.6777376Z  ) 2025-11-03T15:43:33.6777825Z  enabled = True 2025-11-03T15:43:33.6778329Z  2025-11-03T15:43:33.6778785Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:33.6779706Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:33.6780739Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:33.6781450Z  log.info( 2025-11-03T15:43:33.6782411Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:33.6783390Z  ) 2025-11-03T15:43:33.6783881Z  enabled = True 2025-11-03T15:43:33.6784393Z  2025-11-03T15:43:33.6784881Z  if enabled: 2025-11-03T15:43:33.6785396Z  label = experiment_name 2025-11-03T15:43:33.6786017Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:33.6786917Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:33.6787876Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:33.6788713Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:33.6789437Z  if is_canary: 2025-11-03T15:43:33.6790007Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:33.6790611Z  fleet_prefix = label 2025-11-03T15:43:33.6791152Z  else: 2025-11-03T15:43:33.6791812Z  prefixes.append(label) 2025-11-03T15:43:33.6792362Z  2025-11-03T15:43:33.6792761Z  if len(prefixes) > 1: 2025-11-03T15:43:33.6793281Z  log.error( 2025-11-03T15:43:33.6794425Z  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-11-03T15:43:33.6795736Z  ) 2025-11-03T15:43:33.6796195Z  prefixes = prefixes[:1] 2025-11-03T15:43:33.6796723Z  2025-11-03T15:43:33.6797129Z  # Fleet always comes first 2025-11-03T15:43:33.6797676Z  if fleet_prefix: 2025-11-03T15:43:33.6798207Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:33.6798757Z  2025-11-03T15:43:33.6799250Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:33.6799866Z  2025-11-03T15:43:33.6800262Z  2025-11-03T15:43:33.6800960Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:33.6801791Z  """ 2025-11-03T15:43:33.6802450Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:33.6803209Z  2025-11-03T15:43:33.6803840Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:33.6804591Z  """ 2025-11-03T15:43:33.6805153Z  gh = get_gh_client(github_token) 2025-11-03T15:43:33.6805777Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:33.6806508Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:33.6807163Z  2025-11-03T15:43:33.6807532Z  2025-11-03T15:43:33.6808190Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:33.6809157Z  for _ in range(num_retries): 2025-11-03T15:43:33.6809710Z  try: 2025-11-03T15:43:33.6810209Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:33.6810951Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:33.6811671Z  return json.loads(content) 2025-11-03T15:43:33.6812247Z  except Exception as e: 2025-11-03T15:43:33.6812883Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:33.6813483Z  2025-11-03T15:43:33.6814113Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:33.6814987Z  return {} 2025-11-03T15:43:33.6815422Z  2025-11-03T15:43:33.6815786Z  2025-11-03T15:43:33.6816155Z @cache 2025-11-03T15:43:33.6816873Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:33.6817693Z  """ 2025-11-03T15:43:33.6818152Z  Dynamically get PR information 2025-11-03T15:43:33.6818688Z  """ 2025-11-03T15:43:33.6819256Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:33.6819938Z  headers = { 2025-11-03T15:43:33.6820483Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:33.6821161Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:33.6821737Z  } 2025-11-03T15:43:33.6822242Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:33.6822913Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:33.6823514Z  headers=headers, 2025-11-03T15:43:33.6824004Z  ) 2025-11-03T15:43:33.6824399Z  2025-11-03T15:43:33.6824906Z  if not json_response: 2025-11-03T15:43:33.6825571Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:33.6826400Z  return {} 2025-11-03T15:43:33.6826861Z  2025-11-03T15:43:33.6827260Z  return json_response 2025-11-03T15:43:33.6827747Z  2025-11-03T15:43:33.6828115Z  2025-11-03T15:43:33.6828758Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:33.6829551Z  """ 2025-11-03T15:43:33.6830178Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:33.6830875Z  """ 2025-11-03T15:43:33.6831438Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:33.6832102Z  return { 2025-11-03T15:43:33.6832763Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:33.6833497Z  } 2025-11-03T15:43:33.6833896Z  2025-11-03T15:43:33.6834269Z  2025-11-03T15:43:33.6834764Z def main() -> None: 2025-11-03T15:43:33.6835275Z  args = parse_args() 2025-11-03T15:43:33.6835763Z  2025-11-03T15:43:33.6836230Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:33.6836807Z  2025-11-03T15:43:33.6837255Z  # Check if the PR is opt-out 2025-11-03T15:43:33.6837806Z  if args.pr_number: 2025-11-03T15:43:33.6838565Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:33.6839385Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:33.6839934Z  log.info( 2025-11-03T15:43:33.6840717Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:33.6841530Z  ) 2025-11-03T15:43:33.6842174Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:33.6842920Z  sys.exit() 2025-11-03T15:43:33.6843529Z  2025-11-03T15:43:33.6843910Z  try: 2025-11-03T15:43:33.6844422Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:33.6845320Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:33.6846009Z  ) 2025-11-03T15:43:33.6846423Z  2025-11-03T15:43:33.6846860Z  username = get_potential_pr_author( 2025-11-03T15:43:33.6847460Z  args.github_token, 2025-11-03T15:43:33.6848006Z  args.github_repo, 2025-11-03T15:43:33.6848549Z  args.github_actor, 2025-11-03T15:43:33.6849109Z  args.github_ref_type, 2025-11-03T15:43:33.6849662Z  args.github_branch, 2025-11-03T15:43:33.6850192Z  ) 2025-11-03T15:43:33.6850598Z  2025-11-03T15:43:33.6851136Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:33.6851794Z  2025-11-03T15:43:33.6852254Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:33.6852859Z  rollout_state, 2025-11-03T15:43:33.6853430Z  (args.github_issue_owner, username), 2025-11-03T15:43:33.6854035Z  args.github_branch, 2025-11-03T15:43:33.6854605Z  args.eligible_experiments, 2025-11-03T15:43:33.6855307Z  args.opt_out_experiments, 2025-11-03T15:43:33.6855861Z  is_canary, 2025-11-03T15:43:33.6856344Z  ) 2025-11-03T15:43:33.6856749Z  2025-11-03T15:43:33.6857153Z  except Exception as e: 2025-11-03T15:43:33.6857683Z  log.error( 2025-11-03T15:43:33.6858457Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:33.6859400Z  ) 2025-11-03T15:43:33.6859809Z  2025-11-03T15:43:33.6860399Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:33.6861102Z  2025-11-03T15:43:33.6861467Z  2025-11-03T15:43:33.6861859Z if __name__ == "__main__": 2025-11-03T15:43:33.6862363Z  main() 2025-11-03T15:43:33.6862794Z  2025-11-03T15:43:33.6863163Z EOF 2025-11-03T15:43:33.6863548Z  2025-11-03T15:43:33.6863951Z cat runner_determinator.py 2025-11-03T15:43:33.8023230Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:33.8024264Z env: 2025-11-03T15:43:33.8025481Z GITHUB_TOKEN: *** 2025-11-03T15:43:33.8026014Z ISSUE_NUMBER: 5132 2025-11-03T15:43:33.8026571Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:33.8027205Z ISSUE_OWNER: 2025-11-03T15:43:33.8027706Z CHECK_EXPERIMENTS: 2025-11-03T15:43:33.8028247Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:33.8028784Z PR_NUMBER: 2025-11-03T15:43:33.8029293Z ##[endgroup] 2025-11-03T15:43:33.8252011Z # flake8: noqa: G004 2025-11-03T15:43:33.8252371Z 2025-11-03T15:43:33.8252817Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:33.8253779Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:33.8254588Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:33.8255484Z 2025-11-03T15:43:33.8255666Z """ 2025-11-03T15:43:33.8256475Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:33.8257392Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:33.8258301Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:33.8259121Z of which runners should be used to run which job. 2025-11-03T15:43:33.8259525Z 2025-11-03T15:43:33.8259906Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:33.8261027Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:33.8261938Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:33.8262651Z list, defined. 2025-11-03T15:43:33.8262877Z 2025-11-03T15:43:33.8263252Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:33.8264224Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:33.8265408Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:33.8265863Z 2025-11-03T15:43:33.8266234Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:33.8267106Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:33.8267851Z experiments which the user could be opted in to. 2025-11-03T15:43:33.8268289Z 2025-11-03T15:43:33.8268490Z The user list has the following rules: 2025-11-03T15:43:33.8268848Z 2025-11-03T15:43:33.8269185Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:33.8270061Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:33.8270834Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:33.8271233Z 2025-11-03T15:43:33.8271406Z Example config: 2025-11-03T15:43:33.8271864Z # A list of experiments that can be opted into. 2025-11-03T15:43:33.8272546Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:33.8273178Z # Expected syntax is: 2025-11-03T15:43:33.8273829Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:33.8275098Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:33.8275747Z 2025-11-03T15:43:33.8275919Z experiments: 2025-11-03T15:43:33.8276314Z lf: 2025-11-03T15:43:33.8276690Z rollout_percent: 25 2025-11-03T15:43:33.8277337Z all_branches: false 2025-11-03T15:43:33.8277789Z default: true 2025-11-03T15:43:33.8278248Z --- 2025-11-03T15:43:33.8278450Z 2025-11-03T15:43:33.8278613Z # Opt-ins: 2025-11-03T15:43:33.8279206Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:33.8280085Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:33.8280870Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:33.8281572Z # Experiments should be from the above list. 2025-11-03T15:43:33.8281958Z 2025-11-03T15:43:33.8282140Z @User1,-lf,split_build 2025-11-03T15:43:33.8282600Z @User2,lf 2025-11-03T15:43:33.8283111Z @User3,split_build 2025-11-03T15:43:33.8283528Z """ 2025-11-03T15:43:33.8283723Z 2025-11-03T15:43:33.8283888Z import json 2025-11-03T15:43:33.8284262Z import logging 2025-11-03T15:43:33.8284640Z import os 2025-11-03T15:43:33.8285367Z import random 2025-11-03T15:43:33.8285753Z import re 2025-11-03T15:43:33.8286141Z import sys 2025-11-03T15:43:33.8286550Z from argparse import ArgumentParser 2025-11-03T15:43:33.8287097Z from collections.abc import Iterable 2025-11-03T15:43:33.8287634Z from functools import cache 2025-11-03T15:43:33.8288132Z from logging import LogRecord 2025-11-03T15:43:33.8288636Z from typing import Any, NamedTuple 2025-11-03T15:43:33.8289218Z from urllib.request import Request, urlopen 2025-11-03T15:43:33.8289602Z 2025-11-03T15:43:33.8289769Z import yaml 2025-11-03T15:43:33.8290202Z from github import Auth, Github 2025-11-03T15:43:33.8290885Z from github.Issue import Issue 2025-11-03T15:43:33.8291207Z 2025-11-03T15:43:33.8291214Z 2025-11-03T15:43:33.8291440Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:33.8292310Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:33.8293229Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:33.8293809Z 2025-11-03T15:43:33.8294060Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:33.8295011Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:33.8295612Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:33.8296184Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:33.8296558Z 2025-11-03T15:43:33.8296765Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:33.8297108Z 2025-11-03T15:43:33.8297306Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:33.8297809Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:33.8298102Z 2025-11-03T15:43:33.8298109Z 2025-11-03T15:43:33.8298306Z class Experiment(NamedTuple): 2025-11-03T15:43:33.8298788Z rollout_perc: float = ( 2025-11-03T15:43:33.8299439Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:33.8300153Z ) 2025-11-03T15:43:33.8300527Z all_branches: bool = ( 2025-11-03T15:43:33.8301158Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:33.8301845Z ) 2025-11-03T15:43:33.8302212Z default: bool = ( 2025-11-03T15:43:33.8302803Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:33.8303451Z ) 2025-11-03T15:43:33.8303668Z 2025-11-03T15:43:33.8303852Z # Add more fields as needed 2025-11-03T15:43:33.8304168Z 2025-11-03T15:43:33.8304175Z 2025-11-03T15:43:33.8304363Z class Settings(NamedTuple): 2025-11-03T15:43:33.8305000Z """ 2025-11-03T15:43:33.8305475Z Settings for the experiments that can be opted into. 2025-11-03T15:43:33.8306052Z """ 2025-11-03T15:43:33.8306257Z 2025-11-03T15:43:33.8306469Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:33.8306847Z 2025-11-03T15:43:33.8306854Z 2025-11-03T15:43:33.8307080Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:33.8307713Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:33.8308159Z 2025-11-03T15:43:33.8308326Z COLORS = { 2025-11-03T15:43:33.8308723Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:33.8309412Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:33.8309928Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:33.8310430Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:33.8310928Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:33.8311398Z } 2025-11-03T15:43:33.8311592Z 2025-11-03T15:43:33.8311815Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:33.8312565Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:33.8313358Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:33.8313942Z return super().format(record) 2025-11-03T15:43:33.8314285Z 2025-11-03T15:43:33.8314292Z 2025-11-03T15:43:33.8314488Z handler = logging.StreamHandler() 2025-11-03T15:43:33.8315455Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:33.8316026Z 2025-11-03T15:43:33.8316272Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:33.8316880Z log.addHandler(handler) 2025-11-03T15:43:33.8317331Z log.setLevel(logging.INFO) 2025-11-03T15:43:33.8317625Z 2025-11-03T15:43:33.8317632Z 2025-11-03T15:43:33.8317883Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:33.8318460Z """ 2025-11-03T15:43:33.8318970Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:33.8319646Z """ 2025-11-03T15:43:33.8320016Z if not GITHUB_OUTPUT: 2025-11-03T15:43:33.8321098Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:33.8322277Z log.warning( 2025-11-03T15:43:33.8323165Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:33.8324104Z ) 2025-11-03T15:43:33.8334580Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:33.8335502Z return 2025-11-03T15:43:33.8335763Z 2025-11-03T15:43:33.8336158Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:33.8336785Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:33.8337369Z f.write(f"{key}={value}\n") 2025-11-03T15:43:33.8337708Z 2025-11-03T15:43:33.8337716Z 2025-11-03T15:43:33.8338026Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:33.8338680Z return frozenset( 2025-11-03T15:43:33.8339306Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:33.8340024Z ) 2025-11-03T15:43:33.8340229Z 2025-11-03T15:43:33.8340237Z 2025-11-03T15:43:33.8340423Z def parse_args() -> Any: 2025-11-03T15:43:33.8340998Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:33.8341874Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:33.8342672Z parser.add_argument( 2025-11-03T15:43:33.8343149Z "--github-issue-repo", 2025-11-03T15:43:33.8343629Z type=str, 2025-11-03T15:43:33.8344045Z required=False, 2025-11-03T15:43:33.8344508Z default="pytorch/test-infra", 2025-11-03T15:43:33.8345297Z help="GitHub repo to get the issue", 2025-11-03T15:43:33.8345817Z ) 2025-11-03T15:43:33.8346193Z parser.add_argument( 2025-11-03T15:43:33.8346632Z "--github-repo", 2025-11-03T15:43:33.8347062Z type=str, 2025-11-03T15:43:33.8347466Z required=True, 2025-11-03T15:43:33.8347929Z help="GitHub repo where CI is running", 2025-11-03T15:43:33.8348450Z ) 2025-11-03T15:43:33.8348812Z parser.add_argument( 2025-11-03T15:43:33.8403671Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:33.8404533Z ) 2025-11-03T15:43:33.8405203Z parser.add_argument( 2025-11-03T15:43:33.8405861Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:33.8406547Z ) 2025-11-03T15:43:33.8406911Z parser.add_argument( 2025-11-03T15:43:33.8407824Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:33.8408527Z ) 2025-11-03T15:43:33.8408886Z parser.add_argument( 2025-11-03T15:43:33.8409540Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:33.8410251Z ) 2025-11-03T15:43:33.8410614Z parser.add_argument( 2025-11-03T15:43:33.8411056Z "--github-ref-type", 2025-11-03T15:43:33.8411514Z type=str, 2025-11-03T15:43:33.8411904Z required=True, 2025-11-03T15:43:33.8412390Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:33.8412940Z ) 2025-11-03T15:43:33.8413305Z parser.add_argument( 2025-11-03T15:43:33.8413761Z "--eligible-experiments", 2025-11-03T15:43:33.8414278Z type=_str_comma_separated_to_set, 2025-11-03T15:43:33.8414952Z required=False, 2025-11-03T15:43:33.8415371Z default="", 2025-11-03T15:43:33.8416220Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:33.8417154Z ) 2025-11-03T15:43:33.8417523Z parser.add_argument( 2025-11-03T15:43:33.8417972Z "--opt-out-experiments", 2025-11-03T15:43:33.8418476Z type=_str_comma_separated_to_set, 2025-11-03T15:43:33.8418989Z required=False, 2025-11-03T15:43:33.8419411Z default="", 2025-11-03T15:43:33.8419798Z help=( 2025-11-03T15:43:33.8420461Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:33.8421593Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:33.8422411Z ), 2025-11-03T15:43:33.8422762Z ) 2025-11-03T15:43:33.8423122Z parser.add_argument( 2025-11-03T15:43:33.8423560Z "--pr-number", 2025-11-03T15:43:33.8423967Z type=str, 2025-11-03T15:43:33.8424371Z required=False, 2025-11-03T15:43:33.8424933Z default="", 2025-11-03T15:43:33.8425559Z help="the optional PR number where this is run", 2025-11-03T15:43:33.8426133Z ) 2025-11-03T15:43:33.8426329Z 2025-11-03T15:43:33.8426522Z return parser.parse_args() 2025-11-03T15:43:33.8426830Z 2025-11-03T15:43:33.8426843Z 2025-11-03T15:43:33.8427252Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:33.8428010Z auth = Auth.Token(github_token) 2025-11-03T15:43:33.8428521Z return Github(auth=auth) 2025-11-03T15:43:33.8428816Z 2025-11-03T15:43:33.8428824Z 2025-11-03T15:43:33.8429277Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:33.8430074Z repo = gh.get_repo(repo) 2025-11-03T15:43:33.8430575Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:33.8430943Z 2025-11-03T15:43:33.8430949Z 2025-11-03T15:43:33.8431136Z def get_potential_pr_author( 2025-11-03T15:43:33.8431788Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:33.8432455Z ) -> str: 2025-11-03T15:43:33.8432972Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:33.8433777Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:33.8434515Z # embedded in the tag name: ciflow// 2025-11-03T15:43:33.8435240Z 2025-11-03T15:43:33.8435445Z gh = get_gh_client(github_token) 2025-11-03T15:43:33.8435781Z 2025-11-03T15:43:33.8436046Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:33.8436679Z split_tag = ref_name.split("/") 2025-11-03T15:43:33.8437179Z if ( 2025-11-03T15:43:33.8437566Z len(split_tag) == 3 2025-11-03T15:43:33.8438040Z and split_tag[0] == "ciflow" 2025-11-03T15:43:33.8438562Z and split_tag[2].isnumeric() 2025-11-03T15:43:33.8439056Z ): 2025-11-03T15:43:33.8439436Z pr_number = split_tag[2] 2025-11-03T15:43:33.8440083Z try: 2025-11-03T15:43:33.8440512Z repository = gh.get_repo(repo) 2025-11-03T15:43:33.8441134Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:33.8441732Z except Exception as e: 2025-11-03T15:43:33.8442254Z raise Exception( # noqa: TRY002 2025-11-03T15:43:33.8442917Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:33.8443560Z ) from e 2025-11-03T15:43:33.8444092Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:33.8444933Z # In all other cases, return the original input username 2025-11-03T15:43:33.8445534Z return username 2025-11-03T15:43:33.8445774Z 2025-11-03T15:43:33.8445782Z 2025-11-03T15:43:33.8446003Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:33.8446535Z """ 2025-11-03T15:43:33.8447166Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:33.8447949Z """ 2025-11-03T15:43:33.8448492Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:33.8449011Z 2025-11-03T15:43:33.8449018Z 2025-11-03T15:43:33.8449209Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:33.8449709Z try: 2025-11-03T15:43:33.8450091Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:33.8450598Z return data 2025-11-03T15:43:33.8451010Z except yaml.YAMLError: 2025-11-03T15:43:33.8451498Z log.exception("Error loading YAML") 2025-11-03T15:43:33.8452014Z raise 2025-11-03T15:43:33.8452241Z 2025-11-03T15:43:33.8452248Z 2025-11-03T15:43:33.8452655Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:33.8453410Z """ 2025-11-03T15:43:33.8454026Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:33.8454632Z 2025-11-03T15:43:33.8455218Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:33.8455989Z and the text below is the list of opted in users. 2025-11-03T15:43:33.8456396Z 2025-11-03T15:43:33.8456768Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:33.8457485Z """ 2025-11-03T15:43:33.8457924Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:33.8458524Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:33.8459128Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:33.8459716Z else: 2025-11-03T15:43:33.8460090Z return "", rollout_state 2025-11-03T15:43:33.8460407Z 2025-11-03T15:43:33.8460414Z 2025-11-03T15:43:33.8460612Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:33.8461110Z """ 2025-11-03T15:43:33.8461630Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:33.8462282Z """ 2025-11-03T15:43:33.8462485Z 2025-11-03T15:43:33.8462491Z 2025-11-03T15:43:33.8462833Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:33.8463483Z """ 2025-11-03T15:43:33.8464191Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:33.8465032Z 2025-11-03T15:43:33.8465655Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:33.8466657Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:33.8467337Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:33.8467818Z 2025-11-03T15:43:33.8467830Z 2025-11-03T15:43:33.8467984Z """ 2025-11-03T15:43:33.8468353Z optins = UserOptins() 2025-11-03T15:43:33.8468840Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:33.8469392Z user = user.strip("\r\n\t -") 2025-11-03T15:43:33.8469941Z if not user or not user.startswith("@"): 2025-11-03T15:43:33.8470650Z # Not a valid user. Skip 2025-11-03T15:43:33.8471132Z continue 2025-11-03T15:43:33.8471379Z 2025-11-03T15:43:33.8471544Z if user: 2025-11-03T15:43:33.8471972Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:33.8472673Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:33.8473203Z 2025-11-03T15:43:33.8473367Z return optins 2025-11-03T15:43:33.8473614Z 2025-11-03T15:43:33.8473621Z 2025-11-03T15:43:33.8473905Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:33.8474508Z """ 2025-11-03T15:43:33.8475199Z Check if the experiment name is valid. 2025-11-03T15:43:33.8475739Z A valid name: 2025-11-03T15:43:33.8476371Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:33.8477319Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:33.8478048Z - Cannot contain spaces 2025-11-03T15:43:33.8478515Z """ 2025-11-03T15:43:33.8478711Z 2025-11-03T15:43:33.8478975Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:33.8479677Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:33.8480122Z 2025-11-03T15:43:33.8480293Z if valid: 2025-11-03T15:43:33.8480673Z return True 2025-11-03T15:43:33.8480917Z 2025-11-03T15:43:33.8481089Z log.error( 2025-11-03T15:43:33.8482538Z 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-11-03T15:43:33.8484122Z ) 2025-11-03T15:43:33.8484472Z return False 2025-11-03T15:43:33.8485271Z 2025-11-03T15:43:33.8485278Z 2025-11-03T15:43:33.8485684Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:33.8486329Z """ 2025-11-03T15:43:33.8487076Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:33.8487812Z """ 2025-11-03T15:43:33.8488157Z try: 2025-11-03T15:43:33.8488526Z if settings_text: 2025-11-03T15:43:33.8489251Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:33.8490060Z # for easy reading 2025-11-03T15:43:33.8490854Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:33.8491745Z # the backtick character in shell commands. 2025-11-03T15:43:33.8492373Z backtick = chr(96) # backtick character 2025-11-03T15:43:33.8493050Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:33.8493717Z settings = load_yaml(settings_text) 2025-11-03T15:43:33.8494092Z 2025-11-03T15:43:33.8494500Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:33.8495388Z experiments = {} 2025-11-03T15:43:33.8495694Z 2025-11-03T15:43:33.8496095Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:33.8496856Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:33.8498003Z # 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-11-03T15:43:33.8499063Z continue 2025-11-03T15:43:33.8499355Z 2025-11-03T15:43:33.8499536Z valid_settings = {} 2025-11-03T15:43:33.8500057Z for setting in exp_settings: 2025-11-03T15:43:33.8500623Z if setting not in Experiment._fields: 2025-11-03T15:43:33.8501185Z log.warning( 2025-11-03T15:43:33.8501887Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:33.8502766Z ) 2025-11-03T15:43:33.8503198Z else: 2025-11-03T15:43:33.8503711Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:33.8504137Z 2025-11-03T15:43:33.8504417Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:33.8505205Z return Settings(experiments) 2025-11-03T15:43:33.8505560Z 2025-11-03T15:43:33.8505744Z except Exception: 2025-11-03T15:43:33.8506218Z log.exception("Failed to parse settings") 2025-11-03T15:43:33.8506617Z 2025-11-03T15:43:33.8506785Z return Settings() 2025-11-03T15:43:33.8507039Z 2025-11-03T15:43:33.8507046Z 2025-11-03T15:43:33.8507294Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:33.8507865Z """ 2025-11-03T15:43:33.8508292Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:33.8508702Z 2025-11-03T15:43:33.8509050Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:33.8509821Z and the text below is the list of opted in users. 2025-11-03T15:43:33.8510225Z 2025-11-03T15:43:33.8510626Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:33.8511363Z """ 2025-11-03T15:43:33.8511909Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:33.8512668Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:33.8513071Z 2025-11-03T15:43:33.8513077Z 2025-11-03T15:43:33.8513328Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:33.8513880Z """ 2025-11-03T15:43:33.8514275Z Parse users from the rollout state. 2025-11-03T15:43:33.8514635Z 2025-11-03T15:43:33.8515073Z """ 2025-11-03T15:43:33.8515649Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:33.8516390Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:33.8516811Z 2025-11-03T15:43:33.8516818Z 2025-11-03T15:43:33.8517427Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:33.8518194Z """ 2025-11-03T15:43:33.8518609Z Check if a user is opted into an experiment 2025-11-03T15:43:33.8519156Z """ 2025-11-03T15:43:33.8519607Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:33.8520027Z 2025-11-03T15:43:33.8520035Z 2025-11-03T15:43:33.8520449Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:33.8521189Z """ 2025-11-03T15:43:33.8521648Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:33.8522224Z """ 2025-11-03T15:43:33.8522722Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:33.8523417Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:33.8524064Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:33.8524821Z return False 2025-11-03T15:43:33.8525081Z 2025-11-03T15:43:33.8525363Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:33.8525976Z log.warning( 2025-11-03T15:43:33.8526785Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:33.8527667Z ) 2025-11-03T15:43:33.8527878Z 2025-11-03T15:43:33.8528063Z return True 2025-11-03T15:43:33.8528300Z 2025-11-03T15:43:33.8528307Z 2025-11-03T15:43:33.8528483Z def get_runner_prefix( 2025-11-03T15:43:33.8528932Z rollout_state: str, 2025-11-03T15:43:33.8529395Z workflow_requestors: Iterable[str], 2025-11-03T15:43:33.8529916Z branch: str, 2025-11-03T15:43:33.8530409Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:33.8531067Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:33.8531656Z is_canary: bool = False, 2025-11-03T15:43:33.8532108Z ) -> str: 2025-11-03T15:43:33.8532670Z settings = parse_settings(rollout_state) 2025-11-03T15:43:33.8533259Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:33.8533634Z 2025-11-03T15:43:33.8533808Z fleet_prefix = "" 2025-11-03T15:43:33.8534233Z prefixes = [] 2025-11-03T15:43:33.8534971Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:33.8535913Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:33.8536619Z log.info( 2025-11-03T15:43:33.8537308Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:33.8538064Z ) 2025-11-03T15:43:33.8538446Z continue 2025-11-03T15:43:33.8538697Z 2025-11-03T15:43:33.8538880Z if opt_out_experiments: 2025-11-03T15:43:33.8539415Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:33.8540065Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:33.8540681Z log.info( 2025-11-03T15:43:33.8541616Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:33.8542593Z ) 2025-11-03T15:43:33.8542992Z continue 2025-11-03T15:43:33.8543269Z 2025-11-03T15:43:33.8543454Z if eligible_experiments: 2025-11-03T15:43:33.8544053Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:33.8544808Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:33.8545378Z log.info( 2025-11-03T15:43:33.8546159Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:33.8547008Z ) 2025-11-03T15:43:33.8547412Z continue 2025-11-03T15:43:33.8547891Z elif not experiment_settings.default: 2025-11-03T15:43:33.8548428Z log.info( 2025-11-03T15:43:33.8549226Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:33.8549994Z ) 2025-11-03T15:43:33.8550369Z continue 2025-11-03T15:43:33.8550626Z 2025-11-03T15:43:33.8550909Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:33.8551550Z opted_out_users = [ 2025-11-03T15:43:33.8552011Z requestor 2025-11-03T15:43:33.8552489Z for requestor in workflow_requestors 2025-11-03T15:43:33.8553174Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:33.8553815Z ] 2025-11-03T15:43:33.8554022Z 2025-11-03T15:43:33.8554200Z if opted_out_users: 2025-11-03T15:43:33.8554656Z log.info( 2025-11-03T15:43:33.8555586Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:33.8556307Z ) 2025-11-03T15:43:33.8556691Z continue 2025-11-03T15:43:33.8556958Z 2025-11-03T15:43:33.8557236Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:33.8557858Z opted_in_users = [ 2025-11-03T15:43:33.8558302Z requestor 2025-11-03T15:43:33.8558762Z for requestor in workflow_requestors 2025-11-03T15:43:33.8559431Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:33.8560064Z ] 2025-11-03T15:43:33.8560270Z 2025-11-03T15:43:33.8560449Z enabled = False 2025-11-03T15:43:33.8560887Z if opted_in_users: 2025-11-03T15:43:33.8561335Z log.info( 2025-11-03T15:43:33.8561940Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:33.8562636Z ) 2025-11-03T15:43:33.8563034Z enabled = True 2025-11-03T15:43:33.8563320Z 2025-11-03T15:43:33.8563536Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:33.8564381Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:33.8565631Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:33.8566289Z log.info( 2025-11-03T15:43:33.8567165Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:33.8568109Z ) 2025-11-03T15:43:33.8568519Z enabled = True 2025-11-03T15:43:33.8568831Z 2025-11-03T15:43:33.8568997Z if enabled: 2025-11-03T15:43:33.8569418Z label = experiment_name 2025-11-03T15:43:33.8569974Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:33.8570807Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:33.8571692Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:33.8572465Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:33.8573148Z if is_canary: 2025-11-03T15:43:33.8573642Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:33.8574190Z fleet_prefix = label 2025-11-03T15:43:33.8574817Z else: 2025-11-03T15:43:33.8575249Z prefixes.append(label) 2025-11-03T15:43:33.8575607Z 2025-11-03T15:43:33.8575793Z if len(prefixes) > 1: 2025-11-03T15:43:33.8576242Z log.error( 2025-11-03T15:43:33.8577289Z 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-11-03T15:43:33.8578418Z ) 2025-11-03T15:43:33.8578806Z prefixes = prefixes[:1] 2025-11-03T15:43:33.8579127Z 2025-11-03T15:43:33.8579319Z # Fleet always comes first 2025-11-03T15:43:33.8579785Z if fleet_prefix: 2025-11-03T15:43:33.8580242Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:33.8580611Z 2025-11-03T15:43:33.8581009Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:33.8581438Z 2025-11-03T15:43:33.8581445Z 2025-11-03T15:43:33.8581885Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:33.8582682Z """ 2025-11-03T15:43:33.8583266Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:33.8583839Z 2025-11-03T15:43:33.8584232Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:33.8585056Z """ 2025-11-03T15:43:33.8585442Z gh = get_gh_client(github_token) 2025-11-03T15:43:33.8585996Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:33.8586633Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:33.8587084Z 2025-11-03T15:43:33.8587091Z 2025-11-03T15:43:33.8587483Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:33.8588249Z for _ in range(num_retries): 2025-11-03T15:43:33.8588729Z try: 2025-11-03T15:43:33.8589159Z req = Request(url=url, headers=headers) 2025-11-03T15:43:33.8589821Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:33.8590471Z return json.loads(content) 2025-11-03T15:43:33.8591005Z except Exception as e: 2025-11-03T15:43:33.8591553Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:33.8591962Z 2025-11-03T15:43:33.8592339Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:33.8593063Z return {} 2025-11-03T15:43:33.8593285Z 2025-11-03T15:43:33.8593293Z 2025-11-03T15:43:33.8593459Z @cache 2025-11-03T15:43:33.8594077Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:33.8594937Z """ 2025-11-03T15:43:33.8595325Z Dynamically get PR information 2025-11-03T15:43:33.8596003Z """ 2025-11-03T15:43:33.8596499Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:33.8597140Z headers = { 2025-11-03T15:43:33.8597626Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:33.8598242Z "Authorization": f"token {github_token}", 2025-11-03T15:43:33.8598778Z } 2025-11-03T15:43:33.8599219Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:33.8599839Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:33.8600394Z headers=headers, 2025-11-03T15:43:33.8600824Z ) 2025-11-03T15:43:33.8601019Z 2025-11-03T15:43:33.8601199Z if not json_response: 2025-11-03T15:43:33.8601772Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:33.8602389Z return {} 2025-11-03T15:43:33.8602634Z 2025-11-03T15:43:33.8602817Z return json_response 2025-11-03T15:43:33.8603094Z 2025-11-03T15:43:33.8603100Z 2025-11-03T15:43:33.8603504Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:33.8604248Z """ 2025-11-03T15:43:33.8604982Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:33.8605650Z """ 2025-11-03T15:43:33.8606149Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:33.8606756Z return { 2025-11-03T15:43:33.8607344Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:33.8608043Z } 2025-11-03T15:43:33.8608249Z 2025-11-03T15:43:33.8608257Z 2025-11-03T15:43:33.8608431Z def main() -> None: 2025-11-03T15:43:33.8608854Z args = parse_args() 2025-11-03T15:43:33.8609121Z 2025-11-03T15:43:33.8609343Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:33.8609730Z 2025-11-03T15:43:33.8609928Z # Check if the PR is opt-out 2025-11-03T15:43:33.8610417Z if args.pr_number: 2025-11-03T15:43:33.8611076Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:33.8611975Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:33.8612484Z log.info( 2025-11-03T15:43:33.8613171Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:33.8613937Z ) 2025-11-03T15:43:33.8614494Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:33.8615283Z sys.exit() 2025-11-03T15:43:33.8615548Z 2025-11-03T15:43:33.8615707Z try: 2025-11-03T15:43:33.8616136Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:33.8616845Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:33.8617485Z ) 2025-11-03T15:43:33.8617696Z 2025-11-03T15:43:33.8617900Z username = get_potential_pr_author( 2025-11-03T15:43:33.8618450Z args.github_token, 2025-11-03T15:43:33.8618936Z args.github_repo, 2025-11-03T15:43:33.8619416Z args.github_actor, 2025-11-03T15:43:33.8619902Z args.github_ref_type, 2025-11-03T15:43:33.8620405Z args.github_branch, 2025-11-03T15:43:33.8620862Z ) 2025-11-03T15:43:33.8621076Z 2025-11-03T15:43:33.8621369Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:33.8621818Z 2025-11-03T15:43:33.8622043Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:33.8622599Z rollout_state, 2025-11-03T15:43:33.8623109Z (args.github_issue_owner, username), 2025-11-03T15:43:33.8623668Z args.github_branch, 2025-11-03T15:43:33.8624165Z args.eligible_experiments, 2025-11-03T15:43:33.8624803Z args.opt_out_experiments, 2025-11-03T15:43:33.8625317Z is_canary, 2025-11-03T15:43:33.8625727Z ) 2025-11-03T15:43:33.8625945Z 2025-11-03T15:43:33.8626127Z except Exception as e: 2025-11-03T15:43:33.8626574Z log.error( 2025-11-03T15:43:33.8627248Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:33.8628161Z ) 2025-11-03T15:43:33.8628368Z 2025-11-03T15:43:33.8628695Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:33.8629216Z 2025-11-03T15:43:33.8629223Z 2025-11-03T15:43:33.8629401Z if __name__ == "__main__": 2025-11-03T15:43:33.8629833Z main() 2025-11-03T15:43:33.8630052Z 2025-11-03T15:43:33.8726405Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:33.8727313Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:33.8760858Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:33.8761337Z env: 2025-11-03T15:43:33.8761965Z GITHUB_TOKEN: *** 2025-11-03T15:43:33.8762403Z ISSUE_NUMBER: 5132 2025-11-03T15:43:33.8762850Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:33.8763367Z ISSUE_OWNER: 2025-11-03T15:43:33.8763770Z CHECK_EXPERIMENTS: 2025-11-03T15:43:33.8764211Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:33.8764652Z PR_NUMBER: 2025-11-03T15:43:33.8765195Z ##[endgroup] 2025-11-03T15:43:35.8126515Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:36.6462314Z Collecting urllib3==1.26.18 2025-11-03T15:43:36.6835238Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:36.7028675Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.9 MB/s eta 0:00:00 2025-11-03T15:43:36.7240643Z Collecting PyGithub==2.3.0 2025-11-03T15:43:36.7272843Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:36.7713071Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:36.7745757Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:36.7792918Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:36.7811873Z 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-11-03T15:43:36.7827435Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:36.8082360Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:36.8115427Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:36.8351453Z 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-11-03T15:43:36.9583366Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:36.9614503Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:37.1177712Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:37.1211118Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:37.1412735Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:37.1445963Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:37.1702771Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:37.1766605Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 32.0 MB/s eta 0:00:00 2025-11-03T15:43:37.1824402Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:37.1885783Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 82.6 MB/s eta 0:00:00 2025-11-03T15:43:37.1922605Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:37.2037607Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 147.0 MB/s eta 0:00:00 2025-11-03T15:43:37.2071666Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:37.2125127Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:37.2176389Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 64.6 MB/s eta 0:00:00 2025-11-03T15:43:37.2219660Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:37.2265613Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 41.9 MB/s eta 0:00:00 2025-11-03T15:43:37.2295713Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:37.2338775Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 42.4 MB/s eta 0:00:00 2025-11-03T15:43:37.5803031Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:38.1305523Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:38.2232172Z ##[group]Run curr_branch="main" 2025-11-03T15:43:38.2232627Z curr_branch="main" 2025-11-03T15:43:38.2232934Z curr_ref_type="branch" 2025-11-03T15:43:38.2233198Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:38.2233480Z  2025-11-03T15:43:38.2233771Z python3 runner_determinator.py \ 2025-11-03T15:43:38.2234062Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:38.2234329Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:38.2234581Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:38.2235083Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:38.2235394Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:38.2235689Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:38.2235967Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:38.2236269Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:38.2236623Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:38.2236912Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:38.2270419Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:38.2270641Z env: 2025-11-03T15:43:38.2271101Z GITHUB_TOKEN: *** 2025-11-03T15:43:38.2271289Z ISSUE_NUMBER: 5132 2025-11-03T15:43:38.2271489Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:38.2271728Z ISSUE_OWNER: 2025-11-03T15:43:38.2271918Z CHECK_EXPERIMENTS: 2025-11-03T15:43:38.2272110Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:38.2272297Z PR_NUMBER: 2025-11-03T15:43:38.2272459Z ##[endgroup] 2025-11-03T15:43:38.2325002Z Current branch is 'main' 2025-11-03T15:43:39.8930042Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-11-03T15:43:39.8931201Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:39.8932028Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:39.8932696Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:39.8933253Z INFO : Setting output: label-type='lf.' 2025-11-03T15:43:39.9265246Z Evaluate and set job outputs 2025-11-03T15:43:39.9272003Z Set output 'label-type' 2025-11-03T15:43:39.9273807Z Cleaning up orphan processes