2025-08-14T20:43:45.8239794Z Current runner version: '2.327.1' 2025-08-14T20:43:45.8273836Z ##[group]Runner Image Provisioner 2025-08-14T20:43:45.8275172Z Hosted Compute Agent 2025-08-14T20:43:45.8276020Z Version: 20250812.370 2025-08-14T20:43:45.8277225Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:45.8278385Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:45.8279556Z ##[endgroup] 2025-08-14T20:43:45.8280514Z ##[group]Operating System 2025-08-14T20:43:45.8281449Z Ubuntu 2025-08-14T20:43:45.8282445Z 24.04.2 2025-08-14T20:43:45.8283120Z LTS 2025-08-14T20:43:45.8283899Z ##[endgroup] 2025-08-14T20:43:45.8284779Z ##[group]Runner Image 2025-08-14T20:43:45.8285756Z Image: ubuntu-24.04 2025-08-14T20:43:45.8286531Z Version: 20250804.2.0 2025-08-14T20:43:45.8288556Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:45.8291413Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:45.8293312Z ##[endgroup] 2025-08-14T20:43:45.8294951Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:45.8298036Z Contents: read 2025-08-14T20:43:45.8298896Z Metadata: read 2025-08-14T20:43:45.8300545Z ##[endgroup] 2025-08-14T20:43:45.8303601Z Secret source: Actions 2025-08-14T20:43:45.8305069Z Prepare workflow directory 2025-08-14T20:43:45.9049284Z Prepare all required actions 2025-08-14T20:43:45.9132715Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:45.9140496Z ##[group] Inputs 2025-08-14T20:43:45.9141457Z check_experiments: 2025-08-14T20:43:45.9142293Z opt_out_experiments: 2025-08-14T20:43:45.9143328Z triggering_actor: pytorchmergebot 2025-08-14T20:43:45.9144415Z issue_owner: 2025-08-14T20:43:45.9145256Z curr_branch: main 2025-08-14T20:43:45.9146391Z curr_ref_type: branch 2025-08-14T20:43:45.9147767Z issue_number: 5132 2025-08-14T20:43:45.9148733Z ##[endgroup] 2025-08-14T20:43:45.9149947Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:43:46.4023519Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:46.4026091Z cat < runner_determinator.py 2025-08-14T20:43:46.4026786Z # flake8: noqa: G004 2025-08-14T20:43:46.4027604Z  2025-08-14T20:43:46.4028484Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:46.4029592Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:46.4030580Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:46.4031378Z  2025-08-14T20:43:46.4031867Z """ 2025-08-14T20:43:46.4032592Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:46.4033727Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:46.4034949Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:46.4036058Z of which runners should be used to run which job. 2025-08-14T20:43:46.4036803Z  2025-08-14T20:43:46.4037659Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:46.4038861Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:46.4039934Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:46.4040830Z list, defined. 2025-08-14T20:43:46.4041338Z  2025-08-14T20:43:46.4042147Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:46.4043260Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:46.4044232Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:46.4045076Z  2025-08-14T20:43:46.4046084Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:46.4047411Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:46.4048474Z experiments which the user could be opted in to. 2025-08-14T20:43:46.4049159Z  2025-08-14T20:43:46.4049696Z The user list has the following rules: 2025-08-14T20:43:46.4050409Z  2025-08-14T20:43:46.4051155Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:46.4052190Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:46.4053224Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:46.4053937Z  2025-08-14T20:43:46.4054392Z Example config: 2025-08-14T20:43:46.4055115Z  # A list of experiments that can be opted into. 2025-08-14T20:43:46.4055966Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:46.4056764Z  # Expected syntax is: 2025-08-14T20:43:46.4135665Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:46.4137829Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:46.4139258Z  2025-08-14T20:43:46.4140014Z  experiments: 2025-08-14T20:43:46.4140793Z  lf: 2025-08-14T20:43:46.4141253Z  rollout_percent: 25 2025-08-14T20:43:46.4141800Z  all_branches: false 2025-08-14T20:43:46.4142333Z  default: true 2025-08-14T20:43:46.4142814Z  --- 2025-08-14T20:43:46.4143237Z  2025-08-14T20:43:46.4143627Z  # Opt-ins: 2025-08-14T20:43:46.4144323Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:46.4145675Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:46.4146698Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:46.4147845Z  # Experiments should be from the above list. 2025-08-14T20:43:46.4148443Z  2025-08-14T20:43:46.4148870Z  @User1,-lf,split_build 2025-08-14T20:43:46.4149400Z  @User2,lf 2025-08-14T20:43:46.4149881Z  @User3,split_build 2025-08-14T20:43:46.4150377Z """ 2025-08-14T20:43:46.4150779Z  2025-08-14T20:43:46.4151186Z import json 2025-08-14T20:43:46.4151639Z import logging 2025-08-14T20:43:46.4152099Z import os 2025-08-14T20:43:46.4152532Z import random 2025-08-14T20:43:46.4153024Z import re 2025-08-14T20:43:46.4153449Z import sys 2025-08-14T20:43:46.4153942Z from argparse import ArgumentParser 2025-08-14T20:43:46.4154644Z from collections.abc import Iterable 2025-08-14T20:43:46.4155264Z from functools import cache 2025-08-14T20:43:46.4155824Z from logging import LogRecord 2025-08-14T20:43:46.4156411Z from typing import Any, NamedTuple 2025-08-14T20:43:46.4157223Z from urllib.request import Request, urlopen 2025-08-14T20:43:46.4157844Z  2025-08-14T20:43:46.4158242Z import yaml 2025-08-14T20:43:46.4158724Z from github import Auth, Github 2025-08-14T20:43:46.4159305Z from github.Issue import Issue 2025-08-14T20:43:46.4159869Z  2025-08-14T20:43:46.4160264Z  2025-08-14T20:43:46.4160742Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:46.4161539Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:46.4162525Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:46.4163320Z  2025-08-14T20:43:46.4164034Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:46.4164700Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:46.4165310Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:46.4165989Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:46.4166576Z  2025-08-14T20:43:46.4167195Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:46.4167771Z  2025-08-14T20:43:46.4168179Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:46.4168727Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:46.4169234Z  2025-08-14T20:43:46.4169627Z  2025-08-14T20:43:46.4170049Z class Experiment(NamedTuple): 2025-08-14T20:43:46.4170618Z  rollout_perc: float = ( 2025-08-14T20:43:46.4171377Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:46.4172117Z  ) 2025-08-14T20:43:46.4172562Z  all_branches: bool = ( 2025-08-14T20:43:46.4173308Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:46.4174049Z  ) 2025-08-14T20:43:46.4174475Z  default: bool = ( 2025-08-14T20:43:46.4175172Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:46.4175885Z  ) 2025-08-14T20:43:46.4176280Z  2025-08-14T20:43:46.4176706Z  # Add more fields as needed 2025-08-14T20:43:46.4177537Z  2025-08-14T20:43:46.4177924Z  2025-08-14T20:43:46.4178343Z class Settings(NamedTuple): 2025-08-14T20:43:46.4178878Z  """ 2025-08-14T20:43:46.4179417Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:46.4180063Z  """ 2025-08-14T20:43:46.4180476Z  2025-08-14T20:43:46.4180933Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:46.4181521Z  2025-08-14T20:43:46.4182063Z  2025-08-14T20:43:46.4182551Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:46.4183275Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:46.4183932Z  2025-08-14T20:43:46.4184323Z  COLORS = { 2025-08-14T20:43:46.4184809Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:46.4185381Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:46.4185960Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:46.4186529Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:46.4187315Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:46.4187878Z  } 2025-08-14T20:43:46.4188274Z  2025-08-14T20:43:46.4188747Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:46.4189583Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:46.4190447Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:46.4191098Z  return super().format(record) 2025-08-14T20:43:46.4191645Z  2025-08-14T20:43:46.4192037Z  2025-08-14T20:43:46.4192467Z handler = logging.StreamHandler() 2025-08-14T20:43:46.4193287Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:46.4194069Z  2025-08-14T20:43:46.4194579Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:46.4195246Z log.addHandler(handler) 2025-08-14T20:43:46.4195780Z log.setLevel(logging.INFO) 2025-08-14T20:43:46.4196293Z  2025-08-14T20:43:46.4196675Z  2025-08-14T20:43:46.4197625Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:46.4198270Z  """ 2025-08-14T20:43:46.4198856Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:46.4199693Z  """ 2025-08-14T20:43:46.4200130Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:46.4201315Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:46.4202525Z  log.warning( 2025-08-14T20:43:46.4203497Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:46.4204489Z  ) 2025-08-14T20:43:46.4205008Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:46.4205614Z  return 2025-08-14T20:43:46.4206063Z  2025-08-14T20:43:46.4206516Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:46.4207465Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:46.4208134Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:46.4208701Z  2025-08-14T20:43:46.4209093Z  2025-08-14T20:43:46.4209663Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:46.4210396Z  return frozenset( 2025-08-14T20:43:46.4211116Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:46.4211855Z  ) 2025-08-14T20:43:46.4212272Z  2025-08-14T20:43:46.4212655Z  2025-08-14T20:43:46.4213068Z def parse_args() -> Any: 2025-08-14T20:43:46.4213740Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:46.4214705Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:46.4215539Z  parser.add_argument( 2025-08-14T20:43:46.4216078Z  "--github-issue-repo", 2025-08-14T20:43:46.4216633Z  type=str, 2025-08-14T20:43:46.4217316Z  required=False, 2025-08-14T20:43:46.4218026Z  default="pytorch/test-infra", 2025-08-14T20:43:46.4218680Z  help="GitHub repo to get the issue", 2025-08-14T20:43:46.4219254Z  ) 2025-08-14T20:43:46.4219692Z  parser.add_argument( 2025-08-14T20:43:46.4220221Z  "--github-repo", 2025-08-14T20:43:46.4220731Z  type=str, 2025-08-14T20:43:46.4221217Z  required=True, 2025-08-14T20:43:46.4221787Z  help="GitHub repo where CI is running", 2025-08-14T20:43:46.4222364Z  ) 2025-08-14T20:43:46.4222795Z  parser.add_argument( 2025-08-14T20:43:46.4223500Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:46.4224223Z  ) 2025-08-14T20:43:46.4224650Z  parser.add_argument( 2025-08-14T20:43:46.4225375Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:46.4226128Z  ) 2025-08-14T20:43:46.4226551Z  parser.add_argument( 2025-08-14T20:43:46.4227411Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:46.4228161Z  ) 2025-08-14T20:43:46.4228596Z  parser.add_argument( 2025-08-14T20:43:46.4229355Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:46.4230123Z  ) 2025-08-14T20:43:46.4230563Z  parser.add_argument( 2025-08-14T20:43:46.4231089Z  "--github-ref-type", 2025-08-14T20:43:46.4231621Z  type=str, 2025-08-14T20:43:46.4232095Z  required=True, 2025-08-14T20:43:46.4232690Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:46.4233298Z  ) 2025-08-14T20:43:46.4233721Z  parser.add_argument( 2025-08-14T20:43:46.4234406Z  "--eligible-experiments", 2025-08-14T20:43:46.4235004Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:46.4235582Z  required=False, 2025-08-14T20:43:46.4236090Z  default="", 2025-08-14T20:43:46.4237139Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:46.4238124Z  ) 2025-08-14T20:43:46.4238542Z  parser.add_argument( 2025-08-14T20:43:46.4239078Z  "--opt-out-experiments", 2025-08-14T20:43:46.4239667Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:46.4240238Z  required=False, 2025-08-14T20:43:46.4240735Z  default="", 2025-08-14T20:43:46.4241208Z  help=( 2025-08-14T20:43:46.4241965Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:46.4243185Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:46.4244077Z  ), 2025-08-14T20:43:46.4244498Z  ) 2025-08-14T20:43:46.4244924Z  parser.add_argument( 2025-08-14T20:43:46.4245444Z  "--pr-number", 2025-08-14T20:43:46.4245937Z  type=str, 2025-08-14T20:43:46.4246417Z  required=False, 2025-08-14T20:43:46.4246917Z  default="", 2025-08-14T20:43:46.4247627Z  help="the optional PR number where this is run", 2025-08-14T20:43:46.4248238Z  ) 2025-08-14T20:43:46.4248641Z  2025-08-14T20:43:46.4249064Z  return parser.parse_args() 2025-08-14T20:43:46.4249597Z  2025-08-14T20:43:46.4249973Z  2025-08-14T20:43:46.4250627Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.4251610Z  auth = Auth.Token(github_token) 2025-08-14T20:43:46.4252218Z  return Github(auth=auth) 2025-08-14T20:43:46.4252737Z  2025-08-14T20:43:46.4253154Z  2025-08-14T20:43:46.4253872Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.4254751Z  repo = gh.get_repo(repo) 2025-08-14T20:43:46.4255345Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:46.4255932Z  2025-08-14T20:43:46.4256318Z  2025-08-14T20:43:46.4256731Z def get_potential_pr_author( 2025-08-14T20:43:46.4257581Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:46.4258338Z ) -> str: 2025-08-14T20:43:46.4258951Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:46.4259843Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:46.4260693Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:46.4261321Z  2025-08-14T20:43:46.4261764Z  gh = get_gh_client(github_token) 2025-08-14T20:43:46.4262326Z  2025-08-14T20:43:46.4262853Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:46.4263561Z  split_tag = ref_name.split("/") 2025-08-14T20:43:46.4264124Z  if ( 2025-08-14T20:43:46.4264589Z  len(split_tag) == 3 2025-08-14T20:43:46.4265162Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:46.4265766Z  and split_tag[2].isnumeric() 2025-08-14T20:43:46.4266321Z  ): 2025-08-14T20:43:46.4266794Z  pr_number = split_tag[2] 2025-08-14T20:43:46.4267455Z  try: 2025-08-14T20:43:46.4267968Z  repository = gh.get_repo(repo) 2025-08-14T20:43:46.4268805Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:46.4269481Z  except Exception as e: 2025-08-14T20:43:46.4270084Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:46.4270848Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:46.4271566Z  ) from e 2025-08-14T20:43:46.4272214Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:46.4272990Z  # In all other cases, return the original input username 2025-08-14T20:43:46.4273649Z  return username 2025-08-14T20:43:46.4274118Z  2025-08-14T20:43:46.4274501Z  2025-08-14T20:43:46.4274966Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:46.4275559Z  """ 2025-08-14T20:43:46.4276295Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:46.4277255Z  """ 2025-08-14T20:43:46.4277881Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:46.4278610Z  2025-08-14T20:43:46.4278997Z  2025-08-14T20:43:46.4279434Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:46.4279999Z  try: 2025-08-14T20:43:46.4280467Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:46.4281028Z  return data 2025-08-14T20:43:46.4281531Z  except yaml.YAMLError: 2025-08-14T20:43:46.4282100Z  log.exception("Error loading YAML") 2025-08-14T20:43:46.4282679Z  raise 2025-08-14T20:43:46.4283107Z  2025-08-14T20:43:46.4283481Z  2025-08-14T20:43:46.4284153Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:46.4284961Z  """ 2025-08-14T20:43:46.4285810Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:46.4286626Z  2025-08-14T20:43:46.4287326Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.4288172Z  and the text below is the list of opted in users. 2025-08-14T20:43:46.4288785Z  2025-08-14T20:43:46.4289416Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:46.4290181Z  """ 2025-08-14T20:43:46.4290700Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:46.4291454Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:46.4292300Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:46.4292950Z  else: 2025-08-14T20:43:46.4293407Z  return "", rollout_state 2025-08-14T20:43:46.4293935Z  2025-08-14T20:43:46.4294310Z  2025-08-14T20:43:46.4294748Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:46.4295313Z  """ 2025-08-14T20:43:46.4295907Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:46.4296607Z  """ 2025-08-14T20:43:46.4297109Z  2025-08-14T20:43:46.4297484Z  2025-08-14T20:43:46.4298074Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:46.4298791Z  """ 2025-08-14T20:43:46.4299588Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:46.4300483Z  2025-08-14T20:43:46.4301338Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:46.4302412Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:46.4303310Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:46.4304003Z  2025-08-14T20:43:46.4304367Z  2025-08-14T20:43:46.4304735Z  """ 2025-08-14T20:43:46.4305160Z  optins = UserOptins() 2025-08-14T20:43:46.4305735Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:46.4306358Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:46.4307082Z  if not user or not user.startswith("@"): 2025-08-14T20:43:46.4307712Z  # Not a valid user. Skip 2025-08-14T20:43:46.4308255Z  continue 2025-08-14T20:43:46.4308718Z  2025-08-14T20:43:46.4309110Z  if user: 2025-08-14T20:43:46.4309632Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:46.4310426Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:46.4311125Z  2025-08-14T20:43:46.4311519Z  return optins 2025-08-14T20:43:46.4311982Z  2025-08-14T20:43:46.4312356Z  2025-08-14T20:43:46.4312891Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:46.4313558Z  """ 2025-08-14T20:43:46.4314025Z  Check if the experiment name is valid. 2025-08-14T20:43:46.4314601Z  A valid name: 2025-08-14T20:43:46.4315336Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:46.4316348Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:46.4317229Z  - Cannot contain spaces 2025-08-14T20:43:46.4317752Z  """ 2025-08-14T20:43:46.4318145Z  2025-08-14T20:43:46.4318645Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:46.4319430Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:46.4320223Z  2025-08-14T20:43:46.4320617Z  if valid: 2025-08-14T20:43:46.4321068Z  return True 2025-08-14T20:43:46.4321524Z  2025-08-14T20:43:46.4321907Z  log.error( 2025-08-14T20:43:46.4323454Z  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-08-14T20:43:46.4325094Z  ) 2025-08-14T20:43:46.4325509Z  return False 2025-08-14T20:43:46.4325953Z  2025-08-14T20:43:46.4326319Z  2025-08-14T20:43:46.4326875Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:46.4327685Z  """ 2025-08-14T20:43:46.4328351Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:46.4329120Z  """ 2025-08-14T20:43:46.4329528Z  try: 2025-08-14T20:43:46.4329947Z  if settings_text: 2025-08-14T20:43:46.4330760Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:46.4331606Z  # for easy reading 2025-08-14T20:43:46.4332528Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:46.4333496Z  # the backtick character in shell commands. 2025-08-14T20:43:46.4334168Z  backtick = chr(96) # backtick character 2025-08-14T20:43:46.4334923Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:46.4335645Z  settings = load_yaml(settings_text) 2025-08-14T20:43:46.4336218Z  2025-08-14T20:43:46.4336870Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:46.4337975Z  experiments = {} 2025-08-14T20:43:46.4338496Z  2025-08-14T20:43:46.4339111Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:46.4339947Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:46.4341128Z  # 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-08-14T20:43:46.4342241Z  continue 2025-08-14T20:43:46.4342740Z  2025-08-14T20:43:46.4343142Z  valid_settings = {} 2025-08-14T20:43:46.4343735Z  for setting in exp_settings: 2025-08-14T20:43:46.4344360Z  if setting not in Experiment._fields: 2025-08-14T20:43:46.4344980Z  log.warning( 2025-08-14T20:43:46.4345779Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:46.4346540Z  ) 2025-08-14T20:43:46.4347130Z  else: 2025-08-14T20:43:46.4347725Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:46.4348347Z  2025-08-14T20:43:46.4348857Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:46.4349571Z  return Settings(experiments) 2025-08-14T20:43:46.4350127Z  2025-08-14T20:43:46.4350527Z  except Exception: 2025-08-14T20:43:46.4351091Z  log.exception("Failed to parse settings") 2025-08-14T20:43:46.4351672Z  2025-08-14T20:43:46.4352069Z  return Settings() 2025-08-14T20:43:46.4352542Z  2025-08-14T20:43:46.4352916Z  2025-08-14T20:43:46.4353588Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:46.4354234Z  """ 2025-08-14T20:43:46.4354737Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:46.4355336Z  2025-08-14T20:43:46.4355921Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.4356742Z  and the text below is the list of opted in users. 2025-08-14T20:43:46.4357456Z  2025-08-14T20:43:46.4358103Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:46.4358888Z  """ 2025-08-14T20:43:46.4359516Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.4360345Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:46.4360935Z  2025-08-14T20:43:46.4361305Z  2025-08-14T20:43:46.4361807Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:46.4362427Z  """ 2025-08-14T20:43:46.4362883Z  Parse users from the rollout state. 2025-08-14T20:43:46.4363440Z  2025-08-14T20:43:46.4363813Z  """ 2025-08-14T20:43:46.4364422Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.4365232Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:46.4365827Z  2025-08-14T20:43:46.4366194Z  2025-08-14T20:43:46.4366872Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.4367777Z  """ 2025-08-14T20:43:46.4368272Z  Check if a user is opted into an experiment 2025-08-14T20:43:46.4368857Z  """ 2025-08-14T20:43:46.4369377Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:46.4370005Z  2025-08-14T20:43:46.4370508Z  2025-08-14T20:43:46.4371203Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.4372016Z  """ 2025-08-14T20:43:46.4372549Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:46.4373183Z  """ 2025-08-14T20:43:46.4373761Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:46.4374531Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:46.4375243Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:46.4375896Z  return False 2025-08-14T20:43:46.4376361Z  2025-08-14T20:43:46.4376872Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:46.4377633Z  log.warning( 2025-08-14T20:43:46.4378526Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:46.4379462Z  ) 2025-08-14T20:43:46.4379868Z  2025-08-14T20:43:46.4380247Z  return True 2025-08-14T20:43:46.4380683Z  2025-08-14T20:43:46.4381053Z  2025-08-14T20:43:46.4381443Z def get_runner_prefix( 2025-08-14T20:43:46.4381948Z  rollout_state: str, 2025-08-14T20:43:46.4382491Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:46.4383063Z  branch: str, 2025-08-14T20:43:46.4383659Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.4384401Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.4385040Z  is_canary: bool = False, 2025-08-14T20:43:46.4385567Z ) -> str: 2025-08-14T20:43:46.4386080Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:46.4386735Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:46.4387411Z  2025-08-14T20:43:46.4387942Z  fleet_prefix = "" 2025-08-14T20:43:46.4388443Z  prefixes = [] 2025-08-14T20:43:46.4389176Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:46.4390189Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:46.4390953Z  log.info( 2025-08-14T20:43:46.4391716Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:46.4392522Z  ) 2025-08-14T20:43:46.4392980Z  continue 2025-08-14T20:43:46.4393433Z  2025-08-14T20:43:46.4393843Z  if opt_out_experiments: 2025-08-14T20:43:46.4394451Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:46.4395170Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:46.4395833Z  log.info( 2025-08-14T20:43:46.4396847Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:46.4397988Z  ) 2025-08-14T20:43:46.4398454Z  continue 2025-08-14T20:43:46.4398939Z  2025-08-14T20:43:46.4399349Z  if eligible_experiments: 2025-08-14T20:43:46.4399988Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:46.4400690Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:46.4401288Z  log.info( 2025-08-14T20:43:46.4402148Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:46.4403064Z  ) 2025-08-14T20:43:46.4403670Z  continue 2025-08-14T20:43:46.4404229Z  elif not experiment_settings.default: 2025-08-14T20:43:46.4404813Z  log.info( 2025-08-14T20:43:46.4405555Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:46.4406336Z  ) 2025-08-14T20:43:46.4406782Z  continue 2025-08-14T20:43:46.4407341Z  2025-08-14T20:43:46.4407858Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:46.4408527Z  opted_out_users = [ 2025-08-14T20:43:46.4409044Z  requestor 2025-08-14T20:43:46.4409586Z  for requestor in workflow_requestors 2025-08-14T20:43:46.4410319Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.4411003Z  ] 2025-08-14T20:43:46.4411405Z  2025-08-14T20:43:46.4411814Z  if opted_out_users: 2025-08-14T20:43:46.4412355Z  log.info( 2025-08-14T20:43:46.4413064Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:46.4413819Z  ) 2025-08-14T20:43:46.4414261Z  continue 2025-08-14T20:43:46.4414724Z  2025-08-14T20:43:46.4415231Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:46.4415898Z  opted_in_users = [ 2025-08-14T20:43:46.4416430Z  requestor 2025-08-14T20:43:46.4417098Z  for requestor in workflow_requestors 2025-08-14T20:43:46.4417853Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.4418527Z  ] 2025-08-14T20:43:46.4418942Z  2025-08-14T20:43:46.4419328Z  enabled = False 2025-08-14T20:43:46.4419856Z  if opted_in_users: 2025-08-14T20:43:46.4420504Z  log.info( 2025-08-14T20:43:46.4421257Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:46.4421986Z  ) 2025-08-14T20:43:46.4422452Z  enabled = True 2025-08-14T20:43:46.4422952Z  2025-08-14T20:43:46.4423401Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:46.4424309Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:46.4425318Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:46.4426027Z  log.info( 2025-08-14T20:43:46.4427083Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:46.4428060Z  ) 2025-08-14T20:43:46.4428559Z  enabled = True 2025-08-14T20:43:46.4429073Z  2025-08-14T20:43:46.4429466Z  if enabled: 2025-08-14T20:43:46.4429966Z  label = experiment_name 2025-08-14T20:43:46.4430591Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:46.4431486Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:46.4432424Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:46.4433247Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:46.4433957Z  if is_canary: 2025-08-14T20:43:46.4434532Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:46.4435129Z  fleet_prefix = label 2025-08-14T20:43:46.4435680Z  else: 2025-08-14T20:43:46.4436319Z  prefixes.append(label) 2025-08-14T20:43:46.4436867Z  2025-08-14T20:43:46.4437376Z  if len(prefixes) > 1: 2025-08-14T20:43:46.4437892Z  log.error( 2025-08-14T20:43:46.4439017Z  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-08-14T20:43:46.4440189Z  ) 2025-08-14T20:43:46.4440639Z  prefixes = prefixes[:1] 2025-08-14T20:43:46.4441170Z  2025-08-14T20:43:46.4441568Z  # Fleet always comes first 2025-08-14T20:43:46.4442112Z  if fleet_prefix: 2025-08-14T20:43:46.4442636Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:46.4443201Z  2025-08-14T20:43:46.4443687Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:46.4444300Z  2025-08-14T20:43:46.4444671Z  2025-08-14T20:43:46.4445371Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:46.4446204Z  """ 2025-08-14T20:43:46.4446861Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:46.4447728Z  2025-08-14T20:43:46.4448348Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:46.4449108Z  """ 2025-08-14T20:43:46.4449556Z  gh = get_gh_client(github_token) 2025-08-14T20:43:46.4450167Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:46.4450901Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:46.4451549Z  2025-08-14T20:43:46.4451925Z  2025-08-14T20:43:46.4452566Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:46.4453556Z  for _ in range(num_retries): 2025-08-14T20:43:46.4454097Z  try: 2025-08-14T20:43:46.4454595Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:46.4455313Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:46.4456020Z  return json.loads(content) 2025-08-14T20:43:46.4456602Z  except Exception as e: 2025-08-14T20:43:46.4457319Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:46.4457922Z  2025-08-14T20:43:46.4458540Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:46.4459304Z  return {} 2025-08-14T20:43:46.4459741Z  2025-08-14T20:43:46.4460103Z  2025-08-14T20:43:46.4460482Z @cache 2025-08-14T20:43:46.4461181Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:46.4461999Z  """ 2025-08-14T20:43:46.4462447Z  Dynamically get PR information 2025-08-14T20:43:46.4462996Z  """ 2025-08-14T20:43:46.4463563Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:46.4464238Z  headers = { 2025-08-14T20:43:46.4464775Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:46.4465438Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:46.4466016Z  } 2025-08-14T20:43:46.4466500Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:46.4467261Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:46.4467851Z  headers=headers, 2025-08-14T20:43:46.4468342Z  ) 2025-08-14T20:43:46.4468743Z  2025-08-14T20:43:46.4469140Z  if not json_response: 2025-08-14T20:43:46.4469799Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:46.4470609Z  return {} 2025-08-14T20:43:46.4471070Z  2025-08-14T20:43:46.4471463Z  return json_response 2025-08-14T20:43:46.4471956Z  2025-08-14T20:43:46.4472318Z  2025-08-14T20:43:46.4472954Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:46.4473729Z  """ 2025-08-14T20:43:46.4474319Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:46.4475018Z  """ 2025-08-14T20:43:46.4475564Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:46.4476226Z  return { 2025-08-14T20:43:46.4476874Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:46.4477722Z  } 2025-08-14T20:43:46.4478122Z  2025-08-14T20:43:46.4478501Z  2025-08-14T20:43:46.4478893Z def main() -> None: 2025-08-14T20:43:46.4479385Z  args = parse_args() 2025-08-14T20:43:46.4479870Z  2025-08-14T20:43:46.4480326Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:46.4480917Z  2025-08-14T20:43:46.4481321Z  # Check if the PR is opt-out 2025-08-14T20:43:46.4481873Z  if args.pr_number: 2025-08-14T20:43:46.4482690Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:46.4483502Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:46.4484059Z  log.info( 2025-08-14T20:43:46.4484826Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:46.4485647Z  ) 2025-08-14T20:43:46.4486285Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.4487106Z  sys.exit() 2025-08-14T20:43:46.4487743Z  2025-08-14T20:43:46.4488123Z  try: 2025-08-14T20:43:46.4488624Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:46.4489397Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:46.4490088Z  ) 2025-08-14T20:43:46.4490493Z  2025-08-14T20:43:46.4490929Z  username = get_potential_pr_author( 2025-08-14T20:43:46.4491520Z  args.github_token, 2025-08-14T20:43:46.4492054Z  args.github_repo, 2025-08-14T20:43:46.4492600Z  args.github_actor, 2025-08-14T20:43:46.4493154Z  args.github_ref_type, 2025-08-14T20:43:46.4493711Z  args.github_branch, 2025-08-14T20:43:46.4494221Z  ) 2025-08-14T20:43:46.4494629Z  2025-08-14T20:43:46.4495147Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:46.4495809Z  2025-08-14T20:43:46.4496270Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:46.4496872Z  rollout_state, 2025-08-14T20:43:46.4497552Z  (args.github_issue_owner, username), 2025-08-14T20:43:46.4498171Z  args.github_branch, 2025-08-14T20:43:46.4498751Z  args.eligible_experiments, 2025-08-14T20:43:46.4499348Z  args.opt_out_experiments, 2025-08-14T20:43:46.4499912Z  is_canary, 2025-08-14T20:43:46.4500398Z  ) 2025-08-14T20:43:46.4500807Z  2025-08-14T20:43:46.4501213Z  except Exception as e: 2025-08-14T20:43:46.4501729Z  log.error( 2025-08-14T20:43:46.4502489Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:46.4503421Z  ) 2025-08-14T20:43:46.4503839Z  2025-08-14T20:43:46.4504411Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.4505120Z  2025-08-14T20:43:46.4505493Z  2025-08-14T20:43:46.4505891Z if __name__ == "__main__": 2025-08-14T20:43:46.4506400Z  main() 2025-08-14T20:43:46.4506817Z  2025-08-14T20:43:46.4507297Z EOF 2025-08-14T20:43:46.4507686Z  2025-08-14T20:43:46.4508098Z cat runner_determinator.py 2025-08-14T20:43:46.4834474Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:46.4835329Z env: 2025-08-14T20:43:46.4836041Z GITHUB_TOKEN: *** 2025-08-14T20:43:46.4836460Z ISSUE_NUMBER: 5132 2025-08-14T20:43:46.4836921Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:46.4837730Z ISSUE_OWNER: 2025-08-14T20:43:46.4838193Z CHECK_EXPERIMENTS: 2025-08-14T20:43:46.4838635Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:46.4839070Z PR_NUMBER: 2025-08-14T20:43:46.4839494Z ##[endgroup] 2025-08-14T20:43:46.5054197Z # flake8: noqa: G004 2025-08-14T20:43:46.5054593Z 2025-08-14T20:43:46.5055045Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:46.5056036Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:46.5056874Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:46.5057673Z 2025-08-14T20:43:46.5057868Z """ 2025-08-14T20:43:46.5058489Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:46.5059398Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:46.5060323Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:46.5061160Z of which runners should be used to run which job. 2025-08-14T20:43:46.5061569Z 2025-08-14T20:43:46.5061969Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:46.5063114Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:46.5064062Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:46.5064794Z list, defined. 2025-08-14T20:43:46.5065041Z 2025-08-14T20:43:46.5065434Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:46.5066395Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:46.5067522Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:46.5067986Z 2025-08-14T20:43:46.5068381Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:46.5069272Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:46.5070036Z experiments which the user could be opted in to. 2025-08-14T20:43:46.5070453Z 2025-08-14T20:43:46.5070675Z The user list has the following rules: 2025-08-14T20:43:46.5071040Z 2025-08-14T20:43:46.5071383Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:46.5072269Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:46.5073061Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:46.5073466Z 2025-08-14T20:43:46.5073663Z Example config: 2025-08-14T20:43:46.5074140Z # A list of experiments that can be opted into. 2025-08-14T20:43:46.5074842Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:46.5075496Z # Expected syntax is: 2025-08-14T20:43:46.5076167Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:46.5077405Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:46.5078063Z 2025-08-14T20:43:46.5078262Z experiments: 2025-08-14T20:43:46.5078684Z lf: 2025-08-14T20:43:46.5079087Z rollout_percent: 25 2025-08-14T20:43:46.5079757Z all_branches: false 2025-08-14T20:43:46.5080238Z default: true 2025-08-14T20:43:46.5080687Z --- 2025-08-14T20:43:46.5080897Z 2025-08-14T20:43:46.5081081Z # Opt-ins: 2025-08-14T20:43:46.5081695Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:46.5082581Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:46.5083395Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:46.5084078Z # Experiments should be from the above list. 2025-08-14T20:43:46.5084462Z 2025-08-14T20:43:46.5084664Z @User1,-lf,split_build 2025-08-14T20:43:46.5085130Z @User2,lf 2025-08-14T20:43:46.5085532Z @User3,split_build 2025-08-14T20:43:46.5085967Z """ 2025-08-14T20:43:46.5086209Z 2025-08-14T20:43:46.5086395Z import json 2025-08-14T20:43:46.5086801Z import logging 2025-08-14T20:43:46.5087441Z import os 2025-08-14T20:43:46.5087847Z import random 2025-08-14T20:43:46.5088254Z import re 2025-08-14T20:43:46.5088665Z import sys 2025-08-14T20:43:46.5089102Z from argparse import ArgumentParser 2025-08-14T20:43:46.5089659Z from collections.abc import Iterable 2025-08-14T20:43:46.5090204Z from functools import cache 2025-08-14T20:43:46.5090706Z from logging import LogRecord 2025-08-14T20:43:46.5091226Z from typing import Any, NamedTuple 2025-08-14T20:43:46.5091787Z from urllib.request import Request, urlopen 2025-08-14T20:43:46.5092175Z 2025-08-14T20:43:46.5092363Z import yaml 2025-08-14T20:43:46.5092781Z from github import Auth, Github 2025-08-14T20:43:46.5093303Z from github.Issue import Issue 2025-08-14T20:43:46.5093610Z 2025-08-14T20:43:46.5093617Z 2025-08-14T20:43:46.5093856Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:46.5094571Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:46.5095463Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:46.5096029Z 2025-08-14T20:43:46.5096280Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:46.5097660Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:46.5098315Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:46.5098904Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:46.5099269Z 2025-08-14T20:43:46.5099489Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:46.5099835Z 2025-08-14T20:43:46.5100043Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:46.5100539Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:46.5100823Z 2025-08-14T20:43:46.5100830Z 2025-08-14T20:43:46.5101039Z class Experiment(NamedTuple): 2025-08-14T20:43:46.5101550Z rollout_perc: float = ( 2025-08-14T20:43:46.5102211Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:46.5102933Z ) 2025-08-14T20:43:46.5103340Z all_branches: bool = ( 2025-08-14T20:43:46.5103987Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:46.5104695Z ) 2025-08-14T20:43:46.5105083Z default: bool = ( 2025-08-14T20:43:46.5105680Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:46.5106347Z ) 2025-08-14T20:43:46.5106554Z 2025-08-14T20:43:46.5106755Z # Add more fields as needed 2025-08-14T20:43:46.5107252Z 2025-08-14T20:43:46.5107259Z 2025-08-14T20:43:46.5107469Z class Settings(NamedTuple): 2025-08-14T20:43:46.5107940Z """ 2025-08-14T20:43:46.5108421Z Settings for the experiments that can be opted into. 2025-08-14T20:43:46.5109015Z """ 2025-08-14T20:43:46.5109217Z 2025-08-14T20:43:46.5109451Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:46.5109826Z 2025-08-14T20:43:46.5109832Z 2025-08-14T20:43:46.5110060Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:46.5110711Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:46.5111154Z 2025-08-14T20:43:46.5111338Z COLORS = { 2025-08-14T20:43:46.5111768Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:46.5112456Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:46.5112983Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:46.5113512Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:46.5114022Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:46.5114543Z } 2025-08-14T20:43:46.5114747Z 2025-08-14T20:43:46.5114987Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:46.5115765Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:46.5116571Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:46.5117399Z return super().format(record) 2025-08-14T20:43:46.5117757Z 2025-08-14T20:43:46.5117763Z 2025-08-14T20:43:46.5117983Z handler = logging.StreamHandler() 2025-08-14T20:43:46.5118712Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:46.5119278Z 2025-08-14T20:43:46.5119543Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:46.5120158Z log.addHandler(handler) 2025-08-14T20:43:46.5120643Z log.setLevel(logging.INFO) 2025-08-14T20:43:46.5120943Z 2025-08-14T20:43:46.5120950Z 2025-08-14T20:43:46.5121225Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:46.5121809Z """ 2025-08-14T20:43:46.5122437Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:46.5123096Z """ 2025-08-14T20:43:46.5123501Z if not GITHUB_OUTPUT: 2025-08-14T20:43:46.5124600Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:46.5125762Z log.warning( 2025-08-14T20:43:46.5126684Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:46.5127890Z ) 2025-08-14T20:43:46.5137855Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:46.5138512Z return 2025-08-14T20:43:46.5138764Z 2025-08-14T20:43:46.5139195Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:46.5139835Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:46.5140453Z f.write(f"{key}={value}\n") 2025-08-14T20:43:46.5140788Z 2025-08-14T20:43:46.5140795Z 2025-08-14T20:43:46.5141132Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:46.5141795Z return frozenset( 2025-08-14T20:43:46.5142441Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:46.5143150Z ) 2025-08-14T20:43:46.5143359Z 2025-08-14T20:43:46.5143367Z 2025-08-14T20:43:46.5143570Z def parse_args() -> Any: 2025-08-14T20:43:46.5144154Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:46.5145062Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:46.5145870Z parser.add_argument( 2025-08-14T20:43:46.5146358Z "--github-issue-repo", 2025-08-14T20:43:46.5146862Z type=str, 2025-08-14T20:43:46.5147539Z required=False, 2025-08-14T20:43:46.5148040Z default="pytorch/test-infra", 2025-08-14T20:43:46.5148601Z help="GitHub repo to get the issue", 2025-08-14T20:43:46.5149143Z ) 2025-08-14T20:43:46.5149546Z parser.add_argument( 2025-08-14T20:43:46.5150031Z "--github-repo", 2025-08-14T20:43:46.5150482Z type=str, 2025-08-14T20:43:46.5150917Z required=True, 2025-08-14T20:43:46.5151416Z help="GitHub repo where CI is running", 2025-08-14T20:43:46.5151980Z ) 2025-08-14T20:43:46.5152387Z parser.add_argument( 2025-08-14T20:43:46.5153021Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:46.5153719Z ) 2025-08-14T20:43:46.5154115Z parser.add_argument( 2025-08-14T20:43:46.5154776Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:46.5155489Z ) 2025-08-14T20:43:46.5155883Z parser.add_argument( 2025-08-14T20:43:46.5156721Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:46.5157704Z ) 2025-08-14T20:43:46.5158110Z parser.add_argument( 2025-08-14T20:43:46.5158808Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:46.5159556Z ) 2025-08-14T20:43:46.5159957Z parser.add_argument( 2025-08-14T20:43:46.5160458Z "--github-ref-type", 2025-08-14T20:43:46.5160944Z type=str, 2025-08-14T20:43:46.5161371Z required=True, 2025-08-14T20:43:46.5211237Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:46.5212528Z ) 2025-08-14T20:43:46.5213257Z parser.add_argument( 2025-08-14T20:43:46.5213823Z "--eligible-experiments", 2025-08-14T20:43:46.5214368Z type=_str_comma_separated_to_set, 2025-08-14T20:43:46.5214921Z required=False, 2025-08-14T20:43:46.5215369Z default="", 2025-08-14T20:43:46.5216260Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:46.5217455Z ) 2025-08-14T20:43:46.5217865Z parser.add_argument( 2025-08-14T20:43:46.5218363Z "--opt-out-experiments", 2025-08-14T20:43:46.5218898Z type=_str_comma_separated_to_set, 2025-08-14T20:43:46.5219445Z required=False, 2025-08-14T20:43:46.5219889Z default="", 2025-08-14T20:43:46.5220320Z help=( 2025-08-14T20:43:46.5221033Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:46.5222194Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:46.5223046Z ), 2025-08-14T20:43:46.5223429Z ) 2025-08-14T20:43:46.5223832Z parser.add_argument( 2025-08-14T20:43:46.5224294Z "--pr-number", 2025-08-14T20:43:46.5224747Z type=str, 2025-08-14T20:43:46.5225174Z required=False, 2025-08-14T20:43:46.5225627Z default="", 2025-08-14T20:43:46.5226369Z help="the optional PR number where this is run", 2025-08-14T20:43:46.5227154Z ) 2025-08-14T20:43:46.5227376Z 2025-08-14T20:43:46.5227592Z return parser.parse_args() 2025-08-14T20:43:46.5227920Z 2025-08-14T20:43:46.5227927Z 2025-08-14T20:43:46.5228341Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.5229124Z auth = Auth.Token(github_token) 2025-08-14T20:43:46.5229655Z return Github(auth=auth) 2025-08-14T20:43:46.5229963Z 2025-08-14T20:43:46.5229970Z 2025-08-14T20:43:46.5230442Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.5231255Z repo = gh.get_repo(repo) 2025-08-14T20:43:46.5231785Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:46.5232153Z 2025-08-14T20:43:46.5232159Z 2025-08-14T20:43:46.5232377Z def get_potential_pr_author( 2025-08-14T20:43:46.5233044Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:46.5233748Z ) -> str: 2025-08-14T20:43:46.5234282Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:46.5235111Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:46.5235880Z # embedded in the tag name: ciflow// 2025-08-14T20:43:46.5236302Z 2025-08-14T20:43:46.5236510Z gh = get_gh_client(github_token) 2025-08-14T20:43:46.5236848Z 2025-08-14T20:43:46.5237338Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:46.5237995Z split_tag = ref_name.split("/") 2025-08-14T20:43:46.5238532Z if ( 2025-08-14T20:43:46.5238950Z len(split_tag) == 3 2025-08-14T20:43:46.5239467Z and split_tag[0] == "ciflow" 2025-08-14T20:43:46.5240013Z and split_tag[2].isnumeric() 2025-08-14T20:43:46.5240540Z ): 2025-08-14T20:43:46.5240953Z pr_number = split_tag[2] 2025-08-14T20:43:46.5241638Z try: 2025-08-14T20:43:46.5242103Z repository = gh.get_repo(repo) 2025-08-14T20:43:46.5242744Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:46.5243370Z except Exception as e: 2025-08-14T20:43:46.5243906Z raise Exception( # noqa: TRY002 2025-08-14T20:43:46.5244595Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:46.5245254Z ) from e 2025-08-14T20:43:46.5245815Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:46.5246529Z # In all other cases, return the original input username 2025-08-14T20:43:46.5247326Z return username 2025-08-14T20:43:46.5247581Z 2025-08-14T20:43:46.5247588Z 2025-08-14T20:43:46.5247832Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:46.5248394Z """ 2025-08-14T20:43:46.5249056Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:46.5249853Z """ 2025-08-14T20:43:46.5250423Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:46.5250944Z 2025-08-14T20:43:46.5250951Z 2025-08-14T20:43:46.5251172Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:46.5251683Z try: 2025-08-14T20:43:46.5252101Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:46.5252629Z return data 2025-08-14T20:43:46.5253074Z except yaml.YAMLError: 2025-08-14T20:43:46.5253574Z log.exception("Error loading YAML") 2025-08-14T20:43:46.5254114Z raise 2025-08-14T20:43:46.5254337Z 2025-08-14T20:43:46.5254344Z 2025-08-14T20:43:46.5254773Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:46.5255533Z """ 2025-08-14T20:43:46.5256177Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:46.5256786Z 2025-08-14T20:43:46.5257485Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.5258299Z and the text below is the list of opted in users. 2025-08-14T20:43:46.5258716Z 2025-08-14T20:43:46.5259105Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:46.5259831Z """ 2025-08-14T20:43:46.5260293Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:46.5260927Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:46.5261556Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:46.5262163Z else: 2025-08-14T20:43:46.5262569Z return "", rollout_state 2025-08-14T20:43:46.5262883Z 2025-08-14T20:43:46.5262891Z 2025-08-14T20:43:46.5263111Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:46.5263648Z """ 2025-08-14T20:43:46.5264202Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:46.5264865Z """ 2025-08-14T20:43:46.5265075Z 2025-08-14T20:43:46.5265082Z 2025-08-14T20:43:46.5265447Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:46.5266124Z """ 2025-08-14T20:43:46.5266859Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:46.5267733Z 2025-08-14T20:43:46.5268368Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:46.5269380Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:46.5270080Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:46.5270567Z 2025-08-14T20:43:46.5270574Z 2025-08-14T20:43:46.5270750Z """ 2025-08-14T20:43:46.5271156Z optins = UserOptins() 2025-08-14T20:43:46.5271666Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:46.5272245Z user = user.strip("\r\n\t -") 2025-08-14T20:43:46.5272810Z if not user or not user.startswith("@"): 2025-08-14T20:43:46.5273550Z # Not a valid user. Skip 2025-08-14T20:43:46.5274059Z continue 2025-08-14T20:43:46.5274320Z 2025-08-14T20:43:46.5274495Z if user: 2025-08-14T20:43:46.5274957Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:46.5275667Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:46.5276161Z 2025-08-14T20:43:46.5276351Z return optins 2025-08-14T20:43:46.5276599Z 2025-08-14T20:43:46.5276605Z 2025-08-14T20:43:46.5276910Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:46.5277755Z """ 2025-08-14T20:43:46.5278187Z Check if the experiment name is valid. 2025-08-14T20:43:46.5278738Z A valid name: 2025-08-14T20:43:46.5279398Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:46.5280352Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:46.5281118Z - Cannot contain spaces 2025-08-14T20:43:46.5281601Z """ 2025-08-14T20:43:46.5281809Z 2025-08-14T20:43:46.5282091Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:46.5282808Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:46.5283260Z 2025-08-14T20:43:46.5283440Z if valid: 2025-08-14T20:43:46.5283852Z return True 2025-08-14T20:43:46.5284097Z 2025-08-14T20:43:46.5284283Z log.error( 2025-08-14T20:43:46.5285759Z 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-08-14T20:43:46.5287857Z ) 2025-08-14T20:43:46.5288254Z return False 2025-08-14T20:43:46.5288494Z 2025-08-14T20:43:46.5288500Z 2025-08-14T20:43:46.5288836Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:46.5289473Z """ 2025-08-14T20:43:46.5290275Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:46.5291033Z """ 2025-08-14T20:43:46.5291422Z try: 2025-08-14T20:43:46.5291818Z if settings_text: 2025-08-14T20:43:46.5292582Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:46.5293409Z # for easy reading 2025-08-14T20:43:46.5294212Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:46.5295117Z # the backtick character in shell commands. 2025-08-14T20:43:46.5295744Z backtick = chr(96) # backtick character 2025-08-14T20:43:46.5296425Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:46.5297384Z settings = load_yaml(settings_text) 2025-08-14T20:43:46.5297884Z 2025-08-14T20:43:46.5298329Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:46.5299124Z experiments = {} 2025-08-14T20:43:46.5299432Z 2025-08-14T20:43:46.5299832Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:46.5300617Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:46.5301750Z # 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-08-14T20:43:46.5302812Z continue 2025-08-14T20:43:46.5303101Z 2025-08-14T20:43:46.5303308Z valid_settings = {} 2025-08-14T20:43:46.5303851Z for setting in exp_settings: 2025-08-14T20:43:46.5304443Z if setting not in Experiment._fields: 2025-08-14T20:43:46.5305021Z log.warning( 2025-08-14T20:43:46.5305747Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:46.5307088Z ) 2025-08-14T20:43:46.5307876Z else: 2025-08-14T20:43:46.5308762Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:46.5309530Z 2025-08-14T20:43:46.5309838Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:46.5310496Z return Settings(experiments) 2025-08-14T20:43:46.5311046Z 2025-08-14T20:43:46.5311356Z except Exception: 2025-08-14T20:43:46.5312176Z log.exception("Failed to parse settings") 2025-08-14T20:43:46.5312884Z 2025-08-14T20:43:46.5313195Z return Settings() 2025-08-14T20:43:46.5313653Z 2025-08-14T20:43:46.5313663Z 2025-08-14T20:43:46.5314087Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:46.5314784Z """ 2025-08-14T20:43:46.5315407Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:46.5315830Z 2025-08-14T20:43:46.5316398Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.5317905Z and the text below is the list of opted in users. 2025-08-14T20:43:46.5318617Z 2025-08-14T20:43:46.5319344Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:46.5320224Z """ 2025-08-14T20:43:46.5320800Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.5321575Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:46.5321974Z 2025-08-14T20:43:46.5321981Z 2025-08-14T20:43:46.5322238Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:46.5322821Z """ 2025-08-14T20:43:46.5323231Z Parse users from the rollout state. 2025-08-14T20:43:46.5323692Z 2025-08-14T20:43:46.5323977Z """ 2025-08-14T20:43:46.5324892Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.5325806Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:46.5326232Z 2025-08-14T20:43:46.5326241Z 2025-08-14T20:43:46.5326854Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.5328174Z """ 2025-08-14T20:43:46.5328640Z Check if a user is opted into an experiment 2025-08-14T20:43:46.5329605Z """ 2025-08-14T20:43:46.5330261Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:46.5330693Z 2025-08-14T20:43:46.5330700Z 2025-08-14T20:43:46.5331138Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.5332483Z """ 2025-08-14T20:43:46.5333277Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:46.5333938Z """ 2025-08-14T20:43:46.5334817Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:46.5336034Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:46.5336929Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:46.5337858Z return False 2025-08-14T20:43:46.5338151Z 2025-08-14T20:43:46.5338564Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:46.5339646Z log.warning( 2025-08-14T20:43:46.5341068Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:46.5342706Z ) 2025-08-14T20:43:46.5343106Z 2025-08-14T20:43:46.5343434Z return True 2025-08-14T20:43:46.5343865Z 2025-08-14T20:43:46.5343875Z 2025-08-14T20:43:46.5344244Z def get_runner_prefix( 2025-08-14T20:43:46.5345006Z rollout_state: str, 2025-08-14T20:43:46.5345811Z workflow_requestors: Iterable[str], 2025-08-14T20:43:46.5346770Z branch: str, 2025-08-14T20:43:46.5347673Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.5348382Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.5348995Z is_canary: bool = False, 2025-08-14T20:43:46.5349482Z ) -> str: 2025-08-14T20:43:46.5350115Z settings = parse_settings(rollout_state) 2025-08-14T20:43:46.5350737Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:46.5351111Z 2025-08-14T20:43:46.5351304Z fleet_prefix = "" 2025-08-14T20:43:46.5351750Z prefixes = [] 2025-08-14T20:43:46.5352390Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:46.5354429Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:46.5355507Z log.info( 2025-08-14T20:43:46.5356392Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:46.5357582Z ) 2025-08-14T20:43:46.5358124Z continue 2025-08-14T20:43:46.5358610Z 2025-08-14T20:43:46.5358836Z if opt_out_experiments: 2025-08-14T20:43:46.5359396Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:46.5360130Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:46.5361197Z log.info( 2025-08-14T20:43:46.5362856Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:46.5363999Z ) 2025-08-14T20:43:46.5364419Z continue 2025-08-14T20:43:46.5364697Z 2025-08-14T20:43:46.5364909Z if eligible_experiments: 2025-08-14T20:43:46.5365488Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:46.5366152Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:46.5366729Z log.info( 2025-08-14T20:43:46.5368158Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:46.5369703Z ) 2025-08-14T20:43:46.5370325Z continue 2025-08-14T20:43:46.5370825Z elif not experiment_settings.default: 2025-08-14T20:43:46.5371374Z log.info( 2025-08-14T20:43:46.5372203Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:46.5373130Z ) 2025-08-14T20:43:46.5373572Z continue 2025-08-14T20:43:46.5374001Z 2025-08-14T20:43:46.5374716Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:46.5375772Z opted_out_users = [ 2025-08-14T20:43:46.5376253Z requestor 2025-08-14T20:43:46.5376830Z for requestor in workflow_requestors 2025-08-14T20:43:46.5378081Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.5378738Z ] 2025-08-14T20:43:46.5378946Z 2025-08-14T20:43:46.5379139Z if opted_out_users: 2025-08-14T20:43:46.5379630Z log.info( 2025-08-14T20:43:46.5380642Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:46.5381366Z ) 2025-08-14T20:43:46.5381760Z continue 2025-08-14T20:43:46.5382036Z 2025-08-14T20:43:46.5382334Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:46.5383223Z opted_in_users = [ 2025-08-14T20:43:46.5383723Z requestor 2025-08-14T20:43:46.5384316Z for requestor in workflow_requestors 2025-08-14T20:43:46.5385145Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.5385992Z ] 2025-08-14T20:43:46.5386211Z 2025-08-14T20:43:46.5386431Z enabled = False 2025-08-14T20:43:46.5387346Z if opted_in_users: 2025-08-14T20:43:46.5388141Z log.info( 2025-08-14T20:43:46.5389204Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:46.5390444Z ) 2025-08-14T20:43:46.5391038Z enabled = True 2025-08-14T20:43:46.5391330Z 2025-08-14T20:43:46.5391626Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:46.5393125Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:46.5394888Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:46.5395583Z log.info( 2025-08-14T20:43:46.5397271Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:46.5398564Z ) 2025-08-14T20:43:46.5399019Z enabled = True 2025-08-14T20:43:46.5399332Z 2025-08-14T20:43:46.5399551Z if enabled: 2025-08-14T20:43:46.5400291Z label = experiment_name 2025-08-14T20:43:46.5401033Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:46.5401940Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:46.5403528Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:46.5404874Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:46.5405571Z if is_canary: 2025-08-14T20:43:46.5406089Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:46.5407332Z fleet_prefix = label 2025-08-14T20:43:46.5407933Z else: 2025-08-14T20:43:46.5408390Z prefixes.append(label) 2025-08-14T20:43:46.5408931Z 2025-08-14T20:43:46.5409142Z if len(prefixes) > 1: 2025-08-14T20:43:46.5409814Z log.error( 2025-08-14T20:43:46.5411101Z 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-08-14T20:43:46.5413120Z ) 2025-08-14T20:43:46.5413673Z prefixes = prefixes[:1] 2025-08-14T20:43:46.5414000Z 2025-08-14T20:43:46.5414219Z # Fleet always comes first 2025-08-14T20:43:46.5414709Z if fleet_prefix: 2025-08-14T20:43:46.5415180Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:46.5415598Z 2025-08-14T20:43:46.5416202Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:46.5417116Z 2025-08-14T20:43:46.5417127Z 2025-08-14T20:43:46.5417948Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:46.5419363Z """ 2025-08-14T20:43:46.5420388Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:46.5421417Z 2025-08-14T20:43:46.5422093Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:46.5422920Z """ 2025-08-14T20:43:46.5423339Z gh = get_gh_client(github_token) 2025-08-14T20:43:46.5424104Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:46.5425228Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:46.5425848Z 2025-08-14T20:43:46.5425858Z 2025-08-14T20:43:46.5426628Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:46.5427904Z for _ in range(num_retries): 2025-08-14T20:43:46.5428606Z try: 2025-08-14T20:43:46.5429335Z req = Request(url=url, headers=headers) 2025-08-14T20:43:46.5430328Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:46.5431106Z return json.loads(content) 2025-08-14T20:43:46.5431870Z except Exception as e: 2025-08-14T20:43:46.5432442Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:46.5432973Z 2025-08-14T20:43:46.5433664Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:46.5434955Z return {} 2025-08-14T20:43:46.5435255Z 2025-08-14T20:43:46.5435266Z 2025-08-14T20:43:46.5435507Z @cache 2025-08-14T20:43:46.5436158Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:46.5436923Z """ 2025-08-14T20:43:46.5437742Z Dynamically get PR information 2025-08-14T20:43:46.5438603Z """ 2025-08-14T20:43:46.5439531Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:46.5440634Z headers = { 2025-08-14T20:43:46.5441406Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:46.5442460Z "Authorization": f"token {github_token}", 2025-08-14T20:43:46.5443028Z } 2025-08-14T20:43:46.5443486Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:46.5444218Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:46.5445188Z headers=headers, 2025-08-14T20:43:46.5445921Z ) 2025-08-14T20:43:46.5446272Z 2025-08-14T20:43:46.5446588Z if not json_response: 2025-08-14T20:43:46.5447543Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:46.5448184Z return {} 2025-08-14T20:43:46.5448430Z 2025-08-14T20:43:46.5448636Z return json_response 2025-08-14T20:43:46.5448919Z 2025-08-14T20:43:46.5448926Z 2025-08-14T20:43:46.5449340Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:46.5450224Z """ 2025-08-14T20:43:46.5451143Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:46.5452209Z """ 2025-08-14T20:43:46.5452719Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:46.5453357Z return { 2025-08-14T20:43:46.5454254Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:46.5455243Z } 2025-08-14T20:43:46.5455472Z 2025-08-14T20:43:46.5455479Z 2025-08-14T20:43:46.5455756Z def main() -> None: 2025-08-14T20:43:46.5456244Z args = parse_args() 2025-08-14T20:43:46.5456521Z 2025-08-14T20:43:46.5456763Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:46.5457337Z 2025-08-14T20:43:46.5457558Z # Check if the PR is opt-out 2025-08-14T20:43:46.5458071Z if args.pr_number: 2025-08-14T20:43:46.5459046Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:46.5460287Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:46.5460958Z log.info( 2025-08-14T20:43:46.5462197Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:46.5463885Z ) 2025-08-14T20:43:46.5464855Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.5466071Z sys.exit() 2025-08-14T20:43:46.5466532Z 2025-08-14T20:43:46.5466822Z try: 2025-08-14T20:43:46.5467738Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:46.5469003Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:46.5469912Z ) 2025-08-14T20:43:46.5470133Z 2025-08-14T20:43:46.5470396Z username = get_potential_pr_author( 2025-08-14T20:43:46.5471303Z args.github_token, 2025-08-14T20:43:46.5471821Z args.github_repo, 2025-08-14T20:43:46.5472320Z args.github_actor, 2025-08-14T20:43:46.5472946Z args.github_ref_type, 2025-08-14T20:43:46.5473850Z args.github_branch, 2025-08-14T20:43:46.5474591Z ) 2025-08-14T20:43:46.5474813Z 2025-08-14T20:43:46.5475163Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:46.5475982Z 2025-08-14T20:43:46.5476358Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:46.5477503Z rollout_state, 2025-08-14T20:43:46.5478343Z (args.github_issue_owner, username), 2025-08-14T20:43:46.5479250Z args.github_branch, 2025-08-14T20:43:46.5479783Z args.eligible_experiments, 2025-08-14T20:43:46.5480343Z args.opt_out_experiments, 2025-08-14T20:43:46.5481043Z is_canary, 2025-08-14T20:43:46.5481756Z ) 2025-08-14T20:43:46.5482113Z 2025-08-14T20:43:46.5482446Z except Exception as e: 2025-08-14T20:43:46.5483232Z log.error( 2025-08-14T20:43:46.5484111Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:46.5485064Z ) 2025-08-14T20:43:46.5485289Z 2025-08-14T20:43:46.5485725Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.5486641Z 2025-08-14T20:43:46.5486652Z 2025-08-14T20:43:46.5487107Z if __name__ == "__main__": 2025-08-14T20:43:46.5487625Z main() 2025-08-14T20:43:46.5487844Z 2025-08-14T20:43:46.5595452Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:46.5597094Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:46.5642558Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:46.5643331Z env: 2025-08-14T20:43:46.5644255Z GITHUB_TOKEN: *** 2025-08-14T20:43:46.5644933Z ISSUE_NUMBER: 5132 2025-08-14T20:43:46.5645656Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:46.5646493Z ISSUE_OWNER: 2025-08-14T20:43:46.5647302Z CHECK_EXPERIMENTS: 2025-08-14T20:43:46.5648011Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:46.5648700Z PR_NUMBER: 2025-08-14T20:43:46.5649092Z ##[endgroup] 2025-08-14T20:43:47.1240734Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:47.5139660Z Collecting urllib3==1.26.18 2025-08-14T20:43:47.5683879Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:47.5889376Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-08-14T20:43:47.6156804Z Collecting PyGithub==2.3.0 2025-08-14T20:43:47.6243424Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:47.6819572Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:47.6887823Z 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-08-14T20:43:47.6930685Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:47.6946142Z 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-08-14T20:43:47.6960575Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:47.7248773Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:47.7328162Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:47.7554870Z 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-08-14T20:43:47.8872794Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:47.8967535Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:48.0114624Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:48.0335706Z 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-08-14T20:43:48.0581495Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:48.0649055Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:48.0913694Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:48.1054796Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.9 MB/s eta 0:00:00 2025-08-14T20:43:48.1149555Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:48.1392431Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 15.2 MB/s eta 0:00:00 2025-08-14T20:43:48.1464599Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:48.1915839Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 19.8 MB/s eta 0:00:00 2025-08-14T20:43:48.1987255Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:48.2083674Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:48.2293076Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 24.4 MB/s eta 0:00:00 2025-08-14T20:43:48.2362405Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:48.2401771Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.5 MB/s eta 0:00:00 2025-08-14T20:43:48.2468905Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:48.2525444Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 26.4 MB/s eta 0:00:00 2025-08-14T20:43:48.5308924Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:49.0557656Z 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-08-14T20:43:49.1372818Z ##[group]Run curr_branch="main" 2025-08-14T20:43:49.1373130Z curr_branch="main" 2025-08-14T20:43:49.1373356Z curr_ref_type="branch" 2025-08-14T20:43:49.1373637Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:49.1373890Z  2025-08-14T20:43:49.1374080Z python3 runner_determinator.py \ 2025-08-14T20:43:49.1374352Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:49.1374620Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:49.1374869Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:49.1375123Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:49.1375399Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:49.1375666Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:49.1375935Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:49.1376222Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:49.1376585Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:49.1376887Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:49.1418400Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:49.1418618Z env: 2025-08-14T20:43:49.1419157Z GITHUB_TOKEN: *** 2025-08-14T20:43:49.1419347Z ISSUE_NUMBER: 5132 2025-08-14T20:43:49.1419555Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:49.1419778Z ISSUE_OWNER: 2025-08-14T20:43:49.1419957Z CHECK_EXPERIMENTS: 2025-08-14T20:43:49.1420150Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:49.1420334Z PR_NUMBER: 2025-08-14T20:43:49.1420491Z ##[endgroup] 2025-08-14T20:43:49.1477685Z Current branch is 'main' 2025-08-14T20:43:50.6890414Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:50.6891271Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:50.6891725Z INFO : Setting output: label-type='' 2025-08-14T20:43:50.7199254Z Evaluate and set job outputs 2025-08-14T20:43:50.7205751Z Cleaning up orphan processes