2025-09-07T07:05:27.0250101Z Current runner version: '2.328.0' 2025-09-07T07:05:27.0275062Z ##[group]Runner Image Provisioner 2025-09-07T07:05:27.0275838Z Hosted Compute Agent 2025-09-07T07:05:27.0276365Z Version: 20250829.383 2025-09-07T07:05:27.0277074Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T07:05:27.0277945Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T07:05:27.0278564Z ##[endgroup] 2025-09-07T07:05:27.0279103Z ##[group]Operating System 2025-09-07T07:05:27.0279693Z Ubuntu 2025-09-07T07:05:27.0280139Z 24.04.3 2025-09-07T07:05:27.0280657Z LTS 2025-09-07T07:05:27.0281158Z ##[endgroup] 2025-09-07T07:05:27.0281658Z ##[group]Runner Image 2025-09-07T07:05:27.0282252Z Image: ubuntu-24.04 2025-09-07T07:05:27.0282730Z Version: 20250831.1.0 2025-09-07T07:05:27.0283739Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T07:05:27.0285432Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T07:05:27.0286402Z ##[endgroup] 2025-09-07T07:05:27.0287424Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T07:05:27.0289668Z Contents: read 2025-09-07T07:05:27.0290306Z Metadata: read 2025-09-07T07:05:27.0290814Z ##[endgroup] 2025-09-07T07:05:27.0293148Z Secret source: Actions 2025-09-07T07:05:27.0293929Z Prepare workflow directory 2025-09-07T07:05:27.0788197Z Prepare all required actions 2025-09-07T07:05:27.0845166Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T07:05:27.0850235Z ##[group] Inputs 2025-09-07T07:05:27.0850884Z check_experiments: 2025-09-07T07:05:27.0851558Z opt_out_experiments: lf 2025-09-07T07:05:27.0852145Z triggering_actor: desertfire 2025-09-07T07:05:27.0852685Z issue_owner: 2025-09-07T07:05:27.0853248Z curr_branch: main 2025-09-07T07:05:27.0853741Z curr_ref_type: branch 2025-09-07T07:05:27.0854387Z issue_number: 5132 2025-09-07T07:05:27.0855005Z ##[endgroup] 2025-09-07T07:05:27.0855598Z Complete job name: get-label-type / runner-determinator 2025-09-07T07:05:27.6102716Z ##[group]Run cat < runner_determinator.py 2025-09-07T07:05:27.6105251Z cat < runner_determinator.py 2025-09-07T07:05:27.6106031Z # flake8: noqa: G004 2025-09-07T07:05:27.6106630Z  2025-09-07T07:05:27.6107417Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:05:27.6108830Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:05:27.6109866Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:05:27.6110603Z  2025-09-07T07:05:27.6111141Z """ 2025-09-07T07:05:27.6111882Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:05:27.6112955Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:05:27.6114215Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:05:27.6115223Z of which runners should be used to run which job. 2025-09-07T07:05:27.6115925Z  2025-09-07T07:05:27.6116750Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:05:27.6118034Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:05:27.6119105Z settings are considered to be empty with only the second part, the user 2025-09-07T07:05:27.6120160Z list, defined. 2025-09-07T07:05:27.6120683Z  2025-09-07T07:05:27.6121390Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:05:27.6122571Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:05:27.6123573Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:05:27.6124325Z  2025-09-07T07:05:27.6125399Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:05:27.6126480Z The user list is also a comma separated list of additional features or 2025-09-07T07:05:27.6127398Z experiments which the user could be opted in to. 2025-09-07T07:05:27.6128451Z  2025-09-07T07:05:27.6129078Z The user list has the following rules: 2025-09-07T07:05:27.6129703Z  2025-09-07T07:05:27.6130494Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:05:27.6131514Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:05:27.6132474Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:05:27.6133222Z  2025-09-07T07:05:27.6133691Z Example config: 2025-09-07T07:05:27.6134342Z  # A list of experiments that can be opted into. 2025-09-07T07:05:27.6135221Z  # This defines the behavior they'll induce when opted into. 2025-09-07T07:05:27.6136046Z  # Expected syntax is: 2025-09-07T07:05:27.6136853Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:05:27.6138167Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:05:27.6139131Z  2025-09-07T07:05:27.6139589Z  experiments: 2025-09-07T07:05:27.6140214Z  lf: 2025-09-07T07:05:27.6140733Z  rollout_percent: 25 2025-09-07T07:05:27.6141371Z  all_branches: false 2025-09-07T07:05:27.6142027Z  default: true 2025-09-07T07:05:27.6142591Z  --- 2025-09-07T07:05:27.6143103Z  2025-09-07T07:05:27.6143568Z  # Opt-ins: 2025-09-07T07:05:27.6144422Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:05:27.6145631Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:05:27.6146639Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:05:27.6147575Z  # Experiments should be from the above list. 2025-09-07T07:05:27.6148407Z  2025-09-07T07:05:27.6148925Z  @User1,-lf,split_build 2025-09-07T07:05:27.6149591Z  @User2,lf 2025-09-07T07:05:27.6150166Z  @User3,split_build 2025-09-07T07:05:27.6150731Z """ 2025-09-07T07:05:27.6151285Z  2025-09-07T07:05:27.6151822Z import json 2025-09-07T07:05:27.6152340Z import logging 2025-09-07T07:05:27.6152959Z import os 2025-09-07T07:05:27.6153470Z import random 2025-09-07T07:05:27.6154022Z import re 2025-09-07T07:05:27.6228433Z import sys 2025-09-07T07:05:27.6229129Z from argparse import ArgumentParser 2025-09-07T07:05:27.6229848Z from collections.abc import Iterable 2025-09-07T07:05:27.6230495Z from functools import cache 2025-09-07T07:05:27.6231060Z from logging import LogRecord 2025-09-07T07:05:27.6231676Z from typing import Any, NamedTuple 2025-09-07T07:05:27.6232309Z from urllib.request import Request, urlopen 2025-09-07T07:05:27.6232911Z  2025-09-07T07:05:27.6233307Z import yaml 2025-09-07T07:05:27.6233787Z from github import Auth, Github 2025-09-07T07:05:27.6234364Z from github.Issue import Issue 2025-09-07T07:05:27.6234889Z  2025-09-07T07:05:27.6235273Z  2025-09-07T07:05:27.6235748Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:05:27.6236540Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:05:27.6237530Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:05:27.6238479Z  2025-09-07T07:05:27.6239215Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:05:27.6239879Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:05:27.6240488Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:05:27.6241179Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:05:27.6241791Z  2025-09-07T07:05:27.6242231Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:05:27.6242780Z  2025-09-07T07:05:27.6243197Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:05:27.6243738Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:05:27.6244238Z  2025-09-07T07:05:27.6244610Z  2025-09-07T07:05:27.6245031Z class Experiment(NamedTuple): 2025-09-07T07:05:27.6245598Z  rollout_perc: float = ( 2025-09-07T07:05:27.6246351Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:05:27.6247096Z  ) 2025-09-07T07:05:27.6247533Z  all_branches: bool = ( 2025-09-07T07:05:27.6248515Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:05:27.6249262Z  ) 2025-09-07T07:05:27.6249679Z  default: bool = ( 2025-09-07T07:05:27.6250352Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T07:05:27.6251058Z  ) 2025-09-07T07:05:27.6251457Z  2025-09-07T07:05:27.6251868Z  # Add more fields as needed 2025-09-07T07:05:27.6252394Z  2025-09-07T07:05:27.6252776Z  2025-09-07T07:05:27.6253193Z class Settings(NamedTuple): 2025-09-07T07:05:27.6253754Z  """ 2025-09-07T07:05:27.6254335Z  Settings for the experiments that can be opted into. 2025-09-07T07:05:27.6254997Z  """ 2025-09-07T07:05:27.6255412Z  2025-09-07T07:05:27.6255859Z  experiments: dict[str, Experiment] = {} 2025-09-07T07:05:27.6256424Z  2025-09-07T07:05:27.6256937Z  2025-09-07T07:05:27.6257412Z class ColorFormatter(logging.Formatter): 2025-09-07T07:05:27.6258241Z  """Color codes the log messages based on the log level""" 2025-09-07T07:05:27.6258889Z  2025-09-07T07:05:27.6259281Z  COLORS = { 2025-09-07T07:05:27.6259771Z  "WARNING": "\033[33m", # Yellow 2025-09-07T07:05:27.6260367Z  "ERROR": "\033[31m", # Red 2025-09-07T07:05:27.6260936Z  "CRITICAL": "\033[31m", # Red 2025-09-07T07:05:27.6261513Z  "INFO": "\033[0m", # Reset 2025-09-07T07:05:27.6262073Z  "DEBUG": "\033[0m", # Reset 2025-09-07T07:05:27.6262596Z  } 2025-09-07T07:05:27.6262984Z  2025-09-07T07:05:27.6263450Z  def format(self, record: LogRecord) -> str: 2025-09-07T07:05:27.6264292Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:05:27.6265157Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:05:27.6265800Z  return super().format(record) 2025-09-07T07:05:27.6266349Z  2025-09-07T07:05:27.6266721Z  2025-09-07T07:05:27.6267137Z handler = logging.StreamHandler() 2025-09-07T07:05:27.6268049Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:05:27.6268838Z  2025-09-07T07:05:27.6269347Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:05:27.6270000Z log.addHandler(handler) 2025-09-07T07:05:27.6270537Z log.setLevel(logging.INFO) 2025-09-07T07:05:27.6271050Z  2025-09-07T07:05:27.6271423Z  2025-09-07T07:05:27.6271932Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:05:27.6272563Z  """ 2025-09-07T07:05:27.6273156Z  Defines outputs of the github action that invokes this script 2025-09-07T07:05:27.6273992Z  """ 2025-09-07T07:05:27.6274424Z  if not GITHUB_OUTPUT: 2025-09-07T07:05:27.6275596Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:05:27.6276804Z  log.warning( 2025-09-07T07:05:27.6277920Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:05:27.6278931Z  ) 2025-09-07T07:05:27.6279439Z  print(f"::set-output name={key}::{value}") 2025-09-07T07:05:27.6280037Z  return 2025-09-07T07:05:27.6280472Z  2025-09-07T07:05:27.6280904Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:05:27.6281552Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:05:27.6282189Z  f.write(f"{key}={value}\n") 2025-09-07T07:05:27.6282732Z  2025-09-07T07:05:27.6283116Z  2025-09-07T07:05:27.6283691Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:05:27.6284426Z  return frozenset( 2025-09-07T07:05:27.6285148Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:05:27.6285891Z  ) 2025-09-07T07:05:27.6286313Z  2025-09-07T07:05:27.6286687Z  2025-09-07T07:05:27.6287093Z def parse_args() -> Any: 2025-09-07T07:05:27.6287873Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:05:27.6288847Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:05:27.6289691Z  parser.add_argument( 2025-09-07T07:05:27.6290247Z  "--github-issue-repo", 2025-09-07T07:05:27.6290794Z  type=str, 2025-09-07T07:05:27.6291278Z  required=False, 2025-09-07T07:05:27.6291957Z  default="pytorch/test-infra", 2025-09-07T07:05:27.6292603Z  help="GitHub repo to get the issue", 2025-09-07T07:05:27.6293175Z  ) 2025-09-07T07:05:27.6293610Z  parser.add_argument( 2025-09-07T07:05:27.6294138Z  "--github-repo", 2025-09-07T07:05:27.6294658Z  type=str, 2025-09-07T07:05:27.6295151Z  required=True, 2025-09-07T07:05:27.6295716Z  help="GitHub repo where CI is running", 2025-09-07T07:05:27.6296306Z  ) 2025-09-07T07:05:27.6296745Z  parser.add_argument( 2025-09-07T07:05:27.6297461Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:05:27.6298294Z  ) 2025-09-07T07:05:27.6298741Z  parser.add_argument( 2025-09-07T07:05:27.6299473Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:05:27.6300236Z  ) 2025-09-07T07:05:27.6300670Z  parser.add_argument( 2025-09-07T07:05:27.6301420Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:05:27.6302176Z  ) 2025-09-07T07:05:27.6302606Z  parser.add_argument( 2025-09-07T07:05:27.6303380Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:05:27.6304153Z  ) 2025-09-07T07:05:27.6304607Z  parser.add_argument( 2025-09-07T07:05:27.6305141Z  "--github-ref-type", 2025-09-07T07:05:27.6305684Z  type=str, 2025-09-07T07:05:27.6306171Z  required=True, 2025-09-07T07:05:27.6306770Z  help="Current GitHub ref type, branch or tag", 2025-09-07T07:05:27.6307383Z  ) 2025-09-07T07:05:27.6307901Z  parser.add_argument( 2025-09-07T07:05:27.6308456Z  "--eligible-experiments", 2025-09-07T07:05:27.6309210Z  type=_str_comma_separated_to_set, 2025-09-07T07:05:27.6309798Z  required=False, 2025-09-07T07:05:27.6310316Z  default="", 2025-09-07T07:05:27.6311279Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:05:27.6312277Z  ) 2025-09-07T07:05:27.6312716Z  parser.add_argument( 2025-09-07T07:05:27.6313255Z  "--opt-out-experiments", 2025-09-07T07:05:27.6313857Z  type=_str_comma_separated_to_set, 2025-09-07T07:05:27.6314437Z  required=False, 2025-09-07T07:05:27.6314942Z  default="", 2025-09-07T07:05:27.6315425Z  help=( 2025-09-07T07:05:27.6316191Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:05:27.6317434Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:05:27.6318481Z  ), 2025-09-07T07:05:27.6318919Z  ) 2025-09-07T07:05:27.6319346Z  parser.add_argument( 2025-09-07T07:05:27.6319904Z  "--pr-number", 2025-09-07T07:05:27.6320409Z  type=str, 2025-09-07T07:05:27.6320897Z  required=False, 2025-09-07T07:05:27.6321407Z  default="", 2025-09-07T07:05:27.6321990Z  help="the optional PR number where this is run", 2025-09-07T07:05:27.6322609Z  ) 2025-09-07T07:05:27.6323016Z  2025-09-07T07:05:27.6323448Z  return parser.parse_args() 2025-09-07T07:05:27.6323981Z  2025-09-07T07:05:27.6324362Z  2025-09-07T07:05:27.6325021Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:05:27.6325984Z  auth = Auth.Token(github_token) 2025-09-07T07:05:27.6326591Z  return Github(auth=auth) 2025-09-07T07:05:27.6327115Z  2025-09-07T07:05:27.6327489Z  2025-09-07T07:05:27.6328472Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:05:27.6329359Z  repo = gh.get_repo(repo) 2025-09-07T07:05:27.6329955Z  return repo.get_issue(number=issue_num) 2025-09-07T07:05:27.6330542Z  2025-09-07T07:05:27.6330916Z  2025-09-07T07:05:27.6331331Z def get_potential_pr_author( 2025-09-07T07:05:27.6332083Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:05:27.6332820Z ) -> str: 2025-09-07T07:05:27.6333430Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:05:27.6334327Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:05:27.6335183Z  # embedded in the tag name: ciflow// 2025-09-07T07:05:27.6335812Z  2025-09-07T07:05:27.6336237Z  gh = get_gh_client(github_token) 2025-09-07T07:05:27.6336786Z  2025-09-07T07:05:27.6337311Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:05:27.6338183Z  split_tag = ref_name.split("/") 2025-09-07T07:05:27.6338760Z  if ( 2025-09-07T07:05:27.6339233Z  len(split_tag) == 3 2025-09-07T07:05:27.6339799Z  and split_tag[0] == "ciflow" 2025-09-07T07:05:27.6340400Z  and split_tag[2].isnumeric() 2025-09-07T07:05:27.6340958Z  ): 2025-09-07T07:05:27.6341423Z  pr_number = split_tag[2] 2025-09-07T07:05:27.6341976Z  try: 2025-09-07T07:05:27.6342488Z  repository = gh.get_repo(repo) 2025-09-07T07:05:27.6343342Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:05:27.6344025Z  except Exception as e: 2025-09-07T07:05:27.6344624Z  raise Exception( # noqa: TRY002 2025-09-07T07:05:27.6345380Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:05:27.6346089Z  ) from e 2025-09-07T07:05:27.6346740Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:05:27.6347522Z  # In all other cases, return the original input username 2025-09-07T07:05:27.6348301Z  return username 2025-09-07T07:05:27.6348778Z  2025-09-07T07:05:27.6349168Z  2025-09-07T07:05:27.6349773Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:05:27.6350652Z  """ 2025-09-07T07:05:27.6351410Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:05:27.6352268Z  """ 2025-09-07T07:05:27.6352897Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:05:27.6353623Z  2025-09-07T07:05:27.6354010Z  2025-09-07T07:05:27.6354446Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:05:27.6355024Z  try: 2025-09-07T07:05:27.6355487Z  data = yaml.safe_load(yaml_text) 2025-09-07T07:05:27.6356058Z  return data 2025-09-07T07:05:27.6356563Z  except yaml.YAMLError: 2025-09-07T07:05:27.6357135Z  log.exception("Error loading YAML") 2025-09-07T07:05:27.6357881Z  raise 2025-09-07T07:05:27.6358325Z  2025-09-07T07:05:27.6358705Z  2025-09-07T07:05:27.6359382Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:05:27.6360193Z  """ 2025-09-07T07:05:27.6361053Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:05:27.6361884Z  2025-09-07T07:05:27.6362488Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:05:27.6363341Z  and the text below is the list of opted in users. 2025-09-07T07:05:27.6363954Z  2025-09-07T07:05:27.6364580Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:05:27.6365335Z  """ 2025-09-07T07:05:27.6365857Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T07:05:27.6366528Z  if len(rollout_state_parts) >= 2: 2025-09-07T07:05:27.6367223Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:05:27.6367977Z  else: 2025-09-07T07:05:27.6368438Z  return "", rollout_state 2025-09-07T07:05:27.6368966Z  2025-09-07T07:05:27.6369419Z  2025-09-07T07:05:27.6370033Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:05:27.6370600Z  """ 2025-09-07T07:05:27.6371196Z  Dictionary of users with a list of features they have opted into 2025-09-07T07:05:27.6371901Z  """ 2025-09-07T07:05:27.6372301Z  2025-09-07T07:05:27.6372665Z  2025-09-07T07:05:27.6373250Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:05:27.6373971Z  """ 2025-09-07T07:05:27.6374770Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:05:27.6375661Z  2025-09-07T07:05:27.6376526Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:05:27.6377608Z  - Example line: "@User1,lf,split_build" 2025-09-07T07:05:27.6378627Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:05:27.6379319Z  2025-09-07T07:05:27.6379695Z  2025-09-07T07:05:27.6380064Z  """ 2025-09-07T07:05:27.6380499Z  optins = UserOptins() 2025-09-07T07:05:27.6381071Z  for user in user_optin_text.split("\n"): 2025-09-07T07:05:27.6381701Z  user = user.strip("\r\n\t -") 2025-09-07T07:05:27.6382325Z  if not user or not user.startswith("@"): 2025-09-07T07:05:27.6382936Z  # Not a valid user. Skip 2025-09-07T07:05:27.6383483Z  continue 2025-09-07T07:05:27.6383948Z  2025-09-07T07:05:27.6384325Z  if user: 2025-09-07T07:05:27.6384856Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T07:05:27.6385619Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:05:27.6386337Z  2025-09-07T07:05:27.6386746Z  return optins 2025-09-07T07:05:27.6387210Z  2025-09-07T07:05:27.6387573Z  2025-09-07T07:05:27.6388215Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:05:27.6388883Z  """ 2025-09-07T07:05:27.6389346Z  Check if the experiment name is valid. 2025-09-07T07:05:27.6389929Z  A valid name: 2025-09-07T07:05:27.6390671Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:05:27.6391681Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:05:27.6392450Z  - Cannot contain spaces 2025-09-07T07:05:27.6392976Z  """ 2025-09-07T07:05:27.6393372Z  2025-09-07T07:05:27.6393883Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:05:27.6394664Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:05:27.6395437Z  2025-09-07T07:05:27.6395822Z  if valid: 2025-09-07T07:05:27.6396280Z  return True 2025-09-07T07:05:27.6396737Z  2025-09-07T07:05:27.6397122Z  log.error( 2025-09-07T07:05:27.6398828Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T07:05:27.6400464Z  ) 2025-09-07T07:05:27.6400877Z  return False 2025-09-07T07:05:27.6401332Z  2025-09-07T07:05:27.6401710Z  2025-09-07T07:05:27.6402279Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:05:27.6402972Z  """ 2025-09-07T07:05:27.6403637Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:05:27.6404406Z  """ 2025-09-07T07:05:27.6404813Z  try: 2025-09-07T07:05:27.6405236Z  if settings_text: 2025-09-07T07:05:27.6406056Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:05:27.6406916Z  # for easy reading 2025-09-07T07:05:27.6408107Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:05:27.6409085Z  # the backtick character in shell commands. 2025-09-07T07:05:27.6409757Z  backtick = chr(96) # backtick character 2025-09-07T07:05:27.6410519Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:05:27.6411259Z  settings = load_yaml(settings_text) 2025-09-07T07:05:27.6411818Z  2025-09-07T07:05:27.6412482Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:05:27.6413438Z  experiments = {} 2025-09-07T07:05:27.6413951Z  2025-09-07T07:05:27.6414569Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:05:27.6415402Z  if not is_valid_experiment_name(exp_name): 2025-09-07T07:05:27.6416584Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T07:05:27.6417883Z  continue 2025-09-07T07:05:27.6418392Z  2025-09-07T07:05:27.6418806Z  valid_settings = {} 2025-09-07T07:05:27.6419408Z  for setting in exp_settings: 2025-09-07T07:05:27.6420078Z  if setting not in Experiment._fields: 2025-09-07T07:05:27.6420695Z  log.warning( 2025-09-07T07:05:27.6421499Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:05:27.6422270Z  ) 2025-09-07T07:05:27.6422768Z  else: 2025-09-07T07:05:27.6423376Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T07:05:27.6424009Z  2025-09-07T07:05:27.6424527Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:05:27.6425234Z  return Settings(experiments) 2025-09-07T07:05:27.6425787Z  2025-09-07T07:05:27.6426187Z  except Exception: 2025-09-07T07:05:27.6426759Z  log.exception("Failed to parse settings") 2025-09-07T07:05:27.6427341Z  2025-09-07T07:05:27.6427834Z  return Settings() 2025-09-07T07:05:27.6428313Z  2025-09-07T07:05:27.6428683Z  2025-09-07T07:05:27.6429326Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:05:27.6429964Z  """ 2025-09-07T07:05:27.6430471Z  Parse settings, if any, from the rollout state. 2025-09-07T07:05:27.6431067Z  2025-09-07T07:05:27.6431659Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:05:27.6432490Z  and the text below is the list of opted in users. 2025-09-07T07:05:27.6433095Z  2025-09-07T07:05:27.6433747Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:05:27.6434523Z  """ 2025-09-07T07:05:27.6435150Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:05:27.6435992Z  return parse_settings_from_text(settings_text) 2025-09-07T07:05:27.6436593Z  2025-09-07T07:05:27.6436954Z  2025-09-07T07:05:27.6437460Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:05:27.6438607Z  """ 2025-09-07T07:05:27.6439102Z  Parse users from the rollout state. 2025-09-07T07:05:27.6439667Z  2025-09-07T07:05:27.6440040Z  """ 2025-09-07T07:05:27.6440651Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:05:27.6441472Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T07:05:27.6442106Z  2025-09-07T07:05:27.6442509Z  2025-09-07T07:05:27.6443221Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:05:27.6444018Z  """ 2025-09-07T07:05:27.6444504Z  Check if a user is opted into an experiment 2025-09-07T07:05:27.6445081Z  """ 2025-09-07T07:05:27.6445609Z  return experiment_name in user_optins.get(user, []) 2025-09-07T07:05:27.6446238Z  2025-09-07T07:05:27.6446809Z  2025-09-07T07:05:27.6447487Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:05:27.6448463Z  """ 2025-09-07T07:05:27.6449010Z  Check if a user explicitly opted out of an experiment 2025-09-07T07:05:27.6449641Z  """ 2025-09-07T07:05:27.6450216Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:05:27.6450986Z  experiment_optout = "-" + experiment_name 2025-09-07T07:05:27.6451730Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:05:27.6452420Z  return False 2025-09-07T07:05:27.6452883Z  2025-09-07T07:05:27.6453399Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:05:27.6454051Z  log.warning( 2025-09-07T07:05:27.6454940Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:05:27.6455861Z  ) 2025-09-07T07:05:27.6456270Z  2025-09-07T07:05:27.6456656Z  return True 2025-09-07T07:05:27.6457105Z  2025-09-07T07:05:27.6457477Z  2025-09-07T07:05:27.6457974Z def get_runner_prefix( 2025-09-07T07:05:27.6458488Z  rollout_state: str, 2025-09-07T07:05:27.6459033Z  workflow_requestors: Iterable[str], 2025-09-07T07:05:27.6459597Z  branch: str, 2025-09-07T07:05:27.6460184Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:05:27.6460927Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:05:27.6461563Z  is_canary: bool = False, 2025-09-07T07:05:27.6462073Z ) -> str: 2025-09-07T07:05:27.6462571Z  settings = parse_settings(rollout_state) 2025-09-07T07:05:27.6463211Z  user_optins = parse_users(rollout_state) 2025-09-07T07:05:27.6463772Z  2025-09-07T07:05:27.6464306Z  fleet_prefix = "" 2025-09-07T07:05:27.6464803Z  prefixes = [] 2025-09-07T07:05:27.6465522Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:05:27.6466532Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:05:27.6467298Z  log.info( 2025-09-07T07:05:27.6468166Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:05:27.6468972Z  ) 2025-09-07T07:05:27.6469479Z  continue 2025-09-07T07:05:27.6469929Z  2025-09-07T07:05:27.6470336Z  if opt_out_experiments: 2025-09-07T07:05:27.6470945Z  if experiment_name in opt_out_experiments: 2025-09-07T07:05:27.6471665Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:05:27.6472316Z  log.info( 2025-09-07T07:05:27.6473321Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:05:27.6474357Z  ) 2025-09-07T07:05:27.6474821Z  continue 2025-09-07T07:05:27.6475302Z  2025-09-07T07:05:27.6475721Z  if eligible_experiments: 2025-09-07T07:05:27.6476356Z  if experiment_name not in eligible_experiments: 2025-09-07T07:05:27.6477054Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T07:05:27.6477668Z  log.info( 2025-09-07T07:05:27.6478639Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:05:27.6479533Z  ) 2025-09-07T07:05:27.6480010Z  continue 2025-09-07T07:05:27.6480709Z  elif not experiment_settings.default: 2025-09-07T07:05:27.6481294Z  log.info( 2025-09-07T07:05:27.6482079Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:05:27.6482859Z  ) 2025-09-07T07:05:27.6483291Z  continue 2025-09-07T07:05:27.6483740Z  2025-09-07T07:05:27.6484260Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:05:27.6484931Z  opted_out_users = [ 2025-09-07T07:05:27.6485439Z  requestor 2025-09-07T07:05:27.6485975Z  for requestor in workflow_requestors 2025-09-07T07:05:27.6486706Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:05:27.6487384Z  ] 2025-09-07T07:05:27.6487886Z  2025-09-07T07:05:27.6488297Z  if opted_out_users: 2025-09-07T07:05:27.6488846Z  log.info( 2025-09-07T07:05:27.6489545Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:05:27.6490286Z  ) 2025-09-07T07:05:27.6490723Z  continue 2025-09-07T07:05:27.6491185Z  2025-09-07T07:05:27.6491691Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:05:27.6492354Z  opted_in_users = [ 2025-09-07T07:05:27.6492879Z  requestor 2025-09-07T07:05:27.6493430Z  for requestor in workflow_requestors 2025-09-07T07:05:27.6494168Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:05:27.6494829Z  ] 2025-09-07T07:05:27.6495237Z  2025-09-07T07:05:27.6495624Z  enabled = False 2025-09-07T07:05:27.6496165Z  if opted_in_users: 2025-09-07T07:05:27.6496836Z  log.info( 2025-09-07T07:05:27.6497561Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:05:27.6498399Z  ) 2025-09-07T07:05:27.6498848Z  enabled = True 2025-09-07T07:05:27.6499340Z  2025-09-07T07:05:27.6499786Z  elif experiment_settings.rollout_perc: 2025-09-07T07:05:27.6500696Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:05:27.6501698Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:05:27.6502418Z  log.info( 2025-09-07T07:05:27.6503388Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:05:27.6504361Z  ) 2025-09-07T07:05:27.6504852Z  enabled = True 2025-09-07T07:05:27.6505368Z  2025-09-07T07:05:27.6505757Z  if enabled: 2025-09-07T07:05:27.6506259Z  label = experiment_name 2025-09-07T07:05:27.6506879Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:05:27.6507868Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:05:27.6508813Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T07:05:27.6509637Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:05:27.6510348Z  if is_canary: 2025-09-07T07:05:27.6510922Z  label += CANARY_FLEET_SUFFIX 2025-09-07T07:05:27.6511529Z  fleet_prefix = label 2025-09-07T07:05:27.6512066Z  else: 2025-09-07T07:05:27.6512758Z  prefixes.append(label) 2025-09-07T07:05:27.6513340Z  2025-09-07T07:05:27.6513778Z  if len(prefixes) > 1: 2025-09-07T07:05:27.6514322Z  log.error( 2025-09-07T07:05:27.6515497Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T07:05:27.6516712Z  ) 2025-09-07T07:05:27.6517158Z  prefixes = prefixes[:1] 2025-09-07T07:05:27.6517687Z  2025-09-07T07:05:27.6518190Z  # Fleet always comes first 2025-09-07T07:05:27.6518726Z  if fleet_prefix: 2025-09-07T07:05:27.6519251Z  prefixes.insert(0, fleet_prefix) 2025-09-07T07:05:27.6519841Z  2025-09-07T07:05:27.6520336Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:05:27.6520945Z  2025-09-07T07:05:27.6521319Z  2025-09-07T07:05:27.6522002Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:05:27.6522824Z  """ 2025-09-07T07:05:27.6523469Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:05:27.6524219Z  2025-09-07T07:05:27.6524838Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:05:27.6525583Z  """ 2025-09-07T07:05:27.6526032Z  gh = get_gh_client(github_token) 2025-09-07T07:05:27.6526641Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T07:05:27.6527353Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:05:27.6528122Z  2025-09-07T07:05:27.6528493Z  2025-09-07T07:05:27.6529134Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:05:27.6530088Z  for _ in range(num_retries): 2025-09-07T07:05:27.6530640Z  try: 2025-09-07T07:05:27.6531140Z  req = Request(url=url, headers=headers) 2025-09-07T07:05:27.6531871Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:05:27.6532569Z  return json.loads(content) 2025-09-07T07:05:27.6533157Z  except Exception as e: 2025-09-07T07:05:27.6533769Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T07:05:27.6534370Z  2025-09-07T07:05:27.6535001Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:05:27.6535759Z  return {} 2025-09-07T07:05:27.6536229Z  2025-09-07T07:05:27.6536628Z  2025-09-07T07:05:27.6537035Z @cache 2025-09-07T07:05:27.6537856Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:05:27.6538678Z  """ 2025-09-07T07:05:27.6539205Z  Dynamically get PR information 2025-09-07T07:05:27.6539747Z  """ 2025-09-07T07:05:27.6540306Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:05:27.6540976Z  headers = { 2025-09-07T07:05:27.6541516Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T07:05:27.6542181Z  "Authorization": f"token {github_token}", 2025-09-07T07:05:27.6542756Z  } 2025-09-07T07:05:27.6543255Z  json_response: dict[str, Any] = download_json( 2025-09-07T07:05:27.6543951Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:05:27.6544578Z  headers=headers, 2025-09-07T07:05:27.6545104Z  ) 2025-09-07T07:05:27.6545530Z  2025-09-07T07:05:27.6545960Z  if not json_response: 2025-09-07T07:05:27.6546656Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:05:27.6547496Z  return {} 2025-09-07T07:05:27.6548068Z  2025-09-07T07:05:27.6548470Z  return json_response 2025-09-07T07:05:27.6548957Z  2025-09-07T07:05:27.6549326Z  2025-09-07T07:05:27.6549971Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:05:27.6550750Z  """ 2025-09-07T07:05:27.6551354Z  Dynamically get the latest list of labels from the pull request 2025-09-07T07:05:27.6552061Z  """ 2025-09-07T07:05:27.6552612Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:05:27.6553276Z  return { 2025-09-07T07:05:27.6553944Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:05:27.6554721Z  } 2025-09-07T07:05:27.6555160Z  2025-09-07T07:05:27.6555552Z  2025-09-07T07:05:27.6555968Z def main() -> None: 2025-09-07T07:05:27.6556461Z  args = parse_args() 2025-09-07T07:05:27.6556953Z  2025-09-07T07:05:27.6557419Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:05:27.6558227Z  2025-09-07T07:05:27.6558658Z  # Check if the PR is opt-out 2025-09-07T07:05:27.6559221Z  if args.pr_number: 2025-09-07T07:05:27.6559990Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:05:27.6560810Z  if OPT_OUT_LABEL in labels: 2025-09-07T07:05:27.6561371Z  log.info( 2025-09-07T07:05:27.6562150Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:05:27.6562967Z  ) 2025-09-07T07:05:27.6563603Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:05:27.6564354Z  sys.exit() 2025-09-07T07:05:27.6564970Z  2025-09-07T07:05:27.6565359Z  try: 2025-09-07T07:05:27.6565872Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T07:05:27.6566656Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:05:27.6567356Z  ) 2025-09-07T07:05:27.6567881Z  2025-09-07T07:05:27.6568336Z  username = get_potential_pr_author( 2025-09-07T07:05:27.6568934Z  args.github_token, 2025-09-07T07:05:27.6569489Z  args.github_repo, 2025-09-07T07:05:27.6570039Z  args.github_actor, 2025-09-07T07:05:27.6570596Z  args.github_ref_type, 2025-09-07T07:05:27.6571166Z  args.github_branch, 2025-09-07T07:05:27.6571678Z  ) 2025-09-07T07:05:27.6572080Z  2025-09-07T07:05:27.6572613Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:05:27.6573266Z  2025-09-07T07:05:27.6573726Z  runner_label_prefix = get_runner_prefix( 2025-09-07T07:05:27.6574320Z  rollout_state, 2025-09-07T07:05:27.6574887Z  (args.github_issue_owner, username), 2025-09-07T07:05:27.6575479Z  args.github_branch, 2025-09-07T07:05:27.6576052Z  args.eligible_experiments, 2025-09-07T07:05:27.6576650Z  args.opt_out_experiments, 2025-09-07T07:05:27.6577202Z  is_canary, 2025-09-07T07:05:27.6577683Z  ) 2025-09-07T07:05:27.6578191Z  2025-09-07T07:05:27.6578601Z  except Exception as e: 2025-09-07T07:05:27.6579120Z  log.error( 2025-09-07T07:05:27.6579899Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:05:27.6580713Z  ) 2025-09-07T07:05:27.6581275Z  2025-09-07T07:05:27.6581863Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:05:27.6582569Z  2025-09-07T07:05:27.6582951Z  2025-09-07T07:05:27.6583350Z if __name__ == "__main__": 2025-09-07T07:05:27.6583860Z  main() 2025-09-07T07:05:27.6584278Z  2025-09-07T07:05:27.6584664Z EOF 2025-09-07T07:05:27.6585045Z  2025-09-07T07:05:27.6585462Z cat runner_determinator.py 2025-09-07T07:05:27.8148669Z shell: /usr/bin/bash -e {0} 2025-09-07T07:05:27.8149539Z env: 2025-09-07T07:05:27.8150255Z GITHUB_TOKEN: *** 2025-09-07T07:05:27.8150726Z ISSUE_NUMBER: 5132 2025-09-07T07:05:27.8151186Z TRIGGERING_ACTOR: desertfire 2025-09-07T07:05:27.8151685Z ISSUE_OWNER: 2025-09-07T07:05:27.8152109Z CHECK_EXPERIMENTS: 2025-09-07T07:05:27.8152569Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:05:27.8153033Z PR_NUMBER: 2025-09-07T07:05:27.8153433Z ##[endgroup] 2025-09-07T07:05:27.8360066Z # flake8: noqa: G004 2025-09-07T07:05:27.8360419Z 2025-09-07T07:05:27.8360877Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:05:27.8361854Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:05:27.8362689Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:05:27.8363153Z 2025-09-07T07:05:27.8363319Z """ 2025-09-07T07:05:27.8363927Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:05:27.8364826Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:05:27.8365776Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:05:27.8366651Z of which runners should be used to run which job. 2025-09-07T07:05:27.8367069Z 2025-09-07T07:05:27.8367478Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:05:27.8369271Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:05:27.8370216Z settings are considered to be empty with only the second part, the user 2025-09-07T07:05:27.8370953Z list, defined. 2025-09-07T07:05:27.8371190Z 2025-09-07T07:05:27.8371560Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:05:27.8372520Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:05:27.8373373Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:05:27.8373837Z 2025-09-07T07:05:27.8374214Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:05:27.8375107Z The user list is also a comma separated list of additional features or 2025-09-07T07:05:27.8375862Z experiments which the user could be opted in to. 2025-09-07T07:05:27.8376277Z 2025-09-07T07:05:27.8376482Z The user list has the following rules: 2025-09-07T07:05:27.8376837Z 2025-09-07T07:05:27.8377204Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:05:27.8378408Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:05:27.8379216Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:05:27.8379627Z 2025-09-07T07:05:27.8379807Z Example config: 2025-09-07T07:05:27.8380284Z # A list of experiments that can be opted into. 2025-09-07T07:05:27.8380968Z # This defines the behavior they'll induce when opted into. 2025-09-07T07:05:27.8381606Z # Expected syntax is: 2025-09-07T07:05:27.8382258Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:05:27.8383265Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:05:27.8383887Z 2025-09-07T07:05:27.8384072Z experiments: 2025-09-07T07:05:27.8384475Z lf: 2025-09-07T07:05:27.8384863Z rollout_percent: 25 2025-09-07T07:05:27.8385332Z all_branches: false 2025-09-07T07:05:27.8385983Z default: true 2025-09-07T07:05:27.8386412Z --- 2025-09-07T07:05:27.8386632Z 2025-09-07T07:05:27.8386802Z # Opt-ins: 2025-09-07T07:05:27.8387405Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:05:27.8388632Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:05:27.8389469Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:05:27.8390144Z # Experiments should be from the above list. 2025-09-07T07:05:27.8390539Z 2025-09-07T07:05:27.8390730Z @User1,-lf,split_build 2025-09-07T07:05:27.8391179Z @User2,lf 2025-09-07T07:05:27.8391586Z @User3,split_build 2025-09-07T07:05:27.8392006Z """ 2025-09-07T07:05:27.8392212Z 2025-09-07T07:05:27.8392384Z import json 2025-09-07T07:05:27.8392781Z import logging 2025-09-07T07:05:27.8393173Z import os 2025-09-07T07:05:27.8393543Z import random 2025-09-07T07:05:27.8393938Z import re 2025-09-07T07:05:27.8394325Z import sys 2025-09-07T07:05:27.8394740Z from argparse import ArgumentParser 2025-09-07T07:05:27.8395319Z from collections.abc import Iterable 2025-09-07T07:05:27.8395852Z from functools import cache 2025-09-07T07:05:27.8396342Z from logging import LogRecord 2025-09-07T07:05:27.8396845Z from typing import Any, NamedTuple 2025-09-07T07:05:27.8397402Z from urllib.request import Request, urlopen 2025-09-07T07:05:27.8398004Z 2025-09-07T07:05:27.8398204Z import yaml 2025-09-07T07:05:27.8398651Z from github import Auth, Github 2025-09-07T07:05:27.8399180Z from github.Issue import Issue 2025-09-07T07:05:27.8399499Z 2025-09-07T07:05:27.8399506Z 2025-09-07T07:05:27.8399731Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:05:27.8400431Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:05:27.8401316Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:05:27.8401892Z 2025-09-07T07:05:27.8402123Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:05:27.8402859Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:05:27.8403406Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:05:27.8403965Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:05:27.8404334Z 2025-09-07T07:05:27.8404536Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:05:27.8404881Z 2025-09-07T07:05:27.8405080Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:05:27.8405549Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:05:27.8405848Z 2025-09-07T07:05:27.8405854Z 2025-09-07T07:05:27.8406046Z class Experiment(NamedTuple): 2025-09-07T07:05:27.8406545Z rollout_perc: float = ( 2025-09-07T07:05:27.8407205Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:05:27.8408126Z ) 2025-09-07T07:05:27.8408513Z all_branches: bool = ( 2025-09-07T07:05:27.8409163Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:05:27.8409862Z ) 2025-09-07T07:05:27.8410237Z default: bool = ( 2025-09-07T07:05:27.8410834Z True # If True, the experiment is enabled by default for all queries 2025-09-07T07:05:27.8411497Z ) 2025-09-07T07:05:27.8411701Z 2025-09-07T07:05:27.8411885Z # Add more fields as needed 2025-09-07T07:05:27.8412200Z 2025-09-07T07:05:27.8412207Z 2025-09-07T07:05:27.8412396Z class Settings(NamedTuple): 2025-09-07T07:05:27.8412855Z """ 2025-09-07T07:05:27.8413313Z Settings for the experiments that can be opted into. 2025-09-07T07:05:27.8413894Z """ 2025-09-07T07:05:27.8414092Z 2025-09-07T07:05:27.8414311Z experiments: dict[str, Experiment] = {} 2025-09-07T07:05:27.8414692Z 2025-09-07T07:05:27.8414698Z 2025-09-07T07:05:27.8414912Z class ColorFormatter(logging.Formatter): 2025-09-07T07:05:27.8415550Z """Color codes the log messages based on the log level""" 2025-09-07T07:05:27.8415998Z 2025-09-07T07:05:27.8416166Z COLORS = { 2025-09-07T07:05:27.8416574Z "WARNING": "\033[33m", # Yellow 2025-09-07T07:05:27.8417091Z "ERROR": "\033[31m", # Red 2025-09-07T07:05:27.8417959Z "CRITICAL": "\033[31m", # Red 2025-09-07T07:05:27.8418515Z "INFO": "\033[0m", # Reset 2025-09-07T07:05:27.8419012Z "DEBUG": "\033[0m", # Reset 2025-09-07T07:05:27.8419484Z } 2025-09-07T07:05:27.8419696Z 2025-09-07T07:05:27.8419925Z def format(self, record: LogRecord) -> str: 2025-09-07T07:05:27.8420684Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:05:27.8421473Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:05:27.8422068Z return super().format(record) 2025-09-07T07:05:27.8422406Z 2025-09-07T07:05:27.8422413Z 2025-09-07T07:05:27.8422607Z handler = logging.StreamHandler() 2025-09-07T07:05:27.8423314Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:05:27.8423879Z 2025-09-07T07:05:27.8424123Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:05:27.8424719Z log.addHandler(handler) 2025-09-07T07:05:27.8425187Z log.setLevel(logging.INFO) 2025-09-07T07:05:27.8425481Z 2025-09-07T07:05:27.8425488Z 2025-09-07T07:05:27.8425743Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:05:27.8426322Z """ 2025-09-07T07:05:27.8426869Z Defines outputs of the github action that invokes this script 2025-09-07T07:05:27.8427553Z """ 2025-09-07T07:05:27.8428137Z if not GITHUB_OUTPUT: 2025-09-07T07:05:27.8429230Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:05:27.8430361Z log.warning( 2025-09-07T07:05:27.8431218Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:05:27.8432177Z ) 2025-09-07T07:05:27.8442526Z print(f"::set-output name={key}::{value}") 2025-09-07T07:05:27.8443190Z return 2025-09-07T07:05:27.8443435Z 2025-09-07T07:05:27.8443840Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:05:27.8444473Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:05:27.8445069Z f.write(f"{key}={value}\n") 2025-09-07T07:05:27.8445417Z 2025-09-07T07:05:27.8445424Z 2025-09-07T07:05:27.8445742Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:05:27.8446407Z return frozenset( 2025-09-07T07:05:27.8447048Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:05:27.8448025Z ) 2025-09-07T07:05:27.8448251Z 2025-09-07T07:05:27.8448258Z 2025-09-07T07:05:27.8448452Z def parse_args() -> Any: 2025-09-07T07:05:27.8449038Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:05:27.8450011Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:05:27.8450816Z parser.add_argument( 2025-09-07T07:05:27.8451286Z "--github-issue-repo", 2025-09-07T07:05:27.8451760Z type=str, 2025-09-07T07:05:27.8452195Z required=False, 2025-09-07T07:05:27.8452653Z default="pytorch/test-infra", 2025-09-07T07:05:27.8453215Z help="GitHub repo to get the issue", 2025-09-07T07:05:27.8453736Z ) 2025-09-07T07:05:27.8454123Z parser.add_argument( 2025-09-07T07:05:27.8454584Z "--github-repo", 2025-09-07T07:05:27.8455045Z type=str, 2025-09-07T07:05:27.8455454Z required=True, 2025-09-07T07:05:27.8455929Z help="GitHub repo where CI is running", 2025-09-07T07:05:27.8456471Z ) 2025-09-07T07:05:27.8456846Z parser.add_argument( 2025-09-07T07:05:27.8457469Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:05:27.8458388Z ) 2025-09-07T07:05:27.8458807Z parser.add_argument( 2025-09-07T07:05:27.8459444Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:05:27.8460142Z ) 2025-09-07T07:05:27.8460515Z parser.add_argument( 2025-09-07T07:05:27.8461347Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:05:27.8462053Z ) 2025-09-07T07:05:27.8462431Z parser.add_argument( 2025-09-07T07:05:27.8463104Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:05:27.8463837Z ) 2025-09-07T07:05:27.8464220Z parser.add_argument( 2025-09-07T07:05:27.8464681Z "--github-ref-type", 2025-09-07T07:05:27.8465149Z type=str, 2025-09-07T07:05:27.8465550Z required=True, 2025-09-07T07:05:27.8466046Z help="Current GitHub ref type, branch or tag", 2025-09-07T07:05:27.8466606Z ) 2025-09-07T07:05:27.8466988Z parser.add_argument( 2025-09-07T07:05:27.8467450Z "--eligible-experiments", 2025-09-07T07:05:27.8468204Z type=_str_comma_separated_to_set, 2025-09-07T07:05:27.8468745Z required=False, 2025-09-07T07:05:27.8469179Z default="", 2025-09-07T07:05:27.8470054Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:05:27.8471010Z ) 2025-09-07T07:05:27.8471397Z parser.add_argument( 2025-09-07T07:05:27.8471864Z "--opt-out-experiments", 2025-09-07T07:05:27.8472382Z type=_str_comma_separated_to_set, 2025-09-07T07:05:27.8472904Z required=False, 2025-09-07T07:05:27.8522506Z default="", 2025-09-07T07:05:27.8523095Z help=( 2025-09-07T07:05:27.8523901Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:05:27.8525072Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:05:27.8525944Z ), 2025-09-07T07:05:27.8526320Z ) 2025-09-07T07:05:27.8526702Z parser.add_argument( 2025-09-07T07:05:27.8527155Z "--pr-number", 2025-09-07T07:05:27.8527578Z type=str, 2025-09-07T07:05:27.8528119Z required=False, 2025-09-07T07:05:27.8528574Z default="", 2025-09-07T07:05:27.8529245Z help="the optional PR number where this is run", 2025-09-07T07:05:27.8529830Z ) 2025-09-07T07:05:27.8530044Z 2025-09-07T07:05:27.8530240Z return parser.parse_args() 2025-09-07T07:05:27.8530557Z 2025-09-07T07:05:27.8530564Z 2025-09-07T07:05:27.8530986Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:05:27.8531758Z auth = Auth.Token(github_token) 2025-09-07T07:05:27.8532275Z return Github(auth=auth) 2025-09-07T07:05:27.8532576Z 2025-09-07T07:05:27.8532582Z 2025-09-07T07:05:27.8533035Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:05:27.8533847Z repo = gh.get_repo(repo) 2025-09-07T07:05:27.8534348Z return repo.get_issue(number=issue_num) 2025-09-07T07:05:27.8534718Z 2025-09-07T07:05:27.8534725Z 2025-09-07T07:05:27.8534914Z def get_potential_pr_author( 2025-09-07T07:05:27.8535564Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:05:27.8536246Z ) -> str: 2025-09-07T07:05:27.8536780Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:05:27.8537598Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:05:27.8538697Z # embedded in the tag name: ciflow// 2025-09-07T07:05:27.8539130Z 2025-09-07T07:05:27.8539326Z gh = get_gh_client(github_token) 2025-09-07T07:05:27.8539663Z 2025-09-07T07:05:27.8539932Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:05:27.8540566Z split_tag = ref_name.split("/") 2025-09-07T07:05:27.8541070Z if ( 2025-09-07T07:05:27.8541469Z len(split_tag) == 3 2025-09-07T07:05:27.8541959Z and split_tag[0] == "ciflow" 2025-09-07T07:05:27.8542513Z and split_tag[2].isnumeric() 2025-09-07T07:05:27.8543041Z ): 2025-09-07T07:05:27.8543464Z pr_number = split_tag[2] 2025-09-07T07:05:27.8544161Z try: 2025-09-07T07:05:27.8544615Z repository = gh.get_repo(repo) 2025-09-07T07:05:27.8545245Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:05:27.8545848Z except Exception as e: 2025-09-07T07:05:27.8546383Z raise Exception( # noqa: TRY002 2025-09-07T07:05:27.8547048Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:05:27.8547820Z ) from e 2025-09-07T07:05:27.8548366Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:05:27.8549080Z # In all other cases, return the original input username 2025-09-07T07:05:27.8549687Z return username 2025-09-07T07:05:27.8549934Z 2025-09-07T07:05:27.8549941Z 2025-09-07T07:05:27.8550171Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:05:27.8550716Z """ 2025-09-07T07:05:27.8551363Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:05:27.8552163Z """ 2025-09-07T07:05:27.8552706Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:05:27.8553230Z 2025-09-07T07:05:27.8553236Z 2025-09-07T07:05:27.8553436Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:05:27.8553936Z try: 2025-09-07T07:05:27.8554329Z data = yaml.safe_load(yaml_text) 2025-09-07T07:05:27.8554847Z return data 2025-09-07T07:05:27.8555274Z except yaml.YAMLError: 2025-09-07T07:05:27.8555776Z log.exception("Error loading YAML") 2025-09-07T07:05:27.8556296Z raise 2025-09-07T07:05:27.8556519Z 2025-09-07T07:05:27.8556525Z 2025-09-07T07:05:27.8556954Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:05:27.8557802Z """ 2025-09-07T07:05:27.8558438Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:05:27.8559047Z 2025-09-07T07:05:27.8559532Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:05:27.8560315Z and the text below is the list of opted in users. 2025-09-07T07:05:27.8560731Z 2025-09-07T07:05:27.8561106Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:05:27.8561811Z """ 2025-09-07T07:05:27.8562258Z rollout_state_parts = rollout_state.split("---") 2025-09-07T07:05:27.8562876Z if len(rollout_state_parts) >= 2: 2025-09-07T07:05:27.8563493Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:05:27.8564090Z else: 2025-09-07T07:05:27.8564474Z return "", rollout_state 2025-09-07T07:05:27.8564783Z 2025-09-07T07:05:27.8564790Z 2025-09-07T07:05:27.8564998Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:05:27.8565507Z """ 2025-09-07T07:05:27.8566030Z Dictionary of users with a list of features they have opted into 2025-09-07T07:05:27.8566677Z """ 2025-09-07T07:05:27.8566885Z 2025-09-07T07:05:27.8566897Z 2025-09-07T07:05:27.8567235Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:05:27.8568001Z """ 2025-09-07T07:05:27.8568715Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:05:27.8569412Z 2025-09-07T07:05:27.8570038Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:05:27.8571031Z - Example line: "@User1,lf,split_build" 2025-09-07T07:05:27.8571724Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:05:27.8572213Z 2025-09-07T07:05:27.8572220Z 2025-09-07T07:05:27.8572380Z """ 2025-09-07T07:05:27.8572757Z optins = UserOptins() 2025-09-07T07:05:27.8573296Z for user in user_optin_text.split("\n"): 2025-09-07T07:05:27.8573847Z user = user.strip("\r\n\t -") 2025-09-07T07:05:27.8574399Z if not user or not user.startswith("@"): 2025-09-07T07:05:27.8575107Z # Not a valid user. Skip 2025-09-07T07:05:27.8575601Z continue 2025-09-07T07:05:27.8575851Z 2025-09-07T07:05:27.8576014Z if user: 2025-09-07T07:05:27.8576454Z usr_name = user.split(",")[0].strip("@") 2025-09-07T07:05:27.8577185Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:05:27.8577686Z 2025-09-07T07:05:27.8578139Z return optins 2025-09-07T07:05:27.8578397Z 2025-09-07T07:05:27.8578411Z 2025-09-07T07:05:27.8578700Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:05:27.8579303Z """ 2025-09-07T07:05:27.8579709Z Check if the experiment name is valid. 2025-09-07T07:05:27.8580227Z A valid name: 2025-09-07T07:05:27.8580860Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:05:27.8581829Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:05:27.8582572Z - Cannot contain spaces 2025-09-07T07:05:27.8583063Z """ 2025-09-07T07:05:27.8583265Z 2025-09-07T07:05:27.8583526Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:05:27.8584231Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:05:27.8584673Z 2025-09-07T07:05:27.8584838Z if valid: 2025-09-07T07:05:27.8585224Z return True 2025-09-07T07:05:27.8585468Z 2025-09-07T07:05:27.8585636Z log.error( 2025-09-07T07:05:27.8587112Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T07:05:27.8588844Z ) 2025-09-07T07:05:27.8589204Z return False 2025-09-07T07:05:27.8589444Z 2025-09-07T07:05:27.8589451Z 2025-09-07T07:05:27.8589752Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:05:27.8590379Z """ 2025-09-07T07:05:27.8591115Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:05:27.8591856Z """ 2025-09-07T07:05:27.8592214Z try: 2025-09-07T07:05:27.8592597Z if settings_text: 2025-09-07T07:05:27.8593327Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:05:27.8594131Z # for easy reading 2025-09-07T07:05:27.8594920Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:05:27.8595824Z # the backtick character in shell commands. 2025-09-07T07:05:27.8596439Z backtick = chr(96) # backtick character 2025-09-07T07:05:27.8597110Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:05:27.8597887Z settings = load_yaml(settings_text) 2025-09-07T07:05:27.8598274Z 2025-09-07T07:05:27.8598696Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:05:27.8599531Z experiments = {} 2025-09-07T07:05:27.8599854Z 2025-09-07T07:05:27.8600237Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:05:27.8601037Z if not is_valid_experiment_name(exp_name): 2025-09-07T07:05:27.8602154Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T07:05:27.8603209Z continue 2025-09-07T07:05:27.8603507Z 2025-09-07T07:05:27.8603691Z valid_settings = {} 2025-09-07T07:05:27.8604209Z for setting in exp_settings: 2025-09-07T07:05:27.8604794Z if setting not in Experiment._fields: 2025-09-07T07:05:27.8605351Z log.warning( 2025-09-07T07:05:27.8606057Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:05:27.8606940Z ) 2025-09-07T07:05:27.8607375Z else: 2025-09-07T07:05:27.8608003Z valid_settings[setting] = exp_settings[setting] 2025-09-07T07:05:27.8608436Z 2025-09-07T07:05:27.8608709Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:05:27.8609358Z return Settings(experiments) 2025-09-07T07:05:27.8609715Z 2025-09-07T07:05:27.8609898Z except Exception: 2025-09-07T07:05:27.8610378Z log.exception("Failed to parse settings") 2025-09-07T07:05:27.8610765Z 2025-09-07T07:05:27.8610947Z return Settings() 2025-09-07T07:05:27.8611204Z 2025-09-07T07:05:27.8611210Z 2025-09-07T07:05:27.8611455Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:05:27.8612060Z """ 2025-09-07T07:05:27.8612501Z Parse settings, if any, from the rollout state. 2025-09-07T07:05:27.8612912Z 2025-09-07T07:05:27.8613271Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:05:27.8614051Z and the text below is the list of opted in users. 2025-09-07T07:05:27.8614468Z 2025-09-07T07:05:27.8614874Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:05:27.8615616Z """ 2025-09-07T07:05:27.8616174Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:05:27.8616946Z return parse_settings_from_text(settings_text) 2025-09-07T07:05:27.8617342Z 2025-09-07T07:05:27.8617349Z 2025-09-07T07:05:27.8617600Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:05:27.8618469Z """ 2025-09-07T07:05:27.8618881Z Parse users from the rollout state. 2025-09-07T07:05:27.8619245Z 2025-09-07T07:05:27.8619405Z """ 2025-09-07T07:05:27.8619941Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:05:27.8620698Z return parse_user_opt_in_from_text(users_text) 2025-09-07T07:05:27.8621112Z 2025-09-07T07:05:27.8621128Z 2025-09-07T07:05:27.8621700Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:05:27.8622484Z """ 2025-09-07T07:05:27.8622910Z Check if a user is opted into an experiment 2025-09-07T07:05:27.8623447Z """ 2025-09-07T07:05:27.8623892Z return experiment_name in user_optins.get(user, []) 2025-09-07T07:05:27.8624321Z 2025-09-07T07:05:27.8624327Z 2025-09-07T07:05:27.8624749Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:05:27.8625509Z """ 2025-09-07T07:05:27.8625967Z Check if a user explicitly opted out of an experiment 2025-09-07T07:05:27.8626560Z """ 2025-09-07T07:05:27.8627060Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:05:27.8627864Z experiment_optout = "-" + experiment_name 2025-09-07T07:05:27.8628509Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:05:27.8629124Z return False 2025-09-07T07:05:27.8629388Z 2025-09-07T07:05:27.8629671Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:05:27.8630283Z log.warning( 2025-09-07T07:05:27.8631097Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:05:27.8631989Z ) 2025-09-07T07:05:27.8632198Z 2025-09-07T07:05:27.8632370Z return True 2025-09-07T07:05:27.8632602Z 2025-09-07T07:05:27.8632609Z 2025-09-07T07:05:27.8632805Z def get_runner_prefix( 2025-09-07T07:05:27.8633292Z rollout_state: str, 2025-09-07T07:05:27.8633794Z workflow_requestors: Iterable[str], 2025-09-07T07:05:27.8634365Z branch: str, 2025-09-07T07:05:27.8634876Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:05:27.8635553Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:05:27.8636159Z is_canary: bool = False, 2025-09-07T07:05:27.8636615Z ) -> str: 2025-09-07T07:05:27.8637037Z settings = parse_settings(rollout_state) 2025-09-07T07:05:27.8637935Z user_optins = parse_users(rollout_state) 2025-09-07T07:05:27.8638320Z 2025-09-07T07:05:27.8638500Z fleet_prefix = "" 2025-09-07T07:05:27.8638926Z prefixes = [] 2025-09-07T07:05:27.8639557Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:05:27.8640514Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:05:27.8641246Z log.info( 2025-09-07T07:05:27.8641928Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:05:27.8642690Z ) 2025-09-07T07:05:27.8643082Z continue 2025-09-07T07:05:27.8643330Z 2025-09-07T07:05:27.8643515Z if opt_out_experiments: 2025-09-07T07:05:27.8644061Z if experiment_name in opt_out_experiments: 2025-09-07T07:05:27.8644699Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:05:27.8645302Z log.info( 2025-09-07T07:05:27.8646239Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:05:27.8647242Z ) 2025-09-07T07:05:27.8647652Z continue 2025-09-07T07:05:27.8648034Z 2025-09-07T07:05:27.8648229Z if eligible_experiments: 2025-09-07T07:05:27.8648822Z if experiment_name not in eligible_experiments: 2025-09-07T07:05:27.8649462Z exp_list = ", ".join(eligible_experiments) 2025-09-07T07:05:27.8650029Z log.info( 2025-09-07T07:05:27.8650816Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:05:27.8651665Z ) 2025-09-07T07:05:27.8652077Z continue 2025-09-07T07:05:27.8652550Z elif not experiment_settings.default: 2025-09-07T07:05:27.8653094Z log.info( 2025-09-07T07:05:27.8653893Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:05:27.8654669Z ) 2025-09-07T07:05:27.8655051Z continue 2025-09-07T07:05:27.8655309Z 2025-09-07T07:05:27.8655590Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:05:27.8656214Z opted_out_users = [ 2025-09-07T07:05:27.8656675Z requestor 2025-09-07T07:05:27.8657136Z for requestor in workflow_requestors 2025-09-07T07:05:27.8658075Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:05:27.8658762Z ] 2025-09-07T07:05:27.8658975Z 2025-09-07T07:05:27.8659156Z if opted_out_users: 2025-09-07T07:05:27.8659615Z log.info( 2025-09-07T07:05:27.8660236Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:05:27.8660944Z ) 2025-09-07T07:05:27.8661330Z continue 2025-09-07T07:05:27.8661588Z 2025-09-07T07:05:27.8661865Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:05:27.8662505Z opted_in_users = [ 2025-09-07T07:05:27.8662962Z requestor 2025-09-07T07:05:27.8663419Z for requestor in workflow_requestors 2025-09-07T07:05:27.8664091Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:05:27.8664715Z ] 2025-09-07T07:05:27.8664921Z 2025-09-07T07:05:27.8665091Z enabled = False 2025-09-07T07:05:27.8665528Z if opted_in_users: 2025-09-07T07:05:27.8665972Z log.info( 2025-09-07T07:05:27.8666570Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:05:27.8667262Z ) 2025-09-07T07:05:27.8667653Z enabled = True 2025-09-07T07:05:27.8668277Z 2025-09-07T07:05:27.8668497Z elif experiment_settings.rollout_perc: 2025-09-07T07:05:27.8669352Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:05:27.8670462Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:05:27.8671133Z log.info( 2025-09-07T07:05:27.8671999Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:05:27.8672943Z ) 2025-09-07T07:05:27.8673354Z enabled = True 2025-09-07T07:05:27.8673664Z 2025-09-07T07:05:27.8673830Z if enabled: 2025-09-07T07:05:27.8674250Z label = experiment_name 2025-09-07T07:05:27.8674804Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:05:27.8675648Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:05:27.8676544Z # - If it's enabled, then we always list it's prefix first 2025-09-07T07:05:27.8677348Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:05:27.8678312Z if is_canary: 2025-09-07T07:05:27.8678823Z label += CANARY_FLEET_SUFFIX 2025-09-07T07:05:27.8679374Z fleet_prefix = label 2025-09-07T07:05:27.8679873Z else: 2025-09-07T07:05:27.8680303Z prefixes.append(label) 2025-09-07T07:05:27.8680660Z 2025-09-07T07:05:27.8680848Z if len(prefixes) > 1: 2025-09-07T07:05:27.8681303Z log.error( 2025-09-07T07:05:27.8682342Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T07:05:27.8683474Z ) 2025-09-07T07:05:27.8683865Z prefixes = prefixes[:1] 2025-09-07T07:05:27.8684184Z 2025-09-07T07:05:27.8684372Z # Fleet always comes first 2025-09-07T07:05:27.8684844Z if fleet_prefix: 2025-09-07T07:05:27.8685302Z prefixes.insert(0, fleet_prefix) 2025-09-07T07:05:27.8685676Z 2025-09-07T07:05:27.8686065Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:05:27.8686497Z 2025-09-07T07:05:27.8686505Z 2025-09-07T07:05:27.8686955Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:05:27.8687949Z """ 2025-09-07T07:05:27.8688572Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:05:27.8689152Z 2025-09-07T07:05:27.8689538Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:05:27.8690245Z """ 2025-09-07T07:05:27.8690639Z gh = get_gh_client(github_token) 2025-09-07T07:05:27.8691178Z issue = get_issue(gh, repo, issue_num) 2025-09-07T07:05:27.8691809Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:05:27.8692257Z 2025-09-07T07:05:27.8692269Z 2025-09-07T07:05:27.8692668Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:05:27.8693446Z for _ in range(num_retries): 2025-09-07T07:05:27.8693931Z try: 2025-09-07T07:05:27.8694357Z req = Request(url=url, headers=headers) 2025-09-07T07:05:27.8695033Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:05:27.8695680Z return json.loads(content) 2025-09-07T07:05:27.8696204Z except Exception as e: 2025-09-07T07:05:27.8696740Z log.warning(f"Could not download {url}: {e}") 2025-09-07T07:05:27.8697143Z 2025-09-07T07:05:27.8697517Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:05:27.8698537Z return {} 2025-09-07T07:05:27.8698773Z 2025-09-07T07:05:27.8698783Z 2025-09-07T07:05:27.8698943Z @cache 2025-09-07T07:05:27.8699572Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:05:27.8700339Z """ 2025-09-07T07:05:27.8700774Z Dynamically get PR information 2025-09-07T07:05:27.8701311Z """ 2025-09-07T07:05:27.8702009Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:05:27.8702639Z headers = { 2025-09-07T07:05:27.8703088Z "Accept": "application/vnd.github.v3+json", 2025-09-07T07:05:27.8703696Z "Authorization": f"token {github_token}", 2025-09-07T07:05:27.8704225Z } 2025-09-07T07:05:27.8704657Z json_response: dict[str, Any] = download_json( 2025-09-07T07:05:27.8705267Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:05:27.8705816Z headers=headers, 2025-09-07T07:05:27.8706246Z ) 2025-09-07T07:05:27.8706446Z 2025-09-07T07:05:27.8706629Z if not json_response: 2025-09-07T07:05:27.8707201Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:05:27.8707949Z return {} 2025-09-07T07:05:27.8708197Z 2025-09-07T07:05:27.8708375Z return json_response 2025-09-07T07:05:27.8708653Z 2025-09-07T07:05:27.8708660Z 2025-09-07T07:05:27.8709055Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:05:27.8709925Z """ 2025-09-07T07:05:27.8710455Z Dynamically get the latest list of labels from the pull request 2025-09-07T07:05:27.8711115Z """ 2025-09-07T07:05:27.8711605Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:05:27.8712216Z return { 2025-09-07T07:05:27.8712809Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:05:27.8713508Z } 2025-09-07T07:05:27.8713719Z 2025-09-07T07:05:27.8713726Z 2025-09-07T07:05:27.8713898Z def main() -> None: 2025-09-07T07:05:27.8714321Z args = parse_args() 2025-09-07T07:05:27.8714595Z 2025-09-07T07:05:27.8714816Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:05:27.8715203Z 2025-09-07T07:05:27.8715405Z # Check if the PR is opt-out 2025-09-07T07:05:27.8715893Z if args.pr_number: 2025-09-07T07:05:27.8716544Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:05:27.8717302Z if OPT_OUT_LABEL in labels: 2025-09-07T07:05:27.8718036Z log.info( 2025-09-07T07:05:27.8718751Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:05:27.8719528Z ) 2025-09-07T07:05:27.8720077Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:05:27.8720745Z sys.exit() 2025-09-07T07:05:27.8721002Z 2025-09-07T07:05:27.8721166Z try: 2025-09-07T07:05:27.8721597Z rollout_state = get_rollout_state_from_issue( 2025-09-07T07:05:27.8722304Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:05:27.8722942Z ) 2025-09-07T07:05:27.8723152Z 2025-09-07T07:05:27.8723358Z username = get_potential_pr_author( 2025-09-07T07:05:27.8723904Z args.github_token, 2025-09-07T07:05:27.8724384Z args.github_repo, 2025-09-07T07:05:27.8724862Z args.github_actor, 2025-09-07T07:05:27.8725354Z args.github_ref_type, 2025-09-07T07:05:27.8725855Z args.github_branch, 2025-09-07T07:05:27.8726376Z ) 2025-09-07T07:05:27.8726596Z 2025-09-07T07:05:27.8726878Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:05:27.8727337Z 2025-09-07T07:05:27.8727561Z runner_label_prefix = get_runner_prefix( 2025-09-07T07:05:27.8728229Z rollout_state, 2025-09-07T07:05:27.8728714Z (args.github_issue_owner, username), 2025-09-07T07:05:27.8729266Z args.github_branch, 2025-09-07T07:05:27.8729765Z args.eligible_experiments, 2025-09-07T07:05:27.8730296Z args.opt_out_experiments, 2025-09-07T07:05:27.8730805Z is_canary, 2025-09-07T07:05:27.8731215Z ) 2025-09-07T07:05:27.8731428Z 2025-09-07T07:05:27.8731617Z except Exception as e: 2025-09-07T07:05:27.8732066Z log.error( 2025-09-07T07:05:27.8732741Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:05:27.8733664Z ) 2025-09-07T07:05:27.8733877Z 2025-09-07T07:05:27.8734201Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:05:27.8734705Z 2025-09-07T07:05:27.8734711Z 2025-09-07T07:05:27.8734894Z if __name__ == "__main__": 2025-09-07T07:05:27.8735336Z main() 2025-09-07T07:05:27.8735552Z 2025-09-07T07:05:27.8825032Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:05:27.8825951Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:05:27.8855572Z shell: /usr/bin/bash -e {0} 2025-09-07T07:05:27.8856052Z env: 2025-09-07T07:05:27.8856685Z GITHUB_TOKEN: *** 2025-09-07T07:05:27.8857112Z ISSUE_NUMBER: 5132 2025-09-07T07:05:27.8857558Z TRIGGERING_ACTOR: desertfire 2025-09-07T07:05:27.8858371Z ISSUE_OWNER: 2025-09-07T07:05:27.8858797Z CHECK_EXPERIMENTS: 2025-09-07T07:05:27.8859246Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:05:27.8859702Z PR_NUMBER: 2025-09-07T07:05:27.8860106Z ##[endgroup] 2025-09-07T07:05:30.3589899Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T07:05:31.5423907Z Collecting urllib3==1.26.18 2025-09-07T07:05:31.5802661Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T07:05:31.6040572Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-09-07T07:05:31.6264628Z Collecting PyGithub==2.3.0 2025-09-07T07:05:31.6315313Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T07:05:31.6762354Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T07:05:31.6813137Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-09-07T07:05:31.6857986Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T07:05:31.6871356Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-09-07T07:05:31.6891806Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T07:05:31.7133887Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T07:05:31.7217110Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T07:05:31.7441303Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-09-07T07:05:31.8590176Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:05:31.8632042Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T07:05:31.9843637Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T07:05:31.9883184Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T07:05:32.0061166Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:05:32.0100385Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T07:05:32.0340136Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T07:05:32.0391799Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 41.5 MB/s eta 0:00:00 2025-09-07T07:05:32.0442897Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T07:05:32.0503795Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 79.6 MB/s eta 0:00:00 2025-09-07T07:05:32.0545535Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T07:05:32.0640857Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 110.1 MB/s eta 0:00:00 2025-09-07T07:05:32.0684263Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T07:05:32.0749962Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T07:05:32.0811709Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 106.7 MB/s eta 0:00:00 2025-09-07T07:05:32.0848778Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T07:05:32.0886255Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 34.6 MB/s eta 0:00:00 2025-09-07T07:05:32.0924431Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T07:05:32.0965407Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 43.2 MB/s eta 0:00:00 2025-09-07T07:05:32.4463522Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T07:05:32.9757179Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-09-07T07:05:33.0636340Z ##[group]Run curr_branch="main" 2025-09-07T07:05:33.0636650Z curr_branch="main" 2025-09-07T07:05:33.0636861Z curr_ref_type="branch" 2025-09-07T07:05:33.0637139Z echo "Current branch is '$curr_branch'" 2025-09-07T07:05:33.0637390Z  2025-09-07T07:05:33.0637581Z python3 runner_determinator.py \ 2025-09-07T07:05:33.0638078Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T07:05:33.0638348Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T07:05:33.0638600Z  --github-branch "$curr_branch" \ 2025-09-07T07:05:33.0638859Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T07:05:33.0639137Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T07:05:33.0639408Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T07:05:33.0639677Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T07:05:33.0639968Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T07:05:33.0640330Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T07:05:33.0640612Z  --pr-number "${PR_NUMBER}" 2025-09-07T07:05:33.0671592Z shell: /usr/bin/bash -e {0} 2025-09-07T07:05:33.0671817Z env: 2025-09-07T07:05:33.0672358Z GITHUB_TOKEN: *** 2025-09-07T07:05:33.0672539Z ISSUE_NUMBER: 5132 2025-09-07T07:05:33.0672730Z TRIGGERING_ACTOR: desertfire 2025-09-07T07:05:33.0672929Z ISSUE_OWNER: 2025-09-07T07:05:33.0673105Z CHECK_EXPERIMENTS: 2025-09-07T07:05:33.0673287Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:05:33.0673476Z PR_NUMBER: 2025-09-07T07:05:33.0673632Z ##[endgroup] 2025-09-07T07:05:33.0722400Z Current branch is 'main' 2025-09-07T07:05:34.6928203Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-09-07T07:05:34.6929431Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T07:05:34.6930446Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T07:05:34.6931322Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T07:05:34.6932019Z INFO : Setting output: label-type='' 2025-09-07T07:05:34.7254527Z Evaluate and set job outputs 2025-09-07T07:05:34.7261170Z Cleaning up orphan processes