2025-08-14T20:43:46.9974665Z Current runner version: '2.327.1' 2025-08-14T20:43:46.9998180Z ##[group]Runner Image Provisioner 2025-08-14T20:43:46.9999070Z Hosted Compute Agent 2025-08-14T20:43:46.9999595Z Version: 20250812.370 2025-08-14T20:43:47.0000199Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.0000838Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.0001501Z ##[endgroup] 2025-08-14T20:43:47.0002019Z ##[group]Operating System 2025-08-14T20:43:47.0002733Z Ubuntu 2025-08-14T20:43:47.0003262Z 24.04.2 2025-08-14T20:43:47.0003723Z LTS 2025-08-14T20:43:47.0004136Z ##[endgroup] 2025-08-14T20:43:47.0004669Z ##[group]Runner Image 2025-08-14T20:43:47.0005238Z Image: ubuntu-24.04 2025-08-14T20:43:47.0005699Z Version: 20250810.1.0 2025-08-14T20:43:47.0006739Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250810.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.0008234Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250810.1 2025-08-14T20:43:47.0009277Z ##[endgroup] 2025-08-14T20:43:47.0010307Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.0012824Z Contents: read 2025-08-14T20:43:47.0013421Z Metadata: read 2025-08-14T20:43:47.0013888Z Packages: read 2025-08-14T20:43:47.0014432Z ##[endgroup] 2025-08-14T20:43:47.0016477Z Secret source: Actions 2025-08-14T20:43:47.0017156Z Prepare workflow directory 2025-08-14T20:43:47.0536092Z Prepare all required actions 2025-08-14T20:43:47.0593761Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.0598641Z ##[group] Inputs 2025-08-14T20:43:47.0599267Z check_experiments: 2025-08-14T20:43:47.0599827Z opt_out_experiments: 2025-08-14T20:43:47.0600446Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.0601034Z issue_owner: 2025-08-14T20:43:47.0601542Z curr_branch: main 2025-08-14T20:43:47.0602212Z curr_ref_type: branch 2025-08-14T20:43:47.0602942Z issue_number: 5132 2025-08-14T20:43:47.0603523Z ##[endgroup] 2025-08-14T20:43:47.0604069Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:47.1193978Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.1196455Z cat < runner_determinator.py 2025-08-14T20:43:47.1197114Z # flake8: noqa: G004 2025-08-14T20:43:47.1197624Z  2025-08-14T20:43:47.1198440Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.1199472Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.1200425Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.1201184Z  2025-08-14T20:43:47.1201593Z """ 2025-08-14T20:43:47.1202486Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.1203521Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.1204739Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.1205640Z of which runners should be used to run which job. 2025-08-14T20:43:47.1206372Z  2025-08-14T20:43:47.1207024Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.1208036Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.1209099Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.1209897Z list, defined. 2025-08-14T20:43:47.1210381Z  2025-08-14T20:43:47.1211081Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.1212145Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.1213471Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.1214502Z  2025-08-14T20:43:47.1215212Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.1216171Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.1217092Z experiments which the user could be opted in to. 2025-08-14T20:43:47.1217749Z  2025-08-14T20:43:47.1218205Z The user list has the following rules: 2025-08-14T20:43:47.1218851Z  2025-08-14T20:43:47.1219469Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.1220437Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.1221327Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.1222000Z  2025-08-14T20:43:47.1222768Z Example config: 2025-08-14T20:43:47.1223400Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.1224259Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.1224961Z  # Expected syntax is: 2025-08-14T20:43:47.1225782Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.1226870Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.1227682Z  2025-08-14T20:43:47.1228173Z  experiments: 2025-08-14T20:43:47.1228700Z  lf: 2025-08-14T20:43:47.1229195Z  rollout_percent: 25 2025-08-14T20:43:47.1229731Z  all_branches: false 2025-08-14T20:43:47.1230385Z  default: true 2025-08-14T20:43:47.1230916Z  --- 2025-08-14T20:43:47.1231322Z  2025-08-14T20:43:47.1231864Z  # Opt-ins: 2025-08-14T20:43:47.1232695Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.1233829Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.1234793Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.1235586Z  # Experiments should be from the above list. 2025-08-14T20:43:47.1236245Z  2025-08-14T20:43:47.1236739Z  @User1,-lf,split_build 2025-08-14T20:43:47.1237316Z  @User2,lf 2025-08-14T20:43:47.1237810Z  @User3,split_build 2025-08-14T20:43:47.1238417Z """ 2025-08-14T20:43:47.1238845Z  2025-08-14T20:43:47.1239326Z import json 2025-08-14T20:43:47.1239890Z import logging 2025-08-14T20:43:47.1240438Z import os 2025-08-14T20:43:47.1240942Z import random 2025-08-14T20:43:47.1241457Z import re 2025-08-14T20:43:47.1241963Z import sys 2025-08-14T20:43:47.1242670Z from argparse import ArgumentParser 2025-08-14T20:43:47.1244497Z from collections.abc import Iterable 2025-08-14T20:43:47.1245668Z from functools import cache 2025-08-14T20:43:47.1246590Z from logging import LogRecord 2025-08-14T20:43:47.1247668Z from typing import Any, NamedTuple 2025-08-14T20:43:47.1248475Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.1249160Z  2025-08-14T20:43:47.1249653Z import yaml 2025-08-14T20:43:47.1250167Z from github import Auth, Github 2025-08-14T20:43:47.1250798Z from github.Issue import Issue 2025-08-14T20:43:47.1251343Z  2025-08-14T20:43:47.1251839Z  2025-08-14T20:43:47.1252546Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.1253483Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.1254576Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.1255564Z  2025-08-14T20:43:47.1256097Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.1256831Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.1257524Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.1258182Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.1258854Z  2025-08-14T20:43:47.1259340Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.1259906Z  2025-08-14T20:43:47.1260436Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.1261025Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.1261580Z  2025-08-14T20:43:47.1262010Z  2025-08-14T20:43:47.1263112Z class Experiment(NamedTuple): 2025-08-14T20:43:47.1263709Z  rollout_perc: float = ( 2025-08-14T20:43:47.1264566Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.1265399Z  ) 2025-08-14T20:43:47.1265866Z  all_branches: bool = ( 2025-08-14T20:43:47.1266676Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.1267438Z  ) 2025-08-14T20:43:47.1267915Z  default: bool = ( 2025-08-14T20:43:47.1268669Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.1269430Z  ) 2025-08-14T20:43:47.1269882Z  2025-08-14T20:43:47.1270308Z  # Add more fields as needed 2025-08-14T20:43:47.1270956Z  2025-08-14T20:43:47.1271356Z  2025-08-14T20:43:47.1271812Z class Settings(NamedTuple): 2025-08-14T20:43:47.1272714Z  """ 2025-08-14T20:43:47.1273325Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.1273992Z  """ 2025-08-14T20:43:47.1274487Z  2025-08-14T20:43:47.1274998Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.1275591Z  2025-08-14T20:43:47.1276274Z  2025-08-14T20:43:47.1276787Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.1277556Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.1278303Z  2025-08-14T20:43:47.1278717Z  COLORS = { 2025-08-14T20:43:47.1279263Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.1279922Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.1280567Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.1281155Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.1281803Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.1282552Z  } 2025-08-14T20:43:47.1282990Z  2025-08-14T20:43:47.1283588Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.1284457Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.1285379Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.1286116Z  return super().format(record) 2025-08-14T20:43:47.1286691Z  2025-08-14T20:43:47.1287126Z  2025-08-14T20:43:47.1287591Z handler = logging.StreamHandler() 2025-08-14T20:43:47.1288521Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.1289298Z  2025-08-14T20:43:47.1289846Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.1290997Z log.addHandler(handler) 2025-08-14T20:43:47.1292070Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.1293100Z  2025-08-14T20:43:47.1293607Z  2025-08-14T20:43:47.1294170Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.1294819Z  """ 2025-08-14T20:43:47.1295552Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.1296443Z  """ 2025-08-14T20:43:47.1296975Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.1298233Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.1299400Z  log.warning( 2025-08-14T20:43:47.1300379Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.1301427Z  ) 2025-08-14T20:43:47.1301961Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.1303099Z  return 2025-08-14T20:43:47.1303614Z  2025-08-14T20:43:47.1304118Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.1304789Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.1305514Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.1306095Z  2025-08-14T20:43:47.1306567Z  2025-08-14T20:43:47.1307206Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.1307980Z  return frozenset( 2025-08-14T20:43:47.1308740Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.1309463Z  ) 2025-08-14T20:43:47.1309990Z  2025-08-14T20:43:47.1310504Z  2025-08-14T20:43:47.1310959Z def parse_args() -> Any: 2025-08-14T20:43:47.1312271Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.1313352Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.1314200Z  parser.add_argument( 2025-08-14T20:43:47.1314845Z  "--github-issue-repo", 2025-08-14T20:43:47.1315502Z  type=str, 2025-08-14T20:43:47.1316037Z  required=False, 2025-08-14T20:43:47.1316857Z  default="pytorch/test-infra", 2025-08-14T20:43:47.1317618Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.1318211Z  ) 2025-08-14T20:43:47.1318789Z  parser.add_argument( 2025-08-14T20:43:47.1319327Z  "--github-repo", 2025-08-14T20:43:47.1319961Z  type=str, 2025-08-14T20:43:47.1320549Z  required=True, 2025-08-14T20:43:47.1321136Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.1321762Z  ) 2025-08-14T20:43:47.1322242Z  parser.add_argument( 2025-08-14T20:43:47.1323183Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.1323897Z  ) 2025-08-14T20:43:47.1324413Z  parser.add_argument( 2025-08-14T20:43:47.1325193Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.1325941Z  ) 2025-08-14T20:43:47.1326484Z  parser.add_argument( 2025-08-14T20:43:47.1327246Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.1328055Z  ) 2025-08-14T20:43:47.1393645Z  parser.add_argument( 2025-08-14T20:43:47.1395027Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.1396367Z  ) 2025-08-14T20:43:47.1397079Z  parser.add_argument( 2025-08-14T20:43:47.1397962Z  "--github-ref-type", 2025-08-14T20:43:47.1398834Z  type=str, 2025-08-14T20:43:47.1399518Z  required=True, 2025-08-14T20:43:47.1400079Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.1400642Z  ) 2025-08-14T20:43:47.1401038Z  parser.add_argument( 2025-08-14T20:43:47.1401812Z  "--eligible-experiments", 2025-08-14T20:43:47.1402688Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.1403276Z  required=False, 2025-08-14T20:43:47.1403739Z  default="", 2025-08-14T20:43:47.1404626Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.1405555Z  ) 2025-08-14T20:43:47.1405941Z  parser.add_argument( 2025-08-14T20:43:47.1406435Z  "--opt-out-experiments", 2025-08-14T20:43:47.1406971Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.1407501Z  required=False, 2025-08-14T20:43:47.1407957Z  default="", 2025-08-14T20:43:47.1408392Z  help=( 2025-08-14T20:43:47.1409099Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.1410262Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.1411091Z  ), 2025-08-14T20:43:47.1411461Z  ) 2025-08-14T20:43:47.1411850Z  parser.add_argument( 2025-08-14T20:43:47.1412616Z  "--pr-number", 2025-08-14T20:43:47.1413109Z  type=str, 2025-08-14T20:43:47.1413560Z  required=False, 2025-08-14T20:43:47.1414022Z  default="", 2025-08-14T20:43:47.1414562Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.1415124Z  ) 2025-08-14T20:43:47.1415489Z  2025-08-14T20:43:47.1415874Z  return parser.parse_args() 2025-08-14T20:43:47.1416360Z  2025-08-14T20:43:47.1416704Z  2025-08-14T20:43:47.1417304Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.1418246Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.1418779Z  return Github(auth=auth) 2025-08-14T20:43:47.1419250Z  2025-08-14T20:43:47.1419582Z  2025-08-14T20:43:47.1420235Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.1421053Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.1421598Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.1422128Z  2025-08-14T20:43:47.1422755Z  2025-08-14T20:43:47.1423143Z def get_potential_pr_author( 2025-08-14T20:43:47.1423831Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.1424518Z ) -> str: 2025-08-14T20:43:47.1425096Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.1425919Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.1426703Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.1427269Z  2025-08-14T20:43:47.1427664Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.1428155Z  2025-08-14T20:43:47.1428634Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.1429282Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.1429789Z  if ( 2025-08-14T20:43:47.1430208Z  len(split_tag) == 3 2025-08-14T20:43:47.1430722Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.1431263Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.1431753Z  ): 2025-08-14T20:43:47.1432180Z  pr_number = split_tag[2] 2025-08-14T20:43:47.1433325Z  try: 2025-08-14T20:43:47.1433801Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.1434601Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.1435218Z  except Exception as e: 2025-08-14T20:43:47.1435775Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.1436460Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.1437157Z  ) from e 2025-08-14T20:43:47.1437763Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.1438473Z  # In all other cases, return the original input username 2025-08-14T20:43:47.1439123Z  return username 2025-08-14T20:43:47.1439713Z  2025-08-14T20:43:47.1440047Z  2025-08-14T20:43:47.1440468Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.1441006Z  """ 2025-08-14T20:43:47.1441675Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.1442587Z  """ 2025-08-14T20:43:47.1443151Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.1443803Z  2025-08-14T20:43:47.1444135Z  2025-08-14T20:43:47.1444522Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.1445025Z  try: 2025-08-14T20:43:47.1445438Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.1445958Z  return data 2025-08-14T20:43:47.1446407Z  except yaml.YAMLError: 2025-08-14T20:43:47.1446939Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.1447607Z  raise 2025-08-14T20:43:47.1447999Z  2025-08-14T20:43:47.1448328Z  2025-08-14T20:43:47.1448937Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.1449687Z  """ 2025-08-14T20:43:47.1450760Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.1451538Z  2025-08-14T20:43:47.1452080Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.1453097Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.1453668Z  2025-08-14T20:43:47.1454243Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.1454943Z  """ 2025-08-14T20:43:47.1455416Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.1456034Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.1456664Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.1457263Z  else: 2025-08-14T20:43:47.1457675Z  return "", rollout_state 2025-08-14T20:43:47.1458157Z  2025-08-14T20:43:47.1458493Z  2025-08-14T20:43:47.1458904Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.1459427Z  """ 2025-08-14T20:43:47.1459987Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.1460627Z  """ 2025-08-14T20:43:47.1460990Z  2025-08-14T20:43:47.1461327Z  2025-08-14T20:43:47.1461882Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.1462763Z  """ 2025-08-14T20:43:47.1463503Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.1464324Z  2025-08-14T20:43:47.1465123Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.1466125Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.1466975Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.1467602Z  2025-08-14T20:43:47.1467925Z  2025-08-14T20:43:47.1468258Z  """ 2025-08-14T20:43:47.1468648Z  optins = UserOptins() 2025-08-14T20:43:47.1469183Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.1469760Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.1470326Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.1470897Z  # Not a valid user. Skip 2025-08-14T20:43:47.1471408Z  continue 2025-08-14T20:43:47.1471821Z  2025-08-14T20:43:47.1472159Z  if user: 2025-08-14T20:43:47.1472768Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.1473475Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.1474116Z  2025-08-14T20:43:47.1474479Z  return optins 2025-08-14T20:43:47.1474888Z  2025-08-14T20:43:47.1475220Z  2025-08-14T20:43:47.1475712Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.1476327Z  """ 2025-08-14T20:43:47.1476747Z  Check if the experiment name is valid. 2025-08-14T20:43:47.1477278Z  A valid name: 2025-08-14T20:43:47.1477972Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.1478918Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.1479631Z  - Cannot contain spaces 2025-08-14T20:43:47.1480109Z  """ 2025-08-14T20:43:47.1480469Z  2025-08-14T20:43:47.1480927Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.1481662Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.1482486Z  2025-08-14T20:43:47.1482844Z  if valid: 2025-08-14T20:43:47.1483248Z  return True 2025-08-14T20:43:47.1483662Z  2025-08-14T20:43:47.1484007Z  log.error( 2025-08-14T20:43:47.1485426Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.1486913Z  ) 2025-08-14T20:43:47.1487282Z  return False 2025-08-14T20:43:47.1487671Z  2025-08-14T20:43:47.1487995Z  2025-08-14T20:43:47.1488505Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.1489128Z  """ 2025-08-14T20:43:47.1489731Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.1490473Z  """ 2025-08-14T20:43:47.1490846Z  try: 2025-08-14T20:43:47.1491225Z  if settings_text: 2025-08-14T20:43:47.1491971Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.1493024Z  # for easy reading 2025-08-14T20:43:47.1493843Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.1494725Z  # the backtick character in shell commands. 2025-08-14T20:43:47.1495340Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.1496028Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.1496708Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.1497214Z  2025-08-14T20:43:47.1497951Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.1498691Z  experiments = {} 2025-08-14T20:43:47.1499148Z  2025-08-14T20:43:47.1499698Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.1500464Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.1501547Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.1502785Z  continue 2025-08-14T20:43:47.1503234Z  2025-08-14T20:43:47.1503599Z  valid_settings = {} 2025-08-14T20:43:47.1504138Z  for setting in exp_settings: 2025-08-14T20:43:47.1504717Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.1505298Z  log.warning( 2025-08-14T20:43:47.1506017Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.1506721Z  ) 2025-08-14T20:43:47.1507171Z  else: 2025-08-14T20:43:47.1507718Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.1508277Z  2025-08-14T20:43:47.1508751Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.1509394Z  return Settings(experiments) 2025-08-14T20:43:47.1509881Z  2025-08-14T20:43:47.1510232Z  except Exception: 2025-08-14T20:43:47.1510760Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.1511287Z  2025-08-14T20:43:47.1511648Z  return Settings() 2025-08-14T20:43:47.1512071Z  2025-08-14T20:43:47.1512508Z  2025-08-14T20:43:47.1513095Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.1513683Z  """ 2025-08-14T20:43:47.1514139Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.1514686Z  2025-08-14T20:43:47.1515221Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.1515985Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.1516533Z  2025-08-14T20:43:47.1517124Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.1517837Z  """ 2025-08-14T20:43:47.1518414Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.1519207Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.1519761Z  2025-08-14T20:43:47.1520091Z  2025-08-14T20:43:47.1520548Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.1521109Z  """ 2025-08-14T20:43:47.1521530Z  Parse users from the rollout state. 2025-08-14T20:43:47.1522053Z  2025-08-14T20:43:47.1522551Z  """ 2025-08-14T20:43:47.1523163Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.1523961Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.1524554Z  2025-08-14T20:43:47.1524934Z  2025-08-14T20:43:47.1525600Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.1526383Z  """ 2025-08-14T20:43:47.1526847Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.1527382Z  """ 2025-08-14T20:43:47.1527860Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.1528562Z  2025-08-14T20:43:47.1528887Z  2025-08-14T20:43:47.1529515Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.1530253Z  """ 2025-08-14T20:43:47.1530746Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.1531313Z  """ 2025-08-14T20:43:47.1531848Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.1532840Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.1533529Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.1534133Z  return False 2025-08-14T20:43:47.1534549Z  2025-08-14T20:43:47.1535022Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.1535619Z  log.warning( 2025-08-14T20:43:47.1536447Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.1537300Z  ) 2025-08-14T20:43:47.1537658Z  2025-08-14T20:43:47.1538007Z  return True 2025-08-14T20:43:47.1538410Z  2025-08-14T20:43:47.1538743Z  2025-08-14T20:43:47.1539094Z def get_runner_prefix( 2025-08-14T20:43:47.1539575Z  rollout_state: str, 2025-08-14T20:43:47.1540071Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.1540596Z  branch: str, 2025-08-14T20:43:47.1541136Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.1541828Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.1542635Z  is_canary: bool = False, 2025-08-14T20:43:47.1543109Z ) -> str: 2025-08-14T20:43:47.1543568Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.1544158Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.1544677Z  2025-08-14T20:43:47.1545182Z  fleet_prefix = "" 2025-08-14T20:43:47.1545638Z  prefixes = [] 2025-08-14T20:43:47.1546333Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.1547280Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.1548147Z  log.info( 2025-08-14T20:43:47.1548858Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.1549598Z  ) 2025-08-14T20:43:47.1550001Z  continue 2025-08-14T20:43:47.1550413Z  2025-08-14T20:43:47.1550790Z  if opt_out_experiments: 2025-08-14T20:43:47.1551350Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.1552006Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.1552716Z  log.info( 2025-08-14T20:43:47.1553648Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.1554595Z  ) 2025-08-14T20:43:47.1555010Z  continue 2025-08-14T20:43:47.1555444Z  2025-08-14T20:43:47.1555813Z  if eligible_experiments: 2025-08-14T20:43:47.1556401Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.1557050Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.1557617Z  log.info( 2025-08-14T20:43:47.1558422Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.1559233Z  ) 2025-08-14T20:43:47.1559800Z  continue 2025-08-14T20:43:47.1560366Z  elif not experiment_settings.default: 2025-08-14T20:43:47.1560949Z  log.info( 2025-08-14T20:43:47.1561694Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.1562539Z  ) 2025-08-14T20:43:47.1562944Z  continue 2025-08-14T20:43:47.1563357Z  2025-08-14T20:43:47.1563828Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.1564442Z  opted_out_users = [ 2025-08-14T20:43:47.1564921Z  requestor 2025-08-14T20:43:47.1565418Z  for requestor in workflow_requestors 2025-08-14T20:43:47.1566103Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.1566722Z  ] 2025-08-14T20:43:47.1567093Z  2025-08-14T20:43:47.1567455Z  if opted_out_users: 2025-08-14T20:43:47.1567927Z  log.info( 2025-08-14T20:43:47.1568583Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.1569264Z  ) 2025-08-14T20:43:47.1569670Z  continue 2025-08-14T20:43:47.1570097Z  2025-08-14T20:43:47.1570558Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.1571166Z  opted_in_users = [ 2025-08-14T20:43:47.1571634Z  requestor 2025-08-14T20:43:47.1572166Z  for requestor in workflow_requestors 2025-08-14T20:43:47.1573103Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.1573723Z  ] 2025-08-14T20:43:47.1574087Z  2025-08-14T20:43:47.1574435Z  enabled = False 2025-08-14T20:43:47.1574910Z  if opted_in_users: 2025-08-14T20:43:47.1575505Z  log.info( 2025-08-14T20:43:47.1576152Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.1576810Z  ) 2025-08-14T20:43:47.1577223Z  enabled = True 2025-08-14T20:43:47.1577667Z  2025-08-14T20:43:47.1578078Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.1578906Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.1579825Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.1580462Z  log.info( 2025-08-14T20:43:47.1581339Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.1582242Z  ) 2025-08-14T20:43:47.1582911Z  enabled = True 2025-08-14T20:43:47.1583373Z  2025-08-14T20:43:47.1583725Z  if enabled: 2025-08-14T20:43:47.1584181Z  label = experiment_name 2025-08-14T20:43:47.1584753Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.1585577Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.1586443Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.1587212Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.1587872Z  if is_canary: 2025-08-14T20:43:47.1588397Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.1588942Z  fleet_prefix = label 2025-08-14T20:43:47.1589568Z  else: 2025-08-14T20:43:47.1590031Z  prefixes.append(label) 2025-08-14T20:43:47.1590562Z  2025-08-14T20:43:47.1590920Z  if len(prefixes) > 1: 2025-08-14T20:43:47.1591379Z  log.error( 2025-08-14T20:43:47.1592515Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.1593593Z  ) 2025-08-14T20:43:47.1594000Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.1594479Z  2025-08-14T20:43:47.1594837Z  # Fleet always comes first 2025-08-14T20:43:47.1595332Z  if fleet_prefix: 2025-08-14T20:43:47.1595807Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.1596307Z  2025-08-14T20:43:47.1596748Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.1597308Z  2025-08-14T20:43:47.1597629Z  2025-08-14T20:43:47.1598268Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.1599025Z  """ 2025-08-14T20:43:47.1599617Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.1600312Z  2025-08-14T20:43:47.1600881Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.1601578Z  """ 2025-08-14T20:43:47.1601995Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.1602690Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.1603386Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.1604013Z  2025-08-14T20:43:47.1604361Z  2025-08-14T20:43:47.1604954Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.1605825Z  for _ in range(num_retries): 2025-08-14T20:43:47.1606307Z  try: 2025-08-14T20:43:47.1606767Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.1607432Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.1608075Z  return json.loads(content) 2025-08-14T20:43:47.1608607Z  except Exception as e: 2025-08-14T20:43:47.1609172Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.1609711Z  2025-08-14T20:43:47.1610279Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.1610983Z  return {} 2025-08-14T20:43:47.1611370Z  2025-08-14T20:43:47.1611702Z  2025-08-14T20:43:47.1612035Z @cache 2025-08-14T20:43:47.1612955Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.1613721Z  """ 2025-08-14T20:43:47.1614126Z  Dynamically get PR information 2025-08-14T20:43:47.1614618Z  """ 2025-08-14T20:43:47.1615133Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.1615766Z  headers = { 2025-08-14T20:43:47.1616269Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.1616880Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.1617407Z  } 2025-08-14T20:43:47.1617853Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.1618468Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.1619004Z  headers=headers, 2025-08-14T20:43:47.1619447Z  ) 2025-08-14T20:43:47.1619799Z  2025-08-14T20:43:47.1620157Z  if not json_response: 2025-08-14T20:43:47.1620913Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.1621537Z  return {} 2025-08-14T20:43:47.1621962Z  2025-08-14T20:43:47.1622515Z  return json_response 2025-08-14T20:43:47.1622999Z  2025-08-14T20:43:47.1623323Z  2025-08-14T20:43:47.1623910Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.1624629Z  """ 2025-08-14T20:43:47.1625177Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.1625815Z  """ 2025-08-14T20:43:47.1626304Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.1626910Z  return { 2025-08-14T20:43:47.1627502Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.1628174Z  } 2025-08-14T20:43:47.1628523Z  2025-08-14T20:43:47.1628853Z  2025-08-14T20:43:47.1629207Z def main() -> None: 2025-08-14T20:43:47.1629645Z  args = parse_args() 2025-08-14T20:43:47.1630080Z  2025-08-14T20:43:47.1630498Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.1631035Z  2025-08-14T20:43:47.1631398Z  # Check if the PR is opt-out 2025-08-14T20:43:47.1631910Z  if args.pr_number: 2025-08-14T20:43:47.1632729Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.1633470Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.1633969Z  log.info( 2025-08-14T20:43:47.1634676Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.1635421Z  ) 2025-08-14T20:43:47.1635998Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.1636677Z  sys.exit() 2025-08-14T20:43:47.1637276Z  2025-08-14T20:43:47.1637618Z  try: 2025-08-14T20:43:47.1638076Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.1638790Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.1639419Z  ) 2025-08-14T20:43:47.1639783Z  2025-08-14T20:43:47.1640187Z  username = get_potential_pr_author( 2025-08-14T20:43:47.1640740Z  args.github_token, 2025-08-14T20:43:47.1641238Z  args.github_repo, 2025-08-14T20:43:47.1641736Z  args.github_actor, 2025-08-14T20:43:47.1642246Z  args.github_ref_type, 2025-08-14T20:43:47.1643086Z  args.github_branch, 2025-08-14T20:43:47.1643558Z  ) 2025-08-14T20:43:47.1643929Z  2025-08-14T20:43:47.1644412Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.1645001Z  2025-08-14T20:43:47.1645423Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.1645959Z  rollout_state, 2025-08-14T20:43:47.1646490Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.1647039Z  args.github_branch, 2025-08-14T20:43:47.1647567Z  args.eligible_experiments, 2025-08-14T20:43:47.1648108Z  args.opt_out_experiments, 2025-08-14T20:43:47.1648623Z  is_canary, 2025-08-14T20:43:47.1649048Z  ) 2025-08-14T20:43:47.1649410Z  2025-08-14T20:43:47.1649770Z  except Exception as e: 2025-08-14T20:43:47.1650242Z  log.error( 2025-08-14T20:43:47.1650947Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.1651813Z  ) 2025-08-14T20:43:47.1652192Z  2025-08-14T20:43:47.1653046Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.1653703Z  2025-08-14T20:43:47.1654031Z  2025-08-14T20:43:47.1654378Z if __name__ == "__main__": 2025-08-14T20:43:47.1654828Z  main() 2025-08-14T20:43:47.1655198Z  2025-08-14T20:43:47.1655527Z EOF 2025-08-14T20:43:47.1655862Z  2025-08-14T20:43:47.1656232Z cat runner_determinator.py 2025-08-14T20:43:47.1980254Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.1981026Z env: 2025-08-14T20:43:47.1981683Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.1982081Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.1982813Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.1983314Z ISSUE_OWNER: 2025-08-14T20:43:47.1983690Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.1984096Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.1984508Z PR_NUMBER: 2025-08-14T20:43:47.1984863Z ##[endgroup] 2025-08-14T20:43:47.2261414Z # flake8: noqa: G004 2025-08-14T20:43:47.2261750Z 2025-08-14T20:43:47.2262171Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.2263468Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.2264246Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.2264671Z 2025-08-14T20:43:47.2264820Z """ 2025-08-14T20:43:47.2265380Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.2266207Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.2267066Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.2267846Z of which runners should be used to run which job. 2025-08-14T20:43:47.2268241Z 2025-08-14T20:43:47.2268611Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.2269684Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.2270520Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.2271170Z list, defined. 2025-08-14T20:43:47.2271385Z 2025-08-14T20:43:47.2271734Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.2272906Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.2273701Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.2274125Z 2025-08-14T20:43:47.2274490Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.2275319Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.2276004Z experiments which the user could be opted in to. 2025-08-14T20:43:47.2276388Z 2025-08-14T20:43:47.2276580Z The user list has the following rules: 2025-08-14T20:43:47.2276911Z 2025-08-14T20:43:47.2277218Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.2278027Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.2278751Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.2279122Z 2025-08-14T20:43:47.2279285Z Example config: 2025-08-14T20:43:47.2279713Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.2280343Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.2280934Z # Expected syntax is: 2025-08-14T20:43:47.2281538Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.2282817Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.2283413Z 2025-08-14T20:43:47.2283581Z experiments: 2025-08-14T20:43:47.2283945Z lf: 2025-08-14T20:43:47.2284303Z rollout_percent: 25 2025-08-14T20:43:47.2284947Z all_branches: false 2025-08-14T20:43:47.2285375Z default: true 2025-08-14T20:43:47.2285970Z --- 2025-08-14T20:43:47.2286264Z 2025-08-14T20:43:47.2286422Z # Opt-ins: 2025-08-14T20:43:47.2286969Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.2287806Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.2288551Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.2289173Z # Experiments should be from the above list. 2025-08-14T20:43:47.2289528Z 2025-08-14T20:43:47.2289712Z @User1,-lf,split_build 2025-08-14T20:43:47.2290125Z @User2,lf 2025-08-14T20:43:47.2290487Z @User3,split_build 2025-08-14T20:43:47.2290873Z """ 2025-08-14T20:43:47.2291054Z 2025-08-14T20:43:47.2291211Z import json 2025-08-14T20:43:47.2291557Z import logging 2025-08-14T20:43:47.2291918Z import os 2025-08-14T20:43:47.2292254Z import random 2025-08-14T20:43:47.2292963Z import re 2025-08-14T20:43:47.2293311Z import sys 2025-08-14T20:43:47.2293686Z from argparse import ArgumentParser 2025-08-14T20:43:47.2294190Z from collections.abc import Iterable 2025-08-14T20:43:47.2294681Z from functools import cache 2025-08-14T20:43:47.2295124Z from logging import LogRecord 2025-08-14T20:43:47.2295585Z from typing import Any, NamedTuple 2025-08-14T20:43:47.2296098Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.2296447Z 2025-08-14T20:43:47.2296599Z import yaml 2025-08-14T20:43:47.2296976Z from github import Auth, Github 2025-08-14T20:43:47.2297431Z from github.Issue import Issue 2025-08-14T20:43:47.2297721Z 2025-08-14T20:43:47.2297728Z 2025-08-14T20:43:47.2297937Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.2298591Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.2299404Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.2299932Z 2025-08-14T20:43:47.2300158Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.2300869Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.2301384Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.2301903Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.2302232Z 2025-08-14T20:43:47.2302720Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.2303078Z 2025-08-14T20:43:47.2303257Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.2303696Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.2303969Z 2025-08-14T20:43:47.2303975Z 2025-08-14T20:43:47.2304153Z class Experiment(NamedTuple): 2025-08-14T20:43:47.2304600Z rollout_perc: float = ( 2025-08-14T20:43:47.2305198Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.2305839Z ) 2025-08-14T20:43:47.2306185Z all_branches: bool = ( 2025-08-14T20:43:47.2306790Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.2307433Z ) 2025-08-14T20:43:47.2307764Z default: bool = ( 2025-08-14T20:43:47.2308308Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.2308913Z ) 2025-08-14T20:43:47.2309088Z 2025-08-14T20:43:47.2309268Z # Add more fields as needed 2025-08-14T20:43:47.2309550Z 2025-08-14T20:43:47.2309557Z 2025-08-14T20:43:47.2309735Z class Settings(NamedTuple): 2025-08-14T20:43:47.2310157Z """ 2025-08-14T20:43:47.2310576Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.2311123Z """ 2025-08-14T20:43:47.2311302Z 2025-08-14T20:43:47.2311502Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.2311847Z 2025-08-14T20:43:47.2311853Z 2025-08-14T20:43:47.2312047Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.2312964Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.2313372Z 2025-08-14T20:43:47.2313523Z COLORS = { 2025-08-14T20:43:47.2313897Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.2314530Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.2315003Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.2315465Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.2315923Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.2316353Z } 2025-08-14T20:43:47.2316539Z 2025-08-14T20:43:47.2316748Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.2317452Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.2318180Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.2318727Z return super().format(record) 2025-08-14T20:43:47.2319038Z 2025-08-14T20:43:47.2319044Z 2025-08-14T20:43:47.2319267Z handler = logging.StreamHandler() 2025-08-14T20:43:47.2319939Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.2320451Z 2025-08-14T20:43:47.2320684Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.2321243Z log.addHandler(handler) 2025-08-14T20:43:47.2321671Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.2321941Z 2025-08-14T20:43:47.2321946Z 2025-08-14T20:43:47.2322183Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.2322921Z """ 2025-08-14T20:43:47.2323398Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.2323993Z """ 2025-08-14T20:43:47.2324339Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.2325349Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.2326391Z log.warning( 2025-08-14T20:43:47.2327185Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.2328055Z ) 2025-08-14T20:43:47.2338313Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.2338895Z return 2025-08-14T20:43:47.2339136Z 2025-08-14T20:43:47.2339512Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.2340077Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.2340624Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.2340929Z 2025-08-14T20:43:47.2340937Z 2025-08-14T20:43:47.2341222Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.2341826Z return frozenset( 2025-08-14T20:43:47.2342837Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.2343557Z ) 2025-08-14T20:43:47.2343739Z 2025-08-14T20:43:47.2343746Z 2025-08-14T20:43:47.2343925Z def parse_args() -> Any: 2025-08-14T20:43:47.2344468Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.2345294Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.2346031Z parser.add_argument( 2025-08-14T20:43:47.2346466Z "--github-issue-repo", 2025-08-14T20:43:47.2346909Z type=str, 2025-08-14T20:43:47.2347291Z required=False, 2025-08-14T20:43:47.2347709Z default="pytorch/test-infra", 2025-08-14T20:43:47.2348225Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.2348699Z ) 2025-08-14T20:43:47.2349045Z parser.add_argument( 2025-08-14T20:43:47.2349456Z "--github-repo", 2025-08-14T20:43:47.2349856Z type=str, 2025-08-14T20:43:47.2350227Z required=True, 2025-08-14T20:43:47.2350651Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.2351143Z ) 2025-08-14T20:43:47.2351482Z parser.add_argument( 2025-08-14T20:43:47.2352052Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.2352923Z ) 2025-08-14T20:43:47.2353276Z parser.add_argument( 2025-08-14T20:43:47.2353857Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.2354491Z ) 2025-08-14T20:43:47.2354979Z parser.add_argument( 2025-08-14T20:43:47.2355586Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.2356233Z ) 2025-08-14T20:43:47.2356567Z parser.add_argument( 2025-08-14T20:43:47.2357184Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.2357844Z ) 2025-08-14T20:43:47.2358186Z parser.add_argument( 2025-08-14T20:43:47.2358633Z "--github-ref-type", 2025-08-14T20:43:47.2359054Z type=str, 2025-08-14T20:43:47.2359414Z required=True, 2025-08-14T20:43:47.2359874Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.2360384Z ) 2025-08-14T20:43:47.2360725Z parser.add_argument( 2025-08-14T20:43:47.2361149Z "--eligible-experiments", 2025-08-14T20:43:47.2361634Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.2362124Z required=False, 2025-08-14T20:43:47.2362636Z default="", 2025-08-14T20:43:47.2363456Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.2364319Z ) 2025-08-14T20:43:47.2364667Z parser.add_argument( 2025-08-14T20:43:47.2365101Z "--opt-out-experiments", 2025-08-14T20:43:47.2365586Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.2366080Z required=False, 2025-08-14T20:43:47.2366471Z default="", 2025-08-14T20:43:47.2366833Z help=( 2025-08-14T20:43:47.2367469Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.2368554Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.2369336Z ), 2025-08-14T20:43:47.2369669Z ) 2025-08-14T20:43:47.2370004Z parser.add_argument( 2025-08-14T20:43:47.2370417Z "--pr-number", 2025-08-14T20:43:47.2370804Z type=str, 2025-08-14T20:43:47.2371188Z required=False, 2025-08-14T20:43:47.2371574Z default="", 2025-08-14T20:43:47.2372145Z help="the optional PR number where this is run", 2025-08-14T20:43:47.2372803Z ) 2025-08-14T20:43:47.2372988Z 2025-08-14T20:43:47.2373166Z return parser.parse_args() 2025-08-14T20:43:47.2373463Z 2025-08-14T20:43:47.2373469Z 2025-08-14T20:43:47.2373849Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.2374572Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.2375056Z return Github(auth=auth) 2025-08-14T20:43:47.2375331Z 2025-08-14T20:43:47.2375338Z 2025-08-14T20:43:47.2375783Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.2376535Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.2377004Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.2377347Z 2025-08-14T20:43:47.2377354Z 2025-08-14T20:43:47.2377531Z def get_potential_pr_author( 2025-08-14T20:43:47.2378155Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.2378788Z ) -> str: 2025-08-14T20:43:47.2379270Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.2380031Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.2380727Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.2381124Z 2025-08-14T20:43:47.2381299Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.2381611Z 2025-08-14T20:43:47.2381860Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.2382752Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.2383270Z if ( 2025-08-14T20:43:47.2383631Z len(split_tag) == 3 2025-08-14T20:43:47.2384096Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.2384590Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.2385056Z ): 2025-08-14T20:43:47.2385570Z pr_number = split_tag[2] 2025-08-14T20:43:47.2386026Z try: 2025-08-14T20:43:47.2386429Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.2387006Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.2387570Z except Exception as e: 2025-08-14T20:43:47.2388071Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.2388708Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.2389314Z ) from e 2025-08-14T20:43:47.2389829Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.2390488Z # In all other cases, return the original input username 2025-08-14T20:43:47.2391169Z return username 2025-08-14T20:43:47.2391396Z 2025-08-14T20:43:47.2391403Z 2025-08-14T20:43:47.2391619Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.2392118Z """ 2025-08-14T20:43:47.2392846Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.2393582Z """ 2025-08-14T20:43:47.2394102Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.2394592Z 2025-08-14T20:43:47.2394599Z 2025-08-14T20:43:47.2394787Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.2395259Z try: 2025-08-14T20:43:47.2395706Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.2396458Z return data 2025-08-14T20:43:47.2396860Z except yaml.YAMLError: 2025-08-14T20:43:47.2397322Z log.exception("Error loading YAML") 2025-08-14T20:43:47.2397798Z raise 2025-08-14T20:43:47.2397999Z 2025-08-14T20:43:47.2398005Z 2025-08-14T20:43:47.2398397Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.2399086Z """ 2025-08-14T20:43:47.2399672Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.2400250Z 2025-08-14T20:43:47.2400720Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.2401440Z and the text below is the list of opted in users. 2025-08-14T20:43:47.2401828Z 2025-08-14T20:43:47.2402181Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.2402982Z """ 2025-08-14T20:43:47.2403405Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.2403968Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.2404525Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.2405068Z else: 2025-08-14T20:43:47.2405417Z return "", rollout_state 2025-08-14T20:43:47.2405708Z 2025-08-14T20:43:47.2405715Z 2025-08-14T20:43:47.2405901Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.2406371Z """ 2025-08-14T20:43:47.2406855Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.2407454Z """ 2025-08-14T20:43:47.2407639Z 2025-08-14T20:43:47.2407645Z 2025-08-14T20:43:47.2407966Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.2408578Z """ 2025-08-14T20:43:47.2409237Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.2409899Z 2025-08-14T20:43:47.2410494Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.2411438Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.2412102Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.2412681Z 2025-08-14T20:43:47.2412687Z 2025-08-14T20:43:47.2412837Z """ 2025-08-14T20:43:47.2413211Z optins = UserOptins() 2025-08-14T20:43:47.2413683Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.2414223Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.2414871Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.2415405Z # Not a valid user. Skip 2025-08-14T20:43:47.2415854Z continue 2025-08-14T20:43:47.2416080Z 2025-08-14T20:43:47.2416234Z if user: 2025-08-14T20:43:47.2416640Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.2417292Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.2417746Z 2025-08-14T20:43:47.2417901Z return optins 2025-08-14T20:43:47.2418128Z 2025-08-14T20:43:47.2418135Z 2025-08-14T20:43:47.2418401Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.2418962Z """ 2025-08-14T20:43:47.2419369Z Check if the experiment name is valid. 2025-08-14T20:43:47.2473718Z A valid name: 2025-08-14T20:43:47.2474874Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.2476019Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.2476715Z - Cannot contain spaces 2025-08-14T20:43:47.2477157Z """ 2025-08-14T20:43:47.2477350Z 2025-08-14T20:43:47.2477599Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.2478268Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.2478701Z 2025-08-14T20:43:47.2478860Z if valid: 2025-08-14T20:43:47.2479203Z return True 2025-08-14T20:43:47.2479424Z 2025-08-14T20:43:47.2479581Z log.error( 2025-08-14T20:43:47.2480924Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.2482678Z ) 2025-08-14T20:43:47.2483025Z return False 2025-08-14T20:43:47.2483240Z 2025-08-14T20:43:47.2483246Z 2025-08-14T20:43:47.2483533Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.2484119Z """ 2025-08-14T20:43:47.2484850Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.2485546Z """ 2025-08-14T20:43:47.2485876Z try: 2025-08-14T20:43:47.2486216Z if settings_text: 2025-08-14T20:43:47.2486903Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.2487643Z # for easy reading 2025-08-14T20:43:47.2488385Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.2489217Z # the backtick character in shell commands. 2025-08-14T20:43:47.2489783Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.2490401Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.2491025Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.2491363Z 2025-08-14T20:43:47.2491762Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.2492754Z experiments = {} 2025-08-14T20:43:47.2493041Z 2025-08-14T20:43:47.2493412Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.2494109Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.2495135Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.2496114Z continue 2025-08-14T20:43:47.2496384Z 2025-08-14T20:43:47.2496558Z valid_settings = {} 2025-08-14T20:43:47.2497053Z for setting in exp_settings: 2025-08-14T20:43:47.2497593Z if setting not in Experiment._fields: 2025-08-14T20:43:47.2498114Z log.warning( 2025-08-14T20:43:47.2498770Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.2499599Z ) 2025-08-14T20:43:47.2499995Z else: 2025-08-14T20:43:47.2500468Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.2500862Z 2025-08-14T20:43:47.2501127Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.2501713Z return Settings(experiments) 2025-08-14T20:43:47.2502045Z 2025-08-14T20:43:47.2502212Z except Exception: 2025-08-14T20:43:47.2502860Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.2503228Z 2025-08-14T20:43:47.2503385Z return Settings() 2025-08-14T20:43:47.2503620Z 2025-08-14T20:43:47.2503627Z 2025-08-14T20:43:47.2503866Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.2504384Z """ 2025-08-14T20:43:47.2504787Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.2505159Z 2025-08-14T20:43:47.2505491Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.2506210Z and the text below is the list of opted in users. 2025-08-14T20:43:47.2506579Z 2025-08-14T20:43:47.2506970Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.2507641Z """ 2025-08-14T20:43:47.2508159Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.2508861Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.2509233Z 2025-08-14T20:43:47.2509240Z 2025-08-14T20:43:47.2509473Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.2509987Z """ 2025-08-14T20:43:47.2510351Z Parse users from the rollout state. 2025-08-14T20:43:47.2510679Z 2025-08-14T20:43:47.2510854Z """ 2025-08-14T20:43:47.2511337Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.2512022Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.2512635Z 2025-08-14T20:43:47.2512642Z 2025-08-14T20:43:47.2513178Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.2513879Z """ 2025-08-14T20:43:47.2514264Z Check if a user is opted into an experiment 2025-08-14T20:43:47.2514762Z """ 2025-08-14T20:43:47.2515188Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.2515578Z 2025-08-14T20:43:47.2515584Z 2025-08-14T20:43:47.2515973Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.2516662Z """ 2025-08-14T20:43:47.2517111Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.2517651Z """ 2025-08-14T20:43:47.2518112Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.2518760Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.2519400Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.2519961Z return False 2025-08-14T20:43:47.2520192Z 2025-08-14T20:43:47.2520453Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.2520996Z log.warning( 2025-08-14T20:43:47.2521738Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.2522798Z ) 2025-08-14T20:43:47.2522997Z 2025-08-14T20:43:47.2523148Z return True 2025-08-14T20:43:47.2523363Z 2025-08-14T20:43:47.2523371Z 2025-08-14T20:43:47.2523543Z def get_runner_prefix( 2025-08-14T20:43:47.2523936Z rollout_state: str, 2025-08-14T20:43:47.2524364Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.2524836Z branch: str, 2025-08-14T20:43:47.2525289Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.2525890Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.2526433Z is_canary: bool = False, 2025-08-14T20:43:47.2526844Z ) -> str: 2025-08-14T20:43:47.2527428Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.2527967Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.2528314Z 2025-08-14T20:43:47.2528471Z fleet_prefix = "" 2025-08-14T20:43:47.2528865Z prefixes = [] 2025-08-14T20:43:47.2529442Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.2530308Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.2530975Z log.info( 2025-08-14T20:43:47.2531607Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.2532522Z ) 2025-08-14T20:43:47.2532923Z continue 2025-08-14T20:43:47.2533154Z 2025-08-14T20:43:47.2533333Z if opt_out_experiments: 2025-08-14T20:43:47.2533824Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.2534427Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.2534978Z log.info( 2025-08-14T20:43:47.2535841Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.2536738Z ) 2025-08-14T20:43:47.2537104Z continue 2025-08-14T20:43:47.2537349Z 2025-08-14T20:43:47.2537529Z if eligible_experiments: 2025-08-14T20:43:47.2538043Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.2538633Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.2539138Z log.info( 2025-08-14T20:43:47.2539869Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.2540644Z ) 2025-08-14T20:43:47.2541010Z continue 2025-08-14T20:43:47.2541446Z elif not experiment_settings.default: 2025-08-14T20:43:47.2541943Z log.info( 2025-08-14T20:43:47.2542899Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.2543587Z ) 2025-08-14T20:43:47.2543944Z continue 2025-08-14T20:43:47.2544167Z 2025-08-14T20:43:47.2544426Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.2545000Z opted_out_users = [ 2025-08-14T20:43:47.2545419Z requestor 2025-08-14T20:43:47.2545844Z for requestor in workflow_requestors 2025-08-14T20:43:47.2546465Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.2547048Z ] 2025-08-14T20:43:47.2547236Z 2025-08-14T20:43:47.2547408Z if opted_out_users: 2025-08-14T20:43:47.2547821Z log.info( 2025-08-14T20:43:47.2548398Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.2549034Z ) 2025-08-14T20:43:47.2549386Z continue 2025-08-14T20:43:47.2549612Z 2025-08-14T20:43:47.2549875Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.2550441Z opted_in_users = [ 2025-08-14T20:43:47.2550844Z requestor 2025-08-14T20:43:47.2551261Z for requestor in workflow_requestors 2025-08-14T20:43:47.2551874Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.2552677Z ] 2025-08-14T20:43:47.2552870Z 2025-08-14T20:43:47.2553042Z enabled = False 2025-08-14T20:43:47.2553438Z if opted_in_users: 2025-08-14T20:43:47.2553846Z log.info( 2025-08-14T20:43:47.2554393Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.2555022Z ) 2025-08-14T20:43:47.2555377Z enabled = True 2025-08-14T20:43:47.2555638Z 2025-08-14T20:43:47.2555839Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.2556617Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.2557623Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.2558230Z log.info( 2025-08-14T20:43:47.2559031Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.2559886Z ) 2025-08-14T20:43:47.2560250Z enabled = True 2025-08-14T20:43:47.2560541Z 2025-08-14T20:43:47.2560697Z if enabled: 2025-08-14T20:43:47.2561090Z label = experiment_name 2025-08-14T20:43:47.2561594Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.2562592Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.2563457Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.2564172Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.2564780Z if is_canary: 2025-08-14T20:43:47.2565235Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.2565753Z fleet_prefix = label 2025-08-14T20:43:47.2566198Z else: 2025-08-14T20:43:47.2566592Z prefixes.append(label) 2025-08-14T20:43:47.2566915Z 2025-08-14T20:43:47.2567083Z if len(prefixes) > 1: 2025-08-14T20:43:47.2567824Z log.error( 2025-08-14T20:43:47.2568884Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.2569947Z ) 2025-08-14T20:43:47.2570314Z prefixes = prefixes[:1] 2025-08-14T20:43:47.2570602Z 2025-08-14T20:43:47.2570784Z # Fleet always comes first 2025-08-14T20:43:47.2571222Z if fleet_prefix: 2025-08-14T20:43:47.2571631Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.2571973Z 2025-08-14T20:43:47.2572943Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.2573383Z 2025-08-14T20:43:47.2573390Z 2025-08-14T20:43:47.2573807Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.2574526Z """ 2025-08-14T20:43:47.2575080Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.2575601Z 2025-08-14T20:43:47.2575969Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.2576625Z """ 2025-08-14T20:43:47.2576972Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.2577477Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.2578059Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.2578478Z 2025-08-14T20:43:47.2578484Z 2025-08-14T20:43:47.2578857Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.2579565Z for _ in range(num_retries): 2025-08-14T20:43:47.2579999Z try: 2025-08-14T20:43:47.2580399Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.2581014Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.2581611Z return json.loads(content) 2025-08-14T20:43:47.2582092Z except Exception as e: 2025-08-14T20:43:47.2582731Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.2583104Z 2025-08-14T20:43:47.2583467Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.2584119Z return {} 2025-08-14T20:43:47.2584318Z 2025-08-14T20:43:47.2584324Z 2025-08-14T20:43:47.2584476Z @cache 2025-08-14T20:43:47.2585048Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.2585748Z """ 2025-08-14T20:43:47.2586108Z Dynamically get PR information 2025-08-14T20:43:47.2586751Z """ 2025-08-14T20:43:47.2587208Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.2587788Z headers = { 2025-08-14T20:43:47.2588208Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.2588765Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.2589270Z } 2025-08-14T20:43:47.2589665Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.2590224Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.2590719Z headers=headers, 2025-08-14T20:43:47.2591110Z ) 2025-08-14T20:43:47.2591289Z 2025-08-14T20:43:47.2591460Z if not json_response: 2025-08-14T20:43:47.2591982Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.2592794Z return {} 2025-08-14T20:43:47.2593015Z 2025-08-14T20:43:47.2593183Z return json_response 2025-08-14T20:43:47.2593434Z 2025-08-14T20:43:47.2593448Z 2025-08-14T20:43:47.2593826Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.2594508Z """ 2025-08-14T20:43:47.2594998Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.2595596Z """ 2025-08-14T20:43:47.2596042Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.2596592Z return { 2025-08-14T20:43:47.2597123Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.2597765Z } 2025-08-14T20:43:47.2597942Z 2025-08-14T20:43:47.2597948Z 2025-08-14T20:43:47.2598104Z def main() -> None: 2025-08-14T20:43:47.2598490Z args = parse_args() 2025-08-14T20:43:47.2598732Z 2025-08-14T20:43:47.2598936Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.2599301Z 2025-08-14T20:43:47.2599478Z # Check if the PR is opt-out 2025-08-14T20:43:47.2599915Z if args.pr_number: 2025-08-14T20:43:47.2600500Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.2601332Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.2601793Z log.info( 2025-08-14T20:43:47.2602673Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.2603400Z ) 2025-08-14T20:43:47.2603911Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.2604519Z sys.exit() 2025-08-14T20:43:47.2604760Z 2025-08-14T20:43:47.2604906Z try: 2025-08-14T20:43:47.2605298Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.2605945Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.2606529Z ) 2025-08-14T20:43:47.2606717Z 2025-08-14T20:43:47.2606906Z username = get_potential_pr_author( 2025-08-14T20:43:47.2607405Z args.github_token, 2025-08-14T20:43:47.2607840Z args.github_repo, 2025-08-14T20:43:47.2608281Z args.github_actor, 2025-08-14T20:43:47.2608730Z args.github_ref_type, 2025-08-14T20:43:47.2609181Z args.github_branch, 2025-08-14T20:43:47.2609594Z ) 2025-08-14T20:43:47.2609779Z 2025-08-14T20:43:47.2610041Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.2610455Z 2025-08-14T20:43:47.2610657Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.2611159Z rollout_state, 2025-08-14T20:43:47.2611600Z (args.github_issue_owner, username), 2025-08-14T20:43:47.2612100Z args.github_branch, 2025-08-14T20:43:47.2612683Z args.eligible_experiments, 2025-08-14T20:43:47.2613175Z args.opt_out_experiments, 2025-08-14T20:43:47.2613636Z is_canary, 2025-08-14T20:43:47.2614013Z ) 2025-08-14T20:43:47.2614196Z 2025-08-14T20:43:47.2614368Z except Exception as e: 2025-08-14T20:43:47.2614787Z log.error( 2025-08-14T20:43:47.2615387Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.2616240Z ) 2025-08-14T20:43:47.2616424Z 2025-08-14T20:43:47.2616732Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.2617188Z 2025-08-14T20:43:47.2617195Z 2025-08-14T20:43:47.2617358Z if __name__ == "__main__": 2025-08-14T20:43:47.2617780Z main() 2025-08-14T20:43:47.2617995Z 2025-08-14T20:43:47.2708258Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.2709068Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.2749910Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.2750357Z env: 2025-08-14T20:43:47.2750932Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.2751330Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.2751743Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.2752197Z ISSUE_OWNER: 2025-08-14T20:43:47.2752828Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.2753227Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.2753629Z PR_NUMBER: 2025-08-14T20:43:47.2753971Z ##[endgroup] 2025-08-14T20:43:47.6312876Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:47.9560309Z Collecting urllib3==1.26.18 2025-08-14T20:43:47.9948237Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:48.0171742Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.3 MB/s eta 0:00:00 2025-08-14T20:43:48.0433688Z Collecting PyGithub==2.3.0 2025-08-14T20:43:48.0464248Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:48.0899420Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:48.0930321Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:48.0979020Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:48.0997147Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:48.1012609Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:48.1269441Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:48.1299972Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:48.1527950Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:48.2804527Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:48.2834996Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:48.3973536Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:48.4008110Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:48.4195293Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:48.4228170Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:48.4452216Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:48.4544911Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 18.4 MB/s eta 0:00:00 2025-08-14T20:43:48.4622937Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:48.4716266Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 47.0 MB/s eta 0:00:00 2025-08-14T20:43:48.4756444Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:48.4871946Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 86.6 MB/s eta 0:00:00 2025-08-14T20:43:48.4903021Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:48.4949139Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:48.5019745Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 87.8 MB/s eta 0:00:00 2025-08-14T20:43:48.5066201Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:48.5106319Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 32.4 MB/s eta 0:00:00 2025-08-14T20:43:48.5131858Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:48.5174300Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 40.8 MB/s eta 0:00:00 2025-08-14T20:43:48.8039427Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:49.3482569Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:49.4577972Z ##[group]Run curr_branch="main" 2025-08-14T20:43:49.4578324Z curr_branch="main" 2025-08-14T20:43:49.4578628Z curr_ref_type="branch" 2025-08-14T20:43:49.4578926Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:49.4579217Z  2025-08-14T20:43:49.4579454Z python3 runner_determinator.py \ 2025-08-14T20:43:49.4579778Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:49.4580098Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:49.4580410Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:49.4580717Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:49.4581038Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:49.4581348Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:49.4581660Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:49.4582031Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:49.4582749Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:49.4583103Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:49.4625395Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:49.4625680Z env: 2025-08-14T20:43:49.4626405Z GITHUB_TOKEN: *** 2025-08-14T20:43:49.4626643Z ISSUE_NUMBER: 5132 2025-08-14T20:43:49.4626894Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:49.4627168Z ISSUE_OWNER: 2025-08-14T20:43:49.4627424Z CHECK_EXPERIMENTS: 2025-08-14T20:43:49.4627673Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:49.4627910Z PR_NUMBER: 2025-08-14T20:43:49.4628131Z ##[endgroup] 2025-08-14T20:43:49.4692733Z Current branch is 'main' 2025-08-14T20:43:51.3846719Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:51.3847981Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:51.3849013Z INFO : Setting output: label-type='' 2025-08-14T20:43:51.4170181Z Evaluate and set job outputs 2025-08-14T20:43:51.4177267Z Cleaning up orphan processes