2025-07-17T06:33:19.8306737Z Current runner version: '2.326.0' 2025-07-17T06:33:19.8331999Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.8332980Z Hosted Compute Agent 2025-07-17T06:33:19.8333500Z Version: 20250711.363 2025-07-17T06:33:19.8334077Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.8334794Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.8335382Z ##[endgroup] 2025-07-17T06:33:19.8335901Z ##[group]Operating System 2025-07-17T06:33:19.8336512Z Ubuntu 2025-07-17T06:33:19.8336989Z 24.04.2 2025-07-17T06:33:19.8337417Z LTS 2025-07-17T06:33:19.8337913Z ##[endgroup] 2025-07-17T06:33:19.8338352Z ##[group]Runner Image 2025-07-17T06:33:19.8339291Z Image: ubuntu-24.04 2025-07-17T06:33:19.8339881Z Version: 20250710.1.0 2025-07-17T06:33:19.8340932Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.8342429Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.8343461Z ##[endgroup] 2025-07-17T06:33:19.8344423Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.8346510Z Contents: read 2025-07-17T06:33:19.8347064Z Metadata: read 2025-07-17T06:33:19.8347511Z ##[endgroup] 2025-07-17T06:33:19.8350273Z Secret source: Actions 2025-07-17T06:33:19.8351177Z Prepare workflow directory 2025-07-17T06:33:19.8911588Z Prepare all required actions 2025-07-17T06:33:19.8965525Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.8970595Z ##[group] Inputs 2025-07-17T06:33:19.8971317Z check_experiments: 2025-07-17T06:33:19.8971840Z opt_out_experiments: 2025-07-17T06:33:19.8972400Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.8973120Z issue_owner: 2025-07-17T06:33:19.8973586Z curr_branch: main 2025-07-17T06:33:19.8974096Z curr_ref_type: branch 2025-07-17T06:33:19.8974771Z issue_number: 5132 2025-07-17T06:33:19.8975303Z ##[endgroup] 2025-07-17T06:33:19.8975954Z Complete job name: before-test / get-label-type / runner-determinator 2025-07-17T06:33:20.5983829Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.5986320Z cat < runner_determinator.py 2025-07-17T06:33:20.5987078Z # flake8: noqa: G004 2025-07-17T06:33:20.5987608Z  2025-07-17T06:33:20.5988345Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.5989651Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.5990672Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.5991371Z  2025-07-17T06:33:20.5991856Z """ 2025-07-17T06:33:20.5992573Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.5993537Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.5994772Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.5995709Z of which runners should be used to run which job. 2025-07-17T06:33:20.5996432Z  2025-07-17T06:33:20.5997111Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.5998172Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.5999544Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.6000402Z list, defined. 2025-07-17T06:33:20.6001037Z  2025-07-17T06:33:20.6001738Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.6002867Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.6003843Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.6004506Z  2025-07-17T06:33:20.6005591Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.6006579Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.6007450Z experiments which the user could be opted in to. 2025-07-17T06:33:20.6008189Z  2025-07-17T06:33:20.6008661Z The user list has the following rules: 2025-07-17T06:33:20.6009419Z  2025-07-17T06:33:20.6010125Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.6011098Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.6011958Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.6012670Z  2025-07-17T06:33:20.6013132Z Example config: 2025-07-17T06:33:20.6013695Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.6014563Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.6015304Z  # Expected syntax is: 2025-07-17T06:33:20.6016103Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.6017233Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.6018059Z  2025-07-17T06:33:20.6018523Z  experiments: 2025-07-17T06:33:20.6019310Z  lf: 2025-07-17T06:33:20.6019849Z  rollout_percent: 25 2025-07-17T06:33:20.6020409Z  all_branches: false 2025-07-17T06:33:20.6021030Z  default: true 2025-07-17T06:33:20.6021591Z  --- 2025-07-17T06:33:20.6022032Z  2025-07-17T06:33:20.6022554Z  # Opt-ins: 2025-07-17T06:33:20.6023270Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.6024448Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.6109352Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.6110212Z  # Experiments should be from the above list. 2025-07-17T06:33:20.6110824Z  2025-07-17T06:33:20.6111212Z  @User1,-lf,split_build 2025-07-17T06:33:20.6111714Z  @User2,lf 2025-07-17T06:33:20.6112159Z  @User3,split_build 2025-07-17T06:33:20.6112615Z """ 2025-07-17T06:33:20.6113001Z  2025-07-17T06:33:20.6113378Z import json 2025-07-17T06:33:20.6113789Z import logging 2025-07-17T06:33:20.6114203Z import os 2025-07-17T06:33:20.6114604Z import random 2025-07-17T06:33:20.6115017Z import re 2025-07-17T06:33:20.6115415Z import sys 2025-07-17T06:33:20.6115867Z from argparse import ArgumentParser 2025-07-17T06:33:20.6116522Z from collections.abc import Iterable 2025-07-17T06:33:20.6117100Z from functools import cache 2025-07-17T06:33:20.6117609Z from logging import LogRecord 2025-07-17T06:33:20.6118145Z from typing import Any, NamedTuple 2025-07-17T06:33:20.6118849Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.6119393Z  2025-07-17T06:33:20.6119754Z import yaml 2025-07-17T06:33:20.6120188Z from github import Auth, Github 2025-07-17T06:33:20.6120720Z from github.Issue import Issue 2025-07-17T06:33:20.6121208Z  2025-07-17T06:33:20.6121555Z  2025-07-17T06:33:20.6121988Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.6122724Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.6123621Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.6124346Z  2025-07-17T06:33:20.6125043Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.6125646Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.6126206Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.6126797Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.6127321Z  2025-07-17T06:33:20.6127725Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.6128223Z  2025-07-17T06:33:20.6128604Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.6129216Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.6129685Z  2025-07-17T06:33:20.6130022Z  2025-07-17T06:33:20.6130403Z class Experiment(NamedTuple): 2025-07-17T06:33:20.6131132Z  rollout_perc: float = ( 2025-07-17T06:33:20.6131844Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.6132541Z  ) 2025-07-17T06:33:20.6132938Z  all_branches: bool = ( 2025-07-17T06:33:20.6133634Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.6134326Z  ) 2025-07-17T06:33:20.6134716Z  default: bool = ( 2025-07-17T06:33:20.6135338Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.6135992Z  ) 2025-07-17T06:33:20.6136347Z  2025-07-17T06:33:20.6136728Z  # Add more fields as needed 2025-07-17T06:33:20.6137223Z  2025-07-17T06:33:20.6137567Z  2025-07-17T06:33:20.6137948Z class Settings(NamedTuple): 2025-07-17T06:33:20.6138426Z  """ 2025-07-17T06:33:20.6139174Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.6139767Z  """ 2025-07-17T06:33:20.6140135Z  2025-07-17T06:33:20.6140553Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.6141081Z  2025-07-17T06:33:20.6141583Z  2025-07-17T06:33:20.6142025Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.6142699Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.6143291Z  2025-07-17T06:33:20.6143643Z  COLORS = { 2025-07-17T06:33:20.6144087Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.6144618Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.6145134Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.6145657Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.6146175Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.6146665Z  } 2025-07-17T06:33:20.6147036Z  2025-07-17T06:33:20.6147469Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.6148234Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.6149170Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.6149771Z  return super().format(record) 2025-07-17T06:33:20.6150273Z  2025-07-17T06:33:20.6150616Z  2025-07-17T06:33:20.6151015Z handler = logging.StreamHandler() 2025-07-17T06:33:20.6151811Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.6152537Z  2025-07-17T06:33:20.6153002Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.6153609Z log.addHandler(handler) 2025-07-17T06:33:20.6154090Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.6154560Z  2025-07-17T06:33:20.6154912Z  2025-07-17T06:33:20.6155381Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.6155963Z  """ 2025-07-17T06:33:20.6156501Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.6157270Z  """ 2025-07-17T06:33:20.6157659Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.6158850Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.6159966Z  log.warning( 2025-07-17T06:33:20.6160848Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.6161763Z  ) 2025-07-17T06:33:20.6162226Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.6162780Z  return 2025-07-17T06:33:20.6163186Z  2025-07-17T06:33:20.6163590Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.6164194Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.6164774Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.6165277Z  2025-07-17T06:33:20.6165621Z  2025-07-17T06:33:20.6166149Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.6166805Z  return frozenset( 2025-07-17T06:33:20.6167458Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.6168139Z  ) 2025-07-17T06:33:20.6168507Z  2025-07-17T06:33:20.6168959Z  2025-07-17T06:33:20.6169329Z def parse_args() -> Any: 2025-07-17T06:33:20.6169943Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.6170816Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.6171589Z  parser.add_argument( 2025-07-17T06:33:20.6172088Z  "--github-issue-repo", 2025-07-17T06:33:20.6172586Z  type=str, 2025-07-17T06:33:20.6173039Z  required=False, 2025-07-17T06:33:20.6173652Z  default="pytorch/test-infra", 2025-07-17T06:33:20.6174231Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.6174741Z  ) 2025-07-17T06:33:20.6175137Z  parser.add_argument( 2025-07-17T06:33:20.6175604Z  "--github-repo", 2025-07-17T06:33:20.6176078Z  type=str, 2025-07-17T06:33:20.6176521Z  required=True, 2025-07-17T06:33:20.6177029Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.6177559Z  ) 2025-07-17T06:33:20.6177950Z  parser.add_argument( 2025-07-17T06:33:20.6178608Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.6179821Z  ) 2025-07-17T06:33:20.6180221Z  parser.add_argument( 2025-07-17T06:33:20.6180902Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.6181595Z  ) 2025-07-17T06:33:20.6181988Z  parser.add_argument( 2025-07-17T06:33:20.6182664Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.6183349Z  ) 2025-07-17T06:33:20.6183745Z  parser.add_argument( 2025-07-17T06:33:20.6184455Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.6185170Z  ) 2025-07-17T06:33:20.6185562Z  parser.add_argument( 2025-07-17T06:33:20.6186057Z  "--github-ref-type", 2025-07-17T06:33:20.6186544Z  type=str, 2025-07-17T06:33:20.6186987Z  required=True, 2025-07-17T06:33:20.6187534Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.6188081Z  ) 2025-07-17T06:33:20.6188475Z  parser.add_argument( 2025-07-17T06:33:20.6189228Z  "--eligible-experiments", 2025-07-17T06:33:20.6189794Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.6190332Z  required=False, 2025-07-17T06:33:20.6190794Z  default="", 2025-07-17T06:33:20.6191679Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.6192595Z  ) 2025-07-17T06:33:20.6192987Z  parser.add_argument( 2025-07-17T06:33:20.6193478Z  "--opt-out-experiments", 2025-07-17T06:33:20.6194032Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.6194568Z  required=False, 2025-07-17T06:33:20.6195022Z  default="", 2025-07-17T06:33:20.6195454Z  help=( 2025-07-17T06:33:20.6196158Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.6197298Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.6198129Z  ), 2025-07-17T06:33:20.6198508Z  ) 2025-07-17T06:33:20.6199001Z  parser.add_argument( 2025-07-17T06:33:20.6199483Z  "--pr-number", 2025-07-17T06:33:20.6199942Z  type=str, 2025-07-17T06:33:20.6200385Z  required=False, 2025-07-17T06:33:20.6200852Z  default="", 2025-07-17T06:33:20.6201384Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.6201949Z  ) 2025-07-17T06:33:20.6202314Z  2025-07-17T06:33:20.6202695Z  return parser.parse_args() 2025-07-17T06:33:20.6203180Z  2025-07-17T06:33:20.6203524Z  2025-07-17T06:33:20.6204149Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.6205046Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.6205589Z  return Github(auth=auth) 2025-07-17T06:33:20.6206057Z  2025-07-17T06:33:20.6206396Z  2025-07-17T06:33:20.6207057Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.6207851Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.6208388Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.6209005Z  2025-07-17T06:33:20.6209348Z  2025-07-17T06:33:20.6209720Z def get_potential_pr_author( 2025-07-17T06:33:20.6210401Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.6211073Z ) -> str: 2025-07-17T06:33:20.6211625Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.6212434Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.6213192Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.6213777Z  2025-07-17T06:33:20.6214163Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.6214665Z  2025-07-17T06:33:20.6215143Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.6215791Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.6216309Z  if ( 2025-07-17T06:33:20.6216731Z  len(split_tag) == 3 2025-07-17T06:33:20.6217264Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.6217811Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.6218330Z  ): 2025-07-17T06:33:20.6218861Z  pr_number = split_tag[2] 2025-07-17T06:33:20.6219368Z  try: 2025-07-17T06:33:20.6219847Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.6220625Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.6221259Z  except Exception as e: 2025-07-17T06:33:20.6221809Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.6222503Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.6223173Z  ) from e 2025-07-17T06:33:20.6223774Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.6224508Z  # In all other cases, return the original input username 2025-07-17T06:33:20.6225104Z  return username 2025-07-17T06:33:20.6225541Z  2025-07-17T06:33:20.6225885Z  2025-07-17T06:33:20.6226319Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.6226859Z  """ 2025-07-17T06:33:20.6227547Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.6228341Z  """ 2025-07-17T06:33:20.6229042Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.6229716Z  2025-07-17T06:33:20.6230055Z  2025-07-17T06:33:20.6230452Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.6230955Z  try: 2025-07-17T06:33:20.6231378Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.6231905Z  return data 2025-07-17T06:33:20.6232363Z  except yaml.YAMLError: 2025-07-17T06:33:20.6232901Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.6233425Z  raise 2025-07-17T06:33:20.6233828Z  2025-07-17T06:33:20.6234161Z  2025-07-17T06:33:20.6234785Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.6235529Z  """ 2025-07-17T06:33:20.6236310Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.6237068Z  2025-07-17T06:33:20.6237626Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.6238410Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.6239078Z  2025-07-17T06:33:20.6239655Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.6240353Z  """ 2025-07-17T06:33:20.6240826Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.6241447Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.6242076Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.6242678Z  else: 2025-07-17T06:33:20.6243084Z  return "", rollout_state 2025-07-17T06:33:20.6243805Z  2025-07-17T06:33:20.6244151Z  2025-07-17T06:33:20.6244563Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.6245090Z  """ 2025-07-17T06:33:20.6245641Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.6246288Z  """ 2025-07-17T06:33:20.6246648Z  2025-07-17T06:33:20.6246982Z  2025-07-17T06:33:20.6247525Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.6248184Z  """ 2025-07-17T06:33:20.6249079Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.6249908Z  2025-07-17T06:33:20.6250722Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.6251768Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.6252608Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.6253234Z  2025-07-17T06:33:20.6253576Z  2025-07-17T06:33:20.6253912Z  """ 2025-07-17T06:33:20.6254295Z  optins = UserOptins() 2025-07-17T06:33:20.6254826Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.6255401Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.6255970Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.6256537Z  # Not a valid user. Skip 2025-07-17T06:33:20.6257047Z  continue 2025-07-17T06:33:20.6257461Z  2025-07-17T06:33:20.6257812Z  if user: 2025-07-17T06:33:20.6258324Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.6259164Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.6259807Z  2025-07-17T06:33:20.6260160Z  return optins 2025-07-17T06:33:20.6260583Z  2025-07-17T06:33:20.6260911Z  2025-07-17T06:33:20.6261415Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.6262040Z  """ 2025-07-17T06:33:20.6262470Z  Check if the experiment name is valid. 2025-07-17T06:33:20.6263004Z  A valid name: 2025-07-17T06:33:20.6263682Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.6264617Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.6265338Z  - Cannot contain spaces 2025-07-17T06:33:20.6265825Z  """ 2025-07-17T06:33:20.6266190Z  2025-07-17T06:33:20.6266663Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.6267382Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.6268103Z  2025-07-17T06:33:20.6268458Z  if valid: 2025-07-17T06:33:20.6268958Z  return True 2025-07-17T06:33:20.6269387Z  2025-07-17T06:33:20.6269736Z  log.error( 2025-07-17T06:33:20.6271181Z  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-07-17T06:33:20.6272684Z  ) 2025-07-17T06:33:20.6273060Z  return False 2025-07-17T06:33:20.6273476Z  2025-07-17T06:33:20.6273814Z  2025-07-17T06:33:20.6274336Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.6274968Z  """ 2025-07-17T06:33:20.6275579Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.6276299Z  """ 2025-07-17T06:33:20.6276661Z  try: 2025-07-17T06:33:20.6277052Z  if settings_text: 2025-07-17T06:33:20.6277805Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.6278587Z  # for easy reading 2025-07-17T06:33:20.6279501Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.6280398Z  # the backtick character in shell commands. 2025-07-17T06:33:20.6281025Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.6281702Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.6282384Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.6282900Z  2025-07-17T06:33:20.6283510Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.6284403Z  experiments = {} 2025-07-17T06:33:20.6284867Z  2025-07-17T06:33:20.6285428Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.6286186Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.6287282Z  # 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-07-17T06:33:20.6288305Z  continue 2025-07-17T06:33:20.6288854Z  2025-07-17T06:33:20.6289229Z  valid_settings = {} 2025-07-17T06:33:20.6289764Z  for setting in exp_settings: 2025-07-17T06:33:20.6290345Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.6290906Z  log.warning( 2025-07-17T06:33:20.6291641Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.6292350Z  ) 2025-07-17T06:33:20.6292800Z  else: 2025-07-17T06:33:20.6293348Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.6293914Z  2025-07-17T06:33:20.6294395Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.6295035Z  return Settings(experiments) 2025-07-17T06:33:20.6295540Z  2025-07-17T06:33:20.6295901Z  except Exception: 2025-07-17T06:33:20.6296417Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.6296955Z  2025-07-17T06:33:20.6297310Z  return Settings() 2025-07-17T06:33:20.6297746Z  2025-07-17T06:33:20.6298086Z  2025-07-17T06:33:20.6298677Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.6299361Z  """ 2025-07-17T06:33:20.6299838Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.6300396Z  2025-07-17T06:33:20.6300941Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.6301708Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.6302256Z  2025-07-17T06:33:20.6302859Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.6303574Z  """ 2025-07-17T06:33:20.6304152Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.6304929Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.6305476Z  2025-07-17T06:33:20.6305814Z  2025-07-17T06:33:20.6306278Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.6306854Z  """ 2025-07-17T06:33:20.6307272Z  Parse users from the rollout state. 2025-07-17T06:33:20.6307784Z  2025-07-17T06:33:20.6308122Z  """ 2025-07-17T06:33:20.6308689Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.6309541Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.6310088Z  2025-07-17T06:33:20.6310427Z  2025-07-17T06:33:20.6311053Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.6311799Z  """ 2025-07-17T06:33:20.6312246Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.6312788Z  """ 2025-07-17T06:33:20.6313270Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.6313846Z  2025-07-17T06:33:20.6314350Z  2025-07-17T06:33:20.6314981Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.6315728Z  """ 2025-07-17T06:33:20.6316208Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.6316790Z  """ 2025-07-17T06:33:20.6317321Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.6318026Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.6318681Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.6319379Z  return False 2025-07-17T06:33:20.6319805Z  2025-07-17T06:33:20.6320272Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.6320874Z  log.warning( 2025-07-17T06:33:20.6321693Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.6322549Z  ) 2025-07-17T06:33:20.6322924Z  2025-07-17T06:33:20.6323279Z  return True 2025-07-17T06:33:20.6323683Z  2025-07-17T06:33:20.6324013Z  2025-07-17T06:33:20.6324382Z def get_runner_prefix( 2025-07-17T06:33:20.6324850Z  rollout_state: str, 2025-07-17T06:33:20.6325355Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.6325876Z  branch: str, 2025-07-17T06:33:20.6326408Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.6327094Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.6327678Z  is_canary: bool = False, 2025-07-17T06:33:20.6328149Z ) -> str: 2025-07-17T06:33:20.6328599Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.6329319Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.6329847Z  2025-07-17T06:33:20.6330338Z  fleet_prefix = "" 2025-07-17T06:33:20.6330797Z  prefixes = [] 2025-07-17T06:33:20.6331465Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.6332404Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.6333108Z  log.info( 2025-07-17T06:33:20.6333820Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.6334574Z  ) 2025-07-17T06:33:20.6334992Z  continue 2025-07-17T06:33:20.6335424Z  2025-07-17T06:33:20.6335800Z  if opt_out_experiments: 2025-07-17T06:33:20.6336374Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.6337020Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.6337632Z  log.info( 2025-07-17T06:33:20.6338570Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.6339630Z  ) 2025-07-17T06:33:20.6340093Z  continue 2025-07-17T06:33:20.6340537Z  2025-07-17T06:33:20.6340921Z  if eligible_experiments: 2025-07-17T06:33:20.6341502Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.6342151Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.6342705Z  log.info( 2025-07-17T06:33:20.6343498Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.6344316Z  ) 2025-07-17T06:33:20.6344860Z  continue 2025-07-17T06:33:20.6345380Z  elif not experiment_settings.default: 2025-07-17T06:33:20.6345912Z  log.info( 2025-07-17T06:33:20.6346612Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.6347340Z  ) 2025-07-17T06:33:20.6347741Z  continue 2025-07-17T06:33:20.6348165Z  2025-07-17T06:33:20.6348635Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.6349369Z  opted_out_users = [ 2025-07-17T06:33:20.6349845Z  requestor 2025-07-17T06:33:20.6350344Z  for requestor in workflow_requestors 2025-07-17T06:33:20.6351026Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.6351676Z  ] 2025-07-17T06:33:20.6352046Z  2025-07-17T06:33:20.6352413Z  if opted_out_users: 2025-07-17T06:33:20.6352897Z  log.info( 2025-07-17T06:33:20.6353535Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.6354226Z  ) 2025-07-17T06:33:20.6354628Z  continue 2025-07-17T06:33:20.6355049Z  2025-07-17T06:33:20.6355515Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.6356128Z  opted_in_users = [ 2025-07-17T06:33:20.6356604Z  requestor 2025-07-17T06:33:20.6357099Z  for requestor in workflow_requestors 2025-07-17T06:33:20.6357778Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.6358411Z  ] 2025-07-17T06:33:20.6358878Z  2025-07-17T06:33:20.6359244Z  enabled = False 2025-07-17T06:33:20.6359715Z  if opted_in_users: 2025-07-17T06:33:20.6360304Z  log.info( 2025-07-17T06:33:20.6360950Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.6361630Z  ) 2025-07-17T06:33:20.6362043Z  enabled = True 2025-07-17T06:33:20.6362495Z  2025-07-17T06:33:20.6362911Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.6363745Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.6364676Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.6365333Z  log.info( 2025-07-17T06:33:20.6366221Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.6367132Z  ) 2025-07-17T06:33:20.6367577Z  enabled = True 2025-07-17T06:33:20.6368053Z  2025-07-17T06:33:20.6368404Z  if enabled: 2025-07-17T06:33:20.6368971Z  label = experiment_name 2025-07-17T06:33:20.6369537Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.6370367Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.6371252Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.6372024Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.6372685Z  if is_canary: 2025-07-17T06:33:20.6373207Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.6373761Z  fleet_prefix = label 2025-07-17T06:33:20.6374259Z  else: 2025-07-17T06:33:20.6374856Z  prefixes.append(label) 2025-07-17T06:33:20.6375355Z  2025-07-17T06:33:20.6375720Z  if len(prefixes) > 1: 2025-07-17T06:33:20.6376199Z  log.error( 2025-07-17T06:33:20.6377246Z  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-07-17T06:33:20.6378346Z  ) 2025-07-17T06:33:20.6378850Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.6379334Z  2025-07-17T06:33:20.6379708Z  # Fleet always comes first 2025-07-17T06:33:20.6380205Z  if fleet_prefix: 2025-07-17T06:33:20.6380689Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.6381194Z  2025-07-17T06:33:20.6381650Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.6382214Z  2025-07-17T06:33:20.6382559Z  2025-07-17T06:33:20.6383195Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.6383964Z  """ 2025-07-17T06:33:20.6384571Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.6385258Z  2025-07-17T06:33:20.6385841Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.6386531Z  """ 2025-07-17T06:33:20.6386940Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.6387503Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.6388150Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.6388835Z  2025-07-17T06:33:20.6389172Z  2025-07-17T06:33:20.6389773Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.6390756Z  for _ in range(num_retries): 2025-07-17T06:33:20.6391251Z  try: 2025-07-17T06:33:20.6391707Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.6392376Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.6393023Z  return json.loads(content) 2025-07-17T06:33:20.6393558Z  except Exception as e: 2025-07-17T06:33:20.6394130Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.6394676Z  2025-07-17T06:33:20.6395260Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.6395962Z  return {} 2025-07-17T06:33:20.6396358Z  2025-07-17T06:33:20.6396706Z  2025-07-17T06:33:20.6397044Z @cache 2025-07-17T06:33:20.6397684Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.6398435Z  """ 2025-07-17T06:33:20.6398949Z  Dynamically get PR information 2025-07-17T06:33:20.6399442Z  """ 2025-07-17T06:33:20.6399963Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.6400596Z  headers = { 2025-07-17T06:33:20.6401082Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.6401699Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.6402229Z  } 2025-07-17T06:33:20.6402685Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.6403295Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.6403844Z  headers=headers, 2025-07-17T06:33:20.6404289Z  ) 2025-07-17T06:33:20.6404655Z  2025-07-17T06:33:20.6405016Z  if not json_response: 2025-07-17T06:33:20.6405616Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.6406375Z  return {} 2025-07-17T06:33:20.6406794Z  2025-07-17T06:33:20.6407159Z  return json_response 2025-07-17T06:33:20.6407611Z  2025-07-17T06:33:20.6407947Z  2025-07-17T06:33:20.6408533Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.6409350Z  """ 2025-07-17T06:33:20.6409897Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.6410535Z  """ 2025-07-17T06:33:20.6411040Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.6411645Z  return { 2025-07-17T06:33:20.6412252Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.6412919Z  } 2025-07-17T06:33:20.6413284Z  2025-07-17T06:33:20.6413626Z  2025-07-17T06:33:20.6413985Z def main() -> None: 2025-07-17T06:33:20.6414433Z  args = parse_args() 2025-07-17T06:33:20.6414873Z  2025-07-17T06:33:20.6415292Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.6415827Z  2025-07-17T06:33:20.6416207Z  # Check if the PR is opt-out 2025-07-17T06:33:20.6416709Z  if args.pr_number: 2025-07-17T06:33:20.6417407Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.6418161Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.6418665Z  log.info( 2025-07-17T06:33:20.6419487Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.6420255Z  ) 2025-07-17T06:33:20.6420857Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.6421541Z  sys.exit() 2025-07-17T06:33:20.6422094Z  2025-07-17T06:33:20.6422448Z  try: 2025-07-17T06:33:20.6422902Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.6423631Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.6424268Z  ) 2025-07-17T06:33:20.6424650Z  2025-07-17T06:33:20.6425048Z  username = get_potential_pr_author( 2025-07-17T06:33:20.6425592Z  args.github_token, 2025-07-17T06:33:20.6426096Z  args.github_repo, 2025-07-17T06:33:20.6426588Z  args.github_actor, 2025-07-17T06:33:20.6427098Z  args.github_ref_type, 2025-07-17T06:33:20.6427601Z  args.github_branch, 2025-07-17T06:33:20.6428077Z  ) 2025-07-17T06:33:20.6428448Z  2025-07-17T06:33:20.6429032Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.6429637Z  2025-07-17T06:33:20.6430059Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.6430615Z  rollout_state, 2025-07-17T06:33:20.6431128Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.6431683Z  args.github_branch, 2025-07-17T06:33:20.6432207Z  args.eligible_experiments, 2025-07-17T06:33:20.6432758Z  args.opt_out_experiments, 2025-07-17T06:33:20.6433267Z  is_canary, 2025-07-17T06:33:20.6433707Z  ) 2025-07-17T06:33:20.6434076Z  2025-07-17T06:33:20.6434450Z  except Exception as e: 2025-07-17T06:33:20.6434931Z  log.error( 2025-07-17T06:33:20.6435627Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.6436497Z  ) 2025-07-17T06:33:20.6436872Z  2025-07-17T06:33:20.6437411Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.6438059Z  2025-07-17T06:33:20.6438398Z  2025-07-17T06:33:20.6438855Z if __name__ == "__main__": 2025-07-17T06:33:20.6439317Z  main() 2025-07-17T06:33:20.6439697Z  2025-07-17T06:33:20.6440035Z EOF 2025-07-17T06:33:20.6440388Z  2025-07-17T06:33:20.6440761Z cat runner_determinator.py 2025-07-17T06:33:20.6665757Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.6666802Z env: 2025-07-17T06:33:20.6667516Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.6667952Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.6668385Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.6669065Z ISSUE_OWNER: 2025-07-17T06:33:20.6669458Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.6669879Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.6670302Z PR_NUMBER: 2025-07-17T06:33:20.6670703Z ##[endgroup] 2025-07-17T06:33:20.6868360Z # flake8: noqa: G004 2025-07-17T06:33:20.6868677Z 2025-07-17T06:33:20.6869346Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.6870259Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.6871024Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.6871445Z 2025-07-17T06:33:20.6871594Z """ 2025-07-17T06:33:20.6872137Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.6872959Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.6873799Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.6874562Z of which runners should be used to run which job. 2025-07-17T06:33:20.6874933Z 2025-07-17T06:33:20.6875306Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.6876370Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.6877203Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.6877845Z list, defined. 2025-07-17T06:33:20.6878058Z 2025-07-17T06:33:20.6878394Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.6879420Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.6880199Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.6880614Z 2025-07-17T06:33:20.6880962Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.6881772Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.6882460Z experiments which the user could be opted in to. 2025-07-17T06:33:20.6882834Z 2025-07-17T06:33:20.6883018Z The user list has the following rules: 2025-07-17T06:33:20.6883348Z 2025-07-17T06:33:20.6883646Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.6884443Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.6885163Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.6885531Z 2025-07-17T06:33:20.6885690Z Example config: 2025-07-17T06:33:20.6886108Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.6886735Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.6887312Z # Expected syntax is: 2025-07-17T06:33:20.6887909Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.6888969Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.6889567Z 2025-07-17T06:33:20.6889720Z experiments: 2025-07-17T06:33:20.6890084Z lf: 2025-07-17T06:33:20.6890431Z rollout_percent: 25 2025-07-17T06:33:20.6891045Z all_branches: false 2025-07-17T06:33:20.6891460Z default: true 2025-07-17T06:33:20.6891840Z --- 2025-07-17T06:33:20.6892030Z 2025-07-17T06:33:20.6892179Z # Opt-ins: 2025-07-17T06:33:20.6892729Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.6893533Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.6894250Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.6894857Z # Experiments should be from the above list. 2025-07-17T06:33:20.6895207Z 2025-07-17T06:33:20.6895372Z @User1,-lf,split_build 2025-07-17T06:33:20.6895781Z @User2,lf 2025-07-17T06:33:20.6896127Z @User3,split_build 2025-07-17T06:33:20.6896504Z """ 2025-07-17T06:33:20.6896683Z 2025-07-17T06:33:20.6896832Z import json 2025-07-17T06:33:20.6897170Z import logging 2025-07-17T06:33:20.6897511Z import os 2025-07-17T06:33:20.6897848Z import random 2025-07-17T06:33:20.6898192Z import re 2025-07-17T06:33:20.6898524Z import sys 2025-07-17T06:33:20.6899106Z from argparse import ArgumentParser 2025-07-17T06:33:20.6899610Z from collections.abc import Iterable 2025-07-17T06:33:20.6900096Z from functools import cache 2025-07-17T06:33:20.6900529Z from logging import LogRecord 2025-07-17T06:33:20.6900980Z from typing import Any, NamedTuple 2025-07-17T06:33:20.6901472Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.6901815Z 2025-07-17T06:33:20.6901966Z import yaml 2025-07-17T06:33:20.6902323Z from github import Auth, Github 2025-07-17T06:33:20.6902784Z from github.Issue import Issue 2025-07-17T06:33:20.6903068Z 2025-07-17T06:33:20.6903074Z 2025-07-17T06:33:20.6903275Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.6903911Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.6904720Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.6905239Z 2025-07-17T06:33:20.6905446Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.6906113Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.6906596Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.6907107Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.6907432Z 2025-07-17T06:33:20.6907616Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.6907928Z 2025-07-17T06:33:20.6908097Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.6908523Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.6908995Z 2025-07-17T06:33:20.6909001Z 2025-07-17T06:33:20.6909185Z class Experiment(NamedTuple): 2025-07-17T06:33:20.6909644Z rollout_perc: float = ( 2025-07-17T06:33:20.6910229Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.6910862Z ) 2025-07-17T06:33:20.6911204Z all_branches: bool = ( 2025-07-17T06:33:20.6911785Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.6912424Z ) 2025-07-17T06:33:20.6912762Z default: bool = ( 2025-07-17T06:33:20.6913296Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.6913897Z ) 2025-07-17T06:33:20.6914085Z 2025-07-17T06:33:20.6914249Z # Add more fields as needed 2025-07-17T06:33:20.6914523Z 2025-07-17T06:33:20.6914529Z 2025-07-17T06:33:20.6914708Z class Settings(NamedTuple): 2025-07-17T06:33:20.6915115Z """ 2025-07-17T06:33:20.6915538Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.6916072Z """ 2025-07-17T06:33:20.6916255Z 2025-07-17T06:33:20.6916454Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.6916795Z 2025-07-17T06:33:20.6916802Z 2025-07-17T06:33:20.6916999Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.6917583Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.6917987Z 2025-07-17T06:33:20.6918142Z COLORS = { 2025-07-17T06:33:20.6918502Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.6919423Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.6919892Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.6920351Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.6920793Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.6921235Z } 2025-07-17T06:33:20.6921412Z 2025-07-17T06:33:20.6921612Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.6922314Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.6923044Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.6923580Z return super().format(record) 2025-07-17T06:33:20.6923892Z 2025-07-17T06:33:20.6923899Z 2025-07-17T06:33:20.6924085Z handler = logging.StreamHandler() 2025-07-17T06:33:20.6924742Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.6925273Z 2025-07-17T06:33:20.6925497Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.6926037Z log.addHandler(handler) 2025-07-17T06:33:20.6926451Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.6926717Z 2025-07-17T06:33:20.6926724Z 2025-07-17T06:33:20.6926961Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.6927478Z """ 2025-07-17T06:33:20.6927946Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.6928522Z """ 2025-07-17T06:33:20.6929118Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.6930134Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.6931187Z log.warning( 2025-07-17T06:33:20.6931977Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.6932832Z ) 2025-07-17T06:33:20.6942841Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.6943412Z return 2025-07-17T06:33:20.6943638Z 2025-07-17T06:33:20.6944018Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.6944574Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.6945110Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.6945420Z 2025-07-17T06:33:20.6945426Z 2025-07-17T06:33:20.6945714Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.6946358Z return frozenset( 2025-07-17T06:33:20.6946943Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.6947579Z ) 2025-07-17T06:33:20.6947762Z 2025-07-17T06:33:20.6947768Z 2025-07-17T06:33:20.6947933Z def parse_args() -> Any: 2025-07-17T06:33:20.6948447Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.6949443Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.6950162Z parser.add_argument( 2025-07-17T06:33:20.6950579Z "--github-issue-repo", 2025-07-17T06:33:20.6951017Z type=str, 2025-07-17T06:33:20.6951392Z required=False, 2025-07-17T06:33:20.6951819Z default="pytorch/test-infra", 2025-07-17T06:33:20.6952317Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.6952792Z ) 2025-07-17T06:33:20.6953133Z parser.add_argument( 2025-07-17T06:33:20.6953553Z "--github-repo", 2025-07-17T06:33:20.6953939Z type=str, 2025-07-17T06:33:20.6954310Z required=True, 2025-07-17T06:33:20.6954741Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.6955231Z ) 2025-07-17T06:33:20.6955576Z parser.add_argument( 2025-07-17T06:33:20.6956144Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.6956754Z ) 2025-07-17T06:33:20.6957085Z parser.add_argument( 2025-07-17T06:33:20.6957668Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.6958288Z ) 2025-07-17T06:33:20.6958620Z parser.add_argument( 2025-07-17T06:33:20.6959619Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.6960278Z ) 2025-07-17T06:33:20.6960622Z parser.add_argument( 2025-07-17T06:33:20.6961224Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.6961885Z ) 2025-07-17T06:33:20.6962216Z parser.add_argument( 2025-07-17T06:33:20.6962631Z "--github-ref-type", 2025-07-17T06:33:20.6963042Z type=str, 2025-07-17T06:33:20.6963406Z required=True, 2025-07-17T06:33:20.7012602Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.7013267Z ) 2025-07-17T06:33:20.7013635Z parser.add_argument( 2025-07-17T06:33:20.7014080Z "--eligible-experiments", 2025-07-17T06:33:20.7014563Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.7015054Z required=False, 2025-07-17T06:33:20.7015437Z default="", 2025-07-17T06:33:20.7016254Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.7017135Z ) 2025-07-17T06:33:20.7017478Z parser.add_argument( 2025-07-17T06:33:20.7017898Z "--opt-out-experiments", 2025-07-17T06:33:20.7018368Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.7019031Z required=False, 2025-07-17T06:33:20.7019425Z default="", 2025-07-17T06:33:20.7019797Z help=( 2025-07-17T06:33:20.7020416Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.7021490Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.7022287Z ), 2025-07-17T06:33:20.7022616Z ) 2025-07-17T06:33:20.7022952Z parser.add_argument( 2025-07-17T06:33:20.7023359Z "--pr-number", 2025-07-17T06:33:20.7023746Z type=str, 2025-07-17T06:33:20.7024107Z required=False, 2025-07-17T06:33:20.7024504Z default="", 2025-07-17T06:33:20.7025108Z help="the optional PR number where this is run", 2025-07-17T06:33:20.7025646Z ) 2025-07-17T06:33:20.7025830Z 2025-07-17T06:33:20.7026005Z return parser.parse_args() 2025-07-17T06:33:20.7026295Z 2025-07-17T06:33:20.7026301Z 2025-07-17T06:33:20.7026678Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.7027386Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.7027864Z return Github(auth=auth) 2025-07-17T06:33:20.7028143Z 2025-07-17T06:33:20.7028149Z 2025-07-17T06:33:20.7028576Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.7029465Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.7029936Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.7030276Z 2025-07-17T06:33:20.7030282Z 2025-07-17T06:33:20.7030450Z def get_potential_pr_author( 2025-07-17T06:33:20.7031053Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.7031687Z ) -> str: 2025-07-17T06:33:20.7032159Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.7032917Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.7033605Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.7033992Z 2025-07-17T06:33:20.7034167Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.7034481Z 2025-07-17T06:33:20.7034727Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.7035310Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.7035778Z if ( 2025-07-17T06:33:20.7036131Z len(split_tag) == 3 2025-07-17T06:33:20.7036576Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.7037065Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.7037532Z ): 2025-07-17T06:33:20.7037886Z pr_number = split_tag[2] 2025-07-17T06:33:20.7038476Z try: 2025-07-17T06:33:20.7038983Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.7039556Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.7040116Z except Exception as e: 2025-07-17T06:33:20.7040601Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.7041224Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.7041810Z ) from e 2025-07-17T06:33:20.7042310Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.7042951Z # In all other cases, return the original input username 2025-07-17T06:33:20.7043500Z return username 2025-07-17T06:33:20.7043724Z 2025-07-17T06:33:20.7043730Z 2025-07-17T06:33:20.7043938Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.7044430Z """ 2025-07-17T06:33:20.7045025Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.7045753Z """ 2025-07-17T06:33:20.7046291Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.7046771Z 2025-07-17T06:33:20.7046778Z 2025-07-17T06:33:20.7046960Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.7047416Z try: 2025-07-17T06:33:20.7047769Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.7048243Z return data 2025-07-17T06:33:20.7048621Z except yaml.YAMLError: 2025-07-17T06:33:20.7049296Z log.exception("Error loading YAML") 2025-07-17T06:33:20.7049780Z raise 2025-07-17T06:33:20.7049982Z 2025-07-17T06:33:20.7049988Z 2025-07-17T06:33:20.7050377Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.7051066Z """ 2025-07-17T06:33:20.7051634Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.7052203Z 2025-07-17T06:33:20.7052666Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.7053393Z and the text below is the list of opted in users. 2025-07-17T06:33:20.7053774Z 2025-07-17T06:33:20.7054121Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.7054786Z """ 2025-07-17T06:33:20.7055202Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.7055773Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.7056343Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.7056892Z else: 2025-07-17T06:33:20.7057235Z return "", rollout_state 2025-07-17T06:33:20.7057525Z 2025-07-17T06:33:20.7057531Z 2025-07-17T06:33:20.7057715Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.7058186Z """ 2025-07-17T06:33:20.7058660Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.7059416Z """ 2025-07-17T06:33:20.7059605Z 2025-07-17T06:33:20.7059611Z 2025-07-17T06:33:20.7059934Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.7060544Z """ 2025-07-17T06:33:20.7061196Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.7061851Z 2025-07-17T06:33:20.7062433Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.7063363Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.7063991Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.7064440Z 2025-07-17T06:33:20.7064446Z 2025-07-17T06:33:20.7064591Z """ 2025-07-17T06:33:20.7064932Z optins = UserOptins() 2025-07-17T06:33:20.7065386Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.7065903Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.7066397Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.7067050Z # Not a valid user. Skip 2025-07-17T06:33:20.7067492Z continue 2025-07-17T06:33:20.7067720Z 2025-07-17T06:33:20.7067874Z if user: 2025-07-17T06:33:20.7068273Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.7069065Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.7069521Z 2025-07-17T06:33:20.7069675Z return optins 2025-07-17T06:33:20.7069901Z 2025-07-17T06:33:20.7069907Z 2025-07-17T06:33:20.7070170Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.7070728Z """ 2025-07-17T06:33:20.7071088Z Check if the experiment name is valid. 2025-07-17T06:33:20.7071567Z A valid name: 2025-07-17T06:33:20.7072149Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.7073025Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.7073689Z - Cannot contain spaces 2025-07-17T06:33:20.7074110Z """ 2025-07-17T06:33:20.7074289Z 2025-07-17T06:33:20.7074535Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.7075183Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.7075597Z 2025-07-17T06:33:20.7075747Z if valid: 2025-07-17T06:33:20.7076093Z return True 2025-07-17T06:33:20.7076315Z 2025-07-17T06:33:20.7076461Z log.error( 2025-07-17T06:33:20.7077815Z 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-07-17T06:33:20.7079392Z ) 2025-07-17T06:33:20.7079721Z return False 2025-07-17T06:33:20.7079938Z 2025-07-17T06:33:20.7079943Z 2025-07-17T06:33:20.7080220Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.7080794Z """ 2025-07-17T06:33:20.7081459Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.7082139Z """ 2025-07-17T06:33:20.7082461Z try: 2025-07-17T06:33:20.7082795Z if settings_text: 2025-07-17T06:33:20.7083471Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.7084205Z # for easy reading 2025-07-17T06:33:20.7084936Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.7085758Z # the backtick character in shell commands. 2025-07-17T06:33:20.7086321Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.7086934Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.7087539Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.7087877Z 2025-07-17T06:33:20.7088272Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.7089182Z experiments = {} 2025-07-17T06:33:20.7089511Z 2025-07-17T06:33:20.7089864Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.7090563Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.7091599Z # 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-07-17T06:33:20.7092584Z continue 2025-07-17T06:33:20.7092849Z 2025-07-17T06:33:20.7093015Z valid_settings = {} 2025-07-17T06:33:20.7093510Z for setting in exp_settings: 2025-07-17T06:33:20.7094036Z if setting not in Experiment._fields: 2025-07-17T06:33:20.7094553Z log.warning( 2025-07-17T06:33:20.7095203Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.7096014Z ) 2025-07-17T06:33:20.7096411Z else: 2025-07-17T06:33:20.7096879Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.7097269Z 2025-07-17T06:33:20.7097530Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.7098115Z return Settings(experiments) 2025-07-17T06:33:20.7098449Z 2025-07-17T06:33:20.7098606Z except Exception: 2025-07-17T06:33:20.7099210Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.7099575Z 2025-07-17T06:33:20.7099753Z return Settings() 2025-07-17T06:33:20.7099992Z 2025-07-17T06:33:20.7099998Z 2025-07-17T06:33:20.7100231Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.7100758Z """ 2025-07-17T06:33:20.7101155Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.7101525Z 2025-07-17T06:33:20.7101847Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.7102563Z and the text below is the list of opted in users. 2025-07-17T06:33:20.7102937Z 2025-07-17T06:33:20.7103323Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.7104008Z """ 2025-07-17T06:33:20.7104527Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.7105222Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.7105607Z 2025-07-17T06:33:20.7105614Z 2025-07-17T06:33:20.7105836Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.7106342Z """ 2025-07-17T06:33:20.7106710Z Parse users from the rollout state. 2025-07-17T06:33:20.7107044Z 2025-07-17T06:33:20.7107191Z """ 2025-07-17T06:33:20.7107678Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.7108359Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.7108853Z 2025-07-17T06:33:20.7108859Z 2025-07-17T06:33:20.7109373Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.7110085Z """ 2025-07-17T06:33:20.7110463Z Check if a user is opted into an experiment 2025-07-17T06:33:20.7110959Z """ 2025-07-17T06:33:20.7111372Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.7111756Z 2025-07-17T06:33:20.7111762Z 2025-07-17T06:33:20.7112148Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.7112843Z """ 2025-07-17T06:33:20.7113257Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.7113786Z """ 2025-07-17T06:33:20.7114241Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.7114873Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.7115456Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.7116007Z return False 2025-07-17T06:33:20.7116241Z 2025-07-17T06:33:20.7116492Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.7117042Z log.warning( 2025-07-17T06:33:20.7117786Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.7118600Z ) 2025-07-17T06:33:20.7118901Z 2025-07-17T06:33:20.7119052Z return True 2025-07-17T06:33:20.7119265Z 2025-07-17T06:33:20.7119270Z 2025-07-17T06:33:20.7119435Z def get_runner_prefix( 2025-07-17T06:33:20.7119833Z rollout_state: str, 2025-07-17T06:33:20.7120254Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.7120723Z branch: str, 2025-07-17T06:33:20.7121174Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.7121787Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.7122326Z is_canary: bool = False, 2025-07-17T06:33:20.7122732Z ) -> str: 2025-07-17T06:33:20.7123240Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.7123778Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.7124120Z 2025-07-17T06:33:20.7124278Z fleet_prefix = "" 2025-07-17T06:33:20.7124670Z prefixes = [] 2025-07-17T06:33:20.7125240Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.7126112Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.7126772Z log.info( 2025-07-17T06:33:20.7127397Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.7128100Z ) 2025-07-17T06:33:20.7128447Z continue 2025-07-17T06:33:20.7128675Z 2025-07-17T06:33:20.7129045Z if opt_out_experiments: 2025-07-17T06:33:20.7129550Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.7130140Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.7130679Z log.info( 2025-07-17T06:33:20.7131765Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.7132684Z ) 2025-07-17T06:33:20.7133048Z continue 2025-07-17T06:33:20.7133291Z 2025-07-17T06:33:20.7133466Z if eligible_experiments: 2025-07-17T06:33:20.7133993Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.7134566Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.7135067Z log.info( 2025-07-17T06:33:20.7135781Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.7136550Z ) 2025-07-17T06:33:20.7136909Z continue 2025-07-17T06:33:20.7137349Z elif not experiment_settings.default: 2025-07-17T06:33:20.7137837Z log.info( 2025-07-17T06:33:20.7138587Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.7139431Z ) 2025-07-17T06:33:20.7139782Z continue 2025-07-17T06:33:20.7140008Z 2025-07-17T06:33:20.7140264Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.7140835Z opted_out_users = [ 2025-07-17T06:33:20.7141241Z requestor 2025-07-17T06:33:20.7141661Z for requestor in workflow_requestors 2025-07-17T06:33:20.7142280Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.7142863Z ] 2025-07-17T06:33:20.7143049Z 2025-07-17T06:33:20.7143221Z if opted_out_users: 2025-07-17T06:33:20.7143624Z log.info( 2025-07-17T06:33:20.7144185Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.7144823Z ) 2025-07-17T06:33:20.7145168Z continue 2025-07-17T06:33:20.7145398Z 2025-07-17T06:33:20.7145647Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.7146234Z opted_in_users = [ 2025-07-17T06:33:20.7146643Z requestor 2025-07-17T06:33:20.7147055Z for requestor in workflow_requestors 2025-07-17T06:33:20.7147659Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.7148225Z ] 2025-07-17T06:33:20.7148409Z 2025-07-17T06:33:20.7148562Z enabled = False 2025-07-17T06:33:20.7149084Z if opted_in_users: 2025-07-17T06:33:20.7149487Z log.info( 2025-07-17T06:33:20.7150029Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.7150653Z ) 2025-07-17T06:33:20.7150999Z enabled = True 2025-07-17T06:33:20.7151259Z 2025-07-17T06:33:20.7151460Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.7152230Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.7153237Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.7153844Z log.info( 2025-07-17T06:33:20.7154649Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.7155514Z ) 2025-07-17T06:33:20.7155880Z enabled = True 2025-07-17T06:33:20.7156154Z 2025-07-17T06:33:20.7156304Z if enabled: 2025-07-17T06:33:20.7156700Z label = experiment_name 2025-07-17T06:33:20.7157204Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.7157959Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.7158877Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.7159594Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.7160210Z if is_canary: 2025-07-17T06:33:20.7160654Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.7161157Z fleet_prefix = label 2025-07-17T06:33:20.7161595Z else: 2025-07-17T06:33:20.7161986Z prefixes.append(label) 2025-07-17T06:33:20.7162308Z 2025-07-17T06:33:20.7162471Z if len(prefixes) > 1: 2025-07-17T06:33:20.7162878Z log.error( 2025-07-17T06:33:20.7163828Z 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-07-17T06:33:20.7164877Z ) 2025-07-17T06:33:20.7165232Z prefixes = prefixes[:1] 2025-07-17T06:33:20.7165516Z 2025-07-17T06:33:20.7165685Z # Fleet always comes first 2025-07-17T06:33:20.7166119Z if fleet_prefix: 2025-07-17T06:33:20.7166530Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.7166865Z 2025-07-17T06:33:20.7167212Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.7167596Z 2025-07-17T06:33:20.7167602Z 2025-07-17T06:33:20.7168016Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.7168833Z """ 2025-07-17T06:33:20.7169502Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.7170033Z 2025-07-17T06:33:20.7170393Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.7171053Z """ 2025-07-17T06:33:20.7171401Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.7171893Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.7172471Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.7172886Z 2025-07-17T06:33:20.7172891Z 2025-07-17T06:33:20.7173256Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.7173964Z for _ in range(num_retries): 2025-07-17T06:33:20.7174398Z try: 2025-07-17T06:33:20.7174790Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.7175399Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.7175989Z return json.loads(content) 2025-07-17T06:33:20.7176471Z except Exception as e: 2025-07-17T06:33:20.7176970Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.7177340Z 2025-07-17T06:33:20.7177692Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.7178341Z return {} 2025-07-17T06:33:20.7178541Z 2025-07-17T06:33:20.7178553Z 2025-07-17T06:33:20.7178698Z @cache 2025-07-17T06:33:20.7179790Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.7180503Z """ 2025-07-17T06:33:20.7180858Z Dynamically get PR information 2025-07-17T06:33:20.7181308Z """ 2025-07-17T06:33:20.7181919Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.7182491Z headers = { 2025-07-17T06:33:20.7182911Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.7183465Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.7183954Z } 2025-07-17T06:33:20.7184333Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.7184891Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.7185390Z headers=headers, 2025-07-17T06:33:20.7185781Z ) 2025-07-17T06:33:20.7185957Z 2025-07-17T06:33:20.7186123Z if not json_response: 2025-07-17T06:33:20.7186639Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.7187204Z return {} 2025-07-17T06:33:20.7187419Z 2025-07-17T06:33:20.7187580Z return json_response 2025-07-17T06:33:20.7187832Z 2025-07-17T06:33:20.7187847Z 2025-07-17T06:33:20.7188213Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.7189032Z """ 2025-07-17T06:33:20.7189513Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.7190105Z """ 2025-07-17T06:33:20.7190543Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.7191103Z return { 2025-07-17T06:33:20.7191629Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.7192277Z } 2025-07-17T06:33:20.7192456Z 2025-07-17T06:33:20.7192462Z 2025-07-17T06:33:20.7192614Z def main() -> None: 2025-07-17T06:33:20.7192994Z args = parse_args() 2025-07-17T06:33:20.7193237Z 2025-07-17T06:33:20.7193438Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.7193798Z 2025-07-17T06:33:20.7193973Z # Check if the PR is opt-out 2025-07-17T06:33:20.7194421Z if args.pr_number: 2025-07-17T06:33:20.7195003Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.7195822Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.7196278Z log.info( 2025-07-17T06:33:20.7196905Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.7197610Z ) 2025-07-17T06:33:20.7198108Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.7198717Z sys.exit() 2025-07-17T06:33:20.7199067Z 2025-07-17T06:33:20.7199214Z try: 2025-07-17T06:33:20.7199616Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.7200261Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.7200851Z ) 2025-07-17T06:33:20.7201038Z 2025-07-17T06:33:20.7201221Z username = get_potential_pr_author( 2025-07-17T06:33:20.7201722Z args.github_token, 2025-07-17T06:33:20.7202151Z args.github_repo, 2025-07-17T06:33:20.7202583Z args.github_actor, 2025-07-17T06:33:20.7203020Z args.github_ref_type, 2025-07-17T06:33:20.7203479Z args.github_branch, 2025-07-17T06:33:20.7203891Z ) 2025-07-17T06:33:20.7204077Z 2025-07-17T06:33:20.7204335Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.7204752Z 2025-07-17T06:33:20.7204957Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.7205463Z rollout_state, 2025-07-17T06:33:20.7205907Z (args.github_issue_owner, username), 2025-07-17T06:33:20.7206404Z args.github_branch, 2025-07-17T06:33:20.7206852Z args.eligible_experiments, 2025-07-17T06:33:20.7207346Z args.opt_out_experiments, 2025-07-17T06:33:20.7207799Z is_canary, 2025-07-17T06:33:20.7208172Z ) 2025-07-17T06:33:20.7208359Z 2025-07-17T06:33:20.7208525Z except Exception as e: 2025-07-17T06:33:20.7209035Z log.error( 2025-07-17T06:33:20.7209640Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.7210472Z ) 2025-07-17T06:33:20.7210657Z 2025-07-17T06:33:20.7210959Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.7211427Z 2025-07-17T06:33:20.7211433Z 2025-07-17T06:33:20.7211592Z if __name__ == "__main__": 2025-07-17T06:33:20.7211990Z main() 2025-07-17T06:33:20.7212178Z 2025-07-17T06:33:20.7299722Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.7300598Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.7328462Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.7329025Z env: 2025-07-17T06:33:20.7329615Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.7330012Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.7330435Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.7330899Z ISSUE_OWNER: 2025-07-17T06:33:20.7331265Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.7331657Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.7332057Z PR_NUMBER: 2025-07-17T06:33:20.7332401Z ##[endgroup] 2025-07-17T06:33:22.2675299Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:23.3786435Z Collecting urllib3==1.26.18 2025-07-17T06:33:23.4125156Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:23.4330701Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-07-17T06:33:23.4549781Z Collecting PyGithub==2.3.0 2025-07-17T06:33:23.4592897Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:23.5016486Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:23.5049028Z 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-07-17T06:33:23.5095316Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:23.5113247Z 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-07-17T06:33:23.5127555Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:23.5370634Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:23.5404646Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:23.5639701Z 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-07-17T06:33:23.6705927Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:23.6737584Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:23.7755045Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:23.7793059Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:23.7975780Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:23.8004828Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:23.8247084Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:23.8317852Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.4 MB/s eta 0:00:00 2025-07-17T06:33:23.8357237Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:23.8412896Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 91.9 MB/s eta 0:00:00 2025-07-17T06:33:23.8475776Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:23.8566071Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 121.5 MB/s eta 0:00:00 2025-07-17T06:33:23.8601471Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:23.8657739Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:23.8727753Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 95.5 MB/s eta 0:00:00 2025-07-17T06:33:23.8761090Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:23.8805240Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 30.9 MB/s eta 0:00:00 2025-07-17T06:33:23.8836397Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:23.8883196Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 35.7 MB/s eta 0:00:00 2025-07-17T06:33:24.2400708Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:24.7769608Z 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.2 2025-07-17T06:33:24.8587367Z ##[group]Run curr_branch="main" 2025-07-17T06:33:24.8587680Z curr_branch="main" 2025-07-17T06:33:24.8587923Z curr_ref_type="branch" 2025-07-17T06:33:24.8588182Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:24.8588433Z  2025-07-17T06:33:24.8588626Z python3 runner_determinator.py \ 2025-07-17T06:33:24.8589131Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:24.8589428Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:24.8589701Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:24.8589964Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:24.8590248Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:24.8590530Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:24.8590805Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:24.8591116Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:24.8591495Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:24.8591787Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:24.8620512Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:24.8620743Z env: 2025-07-17T06:33:24.8621312Z GITHUB_TOKEN: *** 2025-07-17T06:33:24.8621513Z ISSUE_NUMBER: 5132 2025-07-17T06:33:24.8621724Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:24.8621951Z ISSUE_OWNER: 2025-07-17T06:33:24.8622130Z CHECK_EXPERIMENTS: 2025-07-17T06:33:24.8622317Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:24.8622510Z PR_NUMBER: 2025-07-17T06:33:24.8622673Z ##[endgroup] 2025-07-17T06:33:24.8669211Z Current branch is 'main' 2025-07-17T06:33:26.5085997Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:26.5087155Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:26.5088125Z INFO : Setting output: label-type='' 2025-07-17T06:33:26.5401236Z Evaluate and set job outputs 2025-07-17T06:33:26.5408449Z Cleaning up orphan processes