2025-08-26T19:39:33.4336382Z Current runner version: '2.328.0' 2025-08-26T19:39:33.4359694Z ##[group]Runner Image Provisioner 2025-08-26T19:39:33.4360503Z Hosted Compute Agent 2025-08-26T19:39:33.4361207Z Version: 20250825.382 2025-08-26T19:39:33.4361933Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:39:33.4362632Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:39:33.4363225Z ##[endgroup] 2025-08-26T19:39:33.4363761Z ##[group]Operating System 2025-08-26T19:39:33.4364332Z Ubuntu 2025-08-26T19:39:33.4364804Z 24.04.2 2025-08-26T19:39:33.4365272Z LTS 2025-08-26T19:39:33.4365779Z ##[endgroup] 2025-08-26T19:39:33.4366235Z ##[group]Runner Image 2025-08-26T19:39:33.4366815Z Image: ubuntu-24.04 2025-08-26T19:39:33.4367301Z Version: 20250818.1.0 2025-08-26T19:39:33.4368294Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:39:33.4369848Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:39:33.4371155Z ##[endgroup] 2025-08-26T19:39:33.4372229Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:39:33.4374388Z Contents: read 2025-08-26T19:39:33.4374923Z Metadata: read 2025-08-26T19:39:33.4375487Z ##[endgroup] 2025-08-26T19:39:33.4377591Z Secret source: Actions 2025-08-26T19:39:33.4378263Z Prepare workflow directory 2025-08-26T19:39:33.4955603Z Prepare all required actions 2025-08-26T19:39:33.5013054Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:39:33.5018147Z ##[group] Inputs 2025-08-26T19:39:33.5018742Z check_experiments: 2025-08-26T19:39:33.5019277Z opt_out_experiments: 2025-08-26T19:39:33.5020050Z triggering_actor: pytorchmergebot 2025-08-26T19:39:33.5020659Z issue_owner: 2025-08-26T19:39:33.5021329Z curr_branch: main 2025-08-26T19:39:33.5021981Z curr_ref_type: branch 2025-08-26T19:39:33.5022595Z issue_number: 5132 2025-08-26T19:39:33.5023101Z ##[endgroup] 2025-08-26T19:39:33.5023837Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-26T19:39:34.2126190Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:39:34.2129458Z cat < runner_determinator.py 2025-08-26T19:39:34.2130261Z # flake8: noqa: G004 2025-08-26T19:39:34.2131262Z  2025-08-26T19:39:34.2132246Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:39:34.2133481Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:39:34.2134459Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:39:34.2135210Z  2025-08-26T19:39:34.2135753Z """ 2025-08-26T19:39:34.2136481Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:39:34.2137531Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:39:34.2138785Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:39:34.2139787Z of which runners should be used to run which job. 2025-08-26T19:39:34.2140491Z  2025-08-26T19:39:34.2141552Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:39:34.2142650Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:39:34.2143698Z settings are considered to be empty with only the second part, the user 2025-08-26T19:39:34.2144680Z list, defined. 2025-08-26T19:39:34.2145187Z  2025-08-26T19:39:34.2145886Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:39:34.2147024Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:39:34.2148057Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:39:34.2148798Z  2025-08-26T19:39:34.2149907Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:39:34.2151173Z The user list is also a comma separated list of additional features or 2025-08-26T19:39:34.2152084Z experiments which the user could be opted in to. 2025-08-26T19:39:34.2152860Z  2025-08-26T19:39:34.2153392Z The user list has the following rules: 2025-08-26T19:39:34.2154012Z  2025-08-26T19:39:34.2154812Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:39:34.2155833Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:39:34.2156775Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:39:34.2157477Z  2025-08-26T19:39:34.2157990Z Example config: 2025-08-26T19:39:34.2158636Z  # A list of experiments that can be opted into. 2025-08-26T19:39:34.2159517Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:39:34.2160326Z  # Expected syntax is: 2025-08-26T19:39:34.2161250Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:39:34.2162464Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:39:34.2163383Z  2025-08-26T19:39:34.2163832Z  experiments: 2025-08-26T19:39:34.2250274Z  lf: 2025-08-26T19:39:34.2251202Z  rollout_percent: 25 2025-08-26T19:39:34.2251776Z  all_branches: false 2025-08-26T19:39:34.2252321Z  default: true 2025-08-26T19:39:34.2252795Z  --- 2025-08-26T19:39:34.2253200Z  2025-08-26T19:39:34.2253580Z  # Opt-ins: 2025-08-26T19:39:34.2254264Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:39:34.2255555Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:39:34.2256437Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:39:34.2257184Z  # Experiments should be from the above list. 2025-08-26T19:39:34.2257769Z  2025-08-26T19:39:34.2258184Z  @User1,-lf,split_build 2025-08-26T19:39:34.2258699Z  @User2,lf 2025-08-26T19:39:34.2259168Z  @User3,split_build 2025-08-26T19:39:34.2259652Z """ 2025-08-26T19:39:34.2260048Z  2025-08-26T19:39:34.2260430Z import json 2025-08-26T19:39:34.2260993Z import logging 2025-08-26T19:39:34.2261451Z import os 2025-08-26T19:39:34.2261879Z import random 2025-08-26T19:39:34.2262316Z import re 2025-08-26T19:39:34.2262731Z import sys 2025-08-26T19:39:34.2263206Z from argparse import ArgumentParser 2025-08-26T19:39:34.2263897Z from collections.abc import Iterable 2025-08-26T19:39:34.2264488Z from functools import cache 2025-08-26T19:39:34.2265035Z from logging import LogRecord 2025-08-26T19:39:34.2265603Z from typing import Any, NamedTuple 2025-08-26T19:39:34.2266222Z from urllib.request import Request, urlopen 2025-08-26T19:39:34.2266798Z  2025-08-26T19:39:34.2267190Z import yaml 2025-08-26T19:39:34.2267657Z from github import Auth, Github 2025-08-26T19:39:34.2268224Z from github.Issue import Issue 2025-08-26T19:39:34.2268747Z  2025-08-26T19:39:34.2269115Z  2025-08-26T19:39:34.2269593Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:39:34.2270419Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:39:34.2271683Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:39:34.2272445Z  2025-08-26T19:39:34.2273146Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:39:34.2273787Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:39:34.2274396Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:39:34.2275050Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:39:34.2275609Z  2025-08-26T19:39:34.2276046Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:39:34.2276585Z  2025-08-26T19:39:34.2276991Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:39:34.2277530Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:39:34.2278037Z  2025-08-26T19:39:34.2278416Z  2025-08-26T19:39:34.2278827Z class Experiment(NamedTuple): 2025-08-26T19:39:34.2279386Z  rollout_perc: float = ( 2025-08-26T19:39:34.2280134Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:39:34.2280992Z  ) 2025-08-26T19:39:34.2281426Z  all_branches: bool = ( 2025-08-26T19:39:34.2282173Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:39:34.2282912Z  ) 2025-08-26T19:39:34.2283335Z  default: bool = ( 2025-08-26T19:39:34.2284005Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:39:34.2284694Z  ) 2025-08-26T19:39:34.2285083Z  2025-08-26T19:39:34.2285484Z  # Add more fields as needed 2025-08-26T19:39:34.2286007Z  2025-08-26T19:39:34.2286373Z  2025-08-26T19:39:34.2286780Z class Settings(NamedTuple): 2025-08-26T19:39:34.2287297Z  """ 2025-08-26T19:39:34.2287834Z  Settings for the experiments that can be opted into. 2025-08-26T19:39:34.2288459Z  """ 2025-08-26T19:39:34.2288847Z  2025-08-26T19:39:34.2289290Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:39:34.2289858Z  2025-08-26T19:39:34.2290412Z  2025-08-26T19:39:34.2291110Z class ColorFormatter(logging.Formatter): 2025-08-26T19:39:34.2291877Z  """Color codes the log messages based on the log level""" 2025-08-26T19:39:34.2292515Z  2025-08-26T19:39:34.2292891Z  COLORS = { 2025-08-26T19:39:34.2293372Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:39:34.2293934Z  "ERROR": "\033[31m", # Red 2025-08-26T19:39:34.2294507Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:39:34.2295072Z  "INFO": "\033[0m", # Reset 2025-08-26T19:39:34.2295630Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:39:34.2296156Z  } 2025-08-26T19:39:34.2296550Z  2025-08-26T19:39:34.2297022Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:39:34.2297846Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:39:34.2298715Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:39:34.2299354Z  return super().format(record) 2025-08-26T19:39:34.2299893Z  2025-08-26T19:39:34.2300257Z  2025-08-26T19:39:34.2300674Z handler = logging.StreamHandler() 2025-08-26T19:39:34.2301607Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:39:34.2302384Z  2025-08-26T19:39:34.2302896Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:39:34.2303538Z log.addHandler(handler) 2025-08-26T19:39:34.2304061Z log.setLevel(logging.INFO) 2025-08-26T19:39:34.2304559Z  2025-08-26T19:39:34.2304935Z  2025-08-26T19:39:34.2305429Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:39:34.2306047Z  """ 2025-08-26T19:39:34.2306633Z  Defines outputs of the github action that invokes this script 2025-08-26T19:39:34.2307469Z  """ 2025-08-26T19:39:34.2307906Z  if not GITHUB_OUTPUT: 2025-08-26T19:39:34.2309059Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:39:34.2310250Z  log.warning( 2025-08-26T19:39:34.2311602Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:39:34.2312579Z  ) 2025-08-26T19:39:34.2313085Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:39:34.2313672Z  return 2025-08-26T19:39:34.2314105Z  2025-08-26T19:39:34.2314534Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:39:34.2315185Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:39:34.2315818Z  f.write(f"{key}={value}\n") 2025-08-26T19:39:34.2316348Z  2025-08-26T19:39:34.2316726Z  2025-08-26T19:39:34.2317286Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:39:34.2318004Z  return frozenset( 2025-08-26T19:39:34.2318711Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:39:34.2319451Z  ) 2025-08-26T19:39:34.2319850Z  2025-08-26T19:39:34.2320233Z  2025-08-26T19:39:34.2320635Z def parse_args() -> Any: 2025-08-26T19:39:34.2321584Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:39:34.2322554Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:39:34.2323385Z  parser.add_argument( 2025-08-26T19:39:34.2323924Z  "--github-issue-repo", 2025-08-26T19:39:34.2324463Z  type=str, 2025-08-26T19:39:34.2324967Z  required=False, 2025-08-26T19:39:34.2325659Z  default="pytorch/test-infra", 2025-08-26T19:39:34.2326297Z  help="GitHub repo to get the issue", 2025-08-26T19:39:34.2326867Z  ) 2025-08-26T19:39:34.2327291Z  parser.add_argument( 2025-08-26T19:39:34.2327812Z  "--github-repo", 2025-08-26T19:39:34.2328320Z  type=str, 2025-08-26T19:39:34.2328806Z  required=True, 2025-08-26T19:39:34.2329357Z  help="GitHub repo where CI is running", 2025-08-26T19:39:34.2329934Z  ) 2025-08-26T19:39:34.2330365Z  parser.add_argument( 2025-08-26T19:39:34.2331426Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:39:34.2332174Z  ) 2025-08-26T19:39:34.2332610Z  parser.add_argument( 2025-08-26T19:39:34.2333339Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:39:34.2334089Z  ) 2025-08-26T19:39:34.2334522Z  parser.add_argument( 2025-08-26T19:39:34.2335265Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:39:34.2336003Z  ) 2025-08-26T19:39:34.2336438Z  parser.add_argument( 2025-08-26T19:39:34.2337205Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:39:34.2337978Z  ) 2025-08-26T19:39:34.2338427Z  parser.add_argument( 2025-08-26T19:39:34.2338971Z  "--github-ref-type", 2025-08-26T19:39:34.2339503Z  type=str, 2025-08-26T19:39:34.2339995Z  required=True, 2025-08-26T19:39:34.2340597Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:39:34.2341395Z  ) 2025-08-26T19:39:34.2341829Z  parser.add_argument( 2025-08-26T19:39:34.2342666Z  "--eligible-experiments", 2025-08-26T19:39:34.2343277Z  type=_str_comma_separated_to_set, 2025-08-26T19:39:34.2343868Z  required=False, 2025-08-26T19:39:34.2344372Z  default="", 2025-08-26T19:39:34.2345338Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:39:34.2346331Z  ) 2025-08-26T19:39:34.2346759Z  parser.add_argument( 2025-08-26T19:39:34.2347305Z  "--opt-out-experiments", 2025-08-26T19:39:34.2347896Z  type=_str_comma_separated_to_set, 2025-08-26T19:39:34.2348476Z  required=False, 2025-08-26T19:39:34.2348969Z  default="", 2025-08-26T19:39:34.2349448Z  help=( 2025-08-26T19:39:34.2350209Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:39:34.2351568Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:39:34.2352467Z  ), 2025-08-26T19:39:34.2352884Z  ) 2025-08-26T19:39:34.2353311Z  parser.add_argument( 2025-08-26T19:39:34.2353833Z  "--pr-number", 2025-08-26T19:39:34.2354327Z  type=str, 2025-08-26T19:39:34.2354813Z  required=False, 2025-08-26T19:39:34.2355322Z  default="", 2025-08-26T19:39:34.2355900Z  help="the optional PR number where this is run", 2025-08-26T19:39:34.2356503Z  ) 2025-08-26T19:39:34.2356906Z  2025-08-26T19:39:34.2357324Z  return parser.parse_args() 2025-08-26T19:39:34.2357852Z  2025-08-26T19:39:34.2358218Z  2025-08-26T19:39:34.2358887Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:39:34.2359858Z  auth = Auth.Token(github_token) 2025-08-26T19:39:34.2360468Z  return Github(auth=auth) 2025-08-26T19:39:34.2361089Z  2025-08-26T19:39:34.2361468Z  2025-08-26T19:39:34.2362191Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:39:34.2363058Z  repo = gh.get_repo(repo) 2025-08-26T19:39:34.2363659Z  return repo.get_issue(number=issue_num) 2025-08-26T19:39:34.2364237Z  2025-08-26T19:39:34.2364609Z  2025-08-26T19:39:34.2365016Z def get_potential_pr_author( 2025-08-26T19:39:34.2365750Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:39:34.2366486Z ) -> str: 2025-08-26T19:39:34.2367084Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:39:34.2367980Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:39:34.2368826Z  # embedded in the tag name: ciflow// 2025-08-26T19:39:34.2369447Z  2025-08-26T19:39:34.2369920Z  gh = get_gh_client(github_token) 2025-08-26T19:39:34.2370464Z  2025-08-26T19:39:34.2371087Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:39:34.2371792Z  split_tag = ref_name.split("/") 2025-08-26T19:39:34.2372359Z  if ( 2025-08-26T19:39:34.2372827Z  len(split_tag) == 3 2025-08-26T19:39:34.2373398Z  and split_tag[0] == "ciflow" 2025-08-26T19:39:34.2373998Z  and split_tag[2].isnumeric() 2025-08-26T19:39:34.2374547Z  ): 2025-08-26T19:39:34.2375019Z  pr_number = split_tag[2] 2025-08-26T19:39:34.2375574Z  try: 2025-08-26T19:39:34.2376094Z  repository = gh.get_repo(repo) 2025-08-26T19:39:34.2376933Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:39:34.2377617Z  except Exception as e: 2025-08-26T19:39:34.2378222Z  raise Exception( # noqa: TRY002 2025-08-26T19:39:34.2378962Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:39:34.2379677Z  ) from e 2025-08-26T19:39:34.2380311Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:39:34.2381203Z  # In all other cases, return the original input username 2025-08-26T19:39:34.2381867Z  return username 2025-08-26T19:39:34.2382342Z  2025-08-26T19:39:34.2382717Z  2025-08-26T19:39:34.2383187Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:39:34.2383784Z  """ 2025-08-26T19:39:34.2384511Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:39:34.2385375Z  """ 2025-08-26T19:39:34.2386002Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:39:34.2386727Z  2025-08-26T19:39:34.2387107Z  2025-08-26T19:39:34.2387549Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:39:34.2388107Z  try: 2025-08-26T19:39:34.2388571Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:39:34.2389143Z  return data 2025-08-26T19:39:34.2389646Z  except yaml.YAMLError: 2025-08-26T19:39:34.2390224Z  log.exception("Error loading YAML") 2025-08-26T19:39:34.2390899Z  raise 2025-08-26T19:39:34.2391339Z  2025-08-26T19:39:34.2391721Z  2025-08-26T19:39:34.2392404Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:39:34.2393212Z  """ 2025-08-26T19:39:34.2394044Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:39:34.2394862Z  2025-08-26T19:39:34.2395462Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:39:34.2396314Z  and the text below is the list of opted in users. 2025-08-26T19:39:34.2396927Z  2025-08-26T19:39:34.2397556Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:39:34.2398316Z  """ 2025-08-26T19:39:34.2398839Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:39:34.2399511Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:39:34.2400206Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:39:34.2400954Z  else: 2025-08-26T19:39:34.2401417Z  return "", rollout_state 2025-08-26T19:39:34.2402154Z  2025-08-26T19:39:34.2402579Z  2025-08-26T19:39:34.2403023Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:39:34.2403591Z  """ 2025-08-26T19:39:34.2404187Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:39:34.2404887Z  """ 2025-08-26T19:39:34.2405286Z  2025-08-26T19:39:34.2405654Z  2025-08-26T19:39:34.2406248Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:39:34.2406960Z  """ 2025-08-26T19:39:34.2407754Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:39:34.2408639Z  2025-08-26T19:39:34.2409505Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:39:34.2410567Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:39:34.2411577Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:39:34.2412268Z  2025-08-26T19:39:34.2412631Z  2025-08-26T19:39:34.2412999Z  """ 2025-08-26T19:39:34.2413419Z  optins = UserOptins() 2025-08-26T19:39:34.2414007Z  for user in user_optin_text.split("\n"): 2025-08-26T19:39:34.2414635Z  user = user.strip("\r\n\t -") 2025-08-26T19:39:34.2415251Z  if not user or not user.startswith("@"): 2025-08-26T19:39:34.2415875Z  # Not a valid user. Skip 2025-08-26T19:39:34.2416420Z  continue 2025-08-26T19:39:34.2416879Z  2025-08-26T19:39:34.2417258Z  if user: 2025-08-26T19:39:34.2417821Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:39:34.2418584Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:39:34.2419278Z  2025-08-26T19:39:34.2419673Z  return optins 2025-08-26T19:39:34.2420132Z  2025-08-26T19:39:34.2420503Z  2025-08-26T19:39:34.2421138Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:39:34.2421811Z  """ 2025-08-26T19:39:34.2422276Z  Check if the experiment name is valid. 2025-08-26T19:39:34.2422861Z  A valid name: 2025-08-26T19:39:34.2423596Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:39:34.2424612Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:39:34.2425385Z  - Cannot contain spaces 2025-08-26T19:39:34.2425897Z  """ 2025-08-26T19:39:34.2426296Z  2025-08-26T19:39:34.2426796Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:39:34.2427574Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:39:34.2428353Z  2025-08-26T19:39:34.2428733Z  if valid: 2025-08-26T19:39:34.2429186Z  return True 2025-08-26T19:39:34.2429633Z  2025-08-26T19:39:34.2430011Z  log.error( 2025-08-26T19:39:34.2431662Z  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-26T19:39:34.2433307Z  ) 2025-08-26T19:39:34.2433720Z  return False 2025-08-26T19:39:34.2434161Z  2025-08-26T19:39:34.2434539Z  2025-08-26T19:39:34.2435100Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:39:34.2435795Z  """ 2025-08-26T19:39:34.2436462Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:39:34.2437240Z  """ 2025-08-26T19:39:34.2437639Z  try: 2025-08-26T19:39:34.2438067Z  if settings_text: 2025-08-26T19:39:34.2438889Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:39:34.2439735Z  # for easy reading 2025-08-26T19:39:34.2440624Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:39:34.2441721Z  # the backtick character in shell commands. 2025-08-26T19:39:34.2442406Z  backtick = chr(96) # backtick character 2025-08-26T19:39:34.2443151Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:39:34.2443879Z  settings = load_yaml(settings_text) 2025-08-26T19:39:34.2444442Z  2025-08-26T19:39:34.2445090Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:39:34.2446024Z  experiments = {} 2025-08-26T19:39:34.2446531Z  2025-08-26T19:39:34.2447142Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:39:34.2447973Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:39:34.2449151Z  # 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-26T19:39:34.2450258Z  continue 2025-08-26T19:39:34.2450879Z  2025-08-26T19:39:34.2451306Z  valid_settings = {} 2025-08-26T19:39:34.2451908Z  for setting in exp_settings: 2025-08-26T19:39:34.2452540Z  if setting not in Experiment._fields: 2025-08-26T19:39:34.2453167Z  log.warning( 2025-08-26T19:39:34.2453955Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:39:34.2454721Z  ) 2025-08-26T19:39:34.2455206Z  else: 2025-08-26T19:39:34.2455807Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:39:34.2456427Z  2025-08-26T19:39:34.2456942Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:39:34.2457645Z  return Settings(experiments) 2025-08-26T19:39:34.2458188Z  2025-08-26T19:39:34.2458585Z  except Exception: 2025-08-26T19:39:34.2459148Z  log.exception("Failed to parse settings") 2025-08-26T19:39:34.2459724Z  2025-08-26T19:39:34.2460115Z  return Settings() 2025-08-26T19:39:34.2460583Z  2025-08-26T19:39:34.2461169Z  2025-08-26T19:39:34.2461874Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:39:34.2462522Z  """ 2025-08-26T19:39:34.2463029Z  Parse settings, if any, from the rollout state. 2025-08-26T19:39:34.2463629Z  2025-08-26T19:39:34.2464226Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:39:34.2465065Z  and the text below is the list of opted in users. 2025-08-26T19:39:34.2465676Z  2025-08-26T19:39:34.2466326Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:39:34.2467100Z  """ 2025-08-26T19:39:34.2467725Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:39:34.2468563Z  return parse_settings_from_text(settings_text) 2025-08-26T19:39:34.2469188Z  2025-08-26T19:39:34.2469571Z  2025-08-26T19:39:34.2470118Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:39:34.2470911Z  """ 2025-08-26T19:39:34.2471471Z  Parse users from the rollout state. 2025-08-26T19:39:34.2472028Z  2025-08-26T19:39:34.2472403Z  """ 2025-08-26T19:39:34.2473011Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:39:34.2473829Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:39:34.2474422Z  2025-08-26T19:39:34.2474785Z  2025-08-26T19:39:34.2475461Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:39:34.2476264Z  """ 2025-08-26T19:39:34.2476756Z  Check if a user is opted into an experiment 2025-08-26T19:39:34.2477336Z  """ 2025-08-26T19:39:34.2477871Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:39:34.2478486Z  2025-08-26T19:39:34.2479003Z  2025-08-26T19:39:34.2479706Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:39:34.2480512Z  """ 2025-08-26T19:39:34.2481312Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:39:34.2481946Z  """ 2025-08-26T19:39:34.2482525Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:39:34.2483283Z  experiment_optout = "-" + experiment_name 2025-08-26T19:39:34.2483992Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:39:34.2484657Z  return False 2025-08-26T19:39:34.2485112Z  2025-08-26T19:39:34.2485627Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:39:34.2486277Z  log.warning( 2025-08-26T19:39:34.2487196Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:39:34.2488119Z  ) 2025-08-26T19:39:34.2488530Z  2025-08-26T19:39:34.2488913Z  return True 2025-08-26T19:39:34.2489349Z  2025-08-26T19:39:34.2489717Z  2025-08-26T19:39:34.2490107Z def get_runner_prefix( 2025-08-26T19:39:34.2490616Z  rollout_state: str, 2025-08-26T19:39:34.2491268Z  workflow_requestors: Iterable[str], 2025-08-26T19:39:34.2491838Z  branch: str, 2025-08-26T19:39:34.2492419Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:39:34.2493159Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:39:34.2493796Z  is_canary: bool = False, 2025-08-26T19:39:34.2494316Z ) -> str: 2025-08-26T19:39:34.2494829Z  settings = parse_settings(rollout_state) 2025-08-26T19:39:34.2495475Z  user_optins = parse_users(rollout_state) 2025-08-26T19:39:34.2496046Z  2025-08-26T19:39:34.2496567Z  fleet_prefix = "" 2025-08-26T19:39:34.2497094Z  prefixes = [] 2025-08-26T19:39:34.2497811Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:39:34.2498830Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:39:34.2499593Z  log.info( 2025-08-26T19:39:34.2500348Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:39:34.2501259Z  ) 2025-08-26T19:39:34.2501715Z  continue 2025-08-26T19:39:34.2502175Z  2025-08-26T19:39:34.2502587Z  if opt_out_experiments: 2025-08-26T19:39:34.2503203Z  if experiment_name in opt_out_experiments: 2025-08-26T19:39:34.2503931Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:39:34.2504583Z  log.info( 2025-08-26T19:39:34.2505600Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:39:34.2506624Z  ) 2025-08-26T19:39:34.2507089Z  continue 2025-08-26T19:39:34.2507616Z  2025-08-26T19:39:34.2508034Z  if eligible_experiments: 2025-08-26T19:39:34.2508678Z  if experiment_name not in eligible_experiments: 2025-08-26T19:39:34.2509379Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:39:34.2509987Z  log.info( 2025-08-26T19:39:34.2510953Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:39:34.2511843Z  ) 2025-08-26T19:39:34.2512441Z  continue 2025-08-26T19:39:34.2513015Z  elif not experiment_settings.default: 2025-08-26T19:39:34.2513593Z  log.info( 2025-08-26T19:39:34.2514336Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:39:34.2515126Z  ) 2025-08-26T19:39:34.2515569Z  continue 2025-08-26T19:39:34.2516023Z  2025-08-26T19:39:34.2516549Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:39:34.2517214Z  opted_out_users = [ 2025-08-26T19:39:34.2517739Z  requestor 2025-08-26T19:39:34.2518277Z  for requestor in workflow_requestors 2025-08-26T19:39:34.2519024Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:39:34.2519698Z  ] 2025-08-26T19:39:34.2520111Z  2025-08-26T19:39:34.2520520Z  if opted_out_users: 2025-08-26T19:39:34.2521173Z  log.info( 2025-08-26T19:39:34.2521899Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:39:34.2522639Z  ) 2025-08-26T19:39:34.2523084Z  continue 2025-08-26T19:39:34.2523537Z  2025-08-26T19:39:34.2524055Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:39:34.2524719Z  opted_in_users = [ 2025-08-26T19:39:34.2525252Z  requestor 2025-08-26T19:39:34.2525812Z  for requestor in workflow_requestors 2025-08-26T19:39:34.2526554Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:39:34.2527234Z  ] 2025-08-26T19:39:34.2527643Z  2025-08-26T19:39:34.2528040Z  enabled = False 2025-08-26T19:39:34.2528567Z  if opted_in_users: 2025-08-26T19:39:34.2529233Z  log.info( 2025-08-26T19:39:34.2529945Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:39:34.2530676Z  ) 2025-08-26T19:39:34.2531236Z  enabled = True 2025-08-26T19:39:34.2531725Z  2025-08-26T19:39:34.2532185Z  elif experiment_settings.rollout_perc: 2025-08-26T19:39:34.2533098Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:39:34.2534124Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:39:34.2534835Z  log.info( 2025-08-26T19:39:34.2535790Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:39:34.2536774Z  ) 2025-08-26T19:39:34.2537263Z  enabled = True 2025-08-26T19:39:34.2537777Z  2025-08-26T19:39:34.2538169Z  if enabled: 2025-08-26T19:39:34.2538679Z  label = experiment_name 2025-08-26T19:39:34.2539311Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:39:34.2540203Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:39:34.2541269Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:39:34.2542108Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:39:34.2542825Z  if is_canary: 2025-08-26T19:39:34.2543410Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:39:34.2544016Z  fleet_prefix = label 2025-08-26T19:39:34.2544575Z  else: 2025-08-26T19:39:34.2545223Z  prefixes.append(label) 2025-08-26T19:39:34.2545779Z  2025-08-26T19:39:34.2546180Z  if len(prefixes) > 1: 2025-08-26T19:39:34.2546695Z  log.error( 2025-08-26T19:39:34.2547840Z  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-26T19:39:34.2549018Z  ) 2025-08-26T19:39:34.2549472Z  prefixes = prefixes[:1] 2025-08-26T19:39:34.2549993Z  2025-08-26T19:39:34.2550404Z  # Fleet always comes first 2025-08-26T19:39:34.2551049Z  if fleet_prefix: 2025-08-26T19:39:34.2551585Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:39:34.2552142Z  2025-08-26T19:39:34.2552635Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:39:34.2553248Z  2025-08-26T19:39:34.2553625Z  2025-08-26T19:39:34.2554324Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:39:34.2555150Z  """ 2025-08-26T19:39:34.2555813Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:39:34.2556568Z  2025-08-26T19:39:34.2557189Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:39:34.2557945Z  """ 2025-08-26T19:39:34.2558406Z  gh = get_gh_client(github_token) 2025-08-26T19:39:34.2559023Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:39:34.2559735Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:39:34.2560385Z  2025-08-26T19:39:34.2560851Z  2025-08-26T19:39:34.2561505Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:39:34.2562463Z  for _ in range(num_retries): 2025-08-26T19:39:34.2563010Z  try: 2025-08-26T19:39:34.2563516Z  req = Request(url=url, headers=headers) 2025-08-26T19:39:34.2564241Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:39:34.2564961Z  return json.loads(content) 2025-08-26T19:39:34.2565555Z  except Exception as e: 2025-08-26T19:39:34.2566186Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:39:34.2566792Z  2025-08-26T19:39:34.2567415Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:39:34.2568181Z  return {} 2025-08-26T19:39:34.2568604Z  2025-08-26T19:39:34.2568975Z  2025-08-26T19:39:34.2569345Z @cache 2025-08-26T19:39:34.2570088Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:39:34.2571013Z  """ 2025-08-26T19:39:34.2571466Z  Dynamically get PR information 2025-08-26T19:39:34.2572007Z  """ 2025-08-26T19:39:34.2572571Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:39:34.2573253Z  headers = { 2025-08-26T19:39:34.2573790Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:39:34.2574470Z  "Authorization": f"token {github_token}", 2025-08-26T19:39:34.2575053Z  } 2025-08-26T19:39:34.2575548Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:39:34.2576219Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:39:34.2576809Z  headers=headers, 2025-08-26T19:39:34.2577298Z  ) 2025-08-26T19:39:34.2577689Z  2025-08-26T19:39:34.2578091Z  if not json_response: 2025-08-26T19:39:34.2578750Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:39:34.2579592Z  return {} 2025-08-26T19:39:34.2580064Z  2025-08-26T19:39:34.2580454Z  return json_response 2025-08-26T19:39:34.2581060Z  2025-08-26T19:39:34.2581429Z  2025-08-26T19:39:34.2582067Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:39:34.2582850Z  """ 2025-08-26T19:39:34.2583460Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:39:34.2584156Z  """ 2025-08-26T19:39:34.2584711Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:39:34.2585370Z  return { 2025-08-26T19:39:34.2586019Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:39:34.2586755Z  } 2025-08-26T19:39:34.2587144Z  2025-08-26T19:39:34.2587520Z  2025-08-26T19:39:34.2587912Z def main() -> None: 2025-08-26T19:39:34.2588423Z  args = parse_args() 2025-08-26T19:39:34.2588920Z  2025-08-26T19:39:34.2589382Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:39:34.2589969Z  2025-08-26T19:39:34.2590402Z  # Check if the PR is opt-out 2025-08-26T19:39:34.2591056Z  if args.pr_number: 2025-08-26T19:39:34.2591809Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:39:34.2592634Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:39:34.2593193Z  log.info( 2025-08-26T19:39:34.2593975Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:39:34.2594789Z  ) 2025-08-26T19:39:34.2595435Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:39:34.2596179Z  sys.exit() 2025-08-26T19:39:34.2596767Z  2025-08-26T19:39:34.2597158Z  try: 2025-08-26T19:39:34.2597660Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:39:34.2598448Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:39:34.2599135Z  ) 2025-08-26T19:39:34.2599542Z  2025-08-26T19:39:34.2599977Z  username = get_potential_pr_author( 2025-08-26T19:39:34.2600563Z  args.github_token, 2025-08-26T19:39:34.2601234Z  args.github_repo, 2025-08-26T19:39:34.2601778Z  args.github_actor, 2025-08-26T19:39:34.2602337Z  args.github_ref_type, 2025-08-26T19:39:34.2602905Z  args.github_branch, 2025-08-26T19:39:34.2603422Z  ) 2025-08-26T19:39:34.2603827Z  2025-08-26T19:39:34.2604362Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:39:34.2605019Z  2025-08-26T19:39:34.2605480Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:39:34.2606093Z  rollout_state, 2025-08-26T19:39:34.2606660Z  (args.github_issue_owner, username), 2025-08-26T19:39:34.2607269Z  args.github_branch, 2025-08-26T19:39:34.2607851Z  args.eligible_experiments, 2025-08-26T19:39:34.2608449Z  args.opt_out_experiments, 2025-08-26T19:39:34.2609015Z  is_canary, 2025-08-26T19:39:34.2609486Z  ) 2025-08-26T19:39:34.2609893Z  2025-08-26T19:39:34.2610293Z  except Exception as e: 2025-08-26T19:39:34.2610917Z  log.error( 2025-08-26T19:39:34.2611695Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:39:34.2612636Z  ) 2025-08-26T19:39:34.2613056Z  2025-08-26T19:39:34.2613627Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:39:34.2614335Z  2025-08-26T19:39:34.2614697Z  2025-08-26T19:39:34.2615096Z if __name__ == "__main__": 2025-08-26T19:39:34.2615596Z  main() 2025-08-26T19:39:34.2616027Z  2025-08-26T19:39:34.2616395Z EOF 2025-08-26T19:39:34.2616784Z  2025-08-26T19:39:34.2617194Z cat runner_determinator.py 2025-08-26T19:39:34.2889614Z shell: /usr/bin/bash -e {0} 2025-08-26T19:39:34.2890449Z env: 2025-08-26T19:39:34.2891416Z GITHUB_TOKEN: *** 2025-08-26T19:39:34.2891886Z ISSUE_NUMBER: 5132 2025-08-26T19:39:34.2892384Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:39:34.2892915Z ISSUE_OWNER: 2025-08-26T19:39:34.2893336Z CHECK_EXPERIMENTS: 2025-08-26T19:39:34.2893780Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:39:34.2894229Z PR_NUMBER: 2025-08-26T19:39:34.2894645Z ##[endgroup] 2025-08-26T19:39:34.3112189Z # flake8: noqa: G004 2025-08-26T19:39:34.3112553Z 2025-08-26T19:39:34.3112992Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:39:34.3113952Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:39:34.3114766Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:39:34.3115217Z 2025-08-26T19:39:34.3115379Z """ 2025-08-26T19:39:34.3115962Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:39:34.3116837Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:39:34.3117743Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:39:34.3118549Z of which runners should be used to run which job. 2025-08-26T19:39:34.3118953Z 2025-08-26T19:39:34.3119343Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:39:34.3120449Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:39:34.3121667Z settings are considered to be empty with only the second part, the user 2025-08-26T19:39:34.3122382Z list, defined. 2025-08-26T19:39:34.3122618Z 2025-08-26T19:39:34.3122989Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:39:34.3123938Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:39:34.3124779Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:39:34.3125227Z 2025-08-26T19:39:34.3125598Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:39:34.3126469Z The user list is also a comma separated list of additional features or 2025-08-26T19:39:34.3127205Z experiments which the user could be opted in to. 2025-08-26T19:39:34.3127614Z 2025-08-26T19:39:34.3127823Z The user list has the following rules: 2025-08-26T19:39:34.3128173Z 2025-08-26T19:39:34.3128502Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:39:34.3129368Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:39:34.3130142Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:39:34.3130546Z 2025-08-26T19:39:34.3130869Z Example config: 2025-08-26T19:39:34.3131452Z # A list of experiments that can be opted into. 2025-08-26T19:39:34.3132123Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:39:34.3132748Z # Expected syntax is: 2025-08-26T19:39:34.3133391Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:39:34.3134369Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:39:34.3134978Z 2025-08-26T19:39:34.3135154Z experiments: 2025-08-26T19:39:34.3135545Z lf: 2025-08-26T19:39:34.3135928Z rollout_percent: 25 2025-08-26T19:39:34.3136589Z all_branches: false 2025-08-26T19:39:34.3137056Z default: true 2025-08-26T19:39:34.3137510Z --- 2025-08-26T19:39:34.3137718Z 2025-08-26T19:39:34.3137885Z # Opt-ins: 2025-08-26T19:39:34.3138467Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:39:34.3139359Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:39:34.3140141Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:39:34.3141437Z # Experiments should be from the above list. 2025-08-26T19:39:34.3141860Z 2025-08-26T19:39:34.3142058Z @User1,-lf,split_build 2025-08-26T19:39:34.3142504Z @User2,lf 2025-08-26T19:39:34.3142895Z @User3,split_build 2025-08-26T19:39:34.3143309Z """ 2025-08-26T19:39:34.3143510Z 2025-08-26T19:39:34.3143674Z import json 2025-08-26T19:39:34.3144051Z import logging 2025-08-26T19:39:34.3144439Z import os 2025-08-26T19:39:34.3144798Z import random 2025-08-26T19:39:34.3145183Z import re 2025-08-26T19:39:34.3145557Z import sys 2025-08-26T19:39:34.3145962Z from argparse import ArgumentParser 2025-08-26T19:39:34.3146502Z from collections.abc import Iterable 2025-08-26T19:39:34.3147027Z from functools import cache 2025-08-26T19:39:34.3147510Z from logging import LogRecord 2025-08-26T19:39:34.3147999Z from typing import Any, NamedTuple 2025-08-26T19:39:34.3148577Z from urllib.request import Request, urlopen 2025-08-26T19:39:34.3148953Z 2025-08-26T19:39:34.3149120Z import yaml 2025-08-26T19:39:34.3149519Z from github import Auth, Github 2025-08-26T19:39:34.3150014Z from github.Issue import Issue 2025-08-26T19:39:34.3150331Z 2025-08-26T19:39:34.3150338Z 2025-08-26T19:39:34.3150563Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:39:34.3151536Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:39:34.3152421Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:39:34.3152978Z 2025-08-26T19:39:34.3153212Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:39:34.3153951Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:39:34.3154481Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:39:34.3155023Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:39:34.3155386Z 2025-08-26T19:39:34.3155586Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:39:34.3155918Z 2025-08-26T19:39:34.3156107Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:39:34.3156562Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:39:34.3156860Z 2025-08-26T19:39:34.3156867Z 2025-08-26T19:39:34.3157060Z class Experiment(NamedTuple): 2025-08-26T19:39:34.3157545Z rollout_perc: float = ( 2025-08-26T19:39:34.3158203Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:39:34.3158882Z ) 2025-08-26T19:39:34.3159264Z all_branches: bool = ( 2025-08-26T19:39:34.3159894Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:39:34.3160565Z ) 2025-08-26T19:39:34.3161179Z default: bool = ( 2025-08-26T19:39:34.3161766Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:39:34.3162415Z ) 2025-08-26T19:39:34.3162617Z 2025-08-26T19:39:34.3162801Z # Add more fields as needed 2025-08-26T19:39:34.3163108Z 2025-08-26T19:39:34.3163115Z 2025-08-26T19:39:34.3163305Z class Settings(NamedTuple): 2025-08-26T19:39:34.3163747Z """ 2025-08-26T19:39:34.3164202Z Settings for the experiments that can be opted into. 2025-08-26T19:39:34.3164778Z """ 2025-08-26T19:39:34.3164979Z 2025-08-26T19:39:34.3165192Z experiments: dict[str, Experiment] = {} 2025-08-26T19:39:34.3165562Z 2025-08-26T19:39:34.3165568Z 2025-08-26T19:39:34.3165779Z class ColorFormatter(logging.Formatter): 2025-08-26T19:39:34.3166405Z """Color codes the log messages based on the log level""" 2025-08-26T19:39:34.3166847Z 2025-08-26T19:39:34.3167016Z COLORS = { 2025-08-26T19:39:34.3167422Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:39:34.3168082Z "ERROR": "\033[31m", # Red 2025-08-26T19:39:34.3168602Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:39:34.3169108Z "INFO": "\033[0m", # Reset 2025-08-26T19:39:34.3169596Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:39:34.3170069Z } 2025-08-26T19:39:34.3170271Z 2025-08-26T19:39:34.3170491Z def format(self, record: LogRecord) -> str: 2025-08-26T19:39:34.3171465Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:39:34.3172251Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:39:34.3172836Z return super().format(record) 2025-08-26T19:39:34.3173175Z 2025-08-26T19:39:34.3173182Z 2025-08-26T19:39:34.3173380Z handler = logging.StreamHandler() 2025-08-26T19:39:34.3174090Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:39:34.3174651Z 2025-08-26T19:39:34.3174895Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:39:34.3175500Z log.addHandler(handler) 2025-08-26T19:39:34.3175954Z log.setLevel(logging.INFO) 2025-08-26T19:39:34.3176256Z 2025-08-26T19:39:34.3176263Z 2025-08-26T19:39:34.3176522Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:39:34.3177093Z """ 2025-08-26T19:39:34.3177595Z Defines outputs of the github action that invokes this script 2025-08-26T19:39:34.3178234Z """ 2025-08-26T19:39:34.3178602Z if not GITHUB_OUTPUT: 2025-08-26T19:39:34.3179665Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:39:34.3180940Z log.warning( 2025-08-26T19:39:34.3181820Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:39:34.3182772Z ) 2025-08-26T19:39:34.3193007Z print(f"::set-output name={key}::{value}") 2025-08-26T19:39:34.3193631Z return 2025-08-26T19:39:34.3193866Z 2025-08-26T19:39:34.3194258Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:39:34.3194873Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:39:34.3195448Z f.write(f"{key}={value}\n") 2025-08-26T19:39:34.3195783Z 2025-08-26T19:39:34.3195790Z 2025-08-26T19:39:34.3196094Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:39:34.3196740Z return frozenset( 2025-08-26T19:39:34.3197362Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:39:34.3198049Z ) 2025-08-26T19:39:34.3198254Z 2025-08-26T19:39:34.3198261Z 2025-08-26T19:39:34.3198447Z def parse_args() -> Any: 2025-08-26T19:39:34.3199027Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:39:34.3199898Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:39:34.3200682Z parser.add_argument( 2025-08-26T19:39:34.3201397Z "--github-issue-repo", 2025-08-26T19:39:34.3201885Z type=str, 2025-08-26T19:39:34.3202305Z required=False, 2025-08-26T19:39:34.3202769Z default="pytorch/test-infra", 2025-08-26T19:39:34.3203322Z help="GitHub repo to get the issue", 2025-08-26T19:39:34.3203831Z ) 2025-08-26T19:39:34.3204209Z parser.add_argument( 2025-08-26T19:39:34.3204669Z "--github-repo", 2025-08-26T19:39:34.3205118Z type=str, 2025-08-26T19:39:34.3205519Z required=True, 2025-08-26T19:39:34.3205997Z help="GitHub repo where CI is running", 2025-08-26T19:39:34.3206538Z ) 2025-08-26T19:39:34.3206910Z parser.add_argument( 2025-08-26T19:39:34.3207521Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:39:34.3208182Z ) 2025-08-26T19:39:34.3208557Z parser.add_argument( 2025-08-26T19:39:34.3209171Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:39:34.3209850Z ) 2025-08-26T19:39:34.3261884Z parser.add_argument( 2025-08-26T19:39:34.3263385Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:39:34.3264118Z ) 2025-08-26T19:39:34.3264507Z parser.add_argument( 2025-08-26T19:39:34.3265174Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:39:34.3265906Z ) 2025-08-26T19:39:34.3266274Z parser.add_argument( 2025-08-26T19:39:34.3266744Z "--github-ref-type", 2025-08-26T19:39:34.3267195Z type=str, 2025-08-26T19:39:34.3267598Z required=True, 2025-08-26T19:39:34.3268079Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:39:34.3268632Z ) 2025-08-26T19:39:34.3268993Z parser.add_argument( 2025-08-26T19:39:34.3269458Z "--eligible-experiments", 2025-08-26T19:39:34.3269975Z type=_str_comma_separated_to_set, 2025-08-26T19:39:34.3270497Z required=False, 2025-08-26T19:39:34.3271212Z default="", 2025-08-26T19:39:34.3272086Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:39:34.3273022Z ) 2025-08-26T19:39:34.3273390Z parser.add_argument( 2025-08-26T19:39:34.3273856Z "--opt-out-experiments", 2025-08-26T19:39:34.3274360Z type=_str_comma_separated_to_set, 2025-08-26T19:39:34.3274883Z required=False, 2025-08-26T19:39:34.3275308Z default="", 2025-08-26T19:39:34.3275697Z help=( 2025-08-26T19:39:34.3276370Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:39:34.3277495Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:39:34.3278326Z ), 2025-08-26T19:39:34.3278739Z ) 2025-08-26T19:39:34.3279328Z parser.add_argument( 2025-08-26T19:39:34.3279856Z "--pr-number", 2025-08-26T19:39:34.3280281Z type=str, 2025-08-26T19:39:34.3280672Z required=False, 2025-08-26T19:39:34.3281360Z default="", 2025-08-26T19:39:34.3282020Z help="the optional PR number where this is run", 2025-08-26T19:39:34.3282589Z ) 2025-08-26T19:39:34.3282789Z 2025-08-26T19:39:34.3282989Z return parser.parse_args() 2025-08-26T19:39:34.3283296Z 2025-08-26T19:39:34.3283303Z 2025-08-26T19:39:34.3283711Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:39:34.3284471Z auth = Auth.Token(github_token) 2025-08-26T19:39:34.3284971Z return Github(auth=auth) 2025-08-26T19:39:34.3285270Z 2025-08-26T19:39:34.3285278Z 2025-08-26T19:39:34.3285728Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:39:34.3286530Z repo = gh.get_repo(repo) 2025-08-26T19:39:34.3287037Z return repo.get_issue(number=issue_num) 2025-08-26T19:39:34.3287407Z 2025-08-26T19:39:34.3287414Z 2025-08-26T19:39:34.3287601Z def get_potential_pr_author( 2025-08-26T19:39:34.3288247Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:39:34.3288935Z ) -> str: 2025-08-26T19:39:34.3289452Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:39:34.3290256Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:39:34.3291151Z # embedded in the tag name: ciflow// 2025-08-26T19:39:34.3291571Z 2025-08-26T19:39:34.3291761Z gh = get_gh_client(github_token) 2025-08-26T19:39:34.3292104Z 2025-08-26T19:39:34.3292366Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:39:34.3292997Z split_tag = ref_name.split("/") 2025-08-26T19:39:34.3293507Z if ( 2025-08-26T19:39:34.3293893Z len(split_tag) == 3 2025-08-26T19:39:34.3294378Z and split_tag[0] == "ciflow" 2025-08-26T19:39:34.3294909Z and split_tag[2].isnumeric() 2025-08-26T19:39:34.3295396Z ): 2025-08-26T19:39:34.3295780Z pr_number = split_tag[2] 2025-08-26T19:39:34.3296413Z try: 2025-08-26T19:39:34.3296861Z repository = gh.get_repo(repo) 2025-08-26T19:39:34.3297473Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:39:34.3298068Z except Exception as e: 2025-08-26T19:39:34.3298577Z raise Exception( # noqa: TRY002 2025-08-26T19:39:34.3299248Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:39:34.3299889Z ) from e 2025-08-26T19:39:34.3300421Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:39:34.3301228Z # In all other cases, return the original input username 2025-08-26T19:39:34.3301817Z return username 2025-08-26T19:39:34.3302067Z 2025-08-26T19:39:34.3302073Z 2025-08-26T19:39:34.3302307Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:39:34.3302839Z """ 2025-08-26T19:39:34.3303480Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:39:34.3304254Z """ 2025-08-26T19:39:34.3304801Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:39:34.3305326Z 2025-08-26T19:39:34.3305333Z 2025-08-26T19:39:34.3305539Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:39:34.3306034Z try: 2025-08-26T19:39:34.3306430Z data = yaml.safe_load(yaml_text) 2025-08-26T19:39:34.3306939Z return data 2025-08-26T19:39:34.3307355Z except yaml.YAMLError: 2025-08-26T19:39:34.3307830Z log.exception("Error loading YAML") 2025-08-26T19:39:34.3308344Z raise 2025-08-26T19:39:34.3308560Z 2025-08-26T19:39:34.3308566Z 2025-08-26T19:39:34.3308998Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:39:34.3309729Z """ 2025-08-26T19:39:34.3310345Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:39:34.3311237Z 2025-08-26T19:39:34.3311761Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:39:34.3312536Z and the text below is the list of opted in users. 2025-08-26T19:39:34.3312938Z 2025-08-26T19:39:34.3313325Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:39:34.3314019Z """ 2025-08-26T19:39:34.3314475Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:39:34.3315091Z if len(rollout_state_parts) >= 2: 2025-08-26T19:39:34.3315693Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:39:34.3316278Z else: 2025-08-26T19:39:34.3316662Z return "", rollout_state 2025-08-26T19:39:34.3316970Z 2025-08-26T19:39:34.3316979Z 2025-08-26T19:39:34.3317181Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:39:34.3317695Z """ 2025-08-26T19:39:34.3318214Z Dictionary of users with a list of features they have opted into 2025-08-26T19:39:34.3318846Z """ 2025-08-26T19:39:34.3319054Z 2025-08-26T19:39:34.3319060Z 2025-08-26T19:39:34.3319414Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:39:34.3320065Z """ 2025-08-26T19:39:34.3321264Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:39:34.3321964Z 2025-08-26T19:39:34.3322593Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:39:34.3323584Z - Example line: "@User1,lf,split_build" 2025-08-26T19:39:34.3324273Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:39:34.3324755Z 2025-08-26T19:39:34.3324762Z 2025-08-26T19:39:34.3324920Z """ 2025-08-26T19:39:34.3325300Z optins = UserOptins() 2025-08-26T19:39:34.3325785Z for user in user_optin_text.split("\n"): 2025-08-26T19:39:34.3326337Z user = user.strip("\r\n\t -") 2025-08-26T19:39:34.3326877Z if not user or not user.startswith("@"): 2025-08-26T19:39:34.3327599Z # Not a valid user. Skip 2025-08-26T19:39:34.3328083Z continue 2025-08-26T19:39:34.3328327Z 2025-08-26T19:39:34.3328489Z if user: 2025-08-26T19:39:34.3328932Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:39:34.3329629Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:39:34.3330119Z 2025-08-26T19:39:34.3330287Z return optins 2025-08-26T19:39:34.3330520Z 2025-08-26T19:39:34.3330527Z 2025-08-26T19:39:34.3330934Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:39:34.3331536Z """ 2025-08-26T19:39:34.3331934Z Check if the experiment name is valid. 2025-08-26T19:39:34.3332856Z A valid name: 2025-08-26T19:39:34.3333514Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:39:34.3334469Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:39:34.3335206Z - Cannot contain spaces 2025-08-26T19:39:34.3335661Z """ 2025-08-26T19:39:34.3335864Z 2025-08-26T19:39:34.3336134Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:39:34.3336837Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:39:34.3337276Z 2025-08-26T19:39:34.3337435Z if valid: 2025-08-26T19:39:34.3337812Z return True 2025-08-26T19:39:34.3338048Z 2025-08-26T19:39:34.3338209Z log.error( 2025-08-26T19:39:34.3339668Z 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-26T19:39:34.3341410Z ) 2025-08-26T19:39:34.3341766Z return False 2025-08-26T19:39:34.3342010Z 2025-08-26T19:39:34.3342017Z 2025-08-26T19:39:34.3342320Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:39:34.3342935Z """ 2025-08-26T19:39:34.3343692Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:39:34.3344419Z """ 2025-08-26T19:39:34.3344769Z try: 2025-08-26T19:39:34.3345148Z if settings_text: 2025-08-26T19:39:34.3345865Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:39:34.3346652Z # for easy reading 2025-08-26T19:39:34.3347441Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:39:34.3348364Z # the backtick character in shell commands. 2025-08-26T19:39:34.3348966Z backtick = chr(96) # backtick character 2025-08-26T19:39:34.3349637Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:39:34.3350314Z settings = load_yaml(settings_text) 2025-08-26T19:39:34.3350687Z 2025-08-26T19:39:34.3351211Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:39:34.3351975Z experiments = {} 2025-08-26T19:39:34.3352273Z 2025-08-26T19:39:34.3352660Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:39:34.3353436Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:39:34.3354552Z # 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-26T19:39:34.3355597Z continue 2025-08-26T19:39:34.3355885Z 2025-08-26T19:39:34.3356073Z valid_settings = {} 2025-08-26T19:39:34.3356580Z for setting in exp_settings: 2025-08-26T19:39:34.3357150Z if setting not in Experiment._fields: 2025-08-26T19:39:34.3357705Z log.warning( 2025-08-26T19:39:34.3358415Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:39:34.3359312Z ) 2025-08-26T19:39:34.3359737Z else: 2025-08-26T19:39:34.3360252Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:39:34.3360673Z 2025-08-26T19:39:34.3361067Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:39:34.3361715Z return Settings(experiments) 2025-08-26T19:39:34.3362065Z 2025-08-26T19:39:34.3362240Z except Exception: 2025-08-26T19:39:34.3362716Z log.exception("Failed to parse settings") 2025-08-26T19:39:34.3363102Z 2025-08-26T19:39:34.3363274Z return Settings() 2025-08-26T19:39:34.3363527Z 2025-08-26T19:39:34.3363534Z 2025-08-26T19:39:34.3363784Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:39:34.3364358Z """ 2025-08-26T19:39:34.3364793Z Parse settings, if any, from the rollout state. 2025-08-26T19:39:34.3365203Z 2025-08-26T19:39:34.3365553Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:39:34.3366315Z and the text below is the list of opted in users. 2025-08-26T19:39:34.3366722Z 2025-08-26T19:39:34.3367132Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:39:34.3367868Z """ 2025-08-26T19:39:34.3368416Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:39:34.3369178Z return parse_settings_from_text(settings_text) 2025-08-26T19:39:34.3369576Z 2025-08-26T19:39:34.3369583Z 2025-08-26T19:39:34.3369830Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:39:34.3370385Z """ 2025-08-26T19:39:34.3370872Z Parse users from the rollout state. 2025-08-26T19:39:34.3371233Z 2025-08-26T19:39:34.3371392Z """ 2025-08-26T19:39:34.3371924Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:39:34.3372666Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:39:34.3373071Z 2025-08-26T19:39:34.3373078Z 2025-08-26T19:39:34.3373626Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:39:34.3374382Z """ 2025-08-26T19:39:34.3374797Z Check if a user is opted into an experiment 2025-08-26T19:39:34.3375325Z """ 2025-08-26T19:39:34.3375790Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:39:34.3376207Z 2025-08-26T19:39:34.3376215Z 2025-08-26T19:39:34.3376644Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:39:34.3377381Z """ 2025-08-26T19:39:34.3377843Z Check if a user explicitly opted out of an experiment 2025-08-26T19:39:34.3378417Z """ 2025-08-26T19:39:34.3378921Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:39:34.3379604Z experiment_optout = "-" + experiment_name 2025-08-26T19:39:34.3380244Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:39:34.3380955Z return False 2025-08-26T19:39:34.3381229Z 2025-08-26T19:39:34.3381519Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:39:34.3382135Z log.warning( 2025-08-26T19:39:34.3382932Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:39:34.3383813Z ) 2025-08-26T19:39:34.3384019Z 2025-08-26T19:39:34.3384185Z return True 2025-08-26T19:39:34.3384424Z 2025-08-26T19:39:34.3384430Z 2025-08-26T19:39:34.3384608Z def get_runner_prefix( 2025-08-26T19:39:34.3385052Z rollout_state: str, 2025-08-26T19:39:34.3385517Z workflow_requestors: Iterable[str], 2025-08-26T19:39:34.3386044Z branch: str, 2025-08-26T19:39:34.3386544Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:39:34.3387218Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:39:34.3387807Z is_canary: bool = False, 2025-08-26T19:39:34.3388274Z ) -> str: 2025-08-26T19:39:34.3388845Z settings = parse_settings(rollout_state) 2025-08-26T19:39:34.3389448Z user_optins = parse_users(rollout_state) 2025-08-26T19:39:34.3389820Z 2025-08-26T19:39:34.3389996Z fleet_prefix = "" 2025-08-26T19:39:34.3390420Z prefixes = [] 2025-08-26T19:39:34.3391163Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:39:34.3392132Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:39:34.3392857Z log.info( 2025-08-26T19:39:34.3393547Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:39:34.3394310Z ) 2025-08-26T19:39:34.3394688Z continue 2025-08-26T19:39:34.3394947Z 2025-08-26T19:39:34.3395140Z if opt_out_experiments: 2025-08-26T19:39:34.3395690Z if experiment_name in opt_out_experiments: 2025-08-26T19:39:34.3396339Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:39:34.3396937Z log.info( 2025-08-26T19:39:34.3397862Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:39:34.3398843Z ) 2025-08-26T19:39:34.3399249Z continue 2025-08-26T19:39:34.3399525Z 2025-08-26T19:39:34.3399714Z if eligible_experiments: 2025-08-26T19:39:34.3400304Z if experiment_name not in eligible_experiments: 2025-08-26T19:39:34.3401079Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:39:34.3401648Z log.info( 2025-08-26T19:39:34.3402428Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:39:34.3403271Z ) 2025-08-26T19:39:34.3403668Z continue 2025-08-26T19:39:34.3404148Z elif not experiment_settings.default: 2025-08-26T19:39:34.3404686Z log.info( 2025-08-26T19:39:34.3405550Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:39:34.3406324Z ) 2025-08-26T19:39:34.3406704Z continue 2025-08-26T19:39:34.3406949Z 2025-08-26T19:39:34.3407234Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:39:34.3407846Z opted_out_users = [ 2025-08-26T19:39:34.3408298Z requestor 2025-08-26T19:39:34.3408752Z for requestor in workflow_requestors 2025-08-26T19:39:34.3409433Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:39:34.3410069Z ] 2025-08-26T19:39:34.3410278Z 2025-08-26T19:39:34.3410463Z if opted_out_users: 2025-08-26T19:39:34.3411125Z log.info( 2025-08-26T19:39:34.3411853Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:39:34.3412560Z ) 2025-08-26T19:39:34.3412941Z continue 2025-08-26T19:39:34.3413212Z 2025-08-26T19:39:34.3413503Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:39:34.3414135Z opted_in_users = [ 2025-08-26T19:39:34.3414585Z requestor 2025-08-26T19:39:34.3415048Z for requestor in workflow_requestors 2025-08-26T19:39:34.3415714Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:39:34.3416336Z ] 2025-08-26T19:39:34.3416540Z 2025-08-26T19:39:34.3416714Z enabled = False 2025-08-26T19:39:34.3417153Z if opted_in_users: 2025-08-26T19:39:34.3417604Z log.info( 2025-08-26T19:39:34.3418219Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:39:34.3418903Z ) 2025-08-26T19:39:34.3419304Z enabled = True 2025-08-26T19:39:34.3419589Z 2025-08-26T19:39:34.3419820Z elif experiment_settings.rollout_perc: 2025-08-26T19:39:34.3420665Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:39:34.3421947Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:39:34.3422598Z log.info( 2025-08-26T19:39:34.3423472Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:39:34.3424390Z ) 2025-08-26T19:39:34.3424801Z enabled = True 2025-08-26T19:39:34.3425100Z 2025-08-26T19:39:34.3425274Z if enabled: 2025-08-26T19:39:34.3425697Z label = experiment_name 2025-08-26T19:39:34.3426253Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:39:34.3427090Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:39:34.3427969Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:39:34.3428730Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:39:34.3429404Z if is_canary: 2025-08-26T19:39:34.3429905Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:39:34.3430456Z fleet_prefix = label 2025-08-26T19:39:34.3431073Z else: 2025-08-26T19:39:34.3431501Z prefixes.append(label) 2025-08-26T19:39:34.3431852Z 2025-08-26T19:39:34.3432038Z if len(prefixes) > 1: 2025-08-26T19:39:34.3432478Z log.error( 2025-08-26T19:39:34.3433520Z 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-26T19:39:34.3434638Z ) 2025-08-26T19:39:34.3435025Z prefixes = prefixes[:1] 2025-08-26T19:39:34.3435337Z 2025-08-26T19:39:34.3435535Z # Fleet always comes first 2025-08-26T19:39:34.3436001Z if fleet_prefix: 2025-08-26T19:39:34.3436451Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:39:34.3436813Z 2025-08-26T19:39:34.3437221Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:39:34.3437648Z 2025-08-26T19:39:34.3437657Z 2025-08-26T19:39:34.3438109Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:39:34.3438885Z """ 2025-08-26T19:39:34.3439470Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:39:34.3440026Z 2025-08-26T19:39:34.3440430Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:39:34.3441251Z """ 2025-08-26T19:39:34.3441648Z gh = get_gh_client(github_token) 2025-08-26T19:39:34.3442184Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:39:34.3442828Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:39:34.3443271Z 2025-08-26T19:39:34.3443278Z 2025-08-26T19:39:34.3443686Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:39:34.3444450Z for _ in range(num_retries): 2025-08-26T19:39:34.3444933Z try: 2025-08-26T19:39:34.3445363Z req = Request(url=url, headers=headers) 2025-08-26T19:39:34.3446033Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:39:34.3446680Z return json.loads(content) 2025-08-26T19:39:34.3447216Z except Exception as e: 2025-08-26T19:39:34.3447757Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:39:34.3448217Z 2025-08-26T19:39:34.3448611Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:39:34.3449325Z return {} 2025-08-26T19:39:34.3449550Z 2025-08-26T19:39:34.3449556Z 2025-08-26T19:39:34.3449716Z @cache 2025-08-26T19:39:34.3450348Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:39:34.3451412Z """ 2025-08-26T19:39:34.3451828Z Dynamically get PR information 2025-08-26T19:39:34.3452325Z """ 2025-08-26T19:39:34.3452988Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:39:34.3453620Z headers = { 2025-08-26T19:39:34.3454077Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:39:34.3454692Z "Authorization": f"token {github_token}", 2025-08-26T19:39:34.3455226Z } 2025-08-26T19:39:34.3455677Z json_response: dict[str, Any] = download_json( 2025-08-26T19:39:34.3456283Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:39:34.3456838Z headers=headers, 2025-08-26T19:39:34.3457263Z ) 2025-08-26T19:39:34.3457468Z 2025-08-26T19:39:34.3457653Z if not json_response: 2025-08-26T19:39:34.3458225Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:39:34.3458842Z return {} 2025-08-26T19:39:34.3459078Z 2025-08-26T19:39:34.3459271Z return json_response 2025-08-26T19:39:34.3459548Z 2025-08-26T19:39:34.3459555Z 2025-08-26T19:39:34.3459958Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:39:34.3460689Z """ 2025-08-26T19:39:34.3461348Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:39:34.3462009Z """ 2025-08-26T19:39:34.3462489Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:39:34.3463116Z return { 2025-08-26T19:39:34.3463716Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:39:34.3464413Z } 2025-08-26T19:39:34.3464614Z 2025-08-26T19:39:34.3464620Z 2025-08-26T19:39:34.3464802Z def main() -> None: 2025-08-26T19:39:34.3465225Z args = parse_args() 2025-08-26T19:39:34.3465499Z 2025-08-26T19:39:34.3465719Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:39:34.3466105Z 2025-08-26T19:39:34.3466302Z # Check if the PR is opt-out 2025-08-26T19:39:34.3466792Z if args.pr_number: 2025-08-26T19:39:34.3467451Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:39:34.3468332Z if OPT_OUT_LABEL in labels: 2025-08-26T19:39:34.3468846Z log.info( 2025-08-26T19:39:34.3469543Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:39:34.3470311Z ) 2025-08-26T19:39:34.3470966Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:39:34.3471644Z sys.exit() 2025-08-26T19:39:34.3471905Z 2025-08-26T19:39:34.3472075Z try: 2025-08-26T19:39:34.3472512Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:39:34.3473229Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:39:34.3473865Z ) 2025-08-26T19:39:34.3474069Z 2025-08-26T19:39:34.3474288Z username = get_potential_pr_author( 2025-08-26T19:39:34.3474827Z args.github_token, 2025-08-26T19:39:34.3475311Z args.github_repo, 2025-08-26T19:39:34.3475788Z args.github_actor, 2025-08-26T19:39:34.3476282Z args.github_ref_type, 2025-08-26T19:39:34.3476777Z args.github_branch, 2025-08-26T19:39:34.3477253Z ) 2025-08-26T19:39:34.3477457Z 2025-08-26T19:39:34.3477753Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:39:34.3478200Z 2025-08-26T19:39:34.3478416Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:39:34.3478976Z rollout_state, 2025-08-26T19:39:34.3479459Z (args.github_issue_owner, username), 2025-08-26T19:39:34.3480013Z args.github_branch, 2025-08-26T19:39:34.3480510Z args.eligible_experiments, 2025-08-26T19:39:34.3481157Z args.opt_out_experiments, 2025-08-26T19:39:34.3481678Z is_canary, 2025-08-26T19:39:34.3482092Z ) 2025-08-26T19:39:34.3482301Z 2025-08-26T19:39:34.3482495Z except Exception as e: 2025-08-26T19:39:34.3482944Z log.error( 2025-08-26T19:39:34.3483617Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:39:34.3484520Z ) 2025-08-26T19:39:34.3484738Z 2025-08-26T19:39:34.3485067Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:39:34.3485562Z 2025-08-26T19:39:34.3485569Z 2025-08-26T19:39:34.3485750Z if __name__ == "__main__": 2025-08-26T19:39:34.3486189Z main() 2025-08-26T19:39:34.3486396Z 2025-08-26T19:39:34.3582083Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:39:34.3582979Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:39:34.3624408Z shell: /usr/bin/bash -e {0} 2025-08-26T19:39:34.3624886Z env: 2025-08-26T19:39:34.3625529Z GITHUB_TOKEN: *** 2025-08-26T19:39:34.3625940Z ISSUE_NUMBER: 5132 2025-08-26T19:39:34.3626387Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:39:34.3626890Z ISSUE_OWNER: 2025-08-26T19:39:34.3627297Z CHECK_EXPERIMENTS: 2025-08-26T19:39:34.3627724Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:39:34.3628168Z PR_NUMBER: 2025-08-26T19:39:34.3628540Z ##[endgroup] 2025-08-26T19:39:34.7319106Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:39:35.1062817Z Collecting urllib3==1.26.18 2025-08-26T19:39:35.1399942Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:39:35.1587306Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.9 MB/s eta 0:00:00 2025-08-26T19:39:35.1799007Z Collecting PyGithub==2.3.0 2025-08-26T19:39:35.1828006Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:39:35.2287848Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:39:35.2318068Z 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-26T19:39:35.2366467Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:39:35.2384309Z 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-26T19:39:35.2398771Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:39:35.2666013Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:39:35.2695699Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:39:35.2921801Z 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-26T19:39:35.4106129Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:39:35.4138717Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:39:35.5324275Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:39:35.5362613Z 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-26T19:39:35.5548782Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:39:35.5588164Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:39:35.5825440Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:39:35.5922206Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.3 MB/s eta 0:00:00 2025-08-26T19:39:35.5970384Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:39:35.6060106Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 48.7 MB/s eta 0:00:00 2025-08-26T19:39:35.6089643Z 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-26T19:39:35.6243409Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 62.2 MB/s eta 0:00:00 2025-08-26T19:39:35.6273742Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:39:35.6330198Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:39:35.6408808Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 75.9 MB/s eta 0:00:00 2025-08-26T19:39:35.6450036Z 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-26T19:39:35.6500325Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 22.9 MB/s eta 0:00:00 2025-08-26T19:39:35.6530153Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:39:35.6573660Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 40.2 MB/s eta 0:00:00 2025-08-26T19:39:35.9459608Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:39:36.4852139Z 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-26T19:39:36.5852610Z ##[group]Run curr_branch="main" 2025-08-26T19:39:36.5853006Z curr_branch="main" 2025-08-26T19:39:36.5853286Z curr_ref_type="branch" 2025-08-26T19:39:36.5853631Z echo "Current branch is '$curr_branch'" 2025-08-26T19:39:36.5853926Z  2025-08-26T19:39:36.5854155Z python3 runner_determinator.py \ 2025-08-26T19:39:36.5854485Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:39:36.5854797Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:39:36.5855098Z  --github-branch "$curr_branch" \ 2025-08-26T19:39:36.5855402Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:39:36.5855722Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:39:36.5856047Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:39:36.5856373Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:39:36.5856752Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:39:36.5857159Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:39:36.5857489Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:39:36.5900264Z shell: /usr/bin/bash -e {0} 2025-08-26T19:39:36.5900560Z env: 2025-08-26T19:39:36.5901506Z GITHUB_TOKEN: *** 2025-08-26T19:39:36.5901767Z ISSUE_NUMBER: 5132 2025-08-26T19:39:36.5902011Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:39:36.5902292Z ISSUE_OWNER: 2025-08-26T19:39:36.5902536Z CHECK_EXPERIMENTS: 2025-08-26T19:39:36.5902773Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:39:36.5903007Z PR_NUMBER: 2025-08-26T19:39:36.5903214Z ##[endgroup] 2025-08-26T19:39:36.5967684Z Current branch is 'main' 2025-08-26T19:39:38.3059198Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:39:38.3060518Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:39:38.3062046Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:39:38.3062886Z INFO : Setting output: label-type='lf.' 2025-08-26T19:39:38.3400268Z Evaluate and set job outputs 2025-08-26T19:39:38.3406562Z Set output 'label-type' 2025-08-26T19:39:38.3408405Z Cleaning up orphan processes