2025-08-14T20:49:52.5197353Z Current runner version: '2.327.1' 2025-08-14T20:49:52.5232799Z ##[group]Runner Image Provisioner 2025-08-14T20:49:52.5234257Z Hosted Compute Agent 2025-08-14T20:49:52.5235161Z Version: 20250812.370 2025-08-14T20:49:52.5236286Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:49:52.5237480Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:49:52.5238547Z ##[endgroup] 2025-08-14T20:49:52.5239415Z ##[group]Operating System 2025-08-14T20:49:52.5240564Z Ubuntu 2025-08-14T20:49:52.5241707Z 24.04.2 2025-08-14T20:49:52.5242621Z LTS 2025-08-14T20:49:52.5243438Z ##[endgroup] 2025-08-14T20:49:52.5244222Z ##[group]Runner Image 2025-08-14T20:49:52.5245788Z Image: ubuntu-24.04 2025-08-14T20:49:52.5246768Z Version: 20250804.2.0 2025-08-14T20:49:52.5248749Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:49:52.5251965Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:49:52.5253999Z ##[endgroup] 2025-08-14T20:49:52.5255752Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:49:52.5258867Z Contents: read 2025-08-14T20:49:52.5259992Z Metadata: read 2025-08-14T20:49:52.5261049Z ##[endgroup] 2025-08-14T20:49:52.5264598Z Secret source: Actions 2025-08-14T20:49:52.5266180Z Prepare workflow directory 2025-08-14T20:49:52.6038867Z Prepare all required actions 2025-08-14T20:49:52.6124515Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:49:52.6132079Z ##[group] Inputs 2025-08-14T20:49:52.6133121Z check_experiments: 2025-08-14T20:49:52.6133995Z opt_out_experiments: 2025-08-14T20:49:52.6135172Z triggering_actor: pytorchmergebot 2025-08-14T20:49:52.6136151Z issue_owner: 2025-08-14T20:49:52.6136965Z curr_branch: main 2025-08-14T20:49:52.6138025Z curr_ref_type: branch 2025-08-14T20:49:52.6139117Z issue_number: 5132 2025-08-14T20:49:52.6140084Z ##[endgroup] 2025-08-14T20:49:52.6141403Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:49:53.1026311Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:49:53.1028788Z cat < runner_determinator.py 2025-08-14T20:49:53.1029537Z # flake8: noqa: G004 2025-08-14T20:49:53.1030134Z  2025-08-14T20:49:53.1031207Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:49:53.1032440Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:49:53.1033541Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:49:53.1034376Z  2025-08-14T20:49:53.1034827Z """ 2025-08-14T20:49:53.1035641Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:49:53.1036766Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:49:53.1038041Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:49:53.1039182Z of which runners should be used to run which job. 2025-08-14T20:49:53.1039945Z  2025-08-14T20:49:53.1040694Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:49:53.1042473Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:49:53.1043636Z settings are considered to be empty with only the second part, the user 2025-08-14T20:49:53.1044529Z list, defined. 2025-08-14T20:49:53.1045211Z  2025-08-14T20:49:53.1045939Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:49:53.1047084Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:49:53.1048242Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:49:53.1049016Z  2025-08-14T20:49:53.1050053Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:49:53.1051486Z The user list is also a comma separated list of additional features or 2025-08-14T20:49:53.1052480Z experiments which the user could be opted in to. 2025-08-14T20:49:53.1053237Z  2025-08-14T20:49:53.1053770Z The user list has the following rules: 2025-08-14T20:49:53.1054475Z  2025-08-14T20:49:53.1055186Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:49:53.1056347Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:49:53.1057383Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:49:53.1058076Z  2025-08-14T20:49:53.1058605Z Example config: 2025-08-14T20:49:53.1059235Z  # A list of experiments that can be opted into. 2025-08-14T20:49:53.1060147Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:49:53.1143092Z  # Expected syntax is: 2025-08-14T20:49:53.1144624Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:49:53.1146630Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:49:53.1148229Z  2025-08-14T20:49:53.1148673Z  experiments: 2025-08-14T20:49:53.1149149Z  lf: 2025-08-14T20:49:53.1149604Z  rollout_percent: 25 2025-08-14T20:49:53.1150149Z  all_branches: false 2025-08-14T20:49:53.1150671Z  default: true 2025-08-14T20:49:53.1151498Z  --- 2025-08-14T20:49:53.1151900Z  2025-08-14T20:49:53.1152285Z  # Opt-ins: 2025-08-14T20:49:53.1152964Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:49:53.1154208Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:49:53.1155120Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:49:53.1155867Z  # Experiments should be from the above list. 2025-08-14T20:49:53.1156456Z  2025-08-14T20:49:53.1156873Z  @User1,-lf,split_build 2025-08-14T20:49:53.1157397Z  @User2,lf 2025-08-14T20:49:53.1157856Z  @User3,split_build 2025-08-14T20:49:53.1158341Z """ 2025-08-14T20:49:53.1158729Z  2025-08-14T20:49:53.1159112Z import json 2025-08-14T20:49:53.1159556Z import logging 2025-08-14T20:49:53.1160002Z import os 2025-08-14T20:49:53.1160439Z import random 2025-08-14T20:49:53.1161075Z import re 2025-08-14T20:49:53.1161509Z import sys 2025-08-14T20:49:53.1161978Z from argparse import ArgumentParser 2025-08-14T20:49:53.1162659Z from collections.abc import Iterable 2025-08-14T20:49:53.1163256Z from functools import cache 2025-08-14T20:49:53.1163797Z from logging import LogRecord 2025-08-14T20:49:53.1164368Z from typing import Any, NamedTuple 2025-08-14T20:49:53.1164996Z from urllib.request import Request, urlopen 2025-08-14T20:49:53.1165583Z  2025-08-14T20:49:53.1165969Z import yaml 2025-08-14T20:49:53.1166426Z from github import Auth, Github 2025-08-14T20:49:53.1166989Z from github.Issue import Issue 2025-08-14T20:49:53.1167516Z  2025-08-14T20:49:53.1167887Z  2025-08-14T20:49:53.1168383Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:49:53.1169163Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:49:53.1170147Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:49:53.1171074Z  2025-08-14T20:49:53.1171775Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:49:53.1172410Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:49:53.1173008Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:49:53.1173675Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:49:53.1174257Z  2025-08-14T20:49:53.1174697Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:49:53.1175238Z  2025-08-14T20:49:53.1175636Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:49:53.1176166Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:49:53.1176672Z  2025-08-14T20:49:53.1177035Z  2025-08-14T20:49:53.1177445Z class Experiment(NamedTuple): 2025-08-14T20:49:53.1177995Z  rollout_perc: float = ( 2025-08-14T20:49:53.1178741Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:49:53.1179482Z  ) 2025-08-14T20:49:53.1179900Z  all_branches: bool = ( 2025-08-14T20:49:53.1180630Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:49:53.1181666Z  ) 2025-08-14T20:49:53.1182092Z  default: bool = ( 2025-08-14T20:49:53.1182751Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:49:53.1183456Z  ) 2025-08-14T20:49:53.1183847Z  2025-08-14T20:49:53.1184255Z  # Add more fields as needed 2025-08-14T20:49:53.1184771Z  2025-08-14T20:49:53.1185187Z  2025-08-14T20:49:53.1185641Z class Settings(NamedTuple): 2025-08-14T20:49:53.1186209Z  """ 2025-08-14T20:49:53.1186792Z  Settings for the experiments that can be opted into. 2025-08-14T20:49:53.1187475Z  """ 2025-08-14T20:49:53.1187925Z  2025-08-14T20:49:53.1188417Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:49:53.1189007Z  2025-08-14T20:49:53.1189522Z  2025-08-14T20:49:53.1189984Z class ColorFormatter(logging.Formatter): 2025-08-14T20:49:53.1190697Z  """Color codes the log messages based on the log level""" 2025-08-14T20:49:53.1191542Z  2025-08-14T20:49:53.1191928Z  COLORS = { 2025-08-14T20:49:53.1192406Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:49:53.1192977Z  "ERROR": "\033[31m", # Red 2025-08-14T20:49:53.1193538Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:49:53.1194102Z  "INFO": "\033[0m", # Reset 2025-08-14T20:49:53.1194655Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:49:53.1195189Z  } 2025-08-14T20:49:53.1195580Z  2025-08-14T20:49:53.1196031Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:49:53.1196859Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:49:53.1197722Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:49:53.1198367Z  return super().format(record) 2025-08-14T20:49:53.1198913Z  2025-08-14T20:49:53.1199283Z  2025-08-14T20:49:53.1199706Z handler = logging.StreamHandler() 2025-08-14T20:49:53.1200516Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:49:53.1201484Z  2025-08-14T20:49:53.1201985Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:49:53.1202641Z log.addHandler(handler) 2025-08-14T20:49:53.1203161Z log.setLevel(logging.INFO) 2025-08-14T20:49:53.1203661Z  2025-08-14T20:49:53.1204034Z  2025-08-14T20:49:53.1204531Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:49:53.1205155Z  """ 2025-08-14T20:49:53.1205733Z  Defines outputs of the github action that invokes this script 2025-08-14T20:49:53.1206582Z  """ 2025-08-14T20:49:53.1206998Z  if not GITHUB_OUTPUT: 2025-08-14T20:49:53.1208163Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:49:53.1209373Z  log.warning( 2025-08-14T20:49:53.1210336Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:49:53.1211524Z  ) 2025-08-14T20:49:53.1212031Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:49:53.1212634Z  return 2025-08-14T20:49:53.1213071Z  2025-08-14T20:49:53.1213502Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:49:53.1214149Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:49:53.1214775Z  f.write(f"{key}={value}\n") 2025-08-14T20:49:53.1215315Z  2025-08-14T20:49:53.1215690Z  2025-08-14T20:49:53.1216246Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:49:53.1216963Z  return frozenset( 2025-08-14T20:49:53.1217673Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:49:53.1218413Z  ) 2025-08-14T20:49:53.1218811Z  2025-08-14T20:49:53.1219183Z  2025-08-14T20:49:53.1219571Z def parse_args() -> Any: 2025-08-14T20:49:53.1220254Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:49:53.1221445Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:49:53.1222303Z  parser.add_argument( 2025-08-14T20:49:53.1222846Z  "--github-issue-repo", 2025-08-14T20:49:53.1223387Z  type=str, 2025-08-14T20:49:53.1223873Z  required=False, 2025-08-14T20:49:53.1224546Z  default="pytorch/test-infra", 2025-08-14T20:49:53.1225199Z  help="GitHub repo to get the issue", 2025-08-14T20:49:53.1225765Z  ) 2025-08-14T20:49:53.1226194Z  parser.add_argument( 2025-08-14T20:49:53.1226716Z  "--github-repo", 2025-08-14T20:49:53.1227234Z  type=str, 2025-08-14T20:49:53.1227725Z  required=True, 2025-08-14T20:49:53.1228288Z  help="GitHub repo where CI is running", 2025-08-14T20:49:53.1228866Z  ) 2025-08-14T20:49:53.1229291Z  parser.add_argument( 2025-08-14T20:49:53.1230013Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:49:53.1230728Z  ) 2025-08-14T20:49:53.1231495Z  parser.add_argument( 2025-08-14T20:49:53.1232243Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:49:53.1232997Z  ) 2025-08-14T20:49:53.1233441Z  parser.add_argument( 2025-08-14T20:49:53.1234194Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:49:53.1234955Z  ) 2025-08-14T20:49:53.1235377Z  parser.add_argument( 2025-08-14T20:49:53.1236164Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:49:53.1236940Z  ) 2025-08-14T20:49:53.1237384Z  parser.add_argument( 2025-08-14T20:49:53.1237911Z  "--github-ref-type", 2025-08-14T20:49:53.1238439Z  type=str, 2025-08-14T20:49:53.1238916Z  required=True, 2025-08-14T20:49:53.1239513Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:49:53.1240114Z  ) 2025-08-14T20:49:53.1240543Z  parser.add_argument( 2025-08-14T20:49:53.1241454Z  "--eligible-experiments", 2025-08-14T20:49:53.1242062Z  type=_str_comma_separated_to_set, 2025-08-14T20:49:53.1242639Z  required=False, 2025-08-14T20:49:53.1243137Z  default="", 2025-08-14T20:49:53.1244095Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:49:53.1245101Z  ) 2025-08-14T20:49:53.1245524Z  parser.add_argument( 2025-08-14T20:49:53.1246067Z  "--opt-out-experiments", 2025-08-14T20:49:53.1246648Z  type=_str_comma_separated_to_set, 2025-08-14T20:49:53.1247218Z  required=False, 2025-08-14T20:49:53.1247708Z  default="", 2025-08-14T20:49:53.1248184Z  help=( 2025-08-14T20:49:53.1248950Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:49:53.1250175Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:49:53.1251248Z  ), 2025-08-14T20:49:53.1251669Z  ) 2025-08-14T20:49:53.1252104Z  parser.add_argument( 2025-08-14T20:49:53.1252621Z  "--pr-number", 2025-08-14T20:49:53.1253116Z  type=str, 2025-08-14T20:49:53.1253590Z  required=False, 2025-08-14T20:49:53.1254092Z  default="", 2025-08-14T20:49:53.1254661Z  help="the optional PR number where this is run", 2025-08-14T20:49:53.1255273Z  ) 2025-08-14T20:49:53.1255673Z  2025-08-14T20:49:53.1256085Z  return parser.parse_args() 2025-08-14T20:49:53.1256615Z  2025-08-14T20:49:53.1256982Z  2025-08-14T20:49:53.1257644Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:49:53.1258637Z  auth = Auth.Token(github_token) 2025-08-14T20:49:53.1259250Z  return Github(auth=auth) 2025-08-14T20:49:53.1259766Z  2025-08-14T20:49:53.1260140Z  2025-08-14T20:49:53.1261082Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:49:53.1262002Z  repo = gh.get_repo(repo) 2025-08-14T20:49:53.1262610Z  return repo.get_issue(number=issue_num) 2025-08-14T20:49:53.1263184Z  2025-08-14T20:49:53.1263555Z  2025-08-14T20:49:53.1263961Z def get_potential_pr_author( 2025-08-14T20:49:53.1264708Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:49:53.1265451Z ) -> str: 2025-08-14T20:49:53.1266044Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:49:53.1266936Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:49:53.1267784Z  # embedded in the tag name: ciflow// 2025-08-14T20:49:53.1268452Z  2025-08-14T20:49:53.1268889Z  gh = get_gh_client(github_token) 2025-08-14T20:49:53.1269436Z  2025-08-14T20:49:53.1269959Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:49:53.1270658Z  split_tag = ref_name.split("/") 2025-08-14T20:49:53.1271416Z  if ( 2025-08-14T20:49:53.1271879Z  len(split_tag) == 3 2025-08-14T20:49:53.1272448Z  and split_tag[0] == "ciflow" 2025-08-14T20:49:53.1273037Z  and split_tag[2].isnumeric() 2025-08-14T20:49:53.1273586Z  ): 2025-08-14T20:49:53.1274049Z  pr_number = split_tag[2] 2025-08-14T20:49:53.1274590Z  try: 2025-08-14T20:49:53.1275104Z  repository = gh.get_repo(repo) 2025-08-14T20:49:53.1275955Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:49:53.1276641Z  except Exception as e: 2025-08-14T20:49:53.1277239Z  raise Exception( # noqa: TRY002 2025-08-14T20:49:53.1277991Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:49:53.1278713Z  ) from e 2025-08-14T20:49:53.1279342Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:49:53.1280127Z  # In all other cases, return the original input username 2025-08-14T20:49:53.1280778Z  return username 2025-08-14T20:49:53.1281439Z  2025-08-14T20:49:53.1281806Z  2025-08-14T20:49:53.1282452Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:49:53.1283286Z  """ 2025-08-14T20:49:53.1284009Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:49:53.1284855Z  """ 2025-08-14T20:49:53.1285464Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:49:53.1286185Z  2025-08-14T20:49:53.1286551Z  2025-08-14T20:49:53.1286976Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:49:53.1287534Z  try: 2025-08-14T20:49:53.1287981Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:49:53.1288546Z  return data 2025-08-14T20:49:53.1289035Z  except yaml.YAMLError: 2025-08-14T20:49:53.1289611Z  log.exception("Error loading YAML") 2025-08-14T20:49:53.1290179Z  raise 2025-08-14T20:49:53.1290605Z  2025-08-14T20:49:53.1291141Z  2025-08-14T20:49:53.1291813Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:49:53.1292612Z  """ 2025-08-14T20:49:53.1293448Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:49:53.1294272Z  2025-08-14T20:49:53.1294852Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:49:53.1295712Z  and the text below is the list of opted in users. 2025-08-14T20:49:53.1296311Z  2025-08-14T20:49:53.1296935Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:49:53.1297684Z  """ 2025-08-14T20:49:53.1298190Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:49:53.1298853Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:49:53.1299525Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:49:53.1300169Z  else: 2025-08-14T20:49:53.1300605Z  return "", rollout_state 2025-08-14T20:49:53.1301351Z  2025-08-14T20:49:53.1301724Z  2025-08-14T20:49:53.1302188Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:49:53.1302755Z  """ 2025-08-14T20:49:53.1303340Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:49:53.1304033Z  """ 2025-08-14T20:49:53.1304424Z  2025-08-14T20:49:53.1304786Z  2025-08-14T20:49:53.1305365Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:49:53.1306079Z  """ 2025-08-14T20:49:53.1306868Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:49:53.1307757Z  2025-08-14T20:49:53.1308629Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:49:53.1309706Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:49:53.1310620Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:49:53.1311857Z  2025-08-14T20:49:53.1312228Z  2025-08-14T20:49:53.1312594Z  """ 2025-08-14T20:49:53.1313013Z  optins = UserOptins() 2025-08-14T20:49:53.1313586Z  for user in user_optin_text.split("\n"): 2025-08-14T20:49:53.1314200Z  user = user.strip("\r\n\t -") 2025-08-14T20:49:53.1314817Z  if not user or not user.startswith("@"): 2025-08-14T20:49:53.1315415Z  # Not a valid user. Skip 2025-08-14T20:49:53.1315957Z  continue 2025-08-14T20:49:53.1316452Z  2025-08-14T20:49:53.1316831Z  if user: 2025-08-14T20:49:53.1317353Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:49:53.1318108Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:49:53.1318800Z  2025-08-14T20:49:53.1319182Z  return optins 2025-08-14T20:49:53.1319636Z  2025-08-14T20:49:53.1319993Z  2025-08-14T20:49:53.1320532Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:49:53.1321657Z  """ 2025-08-14T20:49:53.1322132Z  Check if the experiment name is valid. 2025-08-14T20:49:53.1322709Z  A valid name: 2025-08-14T20:49:53.1323440Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:49:53.1324443Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:49:53.1325201Z  - Cannot contain spaces 2025-08-14T20:49:53.1325711Z  """ 2025-08-14T20:49:53.1326094Z  2025-08-14T20:49:53.1326588Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:49:53.1327375Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:49:53.1328333Z  2025-08-14T20:49:53.1328856Z  if valid: 2025-08-14T20:49:53.1329306Z  return True 2025-08-14T20:49:53.1329759Z  2025-08-14T20:49:53.1330128Z  log.error( 2025-08-14T20:49:53.1331849Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:49:53.1333532Z  ) 2025-08-14T20:49:53.1333930Z  return False 2025-08-14T20:49:53.1334372Z  2025-08-14T20:49:53.1334726Z  2025-08-14T20:49:53.1335287Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:49:53.1335982Z  """ 2025-08-14T20:49:53.1336644Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:49:53.1337422Z  """ 2025-08-14T20:49:53.1337817Z  try: 2025-08-14T20:49:53.1338234Z  if settings_text: 2025-08-14T20:49:53.1339038Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:49:53.1339892Z  # for easy reading 2025-08-14T20:49:53.1340909Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:49:53.1341895Z  # the backtick character in shell commands. 2025-08-14T20:49:53.1342560Z  backtick = chr(96) # backtick character 2025-08-14T20:49:53.1343305Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:49:53.1344038Z  settings = load_yaml(settings_text) 2025-08-14T20:49:53.1344593Z  2025-08-14T20:49:53.1345248Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:49:53.1346180Z  experiments = {} 2025-08-14T20:49:53.1346681Z  2025-08-14T20:49:53.1347285Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:49:53.1348112Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:49:53.1349311Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:49:53.1350424Z  continue 2025-08-14T20:49:53.1351028Z  2025-08-14T20:49:53.1351436Z  valid_settings = {} 2025-08-14T20:49:53.1352013Z  for setting in exp_settings: 2025-08-14T20:49:53.1352634Z  if setting not in Experiment._fields: 2025-08-14T20:49:53.1353246Z  log.warning( 2025-08-14T20:49:53.1354056Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:49:53.1354827Z  ) 2025-08-14T20:49:53.1355313Z  else: 2025-08-14T20:49:53.1355905Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:49:53.1356511Z  2025-08-14T20:49:53.1357022Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:49:53.1357720Z  return Settings(experiments) 2025-08-14T20:49:53.1358280Z  2025-08-14T20:49:53.1358669Z  except Exception: 2025-08-14T20:49:53.1359226Z  log.exception("Failed to parse settings") 2025-08-14T20:49:53.1359802Z  2025-08-14T20:49:53.1360181Z  return Settings() 2025-08-14T20:49:53.1360647Z  2025-08-14T20:49:53.1361113Z  2025-08-14T20:49:53.1361745Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:49:53.1362388Z  """ 2025-08-14T20:49:53.1362899Z  Parse settings, if any, from the rollout state. 2025-08-14T20:49:53.1363495Z  2025-08-14T20:49:53.1364080Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:49:53.1364911Z  and the text below is the list of opted in users. 2025-08-14T20:49:53.1365505Z  2025-08-14T20:49:53.1366150Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:49:53.1366921Z  """ 2025-08-14T20:49:53.1367537Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:49:53.1368406Z  return parse_settings_from_text(settings_text) 2025-08-14T20:49:53.1368996Z  2025-08-14T20:49:53.1369351Z  2025-08-14T20:49:53.1369837Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:49:53.1370452Z  """ 2025-08-14T20:49:53.1370997Z  Parse users from the rollout state. 2025-08-14T20:49:53.1371549Z  2025-08-14T20:49:53.1371918Z  """ 2025-08-14T20:49:53.1372518Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:49:53.1373344Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:49:53.1373929Z  2025-08-14T20:49:53.1374294Z  2025-08-14T20:49:53.1374955Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:49:53.1375760Z  """ 2025-08-14T20:49:53.1376241Z  Check if a user is opted into an experiment 2025-08-14T20:49:53.1376820Z  """ 2025-08-14T20:49:53.1377342Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:49:53.1377956Z  2025-08-14T20:49:53.1378451Z  2025-08-14T20:49:53.1379134Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:49:53.1379942Z  """ 2025-08-14T20:49:53.1380458Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:49:53.1381198Z  """ 2025-08-14T20:49:53.1381779Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:49:53.1382530Z  experiment_optout = "-" + experiment_name 2025-08-14T20:49:53.1383249Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:49:53.1383895Z  return False 2025-08-14T20:49:53.1384355Z  2025-08-14T20:49:53.1384852Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:49:53.1385502Z  log.warning( 2025-08-14T20:49:53.1386424Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:49:53.1387357Z  ) 2025-08-14T20:49:53.1387759Z  2025-08-14T20:49:53.1388136Z  return True 2025-08-14T20:49:53.1388569Z  2025-08-14T20:49:53.1388923Z  2025-08-14T20:49:53.1389317Z def get_runner_prefix( 2025-08-14T20:49:53.1389821Z  rollout_state: str, 2025-08-14T20:49:53.1390379Z  workflow_requestors: Iterable[str], 2025-08-14T20:49:53.1391050Z  branch: str, 2025-08-14T20:49:53.1391629Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:49:53.1392386Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:49:53.1393028Z  is_canary: bool = False, 2025-08-14T20:49:53.1393538Z ) -> str: 2025-08-14T20:49:53.1394026Z  settings = parse_settings(rollout_state) 2025-08-14T20:49:53.1394665Z  user_optins = parse_users(rollout_state) 2025-08-14T20:49:53.1395248Z  2025-08-14T20:49:53.1395770Z  fleet_prefix = "" 2025-08-14T20:49:53.1396275Z  prefixes = [] 2025-08-14T20:49:53.1396992Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:49:53.1398017Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:49:53.1398777Z  log.info( 2025-08-14T20:49:53.1399540Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:49:53.1400333Z  ) 2025-08-14T20:49:53.1400883Z  continue 2025-08-14T20:49:53.1401346Z  2025-08-14T20:49:53.1401750Z  if opt_out_experiments: 2025-08-14T20:49:53.1402355Z  if experiment_name in opt_out_experiments: 2025-08-14T20:49:53.1403063Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:49:53.1403708Z  log.info( 2025-08-14T20:49:53.1404729Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:49:53.1405751Z  ) 2025-08-14T20:49:53.1406213Z  continue 2025-08-14T20:49:53.1406682Z  2025-08-14T20:49:53.1407091Z  if eligible_experiments: 2025-08-14T20:49:53.1407717Z  if experiment_name not in eligible_experiments: 2025-08-14T20:49:53.1408410Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:49:53.1409012Z  log.info( 2025-08-14T20:49:53.1409864Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:49:53.1410743Z  ) 2025-08-14T20:49:53.1411467Z  continue 2025-08-14T20:49:53.1412033Z  elif not experiment_settings.default: 2025-08-14T20:49:53.1412620Z  log.info( 2025-08-14T20:49:53.1413368Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:49:53.1414151Z  ) 2025-08-14T20:49:53.1414587Z  continue 2025-08-14T20:49:53.1415039Z  2025-08-14T20:49:53.1415545Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:49:53.1416236Z  opted_out_users = [ 2025-08-14T20:49:53.1416750Z  requestor 2025-08-14T20:49:53.1417290Z  for requestor in workflow_requestors 2025-08-14T20:49:53.1418070Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:49:53.1418744Z  ] 2025-08-14T20:49:53.1419148Z  2025-08-14T20:49:53.1419545Z  if opted_out_users: 2025-08-14T20:49:53.1420082Z  log.info( 2025-08-14T20:49:53.1420894Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:49:53.1421653Z  ) 2025-08-14T20:49:53.1422091Z  continue 2025-08-14T20:49:53.1422542Z  2025-08-14T20:49:53.1423052Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:49:53.1423714Z  opted_in_users = [ 2025-08-14T20:49:53.1424304Z  requestor 2025-08-14T20:49:53.1424848Z  for requestor in workflow_requestors 2025-08-14T20:49:53.1425595Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:49:53.1426267Z  ] 2025-08-14T20:49:53.1426669Z  2025-08-14T20:49:53.1427055Z  enabled = False 2025-08-14T20:49:53.1427565Z  if opted_in_users: 2025-08-14T20:49:53.1428198Z  log.info( 2025-08-14T20:49:53.1428914Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:49:53.1429646Z  ) 2025-08-14T20:49:53.1430086Z  enabled = True 2025-08-14T20:49:53.1430576Z  2025-08-14T20:49:53.1431128Z  elif experiment_settings.rollout_perc: 2025-08-14T20:49:53.1432050Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:49:53.1433073Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:49:53.1433769Z  log.info( 2025-08-14T20:49:53.1434721Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:49:53.1435711Z  ) 2025-08-14T20:49:53.1436195Z  enabled = True 2025-08-14T20:49:53.1436706Z  2025-08-14T20:49:53.1437088Z  if enabled: 2025-08-14T20:49:53.1437587Z  label = experiment_name 2025-08-14T20:49:53.1438199Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:49:53.1439100Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:49:53.1440047Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:49:53.1440967Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:49:53.1441706Z  if is_canary: 2025-08-14T20:49:53.1442272Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:49:53.1442867Z  fleet_prefix = label 2025-08-14T20:49:53.1443410Z  else: 2025-08-14T20:49:53.1444057Z  prefixes.append(label) 2025-08-14T20:49:53.1444608Z  2025-08-14T20:49:53.1444989Z  if len(prefixes) > 1: 2025-08-14T20:49:53.1445519Z  log.error( 2025-08-14T20:49:53.1446653Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:49:53.1447842Z  ) 2025-08-14T20:49:53.1448285Z  prefixes = prefixes[:1] 2025-08-14T20:49:53.1448802Z  2025-08-14T20:49:53.1449206Z  # Fleet always comes first 2025-08-14T20:49:53.1449736Z  if fleet_prefix: 2025-08-14T20:49:53.1450268Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:49:53.1450916Z  2025-08-14T20:49:53.1451412Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:49:53.1452024Z  2025-08-14T20:49:53.1452400Z  2025-08-14T20:49:53.1453090Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:49:53.1453907Z  """ 2025-08-14T20:49:53.1454560Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:49:53.1455312Z  2025-08-14T20:49:53.1455931Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:49:53.1456675Z  """ 2025-08-14T20:49:53.1457118Z  gh = get_gh_client(github_token) 2025-08-14T20:49:53.1457730Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:49:53.1458427Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:49:53.1459071Z  2025-08-14T20:49:53.1459428Z  2025-08-14T20:49:53.1460078Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:49:53.1461115Z  for _ in range(num_retries): 2025-08-14T20:49:53.1461674Z  try: 2025-08-14T20:49:53.1462165Z  req = Request(url=url, headers=headers) 2025-08-14T20:49:53.1462884Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:49:53.1463590Z  return json.loads(content) 2025-08-14T20:49:53.1464159Z  except Exception as e: 2025-08-14T20:49:53.1464776Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:49:53.1465360Z  2025-08-14T20:49:53.1465975Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:49:53.1466739Z  return {} 2025-08-14T20:49:53.1467162Z  2025-08-14T20:49:53.1467535Z  2025-08-14T20:49:53.1467894Z @cache 2025-08-14T20:49:53.1468627Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:49:53.1469437Z  """ 2025-08-14T20:49:53.1469881Z  Dynamically get PR information 2025-08-14T20:49:53.1470413Z  """ 2025-08-14T20:49:53.1471070Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:49:53.1471738Z  headers = { 2025-08-14T20:49:53.1472264Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:49:53.1472930Z  "Authorization": f"token {github_token}", 2025-08-14T20:49:53.1473500Z  } 2025-08-14T20:49:53.1473994Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:49:53.1474660Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:49:53.1475252Z  headers=headers, 2025-08-14T20:49:53.1475739Z  ) 2025-08-14T20:49:53.1476123Z  2025-08-14T20:49:53.1476526Z  if not json_response: 2025-08-14T20:49:53.1477187Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:49:53.1478810Z  return {} 2025-08-14T20:49:53.1479260Z  2025-08-14T20:49:53.1479656Z  return json_response 2025-08-14T20:49:53.1480135Z  2025-08-14T20:49:53.1480494Z  2025-08-14T20:49:53.1481240Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:49:53.1482020Z  """ 2025-08-14T20:49:53.1482610Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:49:53.1483306Z  """ 2025-08-14T20:49:53.1483854Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:49:53.1484509Z  return { 2025-08-14T20:49:53.1485168Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:49:53.1485895Z  } 2025-08-14T20:49:53.1486273Z  2025-08-14T20:49:53.1486645Z  2025-08-14T20:49:53.1487029Z def main() -> None: 2025-08-14T20:49:53.1487517Z  args = parse_args() 2025-08-14T20:49:53.1487994Z  2025-08-14T20:49:53.1488448Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:49:53.1489021Z  2025-08-14T20:49:53.1489429Z  # Check if the PR is opt-out 2025-08-14T20:49:53.1489973Z  if args.pr_number: 2025-08-14T20:49:53.1490710Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:49:53.1491622Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:49:53.1492165Z  log.info( 2025-08-14T20:49:53.1492937Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:49:53.1493739Z  ) 2025-08-14T20:49:53.1494379Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:49:53.1495117Z  sys.exit() 2025-08-14T20:49:53.1495701Z  2025-08-14T20:49:53.1496084Z  try: 2025-08-14T20:49:53.1496575Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:49:53.1497368Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:49:53.1498049Z  ) 2025-08-14T20:49:53.1498516Z  2025-08-14T20:49:53.1498949Z  username = get_potential_pr_author( 2025-08-14T20:49:53.1499536Z  args.github_token, 2025-08-14T20:49:53.1500079Z  args.github_repo, 2025-08-14T20:49:53.1500613Z  args.github_actor, 2025-08-14T20:49:53.1501275Z  args.github_ref_type, 2025-08-14T20:49:53.1501831Z  args.github_branch, 2025-08-14T20:49:53.1502341Z  ) 2025-08-14T20:49:53.1502737Z  2025-08-14T20:49:53.1503270Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:49:53.1503919Z  2025-08-14T20:49:53.1504375Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:49:53.1504975Z  rollout_state, 2025-08-14T20:49:53.1505530Z  (args.github_issue_owner, username), 2025-08-14T20:49:53.1506133Z  args.github_branch, 2025-08-14T20:49:53.1506695Z  args.eligible_experiments, 2025-08-14T20:49:53.1507305Z  args.opt_out_experiments, 2025-08-14T20:49:53.1507851Z  is_canary, 2025-08-14T20:49:53.1508327Z  ) 2025-08-14T20:49:53.1508733Z  2025-08-14T20:49:53.1509133Z  except Exception as e: 2025-08-14T20:49:53.1509650Z  log.error( 2025-08-14T20:49:53.1510407Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:49:53.1511466Z  ) 2025-08-14T20:49:53.1511874Z  2025-08-14T20:49:53.1512458Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:49:53.1513157Z  2025-08-14T20:49:53.1513523Z  2025-08-14T20:49:53.1513915Z if __name__ == "__main__": 2025-08-14T20:49:53.1514407Z  main() 2025-08-14T20:49:53.1514816Z  2025-08-14T20:49:53.1515176Z EOF 2025-08-14T20:49:53.1515550Z  2025-08-14T20:49:53.1515946Z cat runner_determinator.py 2025-08-14T20:49:53.1823801Z shell: /usr/bin/bash -e {0} 2025-08-14T20:49:53.1824759Z env: 2025-08-14T20:49:53.1825522Z GITHUB_TOKEN: *** 2025-08-14T20:49:53.1825967Z ISSUE_NUMBER: 5132 2025-08-14T20:49:53.1826442Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:49:53.1826954Z ISSUE_OWNER: 2025-08-14T20:49:53.1827365Z CHECK_EXPERIMENTS: 2025-08-14T20:49:53.1827810Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:49:53.1828251Z PR_NUMBER: 2025-08-14T20:49:53.1828702Z ##[endgroup] 2025-08-14T20:49:53.2043207Z # flake8: noqa: G004 2025-08-14T20:49:53.2043584Z 2025-08-14T20:49:53.2044021Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:49:53.2044990Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:49:53.2045786Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:49:53.2046233Z 2025-08-14T20:49:53.2046389Z """ 2025-08-14T20:49:53.2046964Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:49:53.2047841Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:49:53.2048762Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:49:53.2049572Z of which runners should be used to run which job. 2025-08-14T20:49:53.2049977Z 2025-08-14T20:49:53.2050355Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:49:53.2051743Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:49:53.2052671Z settings are considered to be empty with only the second part, the user 2025-08-14T20:49:53.2053384Z list, defined. 2025-08-14T20:49:53.2053616Z 2025-08-14T20:49:53.2053975Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:49:53.2054919Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:49:53.2055749Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:49:53.2056196Z 2025-08-14T20:49:53.2056557Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:49:53.2057432Z The user list is also a comma separated list of additional features or 2025-08-14T20:49:53.2058172Z experiments which the user could be opted in to. 2025-08-14T20:49:53.2058576Z 2025-08-14T20:49:53.2058784Z The user list has the following rules: 2025-08-14T20:49:53.2059122Z 2025-08-14T20:49:53.2059454Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:49:53.2060354Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:49:53.2061334Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:49:53.2061745Z 2025-08-14T20:49:53.2061912Z Example config: 2025-08-14T20:49:53.2062360Z # A list of experiments that can be opted into. 2025-08-14T20:49:53.2063036Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:49:53.2063666Z # Expected syntax is: 2025-08-14T20:49:53.2064300Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:49:53.2065273Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:49:53.2065884Z 2025-08-14T20:49:53.2066059Z experiments: 2025-08-14T20:49:53.2066446Z lf: 2025-08-14T20:49:53.2066824Z rollout_percent: 25 2025-08-14T20:49:53.2067460Z all_branches: false 2025-08-14T20:49:53.2067918Z default: true 2025-08-14T20:49:53.2068336Z --- 2025-08-14T20:49:53.2068548Z 2025-08-14T20:49:53.2068710Z # Opt-ins: 2025-08-14T20:49:53.2069285Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:49:53.2070158Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:49:53.2071146Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:49:53.2071826Z # Experiments should be from the above list. 2025-08-14T20:49:53.2072213Z 2025-08-14T20:49:53.2072404Z @User1,-lf,split_build 2025-08-14T20:49:53.2072841Z @User2,lf 2025-08-14T20:49:53.2073274Z @User3,split_build 2025-08-14T20:49:53.2073676Z """ 2025-08-14T20:49:53.2073875Z 2025-08-14T20:49:53.2074037Z import json 2025-08-14T20:49:53.2074401Z import logging 2025-08-14T20:49:53.2074782Z import os 2025-08-14T20:49:53.2075146Z import random 2025-08-14T20:49:53.2075524Z import re 2025-08-14T20:49:53.2075893Z import sys 2025-08-14T20:49:53.2076305Z from argparse import ArgumentParser 2025-08-14T20:49:53.2076836Z from collections.abc import Iterable 2025-08-14T20:49:53.2077354Z from functools import cache 2025-08-14T20:49:53.2077826Z from logging import LogRecord 2025-08-14T20:49:53.2078312Z from typing import Any, NamedTuple 2025-08-14T20:49:53.2078847Z from urllib.request import Request, urlopen 2025-08-14T20:49:53.2079217Z 2025-08-14T20:49:53.2079381Z import yaml 2025-08-14T20:49:53.2079770Z from github import Auth, Github 2025-08-14T20:49:53.2080256Z from github.Issue import Issue 2025-08-14T20:49:53.2080571Z 2025-08-14T20:49:53.2080579Z 2025-08-14T20:49:53.2080970Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:49:53.2081689Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:49:53.2082554Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:49:53.2083127Z 2025-08-14T20:49:53.2083355Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:49:53.2084077Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:49:53.2084615Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:49:53.2085169Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:49:53.2085532Z 2025-08-14T20:49:53.2085725Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:49:53.2086057Z 2025-08-14T20:49:53.2086245Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:49:53.2086700Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:49:53.2086981Z 2025-08-14T20:49:53.2086994Z 2025-08-14T20:49:53.2087182Z class Experiment(NamedTuple): 2025-08-14T20:49:53.2087654Z rollout_perc: float = ( 2025-08-14T20:49:53.2088298Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:49:53.2088991Z ) 2025-08-14T20:49:53.2089362Z all_branches: bool = ( 2025-08-14T20:49:53.2089989Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:49:53.2090658Z ) 2025-08-14T20:49:53.2091261Z default: bool = ( 2025-08-14T20:49:53.2091849Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:49:53.2092505Z ) 2025-08-14T20:49:53.2092704Z 2025-08-14T20:49:53.2092883Z # Add more fields as needed 2025-08-14T20:49:53.2093197Z 2025-08-14T20:49:53.2093203Z 2025-08-14T20:49:53.2093383Z class Settings(NamedTuple): 2025-08-14T20:49:53.2093830Z """ 2025-08-14T20:49:53.2094278Z Settings for the experiments that can be opted into. 2025-08-14T20:49:53.2094863Z """ 2025-08-14T20:49:53.2095054Z 2025-08-14T20:49:53.2095257Z experiments: dict[str, Experiment] = {} 2025-08-14T20:49:53.2095619Z 2025-08-14T20:49:53.2095631Z 2025-08-14T20:49:53.2095836Z class ColorFormatter(logging.Formatter): 2025-08-14T20:49:53.2096462Z """Color codes the log messages based on the log level""" 2025-08-14T20:49:53.2096902Z 2025-08-14T20:49:53.2097063Z COLORS = { 2025-08-14T20:49:53.2097466Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:49:53.2098124Z "ERROR": "\033[31m", # Red 2025-08-14T20:49:53.2098629Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:49:53.2099118Z "INFO": "\033[0m", # Reset 2025-08-14T20:49:53.2099602Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:49:53.2100082Z } 2025-08-14T20:49:53.2100279Z 2025-08-14T20:49:53.2100502Z def format(self, record: LogRecord) -> str: 2025-08-14T20:49:53.2101499Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:49:53.2102298Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:49:53.2102877Z return super().format(record) 2025-08-14T20:49:53.2103210Z 2025-08-14T20:49:53.2103217Z 2025-08-14T20:49:53.2103413Z handler = logging.StreamHandler() 2025-08-14T20:49:53.2104119Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:49:53.2104675Z 2025-08-14T20:49:53.2104921Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:49:53.2105514Z log.addHandler(handler) 2025-08-14T20:49:53.2105954Z log.setLevel(logging.INFO) 2025-08-14T20:49:53.2106247Z 2025-08-14T20:49:53.2106254Z 2025-08-14T20:49:53.2106500Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:49:53.2107067Z """ 2025-08-14T20:49:53.2107580Z Defines outputs of the github action that invokes this script 2025-08-14T20:49:53.2108207Z """ 2025-08-14T20:49:53.2108569Z if not GITHUB_OUTPUT: 2025-08-14T20:49:53.2109654Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:49:53.2110776Z log.warning( 2025-08-14T20:49:53.2111741Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:49:53.2112673Z ) 2025-08-14T20:49:53.2122864Z print(f"::set-output name={key}::{value}") 2025-08-14T20:49:53.2123499Z return 2025-08-14T20:49:53.2123737Z 2025-08-14T20:49:53.2124143Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:49:53.2124769Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:49:53.2125351Z f.write(f"{key}={value}\n") 2025-08-14T20:49:53.2125682Z 2025-08-14T20:49:53.2125691Z 2025-08-14T20:49:53.2125995Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:49:53.2126634Z return frozenset( 2025-08-14T20:49:53.2127242Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:49:53.2127928Z ) 2025-08-14T20:49:53.2128124Z 2025-08-14T20:49:53.2128131Z 2025-08-14T20:49:53.2128312Z def parse_args() -> Any: 2025-08-14T20:49:53.2128865Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:49:53.2129735Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:49:53.2130517Z parser.add_argument( 2025-08-14T20:49:53.2131132Z "--github-issue-repo", 2025-08-14T20:49:53.2131606Z type=str, 2025-08-14T20:49:53.2132016Z required=False, 2025-08-14T20:49:53.2132470Z default="pytorch/test-infra", 2025-08-14T20:49:53.2133010Z help="GitHub repo to get the issue", 2025-08-14T20:49:53.2133510Z ) 2025-08-14T20:49:53.2133877Z parser.add_argument( 2025-08-14T20:49:53.2134316Z "--github-repo", 2025-08-14T20:49:53.2134746Z type=str, 2025-08-14T20:49:53.2135140Z required=True, 2025-08-14T20:49:53.2135621Z help="GitHub repo where CI is running", 2025-08-14T20:49:53.2136150Z ) 2025-08-14T20:49:53.2136525Z parser.add_argument( 2025-08-14T20:49:53.2137131Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:49:53.2137784Z ) 2025-08-14T20:49:53.2138148Z parser.add_argument( 2025-08-14T20:49:53.2138764Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:49:53.2139455Z ) 2025-08-14T20:49:53.2139819Z parser.add_argument( 2025-08-14T20:49:53.2140686Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:49:53.2141718Z ) 2025-08-14T20:49:53.2142100Z parser.add_argument( 2025-08-14T20:49:53.2142754Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:49:53.2143471Z ) 2025-08-14T20:49:53.2143841Z parser.add_argument( 2025-08-14T20:49:53.2144292Z "--github-ref-type", 2025-08-14T20:49:53.2198875Z type=str, 2025-08-14T20:49:53.2199808Z required=True, 2025-08-14T20:49:53.2200999Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:49:53.2201896Z ) 2025-08-14T20:49:53.2202288Z parser.add_argument( 2025-08-14T20:49:53.2202765Z "--eligible-experiments", 2025-08-14T20:49:53.2203285Z type=_str_comma_separated_to_set, 2025-08-14T20:49:53.2203811Z required=False, 2025-08-14T20:49:53.2204230Z default="", 2025-08-14T20:49:53.2205118Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:49:53.2206055Z ) 2025-08-14T20:49:53.2206425Z parser.add_argument( 2025-08-14T20:49:53.2206883Z "--opt-out-experiments", 2025-08-14T20:49:53.2207387Z type=_str_comma_separated_to_set, 2025-08-14T20:49:53.2207897Z required=False, 2025-08-14T20:49:53.2208310Z default="", 2025-08-14T20:49:53.2208695Z help=( 2025-08-14T20:49:53.2209374Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:49:53.2210521Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:49:53.2211611Z ), 2025-08-14T20:49:53.2211979Z ) 2025-08-14T20:49:53.2212345Z parser.add_argument( 2025-08-14T20:49:53.2212785Z "--pr-number", 2025-08-14T20:49:53.2213196Z type=str, 2025-08-14T20:49:53.2213595Z required=False, 2025-08-14T20:49:53.2214013Z default="", 2025-08-14T20:49:53.2214724Z help="the optional PR number where this is run", 2025-08-14T20:49:53.2215306Z ) 2025-08-14T20:49:53.2215518Z 2025-08-14T20:49:53.2215708Z return parser.parse_args() 2025-08-14T20:49:53.2216020Z 2025-08-14T20:49:53.2216026Z 2025-08-14T20:49:53.2216437Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:49:53.2217192Z auth = Auth.Token(github_token) 2025-08-14T20:49:53.2217694Z return Github(auth=auth) 2025-08-14T20:49:53.2217988Z 2025-08-14T20:49:53.2217994Z 2025-08-14T20:49:53.2218450Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:49:53.2219251Z repo = gh.get_repo(repo) 2025-08-14T20:49:53.2219739Z return repo.get_issue(number=issue_num) 2025-08-14T20:49:53.2220112Z 2025-08-14T20:49:53.2220118Z 2025-08-14T20:49:53.2220305Z def get_potential_pr_author( 2025-08-14T20:49:53.2221222Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:49:53.2221921Z ) -> str: 2025-08-14T20:49:53.2222439Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:49:53.2223240Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:49:53.2223984Z # embedded in the tag name: ciflow// 2025-08-14T20:49:53.2224394Z 2025-08-14T20:49:53.2224586Z gh = get_gh_client(github_token) 2025-08-14T20:49:53.2224917Z 2025-08-14T20:49:53.2225179Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:49:53.2225802Z split_tag = ref_name.split("/") 2025-08-14T20:49:53.2226296Z if ( 2025-08-14T20:49:53.2226728Z len(split_tag) == 3 2025-08-14T20:49:53.2227247Z and split_tag[0] == "ciflow" 2025-08-14T20:49:53.2227778Z and split_tag[2].isnumeric() 2025-08-14T20:49:53.2228261Z ): 2025-08-14T20:49:53.2228649Z pr_number = split_tag[2] 2025-08-14T20:49:53.2229283Z try: 2025-08-14T20:49:53.2229715Z repository = gh.get_repo(repo) 2025-08-14T20:49:53.2230326Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:49:53.2231130Z except Exception as e: 2025-08-14T20:49:53.2231664Z raise Exception( # noqa: TRY002 2025-08-14T20:49:53.2232328Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:49:53.2232979Z ) from e 2025-08-14T20:49:53.2233502Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:49:53.2234194Z # In all other cases, return the original input username 2025-08-14T20:49:53.2234782Z return username 2025-08-14T20:49:53.2235017Z 2025-08-14T20:49:53.2235024Z 2025-08-14T20:49:53.2235248Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:49:53.2235791Z """ 2025-08-14T20:49:53.2236429Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:49:53.2237205Z """ 2025-08-14T20:49:53.2237749Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:49:53.2238284Z 2025-08-14T20:49:53.2238290Z 2025-08-14T20:49:53.2238482Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:49:53.2238968Z try: 2025-08-14T20:49:53.2239345Z data = yaml.safe_load(yaml_text) 2025-08-14T20:49:53.2239850Z return data 2025-08-14T20:49:53.2240255Z except yaml.YAMLError: 2025-08-14T20:49:53.2240735Z log.exception("Error loading YAML") 2025-08-14T20:49:53.2241461Z raise 2025-08-14T20:49:53.2241685Z 2025-08-14T20:49:53.2241691Z 2025-08-14T20:49:53.2242106Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:49:53.2242848Z """ 2025-08-14T20:49:53.2243467Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:49:53.2244069Z 2025-08-14T20:49:53.2244555Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:49:53.2245318Z and the text below is the list of opted in users. 2025-08-14T20:49:53.2245727Z 2025-08-14T20:49:53.2246099Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:49:53.2246794Z """ 2025-08-14T20:49:53.2247232Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:49:53.2247836Z if len(rollout_state_parts) >= 2: 2025-08-14T20:49:53.2248440Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:49:53.2249027Z else: 2025-08-14T20:49:53.2249398Z return "", rollout_state 2025-08-14T20:49:53.2249701Z 2025-08-14T20:49:53.2249708Z 2025-08-14T20:49:53.2249912Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:49:53.2250410Z """ 2025-08-14T20:49:53.2251115Z Dictionary of users with a list of features they have opted into 2025-08-14T20:49:53.2251769Z """ 2025-08-14T20:49:53.2251981Z 2025-08-14T20:49:53.2251987Z 2025-08-14T20:49:53.2252326Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:49:53.2252985Z """ 2025-08-14T20:49:53.2253695Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:49:53.2254380Z 2025-08-14T20:49:53.2255005Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:49:53.2256016Z - Example line: "@User1,lf,split_build" 2025-08-14T20:49:53.2256701Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:49:53.2257179Z 2025-08-14T20:49:53.2257186Z 2025-08-14T20:49:53.2257348Z """ 2025-08-14T20:49:53.2257711Z optins = UserOptins() 2025-08-14T20:49:53.2258192Z for user in user_optin_text.split("\n"): 2025-08-14T20:49:53.2258731Z user = user.strip("\r\n\t -") 2025-08-14T20:49:53.2259269Z if not user or not user.startswith("@"): 2025-08-14T20:49:53.2259994Z # Not a valid user. Skip 2025-08-14T20:49:53.2260525Z continue 2025-08-14T20:49:53.2261044Z 2025-08-14T20:49:53.2261228Z if user: 2025-08-14T20:49:53.2261682Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:49:53.2262378Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:49:53.2262869Z 2025-08-14T20:49:53.2263036Z return optins 2025-08-14T20:49:53.2263269Z 2025-08-14T20:49:53.2263281Z 2025-08-14T20:49:53.2263564Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:49:53.2264165Z """ 2025-08-14T20:49:53.2264564Z Check if the experiment name is valid. 2025-08-14T20:49:53.2265080Z A valid name: 2025-08-14T20:49:53.2265708Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:49:53.2266650Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:49:53.2267389Z - Cannot contain spaces 2025-08-14T20:49:53.2267871Z """ 2025-08-14T20:49:53.2268071Z 2025-08-14T20:49:53.2268328Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:49:53.2269024Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:49:53.2269465Z 2025-08-14T20:49:53.2269625Z if valid: 2025-08-14T20:49:53.2270003Z return True 2025-08-14T20:49:53.2270240Z 2025-08-14T20:49:53.2270409Z log.error( 2025-08-14T20:49:53.2272061Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:49:53.2273648Z ) 2025-08-14T20:49:53.2273995Z return False 2025-08-14T20:49:53.2274230Z 2025-08-14T20:49:53.2274237Z 2025-08-14T20:49:53.2274534Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:49:53.2275153Z """ 2025-08-14T20:49:53.2275892Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:49:53.2276647Z """ 2025-08-14T20:49:53.2276997Z try: 2025-08-14T20:49:53.2277369Z if settings_text: 2025-08-14T20:49:53.2278106Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:49:53.2278901Z # for easy reading 2025-08-14T20:49:53.2279685Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:49:53.2280582Z # the backtick character in shell commands. 2025-08-14T20:49:53.2281411Z backtick = chr(96) # backtick character 2025-08-14T20:49:53.2282080Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:49:53.2282744Z settings = load_yaml(settings_text) 2025-08-14T20:49:53.2283109Z 2025-08-14T20:49:53.2283524Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:49:53.2284290Z experiments = {} 2025-08-14T20:49:53.2284583Z 2025-08-14T20:49:53.2284964Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:49:53.2285717Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:49:53.2286851Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:49:53.2287897Z continue 2025-08-14T20:49:53.2288187Z 2025-08-14T20:49:53.2288368Z valid_settings = {} 2025-08-14T20:49:53.2288879Z for setting in exp_settings: 2025-08-14T20:49:53.2289448Z if setting not in Experiment._fields: 2025-08-14T20:49:53.2289993Z log.warning( 2025-08-14T20:49:53.2290696Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:49:53.2291941Z ) 2025-08-14T20:49:53.2292416Z else: 2025-08-14T20:49:53.2292966Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:49:53.2293582Z 2025-08-14T20:49:53.2293868Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:49:53.2294515Z return Settings(experiments) 2025-08-14T20:49:53.2294867Z 2025-08-14T20:49:53.2295041Z except Exception: 2025-08-14T20:49:53.2295525Z log.exception("Failed to parse settings") 2025-08-14T20:49:53.2295936Z 2025-08-14T20:49:53.2296111Z return Settings() 2025-08-14T20:49:53.2296364Z 2025-08-14T20:49:53.2296371Z 2025-08-14T20:49:53.2296632Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:49:53.2297198Z """ 2025-08-14T20:49:53.2297621Z Parse settings, if any, from the rollout state. 2025-08-14T20:49:53.2298040Z 2025-08-14T20:49:53.2298393Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:49:53.2299170Z and the text below is the list of opted in users. 2025-08-14T20:49:53.2299571Z 2025-08-14T20:49:53.2299979Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:49:53.2301006Z """ 2025-08-14T20:49:53.2301709Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:49:53.2302489Z return parse_settings_from_text(settings_text) 2025-08-14T20:49:53.2302901Z 2025-08-14T20:49:53.2302908Z 2025-08-14T20:49:53.2303151Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:49:53.2303712Z """ 2025-08-14T20:49:53.2304098Z Parse users from the rollout state. 2025-08-14T20:49:53.2304446Z 2025-08-14T20:49:53.2304602Z """ 2025-08-14T20:49:53.2305217Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:49:53.2306015Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:49:53.2306520Z 2025-08-14T20:49:53.2306527Z 2025-08-14T20:49:53.2307095Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:49:53.2307866Z """ 2025-08-14T20:49:53.2308278Z Check if a user is opted into an experiment 2025-08-14T20:49:53.2308820Z """ 2025-08-14T20:49:53.2309262Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:49:53.2309689Z 2025-08-14T20:49:53.2309701Z 2025-08-14T20:49:53.2310123Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:49:53.2311116Z """ 2025-08-14T20:49:53.2311602Z Check if a user explicitly opted out of an experiment 2025-08-14T20:49:53.2312177Z """ 2025-08-14T20:49:53.2312678Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:49:53.2313381Z experiment_optout = "-" + experiment_name 2025-08-14T20:49:53.2314111Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:49:53.2314847Z return False 2025-08-14T20:49:53.2315282Z 2025-08-14T20:49:53.2315578Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:49:53.2316195Z log.warning( 2025-08-14T20:49:53.2316995Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:49:53.2317879Z ) 2025-08-14T20:49:53.2318086Z 2025-08-14T20:49:53.2318250Z return True 2025-08-14T20:49:53.2318482Z 2025-08-14T20:49:53.2318488Z 2025-08-14T20:49:53.2319104Z def get_runner_prefix( 2025-08-14T20:49:53.2319663Z rollout_state: str, 2025-08-14T20:49:53.2320144Z workflow_requestors: Iterable[str], 2025-08-14T20:49:53.2320669Z branch: str, 2025-08-14T20:49:53.2321409Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:49:53.2322075Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:49:53.2322654Z is_canary: bool = False, 2025-08-14T20:49:53.2323107Z ) -> str: 2025-08-14T20:49:53.2323708Z settings = parse_settings(rollout_state) 2025-08-14T20:49:53.2324304Z user_optins = parse_users(rollout_state) 2025-08-14T20:49:53.2324677Z 2025-08-14T20:49:53.2324851Z fleet_prefix = "" 2025-08-14T20:49:53.2325276Z prefixes = [] 2025-08-14T20:49:53.2325904Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:49:53.2327068Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:49:53.2327790Z log.info( 2025-08-14T20:49:53.2328458Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:49:53.2329209Z ) 2025-08-14T20:49:53.2329582Z continue 2025-08-14T20:49:53.2329838Z 2025-08-14T20:49:53.2330025Z if opt_out_experiments: 2025-08-14T20:49:53.2330546Z if experiment_name in opt_out_experiments: 2025-08-14T20:49:53.2331425Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:49:53.2332033Z log.info( 2025-08-14T20:49:53.2332964Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:49:53.2333944Z ) 2025-08-14T20:49:53.2334332Z continue 2025-08-14T20:49:53.2334601Z 2025-08-14T20:49:53.2334786Z if eligible_experiments: 2025-08-14T20:49:53.2335355Z if experiment_name not in eligible_experiments: 2025-08-14T20:49:53.2335978Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:49:53.2336529Z log.info( 2025-08-14T20:49:53.2337299Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:49:53.2338131Z ) 2025-08-14T20:49:53.2338516Z continue 2025-08-14T20:49:53.2338985Z elif not experiment_settings.default: 2025-08-14T20:49:53.2339510Z log.info( 2025-08-14T20:49:53.2340303Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:49:53.2341238Z ) 2025-08-14T20:49:53.2341611Z continue 2025-08-14T20:49:53.2341853Z 2025-08-14T20:49:53.2342127Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:49:53.2342738Z opted_out_users = [ 2025-08-14T20:49:53.2343180Z requestor 2025-08-14T20:49:53.2343628Z for requestor in workflow_requestors 2025-08-14T20:49:53.2344288Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:49:53.2344902Z ] 2025-08-14T20:49:53.2345111Z 2025-08-14T20:49:53.2345289Z if opted_out_users: 2025-08-14T20:49:53.2345738Z log.info( 2025-08-14T20:49:53.2346347Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:49:53.2347048Z ) 2025-08-14T20:49:53.2347418Z continue 2025-08-14T20:49:53.2347664Z 2025-08-14T20:49:53.2347956Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:49:53.2348586Z opted_in_users = [ 2025-08-14T20:49:53.2349037Z requestor 2025-08-14T20:49:53.2349492Z for requestor in workflow_requestors 2025-08-14T20:49:53.2350158Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:49:53.2350881Z ] 2025-08-14T20:49:53.2351092Z 2025-08-14T20:49:53.2351265Z enabled = False 2025-08-14T20:49:53.2351707Z if opted_in_users: 2025-08-14T20:49:53.2352142Z log.info( 2025-08-14T20:49:53.2352737Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:49:53.2353412Z ) 2025-08-14T20:49:53.2353793Z enabled = True 2025-08-14T20:49:53.2354064Z 2025-08-14T20:49:53.2354282Z elif experiment_settings.rollout_perc: 2025-08-14T20:49:53.2355118Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:49:53.2356207Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:49:53.2357165Z log.info( 2025-08-14T20:49:53.2358041Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:49:53.2358959Z ) 2025-08-14T20:49:53.2359363Z enabled = True 2025-08-14T20:49:53.2359657Z 2025-08-14T20:49:53.2359823Z if enabled: 2025-08-14T20:49:53.2360240Z label = experiment_name 2025-08-14T20:49:53.2361016Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:49:53.2362003Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:49:53.2362915Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:49:53.2363670Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:49:53.2364340Z if is_canary: 2025-08-14T20:49:53.2364815Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:49:53.2365363Z fleet_prefix = label 2025-08-14T20:49:53.2365844Z else: 2025-08-14T20:49:53.2366262Z prefixes.append(label) 2025-08-14T20:49:53.2366605Z 2025-08-14T20:49:53.2366792Z if len(prefixes) > 1: 2025-08-14T20:49:53.2367221Z log.error( 2025-08-14T20:49:53.2368252Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:49:53.2369360Z ) 2025-08-14T20:49:53.2369743Z prefixes = prefixes[:1] 2025-08-14T20:49:53.2370047Z 2025-08-14T20:49:53.2370237Z # Fleet always comes first 2025-08-14T20:49:53.2370695Z if fleet_prefix: 2025-08-14T20:49:53.2371358Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:49:53.2371732Z 2025-08-14T20:49:53.2372124Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:49:53.2372555Z 2025-08-14T20:49:53.2372562Z 2025-08-14T20:49:53.2373010Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:49:53.2373768Z """ 2025-08-14T20:49:53.2374343Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:49:53.2374899Z 2025-08-14T20:49:53.2375286Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:49:53.2375981Z """ 2025-08-14T20:49:53.2376368Z gh = get_gh_client(github_token) 2025-08-14T20:49:53.2376895Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:49:53.2377528Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:49:53.2377968Z 2025-08-14T20:49:53.2377975Z 2025-08-14T20:49:53.2378371Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:49:53.2379131Z for _ in range(num_retries): 2025-08-14T20:49:53.2379611Z try: 2025-08-14T20:49:53.2380023Z req = Request(url=url, headers=headers) 2025-08-14T20:49:53.2380679Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:49:53.2381706Z return json.loads(content) 2025-08-14T20:49:53.2382240Z except Exception as e: 2025-08-14T20:49:53.2382771Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:49:53.2383181Z 2025-08-14T20:49:53.2383561Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:49:53.2384269Z return {} 2025-08-14T20:49:53.2384502Z 2025-08-14T20:49:53.2384509Z 2025-08-14T20:49:53.2384669Z @cache 2025-08-14T20:49:53.2385286Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:49:53.2386038Z """ 2025-08-14T20:49:53.2386428Z Dynamically get PR information 2025-08-14T20:49:53.2386905Z """ 2025-08-14T20:49:53.2387556Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:49:53.2388169Z headers = { 2025-08-14T20:49:53.2388620Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:49:53.2389223Z "Authorization": f"token {github_token}", 2025-08-14T20:49:53.2389745Z } 2025-08-14T20:49:53.2390167Z json_response: dict[str, Any] = download_json( 2025-08-14T20:49:53.2390758Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:49:53.2391829Z headers=headers, 2025-08-14T20:49:53.2392252Z ) 2025-08-14T20:49:53.2392454Z 2025-08-14T20:49:53.2392634Z if not json_response: 2025-08-14T20:49:53.2393193Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:49:53.2393808Z return {} 2025-08-14T20:49:53.2394041Z 2025-08-14T20:49:53.2394217Z return json_response 2025-08-14T20:49:53.2394494Z 2025-08-14T20:49:53.2394501Z 2025-08-14T20:49:53.2394894Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:49:53.2395623Z """ 2025-08-14T20:49:53.2396138Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:49:53.2396796Z """ 2025-08-14T20:49:53.2397267Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:49:53.2397888Z return { 2025-08-14T20:49:53.2398471Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:49:53.2399166Z } 2025-08-14T20:49:53.2399358Z 2025-08-14T20:49:53.2399365Z 2025-08-14T20:49:53.2399545Z def main() -> None: 2025-08-14T20:49:53.2399952Z args = parse_args() 2025-08-14T20:49:53.2400218Z 2025-08-14T20:49:53.2400440Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:49:53.2401006Z 2025-08-14T20:49:53.2401225Z # Check if the PR is opt-out 2025-08-14T20:49:53.2401718Z if args.pr_number: 2025-08-14T20:49:53.2402361Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:49:53.2403266Z if OPT_OUT_LABEL in labels: 2025-08-14T20:49:53.2403784Z log.info( 2025-08-14T20:49:53.2404468Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:49:53.2405226Z ) 2025-08-14T20:49:53.2405762Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:49:53.2406432Z sys.exit() 2025-08-14T20:49:53.2406686Z 2025-08-14T20:49:53.2406844Z try: 2025-08-14T20:49:53.2407273Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:49:53.2407966Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:49:53.2408599Z ) 2025-08-14T20:49:53.2408800Z 2025-08-14T20:49:53.2409007Z username = get_potential_pr_author( 2025-08-14T20:49:53.2409540Z args.github_token, 2025-08-14T20:49:53.2410019Z args.github_repo, 2025-08-14T20:49:53.2410484Z args.github_actor, 2025-08-14T20:49:53.2411082Z args.github_ref_type, 2025-08-14T20:49:53.2411574Z args.github_branch, 2025-08-14T20:49:53.2412049Z ) 2025-08-14T20:49:53.2412255Z 2025-08-14T20:49:53.2412540Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:49:53.2413001Z 2025-08-14T20:49:53.2413215Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:49:53.2413765Z rollout_state, 2025-08-14T20:49:53.2414239Z (args.github_issue_owner, username), 2025-08-14T20:49:53.2414785Z args.github_branch, 2025-08-14T20:49:53.2415261Z args.eligible_experiments, 2025-08-14T20:49:53.2415789Z args.opt_out_experiments, 2025-08-14T20:49:53.2416278Z is_canary, 2025-08-14T20:49:53.2416678Z ) 2025-08-14T20:49:53.2416876Z 2025-08-14T20:49:53.2417058Z except Exception as e: 2025-08-14T20:49:53.2417499Z log.error( 2025-08-14T20:49:53.2418156Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:49:53.2419058Z ) 2025-08-14T20:49:53.2419267Z 2025-08-14T20:49:53.2419594Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:49:53.2420092Z 2025-08-14T20:49:53.2420098Z 2025-08-14T20:49:53.2420274Z if __name__ == "__main__": 2025-08-14T20:49:53.2420710Z main() 2025-08-14T20:49:53.2421021Z 2025-08-14T20:49:53.2513097Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:49:53.2513983Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:49:53.2554800Z shell: /usr/bin/bash -e {0} 2025-08-14T20:49:53.2555275Z env: 2025-08-14T20:49:53.2555903Z GITHUB_TOKEN: *** 2025-08-14T20:49:53.2556317Z ISSUE_NUMBER: 5132 2025-08-14T20:49:53.2556750Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:49:53.2557259Z ISSUE_OWNER: 2025-08-14T20:49:53.2557650Z CHECK_EXPERIMENTS: 2025-08-14T20:49:53.2558088Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:49:53.2558524Z PR_NUMBER: 2025-08-14T20:49:53.2558904Z ##[endgroup] 2025-08-14T20:49:54.4729463Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:49:55.5071663Z Collecting urllib3==1.26.18 2025-08-14T20:49:55.5441372Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:49:55.5642486Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-08-14T20:49:55.5875008Z Collecting PyGithub==2.3.0 2025-08-14T20:49:55.5910141Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:49:55.6339251Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:49:55.6374571Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:49:55.6419801Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:49:55.6437181Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:49:55.6451726Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:49:55.6696699Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:49:55.6735052Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:49:55.6961866Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:49:55.8132533Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:49:55.8168865Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:49:55.9335513Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:49:55.9375749Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:49:55.9600373Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:49:55.9645713Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:49:55.9876063Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:49:55.9936868Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 31.9 MB/s eta 0:00:00 2025-08-14T20:49:55.9973793Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:49:56.0049088Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 61.4 MB/s eta 0:00:00 2025-08-14T20:49:56.0099041Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:49:56.0191531Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 114.5 MB/s eta 0:00:00 2025-08-14T20:49:56.0250397Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:49:56.0325109Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:49:56.0390409Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 96.1 MB/s eta 0:00:00 2025-08-14T20:49:56.0435280Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:49:56.0475727Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.2 MB/s eta 0:00:00 2025-08-14T20:49:56.0578640Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:49:56.0621584Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.5 MB/s eta 0:00:00 2025-08-14T20:49:56.3550150Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:49:56.8864105Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:49:56.9753669Z ##[group]Run curr_branch="main" 2025-08-14T20:49:56.9753996Z curr_branch="main" 2025-08-14T20:49:56.9754221Z curr_ref_type="branch" 2025-08-14T20:49:56.9754505Z echo "Current branch is '$curr_branch'" 2025-08-14T20:49:56.9754759Z  2025-08-14T20:49:56.9754941Z python3 runner_determinator.py \ 2025-08-14T20:49:56.9755229Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:49:56.9755495Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:49:56.9755746Z  --github-branch "$curr_branch" \ 2025-08-14T20:49:56.9756002Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:49:56.9756287Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:49:56.9756567Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:49:56.9756831Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:49:56.9757125Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:49:56.9757487Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:49:56.9757773Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:49:56.9799941Z shell: /usr/bin/bash -e {0} 2025-08-14T20:49:56.9800172Z env: 2025-08-14T20:49:56.9800738Z GITHUB_TOKEN: *** 2025-08-14T20:49:56.9801070Z ISSUE_NUMBER: 5132 2025-08-14T20:49:56.9801278Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:49:56.9801504Z ISSUE_OWNER: 2025-08-14T20:49:56.9801681Z CHECK_EXPERIMENTS: 2025-08-14T20:49:56.9801864Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:49:56.9802046Z PR_NUMBER: 2025-08-14T20:49:56.9802210Z ##[endgroup] 2025-08-14T20:49:56.9862125Z Current branch is 'main' 2025-08-14T20:49:58.3069047Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:49:58.3070076Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:49:58.3070599Z INFO : Setting output: label-type='' 2025-08-14T20:49:58.3387623Z Evaluate and set job outputs 2025-08-14T20:49:58.3394648Z Cleaning up orphan processes