2025-10-10T00:01:08.7331083Z Current runner version: '2.328.0' 2025-10-10T00:01:08.7353993Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.7354825Z Hosted Compute Agent 2025-10-10T00:01:08.7355432Z Version: 20250912.392 2025-10-10T00:01:08.7356164Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.7356913Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.7357560Z ##[endgroup] 2025-10-10T00:01:08.7358262Z ##[group]Operating System 2025-10-10T00:01:08.7358887Z Ubuntu 2025-10-10T00:01:08.7359717Z 24.04.3 2025-10-10T00:01:08.7360323Z LTS 2025-10-10T00:01:08.7360828Z ##[endgroup] 2025-10-10T00:01:08.7361391Z ##[group]Runner Image 2025-10-10T00:01:08.7362027Z Image: ubuntu-24.04 2025-10-10T00:01:08.7362615Z Version: 20250929.60.1 2025-10-10T00:01:08.7363695Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.7365506Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.7366582Z ##[endgroup] 2025-10-10T00:01:08.7367769Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.7370321Z Contents: read 2025-10-10T00:01:08.7371049Z Metadata: read 2025-10-10T00:01:08.7371579Z Packages: read 2025-10-10T00:01:08.7372126Z ##[endgroup] 2025-10-10T00:01:08.7374217Z Secret source: Actions 2025-10-10T00:01:08.7374926Z Prepare workflow directory 2025-10-10T00:01:08.7870193Z Prepare all required actions 2025-10-10T00:01:08.7925838Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.7930860Z ##[group] Inputs 2025-10-10T00:01:08.7931655Z check_experiments: 2025-10-10T00:01:08.7932249Z opt_out_experiments: 2025-10-10T00:01:08.7932917Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.7933667Z issue_owner: 2025-10-10T00:01:08.7934208Z curr_branch: main 2025-10-10T00:01:08.7934876Z curr_ref_type: branch 2025-10-10T00:01:08.7935516Z issue_number: 5132 2025-10-10T00:01:08.7936171Z ##[endgroup] 2025-10-10T00:01:08.7936824Z Complete job name: get-label-type / runner-determinator 2025-10-10T00:01:08.8506514Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:08.8509000Z cat < runner_determinator.py 2025-10-10T00:01:08.8509931Z # flake8: noqa: G004 2025-10-10T00:01:08.8510572Z  2025-10-10T00:01:08.8511289Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.8512321Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.8513336Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.8514015Z  2025-10-10T00:01:08.8514448Z """ 2025-10-10T00:01:08.8515169Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.8516178Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.8517345Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.8518329Z of which runners should be used to run which job. 2025-10-10T00:01:08.8518998Z  2025-10-10T00:01:08.8519829Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.8520897Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.8521874Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.8522753Z list, defined. 2025-10-10T00:01:08.8523252Z  2025-10-10T00:01:08.8523929Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.8525003Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.8525959Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.8526918Z  2025-10-10T00:01:08.8527591Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.8528666Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.8529662Z experiments which the user could be opted in to. 2025-10-10T00:01:08.8530286Z  2025-10-10T00:01:08.8530857Z The user list has the following rules: 2025-10-10T00:01:08.8531437Z  2025-10-10T00:01:08.8532087Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.8533113Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.8533960Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.8534626Z  2025-10-10T00:01:08.8535102Z Example config: 2025-10-10T00:01:08.8535699Z  # A list of experiments that can be opted into. 2025-10-10T00:01:08.8536496Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.8537282Z  # Expected syntax is: 2025-10-10T00:01:08.8538073Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.8539216Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.8540120Z  2025-10-10T00:01:08.8540551Z  experiments: 2025-10-10T00:01:08.8541102Z  lf: 2025-10-10T00:01:08.8541839Z  rollout_percent: 25 2025-10-10T00:01:08.8542887Z  all_branches: false 2025-10-10T00:01:08.8543826Z  default: true 2025-10-10T00:01:08.8544455Z  --- 2025-10-10T00:01:08.8544954Z  2025-10-10T00:01:08.8545439Z  # Opt-ins: 2025-10-10T00:01:08.8546209Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.8547428Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.8548318Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.8549474Z  # Experiments should be from the above list. 2025-10-10T00:01:08.8550198Z  2025-10-10T00:01:08.8550671Z  @User1,-lf,split_build 2025-10-10T00:01:08.8551205Z  @User2,lf 2025-10-10T00:01:08.8551846Z  @User3,split_build 2025-10-10T00:01:08.8552443Z """ 2025-10-10T00:01:08.8552869Z  2025-10-10T00:01:08.8553427Z import json 2025-10-10T00:01:08.8553938Z import logging 2025-10-10T00:01:08.8554505Z import os 2025-10-10T00:01:08.8555078Z import random 2025-10-10T00:01:08.8555562Z import re 2025-10-10T00:01:08.8556037Z import sys 2025-10-10T00:01:08.8556639Z from argparse import ArgumentParser 2025-10-10T00:01:08.8557324Z from collections.abc import Iterable 2025-10-10T00:01:08.8557948Z from functools import cache 2025-10-10T00:01:08.8558612Z from logging import LogRecord 2025-10-10T00:01:08.8559369Z from typing import Any, NamedTuple 2025-10-10T00:01:08.8560043Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.8560772Z  2025-10-10T00:01:08.8561196Z import yaml 2025-10-10T00:01:08.8561722Z from github import Auth, Github 2025-10-10T00:01:08.8562340Z from github.Issue import Issue 2025-10-10T00:01:08.8562948Z  2025-10-10T00:01:08.8563355Z  2025-10-10T00:01:08.8563916Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.8564797Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.8565802Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.8566832Z  2025-10-10T00:01:08.8567369Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.8568071Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.8568802Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.8569596Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.8570221Z  2025-10-10T00:01:08.8570663Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.8571328Z  2025-10-10T00:01:08.8571761Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.8572373Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.8572996Z  2025-10-10T00:01:08.8573398Z  2025-10-10T00:01:08.8573863Z class Experiment(NamedTuple): 2025-10-10T00:01:08.8574993Z  rollout_perc: float = ( 2025-10-10T00:01:08.8575794Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.8576570Z  ) 2025-10-10T00:01:08.8577124Z  all_branches: bool = ( 2025-10-10T00:01:08.8577906Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.8578648Z  ) 2025-10-10T00:01:08.8579277Z  default: bool = ( 2025-10-10T00:01:08.8579981Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.8580766Z  ) 2025-10-10T00:01:08.8581222Z  2025-10-10T00:01:08.8581713Z  # Add more fields as needed 2025-10-10T00:01:08.8582290Z  2025-10-10T00:01:08.8582719Z  2025-10-10T00:01:08.8583204Z class Settings(NamedTuple): 2025-10-10T00:01:08.8583776Z  """ 2025-10-10T00:01:08.8584402Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:08.8585085Z  """ 2025-10-10T00:01:08.8585553Z  2025-10-10T00:01:08.8586009Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.8586694Z  2025-10-10T00:01:08.8587301Z  2025-10-10T00:01:08.8587784Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.8589003Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.8590351Z  2025-10-10T00:01:08.8590822Z  COLORS = { 2025-10-10T00:01:08.8591441Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.8592165Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.8592772Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.8593438Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.8594061Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.8594606Z  } 2025-10-10T00:01:08.8595121Z  2025-10-10T00:01:08.8595636Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.8596514Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.8597474Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.8598146Z  return super().format(record) 2025-10-10T00:01:08.8598745Z  2025-10-10T00:01:08.8599416Z  2025-10-10T00:01:08.8600078Z handler = logging.StreamHandler() 2025-10-10T00:01:08.8600920Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.8601787Z  2025-10-10T00:01:08.8602374Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.8603044Z log.addHandler(handler) 2025-10-10T00:01:08.8603654Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.8604238Z  2025-10-10T00:01:08.8604703Z  2025-10-10T00:01:08.8605214Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.8605961Z  """ 2025-10-10T00:01:08.8606605Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.8607473Z  """ 2025-10-10T00:01:08.8608107Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:08.8609548Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.8610769Z  log.warning( 2025-10-10T00:01:08.8611849Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.8612826Z  ) 2025-10-10T00:01:08.8613376Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.8614202Z  return 2025-10-10T00:01:08.8614705Z  2025-10-10T00:01:08.8615165Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.8615903Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.8616585Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:08.8617150Z  2025-10-10T00:01:08.8617675Z  2025-10-10T00:01:08.8618263Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.8619015Z  return frozenset( 2025-10-10T00:01:08.8619933Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.8620691Z  ) 2025-10-10T00:01:08.8621191Z  2025-10-10T00:01:08.8621621Z  2025-10-10T00:01:08.8622110Z def parse_args() -> Any: 2025-10-10T00:01:08.8622804Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.8623817Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.8624693Z  parser.add_argument( 2025-10-10T00:01:08.8625250Z  "--github-issue-repo", 2025-10-10T00:01:08.8625932Z  type=str, 2025-10-10T00:01:08.8626452Z  required=False, 2025-10-10T00:01:08.8627176Z  default="pytorch/test-infra", 2025-10-10T00:01:08.8627856Z  help="GitHub repo to get the issue", 2025-10-10T00:01:08.8628499Z  ) 2025-10-10T00:01:08.8629025Z  parser.add_argument( 2025-10-10T00:01:08.8629716Z  "--github-repo", 2025-10-10T00:01:08.8630303Z  type=str, 2025-10-10T00:01:08.8630812Z  required=True, 2025-10-10T00:01:08.8631462Z  help="GitHub repo where CI is running", 2025-10-10T00:01:08.8632070Z  ) 2025-10-10T00:01:08.8632603Z  parser.add_argument( 2025-10-10T00:01:08.8633377Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.8634123Z  ) 2025-10-10T00:01:08.8634610Z  parser.add_argument( 2025-10-10T00:01:08.8698706Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.8700241Z  ) 2025-10-10T00:01:08.8700957Z  parser.add_argument( 2025-10-10T00:01:08.8702198Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.8703560Z  ) 2025-10-10T00:01:08.8704213Z  parser.add_argument( 2025-10-10T00:01:08.8704972Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.8705717Z  ) 2025-10-10T00:01:08.8706123Z  parser.add_argument( 2025-10-10T00:01:08.8706626Z  "--github-ref-type", 2025-10-10T00:01:08.8707124Z  type=str, 2025-10-10T00:01:08.8707563Z  required=True, 2025-10-10T00:01:08.8708103Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.8708662Z  ) 2025-10-10T00:01:08.8709060Z  parser.add_argument( 2025-10-10T00:01:08.8710084Z  "--eligible-experiments", 2025-10-10T00:01:08.8710652Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8711194Z  required=False, 2025-10-10T00:01:08.8711660Z  default="", 2025-10-10T00:01:08.8712561Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.8713480Z  ) 2025-10-10T00:01:08.8713874Z  parser.add_argument( 2025-10-10T00:01:08.8714368Z  "--opt-out-experiments", 2025-10-10T00:01:08.8714940Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8715469Z  required=False, 2025-10-10T00:01:08.8715927Z  default="", 2025-10-10T00:01:08.8716376Z  help=( 2025-10-10T00:01:08.8717071Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.8718212Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.8719039Z  ), 2025-10-10T00:01:08.8719617Z  ) 2025-10-10T00:01:08.8720020Z  parser.add_argument( 2025-10-10T00:01:08.8720511Z  "--pr-number", 2025-10-10T00:01:08.8720975Z  type=str, 2025-10-10T00:01:08.8721418Z  required=False, 2025-10-10T00:01:08.8721879Z  default="", 2025-10-10T00:01:08.8722401Z  help="the optional PR number where this is run", 2025-10-10T00:01:08.8722956Z  ) 2025-10-10T00:01:08.8723322Z  2025-10-10T00:01:08.8723704Z  return parser.parse_args() 2025-10-10T00:01:08.8724200Z  2025-10-10T00:01:08.8724543Z  2025-10-10T00:01:08.8725152Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8726063Z  auth = Auth.Token(github_token) 2025-10-10T00:01:08.8726636Z  return Github(auth=auth) 2025-10-10T00:01:08.8727116Z  2025-10-10T00:01:08.8727485Z  2025-10-10T00:01:08.8728147Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8728950Z  repo = gh.get_repo(repo) 2025-10-10T00:01:08.8729769Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.8730302Z  2025-10-10T00:01:08.8730656Z  2025-10-10T00:01:08.8731030Z def get_potential_pr_author( 2025-10-10T00:01:08.8731713Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.8732392Z ) -> str: 2025-10-10T00:01:08.8732952Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.8733777Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.8734548Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:08.8735127Z  2025-10-10T00:01:08.8735514Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.8736012Z  2025-10-10T00:01:08.8736494Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.8737144Z  split_tag = ref_name.split("/") 2025-10-10T00:01:08.8737656Z  if ( 2025-10-10T00:01:08.8738070Z  len(split_tag) == 3 2025-10-10T00:01:08.8738593Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:08.8739593Z  and split_tag[2].isnumeric() 2025-10-10T00:01:08.8740133Z  ): 2025-10-10T00:01:08.8740564Z  pr_number = split_tag[2] 2025-10-10T00:01:08.8741070Z  try: 2025-10-10T00:01:08.8741544Z  repository = gh.get_repo(repo) 2025-10-10T00:01:08.8742325Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.8742951Z  except Exception as e: 2025-10-10T00:01:08.8743490Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:08.8744173Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.8744838Z  ) from e 2025-10-10T00:01:08.8745415Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.8746122Z  # In all other cases, return the original input username 2025-10-10T00:01:08.8746715Z  return username 2025-10-10T00:01:08.8747146Z  2025-10-10T00:01:08.8747483Z  2025-10-10T00:01:08.8747919Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.8748460Z  """ 2025-10-10T00:01:08.8749286Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.8750083Z  """ 2025-10-10T00:01:08.8750649Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.8751304Z  2025-10-10T00:01:08.8751646Z  2025-10-10T00:01:08.8752049Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.8752560Z  try: 2025-10-10T00:01:08.8752980Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.8753504Z  return data 2025-10-10T00:01:08.8753955Z  except yaml.YAMLError: 2025-10-10T00:01:08.8754494Z  log.exception("Error loading YAML") 2025-10-10T00:01:08.8755012Z  raise 2025-10-10T00:01:08.8755412Z  2025-10-10T00:01:08.8755753Z  2025-10-10T00:01:08.8756381Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.8757140Z  """ 2025-10-10T00:01:08.8757908Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.8758659Z  2025-10-10T00:01:08.8759393Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8760219Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.8760776Z  2025-10-10T00:01:08.8761347Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.8762038Z  """ 2025-10-10T00:01:08.8762504Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.8763118Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.8763746Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.8764342Z  else: 2025-10-10T00:01:08.8764755Z  return "", rollout_state 2025-10-10T00:01:08.8765323Z  2025-10-10T00:01:08.8765668Z  2025-10-10T00:01:08.8766081Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.8766609Z  """ 2025-10-10T00:01:08.8767162Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.8767811Z  """ 2025-10-10T00:01:08.8768178Z  2025-10-10T00:01:08.8768518Z  2025-10-10T00:01:08.8769074Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.8769930Z  """ 2025-10-10T00:01:08.8770667Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.8771488Z  2025-10-10T00:01:08.8772285Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.8773268Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.8774118Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.8774791Z  2025-10-10T00:01:08.8775130Z  2025-10-10T00:01:08.8775473Z  """ 2025-10-10T00:01:08.8775869Z  optins = UserOptins() 2025-10-10T00:01:08.8776403Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.8776970Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:08.8777546Z  if not user or not user.startswith("@"): 2025-10-10T00:01:08.8778109Z  # Not a valid user. Skip 2025-10-10T00:01:08.8778613Z  continue 2025-10-10T00:01:08.8779032Z  2025-10-10T00:01:08.8779585Z  if user: 2025-10-10T00:01:08.8780070Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.8780768Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.8781412Z  2025-10-10T00:01:08.8781761Z  return optins 2025-10-10T00:01:08.8782178Z  2025-10-10T00:01:08.8782508Z  2025-10-10T00:01:08.8783003Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.8783621Z  """ 2025-10-10T00:01:08.8784048Z  Check if the experiment name is valid. 2025-10-10T00:01:08.8784585Z  A valid name: 2025-10-10T00:01:08.8785268Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.8786199Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.8786907Z  - Cannot contain spaces 2025-10-10T00:01:08.8787387Z  """ 2025-10-10T00:01:08.8787751Z  2025-10-10T00:01:08.8788201Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.8788928Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.8789750Z  2025-10-10T00:01:08.8790112Z  if valid: 2025-10-10T00:01:08.8790530Z  return True 2025-10-10T00:01:08.8790949Z  2025-10-10T00:01:08.8791291Z  log.error( 2025-10-10T00:01:08.8792716Z  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-10-10T00:01:08.8794196Z  ) 2025-10-10T00:01:08.8794577Z  return False 2025-10-10T00:01:08.8794988Z  2025-10-10T00:01:08.8795320Z  2025-10-10T00:01:08.8795827Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.8796459Z  """ 2025-10-10T00:01:08.8797060Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.8797775Z  """ 2025-10-10T00:01:08.8798144Z  try: 2025-10-10T00:01:08.8798531Z  if settings_text: 2025-10-10T00:01:08.8799449Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.8800287Z  # for easy reading 2025-10-10T00:01:08.8801101Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.8801986Z  # the backtick character in shell commands. 2025-10-10T00:01:08.8802591Z  backtick = chr(96) # backtick character 2025-10-10T00:01:08.8803267Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.8803944Z  settings = load_yaml(settings_text) 2025-10-10T00:01:08.8804452Z  2025-10-10T00:01:08.8805186Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.8805923Z  experiments = {} 2025-10-10T00:01:08.8806387Z  2025-10-10T00:01:08.8806943Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.8807698Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.8808789Z  # 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-10-10T00:01:08.8810108Z  continue 2025-10-10T00:01:08.8810566Z  2025-10-10T00:01:08.8810942Z  valid_settings = {} 2025-10-10T00:01:08.8811480Z  for setting in exp_settings: 2025-10-10T00:01:08.8812057Z  if setting not in Experiment._fields: 2025-10-10T00:01:08.8812627Z  log.warning( 2025-10-10T00:01:08.8813355Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.8814055Z  ) 2025-10-10T00:01:08.8814497Z  else: 2025-10-10T00:01:08.8815037Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.8815606Z  2025-10-10T00:01:08.8816080Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.8816723Z  return Settings(experiments) 2025-10-10T00:01:08.8817229Z  2025-10-10T00:01:08.8817590Z  except Exception: 2025-10-10T00:01:08.8818100Z  log.exception("Failed to parse settings") 2025-10-10T00:01:08.8818631Z  2025-10-10T00:01:08.8818982Z  return Settings() 2025-10-10T00:01:08.8819520Z  2025-10-10T00:01:08.8819857Z  2025-10-10T00:01:08.8820445Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.8821028Z  """ 2025-10-10T00:01:08.8821485Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.8822031Z  2025-10-10T00:01:08.8822564Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8823320Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.8823866Z  2025-10-10T00:01:08.8824454Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.8825176Z  """ 2025-10-10T00:01:08.8825751Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8826521Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.8827067Z  2025-10-10T00:01:08.8827410Z  2025-10-10T00:01:08.8827853Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.8828420Z  """ 2025-10-10T00:01:08.8828829Z  Parse users from the rollout state. 2025-10-10T00:01:08.8829436Z  2025-10-10T00:01:08.8829791Z  """ 2025-10-10T00:01:08.8830344Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8831099Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.8831641Z  2025-10-10T00:01:08.8831986Z  2025-10-10T00:01:08.8832600Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8833347Z  """ 2025-10-10T00:01:08.8833797Z  Check if a user is opted into an experiment 2025-10-10T00:01:08.8834331Z  """ 2025-10-10T00:01:08.8834821Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.8835518Z  2025-10-10T00:01:08.8835860Z  2025-10-10T00:01:08.8836476Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8837229Z  """ 2025-10-10T00:01:08.8837707Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.8838291Z  """ 2025-10-10T00:01:08.8838828Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.8839753Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.8840407Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.8841001Z  return False 2025-10-10T00:01:08.8841427Z  2025-10-10T00:01:08.8841882Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.8842487Z  log.warning( 2025-10-10T00:01:08.8843308Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.8844158Z  ) 2025-10-10T00:01:08.8844532Z  2025-10-10T00:01:08.8844879Z  return True 2025-10-10T00:01:08.8845284Z  2025-10-10T00:01:08.8845622Z  2025-10-10T00:01:08.8845988Z def get_runner_prefix( 2025-10-10T00:01:08.8846444Z  rollout_state: str, 2025-10-10T00:01:08.8846951Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:08.8847474Z  branch: str, 2025-10-10T00:01:08.8848000Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8848683Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8849543Z  is_canary: bool = False, 2025-10-10T00:01:08.8850046Z ) -> str: 2025-10-10T00:01:08.8850500Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:08.8851088Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.8851611Z  2025-10-10T00:01:08.8852110Z  fleet_prefix = "" 2025-10-10T00:01:08.8852572Z  prefixes = [] 2025-10-10T00:01:08.8853256Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.8854202Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.8854912Z  log.info( 2025-10-10T00:01:08.8855613Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.8856356Z  ) 2025-10-10T00:01:08.8856758Z  continue 2025-10-10T00:01:08.8857186Z  2025-10-10T00:01:08.8857556Z  if opt_out_experiments: 2025-10-10T00:01:08.8858129Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.8858761Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.8859656Z  log.info( 2025-10-10T00:01:08.8860628Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.8861580Z  ) 2025-10-10T00:01:08.8862010Z  continue 2025-10-10T00:01:08.8862446Z  2025-10-10T00:01:08.8862823Z  if eligible_experiments: 2025-10-10T00:01:08.8863409Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.8864054Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.8864615Z  log.info( 2025-10-10T00:01:08.8865438Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.8866263Z  ) 2025-10-10T00:01:08.8866825Z  continue 2025-10-10T00:01:08.8867341Z  elif not experiment_settings.default: 2025-10-10T00:01:08.8867877Z  log.info( 2025-10-10T00:01:08.8868557Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.8869386Z  ) 2025-10-10T00:01:08.8869784Z  continue 2025-10-10T00:01:08.8870211Z  2025-10-10T00:01:08.8870692Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.8871309Z  opted_out_users = [ 2025-10-10T00:01:08.8871790Z  requestor 2025-10-10T00:01:08.8872277Z  for requestor in workflow_requestors 2025-10-10T00:01:08.8872953Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.8873575Z  ] 2025-10-10T00:01:08.8873954Z  2025-10-10T00:01:08.8874320Z  if opted_out_users: 2025-10-10T00:01:08.8874802Z  log.info( 2025-10-10T00:01:08.8875447Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.8876133Z  ) 2025-10-10T00:01:08.8876542Z  continue 2025-10-10T00:01:08.8876962Z  2025-10-10T00:01:08.8877426Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.8878029Z  opted_in_users = [ 2025-10-10T00:01:08.8878494Z  requestor 2025-10-10T00:01:08.8878975Z  for requestor in workflow_requestors 2025-10-10T00:01:08.8879758Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.8880371Z  ] 2025-10-10T00:01:08.8880740Z  2025-10-10T00:01:08.8881105Z  enabled = False 2025-10-10T00:01:08.8881567Z  if opted_in_users: 2025-10-10T00:01:08.8882155Z  log.info( 2025-10-10T00:01:08.8882784Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.8883451Z  ) 2025-10-10T00:01:08.8883859Z  enabled = True 2025-10-10T00:01:08.8884307Z  2025-10-10T00:01:08.8884716Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.8885534Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.8886456Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.8887092Z  log.info( 2025-10-10T00:01:08.8887970Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.8888875Z  ) 2025-10-10T00:01:08.8889481Z  enabled = True 2025-10-10T00:01:08.8889962Z  2025-10-10T00:01:08.8890316Z  if enabled: 2025-10-10T00:01:08.8890782Z  label = experiment_name 2025-10-10T00:01:08.8891340Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.8892154Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.8893017Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.8893766Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.8894421Z  if is_canary: 2025-10-10T00:01:08.8894934Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.8895488Z  fleet_prefix = label 2025-10-10T00:01:08.8896123Z  else: 2025-10-10T00:01:08.8896587Z  prefixes.append(label) 2025-10-10T00:01:08.8897089Z  2025-10-10T00:01:08.8897450Z  if len(prefixes) > 1: 2025-10-10T00:01:08.8897921Z  log.error( 2025-10-10T00:01:08.8898955Z  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-10-10T00:01:08.8900298Z  ) 2025-10-10T00:01:08.8900728Z  prefixes = prefixes[:1] 2025-10-10T00:01:08.8901207Z  2025-10-10T00:01:08.8901583Z  # Fleet always comes first 2025-10-10T00:01:08.8902076Z  if fleet_prefix: 2025-10-10T00:01:08.8902555Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.8903054Z  2025-10-10T00:01:08.8903501Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.8904063Z  2025-10-10T00:01:08.8904410Z  2025-10-10T00:01:08.8905045Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.8905797Z  """ 2025-10-10T00:01:08.8906396Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.8907083Z  2025-10-10T00:01:08.8907662Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.8908349Z  """ 2025-10-10T00:01:08.8908761Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.8909416Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.8910065Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.8910663Z  2025-10-10T00:01:08.8910993Z  2025-10-10T00:01:08.8911581Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.8912458Z  for _ in range(num_retries): 2025-10-10T00:01:08.8912958Z  try: 2025-10-10T00:01:08.8913414Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:08.8914068Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.8914720Z  return json.loads(content) 2025-10-10T00:01:08.8915246Z  except Exception as e: 2025-10-10T00:01:08.8915814Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.8916352Z  2025-10-10T00:01:08.8916922Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.8917627Z  return {} 2025-10-10T00:01:08.8918020Z  2025-10-10T00:01:08.8918351Z  2025-10-10T00:01:08.8918694Z @cache 2025-10-10T00:01:08.8919506Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.8920272Z  """ 2025-10-10T00:01:08.8920695Z  Dynamically get PR information 2025-10-10T00:01:08.8921197Z  """ 2025-10-10T00:01:08.8921733Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.8922354Z  headers = { 2025-10-10T00:01:08.8922835Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.8923457Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:08.8923979Z  } 2025-10-10T00:01:08.8924431Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.8925035Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.8925576Z  headers=headers, 2025-10-10T00:01:08.8926040Z  ) 2025-10-10T00:01:08.8926401Z  2025-10-10T00:01:08.8926780Z  if not json_response: 2025-10-10T00:01:08.8927519Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.8928153Z  return {} 2025-10-10T00:01:08.8928567Z  2025-10-10T00:01:08.8928935Z  return json_response 2025-10-10T00:01:08.8929568Z  2025-10-10T00:01:08.8929917Z  2025-10-10T00:01:08.8930517Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.8931230Z  """ 2025-10-10T00:01:08.8931771Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.8932436Z  """ 2025-10-10T00:01:08.8932930Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.8933525Z  return { 2025-10-10T00:01:08.8934120Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.8934796Z  } 2025-10-10T00:01:08.8935150Z  2025-10-10T00:01:08.8935498Z  2025-10-10T00:01:08.8935852Z def main() -> None: 2025-10-10T00:01:08.8936299Z  args = parse_args() 2025-10-10T00:01:08.8936740Z  2025-10-10T00:01:08.8937164Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.8937696Z  2025-10-10T00:01:08.8938072Z  # Check if the PR is opt-out 2025-10-10T00:01:08.8938667Z  if args.pr_number: 2025-10-10T00:01:08.8939577Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.8940330Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.8940835Z  log.info( 2025-10-10T00:01:08.8941541Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.8942285Z  ) 2025-10-10T00:01:08.8942858Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.8943528Z  sys.exit() 2025-10-10T00:01:08.8944083Z  2025-10-10T00:01:08.8944433Z  try: 2025-10-10T00:01:08.8944890Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.8945594Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.8946225Z  ) 2025-10-10T00:01:08.8946602Z  2025-10-10T00:01:08.8946991Z  username = get_potential_pr_author( 2025-10-10T00:01:08.8947531Z  args.github_token, 2025-10-10T00:01:08.8948033Z  args.github_repo, 2025-10-10T00:01:08.8948524Z  args.github_actor, 2025-10-10T00:01:08.8949028Z  args.github_ref_type, 2025-10-10T00:01:08.8949661Z  args.github_branch, 2025-10-10T00:01:08.8950139Z  ) 2025-10-10T00:01:08.8950511Z  2025-10-10T00:01:08.8951007Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.8951604Z  2025-10-10T00:01:08.8952013Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.8952562Z  rollout_state, 2025-10-10T00:01:08.8953079Z  (args.github_issue_owner, username), 2025-10-10T00:01:08.8953630Z  args.github_branch, 2025-10-10T00:01:08.8954147Z  args.eligible_experiments, 2025-10-10T00:01:08.8954698Z  args.opt_out_experiments, 2025-10-10T00:01:08.8955219Z  is_canary, 2025-10-10T00:01:08.8955660Z  ) 2025-10-10T00:01:08.8956049Z  2025-10-10T00:01:08.8956417Z  except Exception as e: 2025-10-10T00:01:08.8956904Z  log.error( 2025-10-10T00:01:08.8957618Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.8958496Z  ) 2025-10-10T00:01:08.8958869Z  2025-10-10T00:01:08.8959493Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.8960139Z  2025-10-10T00:01:08.8960471Z  2025-10-10T00:01:08.8960827Z if __name__ == "__main__": 2025-10-10T00:01:08.8961318Z  main() 2025-10-10T00:01:08.8961709Z  2025-10-10T00:01:08.8962039Z EOF 2025-10-10T00:01:08.8962386Z  2025-10-10T00:01:08.8962747Z cat runner_determinator.py 2025-10-10T00:01:09.0251094Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.0252397Z env: 2025-10-10T00:01:09.0253386Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.0254042Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.0254745Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.0255537Z ISSUE_OWNER: 2025-10-10T00:01:09.0256195Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.0256862Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.0257540Z PR_NUMBER: 2025-10-10T00:01:09.0258112Z ##[endgroup] 2025-10-10T00:01:09.0503978Z # flake8: noqa: G004 2025-10-10T00:01:09.0504293Z 2025-10-10T00:01:09.0504713Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.0505640Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.0506398Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.0506825Z 2025-10-10T00:01:09.0506979Z """ 2025-10-10T00:01:09.0507539Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.0508380Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.0509503Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.0510303Z of which runners should be used to run which job. 2025-10-10T00:01:09.0510690Z 2025-10-10T00:01:09.0511061Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.0512118Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.0512968Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.0513630Z list, defined. 2025-10-10T00:01:09.0513840Z 2025-10-10T00:01:09.0514184Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.0515054Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.0515825Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.0516248Z 2025-10-10T00:01:09.0516596Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.0517422Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.0518112Z experiments which the user could be opted in to. 2025-10-10T00:01:09.0518492Z 2025-10-10T00:01:09.0518692Z The user list has the following rules: 2025-10-10T00:01:09.0519024Z 2025-10-10T00:01:09.0519532Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.0520366Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.0521081Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.0521458Z 2025-10-10T00:01:09.0521625Z Example config: 2025-10-10T00:01:09.0522052Z # A list of experiments that can be opted into. 2025-10-10T00:01:09.0522682Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.0523278Z # Expected syntax is: 2025-10-10T00:01:09.0523880Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.0524809Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.0525389Z 2025-10-10T00:01:09.0525553Z experiments: 2025-10-10T00:01:09.0525934Z lf: 2025-10-10T00:01:09.0526295Z rollout_percent: 25 2025-10-10T00:01:09.0526881Z all_branches: false 2025-10-10T00:01:09.0527311Z default: true 2025-10-10T00:01:09.0527698Z --- 2025-10-10T00:01:09.0527886Z 2025-10-10T00:01:09.0528050Z # Opt-ins: 2025-10-10T00:01:09.0528606Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.0529754Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.0530499Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.0531132Z # Experiments should be from the above list. 2025-10-10T00:01:09.0531489Z 2025-10-10T00:01:09.0531673Z @User1,-lf,split_build 2025-10-10T00:01:09.0532087Z @User2,lf 2025-10-10T00:01:09.0532448Z @User3,split_build 2025-10-10T00:01:09.0532834Z """ 2025-10-10T00:01:09.0533018Z 2025-10-10T00:01:09.0533185Z import json 2025-10-10T00:01:09.0533535Z import logging 2025-10-10T00:01:09.0533897Z import os 2025-10-10T00:01:09.0534243Z import random 2025-10-10T00:01:09.0534616Z import re 2025-10-10T00:01:09.0534951Z import sys 2025-10-10T00:01:09.0535333Z from argparse import ArgumentParser 2025-10-10T00:01:09.0535828Z from collections.abc import Iterable 2025-10-10T00:01:09.0536325Z from functools import cache 2025-10-10T00:01:09.0536780Z from logging import LogRecord 2025-10-10T00:01:09.0537244Z from typing import Any, NamedTuple 2025-10-10T00:01:09.0537755Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.0538110Z 2025-10-10T00:01:09.0538269Z import yaml 2025-10-10T00:01:09.0538643Z from github import Auth, Github 2025-10-10T00:01:09.0539247Z from github.Issue import Issue 2025-10-10T00:01:09.0539583Z 2025-10-10T00:01:09.0539589Z 2025-10-10T00:01:09.0539793Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.0540445Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.0541271Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.0541808Z 2025-10-10T00:01:09.0542031Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.0542698Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.0543193Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.0543714Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.0544048Z 2025-10-10T00:01:09.0544239Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.0544552Z 2025-10-10T00:01:09.0544732Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.0545168Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.0545427Z 2025-10-10T00:01:09.0545432Z 2025-10-10T00:01:09.0545623Z class Experiment(NamedTuple): 2025-10-10T00:01:09.0546065Z rollout_perc: float = ( 2025-10-10T00:01:09.0546669Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.0547298Z ) 2025-10-10T00:01:09.0547650Z all_branches: bool = ( 2025-10-10T00:01:09.0548229Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.0548878Z ) 2025-10-10T00:01:09.0549429Z default: bool = ( 2025-10-10T00:01:09.0550006Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.0550622Z ) 2025-10-10T00:01:09.0550802Z 2025-10-10T00:01:09.0551000Z # Add more fields as needed 2025-10-10T00:01:09.0551292Z 2025-10-10T00:01:09.0551298Z 2025-10-10T00:01:09.0551474Z class Settings(NamedTuple): 2025-10-10T00:01:09.0551886Z """ 2025-10-10T00:01:09.0552314Z Settings for the experiments that can be opted into. 2025-10-10T00:01:09.0552857Z """ 2025-10-10T00:01:09.0553036Z 2025-10-10T00:01:09.0553233Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.0553577Z 2025-10-10T00:01:09.0553583Z 2025-10-10T00:01:09.0553791Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.0554383Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.0554799Z 2025-10-10T00:01:09.0554952Z COLORS = { 2025-10-10T00:01:09.0555334Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.0555965Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.0556435Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.0556897Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.0557351Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.0557788Z } 2025-10-10T00:01:09.0557971Z 2025-10-10T00:01:09.0558184Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.0558894Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.0560053Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.0560606Z return super().format(record) 2025-10-10T00:01:09.0560926Z 2025-10-10T00:01:09.0560932Z 2025-10-10T00:01:09.0561123Z handler = logging.StreamHandler() 2025-10-10T00:01:09.0561797Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.0562331Z 2025-10-10T00:01:09.0562564Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.0563132Z log.addHandler(handler) 2025-10-10T00:01:09.0563556Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.0563832Z 2025-10-10T00:01:09.0563839Z 2025-10-10T00:01:09.0564075Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.0564607Z """ 2025-10-10T00:01:09.0565082Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.0565670Z """ 2025-10-10T00:01:09.0566016Z if not GITHUB_OUTPUT: 2025-10-10T00:01:09.0567037Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.0568106Z log.warning( 2025-10-10T00:01:09.0568919Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.0569999Z ) 2025-10-10T00:01:09.0579957Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.0580545Z return 2025-10-10T00:01:09.0580778Z 2025-10-10T00:01:09.0581148Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.0581726Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.0582275Z f.write(f"{key}={value}\n") 2025-10-10T00:01:09.0582588Z 2025-10-10T00:01:09.0582594Z 2025-10-10T00:01:09.0582884Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.0583479Z return frozenset( 2025-10-10T00:01:09.0584074Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.0584739Z ) 2025-10-10T00:01:09.0584926Z 2025-10-10T00:01:09.0584932Z 2025-10-10T00:01:09.0585106Z def parse_args() -> Any: 2025-10-10T00:01:09.0585637Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.0586443Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.0587172Z parser.add_argument( 2025-10-10T00:01:09.0587600Z "--github-issue-repo", 2025-10-10T00:01:09.0588039Z type=str, 2025-10-10T00:01:09.0588424Z required=False, 2025-10-10T00:01:09.0588845Z default="pytorch/test-infra", 2025-10-10T00:01:09.0589546Z help="GitHub repo to get the issue", 2025-10-10T00:01:09.0590025Z ) 2025-10-10T00:01:09.0590365Z parser.add_argument( 2025-10-10T00:01:09.0590773Z "--github-repo", 2025-10-10T00:01:09.0591175Z type=str, 2025-10-10T00:01:09.0591550Z required=True, 2025-10-10T00:01:09.0591981Z help="GitHub repo where CI is running", 2025-10-10T00:01:09.0592475Z ) 2025-10-10T00:01:09.0592818Z parser.add_argument( 2025-10-10T00:01:09.0593374Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.0593992Z ) 2025-10-10T00:01:09.0594343Z parser.add_argument( 2025-10-10T00:01:09.0594926Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.0595574Z ) 2025-10-10T00:01:09.0596043Z parser.add_argument( 2025-10-10T00:01:09.0596643Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.0597296Z ) 2025-10-10T00:01:09.0597635Z parser.add_argument( 2025-10-10T00:01:09.0598246Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.0598917Z ) 2025-10-10T00:01:09.0599434Z parser.add_argument( 2025-10-10T00:01:09.0599857Z "--github-ref-type", 2025-10-10T00:01:09.0600284Z type=str, 2025-10-10T00:01:09.0600654Z required=True, 2025-10-10T00:01:09.0601103Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.0601618Z ) 2025-10-10T00:01:09.0601972Z parser.add_argument( 2025-10-10T00:01:09.0602396Z "--eligible-experiments", 2025-10-10T00:01:09.0602880Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.0603359Z required=False, 2025-10-10T00:01:09.0603759Z default="", 2025-10-10T00:01:09.0604576Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.0605455Z ) 2025-10-10T00:01:09.0605797Z parser.add_argument( 2025-10-10T00:01:09.0606218Z "--opt-out-experiments", 2025-10-10T00:01:09.0606692Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.0607171Z required=False, 2025-10-10T00:01:09.0607566Z default="", 2025-10-10T00:01:09.0607926Z help=( 2025-10-10T00:01:09.0608559Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.0609836Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.0610630Z ), 2025-10-10T00:01:09.0610970Z ) 2025-10-10T00:01:09.0611309Z parser.add_argument( 2025-10-10T00:01:09.0611718Z "--pr-number", 2025-10-10T00:01:09.0612098Z type=str, 2025-10-10T00:01:09.0612475Z required=False, 2025-10-10T00:01:09.0612869Z default="", 2025-10-10T00:01:09.0613438Z help="the optional PR number where this is run", 2025-10-10T00:01:09.0613964Z ) 2025-10-10T00:01:09.0614152Z 2025-10-10T00:01:09.0614330Z return parser.parse_args() 2025-10-10T00:01:09.0614616Z 2025-10-10T00:01:09.0614622Z 2025-10-10T00:01:09.0615013Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.0615718Z auth = Auth.Token(github_token) 2025-10-10T00:01:09.0616199Z return Github(auth=auth) 2025-10-10T00:01:09.0616474Z 2025-10-10T00:01:09.0616481Z 2025-10-10T00:01:09.0616907Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.0617662Z repo = gh.get_repo(repo) 2025-10-10T00:01:09.0618120Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.0618466Z 2025-10-10T00:01:09.0618472Z 2025-10-10T00:01:09.0618648Z def get_potential_pr_author( 2025-10-10T00:01:09.0619466Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.0620112Z ) -> str: 2025-10-10T00:01:09.0620595Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.0621338Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.0622045Z # embedded in the tag name: ciflow// 2025-10-10T00:01:09.0622425Z 2025-10-10T00:01:09.0622608Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.0622924Z 2025-10-10T00:01:09.0623174Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.0623748Z split_tag = ref_name.split("/") 2025-10-10T00:01:09.0624213Z if ( 2025-10-10T00:01:09.0624572Z len(split_tag) == 3 2025-10-10T00:01:09.0671787Z and split_tag[0] == "ciflow" 2025-10-10T00:01:09.0672420Z and split_tag[2].isnumeric() 2025-10-10T00:01:09.0672900Z ): 2025-10-10T00:01:09.0673480Z pr_number = split_tag[2] 2025-10-10T00:01:09.0673954Z try: 2025-10-10T00:01:09.0674371Z repository = gh.get_repo(repo) 2025-10-10T00:01:09.0674954Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.0675532Z except Exception as e: 2025-10-10T00:01:09.0676020Z raise Exception( # noqa: TRY002 2025-10-10T00:01:09.0676645Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.0677251Z ) from e 2025-10-10T00:01:09.0677753Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.0678401Z # In all other cases, return the original input username 2025-10-10T00:01:09.0678953Z return username 2025-10-10T00:01:09.0679319Z 2025-10-10T00:01:09.0679325Z 2025-10-10T00:01:09.0679549Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.0680067Z """ 2025-10-10T00:01:09.0680672Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.0681427Z """ 2025-10-10T00:01:09.0681945Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.0682449Z 2025-10-10T00:01:09.0682457Z 2025-10-10T00:01:09.0682647Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.0683109Z try: 2025-10-10T00:01:09.0683481Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.0683965Z return data 2025-10-10T00:01:09.0684355Z except yaml.YAMLError: 2025-10-10T00:01:09.0684814Z log.exception("Error loading YAML") 2025-10-10T00:01:09.0685292Z raise 2025-10-10T00:01:09.0685494Z 2025-10-10T00:01:09.0685500Z 2025-10-10T00:01:09.0685897Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.0686591Z """ 2025-10-10T00:01:09.0687187Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.0687753Z 2025-10-10T00:01:09.0688215Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.0688933Z and the text below is the list of opted in users. 2025-10-10T00:01:09.0689437Z 2025-10-10T00:01:09.0689800Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.0690465Z """ 2025-10-10T00:01:09.0690888Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.0691444Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.0692013Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.0692566Z else: 2025-10-10T00:01:09.0692928Z return "", rollout_state 2025-10-10T00:01:09.0693212Z 2025-10-10T00:01:09.0693220Z 2025-10-10T00:01:09.0693415Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.0693893Z """ 2025-10-10T00:01:09.0694390Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.0694993Z """ 2025-10-10T00:01:09.0695191Z 2025-10-10T00:01:09.0695197Z 2025-10-10T00:01:09.0695520Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.0696127Z """ 2025-10-10T00:01:09.0696796Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.0697451Z 2025-10-10T00:01:09.0698039Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.0698968Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.0699712Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.0700163Z 2025-10-10T00:01:09.0700169Z 2025-10-10T00:01:09.0700319Z """ 2025-10-10T00:01:09.0700673Z optins = UserOptins() 2025-10-10T00:01:09.0701130Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.0701643Z user = user.strip("\r\n\t -") 2025-10-10T00:01:09.0702319Z if not user or not user.startswith("@"): 2025-10-10T00:01:09.0702836Z # Not a valid user. Skip 2025-10-10T00:01:09.0703289Z continue 2025-10-10T00:01:09.0703515Z 2025-10-10T00:01:09.0703667Z if user: 2025-10-10T00:01:09.0704087Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.0704734Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.0705200Z 2025-10-10T00:01:09.0705361Z return optins 2025-10-10T00:01:09.0705582Z 2025-10-10T00:01:09.0705588Z 2025-10-10T00:01:09.0705867Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.0706431Z """ 2025-10-10T00:01:09.0706812Z Check if the experiment name is valid. 2025-10-10T00:01:09.0707307Z A valid name: 2025-10-10T00:01:09.0707914Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.0708786Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.0709595Z - Cannot contain spaces 2025-10-10T00:01:09.0710038Z """ 2025-10-10T00:01:09.0710227Z 2025-10-10T00:01:09.0710472Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.0711133Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.0711544Z 2025-10-10T00:01:09.0711699Z if valid: 2025-10-10T00:01:09.0712063Z return True 2025-10-10T00:01:09.0712288Z 2025-10-10T00:01:09.0712443Z log.error( 2025-10-10T00:01:09.0713825Z 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-10-10T00:01:09.0715342Z ) 2025-10-10T00:01:09.0715675Z return False 2025-10-10T00:01:09.0715899Z 2025-10-10T00:01:09.0715905Z 2025-10-10T00:01:09.0716191Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.0716786Z """ 2025-10-10T00:01:09.0717471Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.0718156Z """ 2025-10-10T00:01:09.0718492Z try: 2025-10-10T00:01:09.0718853Z if settings_text: 2025-10-10T00:01:09.0719723Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.0720475Z # for easy reading 2025-10-10T00:01:09.0721209Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.0722051Z # the backtick character in shell commands. 2025-10-10T00:01:09.0722625Z backtick = chr(96) # backtick character 2025-10-10T00:01:09.0723242Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.0723868Z settings = load_yaml(settings_text) 2025-10-10T00:01:09.0724203Z 2025-10-10T00:01:09.0724592Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.0725305Z experiments = {} 2025-10-10T00:01:09.0725584Z 2025-10-10T00:01:09.0725944Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.0726657Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.0727702Z # 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-10-10T00:01:09.0728683Z continue 2025-10-10T00:01:09.0728956Z 2025-10-10T00:01:09.0729231Z valid_settings = {} 2025-10-10T00:01:09.0729721Z for setting in exp_settings: 2025-10-10T00:01:09.0730267Z if setting not in Experiment._fields: 2025-10-10T00:01:09.0730794Z log.warning( 2025-10-10T00:01:09.0731450Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.0732278Z ) 2025-10-10T00:01:09.0732677Z else: 2025-10-10T00:01:09.0733166Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.0733555Z 2025-10-10T00:01:09.0733807Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.0734398Z return Settings(experiments) 2025-10-10T00:01:09.0734721Z 2025-10-10T00:01:09.0734895Z except Exception: 2025-10-10T00:01:09.0735338Z log.exception("Failed to parse settings") 2025-10-10T00:01:09.0735700Z 2025-10-10T00:01:09.0735867Z return Settings() 2025-10-10T00:01:09.0736103Z 2025-10-10T00:01:09.0736110Z 2025-10-10T00:01:09.0736347Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.0736881Z """ 2025-10-10T00:01:09.0737281Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.0737657Z 2025-10-10T00:01:09.0737992Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.0738700Z and the text below is the list of opted in users. 2025-10-10T00:01:09.0739076Z 2025-10-10T00:01:09.0739565Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.0740269Z """ 2025-10-10T00:01:09.0740783Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.0741490Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.0741858Z 2025-10-10T00:01:09.0741864Z 2025-10-10T00:01:09.0742100Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.0742620Z """ 2025-10-10T00:01:09.0742988Z Parse users from the rollout state. 2025-10-10T00:01:09.0743316Z 2025-10-10T00:01:09.0743464Z """ 2025-10-10T00:01:09.0743957Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.0744639Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.0745017Z 2025-10-10T00:01:09.0745024Z 2025-10-10T00:01:09.0745528Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.0746224Z """ 2025-10-10T00:01:09.0746606Z Check if a user is opted into an experiment 2025-10-10T00:01:09.0747106Z """ 2025-10-10T00:01:09.0747525Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.0747913Z 2025-10-10T00:01:09.0747925Z 2025-10-10T00:01:09.0748315Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.0749008Z """ 2025-10-10T00:01:09.0749564Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.0750096Z """ 2025-10-10T00:01:09.0750567Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.0751235Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.0751826Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.0752394Z return False 2025-10-10T00:01:09.0752620Z 2025-10-10T00:01:09.0752877Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.0753435Z log.warning( 2025-10-10T00:01:09.0754186Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.0755010Z ) 2025-10-10T00:01:09.0755194Z 2025-10-10T00:01:09.0755362Z return True 2025-10-10T00:01:09.0755574Z 2025-10-10T00:01:09.0755580Z 2025-10-10T00:01:09.0755747Z def get_runner_prefix( 2025-10-10T00:01:09.0756161Z rollout_state: str, 2025-10-10T00:01:09.0756590Z workflow_requestors: Iterable[str], 2025-10-10T00:01:09.0757073Z branch: str, 2025-10-10T00:01:09.0757522Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.0758140Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.0758691Z is_canary: bool = False, 2025-10-10T00:01:09.0759359Z ) -> str: 2025-10-10T00:01:09.0759905Z settings = parse_settings(rollout_state) 2025-10-10T00:01:09.0760447Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.0760791Z 2025-10-10T00:01:09.0760963Z fleet_prefix = "" 2025-10-10T00:01:09.0761354Z prefixes = [] 2025-10-10T00:01:09.0761936Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.0762812Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.0763473Z log.info( 2025-10-10T00:01:09.0764098Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.0764808Z ) 2025-10-10T00:01:09.0765158Z continue 2025-10-10T00:01:09.0765383Z 2025-10-10T00:01:09.0765556Z if opt_out_experiments: 2025-10-10T00:01:09.0766046Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.0766635Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.0767181Z log.info( 2025-10-10T00:01:09.0768034Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.0768959Z ) 2025-10-10T00:01:09.0769429Z continue 2025-10-10T00:01:09.0769679Z 2025-10-10T00:01:09.0769853Z if eligible_experiments: 2025-10-10T00:01:09.0770379Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.0770954Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.0771475Z log.info( 2025-10-10T00:01:09.0772203Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.0772993Z ) 2025-10-10T00:01:09.0773363Z continue 2025-10-10T00:01:09.0773799Z elif not experiment_settings.default: 2025-10-10T00:01:09.0774307Z log.info( 2025-10-10T00:01:09.0775026Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.0775729Z ) 2025-10-10T00:01:09.0776075Z continue 2025-10-10T00:01:09.0776306Z 2025-10-10T00:01:09.0776566Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.0777128Z opted_out_users = [ 2025-10-10T00:01:09.0777549Z requestor 2025-10-10T00:01:09.0777977Z for requestor in workflow_requestors 2025-10-10T00:01:09.0778588Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.0779286Z ] 2025-10-10T00:01:09.0779484Z 2025-10-10T00:01:09.0779651Z if opted_out_users: 2025-10-10T00:01:09.0780062Z log.info( 2025-10-10T00:01:09.0780638Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.0781292Z ) 2025-10-10T00:01:09.0781651Z continue 2025-10-10T00:01:09.0781885Z 2025-10-10T00:01:09.0782133Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.0782704Z opted_in_users = [ 2025-10-10T00:01:09.0783113Z requestor 2025-10-10T00:01:09.0783530Z for requestor in workflow_requestors 2025-10-10T00:01:09.0784139Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.0784715Z ] 2025-10-10T00:01:09.0784904Z 2025-10-10T00:01:09.0785070Z enabled = False 2025-10-10T00:01:09.0785484Z if opted_in_users: 2025-10-10T00:01:09.0785898Z log.info( 2025-10-10T00:01:09.0786463Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.0787104Z ) 2025-10-10T00:01:09.0787453Z enabled = True 2025-10-10T00:01:09.0787712Z 2025-10-10T00:01:09.0787925Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.0788818Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.0789806Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.0790412Z log.info( 2025-10-10T00:01:09.0791213Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.0792085Z ) 2025-10-10T00:01:09.0792454Z enabled = True 2025-10-10T00:01:09.0792727Z 2025-10-10T00:01:09.0792895Z if enabled: 2025-10-10T00:01:09.0793284Z label = experiment_name 2025-10-10T00:01:09.0793789Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.0794555Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.0795369Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.0796074Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.0796673Z if is_canary: 2025-10-10T00:01:09.0797131Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.0797633Z fleet_prefix = label 2025-10-10T00:01:09.0798083Z else: 2025-10-10T00:01:09.0798473Z prefixes.append(label) 2025-10-10T00:01:09.0798797Z 2025-10-10T00:01:09.0798970Z if len(prefixes) > 1: 2025-10-10T00:01:09.0799488Z log.error( 2025-10-10T00:01:09.0800453Z 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-10-10T00:01:09.0801481Z ) 2025-10-10T00:01:09.0801839Z prefixes = prefixes[:1] 2025-10-10T00:01:09.0802127Z 2025-10-10T00:01:09.0802304Z # Fleet always comes first 2025-10-10T00:01:09.0802737Z if fleet_prefix: 2025-10-10T00:01:09.0803153Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.0803485Z 2025-10-10T00:01:09.0803838Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.0804228Z 2025-10-10T00:01:09.0804234Z 2025-10-10T00:01:09.0804643Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.0805363Z """ 2025-10-10T00:01:09.0805902Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.0806420Z 2025-10-10T00:01:09.0806775Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.0807419Z """ 2025-10-10T00:01:09.0807777Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.0808270Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.0808853Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.0809553Z 2025-10-10T00:01:09.0809560Z 2025-10-10T00:01:09.0809939Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.0810645Z for _ in range(num_retries): 2025-10-10T00:01:09.0811087Z try: 2025-10-10T00:01:09.0811477Z req = Request(url=url, headers=headers) 2025-10-10T00:01:09.0812094Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.0812689Z return json.loads(content) 2025-10-10T00:01:09.0813174Z except Exception as e: 2025-10-10T00:01:09.0813670Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.0814044Z 2025-10-10T00:01:09.0814394Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.0815054Z return {} 2025-10-10T00:01:09.0815254Z 2025-10-10T00:01:09.0815261Z 2025-10-10T00:01:09.0815405Z @cache 2025-10-10T00:01:09.0815978Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.0816682Z """ 2025-10-10T00:01:09.0817042Z Dynamically get PR information 2025-10-10T00:01:09.0817634Z """ 2025-10-10T00:01:09.0818088Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.0818674Z headers = { 2025-10-10T00:01:09.0819086Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.0819761Z "Authorization": f"token {github_token}", 2025-10-10T00:01:09.0820254Z } 2025-10-10T00:01:09.0820658Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.0821213Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.0821716Z headers=headers, 2025-10-10T00:01:09.0822112Z ) 2025-10-10T00:01:09.0822296Z 2025-10-10T00:01:09.0822463Z if not json_response: 2025-10-10T00:01:09.0822992Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.0823562Z return {} 2025-10-10T00:01:09.0823781Z 2025-10-10T00:01:09.0823951Z return json_response 2025-10-10T00:01:09.0824203Z 2025-10-10T00:01:09.0824210Z 2025-10-10T00:01:09.0824589Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.0825285Z """ 2025-10-10T00:01:09.0825769Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.0826372Z """ 2025-10-10T00:01:09.0826817Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.0827379Z return { 2025-10-10T00:01:09.0827917Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.0828567Z } 2025-10-10T00:01:09.0828755Z 2025-10-10T00:01:09.0828762Z 2025-10-10T00:01:09.0828924Z def main() -> None: 2025-10-10T00:01:09.0829405Z args = parse_args() 2025-10-10T00:01:09.0829658Z 2025-10-10T00:01:09.0829866Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.0830221Z 2025-10-10T00:01:09.0830407Z # Check if the PR is opt-out 2025-10-10T00:01:09.0830847Z if args.pr_number: 2025-10-10T00:01:09.0831444Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.0832256Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.0832722Z log.info( 2025-10-10T00:01:09.0833347Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.0834056Z ) 2025-10-10T00:01:09.0834561Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.0835175Z sys.exit() 2025-10-10T00:01:09.0835409Z 2025-10-10T00:01:09.0835564Z try: 2025-10-10T00:01:09.0835960Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.0836612Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.0837195Z ) 2025-10-10T00:01:09.0837387Z 2025-10-10T00:01:09.0837579Z username = get_potential_pr_author( 2025-10-10T00:01:09.0838077Z args.github_token, 2025-10-10T00:01:09.0838521Z args.github_repo, 2025-10-10T00:01:09.0838963Z args.github_actor, 2025-10-10T00:01:09.0839507Z args.github_ref_type, 2025-10-10T00:01:09.0839969Z args.github_branch, 2025-10-10T00:01:09.0840384Z ) 2025-10-10T00:01:09.0840571Z 2025-10-10T00:01:09.0840839Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.0841250Z 2025-10-10T00:01:09.0841449Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.0841966Z rollout_state, 2025-10-10T00:01:09.0842407Z (args.github_issue_owner, username), 2025-10-10T00:01:09.0842918Z args.github_branch, 2025-10-10T00:01:09.0843375Z args.eligible_experiments, 2025-10-10T00:01:09.0843869Z args.opt_out_experiments, 2025-10-10T00:01:09.0844331Z is_canary, 2025-10-10T00:01:09.0844709Z ) 2025-10-10T00:01:09.0844899Z 2025-10-10T00:01:09.0845072Z except Exception as e: 2025-10-10T00:01:09.0845487Z log.error( 2025-10-10T00:01:09.0846104Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.0846944Z ) 2025-10-10T00:01:09.0847141Z 2025-10-10T00:01:09.0847448Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.0847903Z 2025-10-10T00:01:09.0847909Z 2025-10-10T00:01:09.0848079Z if __name__ == "__main__": 2025-10-10T00:01:09.0848485Z main() 2025-10-10T00:01:09.0848681Z 2025-10-10T00:01:09.0934909Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.0935733Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.0967135Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.0967571Z env: 2025-10-10T00:01:09.0968124Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.0968513Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.0968931Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.0969510Z ISSUE_OWNER: 2025-10-10T00:01:09.0969877Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.0970272Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.0970678Z PR_NUMBER: 2025-10-10T00:01:09.0971024Z ##[endgroup] 2025-10-10T00:01:11.5994078Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:12.9465109Z Collecting urllib3==1.26.18 2025-10-10T00:01:12.9801366Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:13.0031723Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-10-10T00:01:13.0323444Z Collecting PyGithub==2.3.0 2025-10-10T00:01:13.0369930Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:13.0823283Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:13.0856098Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:13.0901224Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:13.0917708Z 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-10-10T00:01:13.0932949Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:13.1171012Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:13.1230020Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:13.1454955Z 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-10-10T00:01:13.2707600Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.2743546Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:13.4126646Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:13.4158366Z 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-10-10T00:01:13.4342654Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.4396196Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:13.4618572Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:13.4679841Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 32.0 MB/s eta 0:00:00 2025-10-10T00:01:13.4731934Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:13.4787344Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 89.3 MB/s eta 0:00:00 2025-10-10T00:01:13.4820648Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:13.4937729Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 138.7 MB/s eta 0:00:00 2025-10-10T00:01:13.4978035Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:13.5031083Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:13.5078805Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 65.1 MB/s eta 0:00:00 2025-10-10T00:01:13.5116418Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:13.5158609Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 30.3 MB/s eta 0:00:00 2025-10-10T00:01:13.5195767Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:13.5236442Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 43.6 MB/s eta 0:00:00 2025-10-10T00:01:13.8864348Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:14.4178420Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:14.4983805Z ##[group]Run curr_branch="main" 2025-10-10T00:01:14.4984120Z curr_branch="main" 2025-10-10T00:01:14.4984343Z curr_ref_type="branch" 2025-10-10T00:01:14.4984601Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:14.4984885Z  2025-10-10T00:01:14.4985081Z python3 runner_determinator.py \ 2025-10-10T00:01:14.4985384Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:14.4985662Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:14.4985928Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:14.4986202Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:14.4986497Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:14.4986784Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:14.4987063Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:14.4987369Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:14.4987740Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:14.4988032Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:14.5021369Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:14.5021629Z env: 2025-10-10T00:01:14.5022116Z GITHUB_TOKEN: *** 2025-10-10T00:01:14.5022318Z ISSUE_NUMBER: 5132 2025-10-10T00:01:14.5022524Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:14.5022779Z ISSUE_OWNER: 2025-10-10T00:01:14.5022959Z CHECK_EXPERIMENTS: 2025-10-10T00:01:14.5023162Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:14.5023354Z PR_NUMBER: 2025-10-10T00:01:14.5023529Z ##[endgroup] 2025-10-10T00:01:14.5072963Z Current branch is 'main' 2025-10-10T00:01:16.2948191Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-10-10T00:01:16.2949708Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:16.2951403Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:16.2952360Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:16.2953085Z INFO : Setting output: label-type='lf.' 2025-10-10T00:01:16.3262705Z Evaluate and set job outputs 2025-10-10T00:01:16.3269498Z Set output 'label-type' 2025-10-10T00:01:16.3271741Z Cleaning up orphan processes