2025-11-03T15:43:06.6824039Z Current runner version: '2.329.0' 2025-11-03T15:43:06.6845409Z ##[group]Runner Image Provisioner 2025-11-03T15:43:06.6846095Z Hosted Compute Agent 2025-11-03T15:43:06.6846810Z Version: 20251016.436 2025-11-03T15:43:06.6847345Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:06.6848006Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:06.6848547Z ##[endgroup] 2025-11-03T15:43:06.6848996Z ##[group]Operating System 2025-11-03T15:43:06.6849514Z Ubuntu 2025-11-03T15:43:06.6849897Z 24.04.3 2025-11-03T15:43:06.6850333Z LTS 2025-11-03T15:43:06.6850717Z ##[endgroup] 2025-11-03T15:43:06.6851136Z ##[group]Runner Image 2025-11-03T15:43:06.6851625Z Image: ubuntu-24.04 2025-11-03T15:43:06.6852068Z Version: 20251030.96.2 2025-11-03T15:43:06.6852942Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:06.6854319Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:06.6855121Z ##[endgroup] 2025-11-03T15:43:06.6856016Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:06.6858171Z Contents: read 2025-11-03T15:43:06.6858681Z Metadata: read 2025-11-03T15:43:06.6859083Z ##[endgroup] 2025-11-03T15:43:06.6860918Z Secret source: Actions 2025-11-03T15:43:06.6861819Z Prepare workflow directory 2025-11-03T15:43:06.7309009Z Prepare all required actions 2025-11-03T15:43:06.7362930Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:06.7367556Z ##[group] Inputs 2025-11-03T15:43:06.7368059Z check_experiments: 2025-11-03T15:43:06.7368554Z opt_out_experiments: lf 2025-11-03T15:43:06.7369119Z triggering_actor: pytorchmergebot 2025-11-03T15:43:06.7369647Z issue_owner: 2025-11-03T15:43:06.7370055Z curr_branch: main 2025-11-03T15:43:06.7370535Z curr_ref_type: branch 2025-11-03T15:43:06.7371160Z issue_number: 5132 2025-11-03T15:43:06.7371651Z ##[endgroup] 2025-11-03T15:43:06.7372248Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:07.4050294Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:07.4052613Z cat < runner_determinator.py 2025-11-03T15:43:07.4053286Z # flake8: noqa: G004 2025-11-03T15:43:07.4053850Z  2025-11-03T15:43:07.4054615Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:07.4055690Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:07.4056749Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:07.4057517Z  2025-11-03T15:43:07.4057984Z """ 2025-11-03T15:43:07.4058675Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:07.4059728Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:07.4060886Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:07.4061878Z of which runners should be used to run which job. 2025-11-03T15:43:07.4062533Z  2025-11-03T15:43:07.4063262Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:07.4064303Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:07.4065321Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:07.4066162Z list, defined. 2025-11-03T15:43:07.4066739Z  2025-11-03T15:43:07.4067446Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:07.4068481Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:07.4069483Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:07.4070225Z  2025-11-03T15:43:07.4071141Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:07.4072183Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:07.4073058Z experiments which the user could be opted in to. 2025-11-03T15:43:07.4073738Z  2025-11-03T15:43:07.4074268Z The user list has the following rules: 2025-11-03T15:43:07.4074872Z  2025-11-03T15:43:07.4075555Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:07.4076676Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:07.4077632Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:07.4078277Z  2025-11-03T15:43:07.4078746Z Example config: 2025-11-03T15:43:07.4079432Z  # A list of experiments that can be opted into. 2025-11-03T15:43:07.4080235Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:07.4080982Z  # Expected syntax is: 2025-11-03T15:43:07.4082175Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:07.4083289Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:07.4084145Z  2025-11-03T15:43:07.4084631Z  experiments: 2025-11-03T15:43:07.4085169Z  lf: 2025-11-03T15:43:07.4085688Z  rollout_percent: 25 2025-11-03T15:43:07.4086515Z  all_branches: false 2025-11-03T15:43:07.4087091Z  default: true 2025-11-03T15:43:07.4087651Z  --- 2025-11-03T15:43:07.4088154Z  2025-11-03T15:43:07.4088589Z  # Opt-ins: 2025-11-03T15:43:07.4089380Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:07.4090525Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:07.4091470Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:07.4092263Z  # Experiments should be from the above list. 2025-11-03T15:43:07.4092946Z  2025-11-03T15:43:07.4093471Z  @User1,-lf,split_build 2025-11-03T15:43:07.4094036Z  @User2,lf 2025-11-03T15:43:07.4094601Z  @User3,split_build 2025-11-03T15:43:07.4095144Z """ 2025-11-03T15:43:07.4095618Z  2025-11-03T15:43:07.4096033Z import json 2025-11-03T15:43:07.4097014Z import logging 2025-11-03T15:43:07.4097584Z import os 2025-11-03T15:43:07.4098064Z import random 2025-11-03T15:43:07.4098634Z import re 2025-11-03T15:43:07.4099112Z import sys 2025-11-03T15:43:07.4099658Z from argparse import ArgumentParser 2025-11-03T15:43:07.4100467Z from collections.abc import Iterable 2025-11-03T15:43:07.4101104Z from functools import cache 2025-11-03T15:43:07.4101719Z from logging import LogRecord 2025-11-03T15:43:07.4102364Z from typing import Any, NamedTuple 2025-11-03T15:43:07.4103072Z from urllib.request import Request, urlopen 2025-11-03T15:43:07.4103706Z  2025-11-03T15:43:07.4104184Z import yaml 2025-11-03T15:43:07.4104761Z from github import Auth, Github 2025-11-03T15:43:07.4105360Z from github.Issue import Issue 2025-11-03T15:43:07.4105972Z  2025-11-03T15:43:07.4106469Z  2025-11-03T15:43:07.4107014Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:07.4107831Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:07.4108887Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:07.4109716Z  2025-11-03T15:43:07.4110387Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:07.4111114Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:07.4111761Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:07.4112524Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:07.4113144Z  2025-11-03T15:43:07.4113652Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:07.4114285Z  2025-11-03T15:43:07.4114747Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:07.4115362Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:07.4115894Z  2025-11-03T15:43:07.4116532Z  2025-11-03T15:43:07.4117004Z class Experiment(NamedTuple): 2025-11-03T15:43:07.4117619Z  rollout_perc: float = ( 2025-11-03T15:43:07.4118458Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:07.4119227Z  ) 2025-11-03T15:43:07.4119748Z  all_branches: bool = ( 2025-11-03T15:43:07.4120554Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:07.4121346Z  ) 2025-11-03T15:43:07.4121817Z  default: bool = ( 2025-11-03T15:43:07.4122582Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:07.4123343Z  ) 2025-11-03T15:43:07.4123800Z  2025-11-03T15:43:07.4124305Z  # Add more fields as needed 2025-11-03T15:43:07.4124861Z  2025-11-03T15:43:07.4125306Z  2025-11-03T15:43:07.4125777Z class Settings(NamedTuple): 2025-11-03T15:43:07.4126438Z  """ 2025-11-03T15:43:07.4127079Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:07.4127752Z  """ 2025-11-03T15:43:07.4128231Z  2025-11-03T15:43:07.4128724Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:07.4129403Z  2025-11-03T15:43:07.4130320Z  2025-11-03T15:43:07.4130886Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:07.4131627Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:07.4132367Z  2025-11-03T15:43:07.4132834Z  COLORS = { 2025-11-03T15:43:07.4133352Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:07.4134039Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:07.4134661Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:07.4135282Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:07.4135932Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:07.4136608Z  } 2025-11-03T15:43:07.4137065Z  2025-11-03T15:43:07.4137610Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:07.4138526Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:07.4139410Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:07.4140146Z  return super().format(record) 2025-11-03T15:43:07.4140758Z  2025-11-03T15:43:07.4141172Z  2025-11-03T15:43:07.4141690Z handler = logging.StreamHandler() 2025-11-03T15:43:07.4142547Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:07.4143374Z  2025-11-03T15:43:07.4143932Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:07.4144662Z log.addHandler(handler) 2025-11-03T15:43:07.4145260Z log.setLevel(logging.INFO) 2025-11-03T15:43:07.4145828Z  2025-11-03T15:43:07.4146306Z  2025-11-03T15:43:07.4146921Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:07.4147611Z  """ 2025-11-03T15:43:07.4148251Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:07.4149127Z  """ 2025-11-03T15:43:07.4149592Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:07.4150861Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:07.4152084Z  log.warning( 2025-11-03T15:43:07.4153048Z  "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:07.4154107Z  ) 2025-11-03T15:43:07.4154701Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:07.4155322Z  return 2025-11-03T15:43:07.4155900Z  2025-11-03T15:43:07.4156502Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:07.4157203Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:07.4157912Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:07.4158524Z  2025-11-03T15:43:07.4158949Z  2025-11-03T15:43:07.4159627Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:07.4160404Z  return frozenset( 2025-11-03T15:43:07.4161150Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:07.4161972Z  ) 2025-11-03T15:43:07.4162411Z  2025-11-03T15:43:07.4162865Z  2025-11-03T15:43:07.4163338Z def parse_args() -> Any: 2025-11-03T15:43:07.4164079Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:07.4165081Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:07.4165946Z  parser.add_argument( 2025-11-03T15:43:07.4166744Z  "--github-issue-repo", 2025-11-03T15:43:07.4167334Z  type=str, 2025-11-03T15:43:07.4167923Z  required=False, 2025-11-03T15:43:07.4168655Z  default="pytorch/test-infra", 2025-11-03T15:43:07.4169309Z  help="GitHub repo to get the issue", 2025-11-03T15:43:07.4169951Z  ) 2025-11-03T15:43:07.4170454Z  parser.add_argument( 2025-11-03T15:43:07.4171078Z  "--github-repo", 2025-11-03T15:43:07.4171620Z  type=str, 2025-11-03T15:43:07.4172203Z  required=True, 2025-11-03T15:43:07.4172835Z  help="GitHub repo where CI is running", 2025-11-03T15:43:07.4173426Z  ) 2025-11-03T15:43:07.4173963Z  parser.add_argument( 2025-11-03T15:43:07.4174700Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:07.4175485Z  ) 2025-11-03T15:43:07.4175979Z  parser.add_argument( 2025-11-03T15:43:07.4176834Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:07.4177625Z  ) 2025-11-03T15:43:07.4178142Z  parser.add_argument( 2025-11-03T15:43:07.4178968Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:07.4179736Z  ) 2025-11-03T15:43:07.4180265Z  parser.add_argument( 2025-11-03T15:43:07.4181060Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:07.4181881Z  ) 2025-11-03T15:43:07.4182404Z  parser.add_argument( 2025-11-03T15:43:07.4182968Z  "--github-ref-type", 2025-11-03T15:43:07.4183585Z  type=str, 2025-11-03T15:43:07.4184125Z  required=True, 2025-11-03T15:43:07.4184798Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:07.4185465Z  ) 2025-11-03T15:43:07.4185989Z  parser.add_argument( 2025-11-03T15:43:07.4186754Z  "--eligible-experiments", 2025-11-03T15:43:07.4187429Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:07.4188061Z  required=False, 2025-11-03T15:43:07.4188660Z  default="", 2025-11-03T15:43:07.4189642Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:07.4190682Z  ) 2025-11-03T15:43:07.4191210Z  parser.add_argument( 2025-11-03T15:43:07.4191792Z  "--opt-out-experiments", 2025-11-03T15:43:07.4192462Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:07.4193089Z  required=False, 2025-11-03T15:43:07.4193656Z  default="", 2025-11-03T15:43:07.4194166Z  help=( 2025-11-03T15:43:07.4195042Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:07.4196309Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:07.4197335Z  ), 2025-11-03T15:43:07.4197870Z  ) 2025-11-03T15:43:07.4198345Z  parser.add_argument( 2025-11-03T15:43:07.4198930Z  "--pr-number", 2025-11-03T15:43:07.4199554Z  type=str, 2025-11-03T15:43:07.4200079Z  required=False, 2025-11-03T15:43:07.4200638Z  default="", 2025-11-03T15:43:07.4201289Z  help="the optional PR number where this is run", 2025-11-03T15:43:07.4201957Z  ) 2025-11-03T15:43:07.4202394Z  2025-11-03T15:43:07.4202936Z  return parser.parse_args() 2025-11-03T15:43:07.4203501Z  2025-11-03T15:43:07.4203945Z  2025-11-03T15:43:07.4204678Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.4205618Z  auth = Auth.Token(github_token) 2025-11-03T15:43:07.4206284Z  return Github(auth=auth) 2025-11-03T15:43:07.4206941Z  2025-11-03T15:43:07.4207397Z  2025-11-03T15:43:07.4208147Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.4209084Z  repo = gh.get_repo(repo) 2025-11-03T15:43:07.4209748Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:07.4210355Z  2025-11-03T15:43:07.4210840Z  2025-11-03T15:43:07.4211307Z def get_potential_pr_author( 2025-11-03T15:43:07.4212100Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:07.4212987Z ) -> str: 2025-11-03T15:43:07.4213634Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:07.4214604Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:07.4215457Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:07.4216171Z  2025-11-03T15:43:07.4216696Z  gh = get_gh_client(github_token) 2025-11-03T15:43:07.4217287Z  2025-11-03T15:43:07.4217928Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:07.4218655Z  split_tag = ref_name.split("/") 2025-11-03T15:43:07.4219294Z  if ( 2025-11-03T15:43:07.4219841Z  len(split_tag) == 3 2025-11-03T15:43:07.4220478Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:07.4221110Z  and split_tag[2].isnumeric() 2025-11-03T15:43:07.4221746Z  ): 2025-11-03T15:43:07.4222319Z  pr_number = split_tag[2] 2025-11-03T15:43:07.4222899Z  try: 2025-11-03T15:43:07.4223513Z  repository = gh.get_repo(repo) 2025-11-03T15:43:07.4224741Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:07.4225488Z  except Exception as e: 2025-11-03T15:43:07.4226213Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:07.4227092Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:07.4227865Z  ) from e 2025-11-03T15:43:07.4228556Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:07.4229403Z  # In all other cases, return the original input username 2025-11-03T15:43:07.4230123Z  return username 2025-11-03T15:43:07.4230634Z  2025-11-03T15:43:07.4231103Z  2025-11-03T15:43:07.4231622Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:07.4232290Z  """ 2025-11-03T15:43:07.4233067Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:07.4233960Z  """ 2025-11-03T15:43:07.4234659Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:07.4235726Z  2025-11-03T15:43:07.4236181Z  2025-11-03T15:43:07.4236892Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:07.4237570Z  try: 2025-11-03T15:43:07.4238069Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:07.4238692Z  return data 2025-11-03T15:43:07.4239296Z  except yaml.YAMLError: 2025-11-03T15:43:07.4239945Z  log.exception("Error loading YAML") 2025-11-03T15:43:07.4240565Z  raise 2025-11-03T15:43:07.4241073Z  2025-11-03T15:43:07.4241514Z  2025-11-03T15:43:07.4242212Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:07.4243098Z  """ 2025-11-03T15:43:07.4243965Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:07.4244825Z  2025-11-03T15:43:07.4245509Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.4246791Z  and the text below is the list of opted in users. 2025-11-03T15:43:07.4247505Z  2025-11-03T15:43:07.4248197Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:07.4249050Z  """ 2025-11-03T15:43:07.4249641Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:07.4250335Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:07.4251097Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:07.4251767Z  else: 2025-11-03T15:43:07.4252306Z  return "", rollout_state 2025-11-03T15:43:07.4252870Z  2025-11-03T15:43:07.4253315Z  2025-11-03T15:43:07.4253845Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:07.4254452Z  """ 2025-11-03T15:43:07.4255117Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:07.4255839Z  """ 2025-11-03T15:43:07.4256406Z  2025-11-03T15:43:07.4256820Z  2025-11-03T15:43:07.4257447Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:07.4258234Z  """ 2025-11-03T15:43:07.4259051Z  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:07.4259991Z  2025-11-03T15:43:07.4260900Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:07.4262000Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:07.4262908Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:07.4263661Z  2025-11-03T15:43:07.4264122Z  2025-11-03T15:43:07.4264527Z  """ 2025-11-03T15:43:07.4265058Z  optins = UserOptins() 2025-11-03T15:43:07.4265678Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:07.4266432Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:07.4267137Z  if not user or not user.startswith("@"): 2025-11-03T15:43:07.4267787Z  # Not a valid user. Skip 2025-11-03T15:43:07.4268412Z  continue 2025-11-03T15:43:07.4268904Z  2025-11-03T15:43:07.4269366Z  if user: 2025-11-03T15:43:07.4269932Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:07.4270749Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:07.4271535Z  2025-11-03T15:43:07.4271958Z  return optins 2025-11-03T15:43:07.4272506Z  2025-11-03T15:43:07.4272922Z  2025-11-03T15:43:07.4273535Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:07.4274210Z  """ 2025-11-03T15:43:07.4274778Z  Check if the experiment name is valid. 2025-11-03T15:43:07.4275442Z  A valid name: 2025-11-03T15:43:07.4276188Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:07.4277408Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:07.4278200Z  - Cannot contain spaces 2025-11-03T15:43:07.4278766Z  """ 2025-11-03T15:43:07.4279235Z  2025-11-03T15:43:07.4279838Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:07.4280687Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:07.4281475Z  2025-11-03T15:43:07.4281940Z  if valid: 2025-11-03T15:43:07.4282423Z  return True 2025-11-03T15:43:07.4283006Z  2025-11-03T15:43:07.4283416Z  log.error( 2025-11-03T15:43:07.4284958Z  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:07.4286669Z  ) 2025-11-03T15:43:07.4287127Z  return False 2025-11-03T15:43:07.4287647Z  2025-11-03T15:43:07.4288066Z  2025-11-03T15:43:07.4288728Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:07.4289469Z  """ 2025-11-03T15:43:07.4290163Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:07.4290998Z  """ 2025-11-03T15:43:07.4291440Z  try: 2025-11-03T15:43:07.4291987Z  if settings_text: 2025-11-03T15:43:07.4292847Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:07.4293737Z  # for easy reading 2025-11-03T15:43:07.4294674Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:07.4295652Z  # the backtick character in shell commands. 2025-11-03T15:43:07.4296435Z  backtick = chr(96) # backtick character 2025-11-03T15:43:07.4297201Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:07.4298040Z  settings = load_yaml(settings_text) 2025-11-03T15:43:07.4298664Z  2025-11-03T15:43:07.4299327Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:07.4300287Z  experiments = {} 2025-11-03T15:43:07.4300829Z  2025-11-03T15:43:07.4301515Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:07.4302425Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:07.4303606Z  # 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:07.4304724Z  continue 2025-11-03T15:43:07.4305288Z  2025-11-03T15:43:07.4305767Z  valid_settings = {} 2025-11-03T15:43:07.4306488Z  for setting in exp_settings: 2025-11-03T15:43:07.4307206Z  if setting not in Experiment._fields: 2025-11-03T15:43:07.4307901Z  log.warning( 2025-11-03T15:43:07.4308722Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:07.4309560Z  ) 2025-11-03T15:43:07.4310130Z  else: 2025-11-03T15:43:07.4310786Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:07.4311483Z  2025-11-03T15:43:07.4312039Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:07.4312793Z  return Settings(experiments) 2025-11-03T15:43:07.4313378Z  2025-11-03T15:43:07.4313866Z  except Exception: 2025-11-03T15:43:07.4314530Z  log.exception("Failed to parse settings") 2025-11-03T15:43:07.4315145Z  2025-11-03T15:43:07.4315611Z  return Settings() 2025-11-03T15:43:07.4316122Z  2025-11-03T15:43:07.4316697Z  2025-11-03T15:43:07.4317336Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:07.4318041Z  """ 2025-11-03T15:43:07.4318627Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:07.4319268Z  2025-11-03T15:43:07.4319916Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.4320760Z  and the text below is the list of opted in users. 2025-11-03T15:43:07.4321472Z  2025-11-03T15:43:07.4322156Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:07.4322964Z  """ 2025-11-03T15:43:07.4323694Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.4324550Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:07.4325194Z  2025-11-03T15:43:07.4325632Z  2025-11-03T15:43:07.4326221Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:07.4327265Z  """ 2025-11-03T15:43:07.4327818Z  Parse users from the rollout state. 2025-11-03T15:43:07.4328425Z  2025-11-03T15:43:07.4328842Z  """ 2025-11-03T15:43:07.4329560Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.4330397Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:07.4331049Z  2025-11-03T15:43:07.4331460Z  2025-11-03T15:43:07.4332202Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.4333059Z  """ 2025-11-03T15:43:07.4333594Z  Check if a user is opted into an experiment 2025-11-03T15:43:07.4334269Z  """ 2025-11-03T15:43:07.4334836Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:07.4335528Z  2025-11-03T15:43:07.4336037Z  2025-11-03T15:43:07.4336844Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.4337738Z  """ 2025-11-03T15:43:07.4338337Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:07.4339033Z  """ 2025-11-03T15:43:07.4339643Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:07.4340494Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:07.4341276Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:07.4341971Z  return False 2025-11-03T15:43:07.4342528Z  2025-11-03T15:43:07.4343070Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:07.4343768Z  log.warning( 2025-11-03T15:43:07.4344720Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:07.4345688Z  ) 2025-11-03T15:43:07.4346170Z  2025-11-03T15:43:07.4346682Z  return True 2025-11-03T15:43:07.4347203Z  2025-11-03T15:43:07.4347609Z  2025-11-03T15:43:07.4348092Z def get_runner_prefix( 2025-11-03T15:43:07.4348634Z  rollout_state: str, 2025-11-03T15:43:07.4349293Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:07.4441759Z  branch: str, 2025-11-03T15:43:07.4442400Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.4443177Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.4443792Z  is_canary: bool = False, 2025-11-03T15:43:07.4444288Z ) -> str: 2025-11-03T15:43:07.4444789Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:07.4445428Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:07.4446010Z  2025-11-03T15:43:07.4446701Z  fleet_prefix = "" 2025-11-03T15:43:07.4447186Z  prefixes = [] 2025-11-03T15:43:07.4447880Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:07.4448873Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:07.4449621Z  log.info( 2025-11-03T15:43:07.4450349Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:07.4451115Z  ) 2025-11-03T15:43:07.4451558Z  continue 2025-11-03T15:43:07.4452001Z  2025-11-03T15:43:07.4452391Z  if opt_out_experiments: 2025-11-03T15:43:07.4452988Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:07.4453682Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:07.4454298Z  log.info( 2025-11-03T15:43:07.4455258Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:07.4456230Z  ) 2025-11-03T15:43:07.4457188Z  continue 2025-11-03T15:43:07.4457671Z  2025-11-03T15:43:07.4458070Z  if eligible_experiments: 2025-11-03T15:43:07.4458683Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:07.4459359Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:07.4459940Z  log.info( 2025-11-03T15:43:07.4460766Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:07.4461610Z  ) 2025-11-03T15:43:07.4462074Z  continue 2025-11-03T15:43:07.4462714Z  elif not experiment_settings.default: 2025-11-03T15:43:07.4463290Z  log.info( 2025-11-03T15:43:07.4464002Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:07.4464747Z  ) 2025-11-03T15:43:07.4465183Z  continue 2025-11-03T15:43:07.4465618Z  2025-11-03T15:43:07.4466126Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:07.4466877Z  opted_out_users = [ 2025-11-03T15:43:07.4467384Z  requestor 2025-11-03T15:43:07.4467911Z  for requestor in workflow_requestors 2025-11-03T15:43:07.4468646Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.4469306Z  ] 2025-11-03T15:43:07.4469716Z  2025-11-03T15:43:07.4470116Z  if opted_out_users: 2025-11-03T15:43:07.4470662Z  log.info( 2025-11-03T15:43:07.4471361Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:07.4472083Z  ) 2025-11-03T15:43:07.4472531Z  continue 2025-11-03T15:43:07.4472972Z  2025-11-03T15:43:07.4473468Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:07.4474104Z  opted_in_users = [ 2025-11-03T15:43:07.4474619Z  requestor 2025-11-03T15:43:07.4475151Z  for requestor in workflow_requestors 2025-11-03T15:43:07.4475856Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.4476579Z  ] 2025-11-03T15:43:07.4476976Z  2025-11-03T15:43:07.4477365Z  enabled = False 2025-11-03T15:43:07.4477860Z  if opted_in_users: 2025-11-03T15:43:07.4478444Z  log.info( 2025-11-03T15:43:07.4479112Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:07.4479808Z  ) 2025-11-03T15:43:07.4480245Z  enabled = True 2025-11-03T15:43:07.4480714Z  2025-11-03T15:43:07.4481156Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:07.4482024Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:07.4482987Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:07.4483676Z  log.info( 2025-11-03T15:43:07.4484575Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:07.4485498Z  ) 2025-11-03T15:43:07.4485973Z  enabled = True 2025-11-03T15:43:07.4486537Z  2025-11-03T15:43:07.4486919Z  if enabled: 2025-11-03T15:43:07.4487406Z  label = experiment_name 2025-11-03T15:43:07.4488017Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:07.4488880Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:07.4489787Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:07.4490585Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:07.4491272Z  if is_canary: 2025-11-03T15:43:07.4491829Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:07.4492410Z  fleet_prefix = label 2025-11-03T15:43:07.4492945Z  else: 2025-11-03T15:43:07.4493521Z  prefixes.append(label) 2025-11-03T15:43:07.4494049Z  2025-11-03T15:43:07.4494431Z  if len(prefixes) > 1: 2025-11-03T15:43:07.4494933Z  log.error( 2025-11-03T15:43:07.4496001Z  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:07.4497614Z  ) 2025-11-03T15:43:07.4498063Z  prefixes = prefixes[:1] 2025-11-03T15:43:07.4498570Z  2025-11-03T15:43:07.4498963Z  # Fleet always comes first 2025-11-03T15:43:07.4499485Z  if fleet_prefix: 2025-11-03T15:43:07.4499988Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:07.4500516Z  2025-11-03T15:43:07.4501003Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:07.4501595Z  2025-11-03T15:43:07.4501953Z  2025-11-03T15:43:07.4502628Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:07.4503406Z  """ 2025-11-03T15:43:07.4504049Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:07.4504773Z  2025-11-03T15:43:07.4505372Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:07.4506083Z  """ 2025-11-03T15:43:07.4506579Z  gh = get_gh_client(github_token) 2025-11-03T15:43:07.4507171Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:07.4507849Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:07.4508472Z  2025-11-03T15:43:07.4508831Z  2025-11-03T15:43:07.4509455Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:07.4510324Z  for _ in range(num_retries): 2025-11-03T15:43:07.4510833Z  try: 2025-11-03T15:43:07.4511319Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:07.4512014Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:07.4512700Z  return json.loads(content) 2025-11-03T15:43:07.4513260Z  except Exception as e: 2025-11-03T15:43:07.4513868Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:07.4514449Z  2025-11-03T15:43:07.4515048Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:07.4515799Z  return {} 2025-11-03T15:43:07.4516213Z  2025-11-03T15:43:07.4516634Z  2025-11-03T15:43:07.4516988Z @cache 2025-11-03T15:43:07.4517655Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:07.4518427Z  """ 2025-11-03T15:43:07.4518868Z  Dynamically get PR information 2025-11-03T15:43:07.4519390Z  """ 2025-11-03T15:43:07.4519938Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:07.4520601Z  headers = { 2025-11-03T15:43:07.4521124Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:07.4521769Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:07.4522323Z  } 2025-11-03T15:43:07.4522810Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:07.4523470Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:07.4524040Z  headers=headers, 2025-11-03T15:43:07.4524619Z  ) 2025-11-03T15:43:07.4525004Z  2025-11-03T15:43:07.4525409Z  if not json_response: 2025-11-03T15:43:07.4526053Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:07.4526871Z  return {} 2025-11-03T15:43:07.4527316Z  2025-11-03T15:43:07.4527710Z  return json_response 2025-11-03T15:43:07.4528185Z  2025-11-03T15:43:07.4528535Z  2025-11-03T15:43:07.4529153Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:07.4529893Z  """ 2025-11-03T15:43:07.4530486Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:07.4531153Z  """ 2025-11-03T15:43:07.4531694Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:07.4532330Z  return { 2025-11-03T15:43:07.4532970Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:07.4533679Z  } 2025-11-03T15:43:07.4534056Z  2025-11-03T15:43:07.4534416Z  2025-11-03T15:43:07.4534803Z def main() -> None: 2025-11-03T15:43:07.4535292Z  args = parse_args() 2025-11-03T15:43:07.4535763Z  2025-11-03T15:43:07.4536218Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:07.4536868Z  2025-11-03T15:43:07.4537267Z  # Check if the PR is opt-out 2025-11-03T15:43:07.4537797Z  if args.pr_number: 2025-11-03T15:43:07.4538511Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:07.4539294Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:07.4539822Z  log.info( 2025-11-03T15:43:07.4540571Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:07.4541349Z  ) 2025-11-03T15:43:07.4541956Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.4542665Z  sys.exit() 2025-11-03T15:43:07.4543204Z  2025-11-03T15:43:07.4543568Z  try: 2025-11-03T15:43:07.4544051Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:07.4544797Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:07.4545455Z  ) 2025-11-03T15:43:07.4545854Z  2025-11-03T15:43:07.4546297Z  username = get_potential_pr_author( 2025-11-03T15:43:07.4547104Z  args.github_token, 2025-11-03T15:43:07.4547642Z  args.github_repo, 2025-11-03T15:43:07.4548159Z  args.github_actor, 2025-11-03T15:43:07.4548697Z  args.github_ref_type, 2025-11-03T15:43:07.4549259Z  args.github_branch, 2025-11-03T15:43:07.4549773Z  ) 2025-11-03T15:43:07.4550173Z  2025-11-03T15:43:07.4550683Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:07.4551319Z  2025-11-03T15:43:07.4551763Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:07.4552352Z  rollout_state, 2025-11-03T15:43:07.4552899Z  (args.github_issue_owner, username), 2025-11-03T15:43:07.4553476Z  args.github_branch, 2025-11-03T15:43:07.4554035Z  args.eligible_experiments, 2025-11-03T15:43:07.4554615Z  args.opt_out_experiments, 2025-11-03T15:43:07.4555157Z  is_canary, 2025-11-03T15:43:07.4555614Z  ) 2025-11-03T15:43:07.4556019Z  2025-11-03T15:43:07.4556477Z  except Exception as e: 2025-11-03T15:43:07.4556994Z  log.error( 2025-11-03T15:43:07.4557728Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:07.4558496Z  ) 2025-11-03T15:43:07.4558985Z  2025-11-03T15:43:07.4559562Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.4560252Z  2025-11-03T15:43:07.4560613Z  2025-11-03T15:43:07.4561014Z if __name__ == "__main__": 2025-11-03T15:43:07.4561509Z  main() 2025-11-03T15:43:07.4561923Z  2025-11-03T15:43:07.4562281Z EOF 2025-11-03T15:43:07.4562666Z  2025-11-03T15:43:07.4563072Z cat runner_determinator.py 2025-11-03T15:43:07.5008454Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:07.5009287Z env: 2025-11-03T15:43:07.5010021Z GITHUB_TOKEN: *** 2025-11-03T15:43:07.5010440Z ISSUE_NUMBER: 5132 2025-11-03T15:43:07.5010908Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:07.5011407Z ISSUE_OWNER: 2025-11-03T15:43:07.5011818Z CHECK_EXPERIMENTS: 2025-11-03T15:43:07.5012257Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:07.5012713Z PR_NUMBER: 2025-11-03T15:43:07.5013123Z ##[endgroup] 2025-11-03T15:43:07.5194670Z # flake8: noqa: G004 2025-11-03T15:43:07.5195028Z 2025-11-03T15:43:07.5195460Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:07.5196621Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:07.5197432Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:07.5197867Z 2025-11-03T15:43:07.5198025Z """ 2025-11-03T15:43:07.5198602Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:07.5199458Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:07.5200343Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:07.5201136Z of which runners should be used to run which job. 2025-11-03T15:43:07.5201534Z 2025-11-03T15:43:07.5201905Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:07.5202990Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:07.5203855Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:07.5204548Z list, defined. 2025-11-03T15:43:07.5204778Z 2025-11-03T15:43:07.5205139Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:07.5206061Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:07.5207097Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:07.5207546Z 2025-11-03T15:43:07.5207911Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:07.5208770Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:07.5209497Z experiments which the user could be opted in to. 2025-11-03T15:43:07.5209909Z 2025-11-03T15:43:07.5210112Z The user list has the following rules: 2025-11-03T15:43:07.5210455Z 2025-11-03T15:43:07.5210785Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:07.5211629Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:07.5212388Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:07.5212776Z 2025-11-03T15:43:07.5212947Z Example config: 2025-11-03T15:43:07.5213402Z # A list of experiments that can be opted into. 2025-11-03T15:43:07.5214056Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:07.5214683Z # Expected syntax is: 2025-11-03T15:43:07.5215318Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:07.5216274Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:07.5217474Z 2025-11-03T15:43:07.5217664Z experiments: 2025-11-03T15:43:07.5218058Z lf: 2025-11-03T15:43:07.5218443Z rollout_percent: 25 2025-11-03T15:43:07.5219031Z all_branches: false 2025-11-03T15:43:07.5219497Z default: true 2025-11-03T15:43:07.5219902Z --- 2025-11-03T15:43:07.5220115Z 2025-11-03T15:43:07.5220281Z # Opt-ins: 2025-11-03T15:43:07.5220854Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:07.5221714Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:07.5222477Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:07.5223128Z # Experiments should be from the above list. 2025-11-03T15:43:07.5223689Z 2025-11-03T15:43:07.5223991Z @User1,-lf,split_build 2025-11-03T15:43:07.5224448Z @User2,lf 2025-11-03T15:43:07.5224836Z @User3,split_build 2025-11-03T15:43:07.5225244Z """ 2025-11-03T15:43:07.5225457Z 2025-11-03T15:43:07.5225625Z import json 2025-11-03T15:43:07.5226001Z import logging 2025-11-03T15:43:07.5226534Z import os 2025-11-03T15:43:07.5226928Z import random 2025-11-03T15:43:07.5227320Z import re 2025-11-03T15:43:07.5227693Z import sys 2025-11-03T15:43:07.5228099Z from argparse import ArgumentParser 2025-11-03T15:43:07.5228642Z from collections.abc import Iterable 2025-11-03T15:43:07.5229162Z from functools import cache 2025-11-03T15:43:07.5229650Z from logging import LogRecord 2025-11-03T15:43:07.5230145Z from typing import Any, NamedTuple 2025-11-03T15:43:07.5230696Z from urllib.request import Request, urlopen 2025-11-03T15:43:07.5231065Z 2025-11-03T15:43:07.5231233Z import yaml 2025-11-03T15:43:07.5231646Z from github import Auth, Github 2025-11-03T15:43:07.5232140Z from github.Issue import Issue 2025-11-03T15:43:07.5232452Z 2025-11-03T15:43:07.5232461Z 2025-11-03T15:43:07.5232680Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:07.5233370Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:07.5234217Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:07.5234767Z 2025-11-03T15:43:07.5234996Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:07.5235679Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:07.5236196Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:07.5236912Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:07.5237274Z 2025-11-03T15:43:07.5237470Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:07.5237803Z 2025-11-03T15:43:07.5238004Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:07.5238478Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:07.5238791Z 2025-11-03T15:43:07.5238799Z 2025-11-03T15:43:07.5238998Z class Experiment(NamedTuple): 2025-11-03T15:43:07.5239489Z rollout_perc: float = ( 2025-11-03T15:43:07.5240136Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:07.5240796Z ) 2025-11-03T15:43:07.5241173Z all_branches: bool = ( 2025-11-03T15:43:07.5241812Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:07.5242469Z ) 2025-11-03T15:43:07.5242836Z default: bool = ( 2025-11-03T15:43:07.5243410Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:07.5244046Z ) 2025-11-03T15:43:07.5244246Z 2025-11-03T15:43:07.5244434Z # Add more fields as needed 2025-11-03T15:43:07.5244740Z 2025-11-03T15:43:07.5244748Z 2025-11-03T15:43:07.5244934Z class Settings(NamedTuple): 2025-11-03T15:43:07.5245379Z """ 2025-11-03T15:43:07.5245838Z Settings for the experiments that can be opted into. 2025-11-03T15:43:07.5246600Z """ 2025-11-03T15:43:07.5246809Z 2025-11-03T15:43:07.5247019Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:07.5247390Z 2025-11-03T15:43:07.5247397Z 2025-11-03T15:43:07.5247607Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:07.5248232Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:07.5248665Z 2025-11-03T15:43:07.5248826Z COLORS = { 2025-11-03T15:43:07.5249227Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:07.5249818Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:07.5250328Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:07.5250833Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:07.5251325Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:07.5251792Z } 2025-11-03T15:43:07.5252004Z 2025-11-03T15:43:07.5252224Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:07.5252967Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:07.5253735Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:07.5254328Z return super().format(record) 2025-11-03T15:43:07.5254662Z 2025-11-03T15:43:07.5254669Z 2025-11-03T15:43:07.5254875Z handler = logging.StreamHandler() 2025-11-03T15:43:07.5255578Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:07.5256115Z 2025-11-03T15:43:07.5256476Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:07.5257066Z log.addHandler(handler) 2025-11-03T15:43:07.5257519Z log.setLevel(logging.INFO) 2025-11-03T15:43:07.5257818Z 2025-11-03T15:43:07.5257825Z 2025-11-03T15:43:07.5258078Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:07.5258650Z """ 2025-11-03T15:43:07.5259145Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:07.5259773Z """ 2025-11-03T15:43:07.5260149Z if not GITHUB_OUTPUT: 2025-11-03T15:43:07.5261199Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:07.5262288Z log.warning( 2025-11-03T15:43:07.5263121Z "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:07.5264026Z ) 2025-11-03T15:43:07.5274355Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:07.5275031Z return 2025-11-03T15:43:07.5275264Z 2025-11-03T15:43:07.5275633Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:07.5276258Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:07.5277276Z f.write(f"{key}={value}\n") 2025-11-03T15:43:07.5277614Z 2025-11-03T15:43:07.5277622Z 2025-11-03T15:43:07.5277925Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:07.5278561Z return frozenset( 2025-11-03T15:43:07.5279172Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:07.5279856Z ) 2025-11-03T15:43:07.5280054Z 2025-11-03T15:43:07.5280063Z 2025-11-03T15:43:07.5280242Z def parse_args() -> Any: 2025-11-03T15:43:07.5280806Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:07.5281649Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:07.5282408Z parser.add_argument( 2025-11-03T15:43:07.5282878Z "--github-issue-repo", 2025-11-03T15:43:07.5283340Z type=str, 2025-11-03T15:43:07.5283747Z required=False, 2025-11-03T15:43:07.5284194Z default="pytorch/test-infra", 2025-11-03T15:43:07.5284738Z help="GitHub repo to get the issue", 2025-11-03T15:43:07.5285238Z ) 2025-11-03T15:43:07.5285613Z parser.add_argument( 2025-11-03T15:43:07.5286055Z "--github-repo", 2025-11-03T15:43:07.5286609Z type=str, 2025-11-03T15:43:07.5287003Z required=True, 2025-11-03T15:43:07.5287465Z help="GitHub repo where CI is running", 2025-11-03T15:43:07.5287976Z ) 2025-11-03T15:43:07.5288337Z parser.add_argument( 2025-11-03T15:43:07.5288948Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:07.5289621Z ) 2025-11-03T15:43:07.5289998Z parser.add_argument( 2025-11-03T15:43:07.5290632Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:07.5291304Z ) 2025-11-03T15:43:07.5291663Z parser.add_argument( 2025-11-03T15:43:07.5292434Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:07.5293105Z ) 2025-11-03T15:43:07.5293593Z parser.add_argument( 2025-11-03T15:43:07.5294362Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:07.5295077Z ) 2025-11-03T15:43:07.5295439Z parser.add_argument( 2025-11-03T15:43:07.5295893Z "--github-ref-type", 2025-11-03T15:43:07.5296493Z type=str, 2025-11-03T15:43:07.5296912Z required=True, 2025-11-03T15:43:07.5297407Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:07.5297943Z ) 2025-11-03T15:43:07.5298326Z parser.add_argument( 2025-11-03T15:43:07.5298796Z "--eligible-experiments", 2025-11-03T15:43:07.5299313Z type=_str_comma_separated_to_set, 2025-11-03T15:43:07.5299829Z required=False, 2025-11-03T15:43:07.5300252Z default="", 2025-11-03T15:43:07.5301083Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:07.5301987Z ) 2025-11-03T15:43:07.5302345Z parser.add_argument( 2025-11-03T15:43:07.5302811Z "--opt-out-experiments", 2025-11-03T15:43:07.5303316Z type=_str_comma_separated_to_set, 2025-11-03T15:43:07.5303823Z required=False, 2025-11-03T15:43:07.5304242Z default="", 2025-11-03T15:43:07.5304629Z help=( 2025-11-03T15:43:07.5305295Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:07.5306671Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:07.5307532Z ), 2025-11-03T15:43:07.5307889Z ) 2025-11-03T15:43:07.5308262Z parser.add_argument( 2025-11-03T15:43:07.5308702Z "--pr-number", 2025-11-03T15:43:07.5309125Z type=str, 2025-11-03T15:43:07.5309536Z required=False, 2025-11-03T15:43:07.5309965Z default="", 2025-11-03T15:43:07.5310577Z help="the optional PR number where this is run", 2025-11-03T15:43:07.5311122Z ) 2025-11-03T15:43:07.5311336Z 2025-11-03T15:43:07.5311528Z return parser.parse_args() 2025-11-03T15:43:07.5311838Z 2025-11-03T15:43:07.5311845Z 2025-11-03T15:43:07.5312240Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.5312984Z auth = Auth.Token(github_token) 2025-11-03T15:43:07.5313498Z return Github(auth=auth) 2025-11-03T15:43:07.5313798Z 2025-11-03T15:43:07.5313805Z 2025-11-03T15:43:07.5314247Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.5315038Z repo = gh.get_repo(repo) 2025-11-03T15:43:07.5315535Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:07.5315899Z 2025-11-03T15:43:07.5315907Z 2025-11-03T15:43:07.5316105Z def get_potential_pr_author( 2025-11-03T15:43:07.5316939Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:07.5317620Z ) -> str: 2025-11-03T15:43:07.5318152Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:07.5318943Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:07.5319682Z # embedded in the tag name: ciflow// 2025-11-03T15:43:07.5320090Z 2025-11-03T15:43:07.5320279Z gh = get_gh_client(github_token) 2025-11-03T15:43:07.5320621Z 2025-11-03T15:43:07.5320890Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:07.5321512Z split_tag = ref_name.split("/") 2025-11-03T15:43:07.5322011Z if ( 2025-11-03T15:43:07.5322409Z len(split_tag) == 3 2025-11-03T15:43:07.5322883Z and split_tag[0] == "ciflow" 2025-11-03T15:43:07.5323412Z and split_tag[2].isnumeric() 2025-11-03T15:43:07.5323892Z ): 2025-11-03T15:43:07.5324279Z pr_number = split_tag[2] 2025-11-03T15:43:07.5324845Z try: 2025-11-03T15:43:07.5325286Z repository = gh.get_repo(repo) 2025-11-03T15:43:07.5325884Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:07.5326697Z except Exception as e: 2025-11-03T15:43:07.5327229Z raise Exception( # noqa: TRY002 2025-11-03T15:43:07.5327896Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:07.5328533Z ) from e 2025-11-03T15:43:07.5329064Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:07.5329762Z # In all other cases, return the original input username 2025-11-03T15:43:07.5330339Z return username 2025-11-03T15:43:07.5330581Z 2025-11-03T15:43:07.5330588Z 2025-11-03T15:43:07.5330813Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:07.5331341Z """ 2025-11-03T15:43:07.5331963Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:07.5332729Z """ 2025-11-03T15:43:07.5333261Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:07.5333775Z 2025-11-03T15:43:07.5333783Z 2025-11-03T15:43:07.5333976Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:07.5334459Z try: 2025-11-03T15:43:07.5334845Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:07.5335347Z return data 2025-11-03T15:43:07.5335764Z except yaml.YAMLError: 2025-11-03T15:43:07.5336262Z log.exception("Error loading YAML") 2025-11-03T15:43:07.5336880Z raise 2025-11-03T15:43:07.5337102Z 2025-11-03T15:43:07.5337108Z 2025-11-03T15:43:07.5337530Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:07.5338243Z """ 2025-11-03T15:43:07.5338856Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:07.5339442Z 2025-11-03T15:43:07.5339866Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.5340619Z and the text below is the list of opted in users. 2025-11-03T15:43:07.5341016Z 2025-11-03T15:43:07.5341394Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:07.5342085Z """ 2025-11-03T15:43:07.5342534Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:07.5343140Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:07.5343743Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:07.5344315Z else: 2025-11-03T15:43:07.5344700Z return "", rollout_state 2025-11-03T15:43:07.5345011Z 2025-11-03T15:43:07.5345019Z 2025-11-03T15:43:07.5345232Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:07.5345727Z """ 2025-11-03T15:43:07.5346247Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:07.5346988Z """ 2025-11-03T15:43:07.5347196Z 2025-11-03T15:43:07.5347208Z 2025-11-03T15:43:07.5347541Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:07.5348178Z """ 2025-11-03T15:43:07.5348872Z 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:07.5349535Z 2025-11-03T15:43:07.5350149Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:07.5351115Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:07.5351785Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:07.5352250Z 2025-11-03T15:43:07.5352257Z 2025-11-03T15:43:07.5352410Z """ 2025-11-03T15:43:07.5352790Z optins = UserOptins() 2025-11-03T15:43:07.5353274Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:07.5353830Z user = user.strip("\r\n\t -") 2025-11-03T15:43:07.5354381Z if not user or not user.startswith("@"): 2025-11-03T15:43:07.5354999Z # Not a valid user. Skip 2025-11-03T15:43:07.5355482Z continue 2025-11-03T15:43:07.5355728Z 2025-11-03T15:43:07.5355887Z if user: 2025-11-03T15:43:07.5356430Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:07.5357179Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:07.5357668Z 2025-11-03T15:43:07.5357835Z return optins 2025-11-03T15:43:07.5358072Z 2025-11-03T15:43:07.5358079Z 2025-11-03T15:43:07.5358366Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:07.5358957Z """ 2025-11-03T15:43:07.5359356Z Check if the experiment name is valid. 2025-11-03T15:43:07.5359863Z A valid name: 2025-11-03T15:43:07.5360494Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:07.5361420Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:07.5362134Z - Cannot contain spaces 2025-11-03T15:43:07.5362593Z """ 2025-11-03T15:43:07.5362789Z 2025-11-03T15:43:07.5363049Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:07.5363737Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:07.5364170Z 2025-11-03T15:43:07.5364329Z if valid: 2025-11-03T15:43:07.5364710Z return True 2025-11-03T15:43:07.5364949Z 2025-11-03T15:43:07.5365110Z log.error( 2025-11-03T15:43:07.5366646Z 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:07.5368204Z ) 2025-11-03T15:43:07.5368556Z return False 2025-11-03T15:43:07.5368802Z 2025-11-03T15:43:07.5368809Z 2025-11-03T15:43:07.5369110Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:07.5369716Z """ 2025-11-03T15:43:07.5370390Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:07.5371110Z """ 2025-11-03T15:43:07.5371452Z try: 2025-11-03T15:43:07.5371831Z if settings_text: 2025-11-03T15:43:07.5372540Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:07.5373321Z # for easy reading 2025-11-03T15:43:07.5374094Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:07.5375003Z # the backtick character in shell commands. 2025-11-03T15:43:07.5375616Z backtick = chr(96) # backtick character 2025-11-03T15:43:07.5376269Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:07.5376998Z settings = load_yaml(settings_text) 2025-11-03T15:43:07.5377358Z 2025-11-03T15:43:07.5377761Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:07.5378507Z experiments = {} 2025-11-03T15:43:07.5378804Z 2025-11-03T15:43:07.5379179Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:07.5379937Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:07.5381004Z # 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:07.5382008Z continue 2025-11-03T15:43:07.5382299Z 2025-11-03T15:43:07.5382481Z valid_settings = {} 2025-11-03T15:43:07.5382991Z for setting in exp_settings: 2025-11-03T15:43:07.5383561Z if setting not in Experiment._fields: 2025-11-03T15:43:07.5384112Z log.warning( 2025-11-03T15:43:07.5384813Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:07.5385585Z ) 2025-11-03T15:43:07.5386008Z else: 2025-11-03T15:43:07.5386586Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:07.5387005Z 2025-11-03T15:43:07.5387280Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:07.5387901Z return Settings(experiments) 2025-11-03T15:43:07.5388245Z 2025-11-03T15:43:07.5388418Z except Exception: 2025-11-03T15:43:07.5388889Z log.exception("Failed to parse settings") 2025-11-03T15:43:07.5389265Z 2025-11-03T15:43:07.5389444Z return Settings() 2025-11-03T15:43:07.5389695Z 2025-11-03T15:43:07.5389703Z 2025-11-03T15:43:07.5389944Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:07.5390503Z """ 2025-11-03T15:43:07.5390932Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:07.5391332Z 2025-11-03T15:43:07.5391672Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.5392423Z and the text below is the list of opted in users. 2025-11-03T15:43:07.5392817Z 2025-11-03T15:43:07.5393211Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:07.5393929Z """ 2025-11-03T15:43:07.5394463Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.5395202Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:07.5395591Z 2025-11-03T15:43:07.5395598Z 2025-11-03T15:43:07.5395846Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:07.5396454Z """ 2025-11-03T15:43:07.5396850Z Parse users from the rollout state. 2025-11-03T15:43:07.5397191Z 2025-11-03T15:43:07.5397346Z """ 2025-11-03T15:43:07.5397870Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.5398590Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:07.5398990Z 2025-11-03T15:43:07.5398996Z 2025-11-03T15:43:07.5399458Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.5400177Z """ 2025-11-03T15:43:07.5400594Z Check if a user is opted into an experiment 2025-11-03T15:43:07.5401121Z """ 2025-11-03T15:43:07.5401562Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:07.5401974Z 2025-11-03T15:43:07.5401982Z 2025-11-03T15:43:07.5402391Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.5403117Z """ 2025-11-03T15:43:07.5403576Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:07.5404144Z """ 2025-11-03T15:43:07.5404652Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:07.5405326Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:07.5405951Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:07.5406603Z return False 2025-11-03T15:43:07.5406857Z 2025-11-03T15:43:07.5407128Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:07.5407722Z log.warning( 2025-11-03T15:43:07.5408507Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:07.5409359Z ) 2025-11-03T15:43:07.5409562Z 2025-11-03T15:43:07.5409723Z return True 2025-11-03T15:43:07.5409961Z 2025-11-03T15:43:07.5409968Z 2025-11-03T15:43:07.5410143Z def get_runner_prefix( 2025-11-03T15:43:07.5410602Z rollout_state: str, 2025-11-03T15:43:07.5411053Z workflow_requestors: Iterable[str], 2025-11-03T15:43:07.5411561Z branch: str, 2025-11-03T15:43:07.5412038Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.5412695Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.5413265Z is_canary: bool = False, 2025-11-03T15:43:07.5413714Z ) -> str: 2025-11-03T15:43:07.5414119Z settings = parse_settings(rollout_state) 2025-11-03T15:43:07.5414767Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:07.5415126Z 2025-11-03T15:43:07.5415305Z fleet_prefix = "" 2025-11-03T15:43:07.5415716Z prefixes = [] 2025-11-03T15:43:07.5416393Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:07.5417292Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:07.5417978Z log.info( 2025-11-03T15:43:07.5418635Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:07.5419371Z ) 2025-11-03T15:43:07.5419745Z continue 2025-11-03T15:43:07.5419989Z 2025-11-03T15:43:07.5420180Z if opt_out_experiments: 2025-11-03T15:43:07.5420708Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:07.5421325Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:07.5421922Z log.info( 2025-11-03T15:43:07.5422816Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:07.5423759Z ) 2025-11-03T15:43:07.5424144Z continue 2025-11-03T15:43:07.5424421Z 2025-11-03T15:43:07.5424619Z if eligible_experiments: 2025-11-03T15:43:07.5425198Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:07.5425820Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:07.5426437Z log.info( 2025-11-03T15:43:07.5427198Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:07.5428009Z ) 2025-11-03T15:43:07.5428396Z continue 2025-11-03T15:43:07.5428871Z elif not experiment_settings.default: 2025-11-03T15:43:07.5429394Z log.info( 2025-11-03T15:43:07.5430103Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:07.5430825Z ) 2025-11-03T15:43:07.5431193Z continue 2025-11-03T15:43:07.5431445Z 2025-11-03T15:43:07.5431717Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:07.5432315Z opted_out_users = [ 2025-11-03T15:43:07.5432762Z requestor 2025-11-03T15:43:07.5433222Z for requestor in workflow_requestors 2025-11-03T15:43:07.5433882Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.5434503Z ] 2025-11-03T15:43:07.5434704Z 2025-11-03T15:43:07.5434885Z if opted_out_users: 2025-11-03T15:43:07.5435333Z log.info( 2025-11-03T15:43:07.5435941Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:07.5436679Z ) 2025-11-03T15:43:07.5437050Z continue 2025-11-03T15:43:07.5437313Z 2025-11-03T15:43:07.5437592Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:07.5438216Z opted_in_users = [ 2025-11-03T15:43:07.5438651Z requestor 2025-11-03T15:43:07.5439115Z for requestor in workflow_requestors 2025-11-03T15:43:07.5439762Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.5440379Z ] 2025-11-03T15:43:07.5440583Z 2025-11-03T15:43:07.5440755Z enabled = False 2025-11-03T15:43:07.5441198Z if opted_in_users: 2025-11-03T15:43:07.5441642Z log.info( 2025-11-03T15:43:07.5442499Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:07.5443242Z ) 2025-11-03T15:43:07.5443632Z enabled = True 2025-11-03T15:43:07.5443916Z 2025-11-03T15:43:07.5444138Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:07.5444940Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:07.5445934Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:07.5446632Z log.info( 2025-11-03T15:43:07.5447472Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:07.5448356Z ) 2025-11-03T15:43:07.5448762Z enabled = True 2025-11-03T15:43:07.5449059Z 2025-11-03T15:43:07.5449231Z if enabled: 2025-11-03T15:43:07.5449638Z label = experiment_name 2025-11-03T15:43:07.5450186Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:07.5450995Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:07.5451885Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:07.5452625Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:07.5453281Z if is_canary: 2025-11-03T15:43:07.5453772Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:07.5454298Z fleet_prefix = label 2025-11-03T15:43:07.5454789Z else: 2025-11-03T15:43:07.5455207Z prefixes.append(label) 2025-11-03T15:43:07.5455560Z 2025-11-03T15:43:07.5455741Z if len(prefixes) > 1: 2025-11-03T15:43:07.5456182Z log.error( 2025-11-03T15:43:07.5457240Z 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:07.5458315Z ) 2025-11-03T15:43:07.5458699Z prefixes = prefixes[:1] 2025-11-03T15:43:07.5458999Z 2025-11-03T15:43:07.5459245Z # Fleet always comes first 2025-11-03T15:43:07.5459703Z if fleet_prefix: 2025-11-03T15:43:07.5460166Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:07.5460516Z 2025-11-03T15:43:07.5460827Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:07.5461233Z 2025-11-03T15:43:07.5461241Z 2025-11-03T15:43:07.5461665Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:07.5462420Z """ 2025-11-03T15:43:07.5462981Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:07.5463519Z 2025-11-03T15:43:07.5463894Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:07.5464566Z """ 2025-11-03T15:43:07.5464947Z gh = get_gh_client(github_token) 2025-11-03T15:43:07.5465472Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:07.5466092Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:07.5466587Z 2025-11-03T15:43:07.5466594Z 2025-11-03T15:43:07.5466984Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:07.5467717Z for _ in range(num_retries): 2025-11-03T15:43:07.5468186Z try: 2025-11-03T15:43:07.5468605Z req = Request(url=url, headers=headers) 2025-11-03T15:43:07.5469256Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:07.5469877Z return json.loads(content) 2025-11-03T15:43:07.5470398Z except Exception as e: 2025-11-03T15:43:07.5470929Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:07.5471324Z 2025-11-03T15:43:07.5471693Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:07.5472386Z return {} 2025-11-03T15:43:07.5472613Z 2025-11-03T15:43:07.5472620Z 2025-11-03T15:43:07.5472774Z @cache 2025-11-03T15:43:07.5473378Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:07.5474129Z """ 2025-11-03T15:43:07.5474517Z Dynamically get PR information 2025-11-03T15:43:07.5474985Z """ 2025-11-03T15:43:07.5475541Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:07.5476149Z headers = { 2025-11-03T15:43:07.5476656Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:07.5477255Z "Authorization": f"token {github_token}", 2025-11-03T15:43:07.5477770Z } 2025-11-03T15:43:07.5478192Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:07.5478781Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:07.5479312Z headers=headers, 2025-11-03T15:43:07.5479733Z ) 2025-11-03T15:43:07.5479943Z 2025-11-03T15:43:07.5480123Z if not json_response: 2025-11-03T15:43:07.5480696Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:07.5481285Z return {} 2025-11-03T15:43:07.5481515Z 2025-11-03T15:43:07.5481698Z return json_response 2025-11-03T15:43:07.5481973Z 2025-11-03T15:43:07.5481981Z 2025-11-03T15:43:07.5482368Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:07.5483076Z """ 2025-11-03T15:43:07.5483587Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:07.5484217Z """ 2025-11-03T15:43:07.5484693Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:07.5485279Z return { 2025-11-03T15:43:07.5485858Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:07.5486590Z } 2025-11-03T15:43:07.5486791Z 2025-11-03T15:43:07.5486805Z 2025-11-03T15:43:07.5486970Z def main() -> None: 2025-11-03T15:43:07.5487380Z args = parse_args() 2025-11-03T15:43:07.5487651Z 2025-11-03T15:43:07.5487866Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:07.5488238Z 2025-11-03T15:43:07.5488438Z # Check if the PR is opt-out 2025-11-03T15:43:07.5488919Z if args.pr_number: 2025-11-03T15:43:07.5489572Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:07.5490378Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:07.5490868Z log.info( 2025-11-03T15:43:07.5491526Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:07.5492266Z ) 2025-11-03T15:43:07.5492796Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.5493447Z sys.exit() 2025-11-03T15:43:07.5493700Z 2025-11-03T15:43:07.5493864Z try: 2025-11-03T15:43:07.5494285Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:07.5494974Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:07.5495585Z ) 2025-11-03T15:43:07.5495791Z 2025-11-03T15:43:07.5495994Z username = get_potential_pr_author( 2025-11-03T15:43:07.5496586Z args.github_token, 2025-11-03T15:43:07.5497062Z args.github_repo, 2025-11-03T15:43:07.5497534Z args.github_actor, 2025-11-03T15:43:07.5498028Z args.github_ref_type, 2025-11-03T15:43:07.5498520Z args.github_branch, 2025-11-03T15:43:07.5498964Z ) 2025-11-03T15:43:07.5499164Z 2025-11-03T15:43:07.5499442Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:07.5499878Z 2025-11-03T15:43:07.5500092Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:07.5500639Z rollout_state, 2025-11-03T15:43:07.5501120Z (args.github_issue_owner, username), 2025-11-03T15:43:07.5501656Z args.github_branch, 2025-11-03T15:43:07.5502136Z args.eligible_experiments, 2025-11-03T15:43:07.5502669Z args.opt_out_experiments, 2025-11-03T15:43:07.5503162Z is_canary, 2025-11-03T15:43:07.5503560Z ) 2025-11-03T15:43:07.5503759Z 2025-11-03T15:43:07.5503942Z except Exception as e: 2025-11-03T15:43:07.5504379Z log.error( 2025-11-03T15:43:07.5505031Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:07.5505827Z ) 2025-11-03T15:43:07.5506044Z 2025-11-03T15:43:07.5506418Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.5506899Z 2025-11-03T15:43:07.5506906Z 2025-11-03T15:43:07.5507094Z if __name__ == "__main__": 2025-11-03T15:43:07.5507517Z main() 2025-11-03T15:43:07.5507720Z 2025-11-03T15:43:07.5593904Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:07.5594756Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:07.5614175Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:07.5614670Z env: 2025-11-03T15:43:07.5615308Z GITHUB_TOKEN: *** 2025-11-03T15:43:07.5615718Z ISSUE_NUMBER: 5132 2025-11-03T15:43:07.5616166Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:07.5616783Z ISSUE_OWNER: 2025-11-03T15:43:07.5617193Z CHECK_EXPERIMENTS: 2025-11-03T15:43:07.5617625Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:07.5618075Z PR_NUMBER: 2025-11-03T15:43:07.5618462Z ##[endgroup] 2025-11-03T15:43:08.7105094Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:09.8355881Z Collecting urllib3==1.26.18 2025-11-03T15:43:09.9150209Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:09.9440850Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.1 MB/s eta 0:00:00 2025-11-03T15:43:09.9845700Z Collecting PyGithub==2.3.0 2025-11-03T15:43:10.0039385Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:10.0612197Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:10.0798963Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:10.0839773Z 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:10.0855966Z 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:10.0870086Z 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:10.1266781Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:10.1458418Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:10.1662983Z 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:10.3186909Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.3379501Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:10.4869356Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:10.5056717Z 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:10.5388400Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.5575578Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:10.5947667Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:10.6174702Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.4 MB/s eta 0:00:00 2025-11-03T15:43:10.6371557Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:10.6600689Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.4 MB/s eta 0:00:00 2025-11-03T15:43:10.6795473Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:10.7082292Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 51.7 MB/s eta 0:00:00 2025-11-03T15:43:10.7269167Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:10.7482268Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:10.7538776Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 64.3 MB/s eta 0:00:00 2025-11-03T15:43:10.7737461Z 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:10.7778058Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 48.1 MB/s eta 0:00:00 2025-11-03T15:43:10.7964244Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:10.8001104Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 53.7 MB/s eta 0:00:00 2025-11-03T15:43:11.0741022Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:11.5800923Z 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:11.6742471Z ##[group]Run curr_branch="main" 2025-11-03T15:43:11.6742750Z curr_branch="main" 2025-11-03T15:43:11.6742953Z curr_ref_type="branch" 2025-11-03T15:43:11.6743197Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:11.6743455Z  2025-11-03T15:43:11.6743640Z python3 runner_determinator.py \ 2025-11-03T15:43:11.6743909Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:11.6744159Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:11.6744396Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:11.6744639Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:11.6744905Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:11.6745156Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:11.6745415Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:11.6745685Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:11.6746035Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:11.6746305Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:11.6767358Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:11.6767572Z env: 2025-11-03T15:43:11.6768161Z GITHUB_TOKEN: *** 2025-11-03T15:43:11.6768335Z ISSUE_NUMBER: 5132 2025-11-03T15:43:11.6768544Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:11.6768769Z ISSUE_OWNER: 2025-11-03T15:43:11.6768939Z CHECK_EXPERIMENTS: 2025-11-03T15:43:11.6769132Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:11.6769317Z PR_NUMBER: 2025-11-03T15:43:11.6769482Z ##[endgroup] 2025-11-03T15:43:11.6806681Z Current branch is 'main' 2025-11-03T15:43:13.3492749Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-11-03T15:43:13.3494746Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:13.3495576Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:13.3496615Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:13.3497320Z INFO : Setting output: label-type='' 2025-11-03T15:43:13.3852542Z Evaluate and set job outputs 2025-11-03T15:43:13.3859520Z Cleaning up orphan processes