2025-11-03T15:43:04.4698107Z Current runner version: '2.329.0' 2025-11-03T15:43:04.4729914Z ##[group]Runner Image Provisioner 2025-11-03T15:43:04.4731013Z Hosted Compute Agent 2025-11-03T15:43:04.4731918Z Version: 20251016.436 2025-11-03T15:43:04.4732792Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:04.4733874Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:04.4734848Z ##[endgroup] 2025-11-03T15:43:04.4735633Z ##[group]Operating System 2025-11-03T15:43:04.4736486Z Ubuntu 2025-11-03T15:43:04.4737558Z 24.04.3 2025-11-03T15:43:04.4738445Z LTS 2025-11-03T15:43:04.4739246Z ##[endgroup] 2025-11-03T15:43:04.4740379Z ##[group]Runner Image 2025-11-03T15:43:04.4741311Z Image: ubuntu-24.04 2025-11-03T15:43:04.4742211Z Version: 20251030.96.2 2025-11-03T15:43:04.4744063Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:04.4746595Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:04.4748267Z ##[endgroup] 2025-11-03T15:43:04.4750242Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:04.4753051Z Contents: read 2025-11-03T15:43:04.4754028Z Metadata: read 2025-11-03T15:43:04.4754796Z ##[endgroup] 2025-11-03T15:43:04.4757477Z Secret source: Actions 2025-11-03T15:43:04.4759508Z Prepare workflow directory 2025-11-03T15:43:04.5396776Z Prepare all required actions 2025-11-03T15:43:04.5476237Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:04.5483664Z ##[group] Inputs 2025-11-03T15:43:04.5484572Z check_experiments: 2025-11-03T15:43:04.5485515Z opt_out_experiments: lf 2025-11-03T15:43:04.5486359Z triggering_actor: pytorchmergebot 2025-11-03T15:43:04.5487482Z issue_owner: 2025-11-03T15:43:04.5488256Z curr_branch: main 2025-11-03T15:43:04.5489049Z curr_ref_type: branch 2025-11-03T15:43:04.5490489Z issue_number: 5132 2025-11-03T15:43:04.5491476Z ##[endgroup] 2025-11-03T15:43:04.5492436Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:05.1220569Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:05.1223018Z cat < runner_determinator.py 2025-11-03T15:43:05.1223749Z # flake8: noqa: G004 2025-11-03T15:43:05.1224339Z  2025-11-03T15:43:05.1225284Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:05.1226373Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:05.1227417Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:05.1228161Z  2025-11-03T15:43:05.1228637Z """ 2025-11-03T15:43:05.1229422Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:05.1230875Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:05.1232185Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:05.1233313Z of which runners should be used to run which job. 2025-11-03T15:43:05.1234030Z  2025-11-03T15:43:05.1234738Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:05.1235888Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:05.1236957Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:05.1237791Z list, defined. 2025-11-03T15:43:05.1238426Z  2025-11-03T15:43:05.1239116Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:05.1240361Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:05.1241446Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:05.1242177Z  2025-11-03T15:43:05.1243204Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:05.1244273Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:05.1245228Z experiments which the user could be opted in to. 2025-11-03T15:43:05.1245895Z  2025-11-03T15:43:05.1246464Z The user list has the following rules: 2025-11-03T15:43:05.1247361Z  2025-11-03T15:43:05.1248054Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:05.1249136Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:05.1250265Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:05.1250970Z  2025-11-03T15:43:05.1251500Z Example config: 2025-11-03T15:43:05.1252130Z  # A list of experiments that can be opted into. 2025-11-03T15:43:05.1253005Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:05.1329589Z  # Expected syntax is: 2025-11-03T15:43:05.1330767Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:05.1332311Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:05.1333137Z  2025-11-03T15:43:05.1333559Z  experiments: 2025-11-03T15:43:05.1334016Z  lf: 2025-11-03T15:43:05.1334455Z  rollout_percent: 25 2025-11-03T15:43:05.1334992Z  all_branches: false 2025-11-03T15:43:05.1335506Z  default: true 2025-11-03T15:43:05.1335973Z  --- 2025-11-03T15:43:05.1336364Z  2025-11-03T15:43:05.1336742Z  # Opt-ins: 2025-11-03T15:43:05.1337413Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:05.1338609Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:05.1339508Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:05.1340387Z  # Experiments should be from the above list. 2025-11-03T15:43:05.1340977Z  2025-11-03T15:43:05.1341384Z  @User1,-lf,split_build 2025-11-03T15:43:05.1341902Z  @User2,lf 2025-11-03T15:43:05.1342358Z  @User3,split_build 2025-11-03T15:43:05.1342842Z """ 2025-11-03T15:43:05.1343222Z  2025-11-03T15:43:05.1343604Z import json 2025-11-03T15:43:05.1344036Z import logging 2025-11-03T15:43:05.1344480Z import os 2025-11-03T15:43:05.1344906Z import random 2025-11-03T15:43:05.1345343Z import re 2025-11-03T15:43:05.1345763Z import sys 2025-11-03T15:43:05.1346231Z from argparse import ArgumentParser 2025-11-03T15:43:05.1346913Z from collections.abc import Iterable 2025-11-03T15:43:05.1347503Z from functools import cache 2025-11-03T15:43:05.1348042Z from logging import LogRecord 2025-11-03T15:43:05.1348617Z from typing import Any, NamedTuple 2025-11-03T15:43:05.1349237Z from urllib.request import Request, urlopen 2025-11-03T15:43:05.1349932Z  2025-11-03T15:43:05.1350316Z import yaml 2025-11-03T15:43:05.1350787Z from github import Auth, Github 2025-11-03T15:43:05.1351355Z from github.Issue import Issue 2025-11-03T15:43:05.1351868Z  2025-11-03T15:43:05.1352235Z  2025-11-03T15:43:05.1352693Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:05.1353465Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:05.1354433Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:05.1355195Z  2025-11-03T15:43:05.1355867Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:05.1356508Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:05.1357107Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:05.1357763Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:05.1358337Z  2025-11-03T15:43:05.1358770Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:05.1359312Z  2025-11-03T15:43:05.1359814Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:05.1360357Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:05.1360857Z  2025-11-03T15:43:05.1361224Z  2025-11-03T15:43:05.1361637Z class Experiment(NamedTuple): 2025-11-03T15:43:05.1362186Z  rollout_perc: float = ( 2025-11-03T15:43:05.1362926Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:05.1363654Z  ) 2025-11-03T15:43:05.1364077Z  all_branches: bool = ( 2025-11-03T15:43:05.1364809Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:05.1365535Z  ) 2025-11-03T15:43:05.1365949Z  default: bool = ( 2025-11-03T15:43:05.1366610Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:05.1367332Z  ) 2025-11-03T15:43:05.1367722Z  2025-11-03T15:43:05.1368133Z  # Add more fields as needed 2025-11-03T15:43:05.1368641Z  2025-11-03T15:43:05.1369012Z  2025-11-03T15:43:05.1369410Z class Settings(NamedTuple): 2025-11-03T15:43:05.1370182Z  """ 2025-11-03T15:43:05.1370724Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:05.1371356Z  """ 2025-11-03T15:43:05.1371748Z  2025-11-03T15:43:05.1372192Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:05.1372771Z  2025-11-03T15:43:05.1373324Z  2025-11-03T15:43:05.1373802Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:05.1374513Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:05.1375149Z  2025-11-03T15:43:05.1375525Z  COLORS = { 2025-11-03T15:43:05.1376002Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:05.1376571Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:05.1377125Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:05.1377689Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:05.1378236Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:05.1378759Z  } 2025-11-03T15:43:05.1379148Z  2025-11-03T15:43:05.1379607Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:05.1380662Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:05.1381518Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:05.1382165Z  return super().format(record) 2025-11-03T15:43:05.1382694Z  2025-11-03T15:43:05.1383064Z  2025-11-03T15:43:05.1383488Z handler = logging.StreamHandler() 2025-11-03T15:43:05.1384288Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:05.1385053Z  2025-11-03T15:43:05.1385555Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:05.1386206Z log.addHandler(handler) 2025-11-03T15:43:05.1386744Z log.setLevel(logging.INFO) 2025-11-03T15:43:05.1387252Z  2025-11-03T15:43:05.1387621Z  2025-11-03T15:43:05.1388121Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:05.1388753Z  """ 2025-11-03T15:43:05.1389334Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:05.1390277Z  """ 2025-11-03T15:43:05.1390693Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:05.1391860Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:05.1393057Z  log.warning( 2025-11-03T15:43:05.1394018Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:05.1395001Z  ) 2025-11-03T15:43:05.1395495Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:05.1396092Z  return 2025-11-03T15:43:05.1396524Z  2025-11-03T15:43:05.1396957Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:05.1397595Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:05.1398228Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:05.1398775Z  2025-11-03T15:43:05.1399154Z  2025-11-03T15:43:05.1399813Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:05.1400529Z  return frozenset( 2025-11-03T15:43:05.1401231Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:05.1401956Z  ) 2025-11-03T15:43:05.1402360Z  2025-11-03T15:43:05.1402721Z  2025-11-03T15:43:05.1403126Z def parse_args() -> Any: 2025-11-03T15:43:05.1403784Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:05.1404726Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:05.1405555Z  parser.add_argument( 2025-11-03T15:43:05.1406085Z  "--github-issue-repo", 2025-11-03T15:43:05.1406624Z  type=str, 2025-11-03T15:43:05.1407100Z  required=False, 2025-11-03T15:43:05.1407777Z  default="pytorch/test-infra", 2025-11-03T15:43:05.1408415Z  help="GitHub repo to get the issue", 2025-11-03T15:43:05.1408978Z  ) 2025-11-03T15:43:05.1409405Z  parser.add_argument( 2025-11-03T15:43:05.1410187Z  "--github-repo", 2025-11-03T15:43:05.1410722Z  type=str, 2025-11-03T15:43:05.1411203Z  required=True, 2025-11-03T15:43:05.1411761Z  help="GitHub repo where CI is running", 2025-11-03T15:43:05.1412333Z  ) 2025-11-03T15:43:05.1412764Z  parser.add_argument( 2025-11-03T15:43:05.1413469Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:05.1414175Z  ) 2025-11-03T15:43:05.1414599Z  parser.add_argument( 2025-11-03T15:43:05.1415316Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:05.1416059Z  ) 2025-11-03T15:43:05.1416481Z  parser.add_argument( 2025-11-03T15:43:05.1417210Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:05.1417957Z  ) 2025-11-03T15:43:05.1418372Z  parser.add_argument( 2025-11-03T15:43:05.1419128Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:05.1419990Z  ) 2025-11-03T15:43:05.1420436Z  parser.add_argument( 2025-11-03T15:43:05.1420963Z  "--github-ref-type", 2025-11-03T15:43:05.1421488Z  type=str, 2025-11-03T15:43:05.1421975Z  required=True, 2025-11-03T15:43:05.1422565Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:05.1423159Z  ) 2025-11-03T15:43:05.1423589Z  parser.add_argument( 2025-11-03T15:43:05.1424293Z  "--eligible-experiments", 2025-11-03T15:43:05.1424897Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:05.1425474Z  required=False, 2025-11-03T15:43:05.1425976Z  default="", 2025-11-03T15:43:05.1426906Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:05.1427877Z  ) 2025-11-03T15:43:05.1428305Z  parser.add_argument( 2025-11-03T15:43:05.1428837Z  "--opt-out-experiments", 2025-11-03T15:43:05.1429418Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:05.1430122Z  required=False, 2025-11-03T15:43:05.1430623Z  default="", 2025-11-03T15:43:05.1431099Z  help=( 2025-11-03T15:43:05.1431852Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:05.1433073Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:05.1433954Z  ), 2025-11-03T15:43:05.1434370Z  ) 2025-11-03T15:43:05.1434793Z  parser.add_argument( 2025-11-03T15:43:05.1435311Z  "--pr-number", 2025-11-03T15:43:05.1435805Z  type=str, 2025-11-03T15:43:05.1436274Z  required=False, 2025-11-03T15:43:05.1436784Z  default="", 2025-11-03T15:43:05.1437357Z  help="the optional PR number where this is run", 2025-11-03T15:43:05.1437970Z  ) 2025-11-03T15:43:05.1438364Z  2025-11-03T15:43:05.1438782Z  return parser.parse_args() 2025-11-03T15:43:05.1439306Z  2025-11-03T15:43:05.1439774Z  2025-11-03T15:43:05.1440442Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.1441398Z  auth = Auth.Token(github_token) 2025-11-03T15:43:05.1442008Z  return Github(auth=auth) 2025-11-03T15:43:05.1442526Z  2025-11-03T15:43:05.1442902Z  2025-11-03T15:43:05.1443606Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.1444478Z  repo = gh.get_repo(repo) 2025-11-03T15:43:05.1445072Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:05.1445636Z  2025-11-03T15:43:05.1446006Z  2025-11-03T15:43:05.1446410Z def get_potential_pr_author( 2025-11-03T15:43:05.1447151Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:05.1447888Z ) -> str: 2025-11-03T15:43:05.1448501Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:05.1449393Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:05.1450494Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:05.1451125Z  2025-11-03T15:43:05.1451547Z  gh = get_gh_client(github_token) 2025-11-03T15:43:05.1452092Z  2025-11-03T15:43:05.1452605Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:05.1453300Z  split_tag = ref_name.split("/") 2025-11-03T15:43:05.1453863Z  if ( 2025-11-03T15:43:05.1454312Z  len(split_tag) == 3 2025-11-03T15:43:05.1454879Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:05.1455547Z  and split_tag[2].isnumeric() 2025-11-03T15:43:05.1456230Z  ): 2025-11-03T15:43:05.1456697Z  pr_number = split_tag[2] 2025-11-03T15:43:05.1457246Z  try: 2025-11-03T15:43:05.1457755Z  repository = gh.get_repo(repo) 2025-11-03T15:43:05.1458630Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:05.1459314Z  except Exception as e: 2025-11-03T15:43:05.1460437Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:05.1461196Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:05.1461897Z  ) from e 2025-11-03T15:43:05.1462533Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:05.1463313Z  # In all other cases, return the original input username 2025-11-03T15:43:05.1463954Z  return username 2025-11-03T15:43:05.1464418Z  2025-11-03T15:43:05.1464790Z  2025-11-03T15:43:05.1465257Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:05.1465835Z  """ 2025-11-03T15:43:05.1466566Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:05.1467433Z  """ 2025-11-03T15:43:05.1468050Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:05.1468761Z  2025-11-03T15:43:05.1469131Z  2025-11-03T15:43:05.1469563Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:05.1470318Z  try: 2025-11-03T15:43:05.1470779Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:05.1471338Z  return data 2025-11-03T15:43:05.1471841Z  except yaml.YAMLError: 2025-11-03T15:43:05.1472418Z  log.exception("Error loading YAML") 2025-11-03T15:43:05.1472985Z  raise 2025-11-03T15:43:05.1473412Z  2025-11-03T15:43:05.1473777Z  2025-11-03T15:43:05.1474450Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:05.1475239Z  """ 2025-11-03T15:43:05.1476083Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:05.1476889Z  2025-11-03T15:43:05.1477478Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.1478322Z  and the text below is the list of opted in users. 2025-11-03T15:43:05.1478928Z  2025-11-03T15:43:05.1479547Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:05.1480414Z  """ 2025-11-03T15:43:05.1480926Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:05.1481586Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:05.1482268Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:05.1483143Z  else: 2025-11-03T15:43:05.1483584Z  return "", rollout_state 2025-11-03T15:43:05.1484095Z  2025-11-03T15:43:05.1484463Z  2025-11-03T15:43:05.1484907Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:05.1485465Z  """ 2025-11-03T15:43:05.1486052Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:05.1486740Z  """ 2025-11-03T15:43:05.1487121Z  2025-11-03T15:43:05.1487481Z  2025-11-03T15:43:05.1488053Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:05.1488754Z  """ 2025-11-03T15:43:05.1489537Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:05.1490579Z  2025-11-03T15:43:05.1491439Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:05.1492514Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:05.1493416Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:05.1494086Z  2025-11-03T15:43:05.1494445Z  2025-11-03T15:43:05.1494804Z  """ 2025-11-03T15:43:05.1495225Z  optins = UserOptins() 2025-11-03T15:43:05.1495791Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:05.1496403Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:05.1497011Z  if not user or not user.startswith("@"): 2025-11-03T15:43:05.1497616Z  # Not a valid user. Skip 2025-11-03T15:43:05.1498159Z  continue 2025-11-03T15:43:05.1498615Z  2025-11-03T15:43:05.1499028Z  if user: 2025-11-03T15:43:05.1499542Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:05.1500406Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:05.1501093Z  2025-11-03T15:43:05.1501479Z  return optins 2025-11-03T15:43:05.1501919Z  2025-11-03T15:43:05.1502282Z  2025-11-03T15:43:05.1502823Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:05.1503481Z  """ 2025-11-03T15:43:05.1503939Z  Check if the experiment name is valid. 2025-11-03T15:43:05.1504508Z  A valid name: 2025-11-03T15:43:05.1505244Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:05.1506247Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:05.1507009Z  - Cannot contain spaces 2025-11-03T15:43:05.1507526Z  """ 2025-11-03T15:43:05.1507907Z  2025-11-03T15:43:05.1508410Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:05.1509185Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:05.1510145Z  2025-11-03T15:43:05.1510710Z  if valid: 2025-11-03T15:43:05.1511161Z  return True 2025-11-03T15:43:05.1511616Z  2025-11-03T15:43:05.1511991Z  log.error( 2025-11-03T15:43:05.1513536Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-11-03T15:43:05.1515132Z  ) 2025-11-03T15:43:05.1515540Z  return False 2025-11-03T15:43:05.1515983Z  2025-11-03T15:43:05.1516338Z  2025-11-03T15:43:05.1516891Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:05.1517571Z  """ 2025-11-03T15:43:05.1518227Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:05.1518985Z  """ 2025-11-03T15:43:05.1519379Z  try: 2025-11-03T15:43:05.1519893Z  if settings_text: 2025-11-03T15:43:05.1520708Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:05.1521545Z  # for easy reading 2025-11-03T15:43:05.1522428Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:05.1523386Z  # the backtick character in shell commands. 2025-11-03T15:43:05.1524042Z  backtick = chr(96) # backtick character 2025-11-03T15:43:05.1524777Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:05.1525504Z  settings = load_yaml(settings_text) 2025-11-03T15:43:05.1526055Z  2025-11-03T15:43:05.1526708Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:05.1527639Z  experiments = {} 2025-11-03T15:43:05.1528141Z  2025-11-03T15:43:05.1528752Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:05.1529569Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:05.1530887Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-11-03T15:43:05.1531987Z  continue 2025-11-03T15:43:05.1532482Z  2025-11-03T15:43:05.1532887Z  valid_settings = {} 2025-11-03T15:43:05.1533472Z  for setting in exp_settings: 2025-11-03T15:43:05.1534100Z  if setting not in Experiment._fields: 2025-11-03T15:43:05.1534712Z  log.warning( 2025-11-03T15:43:05.1535510Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:05.1536261Z  ) 2025-11-03T15:43:05.1536751Z  else: 2025-11-03T15:43:05.1537347Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:05.1537951Z  2025-11-03T15:43:05.1538464Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:05.1539153Z  return Settings(experiments) 2025-11-03T15:43:05.1539810Z  2025-11-03T15:43:05.1540208Z  except Exception: 2025-11-03T15:43:05.1540775Z  log.exception("Failed to parse settings") 2025-11-03T15:43:05.1541352Z  2025-11-03T15:43:05.1541733Z  return Settings() 2025-11-03T15:43:05.1542202Z  2025-11-03T15:43:05.1542559Z  2025-11-03T15:43:05.1543199Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:05.1543837Z  """ 2025-11-03T15:43:05.1544339Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:05.1544926Z  2025-11-03T15:43:05.1545504Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.1546324Z  and the text below is the list of opted in users. 2025-11-03T15:43:05.1546922Z  2025-11-03T15:43:05.1547563Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:05.1548328Z  """ 2025-11-03T15:43:05.1548941Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.1549863Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:05.1550452Z  2025-11-03T15:43:05.1550807Z  2025-11-03T15:43:05.1551302Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:05.1551913Z  """ 2025-11-03T15:43:05.1552373Z  Parse users from the rollout state. 2025-11-03T15:43:05.1552916Z  2025-11-03T15:43:05.1553279Z  """ 2025-11-03T15:43:05.1553882Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.1554688Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:05.1555273Z  2025-11-03T15:43:05.1555641Z  2025-11-03T15:43:05.1556305Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.1557104Z  """ 2025-11-03T15:43:05.1557583Z  Check if a user is opted into an experiment 2025-11-03T15:43:05.1558163Z  """ 2025-11-03T15:43:05.1558674Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:05.1559302Z  2025-11-03T15:43:05.1559888Z  2025-11-03T15:43:05.1560578Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.1561382Z  """ 2025-11-03T15:43:05.1561906Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:05.1562529Z  """ 2025-11-03T15:43:05.1563101Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:05.1563863Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:05.1564576Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:05.1565225Z  return False 2025-11-03T15:43:05.1565684Z  2025-11-03T15:43:05.1566181Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:05.1566833Z  log.warning( 2025-11-03T15:43:05.1567764Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:05.1568697Z  ) 2025-11-03T15:43:05.1569106Z  2025-11-03T15:43:05.1569485Z  return True 2025-11-03T15:43:05.1570053Z  2025-11-03T15:43:05.1570411Z  2025-11-03T15:43:05.1570801Z def get_runner_prefix( 2025-11-03T15:43:05.1571302Z  rollout_state: str, 2025-11-03T15:43:05.1571857Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:05.1572409Z  branch: str, 2025-11-03T15:43:05.1572985Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.1573719Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.1574351Z  is_canary: bool = False, 2025-11-03T15:43:05.1574859Z ) -> str: 2025-11-03T15:43:05.1575352Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:05.1576005Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:05.1576571Z  2025-11-03T15:43:05.1577084Z  fleet_prefix = "" 2025-11-03T15:43:05.1577576Z  prefixes = [] 2025-11-03T15:43:05.1578288Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:05.1579285Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:05.1580147Z  log.info( 2025-11-03T15:43:05.1580902Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:05.1581687Z  ) 2025-11-03T15:43:05.1582145Z  continue 2025-11-03T15:43:05.1582597Z  2025-11-03T15:43:05.1583004Z  if opt_out_experiments: 2025-11-03T15:43:05.1583613Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:05.1584319Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:05.1584964Z  log.info( 2025-11-03T15:43:05.1586001Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:05.1587027Z  ) 2025-11-03T15:43:05.1587498Z  continue 2025-11-03T15:43:05.1587966Z  2025-11-03T15:43:05.1588380Z  if eligible_experiments: 2025-11-03T15:43:05.1589014Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:05.1589802Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:05.1590404Z  log.info( 2025-11-03T15:43:05.1591450Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:05.1592344Z  ) 2025-11-03T15:43:05.1592804Z  continue 2025-11-03T15:43:05.1593522Z  elif not experiment_settings.default: 2025-11-03T15:43:05.1594095Z  log.info( 2025-11-03T15:43:05.1594836Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:05.1595603Z  ) 2025-11-03T15:43:05.1596049Z  continue 2025-11-03T15:43:05.1596502Z  2025-11-03T15:43:05.1597013Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:05.1597682Z  opted_out_users = [ 2025-11-03T15:43:05.1598197Z  requestor 2025-11-03T15:43:05.1598732Z  for requestor in workflow_requestors 2025-11-03T15:43:05.1599459Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.1600381Z  ] 2025-11-03T15:43:05.1600796Z  2025-11-03T15:43:05.1601192Z  if opted_out_users: 2025-11-03T15:43:05.1601721Z  log.info( 2025-11-03T15:43:05.1602432Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:05.1603172Z  ) 2025-11-03T15:43:05.1603804Z  continue 2025-11-03T15:43:05.1604329Z  2025-11-03T15:43:05.1604867Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:05.1605532Z  opted_in_users = [ 2025-11-03T15:43:05.1606065Z  requestor 2025-11-03T15:43:05.1606606Z  for requestor in workflow_requestors 2025-11-03T15:43:05.1607347Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.1608004Z  ] 2025-11-03T15:43:05.1608406Z  2025-11-03T15:43:05.1608793Z  enabled = False 2025-11-03T15:43:05.1609298Z  if opted_in_users: 2025-11-03T15:43:05.1610166Z  log.info( 2025-11-03T15:43:05.1611013Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:05.1611739Z  ) 2025-11-03T15:43:05.1612190Z  enabled = True 2025-11-03T15:43:05.1612681Z  2025-11-03T15:43:05.1613126Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:05.1614016Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:05.1615018Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:05.1615808Z  log.info( 2025-11-03T15:43:05.1616754Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:05.1617782Z  ) 2025-11-03T15:43:05.1618314Z  enabled = True 2025-11-03T15:43:05.1618819Z  2025-11-03T15:43:05.1619205Z  if enabled: 2025-11-03T15:43:05.1619867Z  label = experiment_name 2025-11-03T15:43:05.1620500Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:05.1621382Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:05.1622307Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:05.1623137Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:05.1623851Z  if is_canary: 2025-11-03T15:43:05.1624520Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:05.1625120Z  fleet_prefix = label 2025-11-03T15:43:05.1625654Z  else: 2025-11-03T15:43:05.1626315Z  prefixes.append(label) 2025-11-03T15:43:05.1626849Z  2025-11-03T15:43:05.1627243Z  if len(prefixes) > 1: 2025-11-03T15:43:05.1627749Z  log.error( 2025-11-03T15:43:05.1628963Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-11-03T15:43:05.1630348Z  ) 2025-11-03T15:43:05.1630793Z  prefixes = prefixes[:1] 2025-11-03T15:43:05.1631309Z  2025-11-03T15:43:05.1631706Z  # Fleet always comes first 2025-11-03T15:43:05.1632249Z  if fleet_prefix: 2025-11-03T15:43:05.1632869Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:05.1633414Z  2025-11-03T15:43:05.1633909Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:05.1634513Z  2025-11-03T15:43:05.1634888Z  2025-11-03T15:43:05.1635573Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:05.1636381Z  """ 2025-11-03T15:43:05.1637020Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:05.1637767Z  2025-11-03T15:43:05.1638383Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:05.1639122Z  """ 2025-11-03T15:43:05.1639569Z  gh = get_gh_client(github_token) 2025-11-03T15:43:05.1640298Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:05.1641006Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:05.1641635Z  2025-11-03T15:43:05.1642080Z  2025-11-03T15:43:05.1642733Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:05.1643682Z  for _ in range(num_retries): 2025-11-03T15:43:05.1644216Z  try: 2025-11-03T15:43:05.1644700Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:05.1645419Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:05.1646109Z  return json.loads(content) 2025-11-03T15:43:05.1646685Z  except Exception as e: 2025-11-03T15:43:05.1647300Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:05.1647881Z  2025-11-03T15:43:05.1648503Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:05.1649255Z  return {} 2025-11-03T15:43:05.1649787Z  2025-11-03T15:43:05.1650154Z  2025-11-03T15:43:05.1650519Z @cache 2025-11-03T15:43:05.1651216Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:05.1652028Z  """ 2025-11-03T15:43:05.1652477Z  Dynamically get PR information 2025-11-03T15:43:05.1653011Z  """ 2025-11-03T15:43:05.1653571Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:05.1654234Z  headers = { 2025-11-03T15:43:05.1654766Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:05.1655425Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:05.1655997Z  } 2025-11-03T15:43:05.1656485Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:05.1657140Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:05.1657730Z  headers=headers, 2025-11-03T15:43:05.1658205Z  ) 2025-11-03T15:43:05.1658592Z  2025-11-03T15:43:05.1658979Z  if not json_response: 2025-11-03T15:43:05.1659629Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:05.1660576Z  return {} 2025-11-03T15:43:05.1661023Z  2025-11-03T15:43:05.1661423Z  return json_response 2025-11-03T15:43:05.1661907Z  2025-11-03T15:43:05.1662275Z  2025-11-03T15:43:05.1662910Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:05.1663674Z  """ 2025-11-03T15:43:05.1664257Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:05.1664953Z  """ 2025-11-03T15:43:05.1665503Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:05.1666149Z  return { 2025-11-03T15:43:05.1666801Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:05.1667555Z  } 2025-11-03T15:43:05.1667946Z  2025-11-03T15:43:05.1668309Z  2025-11-03T15:43:05.1668714Z def main() -> None: 2025-11-03T15:43:05.1669187Z  args = parse_args() 2025-11-03T15:43:05.1669666Z  2025-11-03T15:43:05.1670222Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:05.1670788Z  2025-11-03T15:43:05.1671191Z  # Check if the PR is opt-out 2025-11-03T15:43:05.1671726Z  if args.pr_number: 2025-11-03T15:43:05.1672463Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:05.1673260Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:05.1673810Z  log.info( 2025-11-03T15:43:05.1674574Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:05.1675357Z  ) 2025-11-03T15:43:05.1675976Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.1676702Z  sys.exit() 2025-11-03T15:43:05.1677290Z  2025-11-03T15:43:05.1677662Z  try: 2025-11-03T15:43:05.1678164Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:05.1678927Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:05.1679599Z  ) 2025-11-03T15:43:05.1680109Z  2025-11-03T15:43:05.1680534Z  username = get_potential_pr_author( 2025-11-03T15:43:05.1681108Z  args.github_token, 2025-11-03T15:43:05.1681642Z  args.github_repo, 2025-11-03T15:43:05.1682173Z  args.github_actor, 2025-11-03T15:43:05.1682719Z  args.github_ref_type, 2025-11-03T15:43:05.1683270Z  args.github_branch, 2025-11-03T15:43:05.1683773Z  ) 2025-11-03T15:43:05.1684166Z  2025-11-03T15:43:05.1684690Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:05.1685335Z  2025-11-03T15:43:05.1685780Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:05.1686367Z  rollout_state, 2025-11-03T15:43:05.1686924Z  (args.github_issue_owner, username), 2025-11-03T15:43:05.1687516Z  args.github_branch, 2025-11-03T15:43:05.1688077Z  args.eligible_experiments, 2025-11-03T15:43:05.1688667Z  args.opt_out_experiments, 2025-11-03T15:43:05.1689208Z  is_canary, 2025-11-03T15:43:05.1689773Z  ) 2025-11-03T15:43:05.1690176Z  2025-11-03T15:43:05.1690581Z  except Exception as e: 2025-11-03T15:43:05.1691088Z  log.error( 2025-11-03T15:43:05.1691844Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:05.1692653Z  ) 2025-11-03T15:43:05.1693204Z  2025-11-03T15:43:05.1693780Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.1694468Z  2025-11-03T15:43:05.1694834Z  2025-11-03T15:43:05.1695221Z if __name__ == "__main__": 2025-11-03T15:43:05.1695717Z  main() 2025-11-03T15:43:05.1696119Z  2025-11-03T15:43:05.1696481Z EOF 2025-11-03T15:43:05.1696854Z  2025-11-03T15:43:05.1697265Z cat runner_determinator.py 2025-11-03T15:43:05.4560763Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:05.4561785Z env: 2025-11-03T15:43:05.4562675Z GITHUB_TOKEN: *** 2025-11-03T15:43:05.4563302Z ISSUE_NUMBER: 5132 2025-11-03T15:43:05.4563940Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:05.4564660Z ISSUE_OWNER: 2025-11-03T15:43:05.4565229Z CHECK_EXPERIMENTS: 2025-11-03T15:43:05.4565854Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:05.4566480Z PR_NUMBER: 2025-11-03T15:43:05.4567066Z ##[endgroup] 2025-11-03T15:43:05.4769099Z # flake8: noqa: G004 2025-11-03T15:43:05.4769969Z 2025-11-03T15:43:05.4770880Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:05.4772856Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:05.4774570Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:05.4775523Z 2025-11-03T15:43:05.4775928Z """ 2025-11-03T15:43:05.4777257Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:05.4779142Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:05.4781925Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:05.4783804Z of which runners should be used to run which job. 2025-11-03T15:43:05.4784733Z 2025-11-03T15:43:05.4785645Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:05.4788027Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:05.4790445Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:05.4792117Z list, defined. 2025-11-03T15:43:05.4792692Z 2025-11-03T15:43:05.4793575Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:05.4796522Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:05.4798722Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:05.4800203Z 2025-11-03T15:43:05.4801182Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:05.4803447Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:05.4805351Z experiments which the user could be opted in to. 2025-11-03T15:43:05.4806398Z 2025-11-03T15:43:05.4806944Z The user list has the following rules: 2025-11-03T15:43:05.4807848Z 2025-11-03T15:43:05.4808654Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:05.4811059Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:05.4813013Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:05.4814016Z 2025-11-03T15:43:05.4814450Z Example config: 2025-11-03T15:43:05.4815612Z # A list of experiments that can be opted into. 2025-11-03T15:43:05.4817312Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:05.4818901Z # Expected syntax is: 2025-11-03T15:43:05.4820678Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:05.4823158Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:05.4824720Z 2025-11-03T15:43:05.4825123Z experiments: 2025-11-03T15:43:05.4826043Z lf: 2025-11-03T15:43:05.4826925Z rollout_percent: 25 2025-11-03T15:43:05.4828207Z all_branches: false 2025-11-03T15:43:05.4829302Z default: true 2025-11-03T15:43:05.4830430Z --- 2025-11-03T15:43:05.4830899Z 2025-11-03T15:43:05.4831262Z # Opt-ins: 2025-11-03T15:43:05.4832649Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:05.4834774Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:05.4836636Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:05.4838230Z # Experiments should be from the above list. 2025-11-03T15:43:05.4839181Z 2025-11-03T15:43:05.4839583Z @User1,-lf,split_build 2025-11-03T15:43:05.4840848Z @User2,lf 2025-11-03T15:43:05.4841742Z @User3,split_build 2025-11-03T15:43:05.4842693Z """ 2025-11-03T15:43:05.4843154Z 2025-11-03T15:43:05.4843513Z import json 2025-11-03T15:43:05.4844373Z import logging 2025-11-03T15:43:05.4845250Z import os 2025-11-03T15:43:05.4846091Z import random 2025-11-03T15:43:05.4846957Z import re 2025-11-03T15:43:05.4847798Z import sys 2025-11-03T15:43:05.4848720Z from argparse import ArgumentParser 2025-11-03T15:43:05.4850196Z from collections.abc import Iterable 2025-11-03T15:43:05.4851457Z from functools import cache 2025-11-03T15:43:05.4852575Z from logging import LogRecord 2025-11-03T15:43:05.4853736Z from typing import Any, NamedTuple 2025-11-03T15:43:05.4855021Z from urllib.request import Request, urlopen 2025-11-03T15:43:05.4855937Z 2025-11-03T15:43:05.4856311Z import yaml 2025-11-03T15:43:05.4857205Z from github import Auth, Github 2025-11-03T15:43:05.4858354Z from github.Issue import Issue 2025-11-03T15:43:05.4859085Z 2025-11-03T15:43:05.4859094Z 2025-11-03T15:43:05.4859582Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:05.4861399Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:05.4863491Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:05.4864840Z 2025-11-03T15:43:05.4865364Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:05.4866872Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:05.4868087Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:05.4869418Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:05.4870456Z 2025-11-03T15:43:05.4870911Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:05.4871731Z 2025-11-03T15:43:05.4872146Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:05.4873229Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:05.4873919Z 2025-11-03T15:43:05.4873927Z 2025-11-03T15:43:05.4874346Z class Experiment(NamedTuple): 2025-11-03T15:43:05.4875465Z rollout_perc: float = ( 2025-11-03T15:43:05.4877001Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:05.4878692Z ) 2025-11-03T15:43:05.4879542Z all_branches: bool = ( 2025-11-03T15:43:05.4881299Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:05.4882988Z ) 2025-11-03T15:43:05.4883821Z default: bool = ( 2025-11-03T15:43:05.4885201Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:05.4886764Z ) 2025-11-03T15:43:05.4887200Z 2025-11-03T15:43:05.4887575Z # Add more fields as needed 2025-11-03T15:43:05.4888267Z 2025-11-03T15:43:05.4888275Z 2025-11-03T15:43:05.4888664Z class Settings(NamedTuple): 2025-11-03T15:43:05.4889662Z """ 2025-11-03T15:43:05.4890869Z Settings for the experiments that can be opted into. 2025-11-03T15:43:05.4892221Z """ 2025-11-03T15:43:05.4892663Z 2025-11-03T15:43:05.4893107Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:05.4893989Z 2025-11-03T15:43:05.4893997Z 2025-11-03T15:43:05.4894452Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:05.4895919Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:05.4896984Z 2025-11-03T15:43:05.4897327Z COLORS = { 2025-11-03T15:43:05.4898215Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:05.4899521Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:05.4900833Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:05.4901974Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:05.4903058Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:05.4904117Z } 2025-11-03T15:43:05.4904550Z 2025-11-03T15:43:05.4905013Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:05.4906811Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:05.4908670Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:05.4910186Z return super().format(record) 2025-11-03T15:43:05.4910976Z 2025-11-03T15:43:05.4910985Z 2025-11-03T15:43:05.4911394Z handler = logging.StreamHandler() 2025-11-03T15:43:05.4913089Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:05.4914463Z 2025-11-03T15:43:05.4915008Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:05.4916339Z log.addHandler(handler) 2025-11-03T15:43:05.4917339Z log.setLevel(logging.INFO) 2025-11-03T15:43:05.4918002Z 2025-11-03T15:43:05.4918009Z 2025-11-03T15:43:05.4918545Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:05.4920042Z """ 2025-11-03T15:43:05.4921204Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:05.4922676Z """ 2025-11-03T15:43:05.4923459Z if not GITHUB_OUTPUT: 2025-11-03T15:43:05.4926193Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:05.4929025Z log.warning( 2025-11-03T15:43:05.4931325Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:05.4933592Z ) 2025-11-03T15:43:05.4943853Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:05.4945154Z return 2025-11-03T15:43:05.4945658Z 2025-11-03T15:43:05.4946262Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:05.4947586Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:05.4948885Z f.write(f"{key}={value}\n") 2025-11-03T15:43:05.4949630Z 2025-11-03T15:43:05.4949638Z 2025-11-03T15:43:05.4950500Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:05.4951963Z return frozenset( 2025-11-03T15:43:05.4953376Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:05.4954976Z ) 2025-11-03T15:43:05.4955409Z 2025-11-03T15:43:05.4955416Z 2025-11-03T15:43:05.4955788Z def parse_args() -> Any: 2025-11-03T15:43:05.4957013Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:05.4959046Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:05.4960942Z parser.add_argument( 2025-11-03T15:43:05.4961943Z "--github-issue-repo", 2025-11-03T15:43:05.4962959Z type=str, 2025-11-03T15:43:05.4963817Z required=False, 2025-11-03T15:43:05.4964795Z default="pytorch/test-infra", 2025-11-03T15:43:05.5014908Z help="GitHub repo to get the issue", 2025-11-03T15:43:05.5016548Z ) 2025-11-03T15:43:05.5017368Z parser.add_argument( 2025-11-03T15:43:05.5018427Z "--github-repo", 2025-11-03T15:43:05.5019489Z type=str, 2025-11-03T15:43:05.5020703Z required=True, 2025-11-03T15:43:05.5021961Z help="GitHub repo where CI is running", 2025-11-03T15:43:05.5023198Z ) 2025-11-03T15:43:05.5023979Z parser.add_argument( 2025-11-03T15:43:05.5025375Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:05.5026918Z ) 2025-11-03T15:43:05.5027720Z parser.add_argument( 2025-11-03T15:43:05.5029204Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:05.5031004Z ) 2025-11-03T15:43:05.5031786Z parser.add_argument( 2025-11-03T15:43:05.5033468Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:05.5035047Z ) 2025-11-03T15:43:05.5035829Z parser.add_argument( 2025-11-03T15:43:05.5037337Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:05.5038984Z ) 2025-11-03T15:43:05.5039951Z parser.add_argument( 2025-11-03T15:43:05.5040942Z "--github-ref-type", 2025-11-03T15:43:05.5041921Z type=str, 2025-11-03T15:43:05.5042799Z required=True, 2025-11-03T15:43:05.5043852Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:05.5045083Z ) 2025-11-03T15:43:05.5045879Z parser.add_argument( 2025-11-03T15:43:05.5046873Z "--eligible-experiments", 2025-11-03T15:43:05.5047976Z type=_str_comma_separated_to_set, 2025-11-03T15:43:05.5049125Z required=False, 2025-11-03T15:43:05.5050192Z default="", 2025-11-03T15:43:05.5052191Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:05.5054370Z ) 2025-11-03T15:43:05.5055155Z parser.add_argument( 2025-11-03T15:43:05.5056132Z "--opt-out-experiments", 2025-11-03T15:43:05.5057225Z type=_str_comma_separated_to_set, 2025-11-03T15:43:05.5058365Z required=False, 2025-11-03T15:43:05.5059257Z default="", 2025-11-03T15:43:05.5060322Z help=( 2025-11-03T15:43:05.5061832Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:05.5064482Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:05.5066405Z ), 2025-11-03T15:43:05.5067159Z ) 2025-11-03T15:43:05.5067930Z parser.add_argument( 2025-11-03T15:43:05.5068865Z "--pr-number", 2025-11-03T15:43:05.5069929Z type=str, 2025-11-03T15:43:05.5070786Z required=False, 2025-11-03T15:43:05.5071697Z default="", 2025-11-03T15:43:05.5072898Z help="the optional PR number where this is run", 2025-11-03T15:43:05.5074138Z ) 2025-11-03T15:43:05.5074567Z 2025-11-03T15:43:05.5074952Z return parser.parse_args() 2025-11-03T15:43:05.5075650Z 2025-11-03T15:43:05.5075657Z 2025-11-03T15:43:05.5076552Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.5078231Z auth = Auth.Token(github_token) 2025-11-03T15:43:05.5079316Z return Github(auth=auth) 2025-11-03T15:43:05.5080108Z 2025-11-03T15:43:05.5080115Z 2025-11-03T15:43:05.5081126Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.5082927Z repo = gh.get_repo(repo) 2025-11-03T15:43:05.5083968Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:05.5084759Z 2025-11-03T15:43:05.5084767Z 2025-11-03T15:43:05.5085139Z def get_potential_pr_author( 2025-11-03T15:43:05.5086545Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:05.5088011Z ) -> str: 2025-11-03T15:43:05.5089132Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:05.5091162Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:05.5092760Z # embedded in the tag name: ciflow// 2025-11-03T15:43:05.5093672Z 2025-11-03T15:43:05.5094049Z gh = get_gh_client(github_token) 2025-11-03T15:43:05.5094772Z 2025-11-03T15:43:05.5095324Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:05.5096633Z split_tag = ref_name.split("/") 2025-11-03T15:43:05.5097690Z if ( 2025-11-03T15:43:05.5098470Z len(split_tag) == 3 2025-11-03T15:43:05.5099501Z and split_tag[0] == "ciflow" 2025-11-03T15:43:05.5100927Z and split_tag[2].isnumeric() 2025-11-03T15:43:05.5101997Z ): 2025-11-03T15:43:05.5102801Z pr_number = split_tag[2] 2025-11-03T15:43:05.5104037Z try: 2025-11-03T15:43:05.5104950Z repository = gh.get_repo(repo) 2025-11-03T15:43:05.5106306Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:05.5107635Z except Exception as e: 2025-11-03T15:43:05.5108751Z raise Exception( # noqa: TRY002 2025-11-03T15:43:05.5110689Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:05.5112127Z ) from e 2025-11-03T15:43:05.5113316Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:05.5114886Z # In all other cases, return the original input username 2025-11-03T15:43:05.5116191Z return username 2025-11-03T15:43:05.5116717Z 2025-11-03T15:43:05.5116724Z 2025-11-03T15:43:05.5117194Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:05.5118349Z """ 2025-11-03T15:43:05.5119877Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:05.5121625Z """ 2025-11-03T15:43:05.5122823Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:05.5123998Z 2025-11-03T15:43:05.5124007Z 2025-11-03T15:43:05.5124408Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:05.5125474Z try: 2025-11-03T15:43:05.5126286Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:05.5127385Z return data 2025-11-03T15:43:05.5128266Z except yaml.YAMLError: 2025-11-03T15:43:05.5129316Z log.exception("Error loading YAML") 2025-11-03T15:43:05.5130524Z raise 2025-11-03T15:43:05.5131010Z 2025-11-03T15:43:05.5131019Z 2025-11-03T15:43:05.5131965Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:05.5133589Z """ 2025-11-03T15:43:05.5134958Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:05.5136332Z 2025-11-03T15:43:05.5137229Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.5138930Z and the text below is the list of opted in users. 2025-11-03T15:43:05.5140117Z 2025-11-03T15:43:05.5140973Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:05.5142524Z """ 2025-11-03T15:43:05.5143456Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:05.5144749Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:05.5146077Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:05.5147349Z else: 2025-11-03T15:43:05.5148161Z return "", rollout_state 2025-11-03T15:43:05.5148836Z 2025-11-03T15:43:05.5148843Z 2025-11-03T15:43:05.5149260Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:05.5150456Z """ 2025-11-03T15:43:05.5151575Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:05.5153004Z """ 2025-11-03T15:43:05.5153434Z 2025-11-03T15:43:05.5153454Z 2025-11-03T15:43:05.5154187Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:05.5155620Z """ 2025-11-03T15:43:05.5157239Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:05.5158805Z 2025-11-03T15:43:05.5160373Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:05.5162602Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:05.5164084Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:05.5165176Z 2025-11-03T15:43:05.5165184Z 2025-11-03T15:43:05.5165496Z """ 2025-11-03T15:43:05.5166281Z optins = UserOptins() 2025-11-03T15:43:05.5167305Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:05.5168495Z user = user.strip("\r\n\t -") 2025-11-03T15:43:05.5169649Z if not user or not user.startswith("@"): 2025-11-03T15:43:05.5171114Z # Not a valid user. Skip 2025-11-03T15:43:05.5172203Z continue 2025-11-03T15:43:05.5172737Z 2025-11-03T15:43:05.5173053Z if user: 2025-11-03T15:43:05.5174023Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:05.5175555Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:05.5176687Z 2025-11-03T15:43:05.5177028Z return optins 2025-11-03T15:43:05.5177539Z 2025-11-03T15:43:05.5177547Z 2025-11-03T15:43:05.5178142Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:05.5179426Z """ 2025-11-03T15:43:05.5180525Z Check if the experiment name is valid. 2025-11-03T15:43:05.5181664Z A valid name: 2025-11-03T15:43:05.5183080Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:05.5185338Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:05.5186934Z - Cannot contain spaces 2025-11-03T15:43:05.5187917Z """ 2025-11-03T15:43:05.5188344Z 2025-11-03T15:43:05.5188878Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:05.5190527Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:05.5191503Z 2025-11-03T15:43:05.5191823Z if valid: 2025-11-03T15:43:05.5192689Z return True 2025-11-03T15:43:05.5193246Z 2025-11-03T15:43:05.5193580Z log.error( 2025-11-03T15:43:05.5197152Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-11-03T15:43:05.5200818Z ) 2025-11-03T15:43:05.5201579Z return False 2025-11-03T15:43:05.5202077Z 2025-11-03T15:43:05.5202085Z 2025-11-03T15:43:05.5202738Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:05.5204108Z """ 2025-11-03T15:43:05.5205552Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:05.5207146Z """ 2025-11-03T15:43:05.5207886Z try: 2025-11-03T15:43:05.5208653Z if settings_text: 2025-11-03T15:43:05.5210345Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:05.5212086Z # for easy reading 2025-11-03T15:43:05.5213823Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:05.5215825Z # the backtick character in shell commands. 2025-11-03T15:43:05.5217106Z backtick = chr(96) # backtick character 2025-11-03T15:43:05.5218539Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:05.5220214Z settings = load_yaml(settings_text) 2025-11-03T15:43:05.5221035Z 2025-11-03T15:43:05.5221946Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:05.5223620Z experiments = {} 2025-11-03T15:43:05.5224261Z 2025-11-03T15:43:05.5225065Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:05.5226719Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:05.5229256Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-11-03T15:43:05.5231670Z continue 2025-11-03T15:43:05.5232282Z 2025-11-03T15:43:05.5232641Z valid_settings = {} 2025-11-03T15:43:05.5233741Z for setting in exp_settings: 2025-11-03T15:43:05.5234955Z if setting not in Experiment._fields: 2025-11-03T15:43:05.5236131Z log.warning( 2025-11-03T15:43:05.5237674Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:05.5239397Z ) 2025-11-03T15:43:05.5240413Z else: 2025-11-03T15:43:05.5241550Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:05.5242474Z 2025-11-03T15:43:05.5243047Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:05.5244377Z return Settings(experiments) 2025-11-03T15:43:05.5245139Z 2025-11-03T15:43:05.5245482Z except Exception: 2025-11-03T15:43:05.5246480Z log.exception("Failed to parse settings") 2025-11-03T15:43:05.5247312Z 2025-11-03T15:43:05.5247651Z return Settings() 2025-11-03T15:43:05.5248195Z 2025-11-03T15:43:05.5248202Z 2025-11-03T15:43:05.5248702Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:05.5249989Z """ 2025-11-03T15:43:05.5250890Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:05.5251746Z 2025-11-03T15:43:05.5252487Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.5254088Z and the text below is the list of opted in users. 2025-11-03T15:43:05.5254961Z 2025-11-03T15:43:05.5255843Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:05.5257404Z """ 2025-11-03T15:43:05.5258596Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.5260471Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:05.5261325Z 2025-11-03T15:43:05.5261333Z 2025-11-03T15:43:05.5261847Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:05.5263038Z """ 2025-11-03T15:43:05.5263874Z Parse users from the rollout state. 2025-11-03T15:43:05.5264624Z 2025-11-03T15:43:05.5264945Z """ 2025-11-03T15:43:05.5266060Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.5267608Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:05.5268465Z 2025-11-03T15:43:05.5268472Z 2025-11-03T15:43:05.5269491Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.5271196Z """ 2025-11-03T15:43:05.5272057Z Check if a user is opted into an experiment 2025-11-03T15:43:05.5273184Z """ 2025-11-03T15:43:05.5274179Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:05.5275089Z 2025-11-03T15:43:05.5275097Z 2025-11-03T15:43:05.5275992Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.5277569Z """ 2025-11-03T15:43:05.5278516Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:05.5279838Z """ 2025-11-03T15:43:05.5280894Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:05.5282327Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:05.5283677Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:05.5284925Z return False 2025-11-03T15:43:05.5285457Z 2025-11-03T15:43:05.5286011Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:05.5287243Z log.warning( 2025-11-03T15:43:05.5288974Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:05.5290951Z ) 2025-11-03T15:43:05.5291388Z 2025-11-03T15:43:05.5291715Z return True 2025-11-03T15:43:05.5292191Z 2025-11-03T15:43:05.5292198Z 2025-11-03T15:43:05.5292552Z def get_runner_prefix( 2025-11-03T15:43:05.5293594Z rollout_state: str, 2025-11-03T15:43:05.5294562Z workflow_requestors: Iterable[str], 2025-11-03T15:43:05.5295623Z branch: str, 2025-11-03T15:43:05.5296632Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.5298041Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.5299260Z is_canary: bool = False, 2025-11-03T15:43:05.5300457Z ) -> str: 2025-11-03T15:43:05.5301319Z settings = parse_settings(rollout_state) 2025-11-03T15:43:05.5302719Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:05.5303507Z 2025-11-03T15:43:05.5303848Z fleet_prefix = "" 2025-11-03T15:43:05.5304738Z prefixes = [] 2025-11-03T15:43:05.5306048Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:05.5308006Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:05.5309502Z log.info( 2025-11-03T15:43:05.5311045Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:05.5312630Z ) 2025-11-03T15:43:05.5313398Z continue 2025-11-03T15:43:05.5313916Z 2025-11-03T15:43:05.5314286Z if opt_out_experiments: 2025-11-03T15:43:05.5315368Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:05.5316674Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:05.5317892Z log.info( 2025-11-03T15:43:05.5319975Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:05.5322008Z ) 2025-11-03T15:43:05.5322806Z continue 2025-11-03T15:43:05.5323354Z 2025-11-03T15:43:05.5323727Z if eligible_experiments: 2025-11-03T15:43:05.5324854Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:05.5326179Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:05.5327336Z log.info( 2025-11-03T15:43:05.5329028Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:05.5330872Z ) 2025-11-03T15:43:05.5331663Z continue 2025-11-03T15:43:05.5332630Z elif not experiment_settings.default: 2025-11-03T15:43:05.5333743Z log.info( 2025-11-03T15:43:05.5335252Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:05.5336787Z ) 2025-11-03T15:43:05.5337554Z continue 2025-11-03T15:43:05.5338061Z 2025-11-03T15:43:05.5338619Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:05.5340158Z opted_out_users = [ 2025-11-03T15:43:05.5341083Z requestor 2025-11-03T15:43:05.5341992Z for requestor in workflow_requestors 2025-11-03T15:43:05.5343364Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.5344656Z ] 2025-11-03T15:43:05.5345087Z 2025-11-03T15:43:05.5345432Z if opted_out_users: 2025-11-03T15:43:05.5346338Z log.info( 2025-11-03T15:43:05.5347652Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:05.5349092Z ) 2025-11-03T15:43:05.5349968Z continue 2025-11-03T15:43:05.5350494Z 2025-11-03T15:43:05.5351053Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:05.5352315Z opted_in_users = [ 2025-11-03T15:43:05.5353219Z requestor 2025-11-03T15:43:05.5354131Z for requestor in workflow_requestors 2025-11-03T15:43:05.5355492Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.5356753Z ] 2025-11-03T15:43:05.5357180Z 2025-11-03T15:43:05.5357513Z enabled = False 2025-11-03T15:43:05.5358384Z if opted_in_users: 2025-11-03T15:43:05.5359309Z log.info( 2025-11-03T15:43:05.5360639Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:05.5362045Z ) 2025-11-03T15:43:05.5362827Z enabled = True 2025-11-03T15:43:05.5363404Z 2025-11-03T15:43:05.5363823Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:05.5365564Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:05.5367622Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:05.5368958Z log.info( 2025-11-03T15:43:05.5370876Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:05.5372754Z ) 2025-11-03T15:43:05.5373566Z enabled = True 2025-11-03T15:43:05.5374180Z 2025-11-03T15:43:05.5374493Z if enabled: 2025-11-03T15:43:05.5375336Z label = experiment_name 2025-11-03T15:43:05.5376439Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:05.5378156Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:05.5380236Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:05.5381816Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:05.5383179Z if is_canary: 2025-11-03T15:43:05.5384151Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:05.5385250Z fleet_prefix = label 2025-11-03T15:43:05.5386222Z else: 2025-11-03T15:43:05.5387072Z prefixes.append(label) 2025-11-03T15:43:05.5387776Z 2025-11-03T15:43:05.5388122Z if len(prefixes) > 1: 2025-11-03T15:43:05.5389007Z log.error( 2025-11-03T15:43:05.5391359Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-11-03T15:43:05.5393665Z ) 2025-11-03T15:43:05.5394439Z prefixes = prefixes[:1] 2025-11-03T15:43:05.5395061Z 2025-11-03T15:43:05.5395416Z # Fleet always comes first 2025-11-03T15:43:05.5396361Z if fleet_prefix: 2025-11-03T15:43:05.5397260Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:05.5398003Z 2025-11-03T15:43:05.5398647Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:05.5399498Z 2025-11-03T15:43:05.5399506Z 2025-11-03T15:43:05.5400517Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:05.5402062Z """ 2025-11-03T15:43:05.5403293Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:05.5404439Z 2025-11-03T15:43:05.5405212Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:05.5406629Z """ 2025-11-03T15:43:05.5407404Z gh = get_gh_client(github_token) 2025-11-03T15:43:05.5408488Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:05.5409869Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:05.5410756Z 2025-11-03T15:43:05.5410765Z 2025-11-03T15:43:05.5411561Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:05.5413086Z for _ in range(num_retries): 2025-11-03T15:43:05.5414030Z try: 2025-11-03T15:43:05.5414863Z req = Request(url=url, headers=headers) 2025-11-03T15:43:05.5416201Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:05.5417501Z return json.loads(content) 2025-11-03T15:43:05.5418554Z except Exception as e: 2025-11-03T15:43:05.5419629Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:05.5420725Z 2025-11-03T15:43:05.5421509Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:05.5422950Z return {} 2025-11-03T15:43:05.5423404Z 2025-11-03T15:43:05.5423413Z 2025-11-03T15:43:05.5423711Z @cache 2025-11-03T15:43:05.5424952Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:05.5426453Z """ 2025-11-03T15:43:05.5427254Z Dynamically get PR information 2025-11-03T15:43:05.5428217Z """ 2025-11-03T15:43:05.5429419Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:05.5430778Z headers = { 2025-11-03T15:43:05.5431666Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:05.5432866Z "Authorization": f"token {github_token}", 2025-11-03T15:43:05.5433926Z } 2025-11-03T15:43:05.5434762Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:05.5435970Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:05.5437062Z headers=headers, 2025-11-03T15:43:05.5437900Z ) 2025-11-03T15:43:05.5438305Z 2025-11-03T15:43:05.5438648Z if not json_response: 2025-11-03T15:43:05.5439875Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:05.5441107Z return {} 2025-11-03T15:43:05.5441576Z 2025-11-03T15:43:05.5441930Z return json_response 2025-11-03T15:43:05.5442494Z 2025-11-03T15:43:05.5442502Z 2025-11-03T15:43:05.5443292Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:05.5444744Z """ 2025-11-03T15:43:05.5445791Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:05.5447093Z """ 2025-11-03T15:43:05.5448033Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:05.5449260Z return { 2025-11-03T15:43:05.5450534Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:05.5451930Z } 2025-11-03T15:43:05.5452332Z 2025-11-03T15:43:05.5452340Z 2025-11-03T15:43:05.5452666Z def main() -> None: 2025-11-03T15:43:05.5453486Z args = parse_args() 2025-11-03T15:43:05.5454022Z 2025-11-03T15:43:05.5454454Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:05.5455225Z 2025-11-03T15:43:05.5455583Z # Check if the PR is opt-out 2025-11-03T15:43:05.5456546Z if args.pr_number: 2025-11-03T15:43:05.5457845Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:05.5459497Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:05.5460799Z log.info( 2025-11-03T15:43:05.5462210Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:05.5463777Z ) 2025-11-03T15:43:05.5464859Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.5466221Z sys.exit() 2025-11-03T15:43:05.5466739Z 2025-11-03T15:43:05.5467040Z try: 2025-11-03T15:43:05.5467921Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:05.5469335Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:05.5470747Z ) 2025-11-03T15:43:05.5471175Z 2025-11-03T15:43:05.5471567Z username = get_potential_pr_author( 2025-11-03T15:43:05.5472646Z args.github_token, 2025-11-03T15:43:05.5473606Z args.github_repo, 2025-11-03T15:43:05.5474546Z args.github_actor, 2025-11-03T15:43:05.5475523Z args.github_ref_type, 2025-11-03T15:43:05.5476516Z args.github_branch, 2025-11-03T15:43:05.5477434Z ) 2025-11-03T15:43:05.5477852Z 2025-11-03T15:43:05.5478405Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:05.5479320Z 2025-11-03T15:43:05.5479829Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:05.5480933Z rollout_state, 2025-11-03T15:43:05.5481903Z (args.github_issue_owner, username), 2025-11-03T15:43:05.5483005Z args.github_branch, 2025-11-03T15:43:05.5483989Z args.eligible_experiments, 2025-11-03T15:43:05.5485084Z args.opt_out_experiments, 2025-11-03T15:43:05.5486082Z is_canary, 2025-11-03T15:43:05.5486891Z ) 2025-11-03T15:43:05.5487310Z 2025-11-03T15:43:05.5487659Z except Exception as e: 2025-11-03T15:43:05.5488567Z log.error( 2025-11-03T15:43:05.5490015Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:05.5491716Z ) 2025-11-03T15:43:05.5492136Z 2025-11-03T15:43:05.5492780Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.5493776Z 2025-11-03T15:43:05.5493785Z 2025-11-03T15:43:05.5494122Z if __name__ == "__main__": 2025-11-03T15:43:05.5494998Z main() 2025-11-03T15:43:05.5495428Z 2025-11-03T15:43:05.5604605Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:05.5606224Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:05.5640527Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:05.5641395Z env: 2025-11-03T15:43:05.5642444Z GITHUB_TOKEN: *** 2025-11-03T15:43:05.5643217Z ISSUE_NUMBER: 5132 2025-11-03T15:43:05.5644057Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:05.5645009Z ISSUE_OWNER: 2025-11-03T15:43:05.5645768Z CHECK_EXPERIMENTS: 2025-11-03T15:43:05.5646605Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:05.5647440Z PR_NUMBER: 2025-11-03T15:43:05.5648163Z ##[endgroup] 2025-11-03T15:43:05.9495792Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:06.4124776Z Collecting urllib3==1.26.18 2025-11-03T15:43:06.4754526Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:06.5004143Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.7 MB/s eta 0:00:00 2025-11-03T15:43:06.5355547Z Collecting PyGithub==2.3.0 2025-11-03T15:43:06.5488159Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:06.6058522Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:06.6199943Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:06.6243126Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:06.6258647Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-11-03T15:43:06.6273390Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:06.6636456Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:06.6772414Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:06.6999320Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-11-03T15:43:06.8540338Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:06.8675788Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:07.0265716Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:07.0402709Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:07.0718955Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:07.0853053Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:07.1188322Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:07.1355398Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.1 MB/s eta 0:00:00 2025-11-03T15:43:07.1487815Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:07.1657712Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 22.4 MB/s eta 0:00:00 2025-11-03T15:43:07.1792179Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:07.2011570Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 68.6 MB/s eta 0:00:00 2025-11-03T15:43:07.2152230Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:07.2307308Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:07.2355275Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 70.5 MB/s eta 0:00:00 2025-11-03T15:43:07.2490098Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:07.2532149Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 44.1 MB/s eta 0:00:00 2025-11-03T15:43:07.2667172Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:07.2709022Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 41.6 MB/s eta 0:00:00 2025-11-03T15:43:07.5596551Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:08.1025470Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:08.1837040Z ##[group]Run curr_branch="main" 2025-11-03T15:43:08.1837338Z curr_branch="main" 2025-11-03T15:43:08.1837560Z curr_ref_type="branch" 2025-11-03T15:43:08.1837806Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:08.1838074Z  2025-11-03T15:43:08.1838260Z python3 runner_determinator.py \ 2025-11-03T15:43:08.1838536Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:08.1838812Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:08.1839075Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:08.1839345Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:08.1839628Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:08.1840115Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:08.1840378Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:08.1840672Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:08.1841023Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:08.1841307Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:08.1874593Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:08.1874810Z env: 2025-11-03T15:43:08.1875228Z GITHUB_TOKEN: *** 2025-11-03T15:43:08.1875413Z ISSUE_NUMBER: 5132 2025-11-03T15:43:08.1875626Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:08.1875851Z ISSUE_OWNER: 2025-11-03T15:43:08.1876030Z CHECK_EXPERIMENTS: 2025-11-03T15:43:08.1876220Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:08.1876415Z PR_NUMBER: 2025-11-03T15:43:08.1876579Z ##[endgroup] 2025-11-03T15:43:08.1926253Z Current branch is 'main' 2025-11-03T15:43:09.6997972Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-11-03T15:43:09.6999277Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:09.7000458Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:09.7001315Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:09.7001970Z INFO : Setting output: label-type='' 2025-11-03T15:43:09.7315949Z Evaluate and set job outputs 2025-11-03T15:43:09.7322883Z Cleaning up orphan processes