2025-11-03T15:43:06.1378759Z Current runner version: '2.329.0' 2025-11-03T15:43:06.1413647Z ##[group]Runner Image Provisioner 2025-11-03T15:43:06.1414992Z Hosted Compute Agent 2025-11-03T15:43:06.1415917Z Version: 20251016.436 2025-11-03T15:43:06.1416952Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:06.1418261Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:06.1419293Z ##[endgroup] 2025-11-03T15:43:06.1420169Z ##[group]Operating System 2025-11-03T15:43:06.1421504Z Ubuntu 2025-11-03T15:43:06.1422248Z 24.04.3 2025-11-03T15:43:06.1423026Z LTS 2025-11-03T15:43:06.1423847Z ##[endgroup] 2025-11-03T15:43:06.1424717Z ##[group]Runner Image 2025-11-03T15:43:06.1425701Z Image: ubuntu-24.04 2025-11-03T15:43:06.1426558Z Version: 20251030.96.2 2025-11-03T15:43:06.1428352Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:06.1431196Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:06.1432978Z ##[endgroup] 2025-11-03T15:43:06.1434792Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:06.1437655Z Contents: read 2025-11-03T15:43:06.1438500Z Metadata: read 2025-11-03T15:43:06.1439822Z ##[endgroup] 2025-11-03T15:43:06.1443056Z Secret source: Actions 2025-11-03T15:43:06.1444122Z Prepare workflow directory 2025-11-03T15:43:06.2167993Z Prepare all required actions 2025-11-03T15:43:06.2250181Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:06.2258749Z ##[group] Inputs 2025-11-03T15:43:06.2259862Z check_experiments: 2025-11-03T15:43:06.2261001Z opt_out_experiments: 2025-11-03T15:43:06.2261906Z triggering_actor: pytorchmergebot 2025-11-03T15:43:06.2262817Z issue_owner: 2025-11-03T15:43:06.2263783Z curr_branch: main 2025-11-03T15:43:06.2264652Z curr_ref_type: branch 2025-11-03T15:43:06.2265732Z issue_number: 5132 2025-11-03T15:43:06.2266573Z ##[endgroup] 2025-11-03T15:43:06.2267663Z Complete job name: before-test / get-label-type / runner-determinator 2025-11-03T15:43:06.7288278Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:06.7290918Z cat < runner_determinator.py 2025-11-03T15:43:06.7291617Z # flake8: noqa: G004 2025-11-03T15:43:06.7292272Z  2025-11-03T15:43:06.7293062Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:06.7294189Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:06.7295254Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:06.7295998Z  2025-11-03T15:43:06.7296495Z """ 2025-11-03T15:43:06.7297265Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:06.7298365Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:06.7299698Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:06.7301063Z of which runners should be used to run which job. 2025-11-03T15:43:06.7301771Z  2025-11-03T15:43:06.7302519Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:06.7303715Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:06.7304771Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:06.7305662Z list, defined. 2025-11-03T15:43:06.7306259Z  2025-11-03T15:43:06.7306990Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:06.7308087Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:06.7309150Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:06.7309927Z  2025-11-03T15:43:06.7311195Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:06.7312342Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:06.7313315Z experiments which the user could be opted in to. 2025-11-03T15:43:06.7314003Z  2025-11-03T15:43:06.7314610Z The user list has the following rules: 2025-11-03T15:43:06.7315244Z  2025-11-03T15:43:06.7315977Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:06.7317047Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:06.7318025Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:06.7318731Z  2025-11-03T15:43:06.7319228Z Example config: 2025-11-03T15:43:06.7319893Z  # A list of experiments that can be opted into. 2025-11-03T15:43:06.7320871Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:06.7405898Z  # Expected syntax is: 2025-11-03T15:43:06.7406889Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:06.7407988Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:06.7408833Z  2025-11-03T15:43:06.7409240Z  experiments: 2025-11-03T15:43:06.7409722Z  lf: 2025-11-03T15:43:06.7410173Z  rollout_percent: 25 2025-11-03T15:43:06.7410847Z  all_branches: false 2025-11-03T15:43:06.7411385Z  default: true 2025-11-03T15:43:06.7411865Z  --- 2025-11-03T15:43:06.7412284Z  2025-11-03T15:43:06.7412677Z  # Opt-ins: 2025-11-03T15:43:06.7413388Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:06.7414679Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:06.7415635Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:06.7416394Z  # Experiments should be from the above list. 2025-11-03T15:43:06.7416995Z  2025-11-03T15:43:06.7417418Z  @User1,-lf,split_build 2025-11-03T15:43:06.7417940Z  @User2,lf 2025-11-03T15:43:06.7418412Z  @User3,split_build 2025-11-03T15:43:06.7418907Z """ 2025-11-03T15:43:06.7419305Z  2025-11-03T15:43:06.7419695Z import json 2025-11-03T15:43:06.7420141Z import logging 2025-11-03T15:43:06.7420770Z import os 2025-11-03T15:43:06.7421201Z import random 2025-11-03T15:43:06.7421649Z import re 2025-11-03T15:43:06.7422073Z import sys 2025-11-03T15:43:06.7422563Z from argparse import ArgumentParser 2025-11-03T15:43:06.7423274Z from collections.abc import Iterable 2025-11-03T15:43:06.7423907Z from functools import cache 2025-11-03T15:43:06.7424473Z from logging import LogRecord 2025-11-03T15:43:06.7425057Z from typing import Any, NamedTuple 2025-11-03T15:43:06.7425703Z from urllib.request import Request, urlopen 2025-11-03T15:43:06.7426307Z  2025-11-03T15:43:06.7426709Z import yaml 2025-11-03T15:43:06.7427192Z from github import Auth, Github 2025-11-03T15:43:06.7427778Z from github.Issue import Issue 2025-11-03T15:43:06.7428309Z  2025-11-03T15:43:06.7428705Z  2025-11-03T15:43:06.7429189Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:06.7429986Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:06.7431340Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:06.7432135Z  2025-11-03T15:43:06.7432820Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:06.7433479Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:06.7434086Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:06.7434784Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:06.7435360Z  2025-11-03T15:43:06.7435820Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:06.7436375Z  2025-11-03T15:43:06.7436792Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:06.7437343Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:06.7437849Z  2025-11-03T15:43:06.7438226Z  2025-11-03T15:43:06.7438636Z class Experiment(NamedTuple): 2025-11-03T15:43:06.7439204Z  rollout_perc: float = ( 2025-11-03T15:43:06.7439971Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:06.7440840Z  ) 2025-11-03T15:43:06.7441270Z  all_branches: bool = ( 2025-11-03T15:43:06.7442022Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:06.7442772Z  ) 2025-11-03T15:43:06.7443198Z  default: bool = ( 2025-11-03T15:43:06.7443890Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:06.7444611Z  ) 2025-11-03T15:43:06.7445015Z  2025-11-03T15:43:06.7445436Z  # Add more fields as needed 2025-11-03T15:43:06.7445972Z  2025-11-03T15:43:06.7446354Z  2025-11-03T15:43:06.7446763Z class Settings(NamedTuple): 2025-11-03T15:43:06.7447289Z  """ 2025-11-03T15:43:06.7447834Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:06.7448485Z  """ 2025-11-03T15:43:06.7448889Z  2025-11-03T15:43:06.7449344Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:06.7449921Z  2025-11-03T15:43:06.7450571Z  2025-11-03T15:43:06.7451066Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:06.7451794Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:06.7452441Z  2025-11-03T15:43:06.7452828Z  COLORS = { 2025-11-03T15:43:06.7453330Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:06.7453908Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:06.7454486Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:06.7455068Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:06.7455637Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:06.7456173Z  } 2025-11-03T15:43:06.7456569Z  2025-11-03T15:43:06.7457044Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:06.7457890Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:06.7458754Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:06.7459414Z  return super().format(record) 2025-11-03T15:43:06.7459968Z  2025-11-03T15:43:06.7460495Z  2025-11-03T15:43:06.7460932Z handler = logging.StreamHandler() 2025-11-03T15:43:06.7461749Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:06.7462534Z  2025-11-03T15:43:06.7463043Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:06.7463701Z log.addHandler(handler) 2025-11-03T15:43:06.7464240Z log.setLevel(logging.INFO) 2025-11-03T15:43:06.7464758Z  2025-11-03T15:43:06.7465144Z  2025-11-03T15:43:06.7465658Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:06.7466292Z  """ 2025-11-03T15:43:06.7466887Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:06.7467724Z  """ 2025-11-03T15:43:06.7468153Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:06.7469373Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:06.7470849Z  log.warning( 2025-11-03T15:43:06.7471832Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:06.7472832Z  ) 2025-11-03T15:43:06.7473350Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:06.7473951Z  return 2025-11-03T15:43:06.7474393Z  2025-11-03T15:43:06.7474839Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:06.7475491Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:06.7476143Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:06.7476686Z  2025-11-03T15:43:06.7477084Z  2025-11-03T15:43:06.7477657Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:06.7478389Z  return frozenset( 2025-11-03T15:43:06.7479108Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:06.7479855Z  ) 2025-11-03T15:43:06.7480499Z  2025-11-03T15:43:06.7480884Z  2025-11-03T15:43:06.7481294Z def parse_args() -> Any: 2025-11-03T15:43:06.7481974Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:06.7482943Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:06.7483789Z  parser.add_argument( 2025-11-03T15:43:06.7484337Z  "--github-issue-repo", 2025-11-03T15:43:06.7484888Z  type=str, 2025-11-03T15:43:06.7485391Z  required=False, 2025-11-03T15:43:06.7486082Z  default="pytorch/test-infra", 2025-11-03T15:43:06.7486732Z  help="GitHub repo to get the issue", 2025-11-03T15:43:06.7487304Z  ) 2025-11-03T15:43:06.7487740Z  parser.add_argument( 2025-11-03T15:43:06.7488278Z  "--github-repo", 2025-11-03T15:43:06.7488789Z  type=str, 2025-11-03T15:43:06.7489285Z  required=True, 2025-11-03T15:43:06.7489853Z  help="GitHub repo where CI is running", 2025-11-03T15:43:06.7490548Z  ) 2025-11-03T15:43:06.7490992Z  parser.add_argument( 2025-11-03T15:43:06.7491697Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:06.7492427Z  ) 2025-11-03T15:43:06.7492860Z  parser.add_argument( 2025-11-03T15:43:06.7493600Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:06.7494350Z  ) 2025-11-03T15:43:06.7494801Z  parser.add_argument( 2025-11-03T15:43:06.7495550Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:06.7496315Z  ) 2025-11-03T15:43:06.7496758Z  parser.add_argument( 2025-11-03T15:43:06.7497529Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:06.7498315Z  ) 2025-11-03T15:43:06.7498768Z  parser.add_argument( 2025-11-03T15:43:06.7499310Z  "--github-ref-type", 2025-11-03T15:43:06.7499889Z  type=str, 2025-11-03T15:43:06.7500521Z  required=True, 2025-11-03T15:43:06.7501140Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:06.7501766Z  ) 2025-11-03T15:43:06.7502212Z  parser.add_argument( 2025-11-03T15:43:06.7502909Z  "--eligible-experiments", 2025-11-03T15:43:06.7503526Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.7504122Z  required=False, 2025-11-03T15:43:06.7504647Z  default="", 2025-11-03T15:43:06.7505617Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:06.7506620Z  ) 2025-11-03T15:43:06.7507059Z  parser.add_argument( 2025-11-03T15:43:06.7507618Z  "--opt-out-experiments", 2025-11-03T15:43:06.7508211Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.7508801Z  required=False, 2025-11-03T15:43:06.7509328Z  default="", 2025-11-03T15:43:06.7509814Z  help=( 2025-11-03T15:43:06.7510695Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:06.7511928Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:06.7512834Z  ), 2025-11-03T15:43:06.7513264Z  ) 2025-11-03T15:43:06.7513710Z  parser.add_argument( 2025-11-03T15:43:06.7514246Z  "--pr-number", 2025-11-03T15:43:06.7514758Z  type=str, 2025-11-03T15:43:06.7515247Z  required=False, 2025-11-03T15:43:06.7515763Z  default="", 2025-11-03T15:43:06.7516353Z  help="the optional PR number where this is run", 2025-11-03T15:43:06.7516970Z  ) 2025-11-03T15:43:06.7517388Z  2025-11-03T15:43:06.7517814Z  return parser.parse_args() 2025-11-03T15:43:06.7518353Z  2025-11-03T15:43:06.7518736Z  2025-11-03T15:43:06.7519398Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.7520481Z  auth = Auth.Token(github_token) 2025-11-03T15:43:06.7521129Z  return Github(auth=auth) 2025-11-03T15:43:06.7521665Z  2025-11-03T15:43:06.7522051Z  2025-11-03T15:43:06.7522789Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.7523711Z  repo = gh.get_repo(repo) 2025-11-03T15:43:06.7524330Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:06.7524926Z  2025-11-03T15:43:06.7525307Z  2025-11-03T15:43:06.7525741Z def get_potential_pr_author( 2025-11-03T15:43:06.7526502Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:06.7527267Z ) -> str: 2025-11-03T15:43:06.7527885Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:06.7528798Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:06.7529665Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:06.7530409Z  2025-11-03T15:43:06.7530908Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.7531462Z  2025-11-03T15:43:06.7531997Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:06.7532714Z  split_tag = ref_name.split("/") 2025-11-03T15:43:06.7533295Z  if ( 2025-11-03T15:43:06.7533775Z  len(split_tag) == 3 2025-11-03T15:43:06.7534354Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:06.7534972Z  and split_tag[2].isnumeric() 2025-11-03T15:43:06.7535531Z  ): 2025-11-03T15:43:06.7536010Z  pr_number = split_tag[2] 2025-11-03T15:43:06.7536568Z  try: 2025-11-03T15:43:06.7537104Z  repository = gh.get_repo(repo) 2025-11-03T15:43:06.7537965Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:06.7538669Z  except Exception as e: 2025-11-03T15:43:06.7539337Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:06.7540143Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:06.7541060Z  ) from e 2025-11-03T15:43:06.7541714Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:06.7542519Z  # In all other cases, return the original input username 2025-11-03T15:43:06.7543185Z  return username 2025-11-03T15:43:06.7543666Z  2025-11-03T15:43:06.7544063Z  2025-11-03T15:43:06.7544540Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:06.7545150Z  """ 2025-11-03T15:43:06.7545895Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:06.7546769Z  """ 2025-11-03T15:43:06.7547417Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:06.7548153Z  2025-11-03T15:43:06.7548546Z  2025-11-03T15:43:06.7548985Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:06.7549560Z  try: 2025-11-03T15:43:06.7550024Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:06.7551158Z  return data 2025-11-03T15:43:06.7551677Z  except yaml.YAMLError: 2025-11-03T15:43:06.7552262Z  log.exception("Error loading YAML") 2025-11-03T15:43:06.7552848Z  raise 2025-11-03T15:43:06.7553290Z  2025-11-03T15:43:06.7553680Z  2025-11-03T15:43:06.7554371Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:06.7555211Z  """ 2025-11-03T15:43:06.7556074Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:06.7556941Z  2025-11-03T15:43:06.7557560Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.7558423Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.7559051Z  2025-11-03T15:43:06.7559691Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:06.7560590Z  """ 2025-11-03T15:43:06.7561120Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:06.7561805Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:06.7562512Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:06.7563294Z  else: 2025-11-03T15:43:06.7563871Z  return "", rollout_state 2025-11-03T15:43:06.7564412Z  2025-11-03T15:43:06.7564795Z  2025-11-03T15:43:06.7565252Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:06.7565828Z  """ 2025-11-03T15:43:06.7566432Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:06.7567133Z  """ 2025-11-03T15:43:06.7567538Z  2025-11-03T15:43:06.7567916Z  2025-11-03T15:43:06.7568514Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:06.7569271Z  """ 2025-11-03T15:43:06.7570076Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:06.7571093Z  2025-11-03T15:43:06.7571973Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:06.7573085Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:06.7573983Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:06.7574677Z  2025-11-03T15:43:06.7575050Z  2025-11-03T15:43:06.7575435Z  """ 2025-11-03T15:43:06.7575865Z  optins = UserOptins() 2025-11-03T15:43:06.7576459Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:06.7577100Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:06.7577725Z  if not user or not user.startswith("@"): 2025-11-03T15:43:06.7578349Z  # Not a valid user. Skip 2025-11-03T15:43:06.7578903Z  continue 2025-11-03T15:43:06.7579377Z  2025-11-03T15:43:06.7579797Z  if user: 2025-11-03T15:43:06.7580439Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:06.7581216Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:06.7581919Z  2025-11-03T15:43:06.7582325Z  return optins 2025-11-03T15:43:06.7582784Z  2025-11-03T15:43:06.7583158Z  2025-11-03T15:43:06.7583708Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:06.7584400Z  """ 2025-11-03T15:43:06.7584864Z  Check if the experiment name is valid. 2025-11-03T15:43:06.7585449Z  A valid name: 2025-11-03T15:43:06.7586197Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:06.7587240Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:06.7588063Z  - Cannot contain spaces 2025-11-03T15:43:06.7588596Z  """ 2025-11-03T15:43:06.7589006Z  2025-11-03T15:43:06.7589514Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:06.7590429Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:06.7591418Z  2025-11-03T15:43:06.7591910Z  if valid: 2025-11-03T15:43:06.7592383Z  return True 2025-11-03T15:43:06.7592848Z  2025-11-03T15:43:06.7593241Z  log.error( 2025-11-03T15:43:06.7594844Z  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-11-03T15:43:06.7596518Z  ) 2025-11-03T15:43:06.7596943Z  return False 2025-11-03T15:43:06.7597401Z  2025-11-03T15:43:06.7597793Z  2025-11-03T15:43:06.7598360Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:06.7599064Z  """ 2025-11-03T15:43:06.7599730Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:06.7600637Z  """ 2025-11-03T15:43:06.7601050Z  try: 2025-11-03T15:43:06.7601481Z  if settings_text: 2025-11-03T15:43:06.7602318Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:06.7603199Z  # for easy reading 2025-11-03T15:43:06.7604132Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:06.7605111Z  # the backtick character in shell commands. 2025-11-03T15:43:06.7605788Z  backtick = chr(96) # backtick character 2025-11-03T15:43:06.7606560Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:06.7607304Z  settings = load_yaml(settings_text) 2025-11-03T15:43:06.7607881Z  2025-11-03T15:43:06.7608542Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:06.7609511Z  experiments = {} 2025-11-03T15:43:06.7610027Z  2025-11-03T15:43:06.7610831Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:06.7611680Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:06.7612874Z  # 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-11-03T15:43:06.7614013Z  continue 2025-11-03T15:43:06.7614521Z  2025-11-03T15:43:06.7614938Z  valid_settings = {} 2025-11-03T15:43:06.7615542Z  for setting in exp_settings: 2025-11-03T15:43:06.7616183Z  if setting not in Experiment._fields: 2025-11-03T15:43:06.7616829Z  log.warning( 2025-11-03T15:43:06.7617648Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:06.7618458Z  ) 2025-11-03T15:43:06.7618964Z  else: 2025-11-03T15:43:06.7619581Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:06.7620498Z  2025-11-03T15:43:06.7621049Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:06.7621759Z  return Settings(experiments) 2025-11-03T15:43:06.7622311Z  2025-11-03T15:43:06.7622723Z  except Exception: 2025-11-03T15:43:06.7623308Z  log.exception("Failed to parse settings") 2025-11-03T15:43:06.7623902Z  2025-11-03T15:43:06.7624309Z  return Settings() 2025-11-03T15:43:06.7624789Z  2025-11-03T15:43:06.7625180Z  2025-11-03T15:43:06.7625834Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:06.7626489Z  """ 2025-11-03T15:43:06.7626997Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:06.7627605Z  2025-11-03T15:43:06.7628205Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.7629045Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.7629667Z  2025-11-03T15:43:06.7630436Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:06.7631241Z  """ 2025-11-03T15:43:06.7631876Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.7632731Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:06.7633336Z  2025-11-03T15:43:06.7633708Z  2025-11-03T15:43:06.7634223Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:06.7634853Z  """ 2025-11-03T15:43:06.7635317Z  Parse users from the rollout state. 2025-11-03T15:43:06.7635877Z  2025-11-03T15:43:06.7636257Z  """ 2025-11-03T15:43:06.7636866Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.7637705Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:06.7638313Z  2025-11-03T15:43:06.7638680Z  2025-11-03T15:43:06.7639365Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.7640173Z  """ 2025-11-03T15:43:06.7640775Z  Check if a user is opted into an experiment 2025-11-03T15:43:06.7641372Z  """ 2025-11-03T15:43:06.7641934Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:06.7642571Z  2025-11-03T15:43:06.7643076Z  2025-11-03T15:43:06.7643767Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.7644583Z  """ 2025-11-03T15:43:06.7645124Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:06.7645766Z  """ 2025-11-03T15:43:06.7646366Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:06.7647150Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:06.7647876Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:06.7648551Z  return False 2025-11-03T15:43:06.7649019Z  2025-11-03T15:43:06.7649555Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:06.7650321Z  log.warning( 2025-11-03T15:43:06.7651251Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:06.7652204Z  ) 2025-11-03T15:43:06.7652623Z  2025-11-03T15:43:06.7653020Z  return True 2025-11-03T15:43:06.7653462Z  2025-11-03T15:43:06.7653844Z  2025-11-03T15:43:06.7654248Z def get_runner_prefix( 2025-11-03T15:43:06.7654769Z  rollout_state: str, 2025-11-03T15:43:06.7655333Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:06.7655917Z  branch: str, 2025-11-03T15:43:06.7656509Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.7657271Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.7657931Z  is_canary: bool = False, 2025-11-03T15:43:06.7658467Z ) -> str: 2025-11-03T15:43:06.7659000Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:06.7659661Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:06.7660340Z  2025-11-03T15:43:06.7660876Z  fleet_prefix = "" 2025-11-03T15:43:06.7661401Z  prefixes = [] 2025-11-03T15:43:06.7662132Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:06.7663164Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:06.7663949Z  log.info( 2025-11-03T15:43:06.7664719Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:06.7665537Z  ) 2025-11-03T15:43:06.7666003Z  continue 2025-11-03T15:43:06.7666464Z  2025-11-03T15:43:06.7666884Z  if opt_out_experiments: 2025-11-03T15:43:06.7667501Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:06.7668237Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:06.7668922Z  log.info( 2025-11-03T15:43:06.7669957Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:06.7671112Z  ) 2025-11-03T15:43:06.7671589Z  continue 2025-11-03T15:43:06.7672079Z  2025-11-03T15:43:06.7672505Z  if eligible_experiments: 2025-11-03T15:43:06.7673190Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:06.7673899Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:06.7674520Z  log.info( 2025-11-03T15:43:06.7675399Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:06.7676306Z  ) 2025-11-03T15:43:06.7676916Z  continue 2025-11-03T15:43:06.7677488Z  elif not experiment_settings.default: 2025-11-03T15:43:06.7678085Z  log.info( 2025-11-03T15:43:06.7678837Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:06.7679637Z  ) 2025-11-03T15:43:06.7680094Z  continue 2025-11-03T15:43:06.7680668Z  2025-11-03T15:43:06.7681197Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:06.7681886Z  opted_out_users = [ 2025-11-03T15:43:06.7682419Z  requestor 2025-11-03T15:43:06.7682971Z  for requestor in workflow_requestors 2025-11-03T15:43:06.7683733Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.7684425Z  ] 2025-11-03T15:43:06.7684836Z  2025-11-03T15:43:06.7685247Z  if opted_out_users: 2025-11-03T15:43:06.7685806Z  log.info( 2025-11-03T15:43:06.7686535Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:06.7687294Z  ) 2025-11-03T15:43:06.7687751Z  continue 2025-11-03T15:43:06.7688217Z  2025-11-03T15:43:06.7688744Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:06.7689431Z  opted_in_users = [ 2025-11-03T15:43:06.7689966Z  requestor 2025-11-03T15:43:06.7690637Z  for requestor in workflow_requestors 2025-11-03T15:43:06.7691387Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.7692086Z  ] 2025-11-03T15:43:06.7692507Z  2025-11-03T15:43:06.7692918Z  enabled = False 2025-11-03T15:43:06.7693455Z  if opted_in_users: 2025-11-03T15:43:06.7694116Z  log.info( 2025-11-03T15:43:06.7694854Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:06.7695602Z  ) 2025-11-03T15:43:06.7696061Z  enabled = True 2025-11-03T15:43:06.7696560Z  2025-11-03T15:43:06.7697021Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:06.7697941Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:06.7698980Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:06.7699711Z  log.info( 2025-11-03T15:43:06.7700779Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:06.7701788Z  ) 2025-11-03T15:43:06.7702303Z  enabled = True 2025-11-03T15:43:06.7702831Z  2025-11-03T15:43:06.7703242Z  if enabled: 2025-11-03T15:43:06.7703756Z  label = experiment_name 2025-11-03T15:43:06.7704392Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:06.7705343Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:06.7706310Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:06.7707160Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:06.7707888Z  if is_canary: 2025-11-03T15:43:06.7708472Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:06.7709081Z  fleet_prefix = label 2025-11-03T15:43:06.7709637Z  else: 2025-11-03T15:43:06.7710381Z  prefixes.append(label) 2025-11-03T15:43:06.7710946Z  2025-11-03T15:43:06.7711348Z  if len(prefixes) > 1: 2025-11-03T15:43:06.7711861Z  log.error( 2025-11-03T15:43:06.7713028Z  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-11-03T15:43:06.7714227Z  ) 2025-11-03T15:43:06.7714694Z  prefixes = prefixes[:1] 2025-11-03T15:43:06.7715217Z  2025-11-03T15:43:06.7715632Z  # Fleet always comes first 2025-11-03T15:43:06.7716184Z  if fleet_prefix: 2025-11-03T15:43:06.7716715Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:06.7717280Z  2025-11-03T15:43:06.7717770Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:06.7718397Z  2025-11-03T15:43:06.7718772Z  2025-11-03T15:43:06.7719485Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:06.7720405Z  """ 2025-11-03T15:43:06.7721075Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:06.7721841Z  2025-11-03T15:43:06.7722467Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:06.7723231Z  """ 2025-11-03T15:43:06.7723684Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.7724307Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:06.7725031Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:06.7725693Z  2025-11-03T15:43:06.7726081Z  2025-11-03T15:43:06.7726734Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:06.7727722Z  for _ in range(num_retries): 2025-11-03T15:43:06.7728268Z  try: 2025-11-03T15:43:06.7728780Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:06.7729511Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:06.7730328Z  return json.loads(content) 2025-11-03T15:43:06.7730918Z  except Exception as e: 2025-11-03T15:43:06.7731546Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:06.7732151Z  2025-11-03T15:43:06.7732781Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:06.7733551Z  return {} 2025-11-03T15:43:06.7733986Z  2025-11-03T15:43:06.7734363Z  2025-11-03T15:43:06.7734745Z @cache 2025-11-03T15:43:06.7735450Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:06.7736273Z  """ 2025-11-03T15:43:06.7736726Z  Dynamically get PR information 2025-11-03T15:43:06.7737278Z  """ 2025-11-03T15:43:06.7737840Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:06.7738617Z  headers = { 2025-11-03T15:43:06.7739162Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:06.7739861Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:06.7740556Z  } 2025-11-03T15:43:06.7741065Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:06.7741741Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:06.7742336Z  headers=headers, 2025-11-03T15:43:06.7742839Z  ) 2025-11-03T15:43:06.7743237Z  2025-11-03T15:43:06.7743653Z  if not json_response: 2025-11-03T15:43:06.7744322Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:06.7745155Z  return {} 2025-11-03T15:43:06.7745620Z  2025-11-03T15:43:06.7746024Z  return json_response 2025-11-03T15:43:06.7746522Z  2025-11-03T15:43:06.7746893Z  2025-11-03T15:43:06.7747552Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:06.7748350Z  """ 2025-11-03T15:43:06.7748952Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:06.7749660Z  """ 2025-11-03T15:43:06.7750313Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:06.7751000Z  return { 2025-11-03T15:43:06.7751658Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:06.7752404Z  } 2025-11-03T15:43:06.7752796Z  2025-11-03T15:43:06.7753181Z  2025-11-03T15:43:06.7753591Z def main() -> None: 2025-11-03T15:43:06.7754089Z  args = parse_args() 2025-11-03T15:43:06.7754585Z  2025-11-03T15:43:06.7755049Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:06.7755643Z  2025-11-03T15:43:06.7756058Z  # Check if the PR is opt-out 2025-11-03T15:43:06.7756619Z  if args.pr_number: 2025-11-03T15:43:06.7757368Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:06.7758190Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:06.7758752Z  log.info( 2025-11-03T15:43:06.7759539Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:06.7760454Z  ) 2025-11-03T15:43:06.7761095Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.7761836Z  sys.exit() 2025-11-03T15:43:06.7762435Z  2025-11-03T15:43:06.7762822Z  try: 2025-11-03T15:43:06.7763334Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:06.7764113Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:06.7764806Z  ) 2025-11-03T15:43:06.7765212Z  2025-11-03T15:43:06.7765660Z  username = get_potential_pr_author( 2025-11-03T15:43:06.7766258Z  args.github_token, 2025-11-03T15:43:06.7766812Z  args.github_repo, 2025-11-03T15:43:06.7767353Z  args.github_actor, 2025-11-03T15:43:06.7767919Z  args.github_ref_type, 2025-11-03T15:43:06.7768490Z  args.github_branch, 2025-11-03T15:43:06.7769038Z  ) 2025-11-03T15:43:06.7769454Z  2025-11-03T15:43:06.7769982Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:06.7770741Z  2025-11-03T15:43:06.7771201Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:06.7771810Z  rollout_state, 2025-11-03T15:43:06.7772385Z  (args.github_issue_owner, username), 2025-11-03T15:43:06.7772987Z  args.github_branch, 2025-11-03T15:43:06.7773563Z  args.eligible_experiments, 2025-11-03T15:43:06.7774160Z  args.opt_out_experiments, 2025-11-03T15:43:06.7774729Z  is_canary, 2025-11-03T15:43:06.7775210Z  ) 2025-11-03T15:43:06.7775627Z  2025-11-03T15:43:06.7776038Z  except Exception as e: 2025-11-03T15:43:06.7776612Z  log.error( 2025-11-03T15:43:06.7777402Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:06.7778337Z  ) 2025-11-03T15:43:06.7778768Z  2025-11-03T15:43:06.7779355Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.7780069Z  2025-11-03T15:43:06.7780545Z  2025-11-03T15:43:06.7780950Z if __name__ == "__main__": 2025-11-03T15:43:06.7781451Z  main() 2025-11-03T15:43:06.7781874Z  2025-11-03T15:43:06.7782252Z EOF 2025-11-03T15:43:06.7782638Z  2025-11-03T15:43:06.7783052Z cat runner_determinator.py 2025-11-03T15:43:06.8996292Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:06.8997303Z env: 2025-11-03T15:43:06.8998202Z GITHUB_TOKEN: *** 2025-11-03T15:43:06.8998778Z ISSUE_NUMBER: 5132 2025-11-03T15:43:06.8999400Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:06.9000096Z ISSUE_OWNER: 2025-11-03T15:43:06.9000827Z CHECK_EXPERIMENTS: 2025-11-03T15:43:06.9001439Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:06.9002035Z PR_NUMBER: 2025-11-03T15:43:06.9002603Z ##[endgroup] 2025-11-03T15:43:06.9211298Z # flake8: noqa: G004 2025-11-03T15:43:06.9211673Z 2025-11-03T15:43:06.9212112Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:06.9213081Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:06.9214262Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:06.9214720Z 2025-11-03T15:43:06.9214883Z """ 2025-11-03T15:43:06.9215483Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:06.9216387Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:06.9217319Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:06.9218162Z of which runners should be used to run which job. 2025-11-03T15:43:06.9218575Z 2025-11-03T15:43:06.9218984Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:06.9220126Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:06.9221344Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:06.9222075Z list, defined. 2025-11-03T15:43:06.9222312Z 2025-11-03T15:43:06.9222684Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:06.9223635Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:06.9224495Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:06.9224942Z 2025-11-03T15:43:06.9225319Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:06.9226198Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:06.9226953Z experiments which the user could be opted in to. 2025-11-03T15:43:06.9227367Z 2025-11-03T15:43:06.9227569Z The user list has the following rules: 2025-11-03T15:43:06.9227928Z 2025-11-03T15:43:06.9228257Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:06.9229126Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:06.9229907Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:06.9230598Z 2025-11-03T15:43:06.9230890Z Example config: 2025-11-03T15:43:06.9231377Z # A list of experiments that can be opted into. 2025-11-03T15:43:06.9232073Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:06.9232709Z # Expected syntax is: 2025-11-03T15:43:06.9233373Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:06.9234361Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:06.9234991Z 2025-11-03T15:43:06.9235164Z experiments: 2025-11-03T15:43:06.9235574Z lf: 2025-11-03T15:43:06.9236007Z rollout_percent: 25 2025-11-03T15:43:06.9236663Z all_branches: false 2025-11-03T15:43:06.9237120Z default: true 2025-11-03T15:43:06.9237547Z --- 2025-11-03T15:43:06.9237757Z 2025-11-03T15:43:06.9237923Z # Opt-ins: 2025-11-03T15:43:06.9238521Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:06.9239418Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:06.9240453Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:06.9241165Z # Experiments should be from the above list. 2025-11-03T15:43:06.9241562Z 2025-11-03T15:43:06.9241751Z @User1,-lf,split_build 2025-11-03T15:43:06.9242200Z @User2,lf 2025-11-03T15:43:06.9242595Z @User3,split_build 2025-11-03T15:43:06.9243023Z """ 2025-11-03T15:43:06.9243220Z 2025-11-03T15:43:06.9243393Z import json 2025-11-03T15:43:06.9243779Z import logging 2025-11-03T15:43:06.9244172Z import os 2025-11-03T15:43:06.9244549Z import random 2025-11-03T15:43:06.9244938Z import re 2025-11-03T15:43:06.9245316Z import sys 2025-11-03T15:43:06.9245730Z from argparse import ArgumentParser 2025-11-03T15:43:06.9246279Z from collections.abc import Iterable 2025-11-03T15:43:06.9246819Z from functools import cache 2025-11-03T15:43:06.9247307Z from logging import LogRecord 2025-11-03T15:43:06.9247805Z from typing import Any, NamedTuple 2025-11-03T15:43:06.9248352Z from urllib.request import Request, urlopen 2025-11-03T15:43:06.9248735Z 2025-11-03T15:43:06.9248905Z import yaml 2025-11-03T15:43:06.9249301Z from github import Auth, Github 2025-11-03T15:43:06.9249820Z from github.Issue import Issue 2025-11-03T15:43:06.9250131Z 2025-11-03T15:43:06.9250137Z 2025-11-03T15:43:06.9250587Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:06.9251303Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:06.9252205Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:06.9252780Z 2025-11-03T15:43:06.9253024Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:06.9253758Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:06.9254292Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:06.9254881Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:06.9255243Z 2025-11-03T15:43:06.9255450Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:06.9255792Z 2025-11-03T15:43:06.9255983Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:06.9256455Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:06.9256744Z 2025-11-03T15:43:06.9256750Z 2025-11-03T15:43:06.9256940Z class Experiment(NamedTuple): 2025-11-03T15:43:06.9257442Z rollout_perc: float = ( 2025-11-03T15:43:06.9258091Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:06.9258789Z ) 2025-11-03T15:43:06.9259167Z all_branches: bool = ( 2025-11-03T15:43:06.9259804Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:06.9260688Z ) 2025-11-03T15:43:06.9261066Z default: bool = ( 2025-11-03T15:43:06.9261653Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:06.9262309Z ) 2025-11-03T15:43:06.9262513Z 2025-11-03T15:43:06.9262700Z # Add more fields as needed 2025-11-03T15:43:06.9263001Z 2025-11-03T15:43:06.9263007Z 2025-11-03T15:43:06.9263202Z class Settings(NamedTuple): 2025-11-03T15:43:06.9263652Z """ 2025-11-03T15:43:06.9264116Z Settings for the experiments that can be opted into. 2025-11-03T15:43:06.9264707Z """ 2025-11-03T15:43:06.9264910Z 2025-11-03T15:43:06.9265127Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:06.9265496Z 2025-11-03T15:43:06.9265503Z 2025-11-03T15:43:06.9265716Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:06.9266354Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:06.9266793Z 2025-11-03T15:43:06.9266965Z COLORS = { 2025-11-03T15:43:06.9267367Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:06.9268032Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:06.9268552Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:06.9269077Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:06.9269573Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:06.9270057Z } 2025-11-03T15:43:06.9270429Z 2025-11-03T15:43:06.9270663Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:06.9271444Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:06.9272246Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:06.9272834Z return super().format(record) 2025-11-03T15:43:06.9273173Z 2025-11-03T15:43:06.9273181Z 2025-11-03T15:43:06.9273385Z handler = logging.StreamHandler() 2025-11-03T15:43:06.9274112Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:06.9274691Z 2025-11-03T15:43:06.9274940Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:06.9275535Z log.addHandler(handler) 2025-11-03T15:43:06.9275999Z log.setLevel(logging.INFO) 2025-11-03T15:43:06.9276294Z 2025-11-03T15:43:06.9276301Z 2025-11-03T15:43:06.9276556Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:06.9277123Z """ 2025-11-03T15:43:06.9277639Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:06.9278292Z """ 2025-11-03T15:43:06.9278675Z if not GITHUB_OUTPUT: 2025-11-03T15:43:06.9279778Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:06.9281242Z log.warning( 2025-11-03T15:43:06.9282130Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:06.9283100Z ) 2025-11-03T15:43:06.9292817Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:06.9293445Z return 2025-11-03T15:43:06.9293715Z 2025-11-03T15:43:06.9294102Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:06.9294722Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:06.9295318Z f.write(f"{key}={value}\n") 2025-11-03T15:43:06.9295656Z 2025-11-03T15:43:06.9295663Z 2025-11-03T15:43:06.9295973Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:06.9296621Z return frozenset( 2025-11-03T15:43:06.9297247Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:06.9297956Z ) 2025-11-03T15:43:06.9298163Z 2025-11-03T15:43:06.9298170Z 2025-11-03T15:43:06.9298354Z def parse_args() -> Any: 2025-11-03T15:43:06.9298928Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:06.9299828Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:06.9300868Z parser.add_argument( 2025-11-03T15:43:06.9301348Z "--github-issue-repo", 2025-11-03T15:43:06.9301850Z type=str, 2025-11-03T15:43:06.9302303Z required=False, 2025-11-03T15:43:06.9302776Z default="pytorch/test-infra", 2025-11-03T15:43:06.9303335Z help="GitHub repo to get the issue", 2025-11-03T15:43:06.9303867Z ) 2025-11-03T15:43:06.9304252Z parser.add_argument( 2025-11-03T15:43:06.9304721Z "--github-repo", 2025-11-03T15:43:06.9305163Z type=str, 2025-11-03T15:43:06.9305574Z required=True, 2025-11-03T15:43:06.9306052Z help="GitHub repo where CI is running", 2025-11-03T15:43:06.9306595Z ) 2025-11-03T15:43:06.9306978Z parser.add_argument( 2025-11-03T15:43:06.9307586Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:06.9359203Z ) 2025-11-03T15:43:06.9359766Z parser.add_argument( 2025-11-03T15:43:06.9360730Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:06.9361471Z ) 2025-11-03T15:43:06.9361850Z parser.add_argument( 2025-11-03T15:43:06.9362742Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:06.9363450Z ) 2025-11-03T15:43:06.9363829Z parser.add_argument( 2025-11-03T15:43:06.9364501Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:06.9365247Z ) 2025-11-03T15:43:06.9365622Z parser.add_argument( 2025-11-03T15:43:06.9366086Z "--github-ref-type", 2025-11-03T15:43:06.9366546Z type=str, 2025-11-03T15:43:06.9366953Z required=True, 2025-11-03T15:43:06.9367451Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:06.9368005Z ) 2025-11-03T15:43:06.9368382Z parser.add_argument( 2025-11-03T15:43:06.9368844Z "--eligible-experiments", 2025-11-03T15:43:06.9369364Z type=_str_comma_separated_to_set, 2025-11-03T15:43:06.9369891Z required=False, 2025-11-03T15:43:06.9370543Z default="", 2025-11-03T15:43:06.9371431Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:06.9372398Z ) 2025-11-03T15:43:06.9372767Z parser.add_argument( 2025-11-03T15:43:06.9373239Z "--opt-out-experiments", 2025-11-03T15:43:06.9373788Z type=_str_comma_separated_to_set, 2025-11-03T15:43:06.9374321Z required=False, 2025-11-03T15:43:06.9374750Z default="", 2025-11-03T15:43:06.9375143Z help=( 2025-11-03T15:43:06.9375825Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:06.9376987Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:06.9377844Z ), 2025-11-03T15:43:06.9378199Z ) 2025-11-03T15:43:06.9378578Z parser.add_argument( 2025-11-03T15:43:06.9379030Z "--pr-number", 2025-11-03T15:43:06.9379446Z type=str, 2025-11-03T15:43:06.9379850Z required=False, 2025-11-03T15:43:06.9380450Z default="", 2025-11-03T15:43:06.9381123Z help="the optional PR number where this is run", 2025-11-03T15:43:06.9381704Z ) 2025-11-03T15:43:06.9381914Z 2025-11-03T15:43:06.9382107Z return parser.parse_args() 2025-11-03T15:43:06.9382416Z 2025-11-03T15:43:06.9382423Z 2025-11-03T15:43:06.9382831Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.9383606Z auth = Auth.Token(github_token) 2025-11-03T15:43:06.9384122Z return Github(auth=auth) 2025-11-03T15:43:06.9384422Z 2025-11-03T15:43:06.9384430Z 2025-11-03T15:43:06.9384883Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.9385704Z repo = gh.get_repo(repo) 2025-11-03T15:43:06.9386206Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:06.9386582Z 2025-11-03T15:43:06.9386589Z 2025-11-03T15:43:06.9386784Z def get_potential_pr_author( 2025-11-03T15:43:06.9387441Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:06.9388133Z ) -> str: 2025-11-03T15:43:06.9388656Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:06.9389458Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:06.9390359Z # embedded in the tag name: ciflow// 2025-11-03T15:43:06.9390869Z 2025-11-03T15:43:06.9391066Z gh = get_gh_client(github_token) 2025-11-03T15:43:06.9391417Z 2025-11-03T15:43:06.9391687Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:06.9392325Z split_tag = ref_name.split("/") 2025-11-03T15:43:06.9392833Z if ( 2025-11-03T15:43:06.9393242Z len(split_tag) == 3 2025-11-03T15:43:06.9393731Z and split_tag[0] == "ciflow" 2025-11-03T15:43:06.9394274Z and split_tag[2].isnumeric() 2025-11-03T15:43:06.9394772Z ): 2025-11-03T15:43:06.9395158Z pr_number = split_tag[2] 2025-11-03T15:43:06.9395783Z try: 2025-11-03T15:43:06.9396220Z repository = gh.get_repo(repo) 2025-11-03T15:43:06.9396839Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:06.9397449Z except Exception as e: 2025-11-03T15:43:06.9397980Z raise Exception( # noqa: TRY002 2025-11-03T15:43:06.9398645Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:06.9399300Z ) from e 2025-11-03T15:43:06.9399835Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:06.9400774Z # In all other cases, return the original input username 2025-11-03T15:43:06.9401364Z return username 2025-11-03T15:43:06.9401615Z 2025-11-03T15:43:06.9401622Z 2025-11-03T15:43:06.9401852Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:06.9402406Z """ 2025-11-03T15:43:06.9403042Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:06.9403843Z """ 2025-11-03T15:43:06.9404392Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:06.9404936Z 2025-11-03T15:43:06.9404943Z 2025-11-03T15:43:06.9405138Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:06.9405636Z try: 2025-11-03T15:43:06.9406030Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:06.9406558Z return data 2025-11-03T15:43:06.9406980Z except yaml.YAMLError: 2025-11-03T15:43:06.9407469Z log.exception("Error loading YAML") 2025-11-03T15:43:06.9408005Z raise 2025-11-03T15:43:06.9408245Z 2025-11-03T15:43:06.9408252Z 2025-11-03T15:43:06.9408737Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:06.9409493Z """ 2025-11-03T15:43:06.9410117Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:06.9410973Z 2025-11-03T15:43:06.9411471Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.9412259Z and the text below is the list of opted in users. 2025-11-03T15:43:06.9412673Z 2025-11-03T15:43:06.9413056Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:06.9413840Z """ 2025-11-03T15:43:06.9414309Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:06.9414937Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:06.9415550Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:06.9416140Z else: 2025-11-03T15:43:06.9416530Z return "", rollout_state 2025-11-03T15:43:06.9416841Z 2025-11-03T15:43:06.9416849Z 2025-11-03T15:43:06.9417056Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:06.9417568Z """ 2025-11-03T15:43:06.9418105Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:06.9418760Z """ 2025-11-03T15:43:06.9418971Z 2025-11-03T15:43:06.9418979Z 2025-11-03T15:43:06.9419321Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:06.9419980Z """ 2025-11-03T15:43:06.9420895Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:06.9421591Z 2025-11-03T15:43:06.9422220Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:06.9423225Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:06.9423912Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:06.9424401Z 2025-11-03T15:43:06.9424408Z 2025-11-03T15:43:06.9424566Z """ 2025-11-03T15:43:06.9424944Z optins = UserOptins() 2025-11-03T15:43:06.9425430Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:06.9425990Z user = user.strip("\r\n\t -") 2025-11-03T15:43:06.9426541Z if not user or not user.startswith("@"): 2025-11-03T15:43:06.9427247Z # Not a valid user. Skip 2025-11-03T15:43:06.9427738Z continue 2025-11-03T15:43:06.9427996Z 2025-11-03T15:43:06.9428157Z if user: 2025-11-03T15:43:06.9428603Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:06.9429293Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:06.9429803Z 2025-11-03T15:43:06.9429971Z return optins 2025-11-03T15:43:06.9430360Z 2025-11-03T15:43:06.9430374Z 2025-11-03T15:43:06.9430748Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:06.9431356Z """ 2025-11-03T15:43:06.9431758Z Check if the experiment name is valid. 2025-11-03T15:43:06.9432282Z A valid name: 2025-11-03T15:43:06.9432914Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:06.9433892Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:06.9434642Z - Cannot contain spaces 2025-11-03T15:43:06.9435108Z """ 2025-11-03T15:43:06.9435309Z 2025-11-03T15:43:06.9435573Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:06.9436286Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:06.9436741Z 2025-11-03T15:43:06.9436902Z if valid: 2025-11-03T15:43:06.9437292Z return True 2025-11-03T15:43:06.9437534Z 2025-11-03T15:43:06.9437700Z log.error( 2025-11-03T15:43:06.9439183Z 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-11-03T15:43:06.9441012Z ) 2025-11-03T15:43:06.9441373Z return False 2025-11-03T15:43:06.9441613Z 2025-11-03T15:43:06.9441620Z 2025-11-03T15:43:06.9441923Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:06.9442543Z """ 2025-11-03T15:43:06.9443282Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:06.9444033Z """ 2025-11-03T15:43:06.9444381Z try: 2025-11-03T15:43:06.9444762Z if settings_text: 2025-11-03T15:43:06.9445498Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:06.9446308Z # for easy reading 2025-11-03T15:43:06.9447099Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:06.9448002Z # the backtick character in shell commands. 2025-11-03T15:43:06.9448608Z backtick = chr(96) # backtick character 2025-11-03T15:43:06.9449280Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:06.9449976Z settings = load_yaml(settings_text) 2025-11-03T15:43:06.9450589Z 2025-11-03T15:43:06.9451019Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:06.9451819Z experiments = {} 2025-11-03T15:43:06.9452126Z 2025-11-03T15:43:06.9452519Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:06.9453316Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:06.9454447Z # 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-11-03T15:43:06.9455520Z continue 2025-11-03T15:43:06.9455816Z 2025-11-03T15:43:06.9456006Z valid_settings = {} 2025-11-03T15:43:06.9456526Z for setting in exp_settings: 2025-11-03T15:43:06.9457110Z if setting not in Experiment._fields: 2025-11-03T15:43:06.9457660Z log.warning( 2025-11-03T15:43:06.9458382Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:06.9459263Z ) 2025-11-03T15:43:06.9459694Z else: 2025-11-03T15:43:06.9460323Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:06.9460761Z 2025-11-03T15:43:06.9461037Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:06.9461675Z return Settings(experiments) 2025-11-03T15:43:06.9462035Z 2025-11-03T15:43:06.9462207Z except Exception: 2025-11-03T15:43:06.9462693Z log.exception("Failed to parse settings") 2025-11-03T15:43:06.9463088Z 2025-11-03T15:43:06.9463265Z return Settings() 2025-11-03T15:43:06.9463520Z 2025-11-03T15:43:06.9463527Z 2025-11-03T15:43:06.9463775Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:06.9464361Z """ 2025-11-03T15:43:06.9464797Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:06.9465211Z 2025-11-03T15:43:06.9465558Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.9466331Z and the text below is the list of opted in users. 2025-11-03T15:43:06.9466756Z 2025-11-03T15:43:06.9467164Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:06.9467917Z """ 2025-11-03T15:43:06.9468477Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.9469246Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:06.9469645Z 2025-11-03T15:43:06.9469652Z 2025-11-03T15:43:06.9469899Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:06.9470690Z """ 2025-11-03T15:43:06.9471090Z Parse users from the rollout state. 2025-11-03T15:43:06.9471444Z 2025-11-03T15:43:06.9471601Z """ 2025-11-03T15:43:06.9472132Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.9472902Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:06.9473325Z 2025-11-03T15:43:06.9473331Z 2025-11-03T15:43:06.9473876Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.9474649Z """ 2025-11-03T15:43:06.9475075Z Check if a user is opted into an experiment 2025-11-03T15:43:06.9475615Z """ 2025-11-03T15:43:06.9476067Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:06.9476498Z 2025-11-03T15:43:06.9476505Z 2025-11-03T15:43:06.9476932Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.9477691Z """ 2025-11-03T15:43:06.9478152Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:06.9478732Z """ 2025-11-03T15:43:06.9479239Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:06.9479926Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:06.9481321Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:06.9481982Z return False 2025-11-03T15:43:06.9482250Z 2025-11-03T15:43:06.9482528Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:06.9483149Z log.warning( 2025-11-03T15:43:06.9483953Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:06.9484852Z ) 2025-11-03T15:43:06.9485060Z 2025-11-03T15:43:06.9485227Z return True 2025-11-03T15:43:06.9485469Z 2025-11-03T15:43:06.9485475Z 2025-11-03T15:43:06.9485656Z def get_runner_prefix( 2025-11-03T15:43:06.9486112Z rollout_state: str, 2025-11-03T15:43:06.9486579Z workflow_requestors: Iterable[str], 2025-11-03T15:43:06.9487111Z branch: str, 2025-11-03T15:43:06.9487602Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.9488281Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.9488877Z is_canary: bool = False, 2025-11-03T15:43:06.9489342Z ) -> str: 2025-11-03T15:43:06.9489928Z settings = parse_settings(rollout_state) 2025-11-03T15:43:06.9490758Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:06.9491139Z 2025-11-03T15:43:06.9491325Z fleet_prefix = "" 2025-11-03T15:43:06.9491749Z prefixes = [] 2025-11-03T15:43:06.9492390Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:06.9493353Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:06.9494078Z log.info( 2025-11-03T15:43:06.9494763Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:06.9495534Z ) 2025-11-03T15:43:06.9495916Z continue 2025-11-03T15:43:06.9496169Z 2025-11-03T15:43:06.9496362Z if opt_out_experiments: 2025-11-03T15:43:06.9496903Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:06.9497546Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:06.9498166Z log.info( 2025-11-03T15:43:06.9499114Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:06.9500127Z ) 2025-11-03T15:43:06.9500640Z continue 2025-11-03T15:43:06.9500915Z 2025-11-03T15:43:06.9501103Z if eligible_experiments: 2025-11-03T15:43:06.9501704Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:06.9502343Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:06.9502909Z log.info( 2025-11-03T15:43:06.9503690Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:06.9504545Z ) 2025-11-03T15:43:06.9504952Z continue 2025-11-03T15:43:06.9505433Z elif not experiment_settings.default: 2025-11-03T15:43:06.9505985Z log.info( 2025-11-03T15:43:06.9506788Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:06.9507561Z ) 2025-11-03T15:43:06.9507937Z continue 2025-11-03T15:43:06.9508194Z 2025-11-03T15:43:06.9508509Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:06.9509133Z opted_out_users = [ 2025-11-03T15:43:06.9509594Z requestor 2025-11-03T15:43:06.9510050Z for requestor in workflow_requestors 2025-11-03T15:43:06.9510847Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.9511496Z ] 2025-11-03T15:43:06.9511710Z 2025-11-03T15:43:06.9511893Z if opted_out_users: 2025-11-03T15:43:06.9512361Z log.info( 2025-11-03T15:43:06.9512984Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:06.9513691Z ) 2025-11-03T15:43:06.9514067Z continue 2025-11-03T15:43:06.9514336Z 2025-11-03T15:43:06.9514630Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:06.9515269Z opted_in_users = [ 2025-11-03T15:43:06.9515723Z requestor 2025-11-03T15:43:06.9516184Z for requestor in workflow_requestors 2025-11-03T15:43:06.9516862Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.9517492Z ] 2025-11-03T15:43:06.9517696Z 2025-11-03T15:43:06.9517866Z enabled = False 2025-11-03T15:43:06.9518317Z if opted_in_users: 2025-11-03T15:43:06.9518759Z log.info( 2025-11-03T15:43:06.9519364Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:06.9520057Z ) 2025-11-03T15:43:06.9520553Z enabled = True 2025-11-03T15:43:06.9520838Z 2025-11-03T15:43:06.9521065Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:06.9521905Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:06.9522999Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:06.9523661Z log.info( 2025-11-03T15:43:06.9524534Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:06.9525488Z ) 2025-11-03T15:43:06.9525892Z enabled = True 2025-11-03T15:43:06.9526192Z 2025-11-03T15:43:06.9526368Z if enabled: 2025-11-03T15:43:06.9526791Z label = experiment_name 2025-11-03T15:43:06.9527353Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:06.9528194Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:06.9529087Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:06.9529855Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:06.9530636Z if is_canary: 2025-11-03T15:43:06.9531135Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:06.9531688Z fleet_prefix = label 2025-11-03T15:43:06.9532181Z else: 2025-11-03T15:43:06.9532605Z prefixes.append(label) 2025-11-03T15:43:06.9532960Z 2025-11-03T15:43:06.9533145Z if len(prefixes) > 1: 2025-11-03T15:43:06.9533588Z log.error( 2025-11-03T15:43:06.9534633Z 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-11-03T15:43:06.9535769Z ) 2025-11-03T15:43:06.9536163Z prefixes = prefixes[:1] 2025-11-03T15:43:06.9536471Z 2025-11-03T15:43:06.9536666Z # Fleet always comes first 2025-11-03T15:43:06.9537140Z if fleet_prefix: 2025-11-03T15:43:06.9537594Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:06.9537965Z 2025-11-03T15:43:06.9538347Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:06.9538793Z 2025-11-03T15:43:06.9538800Z 2025-11-03T15:43:06.9539247Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:06.9540060Z """ 2025-11-03T15:43:06.9540765Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:06.9541348Z 2025-11-03T15:43:06.9541738Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:06.9542454Z """ 2025-11-03T15:43:06.9542849Z gh = get_gh_client(github_token) 2025-11-03T15:43:06.9543395Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:06.9544043Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:06.9544497Z 2025-11-03T15:43:06.9544504Z 2025-11-03T15:43:06.9544915Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:06.9545691Z for _ in range(num_retries): 2025-11-03T15:43:06.9546178Z try: 2025-11-03T15:43:06.9546607Z req = Request(url=url, headers=headers) 2025-11-03T15:43:06.9547286Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:06.9547937Z return json.loads(content) 2025-11-03T15:43:06.9548477Z except Exception as e: 2025-11-03T15:43:06.9549027Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:06.9549439Z 2025-11-03T15:43:06.9549816Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:06.9550658Z return {} 2025-11-03T15:43:06.9550899Z 2025-11-03T15:43:06.9550906Z 2025-11-03T15:43:06.9551068Z @cache 2025-11-03T15:43:06.9551699Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:06.9552465Z """ 2025-11-03T15:43:06.9552866Z Dynamically get PR information 2025-11-03T15:43:06.9553512Z """ 2025-11-03T15:43:06.9554013Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:06.9554651Z headers = { 2025-11-03T15:43:06.9555107Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:06.9555723Z "Authorization": f"token {github_token}", 2025-11-03T15:43:06.9556267Z } 2025-11-03T15:43:06.9556704Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:06.9557328Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:06.9557884Z headers=headers, 2025-11-03T15:43:06.9558315Z ) 2025-11-03T15:43:06.9558520Z 2025-11-03T15:43:06.9558702Z if not json_response: 2025-11-03T15:43:06.9559272Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:06.9559893Z return {} 2025-11-03T15:43:06.9560130Z 2025-11-03T15:43:06.9560417Z return json_response 2025-11-03T15:43:06.9560704Z 2025-11-03T15:43:06.9560710Z 2025-11-03T15:43:06.9561115Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:06.9561872Z """ 2025-11-03T15:43:06.9562395Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:06.9563071Z """ 2025-11-03T15:43:06.9563560Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:06.9564177Z return { 2025-11-03T15:43:06.9564775Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:06.9565485Z } 2025-11-03T15:43:06.9565694Z 2025-11-03T15:43:06.9565700Z 2025-11-03T15:43:06.9565874Z def main() -> None: 2025-11-03T15:43:06.9566299Z args = parse_args() 2025-11-03T15:43:06.9566581Z 2025-11-03T15:43:06.9566806Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:06.9567199Z 2025-11-03T15:43:06.9567396Z # Check if the PR is opt-out 2025-11-03T15:43:06.9567888Z if args.pr_number: 2025-11-03T15:43:06.9568559Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:06.9569452Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:06.9570015Z log.info( 2025-11-03T15:43:06.9570802Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:06.9571581Z ) 2025-11-03T15:43:06.9572130Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.9572826Z sys.exit() 2025-11-03T15:43:06.9573086Z 2025-11-03T15:43:06.9573260Z try: 2025-11-03T15:43:06.9573704Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:06.9574424Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:06.9575071Z ) 2025-11-03T15:43:06.9575288Z 2025-11-03T15:43:06.9575493Z username = get_potential_pr_author( 2025-11-03T15:43:06.9576041Z args.github_token, 2025-11-03T15:43:06.9576526Z args.github_repo, 2025-11-03T15:43:06.9577009Z args.github_actor, 2025-11-03T15:43:06.9577510Z args.github_ref_type, 2025-11-03T15:43:06.9578032Z args.github_branch, 2025-11-03T15:43:06.9578501Z ) 2025-11-03T15:43:06.9578711Z 2025-11-03T15:43:06.9579000Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:06.9579453Z 2025-11-03T15:43:06.9579681Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:06.9580345Z rollout_state, 2025-11-03T15:43:06.9580838Z (args.github_issue_owner, username), 2025-11-03T15:43:06.9581397Z args.github_branch, 2025-11-03T15:43:06.9581903Z args.eligible_experiments, 2025-11-03T15:43:06.9582441Z args.opt_out_experiments, 2025-11-03T15:43:06.9582950Z is_canary, 2025-11-03T15:43:06.9583359Z ) 2025-11-03T15:43:06.9583565Z 2025-11-03T15:43:06.9583756Z except Exception as e: 2025-11-03T15:43:06.9584211Z log.error( 2025-11-03T15:43:06.9584891Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:06.9585805Z ) 2025-11-03T15:43:06.9586019Z 2025-11-03T15:43:06.9586350Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.9586856Z 2025-11-03T15:43:06.9586862Z 2025-11-03T15:43:06.9587048Z if __name__ == "__main__": 2025-11-03T15:43:06.9587486Z main() 2025-11-03T15:43:06.9587698Z 2025-11-03T15:43:06.9682863Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:06.9683773Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:06.9716947Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:06.9717434Z env: 2025-11-03T15:43:06.9718054Z GITHUB_TOKEN: *** 2025-11-03T15:43:06.9718480Z ISSUE_NUMBER: 5132 2025-11-03T15:43:06.9718925Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:06.9719446Z ISSUE_OWNER: 2025-11-03T15:43:06.9719851Z CHECK_EXPERIMENTS: 2025-11-03T15:43:06.9720420Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:06.9720872Z PR_NUMBER: 2025-11-03T15:43:06.9721259Z ##[endgroup] 2025-11-03T15:43:09.1061223Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:10.0397402Z Collecting urllib3==1.26.18 2025-11-03T15:43:10.0934057Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:10.1169703Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.2 MB/s eta 0:00:00 2025-11-03T15:43:10.1486102Z Collecting PyGithub==2.3.0 2025-11-03T15:43:10.1577901Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:10.2083056Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:10.2154535Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:10.2202611Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:10.2219507Z 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-11-03T15:43:10.2234310Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:10.2537433Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:10.2610980Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:10.2841793Z 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-11-03T15:43:10.4156053Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.4228354Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:10.5783629Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:10.5859312Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:10.6096634Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.6169996Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:10.6521485Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:10.6690436Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.0 MB/s eta 0:00:00 2025-11-03T15:43:10.6785964Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:10.7093032Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 11.9 MB/s eta 0:00:00 2025-11-03T15:43:10.7159762Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:10.7936693Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 18.3 MB/s eta 0:00:00 2025-11-03T15:43:10.8006432Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:10.8100945Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:10.8214547Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 21.6 MB/s eta 0:00:00 2025-11-03T15:43:10.8282247Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:10.8343114Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 25.3 MB/s eta 0:00:00 2025-11-03T15:43:10.8410441Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:10.8470059Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 24.7 MB/s eta 0:00:00 2025-11-03T15:43:11.1927595Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:11.7394131Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:11.8248782Z ##[group]Run curr_branch="main" 2025-11-03T15:43:11.8249095Z curr_branch="main" 2025-11-03T15:43:11.8249318Z curr_ref_type="branch" 2025-11-03T15:43:11.8249573Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:11.8249876Z  2025-11-03T15:43:11.8250070Z python3 runner_determinator.py \ 2025-11-03T15:43:11.8250680Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:11.8251077Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:11.8251355Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:11.8251631Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:11.8251916Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:11.8252199Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:11.8252475Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:11.8252771Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:11.8253143Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:11.8253436Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:11.8287687Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:11.8287910Z env: 2025-11-03T15:43:11.8288487Z GITHUB_TOKEN: *** 2025-11-03T15:43:11.8288675Z ISSUE_NUMBER: 5132 2025-11-03T15:43:11.8288897Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:11.8289123Z ISSUE_OWNER: 2025-11-03T15:43:11.8289301Z CHECK_EXPERIMENTS: 2025-11-03T15:43:11.8289485Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:11.8289676Z PR_NUMBER: 2025-11-03T15:43:11.8289846Z ##[endgroup] 2025-11-03T15:43:11.8341347Z Current branch is 'main' 2025-11-03T15:43:13.3688438Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:13.3689631Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:13.3690882Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:13.3691567Z INFO : Setting output: label-type='' 2025-11-03T15:43:13.4023103Z Evaluate and set job outputs 2025-11-03T15:43:13.4029750Z Cleaning up orphan processes