2025-08-14T20:43:47.8557772Z Current runner version: '2.327.1' 2025-08-14T20:43:47.8581933Z ##[group]Runner Image Provisioner 2025-08-14T20:43:47.8583066Z Hosted Compute Agent 2025-08-14T20:43:47.8583641Z Version: 20250812.370 2025-08-14T20:43:47.8584224Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.8585002Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.8585592Z ##[endgroup] 2025-08-14T20:43:47.8586076Z ##[group]Operating System 2025-08-14T20:43:47.8586689Z Ubuntu 2025-08-14T20:43:47.8587123Z 24.04.2 2025-08-14T20:43:47.8587586Z LTS 2025-08-14T20:43:47.8588126Z ##[endgroup] 2025-08-14T20:43:47.8588587Z ##[group]Runner Image 2025-08-14T20:43:47.8589136Z Image: ubuntu-24.04 2025-08-14T20:43:47.8589642Z Version: 20250804.2.0 2025-08-14T20:43:47.8590655Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.8592160Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:47.8593402Z ##[endgroup] 2025-08-14T20:43:47.8594363Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.8596709Z Contents: read 2025-08-14T20:43:47.8597256Z Metadata: read 2025-08-14T20:43:47.8597694Z ##[endgroup] 2025-08-14T20:43:47.8599967Z Secret source: Actions 2025-08-14T20:43:47.8600656Z Prepare workflow directory 2025-08-14T20:43:47.9121504Z Prepare all required actions 2025-08-14T20:43:47.9181599Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.9186953Z ##[group] Inputs 2025-08-14T20:43:47.9187550Z check_experiments: 2025-08-14T20:43:47.9188236Z opt_out_experiments: 2025-08-14T20:43:47.9188792Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.9189390Z issue_owner: 2025-08-14T20:43:47.9189838Z curr_branch: main 2025-08-14T20:43:47.9190439Z curr_ref_type: branch 2025-08-14T20:43:47.9191136Z issue_number: 5132 2025-08-14T20:43:47.9191647Z ##[endgroup] 2025-08-14T20:43:47.9192851Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:43:48.6484872Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:48.6487328Z cat < runner_determinator.py 2025-08-14T20:43:48.6488016Z # flake8: noqa: G004 2025-08-14T20:43:48.6488542Z  2025-08-14T20:43:48.6489347Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:48.6490402Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:48.6491318Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:48.6492098Z  2025-08-14T20:43:48.6492747Z """ 2025-08-14T20:43:48.6493438Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:48.6494513Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:48.6495652Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:48.6496662Z of which runners should be used to run which job. 2025-08-14T20:43:48.6497313Z  2025-08-14T20:43:48.6498008Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:48.6499078Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:48.6500063Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:48.6500903Z list, defined. 2025-08-14T20:43:48.6501374Z  2025-08-14T20:43:48.6502172Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:48.6503590Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:48.6504557Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:48.6505365Z  2025-08-14T20:43:48.6506334Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:48.6507315Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:48.6508258Z experiments which the user could be opted in to. 2025-08-14T20:43:48.6508929Z  2025-08-14T20:43:48.6509417Z The user list has the following rules: 2025-08-14T20:43:48.6510091Z  2025-08-14T20:43:48.6510746Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:48.6511671Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:48.6512837Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:48.6513468Z  2025-08-14T20:43:48.6513926Z Example config: 2025-08-14T20:43:48.6514630Z  # A list of experiments that can be opted into. 2025-08-14T20:43:48.6515434Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:48.6516195Z  # Expected syntax is: 2025-08-14T20:43:48.6596015Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:48.6597149Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:48.6597939Z  2025-08-14T20:43:48.6598288Z  experiments: 2025-08-14T20:43:48.6598715Z  lf: 2025-08-14T20:43:48.6599121Z  rollout_percent: 25 2025-08-14T20:43:48.6599617Z  all_branches: false 2025-08-14T20:43:48.6600094Z  default: true 2025-08-14T20:43:48.6600531Z  --- 2025-08-14T20:43:48.6600892Z  2025-08-14T20:43:48.6601235Z  # Opt-ins: 2025-08-14T20:43:48.6601916Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:48.6603620Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:48.6604448Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:48.6605151Z  # Experiments should be from the above list. 2025-08-14T20:43:48.6605715Z  2025-08-14T20:43:48.6606100Z  @User1,-lf,split_build 2025-08-14T20:43:48.6606591Z  @User2,lf 2025-08-14T20:43:48.6607022Z  @User3,split_build 2025-08-14T20:43:48.6607472Z """ 2025-08-14T20:43:48.6607832Z  2025-08-14T20:43:48.6608186Z import json 2025-08-14T20:43:48.6608589Z import logging 2025-08-14T20:43:48.6609007Z import os 2025-08-14T20:43:48.6609409Z import random 2025-08-14T20:43:48.6609825Z import re 2025-08-14T20:43:48.6610213Z import sys 2025-08-14T20:43:48.6610667Z from argparse import ArgumentParser 2025-08-14T20:43:48.6611309Z from collections.abc import Iterable 2025-08-14T20:43:48.6611856Z from functools import cache 2025-08-14T20:43:48.6612371Z from logging import LogRecord 2025-08-14T20:43:48.6613028Z from typing import Any, NamedTuple 2025-08-14T20:43:48.6613632Z from urllib.request import Request, urlopen 2025-08-14T20:43:48.6614173Z  2025-08-14T20:43:48.6614529Z import yaml 2025-08-14T20:43:48.6614959Z from github import Auth, Github 2025-08-14T20:43:48.6615491Z from github.Issue import Issue 2025-08-14T20:43:48.6616026Z  2025-08-14T20:43:48.6616370Z  2025-08-14T20:43:48.6616807Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:48.6617531Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:48.6618412Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:48.6619117Z  2025-08-14T20:43:48.6619780Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:48.6620387Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:48.6620945Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:48.6621538Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:48.6622071Z  2025-08-14T20:43:48.6622578Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:48.6623090Z  2025-08-14T20:43:48.6623475Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:48.6623971Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:48.6624434Z  2025-08-14T20:43:48.6624781Z  2025-08-14T20:43:48.6625161Z class Experiment(NamedTuple): 2025-08-14T20:43:48.6625684Z  rollout_perc: float = ( 2025-08-14T20:43:48.6626397Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:48.6627078Z  ) 2025-08-14T20:43:48.6627470Z  all_branches: bool = ( 2025-08-14T20:43:48.6628158Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:48.6628832Z  ) 2025-08-14T20:43:48.6629216Z  default: bool = ( 2025-08-14T20:43:48.6629837Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:48.6630466Z  ) 2025-08-14T20:43:48.6630831Z  2025-08-14T20:43:48.6631205Z  # Add more fields as needed 2025-08-14T20:43:48.6631696Z  2025-08-14T20:43:48.6632027Z  2025-08-14T20:43:48.6632540Z class Settings(NamedTuple): 2025-08-14T20:43:48.6633019Z  """ 2025-08-14T20:43:48.6633519Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:48.6634104Z  """ 2025-08-14T20:43:48.6634518Z  2025-08-14T20:43:48.6634930Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:48.6635447Z  2025-08-14T20:43:48.6635932Z  2025-08-14T20:43:48.6636353Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:48.6637017Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:48.6637616Z  2025-08-14T20:43:48.6637966Z  COLORS = { 2025-08-14T20:43:48.6638415Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:48.6638937Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:48.6639458Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:48.6639977Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:48.6640497Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:48.6640981Z  } 2025-08-14T20:43:48.6641344Z  2025-08-14T20:43:48.6641771Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:48.6642629Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:48.6643425Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:48.6644013Z  return super().format(record) 2025-08-14T20:43:48.6644514Z  2025-08-14T20:43:48.6644846Z  2025-08-14T20:43:48.6645237Z handler = logging.StreamHandler() 2025-08-14T20:43:48.6645991Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:48.6646705Z  2025-08-14T20:43:48.6647183Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:48.6647802Z log.addHandler(handler) 2025-08-14T20:43:48.6648295Z log.setLevel(logging.INFO) 2025-08-14T20:43:48.6648765Z  2025-08-14T20:43:48.6649164Z  2025-08-14T20:43:48.6649636Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:48.6650229Z  """ 2025-08-14T20:43:48.6650775Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:48.6651538Z  """ 2025-08-14T20:43:48.6651938Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:48.6653144Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:48.6654245Z  log.warning( 2025-08-14T20:43:48.6655119Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:48.6656031Z  ) 2025-08-14T20:43:48.6656508Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:48.6657054Z  return 2025-08-14T20:43:48.6657460Z  2025-08-14T20:43:48.6657859Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:48.6658463Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:48.6659076Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:48.6659588Z  2025-08-14T20:43:48.6659939Z  2025-08-14T20:43:48.6660452Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:48.6661113Z  return frozenset( 2025-08-14T20:43:48.6661767Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:48.6662562Z  ) 2025-08-14T20:43:48.6662938Z  2025-08-14T20:43:48.6663284Z  2025-08-14T20:43:48.6663665Z def parse_args() -> Any: 2025-08-14T20:43:48.6664281Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:48.6665200Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:48.6665963Z  parser.add_argument( 2025-08-14T20:43:48.6666456Z  "--github-issue-repo", 2025-08-14T20:43:48.6666959Z  type=str, 2025-08-14T20:43:48.6667423Z  required=False, 2025-08-14T20:43:48.6668045Z  default="pytorch/test-infra", 2025-08-14T20:43:48.6668629Z  help="GitHub repo to get the issue", 2025-08-14T20:43:48.6669155Z  ) 2025-08-14T20:43:48.6669544Z  parser.add_argument( 2025-08-14T20:43:48.6670026Z  "--github-repo", 2025-08-14T20:43:48.6670488Z  type=str, 2025-08-14T20:43:48.6670928Z  required=True, 2025-08-14T20:43:48.6671440Z  help="GitHub repo where CI is running", 2025-08-14T20:43:48.6671973Z  ) 2025-08-14T20:43:48.6672365Z  parser.add_argument( 2025-08-14T20:43:48.6673166Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:48.6673841Z  ) 2025-08-14T20:43:48.6674229Z  parser.add_argument( 2025-08-14T20:43:48.6674912Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:48.6675601Z  ) 2025-08-14T20:43:48.6675996Z  parser.add_argument( 2025-08-14T20:43:48.6676681Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:48.6677375Z  ) 2025-08-14T20:43:48.6677773Z  parser.add_argument( 2025-08-14T20:43:48.6678477Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:48.6679188Z  ) 2025-08-14T20:43:48.6679581Z  parser.add_argument( 2025-08-14T20:43:48.6680075Z  "--github-ref-type", 2025-08-14T20:43:48.6680558Z  type=str, 2025-08-14T20:43:48.6681005Z  required=True, 2025-08-14T20:43:48.6681553Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:48.6682113Z  ) 2025-08-14T20:43:48.6682831Z  parser.add_argument( 2025-08-14T20:43:48.6683507Z  "--eligible-experiments", 2025-08-14T20:43:48.6684064Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:48.6684601Z  required=False, 2025-08-14T20:43:48.6685065Z  default="", 2025-08-14T20:43:48.6685953Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:48.6686869Z  ) 2025-08-14T20:43:48.6687278Z  parser.add_argument( 2025-08-14T20:43:48.6687775Z  "--opt-out-experiments", 2025-08-14T20:43:48.6688325Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:48.6688861Z  required=False, 2025-08-14T20:43:48.6689313Z  default="", 2025-08-14T20:43:48.6689761Z  help=( 2025-08-14T20:43:48.6690480Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:48.6691617Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:48.6692606Z  ), 2025-08-14T20:43:48.6692993Z  ) 2025-08-14T20:43:48.6693387Z  parser.add_argument( 2025-08-14T20:43:48.6693862Z  "--pr-number", 2025-08-14T20:43:48.6694321Z  type=str, 2025-08-14T20:43:48.6694770Z  required=False, 2025-08-14T20:43:48.6695226Z  default="", 2025-08-14T20:43:48.6695765Z  help="the optional PR number where this is run", 2025-08-14T20:43:48.6696326Z  ) 2025-08-14T20:43:48.6696689Z  2025-08-14T20:43:48.6697070Z  return parser.parse_args() 2025-08-14T20:43:48.6697563Z  2025-08-14T20:43:48.6697897Z  2025-08-14T20:43:48.6698520Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.6699440Z  auth = Auth.Token(github_token) 2025-08-14T20:43:48.6699979Z  return Github(auth=auth) 2025-08-14T20:43:48.6700451Z  2025-08-14T20:43:48.6700793Z  2025-08-14T20:43:48.6701451Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.6702275Z  repo = gh.get_repo(repo) 2025-08-14T20:43:48.6702913Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:48.6703446Z  2025-08-14T20:43:48.6703780Z  2025-08-14T20:43:48.6704153Z def get_potential_pr_author( 2025-08-14T20:43:48.6704837Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:48.6705537Z ) -> str: 2025-08-14T20:43:48.6706092Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:48.6706915Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:48.6707723Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:48.6708294Z  2025-08-14T20:43:48.6708686Z  gh = get_gh_client(github_token) 2025-08-14T20:43:48.6709187Z  2025-08-14T20:43:48.6709670Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:48.6710309Z  split_tag = ref_name.split("/") 2025-08-14T20:43:48.6710831Z  if ( 2025-08-14T20:43:48.6711282Z  len(split_tag) == 3 2025-08-14T20:43:48.6711802Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:48.6712361Z  and split_tag[2].isnumeric() 2025-08-14T20:43:48.6713037Z  ): 2025-08-14T20:43:48.6713465Z  pr_number = split_tag[2] 2025-08-14T20:43:48.6713966Z  try: 2025-08-14T20:43:48.6714444Z  repository = gh.get_repo(repo) 2025-08-14T20:43:48.6715238Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:48.6715868Z  except Exception as e: 2025-08-14T20:43:48.6716424Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:48.6717117Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:48.6717763Z  ) from e 2025-08-14T20:43:48.6718351Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:48.6719080Z  # In all other cases, return the original input username 2025-08-14T20:43:48.6719686Z  return username 2025-08-14T20:43:48.6720115Z  2025-08-14T20:43:48.6720462Z  2025-08-14T20:43:48.6720894Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:48.6721441Z  """ 2025-08-14T20:43:48.6722117Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:48.6723016Z  """ 2025-08-14T20:43:48.6723597Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:48.6724256Z  2025-08-14T20:43:48.6724601Z  2025-08-14T20:43:48.6725002Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:48.6725518Z  try: 2025-08-14T20:43:48.6725937Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:48.6726462Z  return data 2025-08-14T20:43:48.6726926Z  except yaml.YAMLError: 2025-08-14T20:43:48.6727456Z  log.exception("Error loading YAML") 2025-08-14T20:43:48.6727979Z  raise 2025-08-14T20:43:48.6728372Z  2025-08-14T20:43:48.6728708Z  2025-08-14T20:43:48.6729318Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:48.6730051Z  """ 2025-08-14T20:43:48.6730859Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:48.6731667Z  2025-08-14T20:43:48.6732213Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.6733092Z  and the text below is the list of opted in users. 2025-08-14T20:43:48.6733658Z  2025-08-14T20:43:48.6734229Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:48.6734921Z  """ 2025-08-14T20:43:48.6735398Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:48.6736006Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:48.6736643Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:48.6737229Z  else: 2025-08-14T20:43:48.6737639Z  return "", rollout_state 2025-08-14T20:43:48.6738360Z  2025-08-14T20:43:48.6738741Z  2025-08-14T20:43:48.6739154Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:48.6739675Z  """ 2025-08-14T20:43:48.6740221Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:48.6740870Z  """ 2025-08-14T20:43:48.6741239Z  2025-08-14T20:43:48.6741565Z  2025-08-14T20:43:48.6742105Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:48.6742862Z  """ 2025-08-14T20:43:48.6743593Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:48.6744407Z  2025-08-14T20:43:48.6745195Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:48.6746169Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:48.6747015Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:48.6747641Z  2025-08-14T20:43:48.6747962Z  2025-08-14T20:43:48.6748299Z  """ 2025-08-14T20:43:48.6748688Z  optins = UserOptins() 2025-08-14T20:43:48.6749221Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:48.6749803Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:48.6750375Z  if not user or not user.startswith("@"): 2025-08-14T20:43:48.6750955Z  # Not a valid user. Skip 2025-08-14T20:43:48.6751453Z  continue 2025-08-14T20:43:48.6751874Z  2025-08-14T20:43:48.6752221Z  if user: 2025-08-14T20:43:48.6752894Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:48.6753597Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:48.6754247Z  2025-08-14T20:43:48.6754612Z  return optins 2025-08-14T20:43:48.6755029Z  2025-08-14T20:43:48.6755357Z  2025-08-14T20:43:48.6755856Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:48.6756471Z  """ 2025-08-14T20:43:48.6756894Z  Check if the experiment name is valid. 2025-08-14T20:43:48.6757426Z  A valid name: 2025-08-14T20:43:48.6758102Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:48.6759037Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:48.6759750Z  - Cannot contain spaces 2025-08-14T20:43:48.6760223Z  """ 2025-08-14T20:43:48.6760585Z  2025-08-14T20:43:48.6761046Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:48.6761771Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:48.6763166Z  2025-08-14T20:43:48.6763597Z  if valid: 2025-08-14T20:43:48.6764018Z  return True 2025-08-14T20:43:48.6764443Z  2025-08-14T20:43:48.6764797Z  log.error( 2025-08-14T20:43:48.6766225Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:48.6767698Z  ) 2025-08-14T20:43:48.6768084Z  return False 2025-08-14T20:43:48.6768490Z  2025-08-14T20:43:48.6768829Z  2025-08-14T20:43:48.6769342Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:48.6769984Z  """ 2025-08-14T20:43:48.6770593Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:48.6771305Z  """ 2025-08-14T20:43:48.6771673Z  try: 2025-08-14T20:43:48.6772066Z  if settings_text: 2025-08-14T20:43:48.6772949Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:48.6773730Z  # for easy reading 2025-08-14T20:43:48.6774551Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:48.6775427Z  # the backtick character in shell commands. 2025-08-14T20:43:48.6776055Z  backtick = chr(96) # backtick character 2025-08-14T20:43:48.6776737Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:48.6777403Z  settings = load_yaml(settings_text) 2025-08-14T20:43:48.6777919Z  2025-08-14T20:43:48.6778511Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:48.6779395Z  experiments = {} 2025-08-14T20:43:48.6779855Z  2025-08-14T20:43:48.6780416Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:48.6781175Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:48.6782248Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:48.6783365Z  continue 2025-08-14T20:43:48.6783814Z  2025-08-14T20:43:48.6784187Z  valid_settings = {} 2025-08-14T20:43:48.6784728Z  for setting in exp_settings: 2025-08-14T20:43:48.6785304Z  if setting not in Experiment._fields: 2025-08-14T20:43:48.6785881Z  log.warning( 2025-08-14T20:43:48.6786617Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:48.6787316Z  ) 2025-08-14T20:43:48.6787761Z  else: 2025-08-14T20:43:48.6788313Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:48.6788881Z  2025-08-14T20:43:48.6789348Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:48.6789997Z  return Settings(experiments) 2025-08-14T20:43:48.6790492Z  2025-08-14T20:43:48.6790850Z  except Exception: 2025-08-14T20:43:48.6791365Z  log.exception("Failed to parse settings") 2025-08-14T20:43:48.6791894Z  2025-08-14T20:43:48.6792252Z  return Settings() 2025-08-14T20:43:48.6792771Z  2025-08-14T20:43:48.6793112Z  2025-08-14T20:43:48.6793746Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:48.6794336Z  """ 2025-08-14T20:43:48.6794794Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:48.6795344Z  2025-08-14T20:43:48.6795882Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.6796650Z  and the text below is the list of opted in users. 2025-08-14T20:43:48.6797204Z  2025-08-14T20:43:48.6797799Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:48.6798522Z  """ 2025-08-14T20:43:48.6799101Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.6799877Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:48.6800438Z  2025-08-14T20:43:48.6800775Z  2025-08-14T20:43:48.6801236Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:48.6801829Z  """ 2025-08-14T20:43:48.6802247Z  Parse users from the rollout state. 2025-08-14T20:43:48.6802840Z  2025-08-14T20:43:48.6803175Z  """ 2025-08-14T20:43:48.6803725Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.6804474Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:48.6805015Z  2025-08-14T20:43:48.6805353Z  2025-08-14T20:43:48.6805974Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.6806704Z  """ 2025-08-14T20:43:48.6807156Z  Check if a user is opted into an experiment 2025-08-14T20:43:48.6807685Z  """ 2025-08-14T20:43:48.6808173Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:48.6808742Z  2025-08-14T20:43:48.6809203Z  2025-08-14T20:43:48.6809820Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.6810556Z  """ 2025-08-14T20:43:48.6811046Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:48.6811648Z  """ 2025-08-14T20:43:48.6812181Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:48.6812992Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:48.6813694Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:48.6814294Z  return False 2025-08-14T20:43:48.6814708Z  2025-08-14T20:43:48.6815171Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:48.6815766Z  log.warning( 2025-08-14T20:43:48.6816588Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:48.6817441Z  ) 2025-08-14T20:43:48.6817829Z  2025-08-14T20:43:48.6818173Z  return True 2025-08-14T20:43:48.6818570Z  2025-08-14T20:43:48.6818906Z  2025-08-14T20:43:48.6819260Z def get_runner_prefix( 2025-08-14T20:43:48.6819723Z  rollout_state: str, 2025-08-14T20:43:48.6820214Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:48.6820787Z  branch: str, 2025-08-14T20:43:48.6821316Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.6822014Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.6822695Z  is_canary: bool = False, 2025-08-14T20:43:48.6823163Z ) -> str: 2025-08-14T20:43:48.6823617Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:48.6824200Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:48.6824730Z  2025-08-14T20:43:48.6825198Z  fleet_prefix = "" 2025-08-14T20:43:48.6825660Z  prefixes = [] 2025-08-14T20:43:48.6826324Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:48.6827264Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:48.6827973Z  log.info( 2025-08-14T20:43:48.6828680Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:48.6829406Z  ) 2025-08-14T20:43:48.6829824Z  continue 2025-08-14T20:43:48.6830253Z  2025-08-14T20:43:48.6830620Z  if opt_out_experiments: 2025-08-14T20:43:48.6831179Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:48.6831818Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:48.6832628Z  log.info( 2025-08-14T20:43:48.6833567Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:48.6834498Z  ) 2025-08-14T20:43:48.6834924Z  continue 2025-08-14T20:43:48.6835371Z  2025-08-14T20:43:48.6835744Z  if eligible_experiments: 2025-08-14T20:43:48.6836338Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:48.6836983Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:48.6837541Z  log.info( 2025-08-14T20:43:48.6838330Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:48.6839140Z  ) 2025-08-14T20:43:48.6839693Z  continue 2025-08-14T20:43:48.6840214Z  elif not experiment_settings.default: 2025-08-14T20:43:48.6840747Z  log.info( 2025-08-14T20:43:48.6841429Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:48.6842145Z  ) 2025-08-14T20:43:48.6842645Z  continue 2025-08-14T20:43:48.6843073Z  2025-08-14T20:43:48.6843550Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:48.6844163Z  opted_out_users = [ 2025-08-14T20:43:48.6844641Z  requestor 2025-08-14T20:43:48.6845144Z  for requestor in workflow_requestors 2025-08-14T20:43:48.6845834Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.6846453Z  ] 2025-08-14T20:43:48.6846829Z  2025-08-14T20:43:48.6847202Z  if opted_out_users: 2025-08-14T20:43:48.6847679Z  log.info( 2025-08-14T20:43:48.6848333Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:48.6849054Z  ) 2025-08-14T20:43:48.6849464Z  continue 2025-08-14T20:43:48.6849877Z  2025-08-14T20:43:48.6850352Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:48.6850957Z  opted_in_users = [ 2025-08-14T20:43:48.6851421Z  requestor 2025-08-14T20:43:48.6851915Z  for requestor in workflow_requestors 2025-08-14T20:43:48.6852679Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.6853294Z  ] 2025-08-14T20:43:48.6853664Z  2025-08-14T20:43:48.6854021Z  enabled = False 2025-08-14T20:43:48.6854511Z  if opted_in_users: 2025-08-14T20:43:48.6855107Z  log.info( 2025-08-14T20:43:48.6855764Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:48.6856429Z  ) 2025-08-14T20:43:48.6856846Z  enabled = True 2025-08-14T20:43:48.6857289Z  2025-08-14T20:43:48.6857706Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:48.6858532Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:48.6859451Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:48.6860091Z  log.info( 2025-08-14T20:43:48.6860959Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:48.6861845Z  ) 2025-08-14T20:43:48.6862285Z  enabled = True 2025-08-14T20:43:48.6862871Z  2025-08-14T20:43:48.6863244Z  if enabled: 2025-08-14T20:43:48.6863706Z  label = experiment_name 2025-08-14T20:43:48.6864288Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.6865104Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.6865976Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.6866744Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.6867421Z  if is_canary: 2025-08-14T20:43:48.6867940Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.6868488Z  fleet_prefix = label 2025-08-14T20:43:48.6868989Z  else: 2025-08-14T20:43:48.6869583Z  prefixes.append(label) 2025-08-14T20:43:48.6870091Z  2025-08-14T20:43:48.6870455Z  if len(prefixes) > 1: 2025-08-14T20:43:48.6870924Z  log.error( 2025-08-14T20:43:48.6871964Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:48.6873119Z  ) 2025-08-14T20:43:48.6873531Z  prefixes = prefixes[:1] 2025-08-14T20:43:48.6874035Z  2025-08-14T20:43:48.6874410Z  # Fleet always comes first 2025-08-14T20:43:48.6874902Z  if fleet_prefix: 2025-08-14T20:43:48.6875392Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.6875914Z  2025-08-14T20:43:48.6876371Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.6876935Z  2025-08-14T20:43:48.6877272Z  2025-08-14T20:43:48.6877913Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.6878666Z  """ 2025-08-14T20:43:48.6879276Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.6879962Z  2025-08-14T20:43:48.6880536Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.6881237Z  """ 2025-08-14T20:43:48.6881643Z  gh = get_gh_client(github_token) 2025-08-14T20:43:48.6882214Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.6882970Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.6883556Z  2025-08-14T20:43:48.6883887Z  2025-08-14T20:43:48.6884477Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.6885347Z  for _ in range(num_retries): 2025-08-14T20:43:48.6885855Z  try: 2025-08-14T20:43:48.6886316Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:48.6886988Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.6887635Z  return json.loads(content) 2025-08-14T20:43:48.6888164Z  except Exception as e: 2025-08-14T20:43:48.6888734Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.6889280Z  2025-08-14T20:43:48.6889850Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.6890556Z  return {} 2025-08-14T20:43:48.6890949Z  2025-08-14T20:43:48.6891286Z  2025-08-14T20:43:48.6891644Z @cache 2025-08-14T20:43:48.6892294Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.6893137Z  """ 2025-08-14T20:43:48.6893569Z  Dynamically get PR information 2025-08-14T20:43:48.6894062Z  """ 2025-08-14T20:43:48.6894603Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.6895223Z  headers = { 2025-08-14T20:43:48.6895723Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.6896350Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:48.6896873Z  } 2025-08-14T20:43:48.6897321Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.6897933Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.6898468Z  headers=headers, 2025-08-14T20:43:48.6898917Z  ) 2025-08-14T20:43:48.6899270Z  2025-08-14T20:43:48.6899631Z  if not json_response: 2025-08-14T20:43:48.6900233Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.6900981Z  return {} 2025-08-14T20:43:48.6901400Z  2025-08-14T20:43:48.6901788Z  return json_response 2025-08-14T20:43:48.6902240Z  2025-08-14T20:43:48.6902662Z  2025-08-14T20:43:48.6903250Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.6903954Z  """ 2025-08-14T20:43:48.6904510Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.6905141Z  """ 2025-08-14T20:43:48.6905650Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.6906261Z  return { 2025-08-14T20:43:48.6906874Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.6907544Z  } 2025-08-14T20:43:48.6907899Z  2025-08-14T20:43:48.6908246Z  2025-08-14T20:43:48.6908594Z def main() -> None: 2025-08-14T20:43:48.6909052Z  args = parse_args() 2025-08-14T20:43:48.6909495Z  2025-08-14T20:43:48.6909927Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.6910470Z  2025-08-14T20:43:48.6910839Z  # Check if the PR is opt-out 2025-08-14T20:43:48.6911352Z  if args.pr_number: 2025-08-14T20:43:48.6912039Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.6912906Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.6913409Z  log.info( 2025-08-14T20:43:48.6914127Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.6914876Z  ) 2025-08-14T20:43:48.6915456Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.6916136Z  sys.exit() 2025-08-14T20:43:48.6916701Z  2025-08-14T20:43:48.6917050Z  try: 2025-08-14T20:43:48.6917527Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.6918243Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.6918869Z  ) 2025-08-14T20:43:48.6919237Z  2025-08-14T20:43:48.6919635Z  username = get_potential_pr_author( 2025-08-14T20:43:48.6920195Z  args.github_token, 2025-08-14T20:43:48.6920692Z  args.github_repo, 2025-08-14T20:43:48.6921186Z  args.github_actor, 2025-08-14T20:43:48.6921700Z  args.github_ref_type, 2025-08-14T20:43:48.6922214Z  args.github_branch, 2025-08-14T20:43:48.6922904Z  ) 2025-08-14T20:43:48.6923280Z  2025-08-14T20:43:48.6923786Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.6924386Z  2025-08-14T20:43:48.6924798Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.6925351Z  rollout_state, 2025-08-14T20:43:48.6925873Z  (args.github_issue_owner, username), 2025-08-14T20:43:48.6926423Z  args.github_branch, 2025-08-14T20:43:48.6926957Z  args.eligible_experiments, 2025-08-14T20:43:48.6927499Z  args.opt_out_experiments, 2025-08-14T20:43:48.6928033Z  is_canary, 2025-08-14T20:43:48.6928552Z  ) 2025-08-14T20:43:48.6928924Z  2025-08-14T20:43:48.6929298Z  except Exception as e: 2025-08-14T20:43:48.6929783Z  log.error( 2025-08-14T20:43:48.6930481Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.6931361Z  ) 2025-08-14T20:43:48.6931741Z  2025-08-14T20:43:48.6932277Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.6933037Z  2025-08-14T20:43:48.6933373Z  2025-08-14T20:43:48.6933728Z if __name__ == "__main__": 2025-08-14T20:43:48.6934364Z  main() 2025-08-14T20:43:48.6934808Z  2025-08-14T20:43:48.6935370Z EOF 2025-08-14T20:43:48.6935817Z  2025-08-14T20:43:48.6936254Z cat runner_determinator.py 2025-08-14T20:43:48.7267541Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.7268984Z env: 2025-08-14T20:43:48.7269676Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.7270081Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.7270510Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.7270980Z ISSUE_OWNER: 2025-08-14T20:43:48.7271356Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.7271766Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.7272177Z PR_NUMBER: 2025-08-14T20:43:48.7272883Z ##[endgroup] 2025-08-14T20:43:48.7490804Z # flake8: noqa: G004 2025-08-14T20:43:48.7491159Z 2025-08-14T20:43:48.7491575Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:48.7492720Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:48.7493513Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:48.7493936Z 2025-08-14T20:43:48.7494086Z """ 2025-08-14T20:43:48.7494625Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:48.7495447Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:48.7496290Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:48.7497083Z of which runners should be used to run which job. 2025-08-14T20:43:48.7497455Z 2025-08-14T20:43:48.7497820Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:48.7498881Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:48.7499714Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:48.7500355Z list, defined. 2025-08-14T20:43:48.7500574Z 2025-08-14T20:43:48.7500910Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:48.7501756Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:48.7503205Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:48.7503657Z 2025-08-14T20:43:48.7504017Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:48.7504829Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:48.7505520Z experiments which the user could be opted in to. 2025-08-14T20:43:48.7505896Z 2025-08-14T20:43:48.7506079Z The user list has the following rules: 2025-08-14T20:43:48.7506411Z 2025-08-14T20:43:48.7506717Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:48.7507525Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:48.7508237Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:48.7508607Z 2025-08-14T20:43:48.7508770Z Example config: 2025-08-14T20:43:48.7509190Z # A list of experiments that can be opted into. 2025-08-14T20:43:48.7509822Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:48.7510393Z # Expected syntax is: 2025-08-14T20:43:48.7511003Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:48.7511919Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:48.7512724Z 2025-08-14T20:43:48.7512886Z experiments: 2025-08-14T20:43:48.7513298Z lf: 2025-08-14T20:43:48.7513646Z rollout_percent: 25 2025-08-14T20:43:48.7514252Z all_branches: false 2025-08-14T20:43:48.7514670Z default: true 2025-08-14T20:43:48.7515050Z --- 2025-08-14T20:43:48.7515239Z 2025-08-14T20:43:48.7515387Z # Opt-ins: 2025-08-14T20:43:48.7515932Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:48.7516738Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:48.7517469Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:48.7518086Z # Experiments should be from the above list. 2025-08-14T20:43:48.7518442Z 2025-08-14T20:43:48.7518610Z @User1,-lf,split_build 2025-08-14T20:43:48.7519018Z @User2,lf 2025-08-14T20:43:48.7519364Z @User3,split_build 2025-08-14T20:43:48.7519749Z """ 2025-08-14T20:43:48.7519923Z 2025-08-14T20:43:48.7520073Z import json 2025-08-14T20:43:48.7520439Z import logging 2025-08-14T20:43:48.7520797Z import os 2025-08-14T20:43:48.7521138Z import random 2025-08-14T20:43:48.7521494Z import re 2025-08-14T20:43:48.7521837Z import sys 2025-08-14T20:43:48.7522208Z from argparse import ArgumentParser 2025-08-14T20:43:48.7522920Z from collections.abc import Iterable 2025-08-14T20:43:48.7523407Z from functools import cache 2025-08-14T20:43:48.7523843Z from logging import LogRecord 2025-08-14T20:43:48.7524297Z from typing import Any, NamedTuple 2025-08-14T20:43:48.7524789Z from urllib.request import Request, urlopen 2025-08-14T20:43:48.7525138Z 2025-08-14T20:43:48.7525284Z import yaml 2025-08-14T20:43:48.7525640Z from github import Auth, Github 2025-08-14T20:43:48.7526115Z from github.Issue import Issue 2025-08-14T20:43:48.7526402Z 2025-08-14T20:43:48.7526408Z 2025-08-14T20:43:48.7526617Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:48.7527255Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:48.7528065Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:48.7528586Z 2025-08-14T20:43:48.7528799Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:48.7529474Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:48.7529956Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:48.7530482Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:48.7530812Z 2025-08-14T20:43:48.7530992Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:48.7531306Z 2025-08-14T20:43:48.7531473Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:48.7531896Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:48.7532154Z 2025-08-14T20:43:48.7532160Z 2025-08-14T20:43:48.7532328Z class Experiment(NamedTuple): 2025-08-14T20:43:48.7532953Z rollout_perc: float = ( 2025-08-14T20:43:48.7533552Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:48.7534192Z ) 2025-08-14T20:43:48.7534534Z all_branches: bool = ( 2025-08-14T20:43:48.7535117Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:48.7535753Z ) 2025-08-14T20:43:48.7536086Z default: bool = ( 2025-08-14T20:43:48.7536621Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:48.7537219Z ) 2025-08-14T20:43:48.7537404Z 2025-08-14T20:43:48.7537606Z # Add more fields as needed 2025-08-14T20:43:48.7537887Z 2025-08-14T20:43:48.7537893Z 2025-08-14T20:43:48.7538067Z class Settings(NamedTuple): 2025-08-14T20:43:48.7538474Z """ 2025-08-14T20:43:48.7538889Z Settings for the experiments that can be opted into. 2025-08-14T20:43:48.7539412Z """ 2025-08-14T20:43:48.7539591Z 2025-08-14T20:43:48.7539785Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:48.7540123Z 2025-08-14T20:43:48.7540130Z 2025-08-14T20:43:48.7540321Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:48.7540932Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:48.7541336Z 2025-08-14T20:43:48.7541485Z COLORS = { 2025-08-14T20:43:48.7541847Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:48.7542658Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:48.7543137Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:48.7543597Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:48.7544040Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:48.7544468Z } 2025-08-14T20:43:48.7544647Z 2025-08-14T20:43:48.7544847Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:48.7545549Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:48.7546267Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:48.7546812Z return super().format(record) 2025-08-14T20:43:48.7547130Z 2025-08-14T20:43:48.7547137Z 2025-08-14T20:43:48.7547327Z handler = logging.StreamHandler() 2025-08-14T20:43:48.7547978Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:48.7548502Z 2025-08-14T20:43:48.7548731Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:48.7549266Z log.addHandler(handler) 2025-08-14T20:43:48.7549682Z log.setLevel(logging.INFO) 2025-08-14T20:43:48.7549948Z 2025-08-14T20:43:48.7549954Z 2025-08-14T20:43:48.7550188Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:48.7550750Z """ 2025-08-14T20:43:48.7551216Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:48.7551800Z """ 2025-08-14T20:43:48.7552136Z if not GITHUB_OUTPUT: 2025-08-14T20:43:48.7553347Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:48.7554401Z log.warning( 2025-08-14T20:43:48.7555207Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:48.7556057Z ) 2025-08-14T20:43:48.7566319Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:48.7566892Z return 2025-08-14T20:43:48.7567116Z 2025-08-14T20:43:48.7567500Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:48.7568058Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:48.7568603Z f.write(f"{key}={value}\n") 2025-08-14T20:43:48.7568910Z 2025-08-14T20:43:48.7568917Z 2025-08-14T20:43:48.7569214Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:48.7569807Z return frozenset( 2025-08-14T20:43:48.7570386Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:48.7571037Z ) 2025-08-14T20:43:48.7571221Z 2025-08-14T20:43:48.7571226Z 2025-08-14T20:43:48.7571396Z def parse_args() -> Any: 2025-08-14T20:43:48.7571924Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:48.7572924Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:48.7573652Z parser.add_argument( 2025-08-14T20:43:48.7574071Z "--github-issue-repo", 2025-08-14T20:43:48.7574511Z type=str, 2025-08-14T20:43:48.7574883Z required=False, 2025-08-14T20:43:48.7575306Z default="pytorch/test-infra", 2025-08-14T20:43:48.7575798Z help="GitHub repo to get the issue", 2025-08-14T20:43:48.7576271Z ) 2025-08-14T20:43:48.7576605Z parser.add_argument( 2025-08-14T20:43:48.7577040Z "--github-repo", 2025-08-14T20:43:48.7577433Z type=str, 2025-08-14T20:43:48.7577840Z required=True, 2025-08-14T20:43:48.7578256Z help="GitHub repo where CI is running", 2025-08-14T20:43:48.7578743Z ) 2025-08-14T20:43:48.7579078Z parser.add_argument( 2025-08-14T20:43:48.7579636Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:48.7631354Z ) 2025-08-14T20:43:48.7631911Z parser.add_argument( 2025-08-14T20:43:48.7632691Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:48.7633377Z ) 2025-08-14T20:43:48.7633742Z parser.add_argument( 2025-08-14T20:43:48.7634623Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:48.7635273Z ) 2025-08-14T20:43:48.7635616Z parser.add_argument( 2025-08-14T20:43:48.7636234Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:48.7636890Z ) 2025-08-14T20:43:48.7637232Z parser.add_argument( 2025-08-14T20:43:48.7637684Z "--github-ref-type", 2025-08-14T20:43:48.7638100Z type=str, 2025-08-14T20:43:48.7638467Z required=True, 2025-08-14T20:43:48.7638945Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:48.7639451Z ) 2025-08-14T20:43:48.7639796Z parser.add_argument( 2025-08-14T20:43:48.7640229Z "--eligible-experiments", 2025-08-14T20:43:48.7640714Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.7641200Z required=False, 2025-08-14T20:43:48.7641589Z default="", 2025-08-14T20:43:48.7642385Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:48.7643518Z ) 2025-08-14T20:43:48.7643861Z parser.add_argument( 2025-08-14T20:43:48.7644305Z "--opt-out-experiments", 2025-08-14T20:43:48.7644782Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.7645290Z required=False, 2025-08-14T20:43:48.7645685Z default="", 2025-08-14T20:43:48.7646050Z help=( 2025-08-14T20:43:48.7646676Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:48.7647753Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:48.7648558Z ), 2025-08-14T20:43:48.7648881Z ) 2025-08-14T20:43:48.7649218Z parser.add_argument( 2025-08-14T20:43:48.7649624Z "--pr-number", 2025-08-14T20:43:48.7650009Z type=str, 2025-08-14T20:43:48.7650373Z required=False, 2025-08-14T20:43:48.7650770Z default="", 2025-08-14T20:43:48.7651350Z help="the optional PR number where this is run", 2025-08-14T20:43:48.7651884Z ) 2025-08-14T20:43:48.7652066Z 2025-08-14T20:43:48.7652242Z return parser.parse_args() 2025-08-14T20:43:48.7652670Z 2025-08-14T20:43:48.7652681Z 2025-08-14T20:43:48.7653062Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.7653765Z auth = Auth.Token(github_token) 2025-08-14T20:43:48.7654244Z return Github(auth=auth) 2025-08-14T20:43:48.7654518Z 2025-08-14T20:43:48.7654524Z 2025-08-14T20:43:48.7654953Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.7655695Z repo = gh.get_repo(repo) 2025-08-14T20:43:48.7656181Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:48.7656518Z 2025-08-14T20:43:48.7656523Z 2025-08-14T20:43:48.7656695Z def get_potential_pr_author( 2025-08-14T20:43:48.7657325Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:48.7657966Z ) -> str: 2025-08-14T20:43:48.7658458Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:48.7659207Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:48.7659896Z # embedded in the tag name: ciflow// 2025-08-14T20:43:48.7660282Z 2025-08-14T20:43:48.7660462Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.7660771Z 2025-08-14T20:43:48.7661022Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:48.7661606Z split_tag = ref_name.split("/") 2025-08-14T20:43:48.7662069Z if ( 2025-08-14T20:43:48.7662592Z len(split_tag) == 3 2025-08-14T20:43:48.7663051Z and split_tag[0] == "ciflow" 2025-08-14T20:43:48.7663539Z and split_tag[2].isnumeric() 2025-08-14T20:43:48.7663995Z ): 2025-08-14T20:43:48.7664365Z pr_number = split_tag[2] 2025-08-14T20:43:48.7664982Z try: 2025-08-14T20:43:48.7665407Z repository = gh.get_repo(repo) 2025-08-14T20:43:48.7665981Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:48.7666536Z except Exception as e: 2025-08-14T20:43:48.7667023Z raise Exception( # noqa: TRY002 2025-08-14T20:43:48.7667668Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:48.7668311Z ) from e 2025-08-14T20:43:48.7668813Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:48.7669480Z # In all other cases, return the original input username 2025-08-14T20:43:48.7670023Z return username 2025-08-14T20:43:48.7670247Z 2025-08-14T20:43:48.7670253Z 2025-08-14T20:43:48.7670454Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:48.7670947Z """ 2025-08-14T20:43:48.7671540Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:48.7672278Z """ 2025-08-14T20:43:48.7672901Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:48.7673394Z 2025-08-14T20:43:48.7673400Z 2025-08-14T20:43:48.7673577Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:48.7674041Z try: 2025-08-14T20:43:48.7674392Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:48.7674869Z return data 2025-08-14T20:43:48.7675274Z except yaml.YAMLError: 2025-08-14T20:43:48.7675750Z log.exception("Error loading YAML") 2025-08-14T20:43:48.7676221Z raise 2025-08-14T20:43:48.7676429Z 2025-08-14T20:43:48.7676435Z 2025-08-14T20:43:48.7676819Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:48.7677521Z """ 2025-08-14T20:43:48.7678090Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:48.7678654Z 2025-08-14T20:43:48.7679105Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.7679811Z and the text below is the list of opted in users. 2025-08-14T20:43:48.7680199Z 2025-08-14T20:43:48.7680545Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:48.7681194Z """ 2025-08-14T20:43:48.7681603Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:48.7682157Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:48.7682871Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:48.7683440Z else: 2025-08-14T20:43:48.7683786Z return "", rollout_state 2025-08-14T20:43:48.7684085Z 2025-08-14T20:43:48.7684092Z 2025-08-14T20:43:48.7684274Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:48.7684788Z """ 2025-08-14T20:43:48.7685267Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:48.7685861Z """ 2025-08-14T20:43:48.7686051Z 2025-08-14T20:43:48.7686057Z 2025-08-14T20:43:48.7686372Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:48.7686990Z """ 2025-08-14T20:43:48.7687645Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:48.7688289Z 2025-08-14T20:43:48.7688861Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:48.7689782Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:48.7690419Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:48.7690867Z 2025-08-14T20:43:48.7690879Z 2025-08-14T20:43:48.7691024Z """ 2025-08-14T20:43:48.7691379Z optins = UserOptins() 2025-08-14T20:43:48.7691829Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:48.7692336Z user = user.strip("\r\n\t -") 2025-08-14T20:43:48.7693462Z if not user or not user.startswith("@"): 2025-08-14T20:43:48.7694142Z # Not a valid user. Skip 2025-08-14T20:43:48.7694588Z continue 2025-08-14T20:43:48.7694816Z 2025-08-14T20:43:48.7694967Z if user: 2025-08-14T20:43:48.7695362Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:48.7696030Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:48.7696493Z 2025-08-14T20:43:48.7696644Z return optins 2025-08-14T20:43:48.7696870Z 2025-08-14T20:43:48.7696877Z 2025-08-14T20:43:48.7697149Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:48.7697699Z """ 2025-08-14T20:43:48.7698049Z Check if the experiment name is valid. 2025-08-14T20:43:48.7698529Z A valid name: 2025-08-14T20:43:48.7699103Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:48.7699971Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:48.7700632Z - Cannot contain spaces 2025-08-14T20:43:48.7701054Z """ 2025-08-14T20:43:48.7701237Z 2025-08-14T20:43:48.7701478Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:48.7702127Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:48.7702677Z 2025-08-14T20:43:48.7702827Z if valid: 2025-08-14T20:43:48.7703169Z return True 2025-08-14T20:43:48.7703386Z 2025-08-14T20:43:48.7703536Z log.error( 2025-08-14T20:43:48.7704878Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:48.7706372Z ) 2025-08-14T20:43:48.7706692Z return False 2025-08-14T20:43:48.7706906Z 2025-08-14T20:43:48.7706912Z 2025-08-14T20:43:48.7707189Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:48.7707762Z """ 2025-08-14T20:43:48.7708425Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:48.7709100Z """ 2025-08-14T20:43:48.7709411Z try: 2025-08-14T20:43:48.7709747Z if settings_text: 2025-08-14T20:43:48.7710420Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:48.7711147Z # for easy reading 2025-08-14T20:43:48.7711877Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:48.7712802Z # the backtick character in shell commands. 2025-08-14T20:43:48.7713362Z backtick = chr(96) # backtick character 2025-08-14T20:43:48.7713971Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:48.7714585Z settings = load_yaml(settings_text) 2025-08-14T20:43:48.7714926Z 2025-08-14T20:43:48.7715314Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:48.7716009Z experiments = {} 2025-08-14T20:43:48.7716281Z 2025-08-14T20:43:48.7716658Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:48.7717378Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:48.7718426Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:48.7719390Z continue 2025-08-14T20:43:48.7719651Z 2025-08-14T20:43:48.7719814Z valid_settings = {} 2025-08-14T20:43:48.7720293Z for setting in exp_settings: 2025-08-14T20:43:48.7720810Z if setting not in Experiment._fields: 2025-08-14T20:43:48.7721325Z log.warning( 2025-08-14T20:43:48.7721977Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:48.7722976Z ) 2025-08-14T20:43:48.7723362Z else: 2025-08-14T20:43:48.7723828Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:48.7724222Z 2025-08-14T20:43:48.7724481Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:48.7725056Z return Settings(experiments) 2025-08-14T20:43:48.7725383Z 2025-08-14T20:43:48.7725537Z except Exception: 2025-08-14T20:43:48.7725974Z log.exception("Failed to parse settings") 2025-08-14T20:43:48.7726335Z 2025-08-14T20:43:48.7726493Z return Settings() 2025-08-14T20:43:48.7726727Z 2025-08-14T20:43:48.7726733Z 2025-08-14T20:43:48.7726968Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:48.7727490Z """ 2025-08-14T20:43:48.7727892Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:48.7728266Z 2025-08-14T20:43:48.7728592Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.7729334Z and the text below is the list of opted in users. 2025-08-14T20:43:48.7729730Z 2025-08-14T20:43:48.7730109Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:48.7730793Z """ 2025-08-14T20:43:48.7731305Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.7732010Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:48.7732376Z 2025-08-14T20:43:48.7732388Z 2025-08-14T20:43:48.7732734Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:48.7733249Z """ 2025-08-14T20:43:48.7733606Z Parse users from the rollout state. 2025-08-14T20:43:48.7733930Z 2025-08-14T20:43:48.7734073Z """ 2025-08-14T20:43:48.7734560Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.7735245Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:48.7735617Z 2025-08-14T20:43:48.7735623Z 2025-08-14T20:43:48.7736143Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.7736885Z """ 2025-08-14T20:43:48.7737261Z Check if a user is opted into an experiment 2025-08-14T20:43:48.7737798Z """ 2025-08-14T20:43:48.7738203Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:48.7738598Z 2025-08-14T20:43:48.7738604Z 2025-08-14T20:43:48.7738993Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.7739686Z """ 2025-08-14T20:43:48.7740103Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:48.7740632Z """ 2025-08-14T20:43:48.7741092Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:48.7741716Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:48.7742308Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:48.7742965Z return False 2025-08-14T20:43:48.7743202Z 2025-08-14T20:43:48.7743454Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:48.7744046Z log.warning( 2025-08-14T20:43:48.7744808Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:48.7745607Z ) 2025-08-14T20:43:48.7745799Z 2025-08-14T20:43:48.7745948Z return True 2025-08-14T20:43:48.7746179Z 2025-08-14T20:43:48.7746185Z 2025-08-14T20:43:48.7746368Z def get_runner_prefix( 2025-08-14T20:43:48.7746762Z rollout_state: str, 2025-08-14T20:43:48.7747187Z workflow_requestors: Iterable[str], 2025-08-14T20:43:48.7747652Z branch: str, 2025-08-14T20:43:48.7748095Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.7748701Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.7749241Z is_canary: bool = False, 2025-08-14T20:43:48.7749651Z ) -> str: 2025-08-14T20:43:48.7750158Z settings = parse_settings(rollout_state) 2025-08-14T20:43:48.7750692Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:48.7751040Z 2025-08-14T20:43:48.7751193Z fleet_prefix = "" 2025-08-14T20:43:48.7751571Z prefixes = [] 2025-08-14T20:43:48.7752139Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:48.7753111Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:48.7753758Z log.info( 2025-08-14T20:43:48.7754420Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:48.7755105Z ) 2025-08-14T20:43:48.7755444Z continue 2025-08-14T20:43:48.7755687Z 2025-08-14T20:43:48.7755864Z if opt_out_experiments: 2025-08-14T20:43:48.7756344Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:48.7756937Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:48.7757496Z log.info( 2025-08-14T20:43:48.7758347Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:48.7759239Z ) 2025-08-14T20:43:48.7759598Z continue 2025-08-14T20:43:48.7759841Z 2025-08-14T20:43:48.7760009Z if eligible_experiments: 2025-08-14T20:43:48.7760543Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:48.7761127Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:48.7761629Z log.info( 2025-08-14T20:43:48.7762365Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:48.7763229Z ) 2025-08-14T20:43:48.7763590Z continue 2025-08-14T20:43:48.7764016Z elif not experiment_settings.default: 2025-08-14T20:43:48.7764505Z log.info( 2025-08-14T20:43:48.7765228Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:48.7765907Z ) 2025-08-14T20:43:48.7766251Z continue 2025-08-14T20:43:48.7766476Z 2025-08-14T20:43:48.7766726Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:48.7767294Z opted_out_users = [ 2025-08-14T20:43:48.7767697Z requestor 2025-08-14T20:43:48.7768110Z for requestor in workflow_requestors 2025-08-14T20:43:48.7768743Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.7769327Z ] 2025-08-14T20:43:48.7769512Z 2025-08-14T20:43:48.7769679Z if opted_out_users: 2025-08-14T20:43:48.7770087Z log.info( 2025-08-14T20:43:48.7770656Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:48.7771293Z ) 2025-08-14T20:43:48.7771631Z continue 2025-08-14T20:43:48.7771862Z 2025-08-14T20:43:48.7772136Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:48.7772978Z opted_in_users = [ 2025-08-14T20:43:48.7773388Z requestor 2025-08-14T20:43:48.7773801Z for requestor in workflow_requestors 2025-08-14T20:43:48.7774414Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.7774976Z ] 2025-08-14T20:43:48.7775163Z 2025-08-14T20:43:48.7775324Z enabled = False 2025-08-14T20:43:48.7775720Z if opted_in_users: 2025-08-14T20:43:48.7776122Z log.info( 2025-08-14T20:43:48.7776675Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:48.7777311Z ) 2025-08-14T20:43:48.7777655Z enabled = True 2025-08-14T20:43:48.7777923Z 2025-08-14T20:43:48.7778119Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:48.7778885Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:48.7779916Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:48.7780521Z log.info( 2025-08-14T20:43:48.7781305Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:48.7782150Z ) 2025-08-14T20:43:48.7782624Z enabled = True 2025-08-14T20:43:48.7782905Z 2025-08-14T20:43:48.7783052Z if enabled: 2025-08-14T20:43:48.7783438Z label = experiment_name 2025-08-14T20:43:48.7783937Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.7784697Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.7785506Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.7786201Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.7786807Z if is_canary: 2025-08-14T20:43:48.7787260Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.7787771Z fleet_prefix = label 2025-08-14T20:43:48.7788206Z else: 2025-08-14T20:43:48.7788589Z prefixes.append(label) 2025-08-14T20:43:48.7788909Z 2025-08-14T20:43:48.7789074Z if len(prefixes) > 1: 2025-08-14T20:43:48.7789495Z log.error( 2025-08-14T20:43:48.7790433Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:48.7791465Z ) 2025-08-14T20:43:48.7791815Z prefixes = prefixes[:1] 2025-08-14T20:43:48.7792101Z 2025-08-14T20:43:48.7792271Z # Fleet always comes first 2025-08-14T20:43:48.7792806Z if fleet_prefix: 2025-08-14T20:43:48.7793211Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.7793547Z 2025-08-14T20:43:48.7793933Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.7794319Z 2025-08-14T20:43:48.7794325Z 2025-08-14T20:43:48.7794722Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.7795431Z """ 2025-08-14T20:43:48.7795972Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.7796494Z 2025-08-14T20:43:48.7796847Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.7797502Z """ 2025-08-14T20:43:48.7797853Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.7798347Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.7798919Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.7799353Z 2025-08-14T20:43:48.7799359Z 2025-08-14T20:43:48.7799726Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.7800419Z for _ in range(num_retries): 2025-08-14T20:43:48.7800850Z try: 2025-08-14T20:43:48.7801237Z req = Request(url=url, headers=headers) 2025-08-14T20:43:48.7801868Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.7802568Z return json.loads(content) 2025-08-14T20:43:48.7803051Z except Exception as e: 2025-08-14T20:43:48.7803597Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.7803970Z 2025-08-14T20:43:48.7804319Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.7804966Z return {} 2025-08-14T20:43:48.7805169Z 2025-08-14T20:43:48.7805174Z 2025-08-14T20:43:48.7805324Z @cache 2025-08-14T20:43:48.7805881Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.7806569Z """ 2025-08-14T20:43:48.7806919Z Dynamically get PR information 2025-08-14T20:43:48.7807365Z """ 2025-08-14T20:43:48.7807951Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.7808526Z headers = { 2025-08-14T20:43:48.7808962Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.7809515Z "Authorization": f"token {github_token}", 2025-08-14T20:43:48.7810051Z } 2025-08-14T20:43:48.7810435Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.7810984Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.7811480Z headers=headers, 2025-08-14T20:43:48.7811865Z ) 2025-08-14T20:43:48.7812044Z 2025-08-14T20:43:48.7812208Z if not json_response: 2025-08-14T20:43:48.7812850Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.7813404Z return {} 2025-08-14T20:43:48.7813629Z 2025-08-14T20:43:48.7813790Z return json_response 2025-08-14T20:43:48.7814044Z 2025-08-14T20:43:48.7814049Z 2025-08-14T20:43:48.7814421Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.7815135Z """ 2025-08-14T20:43:48.7815618Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.7816201Z """ 2025-08-14T20:43:48.7816640Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.7817232Z return { 2025-08-14T20:43:48.7817761Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.7818396Z } 2025-08-14T20:43:48.7818570Z 2025-08-14T20:43:48.7818576Z 2025-08-14T20:43:48.7818730Z def main() -> None: 2025-08-14T20:43:48.7819110Z args = parse_args() 2025-08-14T20:43:48.7819350Z 2025-08-14T20:43:48.7819550Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.7819908Z 2025-08-14T20:43:48.7820076Z # Check if the PR is opt-out 2025-08-14T20:43:48.7820518Z if args.pr_number: 2025-08-14T20:43:48.7821119Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.7821970Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.7822524Z log.info( 2025-08-14T20:43:48.7823152Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.7823847Z ) 2025-08-14T20:43:48.7824348Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.7824949Z sys.exit() 2025-08-14T20:43:48.7825194Z 2025-08-14T20:43:48.7825337Z try: 2025-08-14T20:43:48.7825731Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.7826406Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.7826981Z ) 2025-08-14T20:43:48.7827166Z 2025-08-14T20:43:48.7827348Z username = get_potential_pr_author( 2025-08-14T20:43:48.7827849Z args.github_token, 2025-08-14T20:43:48.7828282Z args.github_repo, 2025-08-14T20:43:48.7828718Z args.github_actor, 2025-08-14T20:43:48.7829158Z args.github_ref_type, 2025-08-14T20:43:48.7829621Z args.github_branch, 2025-08-14T20:43:48.7830022Z ) 2025-08-14T20:43:48.7830213Z 2025-08-14T20:43:48.7830474Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.7830889Z 2025-08-14T20:43:48.7831090Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.7831597Z rollout_state, 2025-08-14T20:43:48.7832039Z (args.github_issue_owner, username), 2025-08-14T20:43:48.7832628Z args.github_branch, 2025-08-14T20:43:48.7833076Z args.eligible_experiments, 2025-08-14T20:43:48.7833565Z args.opt_out_experiments, 2025-08-14T20:43:48.7834027Z is_canary, 2025-08-14T20:43:48.7834408Z ) 2025-08-14T20:43:48.7834593Z 2025-08-14T20:43:48.7834760Z except Exception as e: 2025-08-14T20:43:48.7835169Z log.error( 2025-08-14T20:43:48.7835792Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.7836667Z ) 2025-08-14T20:43:48.7836853Z 2025-08-14T20:43:48.7837158Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.7837657Z 2025-08-14T20:43:48.7837662Z 2025-08-14T20:43:48.7837823Z if __name__ == "__main__": 2025-08-14T20:43:48.7838219Z main() 2025-08-14T20:43:48.7838407Z 2025-08-14T20:43:48.7931277Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.7932119Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.7972057Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.7972707Z env: 2025-08-14T20:43:48.7973309Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.7973692Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.7974111Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.7974568Z ISSUE_OWNER: 2025-08-14T20:43:48.7974939Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.7975329Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.7975745Z PR_NUMBER: 2025-08-14T20:43:48.7976095Z ##[endgroup] 2025-08-14T20:43:49.5814344Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:50.4870605Z Collecting urllib3==1.26.18 2025-08-14T20:43:50.5208908Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:50.5466942Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.4 MB/s eta 0:00:00 2025-08-14T20:43:50.5677834Z Collecting PyGithub==2.3.0 2025-08-14T20:43:50.5706339Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:50.6122091Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:50.6150714Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:50.6196566Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:50.6216267Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:50.6232254Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:50.6473569Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:50.6498530Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:50.6729903Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:50.7817714Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.7847426Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:50.8979725Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:50.9009341Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:50.9189547Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.9215075Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:50.9438162Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.9535643Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.2 MB/s eta 0:00:00 2025-08-14T20:43:50.9582110Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.9661735Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 57.0 MB/s eta 0:00:00 2025-08-14T20:43:50.9688741Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.9799711Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 91.2 MB/s eta 0:00:00 2025-08-14T20:43:50.9828503Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.9879845Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.9949896Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 89.0 MB/s eta 0:00:00 2025-08-14T20:43:50.9973345Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:51.0015269Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 30.5 MB/s eta 0:00:00 2025-08-14T20:43:51.0043873Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:51.0086742Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.1 MB/s eta 0:00:00 2025-08-14T20:43:51.3156974Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:51.8640749Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:51.9651684Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.9652000Z curr_branch="main" 2025-08-14T20:43:51.9652220Z curr_ref_type="branch" 2025-08-14T20:43:51.9652654Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.9652909Z  2025-08-14T20:43:51.9653102Z python3 runner_determinator.py \ 2025-08-14T20:43:51.9653378Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.9653662Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.9653925Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.9654190Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.9654478Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.9654752Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.9655025Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.9655327Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.9655696Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.9655982Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.9696908Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.9697156Z env: 2025-08-14T20:43:51.9697755Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.9697950Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.9698159Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.9698403Z ISSUE_OWNER: 2025-08-14T20:43:51.9698577Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.9698772Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:51.9698957Z PR_NUMBER: 2025-08-14T20:43:51.9699133Z ##[endgroup] 2025-08-14T20:43:51.9757692Z Current branch is 'main' 2025-08-14T20:43:53.5089177Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:53.5090471Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:53.5091002Z INFO : Setting output: label-type='' 2025-08-14T20:43:53.5473062Z Evaluate and set job outputs 2025-08-14T20:43:53.5480585Z Cleaning up orphan processes