2025-09-07T06:09:27.6604265Z Current runner version: '2.328.0' 2025-09-07T06:09:27.6626024Z ##[group]Runner Image Provisioner 2025-09-07T06:09:27.6626778Z Hosted Compute Agent 2025-09-07T06:09:27.6627316Z Version: 20250829.383 2025-09-07T06:09:27.6628004Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:27.6628685Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:27.6629253Z ##[endgroup] 2025-09-07T06:09:27.6629770Z ##[group]Operating System 2025-09-07T06:09:27.6630347Z Ubuntu 2025-09-07T06:09:27.6630777Z 24.04.3 2025-09-07T06:09:27.6631272Z LTS 2025-09-07T06:09:27.6631726Z ##[endgroup] 2025-09-07T06:09:27.6632203Z ##[group]Runner Image 2025-09-07T06:09:27.6632769Z Image: ubuntu-24.04 2025-09-07T06:09:27.6633246Z Version: 20250831.1.0 2025-09-07T06:09:27.6634481Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:27.6636021Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:27.6636981Z ##[endgroup] 2025-09-07T06:09:27.6637979Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:27.6640053Z Contents: read 2025-09-07T06:09:27.6640572Z Metadata: read 2025-09-07T06:09:27.6641140Z ##[endgroup] 2025-09-07T06:09:27.6643083Z Secret source: Actions 2025-09-07T06:09:27.6644544Z Prepare workflow directory 2025-09-07T06:09:27.7157523Z Prepare all required actions 2025-09-07T06:09:27.7212761Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:27.7217547Z ##[group] Inputs 2025-09-07T06:09:27.7218117Z check_experiments: 2025-09-07T06:09:27.7218839Z opt_out_experiments: lf 2025-09-07T06:09:27.7219381Z triggering_actor: pytorchmergebot 2025-09-07T06:09:27.7219949Z issue_owner: 2025-09-07T06:09:27.7220490Z curr_branch: main 2025-09-07T06:09:27.7220997Z curr_ref_type: branch 2025-09-07T06:09:27.7221583Z issue_number: 5132 2025-09-07T06:09:27.7222192Z ##[endgroup] 2025-09-07T06:09:27.7222859Z Complete job name: unit-test / get-label-type / runner-determinator 2025-09-07T06:09:28.4014216Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:28.4016827Z cat < runner_determinator.py 2025-09-07T06:09:28.4017582Z # flake8: noqa: G004 2025-09-07T06:09:28.4018145Z  2025-09-07T06:09:28.4019016Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.4020142Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.4021110Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.4021938Z  2025-09-07T06:09:28.4022380Z """ 2025-09-07T06:09:28.4023147Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.4024565Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.4025779Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.4026986Z of which runners should be used to run which job. 2025-09-07T06:09:28.4027690Z  2025-09-07T06:09:28.4028435Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.4029465Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.4030603Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.4031483Z list, defined. 2025-09-07T06:09:28.4031985Z  2025-09-07T06:09:28.4032775Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.4034012Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.4035073Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.4035912Z  2025-09-07T06:09:28.4036892Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.4037930Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.4038909Z experiments which the user could be opted in to. 2025-09-07T06:09:28.4039614Z  2025-09-07T06:09:28.4040155Z The user list has the following rules: 2025-09-07T06:09:28.4040877Z  2025-09-07T06:09:28.4041603Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.4042606Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.4043646Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.4044511Z  2025-09-07T06:09:28.4045009Z Example config: 2025-09-07T06:09:28.4045706Z  # A list of experiments that can be opted into. 2025-09-07T06:09:28.4046542Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.4047332Z  # Expected syntax is: 2025-09-07T06:09:28.4048176Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.4049350Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.4050241Z  2025-09-07T06:09:28.4050729Z  experiments: 2025-09-07T06:09:28.4051325Z  lf: 2025-09-07T06:09:28.4051814Z  rollout_percent: 25 2025-09-07T06:09:28.4136356Z  all_branches: false 2025-09-07T06:09:28.4137489Z  default: true 2025-09-07T06:09:28.4138375Z  --- 2025-09-07T06:09:28.4139140Z  2025-09-07T06:09:28.4139864Z  # Opt-ins: 2025-09-07T06:09:28.4141178Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.4142539Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.4143440Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.4144438Z  # Experiments should be from the above list. 2025-09-07T06:09:28.4145036Z  2025-09-07T06:09:28.4145449Z  @User1,-lf,split_build 2025-09-07T06:09:28.4145957Z  @User2,lf 2025-09-07T06:09:28.4146422Z  @User3,split_build 2025-09-07T06:09:28.4146902Z """ 2025-09-07T06:09:28.4147286Z  2025-09-07T06:09:28.4147668Z import json 2025-09-07T06:09:28.4148100Z import logging 2025-09-07T06:09:28.4148544Z import os 2025-09-07T06:09:28.4148951Z import random 2025-09-07T06:09:28.4149392Z import re 2025-09-07T06:09:28.4149801Z import sys 2025-09-07T06:09:28.4150281Z from argparse import ArgumentParser 2025-09-07T06:09:28.4150949Z from collections.abc import Iterable 2025-09-07T06:09:28.4151538Z from functools import cache 2025-09-07T06:09:28.4152084Z from logging import LogRecord 2025-09-07T06:09:28.4152656Z from typing import Any, NamedTuple 2025-09-07T06:09:28.4153300Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.4154122Z  2025-09-07T06:09:28.4154514Z import yaml 2025-09-07T06:09:28.4154974Z from github import Auth, Github 2025-09-07T06:09:28.4155562Z from github.Issue import Issue 2025-09-07T06:09:28.4156086Z  2025-09-07T06:09:28.4156457Z  2025-09-07T06:09:28.4156919Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.4157693Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.4158666Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.4159421Z  2025-09-07T06:09:28.4160089Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.4160726Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.4161316Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.4161976Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.4162534Z  2025-09-07T06:09:28.4162967Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.4163506Z  2025-09-07T06:09:28.4164115Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.4164649Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.4165141Z  2025-09-07T06:09:28.4165516Z  2025-09-07T06:09:28.4165932Z class Experiment(NamedTuple): 2025-09-07T06:09:28.4166489Z  rollout_perc: float = ( 2025-09-07T06:09:28.4167224Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.4167951Z  ) 2025-09-07T06:09:28.4168367Z  all_branches: bool = ( 2025-09-07T06:09:28.4169107Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.4169820Z  ) 2025-09-07T06:09:28.4170226Z  default: bool = ( 2025-09-07T06:09:28.4170890Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.4171577Z  ) 2025-09-07T06:09:28.4171966Z  2025-09-07T06:09:28.4172371Z  # Add more fields as needed 2025-09-07T06:09:28.4172888Z  2025-09-07T06:09:28.4173256Z  2025-09-07T06:09:28.4173662Z class Settings(NamedTuple): 2025-09-07T06:09:28.4174360Z  """ 2025-09-07T06:09:28.4174908Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:28.4175531Z  """ 2025-09-07T06:09:28.4175920Z  2025-09-07T06:09:28.4176365Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.4176936Z  2025-09-07T06:09:28.4177447Z  2025-09-07T06:09:28.4177916Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.4178629Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.4179261Z  2025-09-07T06:09:28.4179637Z  COLORS = { 2025-09-07T06:09:28.4180121Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.4180682Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.4181244Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.4181799Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.4182352Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.4182860Z  } 2025-09-07T06:09:28.4183247Z  2025-09-07T06:09:28.4183711Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.4184740Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.4185593Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.4186225Z  return super().format(record) 2025-09-07T06:09:28.4186763Z  2025-09-07T06:09:28.4187125Z  2025-09-07T06:09:28.4187555Z handler = logging.StreamHandler() 2025-09-07T06:09:28.4188369Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.4189132Z  2025-09-07T06:09:28.4189640Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.4190329Z log.addHandler(handler) 2025-09-07T06:09:28.4190902Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.4191434Z  2025-09-07T06:09:28.4191860Z  2025-09-07T06:09:28.4192409Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.4193083Z  """ 2025-09-07T06:09:28.4193708Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.4194798Z  """ 2025-09-07T06:09:28.4195233Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:28.4196397Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.4197586Z  log.warning( 2025-09-07T06:09:28.4198547Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.4199528Z  ) 2025-09-07T06:09:28.4200032Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.4200614Z  return 2025-09-07T06:09:28.4201045Z  2025-09-07T06:09:28.4201469Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.4202115Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.4202735Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:28.4203270Z  2025-09-07T06:09:28.4203645Z  2025-09-07T06:09:28.4204545Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.4205282Z  return frozenset( 2025-09-07T06:09:28.4205991Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.4206731Z  ) 2025-09-07T06:09:28.4207124Z  2025-09-07T06:09:28.4207496Z  2025-09-07T06:09:28.4207892Z def parse_args() -> Any: 2025-09-07T06:09:28.4208553Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.4209493Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.4210302Z  parser.add_argument( 2025-09-07T06:09:28.4210835Z  "--github-issue-repo", 2025-09-07T06:09:28.4211369Z  type=str, 2025-09-07T06:09:28.4211856Z  required=False, 2025-09-07T06:09:28.4212517Z  default="pytorch/test-infra", 2025-09-07T06:09:28.4213140Z  help="GitHub repo to get the issue", 2025-09-07T06:09:28.4213697Z  ) 2025-09-07T06:09:28.4214302Z  parser.add_argument( 2025-09-07T06:09:28.4214822Z  "--github-repo", 2025-09-07T06:09:28.4215313Z  type=str, 2025-09-07T06:09:28.4215796Z  required=True, 2025-09-07T06:09:28.4216346Z  help="GitHub repo where CI is running", 2025-09-07T06:09:28.4216915Z  ) 2025-09-07T06:09:28.4217336Z  parser.add_argument( 2025-09-07T06:09:28.4218039Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.4218738Z  ) 2025-09-07T06:09:28.4219159Z  parser.add_argument( 2025-09-07T06:09:28.4219874Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.4220611Z  ) 2025-09-07T06:09:28.4221032Z  parser.add_argument( 2025-09-07T06:09:28.4221749Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.4222491Z  ) 2025-09-07T06:09:28.4222918Z  parser.add_argument( 2025-09-07T06:09:28.4223663Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.4224618Z  ) 2025-09-07T06:09:28.4225069Z  parser.add_argument( 2025-09-07T06:09:28.4225595Z  "--github-ref-type", 2025-09-07T06:09:28.4226112Z  type=str, 2025-09-07T06:09:28.4226590Z  required=True, 2025-09-07T06:09:28.4227177Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.4227771Z  ) 2025-09-07T06:09:28.4228187Z  parser.add_argument( 2025-09-07T06:09:28.4228867Z  "--eligible-experiments", 2025-09-07T06:09:28.4229455Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.4230023Z  required=False, 2025-09-07T06:09:28.4230515Z  default="", 2025-09-07T06:09:28.4231458Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.4232440Z  ) 2025-09-07T06:09:28.4232862Z  parser.add_argument( 2025-09-07T06:09:28.4233393Z  "--opt-out-experiments", 2025-09-07T06:09:28.4234203Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.4234803Z  required=False, 2025-09-07T06:09:28.4235294Z  default="", 2025-09-07T06:09:28.4235764Z  help=( 2025-09-07T06:09:28.4236521Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.4237726Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.4238604Z  ), 2025-09-07T06:09:28.4239014Z  ) 2025-09-07T06:09:28.4239435Z  parser.add_argument( 2025-09-07T06:09:28.4239943Z  "--pr-number", 2025-09-07T06:09:28.4240439Z  type=str, 2025-09-07T06:09:28.4240911Z  required=False, 2025-09-07T06:09:28.4241401Z  default="", 2025-09-07T06:09:28.4241969Z  help="the optional PR number where this is run", 2025-09-07T06:09:28.4242564Z  ) 2025-09-07T06:09:28.4242956Z  2025-09-07T06:09:28.4243362Z  return parser.parse_args() 2025-09-07T06:09:28.4244061Z  2025-09-07T06:09:28.4244429Z  2025-09-07T06:09:28.4245093Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.4246079Z  auth = Auth.Token(github_token) 2025-09-07T06:09:28.4246678Z  return Github(auth=auth) 2025-09-07T06:09:28.4247185Z  2025-09-07T06:09:28.4247545Z  2025-09-07T06:09:28.4248256Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.4249111Z  repo = gh.get_repo(repo) 2025-09-07T06:09:28.4249698Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.4250272Z  2025-09-07T06:09:28.4250630Z  2025-09-07T06:09:28.4251033Z def get_potential_pr_author( 2025-09-07T06:09:28.4251761Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.4252495Z ) -> str: 2025-09-07T06:09:28.4253086Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.4254169Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.4255018Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:28.4255632Z  2025-09-07T06:09:28.4256060Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.4256592Z  2025-09-07T06:09:28.4257114Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.4257799Z  split_tag = ref_name.split("/") 2025-09-07T06:09:28.4258356Z  if ( 2025-09-07T06:09:28.4258815Z  len(split_tag) == 3 2025-09-07T06:09:28.4259377Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:28.4259975Z  and split_tag[2].isnumeric() 2025-09-07T06:09:28.4260513Z  ): 2025-09-07T06:09:28.4260973Z  pr_number = split_tag[2] 2025-09-07T06:09:28.4261506Z  try: 2025-09-07T06:09:28.4262018Z  repository = gh.get_repo(repo) 2025-09-07T06:09:28.4262861Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.4263530Z  except Exception as e: 2025-09-07T06:09:28.4264329Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:28.4265066Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.4265765Z  ) from e 2025-09-07T06:09:28.4266389Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.4267163Z  # In all other cases, return the original input username 2025-09-07T06:09:28.4267813Z  return username 2025-09-07T06:09:28.4268273Z  2025-09-07T06:09:28.4268649Z  2025-09-07T06:09:28.4269109Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.4269690Z  """ 2025-09-07T06:09:28.4270413Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.4271249Z  """ 2025-09-07T06:09:28.4271868Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.4272574Z  2025-09-07T06:09:28.4272939Z  2025-09-07T06:09:28.4273363Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.4274135Z  try: 2025-09-07T06:09:28.4274587Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.4275150Z  return data 2025-09-07T06:09:28.4275645Z  except yaml.YAMLError: 2025-09-07T06:09:28.4276215Z  log.exception("Error loading YAML") 2025-09-07T06:09:28.4276781Z  raise 2025-09-07T06:09:28.4277199Z  2025-09-07T06:09:28.4277563Z  2025-09-07T06:09:28.4278227Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.4279016Z  """ 2025-09-07T06:09:28.4279853Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.4280655Z  2025-09-07T06:09:28.4281235Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.4282064Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.4282667Z  2025-09-07T06:09:28.4283284Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.4284707Z  """ 2025-09-07T06:09:28.4285239Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.4285902Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.4286586Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.4287216Z  else: 2025-09-07T06:09:28.4287790Z  return "", rollout_state 2025-09-07T06:09:28.4288443Z  2025-09-07T06:09:28.4288813Z  2025-09-07T06:09:28.4289246Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.4289804Z  """ 2025-09-07T06:09:28.4290393Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.4291086Z  """ 2025-09-07T06:09:28.4291476Z  2025-09-07T06:09:28.4291829Z  2025-09-07T06:09:28.4292415Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.4293109Z  """ 2025-09-07T06:09:28.4294007Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.4294877Z  2025-09-07T06:09:28.4295735Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.4296787Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.4297686Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.4298357Z  2025-09-07T06:09:28.4298709Z  2025-09-07T06:09:28.4299067Z  """ 2025-09-07T06:09:28.4299481Z  optins = UserOptins() 2025-09-07T06:09:28.4300048Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.4300658Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:28.4301260Z  if not user or not user.startswith("@"): 2025-09-07T06:09:28.4301870Z  # Not a valid user. Skip 2025-09-07T06:09:28.4302398Z  continue 2025-09-07T06:09:28.4302848Z  2025-09-07T06:09:28.4303220Z  if user: 2025-09-07T06:09:28.4303872Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.4304629Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.4305319Z  2025-09-07T06:09:28.4305702Z  return optins 2025-09-07T06:09:28.4306145Z  2025-09-07T06:09:28.4306505Z  2025-09-07T06:09:28.4307039Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.4307692Z  """ 2025-09-07T06:09:28.4308151Z  Check if the experiment name is valid. 2025-09-07T06:09:28.4308713Z  A valid name: 2025-09-07T06:09:28.4309436Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.4310425Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.4311186Z  - Cannot contain spaces 2025-09-07T06:09:28.4311697Z  """ 2025-09-07T06:09:28.4312084Z  2025-09-07T06:09:28.4312571Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.4313342Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.4314201Z  2025-09-07T06:09:28.4314581Z  if valid: 2025-09-07T06:09:28.4315018Z  return True 2025-09-07T06:09:28.4315468Z  2025-09-07T06:09:28.4315841Z  log.error( 2025-09-07T06:09:28.4317373Z  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-09-07T06:09:28.4318970Z  ) 2025-09-07T06:09:28.4319369Z  return False 2025-09-07T06:09:28.4319803Z  2025-09-07T06:09:28.4320165Z  2025-09-07T06:09:28.4320713Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.4321390Z  """ 2025-09-07T06:09:28.4322041Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.4322810Z  """ 2025-09-07T06:09:28.4323197Z  try: 2025-09-07T06:09:28.4323607Z  if settings_text: 2025-09-07T06:09:28.4324519Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.4325356Z  # for easy reading 2025-09-07T06:09:28.4326248Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.4327200Z  # the backtick character in shell commands. 2025-09-07T06:09:28.4327869Z  backtick = chr(96) # backtick character 2025-09-07T06:09:28.4328611Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.4329332Z  settings = load_yaml(settings_text) 2025-09-07T06:09:28.4329883Z  2025-09-07T06:09:28.4330518Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.4331449Z  experiments = {} 2025-09-07T06:09:28.4331940Z  2025-09-07T06:09:28.4332538Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.4333355Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.4334656Z  # 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-09-07T06:09:28.4335739Z  continue 2025-09-07T06:09:28.4336228Z  2025-09-07T06:09:28.4336635Z  valid_settings = {} 2025-09-07T06:09:28.4337217Z  for setting in exp_settings: 2025-09-07T06:09:28.4337837Z  if setting not in Experiment._fields: 2025-09-07T06:09:28.4338490Z  log.warning( 2025-09-07T06:09:28.4339284Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.4340044Z  ) 2025-09-07T06:09:28.4340525Z  else: 2025-09-07T06:09:28.4341116Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.4341723Z  2025-09-07T06:09:28.4342230Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.4342930Z  return Settings(experiments) 2025-09-07T06:09:28.4343461Z  2025-09-07T06:09:28.4343943Z  except Exception: 2025-09-07T06:09:28.4344514Z  log.exception("Failed to parse settings") 2025-09-07T06:09:28.4345094Z  2025-09-07T06:09:28.4345477Z  return Settings() 2025-09-07T06:09:28.4345929Z  2025-09-07T06:09:28.4346290Z  2025-09-07T06:09:28.4346949Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.4347582Z  """ 2025-09-07T06:09:28.4348095Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.4348683Z  2025-09-07T06:09:28.4349259Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.4350081Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.4350673Z  2025-09-07T06:09:28.4351311Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.4352097Z  """ 2025-09-07T06:09:28.4352708Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.4353533Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.4354233Z  2025-09-07T06:09:28.4354597Z  2025-09-07T06:09:28.4355104Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.4355724Z  """ 2025-09-07T06:09:28.4356190Z  Parse users from the rollout state. 2025-09-07T06:09:28.4356730Z  2025-09-07T06:09:28.4357092Z  """ 2025-09-07T06:09:28.4357690Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.4358502Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.4359081Z  2025-09-07T06:09:28.4359438Z  2025-09-07T06:09:28.4360107Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.4360895Z  """ 2025-09-07T06:09:28.4361384Z  Check if a user is opted into an experiment 2025-09-07T06:09:28.4361954Z  """ 2025-09-07T06:09:28.4362473Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.4363086Z  2025-09-07T06:09:28.4363574Z  2025-09-07T06:09:28.4364395Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.4365196Z  """ 2025-09-07T06:09:28.4365729Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.4366346Z  """ 2025-09-07T06:09:28.4366917Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.4367669Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.4368374Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.4369020Z  return False 2025-09-07T06:09:28.4369468Z  2025-09-07T06:09:28.4369971Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.4370610Z  log.warning( 2025-09-07T06:09:28.4371507Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.4372418Z  ) 2025-09-07T06:09:28.4372815Z  2025-09-07T06:09:28.4373190Z  return True 2025-09-07T06:09:28.4373614Z  2025-09-07T06:09:28.4374078Z  2025-09-07T06:09:28.4374462Z def get_runner_prefix( 2025-09-07T06:09:28.4374965Z  rollout_state: str, 2025-09-07T06:09:28.4375491Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:28.4376046Z  branch: str, 2025-09-07T06:09:28.4376615Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.4377353Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.4377981Z  is_canary: bool = False, 2025-09-07T06:09:28.4378478Z ) -> str: 2025-09-07T06:09:28.4378973Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:28.4379612Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.4380180Z  2025-09-07T06:09:28.4380689Z  fleet_prefix = "" 2025-09-07T06:09:28.4381199Z  prefixes = [] 2025-09-07T06:09:28.4381910Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.4382922Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.4383679Z  log.info( 2025-09-07T06:09:28.4384528Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.4385311Z  ) 2025-09-07T06:09:28.4385751Z  continue 2025-09-07T06:09:28.4386203Z  2025-09-07T06:09:28.4386604Z  if opt_out_experiments: 2025-09-07T06:09:28.4387199Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.4387904Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.4388542Z  log.info( 2025-09-07T06:09:28.4389542Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.4390543Z  ) 2025-09-07T06:09:28.4391005Z  continue 2025-09-07T06:09:28.4391480Z  2025-09-07T06:09:28.4391886Z  if eligible_experiments: 2025-09-07T06:09:28.4392515Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.4393232Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.4393915Z  log.info( 2025-09-07T06:09:28.4394766Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.4395642Z  ) 2025-09-07T06:09:28.4396233Z  continue 2025-09-07T06:09:28.4396781Z  elif not experiment_settings.default: 2025-09-07T06:09:28.4397355Z  log.info( 2025-09-07T06:09:28.4398081Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.4398846Z  ) 2025-09-07T06:09:28.4399268Z  continue 2025-09-07T06:09:28.4399715Z  2025-09-07T06:09:28.4400225Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.4401112Z  opted_out_users = [ 2025-09-07T06:09:28.4401638Z  requestor 2025-09-07T06:09:28.4402172Z  for requestor in workflow_requestors 2025-09-07T06:09:28.4402908Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.4403573Z  ] 2025-09-07T06:09:28.4404086Z  2025-09-07T06:09:28.4404492Z  if opted_out_users: 2025-09-07T06:09:28.4405028Z  log.info( 2025-09-07T06:09:28.4405733Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.4406463Z  ) 2025-09-07T06:09:28.4406908Z  continue 2025-09-07T06:09:28.4407356Z  2025-09-07T06:09:28.4407854Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.4408500Z  opted_in_users = [ 2025-09-07T06:09:28.4409013Z  requestor 2025-09-07T06:09:28.4409557Z  for requestor in workflow_requestors 2025-09-07T06:09:28.4410278Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.4410940Z  ] 2025-09-07T06:09:28.4411335Z  2025-09-07T06:09:28.4411731Z  enabled = False 2025-09-07T06:09:28.4412238Z  if opted_in_users: 2025-09-07T06:09:28.4413026Z  log.info( 2025-09-07T06:09:28.4413728Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.4414547Z  ) 2025-09-07T06:09:28.4415001Z  enabled = True 2025-09-07T06:09:28.4415483Z  2025-09-07T06:09:28.4415929Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.4416818Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.4417820Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.4418512Z  log.info( 2025-09-07T06:09:28.4419447Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.4420411Z  ) 2025-09-07T06:09:28.4420895Z  enabled = True 2025-09-07T06:09:28.4421408Z  2025-09-07T06:09:28.4421779Z  if enabled: 2025-09-07T06:09:28.4422286Z  label = experiment_name 2025-09-07T06:09:28.4422905Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.4423881Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.4424824Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.4425650Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.4426355Z  if is_canary: 2025-09-07T06:09:28.4426914Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.4427501Z  fleet_prefix = label 2025-09-07T06:09:28.4428044Z  else: 2025-09-07T06:09:28.4428679Z  prefixes.append(label) 2025-09-07T06:09:28.4429222Z  2025-09-07T06:09:28.4429611Z  if len(prefixes) > 1: 2025-09-07T06:09:28.4430115Z  log.error( 2025-09-07T06:09:28.4431234Z  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-09-07T06:09:28.4432378Z  ) 2025-09-07T06:09:28.4432826Z  prefixes = prefixes[:1] 2025-09-07T06:09:28.4433333Z  2025-09-07T06:09:28.4433734Z  # Fleet always comes first 2025-09-07T06:09:28.4434390Z  if fleet_prefix: 2025-09-07T06:09:28.4434913Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.4435461Z  2025-09-07T06:09:28.4435949Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.4436554Z  2025-09-07T06:09:28.4436917Z  2025-09-07T06:09:28.4437607Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.4438410Z  """ 2025-09-07T06:09:28.4439056Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.4439794Z  2025-09-07T06:09:28.4440404Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.4441141Z  """ 2025-09-07T06:09:28.4441582Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.4442195Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.4442892Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.4443528Z  2025-09-07T06:09:28.4443979Z  2025-09-07T06:09:28.4444620Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.4445552Z  for _ in range(num_retries): 2025-09-07T06:09:28.4446079Z  try: 2025-09-07T06:09:28.4446572Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:28.4447290Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.4447992Z  return json.loads(content) 2025-09-07T06:09:28.4448572Z  except Exception as e: 2025-09-07T06:09:28.4449178Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.4449765Z  2025-09-07T06:09:28.4450372Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.4451124Z  return {} 2025-09-07T06:09:28.4451545Z  2025-09-07T06:09:28.4451904Z  2025-09-07T06:09:28.4452262Z @cache 2025-09-07T06:09:28.4452951Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.4453858Z  """ 2025-09-07T06:09:28.4454307Z  Dynamically get PR information 2025-09-07T06:09:28.4454837Z  """ 2025-09-07T06:09:28.4455386Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.4456049Z  headers = { 2025-09-07T06:09:28.4456581Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.4457242Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:28.4457806Z  } 2025-09-07T06:09:28.4458289Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.4458942Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.4459517Z  headers=headers, 2025-09-07T06:09:28.4460005Z  ) 2025-09-07T06:09:28.4460388Z  2025-09-07T06:09:28.4460784Z  if not json_response: 2025-09-07T06:09:28.4461420Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.4462218Z  return {} 2025-09-07T06:09:28.4462671Z  2025-09-07T06:09:28.4463054Z  return json_response 2025-09-07T06:09:28.4463534Z  2025-09-07T06:09:28.4463995Z  2025-09-07T06:09:28.4464626Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.4465384Z  """ 2025-09-07T06:09:28.4465970Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.4466651Z  """ 2025-09-07T06:09:28.4467188Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.4467835Z  return { 2025-09-07T06:09:28.4468469Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.4469195Z  } 2025-09-07T06:09:28.4469573Z  2025-09-07T06:09:28.4469941Z  2025-09-07T06:09:28.4470321Z def main() -> None: 2025-09-07T06:09:28.4470807Z  args = parse_args() 2025-09-07T06:09:28.4471281Z  2025-09-07T06:09:28.4471734Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.4472300Z  2025-09-07T06:09:28.4472698Z  # Check if the PR is opt-out 2025-09-07T06:09:28.4473247Z  if args.pr_number: 2025-09-07T06:09:28.4474079Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.4474890Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.4475431Z  log.info( 2025-09-07T06:09:28.4476202Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.4477001Z  ) 2025-09-07T06:09:28.4477619Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.4478368Z  sys.exit() 2025-09-07T06:09:28.4478951Z  2025-09-07T06:09:28.4479329Z  try: 2025-09-07T06:09:28.4479843Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.4480657Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.4481385Z  ) 2025-09-07T06:09:28.4481783Z  2025-09-07T06:09:28.4482212Z  username = get_potential_pr_author( 2025-09-07T06:09:28.4482787Z  args.github_token, 2025-09-07T06:09:28.4483327Z  args.github_repo, 2025-09-07T06:09:28.4483952Z  args.github_actor, 2025-09-07T06:09:28.4484500Z  args.github_ref_type, 2025-09-07T06:09:28.4485042Z  args.github_branch, 2025-09-07T06:09:28.4485550Z  ) 2025-09-07T06:09:28.4485964Z  2025-09-07T06:09:28.4486481Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.4487134Z  2025-09-07T06:09:28.4487583Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.4488172Z  rollout_state, 2025-09-07T06:09:28.4488721Z  (args.github_issue_owner, username), 2025-09-07T06:09:28.4489309Z  args.github_branch, 2025-09-07T06:09:28.4489878Z  args.eligible_experiments, 2025-09-07T06:09:28.4490461Z  args.opt_out_experiments, 2025-09-07T06:09:28.4491011Z  is_canary, 2025-09-07T06:09:28.4491478Z  ) 2025-09-07T06:09:28.4491881Z  2025-09-07T06:09:28.4492268Z  except Exception as e: 2025-09-07T06:09:28.4492779Z  log.error( 2025-09-07T06:09:28.4493534Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.4494567Z  ) 2025-09-07T06:09:28.4494977Z  2025-09-07T06:09:28.4495547Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.4496238Z  2025-09-07T06:09:28.4496593Z  2025-09-07T06:09:28.4496981Z if __name__ == "__main__": 2025-09-07T06:09:28.4497470Z  main() 2025-09-07T06:09:28.4497879Z  2025-09-07T06:09:28.4498236Z EOF 2025-09-07T06:09:28.4498619Z  2025-09-07T06:09:28.4499021Z cat runner_determinator.py 2025-09-07T06:09:28.5737661Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.5738477Z env: 2025-09-07T06:09:28.5739165Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.5739599Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.5740058Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.5740567Z ISSUE_OWNER: 2025-09-07T06:09:28.5740974Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.5741408Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T06:09:28.5741861Z PR_NUMBER: 2025-09-07T06:09:28.5742262Z ##[endgroup] 2025-09-07T06:09:28.5943362Z # flake8: noqa: G004 2025-09-07T06:09:28.5944025Z 2025-09-07T06:09:28.5944747Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.5945712Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.5946517Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.5946965Z 2025-09-07T06:09:28.5947124Z """ 2025-09-07T06:09:28.5947700Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.5948575Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.5949473Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.5950297Z of which runners should be used to run which job. 2025-09-07T06:09:28.5950703Z 2025-09-07T06:09:28.5951092Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.5952182Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.5953098Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.5954025Z list, defined. 2025-09-07T06:09:28.5954297Z 2025-09-07T06:09:28.5954668Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.5955599Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.5956424Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.5956863Z 2025-09-07T06:09:28.5957233Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.5958100Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.5958840Z experiments which the user could be opted in to. 2025-09-07T06:09:28.5959239Z 2025-09-07T06:09:28.5959434Z The user list has the following rules: 2025-09-07T06:09:28.5959787Z 2025-09-07T06:09:28.5960110Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.5960959Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.5961716Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.5962104Z 2025-09-07T06:09:28.5962279Z Example config: 2025-09-07T06:09:28.5962725Z # A list of experiments that can be opted into. 2025-09-07T06:09:28.5963392Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.5964202Z # Expected syntax is: 2025-09-07T06:09:28.5964859Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.5965833Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.5966454Z 2025-09-07T06:09:28.5966625Z experiments: 2025-09-07T06:09:28.5967021Z lf: 2025-09-07T06:09:28.5967393Z rollout_percent: 25 2025-09-07T06:09:28.5968011Z all_branches: false 2025-09-07T06:09:28.5968464Z default: true 2025-09-07T06:09:28.5968873Z --- 2025-09-07T06:09:28.5969079Z 2025-09-07T06:09:28.5969242Z # Opt-ins: 2025-09-07T06:09:28.5969825Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.5970693Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.5971466Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.5972115Z # Experiments should be from the above list. 2025-09-07T06:09:28.5972487Z 2025-09-07T06:09:28.5972662Z @User1,-lf,split_build 2025-09-07T06:09:28.5973094Z @User2,lf 2025-09-07T06:09:28.5973471Z @User3,split_build 2025-09-07T06:09:28.5974223Z """ 2025-09-07T06:09:28.5974491Z 2025-09-07T06:09:28.5974661Z import json 2025-09-07T06:09:28.5975042Z import logging 2025-09-07T06:09:28.5975420Z import os 2025-09-07T06:09:28.5975787Z import random 2025-09-07T06:09:28.5976163Z import re 2025-09-07T06:09:28.5976532Z import sys 2025-09-07T06:09:28.5976938Z from argparse import ArgumentParser 2025-09-07T06:09:28.5977468Z from collections.abc import Iterable 2025-09-07T06:09:28.5977998Z from functools import cache 2025-09-07T06:09:28.5978466Z from logging import LogRecord 2025-09-07T06:09:28.5978950Z from typing import Any, NamedTuple 2025-09-07T06:09:28.5979479Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.5979853Z 2025-09-07T06:09:28.5980014Z import yaml 2025-09-07T06:09:28.5980394Z from github import Auth, Github 2025-09-07T06:09:28.5980881Z from github.Issue import Issue 2025-09-07T06:09:28.5981180Z 2025-09-07T06:09:28.5981187Z 2025-09-07T06:09:28.5981407Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.5982100Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.5982970Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.5983633Z 2025-09-07T06:09:28.5984074Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.5984819Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.5985352Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.5985912Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.5986264Z 2025-09-07T06:09:28.5986462Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.5986793Z 2025-09-07T06:09:28.5986976Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.5987434Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.5987724Z 2025-09-07T06:09:28.5987731Z 2025-09-07T06:09:28.5987926Z class Experiment(NamedTuple): 2025-09-07T06:09:28.5988416Z rollout_perc: float = ( 2025-09-07T06:09:28.5989055Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.5989730Z ) 2025-09-07T06:09:28.5990094Z all_branches: bool = ( 2025-09-07T06:09:28.5990710Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.5991382Z ) 2025-09-07T06:09:28.5991739Z default: bool = ( 2025-09-07T06:09:28.5992310Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.5992941Z ) 2025-09-07T06:09:28.5993135Z 2025-09-07T06:09:28.5993311Z # Add more fields as needed 2025-09-07T06:09:28.5993648Z 2025-09-07T06:09:28.5993654Z 2025-09-07T06:09:28.5994037Z class Settings(NamedTuple): 2025-09-07T06:09:28.5994491Z """ 2025-09-07T06:09:28.5994942Z Settings for the experiments that can be opted into. 2025-09-07T06:09:28.5995507Z """ 2025-09-07T06:09:28.5995699Z 2025-09-07T06:09:28.5995908Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.5996273Z 2025-09-07T06:09:28.5996280Z 2025-09-07T06:09:28.5996486Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.5997107Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.5997537Z 2025-09-07T06:09:28.5997703Z COLORS = { 2025-09-07T06:09:28.5998102Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.5998753Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.5999258Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.5999759Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.6000237Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.6000700Z } 2025-09-07T06:09:28.6000891Z 2025-09-07T06:09:28.6001107Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.6001857Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.6002642Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.6003214Z return super().format(record) 2025-09-07T06:09:28.6003546Z 2025-09-07T06:09:28.6003553Z 2025-09-07T06:09:28.6003910Z handler = logging.StreamHandler() 2025-09-07T06:09:28.6004640Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.6005204Z 2025-09-07T06:09:28.6005448Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.6006029Z log.addHandler(handler) 2025-09-07T06:09:28.6006472Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.6006757Z 2025-09-07T06:09:28.6006764Z 2025-09-07T06:09:28.6007020Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.6007571Z """ 2025-09-07T06:09:28.6008078Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.6008713Z """ 2025-09-07T06:09:28.6009078Z if not GITHUB_OUTPUT: 2025-09-07T06:09:28.6010132Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.6011254Z log.warning( 2025-09-07T06:09:28.6012104Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.6013027Z ) 2025-09-07T06:09:28.6022939Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.6023553Z return 2025-09-07T06:09:28.6024050Z 2025-09-07T06:09:28.6024461Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.6025065Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.6025636Z f.write(f"{key}={value}\n") 2025-09-07T06:09:28.6025960Z 2025-09-07T06:09:28.6025967Z 2025-09-07T06:09:28.6026273Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.6026893Z return frozenset( 2025-09-07T06:09:28.6027500Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.6028177Z ) 2025-09-07T06:09:28.6028378Z 2025-09-07T06:09:28.6028385Z 2025-09-07T06:09:28.6028563Z def parse_args() -> Any: 2025-09-07T06:09:28.6029111Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.6029977Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.6030752Z parser.add_argument( 2025-09-07T06:09:28.6031204Z "--github-issue-repo", 2025-09-07T06:09:28.6031667Z type=str, 2025-09-07T06:09:28.6032070Z required=False, 2025-09-07T06:09:28.6032522Z default="pytorch/test-infra", 2025-09-07T06:09:28.6033051Z help="GitHub repo to get the issue", 2025-09-07T06:09:28.6033556Z ) 2025-09-07T06:09:28.6034142Z parser.add_argument( 2025-09-07T06:09:28.6034604Z "--github-repo", 2025-09-07T06:09:28.6035031Z type=str, 2025-09-07T06:09:28.6035432Z required=True, 2025-09-07T06:09:28.6035884Z help="GitHub repo where CI is running", 2025-09-07T06:09:28.6036408Z ) 2025-09-07T06:09:28.6036779Z parser.add_argument( 2025-09-07T06:09:28.6037380Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.6038041Z ) 2025-09-07T06:09:28.6038402Z parser.add_argument( 2025-09-07T06:09:28.6039011Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.6039674Z ) 2025-09-07T06:09:28.6040032Z parser.add_argument( 2025-09-07T06:09:28.6040812Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.6041500Z ) 2025-09-07T06:09:28.6092021Z parser.add_argument( 2025-09-07T06:09:28.6092831Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.6093613Z ) 2025-09-07T06:09:28.6094113Z parser.add_argument( 2025-09-07T06:09:28.6094594Z "--github-ref-type", 2025-09-07T06:09:28.6095089Z type=str, 2025-09-07T06:09:28.6095484Z required=True, 2025-09-07T06:09:28.6095973Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.6096515Z ) 2025-09-07T06:09:28.6096878Z parser.add_argument( 2025-09-07T06:09:28.6097333Z "--eligible-experiments", 2025-09-07T06:09:28.6097837Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6098352Z required=False, 2025-09-07T06:09:28.6098764Z default="", 2025-09-07T06:09:28.6099627Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.6100562Z ) 2025-09-07T06:09:28.6100927Z parser.add_argument( 2025-09-07T06:09:28.6101374Z "--opt-out-experiments", 2025-09-07T06:09:28.6101874Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6102377Z required=False, 2025-09-07T06:09:28.6102791Z default="", 2025-09-07T06:09:28.6103174Z help=( 2025-09-07T06:09:28.6103932Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.6105063Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.6105876Z ), 2025-09-07T06:09:28.6106222Z ) 2025-09-07T06:09:28.6106580Z parser.add_argument( 2025-09-07T06:09:28.6107005Z "--pr-number", 2025-09-07T06:09:28.6107405Z type=str, 2025-09-07T06:09:28.6107789Z required=False, 2025-09-07T06:09:28.6108208Z default="", 2025-09-07T06:09:28.6108844Z help="the optional PR number where this is run", 2025-09-07T06:09:28.6109428Z ) 2025-09-07T06:09:28.6109624Z 2025-09-07T06:09:28.6109810Z return parser.parse_args() 2025-09-07T06:09:28.6110118Z 2025-09-07T06:09:28.6110131Z 2025-09-07T06:09:28.6110532Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6111283Z auth = Auth.Token(github_token) 2025-09-07T06:09:28.6111784Z return Github(auth=auth) 2025-09-07T06:09:28.6112076Z 2025-09-07T06:09:28.6112083Z 2025-09-07T06:09:28.6112537Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6113323Z repo = gh.get_repo(repo) 2025-09-07T06:09:28.6113946Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.6114316Z 2025-09-07T06:09:28.6114322Z 2025-09-07T06:09:28.6114509Z def get_potential_pr_author( 2025-09-07T06:09:28.6115159Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.6115825Z ) -> str: 2025-09-07T06:09:28.6116334Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.6117127Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.6117848Z # embedded in the tag name: ciflow// 2025-09-07T06:09:28.6118258Z 2025-09-07T06:09:28.6118451Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.6118774Z 2025-09-07T06:09:28.6119042Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.6119661Z split_tag = ref_name.split("/") 2025-09-07T06:09:28.6120147Z if ( 2025-09-07T06:09:28.6120529Z len(split_tag) == 3 2025-09-07T06:09:28.6121004Z and split_tag[0] == "ciflow" 2025-09-07T06:09:28.6121518Z and split_tag[2].isnumeric() 2025-09-07T06:09:28.6122014Z ): 2025-09-07T06:09:28.6122389Z pr_number = split_tag[2] 2025-09-07T06:09:28.6122997Z try: 2025-09-07T06:09:28.6123410Z repository = gh.get_repo(repo) 2025-09-07T06:09:28.6124131Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.6124723Z except Exception as e: 2025-09-07T06:09:28.6125236Z raise Exception( # noqa: TRY002 2025-09-07T06:09:28.6125889Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.6126528Z ) from e 2025-09-07T06:09:28.6127060Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.6127740Z # In all other cases, return the original input username 2025-09-07T06:09:28.6128333Z return username 2025-09-07T06:09:28.6128569Z 2025-09-07T06:09:28.6128575Z 2025-09-07T06:09:28.6128794Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.6129315Z """ 2025-09-07T06:09:28.6129939Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.6130712Z """ 2025-09-07T06:09:28.6131249Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.6131763Z 2025-09-07T06:09:28.6131770Z 2025-09-07T06:09:28.6131963Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.6132447Z try: 2025-09-07T06:09:28.6132823Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.6133324Z return data 2025-09-07T06:09:28.6133731Z except yaml.YAMLError: 2025-09-07T06:09:28.6134310Z log.exception("Error loading YAML") 2025-09-07T06:09:28.6134809Z raise 2025-09-07T06:09:28.6135026Z 2025-09-07T06:09:28.6135033Z 2025-09-07T06:09:28.6135443Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.6136178Z """ 2025-09-07T06:09:28.6136779Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.6137372Z 2025-09-07T06:09:28.6137844Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6138608Z and the text below is the list of opted in users. 2025-09-07T06:09:28.6139020Z 2025-09-07T06:09:28.6139392Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.6140085Z """ 2025-09-07T06:09:28.6140523Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.6141139Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.6141733Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.6142312Z else: 2025-09-07T06:09:28.6142681Z return "", rollout_state 2025-09-07T06:09:28.6142996Z 2025-09-07T06:09:28.6143004Z 2025-09-07T06:09:28.6143201Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.6143703Z """ 2025-09-07T06:09:28.6144326Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.6144965Z """ 2025-09-07T06:09:28.6145165Z 2025-09-07T06:09:28.6145173Z 2025-09-07T06:09:28.6145508Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.6146152Z """ 2025-09-07T06:09:28.6146841Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.6147522Z 2025-09-07T06:09:28.6148132Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.6149107Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.6149774Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.6150245Z 2025-09-07T06:09:28.6150258Z 2025-09-07T06:09:28.6150413Z """ 2025-09-07T06:09:28.6150779Z optins = UserOptins() 2025-09-07T06:09:28.6151257Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.6151799Z user = user.strip("\r\n\t -") 2025-09-07T06:09:28.6152340Z if not user or not user.startswith("@"): 2025-09-07T06:09:28.6153039Z # Not a valid user. Skip 2025-09-07T06:09:28.6153512Z continue 2025-09-07T06:09:28.6154189Z 2025-09-07T06:09:28.6154372Z if user: 2025-09-07T06:09:28.6154810Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.6155497Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.6155981Z 2025-09-07T06:09:28.6156144Z return optins 2025-09-07T06:09:28.6156382Z 2025-09-07T06:09:28.6156389Z 2025-09-07T06:09:28.6156673Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.6157263Z """ 2025-09-07T06:09:28.6157649Z Check if the experiment name is valid. 2025-09-07T06:09:28.6158167Z A valid name: 2025-09-07T06:09:28.6158782Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.6159733Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.6160457Z - Cannot contain spaces 2025-09-07T06:09:28.6160914Z """ 2025-09-07T06:09:28.6161108Z 2025-09-07T06:09:28.6161366Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.6162060Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.6162499Z 2025-09-07T06:09:28.6162659Z if valid: 2025-09-07T06:09:28.6163023Z return True 2025-09-07T06:09:28.6163257Z 2025-09-07T06:09:28.6163423Z log.error( 2025-09-07T06:09:28.6164968Z 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-09-07T06:09:28.6166506Z ) 2025-09-07T06:09:28.6166853Z return False 2025-09-07T06:09:28.6167084Z 2025-09-07T06:09:28.6167090Z 2025-09-07T06:09:28.6167386Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.6167994Z """ 2025-09-07T06:09:28.6168710Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.6169451Z """ 2025-09-07T06:09:28.6169794Z try: 2025-09-07T06:09:28.6170159Z if settings_text: 2025-09-07T06:09:28.6170885Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.6171665Z # for easy reading 2025-09-07T06:09:28.6172442Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.6173314Z # the backtick character in shell commands. 2025-09-07T06:09:28.6174022Z backtick = chr(96) # backtick character 2025-09-07T06:09:28.6174677Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.6175344Z settings = load_yaml(settings_text) 2025-09-07T06:09:28.6175712Z 2025-09-07T06:09:28.6176132Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.6176880Z experiments = {} 2025-09-07T06:09:28.6177173Z 2025-09-07T06:09:28.6177552Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.6178311Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.6179415Z # 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-09-07T06:09:28.6180457Z continue 2025-09-07T06:09:28.6180740Z 2025-09-07T06:09:28.6180923Z valid_settings = {} 2025-09-07T06:09:28.6181442Z for setting in exp_settings: 2025-09-07T06:09:28.6181996Z if setting not in Experiment._fields: 2025-09-07T06:09:28.6182548Z log.warning( 2025-09-07T06:09:28.6183245Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.6184246Z ) 2025-09-07T06:09:28.6184673Z else: 2025-09-07T06:09:28.6185184Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.6185606Z 2025-09-07T06:09:28.6185884Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.6186509Z return Settings(experiments) 2025-09-07T06:09:28.6186865Z 2025-09-07T06:09:28.6187033Z except Exception: 2025-09-07T06:09:28.6187500Z log.exception("Failed to parse settings") 2025-09-07T06:09:28.6187889Z 2025-09-07T06:09:28.6188057Z return Settings() 2025-09-07T06:09:28.6188306Z 2025-09-07T06:09:28.6188312Z 2025-09-07T06:09:28.6188558Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.6189120Z """ 2025-09-07T06:09:28.6189545Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.6189948Z 2025-09-07T06:09:28.6190291Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6191060Z and the text below is the list of opted in users. 2025-09-07T06:09:28.6191463Z 2025-09-07T06:09:28.6191866Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.6192588Z """ 2025-09-07T06:09:28.6193134Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6194011Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.6194413Z 2025-09-07T06:09:28.6194425Z 2025-09-07T06:09:28.6194670Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.6195216Z """ 2025-09-07T06:09:28.6195597Z Parse users from the rollout state. 2025-09-07T06:09:28.6195941Z 2025-09-07T06:09:28.6196092Z """ 2025-09-07T06:09:28.6196610Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6197352Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.6197763Z 2025-09-07T06:09:28.6197769Z 2025-09-07T06:09:28.6198308Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6199063Z """ 2025-09-07T06:09:28.6199466Z Check if a user is opted into an experiment 2025-09-07T06:09:28.6200002Z """ 2025-09-07T06:09:28.6200440Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.6200860Z 2025-09-07T06:09:28.6200866Z 2025-09-07T06:09:28.6201280Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6202019Z """ 2025-09-07T06:09:28.6202465Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.6203036Z """ 2025-09-07T06:09:28.6203527Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.6204319Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.6204950Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.6205549Z return False 2025-09-07T06:09:28.6205799Z 2025-09-07T06:09:28.6206074Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.6206666Z log.warning( 2025-09-07T06:09:28.6207462Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.6208326Z ) 2025-09-07T06:09:28.6208534Z 2025-09-07T06:09:28.6208695Z return True 2025-09-07T06:09:28.6208926Z 2025-09-07T06:09:28.6208933Z 2025-09-07T06:09:28.6209108Z def get_runner_prefix( 2025-09-07T06:09:28.6209541Z rollout_state: str, 2025-09-07T06:09:28.6209995Z workflow_requestors: Iterable[str], 2025-09-07T06:09:28.6210502Z branch: str, 2025-09-07T06:09:28.6210985Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6211639Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6212224Z is_canary: bool = False, 2025-09-07T06:09:28.6212675Z ) -> str: 2025-09-07T06:09:28.6213246Z settings = parse_settings(rollout_state) 2025-09-07T06:09:28.6213931Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.6214309Z 2025-09-07T06:09:28.6214479Z fleet_prefix = "" 2025-09-07T06:09:28.6214891Z prefixes = [] 2025-09-07T06:09:28.6215503Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.6216447Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.6217149Z log.info( 2025-09-07T06:09:28.6217820Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.6218575Z ) 2025-09-07T06:09:28.6218956Z continue 2025-09-07T06:09:28.6219205Z 2025-09-07T06:09:28.6219395Z if opt_out_experiments: 2025-09-07T06:09:28.6219931Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.6220563Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.6221145Z log.info( 2025-09-07T06:09:28.6222065Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.6223047Z ) 2025-09-07T06:09:28.6223440Z continue 2025-09-07T06:09:28.6223703Z 2025-09-07T06:09:28.6223977Z if eligible_experiments: 2025-09-07T06:09:28.6224551Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.6225179Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.6225733Z log.info( 2025-09-07T06:09:28.6226503Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.6227324Z ) 2025-09-07T06:09:28.6227737Z continue 2025-09-07T06:09:28.6228198Z elif not experiment_settings.default: 2025-09-07T06:09:28.6228733Z log.info( 2025-09-07T06:09:28.6229507Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.6230252Z ) 2025-09-07T06:09:28.6230647Z continue 2025-09-07T06:09:28.6230889Z 2025-09-07T06:09:28.6231159Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.6231770Z opted_out_users = [ 2025-09-07T06:09:28.6232203Z requestor 2025-09-07T06:09:28.6232651Z for requestor in workflow_requestors 2025-09-07T06:09:28.6233307Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6234040Z ] 2025-09-07T06:09:28.6234246Z 2025-09-07T06:09:28.6234425Z if opted_out_users: 2025-09-07T06:09:28.6234863Z log.info( 2025-09-07T06:09:28.6235473Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.6236176Z ) 2025-09-07T06:09:28.6236542Z continue 2025-09-07T06:09:28.6236792Z 2025-09-07T06:09:28.6237071Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.6237685Z opted_in_users = [ 2025-09-07T06:09:28.6238126Z requestor 2025-09-07T06:09:28.6238578Z for requestor in workflow_requestors 2025-09-07T06:09:28.6239237Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6239839Z ] 2025-09-07T06:09:28.6240043Z 2025-09-07T06:09:28.6240209Z enabled = False 2025-09-07T06:09:28.6240633Z if opted_in_users: 2025-09-07T06:09:28.6241067Z log.info( 2025-09-07T06:09:28.6241660Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.6242336Z ) 2025-09-07T06:09:28.6242717Z enabled = True 2025-09-07T06:09:28.6242996Z 2025-09-07T06:09:28.6243211Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.6244271Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.6245352Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.6246005Z log.info( 2025-09-07T06:09:28.6246860Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.6247780Z ) 2025-09-07T06:09:28.6248171Z enabled = True 2025-09-07T06:09:28.6248472Z 2025-09-07T06:09:28.6248634Z if enabled: 2025-09-07T06:09:28.6249058Z label = experiment_name 2025-09-07T06:09:28.6249602Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.6250434Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.6251308Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.6252058Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.6252708Z if is_canary: 2025-09-07T06:09:28.6253197Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.6253742Z fleet_prefix = label 2025-09-07T06:09:28.6254329Z else: 2025-09-07T06:09:28.6254750Z prefixes.append(label) 2025-09-07T06:09:28.6255096Z 2025-09-07T06:09:28.6255272Z if len(prefixes) > 1: 2025-09-07T06:09:28.6255704Z log.error( 2025-09-07T06:09:28.6256724Z 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-09-07T06:09:28.6257834Z ) 2025-09-07T06:09:28.6258213Z prefixes = prefixes[:1] 2025-09-07T06:09:28.6258523Z 2025-09-07T06:09:28.6258703Z # Fleet always comes first 2025-09-07T06:09:28.6259166Z if fleet_prefix: 2025-09-07T06:09:28.6259604Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.6259962Z 2025-09-07T06:09:28.6260337Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.6260760Z 2025-09-07T06:09:28.6260767Z 2025-09-07T06:09:28.6261207Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.6261970Z """ 2025-09-07T06:09:28.6262543Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.6263103Z 2025-09-07T06:09:28.6263486Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.6264287Z """ 2025-09-07T06:09:28.6264665Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.6265196Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.6265819Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.6266266Z 2025-09-07T06:09:28.6266272Z 2025-09-07T06:09:28.6266664Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.6267417Z for _ in range(num_retries): 2025-09-07T06:09:28.6267884Z try: 2025-09-07T06:09:28.6268305Z req = Request(url=url, headers=headers) 2025-09-07T06:09:28.6268955Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.6269587Z return json.loads(content) 2025-09-07T06:09:28.6270100Z except Exception as e: 2025-09-07T06:09:28.6270631Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.6271028Z 2025-09-07T06:09:28.6271405Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.6272102Z return {} 2025-09-07T06:09:28.6272321Z 2025-09-07T06:09:28.6272327Z 2025-09-07T06:09:28.6272485Z @cache 2025-09-07T06:09:28.6273094Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.6273984Z """ 2025-09-07T06:09:28.6274370Z Dynamically get PR information 2025-09-07T06:09:28.6274851Z """ 2025-09-07T06:09:28.6275467Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.6276089Z headers = { 2025-09-07T06:09:28.6276541Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.6277136Z "Authorization": f"token {github_token}", 2025-09-07T06:09:28.6277661Z } 2025-09-07T06:09:28.6278077Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.6278677Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.6279219Z headers=headers, 2025-09-07T06:09:28.6279636Z ) 2025-09-07T06:09:28.6279828Z 2025-09-07T06:09:28.6280004Z if not json_response: 2025-09-07T06:09:28.6280568Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.6281172Z return {} 2025-09-07T06:09:28.6281411Z 2025-09-07T06:09:28.6281585Z return json_response 2025-09-07T06:09:28.6281857Z 2025-09-07T06:09:28.6281863Z 2025-09-07T06:09:28.6282261Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.6282988Z """ 2025-09-07T06:09:28.6283507Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.6284265Z """ 2025-09-07T06:09:28.6284739Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.6285349Z return { 2025-09-07T06:09:28.6285932Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.6286623Z } 2025-09-07T06:09:28.6286820Z 2025-09-07T06:09:28.6286826Z 2025-09-07T06:09:28.6286993Z def main() -> None: 2025-09-07T06:09:28.6287407Z args = parse_args() 2025-09-07T06:09:28.6287669Z 2025-09-07T06:09:28.6287885Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.6288269Z 2025-09-07T06:09:28.6288456Z # Check if the PR is opt-out 2025-09-07T06:09:28.6288928Z if args.pr_number: 2025-09-07T06:09:28.6289568Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.6290437Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.6290935Z log.info( 2025-09-07T06:09:28.6291616Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.6292362Z ) 2025-09-07T06:09:28.6292898Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6293585Z sys.exit() 2025-09-07T06:09:28.6293943Z 2025-09-07T06:09:28.6294106Z try: 2025-09-07T06:09:28.6294533Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.6295227Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.6295860Z ) 2025-09-07T06:09:28.6296061Z 2025-09-07T06:09:28.6296263Z username = get_potential_pr_author( 2025-09-07T06:09:28.6296795Z args.github_token, 2025-09-07T06:09:28.6297259Z args.github_repo, 2025-09-07T06:09:28.6297729Z args.github_actor, 2025-09-07T06:09:28.6298206Z args.github_ref_type, 2025-09-07T06:09:28.6298709Z args.github_branch, 2025-09-07T06:09:28.6299159Z ) 2025-09-07T06:09:28.6299364Z 2025-09-07T06:09:28.6299641Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.6300084Z 2025-09-07T06:09:28.6300301Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.6300841Z rollout_state, 2025-09-07T06:09:28.6301317Z (args.github_issue_owner, username), 2025-09-07T06:09:28.6301855Z args.github_branch, 2025-09-07T06:09:28.6302341Z args.eligible_experiments, 2025-09-07T06:09:28.6302866Z args.opt_out_experiments, 2025-09-07T06:09:28.6303364Z is_canary, 2025-09-07T06:09:28.6303864Z ) 2025-09-07T06:09:28.6304068Z 2025-09-07T06:09:28.6304250Z except Exception as e: 2025-09-07T06:09:28.6304693Z log.error( 2025-09-07T06:09:28.6305347Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.6306241Z ) 2025-09-07T06:09:28.6306445Z 2025-09-07T06:09:28.6306770Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6307265Z 2025-09-07T06:09:28.6307271Z 2025-09-07T06:09:28.6307445Z if __name__ == "__main__": 2025-09-07T06:09:28.6307869Z main() 2025-09-07T06:09:28.6308075Z 2025-09-07T06:09:28.6403378Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.6404575Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.6434367Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.6434852Z env: 2025-09-07T06:09:28.6435441Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.6435874Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.6436317Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.6436821Z ISSUE_OWNER: 2025-09-07T06:09:28.6437215Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.6437645Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T06:09:28.6438093Z PR_NUMBER: 2025-09-07T06:09:28.6438472Z ##[endgroup] 2025-09-07T06:09:31.3840911Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:32.4432654Z Collecting urllib3==1.26.18 2025-09-07T06:09:32.5102753Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:32.5344207Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.0 MB/s eta 0:00:00 2025-09-07T06:09:32.5654820Z Collecting PyGithub==2.3.0 2025-09-07T06:09:32.5781145Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:32.6287842Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:32.6388843Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-09-07T06:09:32.6435474Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:32.6447191Z 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-09-07T06:09:32.6465948Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:32.6805326Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:32.6905576Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:32.7131823Z 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-09-07T06:09:32.8428366Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.8532532Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:32.9826424Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:32.9934870Z 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-09-07T06:09:33.0179170Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:33.0281365Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:33.0590086Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:33.0743097Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.0 MB/s eta 0:00:00 2025-09-07T06:09:33.0862562Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:33.1209778Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 10.5 MB/s eta 0:00:00 2025-09-07T06:09:33.1311158Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:33.1967619Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 13.3 MB/s eta 0:00:00 2025-09-07T06:09:33.2066295Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:33.2194785Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:33.2499702Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 16.3 MB/s eta 0:00:00 2025-09-07T06:09:33.2598870Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:33.2664767Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 15.6 MB/s eta 0:00:00 2025-09-07T06:09:33.2765875Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:33.2833672Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 20.7 MB/s eta 0:00:00 2025-09-07T06:09:33.6610962Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:34.1928155Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-09-07T06:09:34.2718506Z ##[group]Run curr_branch="main" 2025-09-07T06:09:34.2719006Z curr_branch="main" 2025-09-07T06:09:34.2719376Z curr_ref_type="branch" 2025-09-07T06:09:34.2719874Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:34.2720315Z  2025-09-07T06:09:34.2720638Z python3 runner_determinator.py \ 2025-09-07T06:09:34.2721117Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:34.2721598Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:34.2722062Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:34.2722538Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:34.2723065Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:34.2723572Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:34.2724242Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:34.2724788Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:34.2725443Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:34.2725911Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:34.2757675Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:34.2757924Z env: 2025-09-07T06:09:34.2758452Z GITHUB_TOKEN: *** 2025-09-07T06:09:34.2758665Z ISSUE_NUMBER: 5132 2025-09-07T06:09:34.2758890Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:34.2759131Z ISSUE_OWNER: 2025-09-07T06:09:34.2759321Z CHECK_EXPERIMENTS: 2025-09-07T06:09:34.2759528Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T06:09:34.2759738Z PR_NUMBER: 2025-09-07T06:09:34.2759916Z ##[endgroup] 2025-09-07T06:09:34.2809618Z Current branch is 'main' 2025-09-07T06:09:36.0677419Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-09-07T06:09:36.0678521Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:36.0679537Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:36.0680585Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:36.0681318Z INFO : Setting output: label-type='' 2025-09-07T06:09:36.0991364Z Evaluate and set job outputs 2025-09-07T06:09:36.0997984Z Cleaning up orphan processes