2025-12-04T08:08:12.5729642Z Current runner version: '2.329.0' 2025-12-04T08:08:12.5756616Z ##[group]Runner Image Provisioner 2025-12-04T08:08:12.5757995Z Hosted Compute Agent 2025-12-04T08:08:12.5758634Z Version: 20251124.448 2025-12-04T08:08:12.5759311Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:08:12.5760134Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:08:12.5760800Z ##[endgroup] 2025-12-04T08:08:12.5761405Z ##[group]Operating System 2025-12-04T08:08:12.5762086Z Ubuntu 2025-12-04T08:08:12.5762619Z 24.04.3 2025-12-04T08:08:12.5763177Z LTS 2025-12-04T08:08:12.5763704Z ##[endgroup] 2025-12-04T08:08:12.5764459Z ##[group]Runner Image 2025-12-04T08:08:12.5765122Z Image: ubuntu-24.04 2025-12-04T08:08:12.5765717Z Version: 20251126.144.1 2025-12-04T08:08:12.5766855Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:08:12.5768466Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:08:12.5769585Z ##[endgroup] 2025-12-04T08:08:12.5770664Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:08:12.5772960Z Contents: read 2025-12-04T08:08:12.5773599Z Metadata: read 2025-12-04T08:08:12.5774869Z ##[endgroup] 2025-12-04T08:08:12.5777607Z Secret source: Actions 2025-12-04T08:08:12.5778615Z Prepare workflow directory 2025-12-04T08:08:12.6310158Z Prepare all required actions 2025-12-04T08:08:12.6369682Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:08:12.6375487Z ##[group] Inputs 2025-12-04T08:08:12.6376193Z check_experiments: 2025-12-04T08:08:12.6376809Z opt_out_experiments: 2025-12-04T08:08:12.6377591Z triggering_actor: pytorchmergebot 2025-12-04T08:08:12.6378277Z issue_owner: 2025-12-04T08:08:12.6378868Z curr_branch: main 2025-12-04T08:08:12.6379522Z curr_ref_type: branch 2025-12-04T08:08:12.6380300Z issue_number: 5132 2025-12-04T08:08:12.6380913Z ##[endgroup] 2025-12-04T08:08:12.6381749Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:08:13.2009351Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:08:13.2011867Z cat < runner_determinator.py 2025-12-04T08:08:13.2012571Z # flake8: noqa: G004 2025-12-04T08:08:13.2013165Z  2025-12-04T08:08:13.2014259Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:08:13.2015501Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:08:13.2016514Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:08:13.2017348Z  2025-12-04T08:08:13.2017854Z """ 2025-12-04T08:08:13.2018610Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:08:13.2019777Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:08:13.2021085Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:08:13.2022160Z of which runners should be used to run which job. 2025-12-04T08:08:13.2022957Z  2025-12-04T08:08:13.2023730Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:08:13.2025040Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:08:13.2026200Z settings are considered to be empty with only the second part, the user 2025-12-04T08:08:13.2027116Z list, defined. 2025-12-04T08:08:13.2027628Z  2025-12-04T08:08:13.2028403Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:08:13.2029508Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:08:13.2030555Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:08:13.2031383Z  2025-12-04T08:08:13.2032392Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:08:13.2033491Z The user list is also a comma separated list of additional features or 2025-12-04T08:08:13.2034589Z experiments which the user could be opted in to. 2025-12-04T08:08:13.2035344Z  2025-12-04T08:08:13.2035881Z The user list has the following rules: 2025-12-04T08:08:13.2036678Z  2025-12-04T08:08:13.2037439Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:08:13.2038472Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:08:13.2120814Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:08:13.2122095Z  2025-12-04T08:08:13.2122844Z Example config: 2025-12-04T08:08:13.2123840Z  # A list of experiments that can be opted into. 2025-12-04T08:08:13.2125476Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:08:13.2126869Z  # Expected syntax is: 2025-12-04T08:08:13.2127947Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:08:13.2129040Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:08:13.2129871Z  2025-12-04T08:08:13.2130271Z  experiments: 2025-12-04T08:08:13.2130741Z  lf: 2025-12-04T08:08:13.2131184Z  rollout_percent: 25 2025-12-04T08:08:13.2131738Z  all_branches: false 2025-12-04T08:08:13.2132277Z  default: true 2025-12-04T08:08:13.2132768Z  --- 2025-12-04T08:08:13.2133197Z  2025-12-04T08:08:13.2133602Z  # Opt-ins: 2025-12-04T08:08:13.2134594Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:08:13.2135920Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:08:13.2136835Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:08:13.2137590Z  # Experiments should be from the above list. 2025-12-04T08:08:13.2138198Z  2025-12-04T08:08:13.2138627Z  @User1,-lf,split_build 2025-12-04T08:08:13.2139155Z  @User2,lf 2025-12-04T08:08:13.2139638Z  @User3,split_build 2025-12-04T08:08:13.2140146Z """ 2025-12-04T08:08:13.2140555Z  2025-12-04T08:08:13.2140950Z import json 2025-12-04T08:08:13.2141405Z import logging 2025-12-04T08:08:13.2141879Z import os 2025-12-04T08:08:13.2142320Z import random 2025-12-04T08:08:13.2142773Z import re 2025-12-04T08:08:13.2143209Z import sys 2025-12-04T08:08:13.2143707Z from argparse import ArgumentParser 2025-12-04T08:08:13.2144937Z from collections.abc import Iterable 2025-12-04T08:08:13.2145556Z from functools import cache 2025-12-04T08:08:13.2146125Z from logging import LogRecord 2025-12-04T08:08:13.2146709Z from typing import Any, NamedTuple 2025-12-04T08:08:13.2147352Z from urllib.request import Request, urlopen 2025-12-04T08:08:13.2147955Z  2025-12-04T08:08:13.2148351Z import yaml 2025-12-04T08:08:13.2148828Z from github import Auth, Github 2025-12-04T08:08:13.2149417Z from github.Issue import Issue 2025-12-04T08:08:13.2149951Z  2025-12-04T08:08:13.2150335Z  2025-12-04T08:08:13.2150824Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:08:13.2151618Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:08:13.2152617Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:08:13.2153389Z  2025-12-04T08:08:13.2154309Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:08:13.2154975Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:08:13.2155583Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:08:13.2156255Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:08:13.2156828Z  2025-12-04T08:08:13.2157275Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:08:13.2157829Z  2025-12-04T08:08:13.2158245Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:08:13.2158794Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:08:13.2159314Z  2025-12-04T08:08:13.2159685Z  2025-12-04T08:08:13.2160100Z class Experiment(NamedTuple): 2025-12-04T08:08:13.2160667Z  rollout_perc: float = ( 2025-12-04T08:08:13.2161408Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:08:13.2162148Z  ) 2025-12-04T08:08:13.2162581Z  all_branches: bool = ( 2025-12-04T08:08:13.2163325Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:08:13.2164281Z  ) 2025-12-04T08:08:13.2164727Z  default: bool = ( 2025-12-04T08:08:13.2165410Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:08:13.2166115Z  ) 2025-12-04T08:08:13.2166522Z  2025-12-04T08:08:13.2166943Z  # Add more fields as needed 2025-12-04T08:08:13.2167474Z  2025-12-04T08:08:13.2167852Z  2025-12-04T08:08:13.2168271Z class Settings(NamedTuple): 2025-12-04T08:08:13.2168781Z  """ 2025-12-04T08:08:13.2169329Z  Settings for the experiments that can be opted into. 2025-12-04T08:08:13.2169970Z  """ 2025-12-04T08:08:13.2170377Z  2025-12-04T08:08:13.2170829Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:08:13.2171408Z  2025-12-04T08:08:13.2171929Z  2025-12-04T08:08:13.2172401Z class ColorFormatter(logging.Formatter): 2025-12-04T08:08:13.2173131Z  """Color codes the log messages based on the log level""" 2025-12-04T08:08:13.2173779Z  2025-12-04T08:08:13.2174387Z  COLORS = { 2025-12-04T08:08:13.2174891Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:08:13.2175472Z  "ERROR": "\033[31m", # Red 2025-12-04T08:08:13.2176040Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:08:13.2176614Z  "INFO": "\033[0m", # Reset 2025-12-04T08:08:13.2177196Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:08:13.2177728Z  } 2025-12-04T08:08:13.2178137Z  2025-12-04T08:08:13.2178613Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:08:13.2179441Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:08:13.2180306Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:08:13.2180962Z  return super().format(record) 2025-12-04T08:08:13.2181507Z  2025-12-04T08:08:13.2181886Z  2025-12-04T08:08:13.2182326Z handler = logging.StreamHandler() 2025-12-04T08:08:13.2183154Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:08:13.2184386Z  2025-12-04T08:08:13.2184936Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:08:13.2185594Z log.addHandler(handler) 2025-12-04T08:08:13.2186128Z log.setLevel(logging.INFO) 2025-12-04T08:08:13.2186636Z  2025-12-04T08:08:13.2187036Z  2025-12-04T08:08:13.2187552Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:08:13.2188237Z  """ 2025-12-04T08:08:13.2188836Z  Defines outputs of the github action that invokes this script 2025-12-04T08:08:13.2189693Z  """ 2025-12-04T08:08:13.2190148Z  if not GITHUB_OUTPUT: 2025-12-04T08:08:13.2191323Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:08:13.2192542Z  log.warning( 2025-12-04T08:08:13.2193516Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:08:13.2194927Z  ) 2025-12-04T08:08:13.2195454Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:08:13.2196062Z  return 2025-12-04T08:08:13.2196514Z  2025-12-04T08:08:13.2196952Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:08:13.2197604Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:08:13.2198238Z  f.write(f"{key}={value}\n") 2025-12-04T08:08:13.2198795Z  2025-12-04T08:08:13.2199187Z  2025-12-04T08:08:13.2199760Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:08:13.2200492Z  return frozenset( 2025-12-04T08:08:13.2201212Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:08:13.2201957Z  ) 2025-12-04T08:08:13.2202370Z  2025-12-04T08:08:13.2202759Z  2025-12-04T08:08:13.2203168Z def parse_args() -> Any: 2025-12-04T08:08:13.2203858Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:08:13.2204951Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:08:13.2205788Z  parser.add_argument( 2025-12-04T08:08:13.2206338Z  "--github-issue-repo", 2025-12-04T08:08:13.2206891Z  type=str, 2025-12-04T08:08:13.2207391Z  required=False, 2025-12-04T08:08:13.2208100Z  default="pytorch/test-infra", 2025-12-04T08:08:13.2208750Z  help="GitHub repo to get the issue", 2025-12-04T08:08:13.2209324Z  ) 2025-12-04T08:08:13.2209762Z  parser.add_argument( 2025-12-04T08:08:13.2210295Z  "--github-repo", 2025-12-04T08:08:13.2210798Z  type=str, 2025-12-04T08:08:13.2211286Z  required=True, 2025-12-04T08:08:13.2211841Z  help="GitHub repo where CI is running", 2025-12-04T08:08:13.2212419Z  ) 2025-12-04T08:08:13.2212843Z  parser.add_argument( 2025-12-04T08:08:13.2213565Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:08:13.2214492Z  ) 2025-12-04T08:08:13.2214933Z  parser.add_argument( 2025-12-04T08:08:13.2215664Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:08:13.2216414Z  ) 2025-12-04T08:08:13.2216848Z  parser.add_argument( 2025-12-04T08:08:13.2217586Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:08:13.2218332Z  ) 2025-12-04T08:08:13.2218766Z  parser.add_argument( 2025-12-04T08:08:13.2219534Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:08:13.2220303Z  ) 2025-12-04T08:08:13.2220752Z  parser.add_argument( 2025-12-04T08:08:13.2221291Z  "--github-ref-type", 2025-12-04T08:08:13.2221825Z  type=str, 2025-12-04T08:08:13.2222311Z  required=True, 2025-12-04T08:08:13.2222914Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:08:13.2223525Z  ) 2025-12-04T08:08:13.2224064Z  parser.add_argument( 2025-12-04T08:08:13.2224779Z  "--eligible-experiments", 2025-12-04T08:08:13.2225392Z  type=_str_comma_separated_to_set, 2025-12-04T08:08:13.2225978Z  required=False, 2025-12-04T08:08:13.2226499Z  default="", 2025-12-04T08:08:13.2227476Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:08:13.2228459Z  ) 2025-12-04T08:08:13.2228892Z  parser.add_argument( 2025-12-04T08:08:13.2229442Z  "--opt-out-experiments", 2025-12-04T08:08:13.2230030Z  type=_str_comma_separated_to_set, 2025-12-04T08:08:13.2230608Z  required=False, 2025-12-04T08:08:13.2231116Z  default="", 2025-12-04T08:08:13.2231602Z  help=( 2025-12-04T08:08:13.2232373Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:08:13.2233590Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:08:13.2234600Z  ), 2025-12-04T08:08:13.2235037Z  ) 2025-12-04T08:08:13.2235481Z  parser.add_argument( 2025-12-04T08:08:13.2236010Z  "--pr-number", 2025-12-04T08:08:13.2236519Z  type=str, 2025-12-04T08:08:13.2237014Z  required=False, 2025-12-04T08:08:13.2237521Z  default="", 2025-12-04T08:08:13.2238115Z  help="the optional PR number where this is run", 2025-12-04T08:08:13.2238729Z  ) 2025-12-04T08:08:13.2239137Z  2025-12-04T08:08:13.2239564Z  return parser.parse_args() 2025-12-04T08:08:13.2240102Z  2025-12-04T08:08:13.2240482Z  2025-12-04T08:08:13.2241145Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:08:13.2242120Z  auth = Auth.Token(github_token) 2025-12-04T08:08:13.2242739Z  return Github(auth=auth) 2025-12-04T08:08:13.2243269Z  2025-12-04T08:08:13.2243653Z  2025-12-04T08:08:13.2244488Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:08:13.2245363Z  repo = gh.get_repo(repo) 2025-12-04T08:08:13.2245983Z  return repo.get_issue(number=issue_num) 2025-12-04T08:08:13.2246577Z  2025-12-04T08:08:13.2246967Z  2025-12-04T08:08:13.2247398Z def get_potential_pr_author( 2025-12-04T08:08:13.2248145Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:08:13.2248899Z ) -> str: 2025-12-04T08:08:13.2249509Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:08:13.2250429Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:08:13.2251295Z  # embedded in the tag name: ciflow// 2025-12-04T08:08:13.2251933Z  2025-12-04T08:08:13.2252382Z  gh = get_gh_client(github_token) 2025-12-04T08:08:13.2252931Z  2025-12-04T08:08:13.2253463Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:08:13.2254337Z  split_tag = ref_name.split("/") 2025-12-04T08:08:13.2254915Z  if ( 2025-12-04T08:08:13.2255393Z  len(split_tag) == 3 2025-12-04T08:08:13.2255968Z  and split_tag[0] == "ciflow" 2025-12-04T08:08:13.2256580Z  and split_tag[2].isnumeric() 2025-12-04T08:08:13.2257137Z  ): 2025-12-04T08:08:13.2257614Z  pr_number = split_tag[2] 2025-12-04T08:08:13.2258171Z  try: 2025-12-04T08:08:13.2258703Z  repository = gh.get_repo(repo) 2025-12-04T08:08:13.2259548Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:08:13.2260246Z  except Exception as e: 2025-12-04T08:08:13.2260864Z  raise Exception( # noqa: TRY002 2025-12-04T08:08:13.2261623Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:08:13.2262350Z  ) from e 2025-12-04T08:08:13.2262997Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:08:13.2263797Z  # In all other cases, return the original input username 2025-12-04T08:08:13.2264603Z  return username 2025-12-04T08:08:13.2265083Z  2025-12-04T08:08:13.2265474Z  2025-12-04T08:08:13.2265955Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:08:13.2266561Z  """ 2025-12-04T08:08:13.2267309Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:08:13.2268173Z  """ 2025-12-04T08:08:13.2268813Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:08:13.2269544Z  2025-12-04T08:08:13.2269935Z  2025-12-04T08:08:13.2270383Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:08:13.2270958Z  try: 2025-12-04T08:08:13.2271424Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:08:13.2272010Z  return data 2025-12-04T08:08:13.2272509Z  except yaml.YAMLError: 2025-12-04T08:08:13.2273097Z  log.exception("Error loading YAML") 2025-12-04T08:08:13.2273690Z  raise 2025-12-04T08:08:13.2274234Z  2025-12-04T08:08:13.2274625Z  2025-12-04T08:08:13.2275302Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:08:13.2276118Z  """ 2025-12-04T08:08:13.2276960Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:08:13.2277795Z  2025-12-04T08:08:13.2278396Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:08:13.2279269Z  and the text below is the list of opted in users. 2025-12-04T08:08:13.2279900Z  2025-12-04T08:08:13.2280544Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:08:13.2281323Z  """ 2025-12-04T08:08:13.2281850Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:08:13.2282536Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:08:13.2283233Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:08:13.2283889Z  else: 2025-12-04T08:08:13.2284577Z  return "", rollout_state 2025-12-04T08:08:13.2285244Z  2025-12-04T08:08:13.2285629Z  2025-12-04T08:08:13.2286081Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:08:13.2286654Z  """ 2025-12-04T08:08:13.2287253Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:08:13.2287995Z  """ 2025-12-04T08:08:13.2288399Z  2025-12-04T08:08:13.2288774Z  2025-12-04T08:08:13.2289369Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:08:13.2290099Z  """ 2025-12-04T08:08:13.2290905Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:08:13.2291804Z  2025-12-04T08:08:13.2292685Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:08:13.2293771Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:08:13.2294818Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:08:13.2295520Z  2025-12-04T08:08:13.2295894Z  2025-12-04T08:08:13.2296277Z  """ 2025-12-04T08:08:13.2296709Z  optins = UserOptins() 2025-12-04T08:08:13.2297292Z  for user in user_optin_text.split("\n"): 2025-12-04T08:08:13.2297928Z  user = user.strip("\r\n\t -") 2025-12-04T08:08:13.2298571Z  if not user or not user.startswith("@"): 2025-12-04T08:08:13.2299195Z  # Not a valid user. Skip 2025-12-04T08:08:13.2299747Z  continue 2025-12-04T08:08:13.2300224Z  2025-12-04T08:08:13.2300613Z  if user: 2025-12-04T08:08:13.2301186Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:08:13.2301954Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:08:13.2302658Z  2025-12-04T08:08:13.2303062Z  return optins 2025-12-04T08:08:13.2303520Z  2025-12-04T08:08:13.2303892Z  2025-12-04T08:08:13.2304547Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:08:13.2305233Z  """ 2025-12-04T08:08:13.2305715Z  Check if the experiment name is valid. 2025-12-04T08:08:13.2306299Z  A valid name: 2025-12-04T08:08:13.2307035Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:08:13.2308050Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:08:13.2308833Z  - Cannot contain spaces 2025-12-04T08:08:13.2309354Z  """ 2025-12-04T08:08:13.2309761Z  2025-12-04T08:08:13.2310266Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:08:13.2311058Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:08:13.2311840Z  2025-12-04T08:08:13.2312241Z  if valid: 2025-12-04T08:08:13.2312705Z  return True 2025-12-04T08:08:13.2313157Z  2025-12-04T08:08:13.2313546Z  log.error( 2025-12-04T08:08:13.2315221Z  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-12-04T08:08:13.2316876Z  ) 2025-12-04T08:08:13.2317286Z  return False 2025-12-04T08:08:13.2317742Z  2025-12-04T08:08:13.2318113Z  2025-12-04T08:08:13.2318678Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:08:13.2319380Z  """ 2025-12-04T08:08:13.2320046Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:08:13.2320827Z  """ 2025-12-04T08:08:13.2321234Z  try: 2025-12-04T08:08:13.2321670Z  if settings_text: 2025-12-04T08:08:13.2322493Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:08:13.2323334Z  # for easy reading 2025-12-04T08:08:13.2324417Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:08:13.2325673Z  # the backtick character in shell commands. 2025-12-04T08:08:13.2326371Z  backtick = chr(96) # backtick character 2025-12-04T08:08:13.2327151Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:08:13.2327893Z  settings = load_yaml(settings_text) 2025-12-04T08:08:13.2328465Z  2025-12-04T08:08:13.2329129Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:08:13.2330104Z  experiments = {} 2025-12-04T08:08:13.2330610Z  2025-12-04T08:08:13.2331230Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:08:13.2332072Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:08:13.2333261Z  # 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-12-04T08:08:13.2334607Z  continue 2025-12-04T08:08:13.2335115Z  2025-12-04T08:08:13.2335537Z  valid_settings = {} 2025-12-04T08:08:13.2336133Z  for setting in exp_settings: 2025-12-04T08:08:13.2336762Z  if setting not in Experiment._fields: 2025-12-04T08:08:13.2337397Z  log.warning( 2025-12-04T08:08:13.2338188Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:08:13.2338966Z  ) 2025-12-04T08:08:13.2339465Z  else: 2025-12-04T08:08:13.2340081Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:08:13.2340711Z  2025-12-04T08:08:13.2341240Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:08:13.2341953Z  return Settings(experiments) 2025-12-04T08:08:13.2342504Z  2025-12-04T08:08:13.2342910Z  except Exception: 2025-12-04T08:08:13.2343483Z  log.exception("Failed to parse settings") 2025-12-04T08:08:13.2344173Z  2025-12-04T08:08:13.2344578Z  return Settings() 2025-12-04T08:08:13.2345052Z  2025-12-04T08:08:13.2345438Z  2025-12-04T08:08:13.2346110Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:08:13.2346758Z  """ 2025-12-04T08:08:13.2347272Z  Parse settings, if any, from the rollout state. 2025-12-04T08:08:13.2347886Z  2025-12-04T08:08:13.2348476Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:08:13.2349321Z  and the text below is the list of opted in users. 2025-12-04T08:08:13.2349934Z  2025-12-04T08:08:13.2350587Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:08:13.2351374Z  """ 2025-12-04T08:08:13.2352000Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:08:13.2352835Z  return parse_settings_from_text(settings_text) 2025-12-04T08:08:13.2353432Z  2025-12-04T08:08:13.2353801Z  2025-12-04T08:08:13.2354427Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:08:13.2355055Z  """ 2025-12-04T08:08:13.2355520Z  Parse users from the rollout state. 2025-12-04T08:08:13.2356076Z  2025-12-04T08:08:13.2356454Z  """ 2025-12-04T08:08:13.2357063Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:08:13.2357883Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:08:13.2358484Z  2025-12-04T08:08:13.2358861Z  2025-12-04T08:08:13.2359548Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:08:13.2360356Z  """ 2025-12-04T08:08:13.2360858Z  Check if a user is opted into an experiment 2025-12-04T08:08:13.2361443Z  """ 2025-12-04T08:08:13.2361982Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:08:13.2362748Z  2025-12-04T08:08:13.2363127Z  2025-12-04T08:08:13.2363830Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:08:13.2364755Z  """ 2025-12-04T08:08:13.2365300Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:08:13.2365937Z  """ 2025-12-04T08:08:13.2366527Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:08:13.2367292Z  experiment_optout = "-" + experiment_name 2025-12-04T08:08:13.2368011Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:08:13.2368684Z  return False 2025-12-04T08:08:13.2369149Z  2025-12-04T08:08:13.2369676Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:08:13.2370338Z  log.warning( 2025-12-04T08:08:13.2371261Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:08:13.2372207Z  ) 2025-12-04T08:08:13.2372640Z  2025-12-04T08:08:13.2373064Z  return True 2025-12-04T08:08:13.2373518Z  2025-12-04T08:08:13.2373907Z  2025-12-04T08:08:13.2374409Z def get_runner_prefix( 2025-12-04T08:08:13.2374939Z  rollout_state: str, 2025-12-04T08:08:13.2375503Z  workflow_requestors: Iterable[str], 2025-12-04T08:08:13.2376090Z  branch: str, 2025-12-04T08:08:13.2376690Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:08:13.2377459Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:08:13.2378116Z  is_canary: bool = False, 2025-12-04T08:08:13.2378638Z ) -> str: 2025-12-04T08:08:13.2379148Z  settings = parse_settings(rollout_state) 2025-12-04T08:08:13.2379810Z  user_optins = parse_users(rollout_state) 2025-12-04T08:08:13.2380398Z  2025-12-04T08:08:13.2380918Z  fleet_prefix = "" 2025-12-04T08:08:13.2381442Z  prefixes = [] 2025-12-04T08:08:13.2382180Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:08:13.2383234Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:08:13.2384131Z  log.info( 2025-12-04T08:08:13.2384925Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:08:13.2385761Z  ) 2025-12-04T08:08:13.2386235Z  continue 2025-12-04T08:08:13.2386744Z  2025-12-04T08:08:13.2387166Z  if opt_out_experiments: 2025-12-04T08:08:13.2387828Z  if experiment_name in opt_out_experiments: 2025-12-04T08:08:13.2388582Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:08:13.2389251Z  log.info( 2025-12-04T08:08:13.2390302Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:08:13.2391363Z  ) 2025-12-04T08:08:13.2391840Z  continue 2025-12-04T08:08:13.2392338Z  2025-12-04T08:08:13.2392754Z  if eligible_experiments: 2025-12-04T08:08:13.2393419Z  if experiment_name not in eligible_experiments: 2025-12-04T08:08:13.2394238Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:08:13.2394861Z  log.info( 2025-12-04T08:08:13.2395736Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:08:13.2396643Z  ) 2025-12-04T08:08:13.2397260Z  continue 2025-12-04T08:08:13.2397830Z  elif not experiment_settings.default: 2025-12-04T08:08:13.2398434Z  log.info( 2025-12-04T08:08:13.2399192Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:08:13.2399997Z  ) 2025-12-04T08:08:13.2400446Z  continue 2025-12-04T08:08:13.2400917Z  2025-12-04T08:08:13.2401445Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:08:13.2402117Z  opted_out_users = [ 2025-12-04T08:08:13.2402651Z  requestor 2025-12-04T08:08:13.2403193Z  for requestor in workflow_requestors 2025-12-04T08:08:13.2404042Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:08:13.2404737Z  ] 2025-12-04T08:08:13.2405159Z  2025-12-04T08:08:13.2405579Z  if opted_out_users: 2025-12-04T08:08:13.2406138Z  log.info( 2025-12-04T08:08:13.2406874Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:08:13.2407634Z  ) 2025-12-04T08:08:13.2408102Z  continue 2025-12-04T08:08:13.2408571Z  2025-12-04T08:08:13.2409100Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:08:13.2409774Z  opted_in_users = [ 2025-12-04T08:08:13.2410319Z  requestor 2025-12-04T08:08:13.2410884Z  for requestor in workflow_requestors 2025-12-04T08:08:13.2411639Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:08:13.2412335Z  ] 2025-12-04T08:08:13.2412753Z  2025-12-04T08:08:13.2413158Z  enabled = False 2025-12-04T08:08:13.2413682Z  if opted_in_users: 2025-12-04T08:08:13.2414433Z  log.info( 2025-12-04T08:08:13.2415163Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:08:13.2415912Z  ) 2025-12-04T08:08:13.2416373Z  enabled = True 2025-12-04T08:08:13.2416879Z  2025-12-04T08:08:13.2417343Z  elif experiment_settings.rollout_perc: 2025-12-04T08:08:13.2418252Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:08:13.2419285Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:08:13.2420002Z  log.info( 2025-12-04T08:08:13.2420969Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:08:13.2421967Z  ) 2025-12-04T08:08:13.2422461Z  enabled = True 2025-12-04T08:08:13.2422989Z  2025-12-04T08:08:13.2423378Z  if enabled: 2025-12-04T08:08:13.2423897Z  label = experiment_name 2025-12-04T08:08:13.2424659Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:08:13.2425563Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:08:13.2426522Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:08:13.2427366Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:08:13.2428098Z  if is_canary: 2025-12-04T08:08:13.2428685Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:08:13.2429290Z  fleet_prefix = label 2025-12-04T08:08:13.2429850Z  else: 2025-12-04T08:08:13.2430510Z  prefixes.append(label) 2025-12-04T08:08:13.2431076Z  2025-12-04T08:08:13.2431478Z  if len(prefixes) > 1: 2025-12-04T08:08:13.2432000Z  log.error( 2025-12-04T08:08:13.2433153Z  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-12-04T08:08:13.2434444Z  ) 2025-12-04T08:08:13.2434905Z  prefixes = prefixes[:1] 2025-12-04T08:08:13.2435431Z  2025-12-04T08:08:13.2435853Z  # Fleet always comes first 2025-12-04T08:08:13.2436396Z  if fleet_prefix: 2025-12-04T08:08:13.2436941Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:08:13.2437514Z  2025-12-04T08:08:13.2438014Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:08:13.2438645Z  2025-12-04T08:08:13.2439022Z  2025-12-04T08:08:13.2439725Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:08:13.2440631Z  """ 2025-12-04T08:08:13.2441302Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:08:13.2442070Z  2025-12-04T08:08:13.2442695Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:08:13.2443468Z  """ 2025-12-04T08:08:13.2444013Z  gh = get_gh_client(github_token) 2025-12-04T08:08:13.2444643Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:08:13.2445355Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:08:13.2446005Z  2025-12-04T08:08:13.2446373Z  2025-12-04T08:08:13.2447030Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:08:13.2447987Z  for _ in range(num_retries): 2025-12-04T08:08:13.2448533Z  try: 2025-12-04T08:08:13.2449040Z  req = Request(url=url, headers=headers) 2025-12-04T08:08:13.2449770Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:08:13.2450481Z  return json.loads(content) 2025-12-04T08:08:13.2451059Z  except Exception as e: 2025-12-04T08:08:13.2451688Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:08:13.2452298Z  2025-12-04T08:08:13.2452921Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:08:13.2453696Z  return {} 2025-12-04T08:08:13.2454241Z  2025-12-04T08:08:13.2454620Z  2025-12-04T08:08:13.2454998Z @cache 2025-12-04T08:08:13.2455709Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:08:13.2456531Z  """ 2025-12-04T08:08:13.2456992Z  Dynamically get PR information 2025-12-04T08:08:13.2457548Z  """ 2025-12-04T08:08:13.2458112Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:08:13.2458801Z  headers = { 2025-12-04T08:08:13.2459345Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:08:13.2460033Z  "Authorization": f"token {github_token}", 2025-12-04T08:08:13.2460614Z  } 2025-12-04T08:08:13.2461129Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:08:13.2461817Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:08:13.2462417Z  headers=headers, 2025-12-04T08:08:13.2462915Z  ) 2025-12-04T08:08:13.2463309Z  2025-12-04T08:08:13.2463724Z  if not json_response: 2025-12-04T08:08:13.2464491Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:08:13.2465326Z  return {} 2025-12-04T08:08:13.2465790Z  2025-12-04T08:08:13.2466198Z  return json_response 2025-12-04T08:08:13.2466701Z  2025-12-04T08:08:13.2467076Z  2025-12-04T08:08:13.2467728Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:08:13.2468519Z  """ 2025-12-04T08:08:13.2469126Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:08:13.2469834Z  """ 2025-12-04T08:08:13.2470392Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:08:13.2471061Z  return { 2025-12-04T08:08:13.2471720Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:08:13.2472471Z  } 2025-12-04T08:08:13.2472873Z  2025-12-04T08:08:13.2473258Z  2025-12-04T08:08:13.2473659Z def main() -> None: 2025-12-04T08:08:13.2474261Z  args = parse_args() 2025-12-04T08:08:13.2474763Z  2025-12-04T08:08:13.2475236Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:08:13.2475829Z  2025-12-04T08:08:13.2476234Z  # Check if the PR is opt-out 2025-12-04T08:08:13.2476791Z  if args.pr_number: 2025-12-04T08:08:13.2477544Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:08:13.2478360Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:08:13.2478920Z  log.info( 2025-12-04T08:08:13.2479932Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:08:13.2480986Z  ) 2025-12-04T08:08:13.2481639Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:08:13.2482383Z  sys.exit() 2025-12-04T08:08:13.2483007Z  2025-12-04T08:08:13.2483402Z  try: 2025-12-04T08:08:13.2484030Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:08:13.2484832Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:08:13.2485529Z  ) 2025-12-04T08:08:13.2485940Z  2025-12-04T08:08:13.2486394Z  username = get_potential_pr_author( 2025-12-04T08:08:13.2486984Z  args.github_token, 2025-12-04T08:08:13.2487540Z  args.github_repo, 2025-12-04T08:08:13.2488121Z  args.github_actor, 2025-12-04T08:08:13.2488699Z  args.github_ref_type, 2025-12-04T08:08:13.2489268Z  args.github_branch, 2025-12-04T08:08:13.2489796Z  ) 2025-12-04T08:08:13.2490214Z  2025-12-04T08:08:13.2490754Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:08:13.2491424Z  2025-12-04T08:08:13.2491884Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:08:13.2492501Z  rollout_state, 2025-12-04T08:08:13.2493076Z  (args.github_issue_owner, username), 2025-12-04T08:08:13.2493680Z  args.github_branch, 2025-12-04T08:08:13.2494420Z  args.eligible_experiments, 2025-12-04T08:08:13.2495033Z  args.opt_out_experiments, 2025-12-04T08:08:13.2495622Z  is_canary, 2025-12-04T08:08:13.2496109Z  ) 2025-12-04T08:08:13.2496530Z  2025-12-04T08:08:13.2496937Z  except Exception as e: 2025-12-04T08:08:13.2497470Z  log.error( 2025-12-04T08:08:13.2498249Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:08:13.2499206Z  ) 2025-12-04T08:08:13.2499637Z  2025-12-04T08:08:13.2500226Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:08:13.2500947Z  2025-12-04T08:08:13.2501325Z  2025-12-04T08:08:13.2501733Z if __name__ == "__main__": 2025-12-04T08:08:13.2502239Z  main() 2025-12-04T08:08:13.2502668Z  2025-12-04T08:08:13.2503041Z EOF 2025-12-04T08:08:13.2503431Z  2025-12-04T08:08:13.2503834Z cat runner_determinator.py 2025-12-04T08:08:13.2999017Z shell: /usr/bin/bash -e {0} 2025-12-04T08:08:13.3000214Z env: 2025-12-04T08:08:13.3001257Z GITHUB_TOKEN: *** 2025-12-04T08:08:13.3001880Z ISSUE_NUMBER: 5132 2025-12-04T08:08:13.3002560Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:08:13.3003321Z ISSUE_OWNER: 2025-12-04T08:08:13.3004157Z CHECK_EXPERIMENTS: 2025-12-04T08:08:13.3004815Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:08:13.3005484Z PR_NUMBER: 2025-12-04T08:08:13.3005990Z ##[endgroup] 2025-12-04T08:08:13.3242788Z # flake8: noqa: G004 2025-12-04T08:08:13.3243154Z 2025-12-04T08:08:13.3243601Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:08:13.3244842Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:08:13.3245683Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:08:13.3246133Z 2025-12-04T08:08:13.3246304Z """ 2025-12-04T08:08:13.3246888Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:08:13.3247794Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:08:13.3248702Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:08:13.3249534Z of which runners should be used to run which job. 2025-12-04T08:08:13.3249940Z 2025-12-04T08:08:13.3250324Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:08:13.3251437Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:08:13.3252361Z settings are considered to be empty with only the second part, the user 2025-12-04T08:08:13.3253078Z list, defined. 2025-12-04T08:08:13.3253322Z 2025-12-04T08:08:13.3253692Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:08:13.3254996Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:08:13.3255852Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:08:13.3256310Z 2025-12-04T08:08:13.3256698Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:08:13.3257593Z The user list is also a comma separated list of additional features or 2025-12-04T08:08:13.3258347Z experiments which the user could be opted in to. 2025-12-04T08:08:13.3258761Z 2025-12-04T08:08:13.3258971Z The user list has the following rules: 2025-12-04T08:08:13.3259349Z 2025-12-04T08:08:13.3259678Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:08:13.3260569Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:08:13.3261391Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:08:13.3261808Z 2025-12-04T08:08:13.3261998Z Example config: 2025-12-04T08:08:13.3262467Z # A list of experiments that can be opted into. 2025-12-04T08:08:13.3263166Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:08:13.3263856Z # Expected syntax is: 2025-12-04T08:08:13.3265022Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:08:13.3266029Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:08:13.3266668Z 2025-12-04T08:08:13.3266844Z experiments: 2025-12-04T08:08:13.3267254Z lf: 2025-12-04T08:08:13.3267633Z rollout_percent: 25 2025-12-04T08:08:13.3268297Z all_branches: false 2025-12-04T08:08:13.3268758Z default: true 2025-12-04T08:08:13.3269182Z --- 2025-12-04T08:08:13.3269384Z 2025-12-04T08:08:13.3269560Z # Opt-ins: 2025-12-04T08:08:13.3270161Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:08:13.3271050Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:08:13.3271843Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:08:13.3272514Z # Experiments should be from the above list. 2025-12-04T08:08:13.3272898Z 2025-12-04T08:08:13.3273086Z @User1,-lf,split_build 2025-12-04T08:08:13.3273532Z @User2,lf 2025-12-04T08:08:13.3274094Z @User3,split_build 2025-12-04T08:08:13.3274563Z """ 2025-12-04T08:08:13.3274765Z 2025-12-04T08:08:13.3274937Z import json 2025-12-04T08:08:13.3275334Z import logging 2025-12-04T08:08:13.3275729Z import os 2025-12-04T08:08:13.3276119Z import random 2025-12-04T08:08:13.3276514Z import re 2025-12-04T08:08:13.3276906Z import sys 2025-12-04T08:08:13.3277327Z from argparse import ArgumentParser 2025-12-04T08:08:13.3277865Z from collections.abc import Iterable 2025-12-04T08:08:13.3278403Z from functools import cache 2025-12-04T08:08:13.3278907Z from logging import LogRecord 2025-12-04T08:08:13.3279429Z from typing import Any, NamedTuple 2025-12-04T08:08:13.3279977Z from urllib.request import Request, urlopen 2025-12-04T08:08:13.3280370Z 2025-12-04T08:08:13.3280546Z import yaml 2025-12-04T08:08:13.3280950Z from github import Auth, Github 2025-12-04T08:08:13.3281459Z from github.Issue import Issue 2025-12-04T08:08:13.3281771Z 2025-12-04T08:08:13.3281777Z 2025-12-04T08:08:13.3282009Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:08:13.3282707Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:08:13.3283615Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:08:13.3284484Z 2025-12-04T08:08:13.3284748Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:08:13.3285499Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:08:13.3286036Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:08:13.3286609Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:08:13.3286973Z 2025-12-04T08:08:13.3287182Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:08:13.3287522Z 2025-12-04T08:08:13.3287718Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:08:13.3288197Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:08:13.3288481Z 2025-12-04T08:08:13.3288487Z 2025-12-04T08:08:13.3288684Z class Experiment(NamedTuple): 2025-12-04T08:08:13.3289198Z rollout_perc: float = ( 2025-12-04T08:08:13.3289854Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:08:13.3290566Z ) 2025-12-04T08:08:13.3290958Z all_branches: bool = ( 2025-12-04T08:08:13.3291597Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:08:13.3292302Z ) 2025-12-04T08:08:13.3292668Z default: bool = ( 2025-12-04T08:08:13.3293257Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:08:13.3294116Z ) 2025-12-04T08:08:13.3294361Z 2025-12-04T08:08:13.3294556Z # Add more fields as needed 2025-12-04T08:08:13.3294862Z 2025-12-04T08:08:13.3294868Z 2025-12-04T08:08:13.3295063Z class Settings(NamedTuple): 2025-12-04T08:08:13.3295520Z """ 2025-12-04T08:08:13.3295990Z Settings for the experiments that can be opted into. 2025-12-04T08:08:13.3296580Z """ 2025-12-04T08:08:13.3296779Z 2025-12-04T08:08:13.3297001Z experiments: dict[str, Experiment] = {} 2025-12-04T08:08:13.3297378Z 2025-12-04T08:08:13.3297384Z 2025-12-04T08:08:13.3297600Z class ColorFormatter(logging.Formatter): 2025-12-04T08:08:13.3298238Z """Color codes the log messages based on the log level""" 2025-12-04T08:08:13.3298682Z 2025-12-04T08:08:13.3298859Z COLORS = { 2025-12-04T08:08:13.3299262Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:08:13.3300063Z "ERROR": "\033[31m", # Red 2025-12-04T08:08:13.3300586Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:08:13.3301100Z "INFO": "\033[0m", # Reset 2025-12-04T08:08:13.3301596Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:08:13.3302079Z } 2025-12-04T08:08:13.3302280Z 2025-12-04T08:08:13.3302508Z def format(self, record: LogRecord) -> str: 2025-12-04T08:08:13.3303275Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:08:13.3304326Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:08:13.3304944Z return super().format(record) 2025-12-04T08:08:13.3305290Z 2025-12-04T08:08:13.3305296Z 2025-12-04T08:08:13.3305506Z handler = logging.StreamHandler() 2025-12-04T08:08:13.3306226Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:08:13.3306801Z 2025-12-04T08:08:13.3307055Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:08:13.3307656Z log.addHandler(handler) 2025-12-04T08:08:13.3308118Z log.setLevel(logging.INFO) 2025-12-04T08:08:13.3308415Z 2025-12-04T08:08:13.3308421Z 2025-12-04T08:08:13.3308688Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:08:13.3309265Z """ 2025-12-04T08:08:13.3309788Z Defines outputs of the github action that invokes this script 2025-12-04T08:08:13.3310478Z """ 2025-12-04T08:08:13.3310865Z if not GITHUB_OUTPUT: 2025-12-04T08:08:13.3311972Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:08:13.3313151Z log.warning( 2025-12-04T08:08:13.3314277Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:08:13.3315286Z ) 2025-12-04T08:08:13.3325442Z print(f"::set-output name={key}::{value}") 2025-12-04T08:08:13.3326066Z return 2025-12-04T08:08:13.3326334Z 2025-12-04T08:08:13.3326717Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:08:13.3327326Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:08:13.3327926Z f.write(f"{key}={value}\n") 2025-12-04T08:08:13.3328256Z 2025-12-04T08:08:13.3328263Z 2025-12-04T08:08:13.3328586Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:08:13.3329230Z return frozenset( 2025-12-04T08:08:13.3329861Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:08:13.3330566Z ) 2025-12-04T08:08:13.3330773Z 2025-12-04T08:08:13.3330781Z 2025-12-04T08:08:13.3330969Z def parse_args() -> Any: 2025-12-04T08:08:13.3331532Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:08:13.3332428Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:08:13.3333215Z parser.add_argument( 2025-12-04T08:08:13.3333670Z "--github-issue-repo", 2025-12-04T08:08:13.3334561Z type=str, 2025-12-04T08:08:13.3335001Z required=False, 2025-12-04T08:08:13.3335475Z default="pytorch/test-infra", 2025-12-04T08:08:13.3336021Z help="GitHub repo to get the issue", 2025-12-04T08:08:13.3336555Z ) 2025-12-04T08:08:13.3336926Z parser.add_argument( 2025-12-04T08:08:13.3337393Z "--github-repo", 2025-12-04T08:08:13.3337839Z type=str, 2025-12-04T08:08:13.3390473Z required=True, 2025-12-04T08:08:13.3391122Z help="GitHub repo where CI is running", 2025-12-04T08:08:13.3391708Z ) 2025-12-04T08:08:13.3392110Z parser.add_argument( 2025-12-04T08:08:13.3392773Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:08:13.3393496Z ) 2025-12-04T08:08:13.3394038Z parser.add_argument( 2025-12-04T08:08:13.3394786Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:08:13.3395618Z ) 2025-12-04T08:08:13.3396019Z parser.add_argument( 2025-12-04T08:08:13.3396923Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:08:13.3397664Z ) 2025-12-04T08:08:13.3398038Z parser.add_argument( 2025-12-04T08:08:13.3398729Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:08:13.3399489Z ) 2025-12-04T08:08:13.3399878Z parser.add_argument( 2025-12-04T08:08:13.3400352Z "--github-ref-type", 2025-12-04T08:08:13.3400824Z type=str, 2025-12-04T08:08:13.3401233Z required=True, 2025-12-04T08:08:13.3401736Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:08:13.3402308Z ) 2025-12-04T08:08:13.3402697Z parser.add_argument( 2025-12-04T08:08:13.3403168Z "--eligible-experiments", 2025-12-04T08:08:13.3403694Z type=_str_comma_separated_to_set, 2025-12-04T08:08:13.3404375Z required=False, 2025-12-04T08:08:13.3404811Z default="", 2025-12-04T08:08:13.3405716Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:08:13.3406711Z ) 2025-12-04T08:08:13.3407095Z parser.add_argument( 2025-12-04T08:08:13.3407559Z "--opt-out-experiments", 2025-12-04T08:08:13.3408089Z type=_str_comma_separated_to_set, 2025-12-04T08:08:13.3408635Z required=False, 2025-12-04T08:08:13.3409059Z default="", 2025-12-04T08:08:13.3409461Z help=( 2025-12-04T08:08:13.3410185Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:08:13.3411362Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:08:13.3412220Z ), 2025-12-04T08:08:13.3412591Z ) 2025-12-04T08:08:13.3412973Z parser.add_argument( 2025-12-04T08:08:13.3413424Z "--pr-number", 2025-12-04T08:08:13.3413838Z type=str, 2025-12-04T08:08:13.3414601Z required=False, 2025-12-04T08:08:13.3415060Z default="", 2025-12-04T08:08:13.3415686Z help="the optional PR number where this is run", 2025-12-04T08:08:13.3416277Z ) 2025-12-04T08:08:13.3416487Z 2025-12-04T08:08:13.3416682Z return parser.parse_args() 2025-12-04T08:08:13.3416997Z 2025-12-04T08:08:13.3417004Z 2025-12-04T08:08:13.3417414Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:08:13.3418176Z auth = Auth.Token(github_token) 2025-12-04T08:08:13.3418695Z return Github(auth=auth) 2025-12-04T08:08:13.3418999Z 2025-12-04T08:08:13.3419006Z 2025-12-04T08:08:13.3419467Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:08:13.3420273Z repo = gh.get_repo(repo) 2025-12-04T08:08:13.3420780Z return repo.get_issue(number=issue_num) 2025-12-04T08:08:13.3421143Z 2025-12-04T08:08:13.3421149Z 2025-12-04T08:08:13.3421343Z def get_potential_pr_author( 2025-12-04T08:08:13.3421997Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:08:13.3422684Z ) -> str: 2025-12-04T08:08:13.3423213Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:08:13.3424178Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:08:13.3424934Z # embedded in the tag name: ciflow// 2025-12-04T08:08:13.3425362Z 2025-12-04T08:08:13.3425561Z gh = get_gh_client(github_token) 2025-12-04T08:08:13.3425904Z 2025-12-04T08:08:13.3426173Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:08:13.3426811Z split_tag = ref_name.split("/") 2025-12-04T08:08:13.3427316Z if ( 2025-12-04T08:08:13.3427705Z len(split_tag) == 3 2025-12-04T08:08:13.3428193Z and split_tag[0] == "ciflow" 2025-12-04T08:08:13.3428724Z and split_tag[2].isnumeric() 2025-12-04T08:08:13.3429224Z ): 2025-12-04T08:08:13.3429611Z pr_number = split_tag[2] 2025-12-04T08:08:13.3430248Z try: 2025-12-04T08:08:13.3430683Z repository = gh.get_repo(repo) 2025-12-04T08:08:13.3431303Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:08:13.3431905Z except Exception as e: 2025-12-04T08:08:13.3432436Z raise Exception( # noqa: TRY002 2025-12-04T08:08:13.3433112Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:08:13.3433757Z ) from e 2025-12-04T08:08:13.3434473Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:08:13.3435170Z # In all other cases, return the original input username 2025-12-04T08:08:13.3435774Z return username 2025-12-04T08:08:13.3436018Z 2025-12-04T08:08:13.3436024Z 2025-12-04T08:08:13.3436253Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:08:13.3436793Z """ 2025-12-04T08:08:13.3437433Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:08:13.3438225Z """ 2025-12-04T08:08:13.3438777Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:08:13.3439298Z 2025-12-04T08:08:13.3439305Z 2025-12-04T08:08:13.3439504Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:08:13.3439996Z try: 2025-12-04T08:08:13.3440390Z data = yaml.safe_load(yaml_text) 2025-12-04T08:08:13.3440907Z return data 2025-12-04T08:08:13.3441316Z except yaml.YAMLError: 2025-12-04T08:08:13.3441803Z log.exception("Error loading YAML") 2025-12-04T08:08:13.3442319Z raise 2025-12-04T08:08:13.3442535Z 2025-12-04T08:08:13.3442542Z 2025-12-04T08:08:13.3442958Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:08:13.3443741Z """ 2025-12-04T08:08:13.3444471Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:08:13.3445086Z 2025-12-04T08:08:13.3445600Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:08:13.3446380Z and the text below is the list of opted in users. 2025-12-04T08:08:13.3446798Z 2025-12-04T08:08:13.3447179Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:08:13.3447891Z """ 2025-12-04T08:08:13.3448337Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:08:13.3448969Z if len(rollout_state_parts) >= 2: 2025-12-04T08:08:13.3449576Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:08:13.3450183Z else: 2025-12-04T08:08:13.3450561Z return "", rollout_state 2025-12-04T08:08:13.3450880Z 2025-12-04T08:08:13.3450888Z 2025-12-04T08:08:13.3451097Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:08:13.3451617Z """ 2025-12-04T08:08:13.3452140Z Dictionary of users with a list of features they have opted into 2025-12-04T08:08:13.3452801Z """ 2025-12-04T08:08:13.3453001Z 2025-12-04T08:08:13.3453007Z 2025-12-04T08:08:13.3453356Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:08:13.3454295Z """ 2025-12-04T08:08:13.3455069Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:08:13.3455785Z 2025-12-04T08:08:13.3456407Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:08:13.3457423Z - Example line: "@User1,lf,split_build" 2025-12-04T08:08:13.3458103Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:08:13.3458589Z 2025-12-04T08:08:13.3458596Z 2025-12-04T08:08:13.3458762Z """ 2025-12-04T08:08:13.3459146Z optins = UserOptins() 2025-12-04T08:08:13.3459647Z for user in user_optin_text.split("\n"): 2025-12-04T08:08:13.3460208Z user = user.strip("\r\n\t -") 2025-12-04T08:08:13.3460769Z if not user or not user.startswith("@"): 2025-12-04T08:08:13.3461505Z # Not a valid user. Skip 2025-12-04T08:08:13.3462000Z continue 2025-12-04T08:08:13.3462250Z 2025-12-04T08:08:13.3462423Z if user: 2025-12-04T08:08:13.3462859Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:08:13.3463564Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:08:13.3464186Z 2025-12-04T08:08:13.3464367Z return optins 2025-12-04T08:08:13.3464612Z 2025-12-04T08:08:13.3464619Z 2025-12-04T08:08:13.3464907Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:08:13.3465513Z """ 2025-12-04T08:08:13.3465916Z Check if the experiment name is valid. 2025-12-04T08:08:13.3466441Z A valid name: 2025-12-04T08:08:13.3467091Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:08:13.3468057Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:08:13.3468797Z - Cannot contain spaces 2025-12-04T08:08:13.3469273Z """ 2025-12-04T08:08:13.3469475Z 2025-12-04T08:08:13.3469751Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:08:13.3470458Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:08:13.3470902Z 2025-12-04T08:08:13.3471079Z if valid: 2025-12-04T08:08:13.3471462Z return True 2025-12-04T08:08:13.3471712Z 2025-12-04T08:08:13.3471881Z log.error( 2025-12-04T08:08:13.3473339Z 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-12-04T08:08:13.3475070Z ) 2025-12-04T08:08:13.3475441Z return False 2025-12-04T08:08:13.3475679Z 2025-12-04T08:08:13.3475686Z 2025-12-04T08:08:13.3476000Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:08:13.3476638Z """ 2025-12-04T08:08:13.3477390Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:08:13.3478152Z """ 2025-12-04T08:08:13.3478517Z try: 2025-12-04T08:08:13.3478907Z if settings_text: 2025-12-04T08:08:13.3479636Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:08:13.3480427Z # for easy reading 2025-12-04T08:08:13.3481219Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:08:13.3482112Z # the backtick character in shell commands. 2025-12-04T08:08:13.3482725Z backtick = chr(96) # backtick character 2025-12-04T08:08:13.3483389Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:08:13.3484193Z settings = load_yaml(settings_text) 2025-12-04T08:08:13.3484578Z 2025-12-04T08:08:13.3485009Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:08:13.3485783Z experiments = {} 2025-12-04T08:08:13.3486088Z 2025-12-04T08:08:13.3486483Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:08:13.3487261Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:08:13.3488379Z # 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-12-04T08:08:13.3489429Z continue 2025-12-04T08:08:13.3489721Z 2025-12-04T08:08:13.3489908Z valid_settings = {} 2025-12-04T08:08:13.3490442Z for setting in exp_settings: 2025-12-04T08:08:13.3491017Z if setting not in Experiment._fields: 2025-12-04T08:08:13.3491585Z log.warning( 2025-12-04T08:08:13.3492306Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:08:13.3493184Z ) 2025-12-04T08:08:13.3493631Z else: 2025-12-04T08:08:13.3494471Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:08:13.3494932Z 2025-12-04T08:08:13.3495231Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:08:13.3495874Z return Settings(experiments) 2025-12-04T08:08:13.3496230Z 2025-12-04T08:08:13.3496410Z except Exception: 2025-12-04T08:08:13.3496890Z log.exception("Failed to parse settings") 2025-12-04T08:08:13.3497284Z 2025-12-04T08:08:13.3497457Z return Settings() 2025-12-04T08:08:13.3497712Z 2025-12-04T08:08:13.3497719Z 2025-12-04T08:08:13.3497977Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:08:13.3498545Z """ 2025-12-04T08:08:13.3499001Z Parse settings, if any, from the rollout state. 2025-12-04T08:08:13.3499406Z 2025-12-04T08:08:13.3499760Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:08:13.3500543Z and the text below is the list of opted in users. 2025-12-04T08:08:13.3500947Z 2025-12-04T08:08:13.3501355Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:08:13.3502106Z """ 2025-12-04T08:08:13.3502667Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:08:13.3503430Z return parse_settings_from_text(settings_text) 2025-12-04T08:08:13.3503828Z 2025-12-04T08:08:13.3503841Z 2025-12-04T08:08:13.3504228Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:08:13.3504799Z """ 2025-12-04T08:08:13.3505199Z Parse users from the rollout state. 2025-12-04T08:08:13.3505550Z 2025-12-04T08:08:13.3505712Z """ 2025-12-04T08:08:13.3506251Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:08:13.3507009Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:08:13.3507413Z 2025-12-04T08:08:13.3507420Z 2025-12-04T08:08:13.3507998Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:08:13.3508770Z """ 2025-12-04T08:08:13.3509189Z Check if a user is opted into an experiment 2025-12-04T08:08:13.3509737Z """ 2025-12-04T08:08:13.3510239Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:08:13.3510668Z 2025-12-04T08:08:13.3510674Z 2025-12-04T08:08:13.3511099Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:08:13.3511848Z """ 2025-12-04T08:08:13.3512315Z Check if a user explicitly opted out of an experiment 2025-12-04T08:08:13.3512907Z """ 2025-12-04T08:08:13.3513412Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:08:13.3514260Z experiment_optout = "-" + experiment_name 2025-12-04T08:08:13.3514911Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:08:13.3515540Z return False 2025-12-04T08:08:13.3515794Z 2025-12-04T08:08:13.3516095Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:08:13.3516694Z log.warning( 2025-12-04T08:08:13.3517507Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:08:13.3518385Z ) 2025-12-04T08:08:13.3518597Z 2025-12-04T08:08:13.3518769Z return True 2025-12-04T08:08:13.3519005Z 2025-12-04T08:08:13.3519012Z 2025-12-04T08:08:13.3519201Z def get_runner_prefix( 2025-12-04T08:08:13.3519638Z rollout_state: str, 2025-12-04T08:08:13.3520107Z workflow_requestors: Iterable[str], 2025-12-04T08:08:13.3520629Z branch: str, 2025-12-04T08:08:13.3521127Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:08:13.3521788Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:08:13.3522384Z is_canary: bool = False, 2025-12-04T08:08:13.3522840Z ) -> str: 2025-12-04T08:08:13.3523416Z settings = parse_settings(rollout_state) 2025-12-04T08:08:13.3524125Z user_optins = parse_users(rollout_state) 2025-12-04T08:08:13.3524514Z 2025-12-04T08:08:13.3524697Z fleet_prefix = "" 2025-12-04T08:08:13.3525126Z prefixes = [] 2025-12-04T08:08:13.3525752Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:08:13.3526710Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:08:13.3527423Z log.info( 2025-12-04T08:08:13.3528115Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:08:13.3528877Z ) 2025-12-04T08:08:13.3529264Z continue 2025-12-04T08:08:13.3529514Z 2025-12-04T08:08:13.3529709Z if opt_out_experiments: 2025-12-04T08:08:13.3530250Z if experiment_name in opt_out_experiments: 2025-12-04T08:08:13.3530899Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:08:13.3531493Z log.info( 2025-12-04T08:08:13.3532424Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:08:13.3533402Z ) 2025-12-04T08:08:13.3533809Z continue 2025-12-04T08:08:13.3534377Z 2025-12-04T08:08:13.3534599Z if eligible_experiments: 2025-12-04T08:08:13.3535215Z if experiment_name not in eligible_experiments: 2025-12-04T08:08:13.3535875Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:08:13.3536438Z log.info( 2025-12-04T08:08:13.3537235Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:08:13.3538067Z ) 2025-12-04T08:08:13.3538475Z continue 2025-12-04T08:08:13.3538949Z elif not experiment_settings.default: 2025-12-04T08:08:13.3539494Z log.info( 2025-12-04T08:08:13.3540312Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:08:13.3541071Z ) 2025-12-04T08:08:13.3541459Z continue 2025-12-04T08:08:13.3541706Z 2025-12-04T08:08:13.3541988Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:08:13.3542618Z opted_out_users = [ 2025-12-04T08:08:13.3543063Z requestor 2025-12-04T08:08:13.3543526Z for requestor in workflow_requestors 2025-12-04T08:08:13.3544356Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:08:13.3545001Z ] 2025-12-04T08:08:13.3545207Z 2025-12-04T08:08:13.3545394Z if opted_out_users: 2025-12-04T08:08:13.3545849Z log.info( 2025-12-04T08:08:13.3546478Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:08:13.3547195Z ) 2025-12-04T08:08:13.3547595Z continue 2025-12-04T08:08:13.3547858Z 2025-12-04T08:08:13.3548153Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:08:13.3548808Z opted_in_users = [ 2025-12-04T08:08:13.3549257Z requestor 2025-12-04T08:08:13.3549730Z for requestor in workflow_requestors 2025-12-04T08:08:13.3550406Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:08:13.3551030Z ] 2025-12-04T08:08:13.3551235Z 2025-12-04T08:08:13.3551414Z enabled = False 2025-12-04T08:08:13.3551858Z if opted_in_users: 2025-12-04T08:08:13.3552307Z log.info( 2025-12-04T08:08:13.3552909Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:08:13.3553602Z ) 2025-12-04T08:08:13.3554142Z enabled = True 2025-12-04T08:08:13.3554445Z 2025-12-04T08:08:13.3554667Z elif experiment_settings.rollout_perc: 2025-12-04T08:08:13.3555513Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:08:13.3556598Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:08:13.3557266Z log.info( 2025-12-04T08:08:13.3558129Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:08:13.3559063Z ) 2025-12-04T08:08:13.3559465Z enabled = True 2025-12-04T08:08:13.3559771Z 2025-12-04T08:08:13.3559946Z if enabled: 2025-12-04T08:08:13.3560379Z label = experiment_name 2025-12-04T08:08:13.3560931Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:08:13.3561783Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:08:13.3562676Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:08:13.3563455Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:08:13.3564263Z if is_canary: 2025-12-04T08:08:13.3564769Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:08:13.3565329Z fleet_prefix = label 2025-12-04T08:08:13.3565821Z else: 2025-12-04T08:08:13.3566256Z prefixes.append(label) 2025-12-04T08:08:13.3566606Z 2025-12-04T08:08:13.3566794Z if len(prefixes) > 1: 2025-12-04T08:08:13.3567249Z log.error( 2025-12-04T08:08:13.3568294Z 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-12-04T08:08:13.3569427Z ) 2025-12-04T08:08:13.3569820Z prefixes = prefixes[:1] 2025-12-04T08:08:13.3570130Z 2025-12-04T08:08:13.3570328Z # Fleet always comes first 2025-12-04T08:08:13.3570813Z if fleet_prefix: 2025-12-04T08:08:13.3571268Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:08:13.3571643Z 2025-12-04T08:08:13.3572023Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:08:13.3572451Z 2025-12-04T08:08:13.3572458Z 2025-12-04T08:08:13.3572908Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:08:13.3573691Z """ 2025-12-04T08:08:13.3574651Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:08:13.3575242Z 2025-12-04T08:08:13.3575642Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:08:13.3576374Z """ 2025-12-04T08:08:13.3576771Z gh = get_gh_client(github_token) 2025-12-04T08:08:13.3577324Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:08:13.3577963Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:08:13.3578424Z 2025-12-04T08:08:13.3578431Z 2025-12-04T08:08:13.3578834Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:08:13.3579610Z for _ in range(num_retries): 2025-12-04T08:08:13.3580094Z try: 2025-12-04T08:08:13.3580530Z req = Request(url=url, headers=headers) 2025-12-04T08:08:13.3581193Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:08:13.3581844Z return json.loads(content) 2025-12-04T08:08:13.3582373Z except Exception as e: 2025-12-04T08:08:13.3582918Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:08:13.3583318Z 2025-12-04T08:08:13.3583703Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:08:13.3585295Z return {} 2025-12-04T08:08:13.3585533Z 2025-12-04T08:08:13.3585540Z 2025-12-04T08:08:13.3585714Z @cache 2025-12-04T08:08:13.3586343Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:08:13.3587106Z """ 2025-12-04T08:08:13.3587501Z Dynamically get PR information 2025-12-04T08:08:13.3588201Z """ 2025-12-04T08:08:13.3588702Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:08:13.3589329Z headers = { 2025-12-04T08:08:13.3589801Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:08:13.3590405Z "Authorization": f"token {github_token}", 2025-12-04T08:08:13.3590947Z } 2025-12-04T08:08:13.3591386Z json_response: dict[str, Any] = download_json( 2025-12-04T08:08:13.3592002Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:08:13.3592549Z headers=headers, 2025-12-04T08:08:13.3592984Z ) 2025-12-04T08:08:13.3593184Z 2025-12-04T08:08:13.3593371Z if not json_response: 2025-12-04T08:08:13.3594121Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:08:13.3594760Z return {} 2025-12-04T08:08:13.3595000Z 2025-12-04T08:08:13.3595187Z return json_response 2025-12-04T08:08:13.3595466Z 2025-12-04T08:08:13.3595472Z 2025-12-04T08:08:13.3595879Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:08:13.3596618Z """ 2025-12-04T08:08:13.3597152Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:08:13.3597813Z """ 2025-12-04T08:08:13.3598304Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:08:13.3598924Z return { 2025-12-04T08:08:13.3599528Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:08:13.3600239Z } 2025-12-04T08:08:13.3600440Z 2025-12-04T08:08:13.3600446Z 2025-12-04T08:08:13.3600624Z def main() -> None: 2025-12-04T08:08:13.3601052Z args = parse_args() 2025-12-04T08:08:13.3601327Z 2025-12-04T08:08:13.3601550Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:08:13.3601940Z 2025-12-04T08:08:13.3602137Z # Check if the PR is opt-out 2025-12-04T08:08:13.3602633Z if args.pr_number: 2025-12-04T08:08:13.3603293Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:08:13.3604295Z if OPT_OUT_LABEL in labels: 2025-12-04T08:08:13.3604826Z log.info( 2025-12-04T08:08:13.3605534Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:08:13.3606305Z ) 2025-12-04T08:08:13.3606869Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:08:13.3607539Z sys.exit() 2025-12-04T08:08:13.3607810Z 2025-12-04T08:08:13.3607980Z try: 2025-12-04T08:08:13.3608422Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:08:13.3609122Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:08:13.3609766Z ) 2025-12-04T08:08:13.3609975Z 2025-12-04T08:08:13.3610234Z username = get_potential_pr_author( 2025-12-04T08:08:13.3610792Z args.github_token, 2025-12-04T08:08:13.3611272Z args.github_repo, 2025-12-04T08:08:13.3611756Z args.github_actor, 2025-12-04T08:08:13.3612244Z args.github_ref_type, 2025-12-04T08:08:13.3612752Z args.github_branch, 2025-12-04T08:08:13.3613230Z ) 2025-12-04T08:08:13.3613433Z 2025-12-04T08:08:13.3613725Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:08:13.3614284Z 2025-12-04T08:08:13.3614513Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:08:13.3615075Z rollout_state, 2025-12-04T08:08:13.3615570Z (args.github_issue_owner, username), 2025-12-04T08:08:13.3616113Z args.github_branch, 2025-12-04T08:08:13.3616609Z args.eligible_experiments, 2025-12-04T08:08:13.3617151Z args.opt_out_experiments, 2025-12-04T08:08:13.3617661Z is_canary, 2025-12-04T08:08:13.3618079Z ) 2025-12-04T08:08:13.3618282Z 2025-12-04T08:08:13.3618471Z except Exception as e: 2025-12-04T08:08:13.3618931Z log.error( 2025-12-04T08:08:13.3619604Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:08:13.3620533Z ) 2025-12-04T08:08:13.3620740Z 2025-12-04T08:08:13.3621073Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:08:13.3621576Z 2025-12-04T08:08:13.3621582Z 2025-12-04T08:08:13.3621769Z if __name__ == "__main__": 2025-12-04T08:08:13.3622210Z main() 2025-12-04T08:08:13.3622419Z 2025-12-04T08:08:13.3724169Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:08:13.3725144Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:08:13.3759616Z shell: /usr/bin/bash -e {0} 2025-12-04T08:08:13.3760118Z env: 2025-12-04T08:08:13.3760814Z GITHUB_TOKEN: *** 2025-12-04T08:08:13.3761242Z ISSUE_NUMBER: 5132 2025-12-04T08:08:13.3761687Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:08:13.3762215Z ISSUE_OWNER: 2025-12-04T08:08:13.3762617Z CHECK_EXPERIMENTS: 2025-12-04T08:08:13.3763058Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:08:13.3763510Z PR_NUMBER: 2025-12-04T08:08:13.3763900Z ##[endgroup] 2025-12-04T08:08:13.8704957Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:08:14.3345331Z Collecting urllib3==1.26.18 2025-12-04T08:08:14.3874316Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:08:14.4164274Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-12-04T08:08:14.4407517Z Collecting PyGithub==2.3.0 2025-12-04T08:08:14.4440977Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:08:14.4945531Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:08:14.4991827Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:08:14.5052806Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:08:14.5074388Z 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-12-04T08:08:14.5090276Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:08:14.5369854Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:08:14.5413177Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:08:14.5649200Z 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-12-04T08:08:14.6965259Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:08:14.7009362Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:08:14.8757686Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:08:14.8800817Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:08:14.9027124Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:08:14.9064683Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:08:14.9343731Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:08:14.9407089Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 35.8 MB/s eta 0:00:00 2025-12-04T08:08:14.9452609Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:08:14.9523038Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 71.2 MB/s eta 0:00:00 2025-12-04T08:08:14.9579839Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:08:14.9723730Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 118.6 MB/s eta 0:00:00 2025-12-04T08:08:14.9761115Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:08:14.9821287Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:08:14.9877951Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 59.4 MB/s eta 0:00:00 2025-12-04T08:08:14.9912942Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:08:14.9968521Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 35.5 MB/s eta 0:00:00 2025-12-04T08:08:15.0000127Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:08:15.0058654Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 29.8 MB/s eta 0:00:00 2025-12-04T08:08:15.3422151Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:08:15.9343454Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:08:16.0255525Z ##[group]Run curr_branch="main" 2025-12-04T08:08:16.0255878Z curr_branch="main" 2025-12-04T08:08:16.0256127Z curr_ref_type="branch" 2025-12-04T08:08:16.0256419Z echo "Current branch is '$curr_branch'" 2025-12-04T08:08:16.0256760Z  2025-12-04T08:08:16.0256970Z python3 runner_determinator.py \ 2025-12-04T08:08:16.0257285Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:08:16.0257592Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:08:16.0257891Z  --github-branch "$curr_branch" \ 2025-12-04T08:08:16.0258195Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:08:16.0258536Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:08:16.0258896Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:08:16.0259207Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:08:16.0259569Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:08:16.0259984Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:08:16.0260321Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:08:16.0295915Z shell: /usr/bin/bash -e {0} 2025-12-04T08:08:16.0296196Z env: 2025-12-04T08:08:16.0296861Z GITHUB_TOKEN: *** 2025-12-04T08:08:16.0297094Z ISSUE_NUMBER: 5132 2025-12-04T08:08:16.0297344Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:08:16.0297619Z ISSUE_OWNER: 2025-12-04T08:08:16.0297834Z CHECK_EXPERIMENTS: 2025-12-04T08:08:16.0298064Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:08:16.0298293Z PR_NUMBER: 2025-12-04T08:08:16.0298486Z ##[endgroup] 2025-12-04T08:08:16.0359397Z Current branch is 'main' 2025-12-04T08:08:17.7498523Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:08:17.7499393Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:08:17.7500013Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:08:17.7500573Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:08:17.7501027Z INFO : Setting output: label-type='lf.' 2025-12-04T08:08:17.7849378Z Evaluate and set job outputs 2025-12-04T08:08:17.7856061Z Set output 'label-type' 2025-12-04T08:08:17.7857886Z Cleaning up orphan processes