2025-12-04T08:39:57.3561356Z Current runner version: '2.329.0' 2025-12-04T08:39:57.3585033Z ##[group]Runner Image Provisioner 2025-12-04T08:39:57.3585824Z Hosted Compute Agent 2025-12-04T08:39:57.3586469Z Version: 20251124.448 2025-12-04T08:39:57.3587078Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:39:57.3587735Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:39:57.3588382Z ##[endgroup] 2025-12-04T08:39:57.3588903Z ##[group]Operating System 2025-12-04T08:39:57.3589456Z Ubuntu 2025-12-04T08:39:57.3589933Z 24.04.3 2025-12-04T08:39:57.3590409Z LTS 2025-12-04T08:39:57.3590822Z ##[endgroup] 2025-12-04T08:39:57.3591333Z ##[group]Runner Image 2025-12-04T08:39:57.3591920Z Image: ubuntu-24.04 2025-12-04T08:39:57.3592394Z Version: 20251126.144.1 2025-12-04T08:39:57.3593440Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:39:57.3595422Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:39:57.3596462Z ##[endgroup] 2025-12-04T08:39:57.3597484Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:39:57.3599643Z Contents: read 2025-12-04T08:39:57.3600297Z Metadata: read 2025-12-04T08:39:57.3600759Z ##[endgroup] 2025-12-04T08:39:57.3602782Z Secret source: Actions 2025-12-04T08:39:57.3603721Z Prepare workflow directory 2025-12-04T08:39:57.4179025Z Prepare all required actions 2025-12-04T08:39:57.4236533Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:39:57.4241419Z ##[group] Inputs 2025-12-04T08:39:57.4242147Z check_experiments: 2025-12-04T08:39:57.4242721Z opt_out_experiments: lf 2025-12-04T08:39:57.4243299Z triggering_actor: pytorchmergebot 2025-12-04T08:39:57.4244268Z issue_owner: 2025-12-04T08:39:57.4244793Z curr_branch: main 2025-12-04T08:39:57.4245282Z curr_ref_type: branch 2025-12-04T08:39:57.4245996Z issue_number: 5132 2025-12-04T08:39:57.4246564Z ##[endgroup] 2025-12-04T08:39:57.4247151Z Complete job name: get-label-type / runner-determinator 2025-12-04T08:39:58.1317167Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:39:58.1319940Z cat < runner_determinator.py 2025-12-04T08:39:58.1320656Z # flake8: noqa: G004 2025-12-04T08:39:58.1321318Z  2025-12-04T08:39:58.1322142Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:39:58.1323222Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:39:58.1324696Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:39:58.1325499Z  2025-12-04T08:39:58.1325977Z """ 2025-12-04T08:39:58.1326787Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:39:58.1327826Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:39:58.1329106Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:39:58.1330139Z of which runners should be used to run which job. 2025-12-04T08:39:58.1330851Z  2025-12-04T08:39:58.1331536Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:39:58.1332715Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:39:58.1333867Z settings are considered to be empty with only the second part, the user 2025-12-04T08:39:58.1334725Z list, defined. 2025-12-04T08:39:58.1335374Z  2025-12-04T08:39:58.1336038Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:39:58.1337112Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:39:58.1338156Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:39:58.1338902Z  2025-12-04T08:39:58.1339896Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:39:58.1341000Z The user list is also a comma separated list of additional features or 2025-12-04T08:39:58.1341926Z experiments which the user could be opted in to. 2025-12-04T08:39:58.1342590Z  2025-12-04T08:39:58.1343165Z The user list has the following rules: 2025-12-04T08:39:58.1344142Z  2025-12-04T08:39:58.1344862Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:39:58.1345983Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:39:58.1346886Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:39:58.1347570Z  2025-12-04T08:39:58.1348045Z Example config: 2025-12-04T08:39:58.1348978Z  # A list of experiments that can be opted into. 2025-12-04T08:39:58.1349840Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:39:58.1350648Z  # Expected syntax is: 2025-12-04T08:39:58.1351500Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:39:58.1352598Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:39:58.1353725Z  2025-12-04T08:39:58.1354252Z  experiments: 2025-12-04T08:39:58.1354799Z  lf: 2025-12-04T08:39:58.1355374Z  rollout_percent: 25 2025-12-04T08:39:58.1355972Z  all_branches: false 2025-12-04T08:39:58.1356578Z  default: true 2025-12-04T08:39:58.1357097Z  --- 2025-12-04T08:39:58.1357652Z  2025-12-04T08:39:58.1358131Z  # Opt-ins: 2025-12-04T08:39:58.1358890Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:39:58.1360214Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:39:58.1361171Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:39:58.1362004Z  # Experiments should be from the above list. 2025-12-04T08:39:58.1362730Z  2025-12-04T08:39:58.1363277Z  @User1,-lf,split_build 2025-12-04T08:39:58.1364014Z  @User2,lf 2025-12-04T08:39:58.1364626Z  @User3,split_build 2025-12-04T08:39:58.1365212Z """ 2025-12-04T08:39:58.1365668Z  2025-12-04T08:39:58.1446087Z import json 2025-12-04T08:39:58.1446655Z import logging 2025-12-04T08:39:58.1447116Z import os 2025-12-04T08:39:58.1447587Z import random 2025-12-04T08:39:58.1448032Z import re 2025-12-04T08:39:58.1448458Z import sys 2025-12-04T08:39:58.1448934Z from argparse import ArgumentParser 2025-12-04T08:39:58.1449620Z from collections.abc import Iterable 2025-12-04T08:39:58.1450234Z from functools import cache 2025-12-04T08:39:58.1450772Z from logging import LogRecord 2025-12-04T08:39:58.1451350Z from typing import Any, NamedTuple 2025-12-04T08:39:58.1451971Z from urllib.request import Request, urlopen 2025-12-04T08:39:58.1452567Z  2025-12-04T08:39:58.1452951Z import yaml 2025-12-04T08:39:58.1453417Z from github import Auth, Github 2025-12-04T08:39:58.1454130Z from github.Issue import Issue 2025-12-04T08:39:58.1454662Z  2025-12-04T08:39:58.1455033Z  2025-12-04T08:39:58.1455502Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:39:58.1456287Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:39:58.1457252Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:39:58.1458006Z  2025-12-04T08:39:58.1458775Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:39:58.1459414Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:39:58.1460010Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:39:58.1460654Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:39:58.1461219Z  2025-12-04T08:39:58.1461645Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:39:58.1462188Z  2025-12-04T08:39:58.1462589Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:39:58.1463124Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:39:58.1463909Z  2025-12-04T08:39:58.1464341Z  2025-12-04T08:39:58.1464770Z class Experiment(NamedTuple): 2025-12-04T08:39:58.1465330Z  rollout_perc: float = ( 2025-12-04T08:39:58.1466071Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:39:58.1466796Z  ) 2025-12-04T08:39:58.1467216Z  all_branches: bool = ( 2025-12-04T08:39:58.1467958Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:39:58.1468686Z  ) 2025-12-04T08:39:58.1469095Z  default: bool = ( 2025-12-04T08:39:58.1469758Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:39:58.1470459Z  ) 2025-12-04T08:39:58.1470849Z  2025-12-04T08:39:58.1471255Z  # Add more fields as needed 2025-12-04T08:39:58.1471767Z  2025-12-04T08:39:58.1472138Z  2025-12-04T08:39:58.1472552Z class Settings(NamedTuple): 2025-12-04T08:39:58.1473059Z  """ 2025-12-04T08:39:58.1473707Z  Settings for the experiments that can be opted into. 2025-12-04T08:39:58.1474337Z  """ 2025-12-04T08:39:58.1474748Z  2025-12-04T08:39:58.1475179Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:39:58.1475753Z  2025-12-04T08:39:58.1476270Z  2025-12-04T08:39:58.1476742Z class ColorFormatter(logging.Formatter): 2025-12-04T08:39:58.1477452Z  """Color codes the log messages based on the log level""" 2025-12-04T08:39:58.1478080Z  2025-12-04T08:39:58.1478464Z  COLORS = { 2025-12-04T08:39:58.1478931Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:39:58.1479492Z  "ERROR": "\033[31m", # Red 2025-12-04T08:39:58.1480045Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:39:58.1480604Z  "INFO": "\033[0m", # Reset 2025-12-04T08:39:58.1481152Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:39:58.1481679Z  } 2025-12-04T08:39:58.1482069Z  2025-12-04T08:39:58.1482517Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:39:58.1483336Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:39:58.1484305Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:39:58.1484947Z  return super().format(record) 2025-12-04T08:39:58.1485478Z  2025-12-04T08:39:58.1485844Z  2025-12-04T08:39:58.1486260Z handler = logging.StreamHandler() 2025-12-04T08:39:58.1487061Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:39:58.1487827Z  2025-12-04T08:39:58.1488318Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:39:58.1488964Z log.addHandler(handler) 2025-12-04T08:39:58.1489483Z log.setLevel(logging.INFO) 2025-12-04T08:39:58.1489982Z  2025-12-04T08:39:58.1490337Z  2025-12-04T08:39:58.1490835Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:39:58.1491457Z  """ 2025-12-04T08:39:58.1492026Z  Defines outputs of the github action that invokes this script 2025-12-04T08:39:58.1492839Z  """ 2025-12-04T08:39:58.1493250Z  if not GITHUB_OUTPUT: 2025-12-04T08:39:58.1494525Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:39:58.1495730Z  log.warning( 2025-12-04T08:39:58.1496686Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:39:58.1497658Z  ) 2025-12-04T08:39:58.1498156Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:39:58.1498752Z  return 2025-12-04T08:39:58.1499179Z  2025-12-04T08:39:58.1499609Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:39:58.1500244Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:39:58.1500869Z  f.write(f"{key}={value}\n") 2025-12-04T08:39:58.1501403Z  2025-12-04T08:39:58.1501765Z  2025-12-04T08:39:58.1502309Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:39:58.1503024Z  return frozenset( 2025-12-04T08:39:58.1504022Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:39:58.1504781Z  ) 2025-12-04T08:39:58.1505203Z  2025-12-04T08:39:58.1505577Z  2025-12-04T08:39:58.1505969Z def parse_args() -> Any: 2025-12-04T08:39:58.1506637Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:39:58.1507593Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:39:58.1508417Z  parser.add_argument( 2025-12-04T08:39:58.1508950Z  "--github-issue-repo", 2025-12-04T08:39:58.1509499Z  type=str, 2025-12-04T08:39:58.1509984Z  required=False, 2025-12-04T08:39:58.1510669Z  default="pytorch/test-infra", 2025-12-04T08:39:58.1511304Z  help="GitHub repo to get the issue", 2025-12-04T08:39:58.1511867Z  ) 2025-12-04T08:39:58.1512293Z  parser.add_argument( 2025-12-04T08:39:58.1512808Z  "--github-repo", 2025-12-04T08:39:58.1513316Z  type=str, 2025-12-04T08:39:58.1514166Z  required=True, 2025-12-04T08:39:58.1514747Z  help="GitHub repo where CI is running", 2025-12-04T08:39:58.1515322Z  ) 2025-12-04T08:39:58.1515744Z  parser.add_argument( 2025-12-04T08:39:58.1516453Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:39:58.1517169Z  ) 2025-12-04T08:39:58.1517597Z  parser.add_argument( 2025-12-04T08:39:58.1518347Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:39:58.1519089Z  ) 2025-12-04T08:39:58.1519513Z  parser.add_argument( 2025-12-04T08:39:58.1520249Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:39:58.1520995Z  ) 2025-12-04T08:39:58.1521412Z  parser.add_argument( 2025-12-04T08:39:58.1522165Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:39:58.1522927Z  ) 2025-12-04T08:39:58.1523375Z  parser.add_argument( 2025-12-04T08:39:58.1524014Z  "--github-ref-type", 2025-12-04T08:39:58.1524556Z  type=str, 2025-12-04T08:39:58.1525043Z  required=True, 2025-12-04T08:39:58.1525643Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:39:58.1526242Z  ) 2025-12-04T08:39:58.1526674Z  parser.add_argument( 2025-12-04T08:39:58.1527359Z  "--eligible-experiments", 2025-12-04T08:39:58.1527974Z  type=_str_comma_separated_to_set, 2025-12-04T08:39:58.1528547Z  required=False, 2025-12-04T08:39:58.1529053Z  default="", 2025-12-04T08:39:58.1529998Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:39:58.1530986Z  ) 2025-12-04T08:39:58.1531403Z  parser.add_argument( 2025-12-04T08:39:58.1531939Z  "--opt-out-experiments", 2025-12-04T08:39:58.1532532Z  type=_str_comma_separated_to_set, 2025-12-04T08:39:58.1533104Z  required=False, 2025-12-04T08:39:58.1533719Z  default="", 2025-12-04T08:39:58.1534201Z  help=( 2025-12-04T08:39:58.1534972Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:39:58.1536175Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:39:58.1537060Z  ), 2025-12-04T08:39:58.1537485Z  ) 2025-12-04T08:39:58.1537916Z  parser.add_argument( 2025-12-04T08:39:58.1538438Z  "--pr-number", 2025-12-04T08:39:58.1538944Z  type=str, 2025-12-04T08:39:58.1539427Z  required=False, 2025-12-04T08:39:58.1539931Z  default="", 2025-12-04T08:39:58.1540501Z  help="the optional PR number where this is run", 2025-12-04T08:39:58.1541108Z  ) 2025-12-04T08:39:58.1541505Z  2025-12-04T08:39:58.1541925Z  return parser.parse_args() 2025-12-04T08:39:58.1542448Z  2025-12-04T08:39:58.1542825Z  2025-12-04T08:39:58.1543485Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:39:58.1544809Z  auth = Auth.Token(github_token) 2025-12-04T08:39:58.1545422Z  return Github(auth=auth) 2025-12-04T08:39:58.1545939Z  2025-12-04T08:39:58.1546318Z  2025-12-04T08:39:58.1547034Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:39:58.1547905Z  repo = gh.get_repo(repo) 2025-12-04T08:39:58.1548492Z  return repo.get_issue(number=issue_num) 2025-12-04T08:39:58.1549067Z  2025-12-04T08:39:58.1549444Z  2025-12-04T08:39:58.1549854Z def get_potential_pr_author( 2025-12-04T08:39:58.1550603Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:39:58.1551331Z ) -> str: 2025-12-04T08:39:58.1551937Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:39:58.1552817Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:39:58.1553762Z  # embedded in the tag name: ciflow// 2025-12-04T08:39:58.1554394Z  2025-12-04T08:39:58.1554817Z  gh = get_gh_client(github_token) 2025-12-04T08:39:58.1555369Z  2025-12-04T08:39:58.1555879Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:39:58.1556582Z  split_tag = ref_name.split("/") 2025-12-04T08:39:58.1557142Z  if ( 2025-12-04T08:39:58.1557593Z  len(split_tag) == 3 2025-12-04T08:39:58.1558152Z  and split_tag[0] == "ciflow" 2025-12-04T08:39:58.1558745Z  and split_tag[2].isnumeric() 2025-12-04T08:39:58.1559304Z  ): 2025-12-04T08:39:58.1559771Z  pr_number = split_tag[2] 2025-12-04T08:39:58.1560324Z  try: 2025-12-04T08:39:58.1560837Z  repository = gh.get_repo(repo) 2025-12-04T08:39:58.1561665Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:39:58.1562344Z  except Exception as e: 2025-12-04T08:39:58.1562941Z  raise Exception( # noqa: TRY002 2025-12-04T08:39:58.1563788Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:39:58.1564502Z  ) from e 2025-12-04T08:39:58.1565137Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:39:58.1565915Z  # In all other cases, return the original input username 2025-12-04T08:39:58.1566567Z  return username 2025-12-04T08:39:58.1567039Z  2025-12-04T08:39:58.1567409Z  2025-12-04T08:39:58.1567887Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:39:58.1568477Z  """ 2025-12-04T08:39:58.1569219Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:39:58.1570059Z  """ 2025-12-04T08:39:58.1570681Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:39:58.1571408Z  2025-12-04T08:39:58.1571778Z  2025-12-04T08:39:58.1572210Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:39:58.1572760Z  try: 2025-12-04T08:39:58.1573220Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:39:58.1573877Z  return data 2025-12-04T08:39:58.1574382Z  except yaml.YAMLError: 2025-12-04T08:39:58.1574956Z  log.exception("Error loading YAML") 2025-12-04T08:39:58.1575522Z  raise 2025-12-04T08:39:58.1575960Z  2025-12-04T08:39:58.1576329Z  2025-12-04T08:39:58.1577000Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:39:58.1577797Z  """ 2025-12-04T08:39:58.1578621Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:39:58.1579431Z  2025-12-04T08:39:58.1580018Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:39:58.1580864Z  and the text below is the list of opted in users. 2025-12-04T08:39:58.1581463Z  2025-12-04T08:39:58.1582091Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:39:58.1582837Z  """ 2025-12-04T08:39:58.1583351Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:39:58.1584373Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:39:58.1585078Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:39:58.1585722Z  else: 2025-12-04T08:39:58.1586164Z  return "", rollout_state 2025-12-04T08:39:58.1586921Z  2025-12-04T08:39:58.1587307Z  2025-12-04T08:39:58.1587752Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:39:58.1588317Z  """ 2025-12-04T08:39:58.1588912Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:39:58.1589610Z  """ 2025-12-04T08:39:58.1590000Z  2025-12-04T08:39:58.1590372Z  2025-12-04T08:39:58.1590948Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:39:58.1591652Z  """ 2025-12-04T08:39:58.1592442Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:39:58.1593331Z  2025-12-04T08:39:58.1594905Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:39:58.1595976Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:39:58.1596915Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:39:58.1597595Z  2025-12-04T08:39:58.1597971Z  2025-12-04T08:39:58.1598338Z  """ 2025-12-04T08:39:58.1598776Z  optins = UserOptins() 2025-12-04T08:39:58.1599352Z  for user in user_optin_text.split("\n"): 2025-12-04T08:39:58.1599967Z  user = user.strip("\r\n\t -") 2025-12-04T08:39:58.1600590Z  if not user or not user.startswith("@"): 2025-12-04T08:39:58.1601201Z  # Not a valid user. Skip 2025-12-04T08:39:58.1601748Z  continue 2025-12-04T08:39:58.1602199Z  2025-12-04T08:39:58.1602588Z  if user: 2025-12-04T08:39:58.1603136Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:39:58.1604030Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:39:58.1604725Z  2025-12-04T08:39:58.1605116Z  return optins 2025-12-04T08:39:58.1605572Z  2025-12-04T08:39:58.1605926Z  2025-12-04T08:39:58.1606471Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:39:58.1607131Z  """ 2025-12-04T08:39:58.1607600Z  Check if the experiment name is valid. 2025-12-04T08:39:58.1608168Z  A valid name: 2025-12-04T08:39:58.1608904Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:39:58.1609905Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:39:58.1610676Z  - Cannot contain spaces 2025-12-04T08:39:58.1611189Z  """ 2025-12-04T08:39:58.1611578Z  2025-12-04T08:39:58.1612083Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:39:58.1612861Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:39:58.1613736Z  2025-12-04T08:39:58.1614146Z  if valid: 2025-12-04T08:39:58.1614704Z  return True 2025-12-04T08:39:58.1615327Z  2025-12-04T08:39:58.1615712Z  log.error( 2025-12-04T08:39:58.1617257Z  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-12-04T08:39:58.1618900Z  ) 2025-12-04T08:39:58.1619307Z  return False 2025-12-04T08:39:58.1619758Z  2025-12-04T08:39:58.1620120Z  2025-12-04T08:39:58.1620686Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:39:58.1621368Z  """ 2025-12-04T08:39:58.1622024Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:39:58.1623162Z  """ 2025-12-04T08:39:58.1623693Z  try: 2025-12-04T08:39:58.1624128Z  if settings_text: 2025-12-04T08:39:58.1624932Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:39:58.1625776Z  # for easy reading 2025-12-04T08:39:58.1626650Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:39:58.1627612Z  # the backtick character in shell commands. 2025-12-04T08:39:58.1628288Z  backtick = chr(96) # backtick character 2025-12-04T08:39:58.1629040Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:39:58.1629771Z  settings = load_yaml(settings_text) 2025-12-04T08:39:58.1630320Z  2025-12-04T08:39:58.1630968Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:39:58.1631912Z  experiments = {} 2025-12-04T08:39:58.1632420Z  2025-12-04T08:39:58.1633023Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:39:58.1633948Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:39:58.1635116Z  # 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-12-04T08:39:58.1636210Z  continue 2025-12-04T08:39:58.1636709Z  2025-12-04T08:39:58.1637124Z  valid_settings = {} 2025-12-04T08:39:58.1637712Z  for setting in exp_settings: 2025-12-04T08:39:58.1638340Z  if setting not in Experiment._fields: 2025-12-04T08:39:58.1638952Z  log.warning( 2025-12-04T08:39:58.1639746Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:39:58.1640497Z  ) 2025-12-04T08:39:58.1640987Z  else: 2025-12-04T08:39:58.1641582Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:39:58.1642196Z  2025-12-04T08:39:58.1642707Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:39:58.1643402Z  return Settings(experiments) 2025-12-04T08:39:58.1644047Z  2025-12-04T08:39:58.1644437Z  except Exception: 2025-12-04T08:39:58.1645003Z  log.exception("Failed to parse settings") 2025-12-04T08:39:58.1645588Z  2025-12-04T08:39:58.1645971Z  return Settings() 2025-12-04T08:39:58.1646442Z  2025-12-04T08:39:58.1646801Z  2025-12-04T08:39:58.1647426Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:39:58.1648068Z  """ 2025-12-04T08:39:58.1648574Z  Parse settings, if any, from the rollout state. 2025-12-04T08:39:58.1649165Z  2025-12-04T08:39:58.1649752Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:39:58.1650573Z  and the text below is the list of opted in users. 2025-12-04T08:39:58.1651163Z  2025-12-04T08:39:58.1651811Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:39:58.1652582Z  """ 2025-12-04T08:39:58.1653206Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:39:58.1654134Z  return parse_settings_from_text(settings_text) 2025-12-04T08:39:58.1654724Z  2025-12-04T08:39:58.1655089Z  2025-12-04T08:39:58.1655583Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:39:58.1656196Z  """ 2025-12-04T08:39:58.1656649Z  Parse users from the rollout state. 2025-12-04T08:39:58.1657199Z  2025-12-04T08:39:58.1657559Z  """ 2025-12-04T08:39:58.1658166Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:39:58.1658973Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:39:58.1659560Z  2025-12-04T08:39:58.1659934Z  2025-12-04T08:39:58.1660602Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:39:58.1661405Z  """ 2025-12-04T08:39:58.1661888Z  Check if a user is opted into an experiment 2025-12-04T08:39:58.1662464Z  """ 2025-12-04T08:39:58.1662986Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:39:58.1663703Z  2025-12-04T08:39:58.1664215Z  2025-12-04T08:39:58.1664893Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:39:58.1665695Z  """ 2025-12-04T08:39:58.1666215Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:39:58.1666840Z  """ 2025-12-04T08:39:58.1667409Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:39:58.1668162Z  experiment_optout = "-" + experiment_name 2025-12-04T08:39:58.1668883Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:39:58.1669526Z  return False 2025-12-04T08:39:58.1669987Z  2025-12-04T08:39:58.1670499Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:39:58.1671151Z  log.warning( 2025-12-04T08:39:58.1672049Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:39:58.1672986Z  ) 2025-12-04T08:39:58.1673395Z  2025-12-04T08:39:58.1673882Z  return True 2025-12-04T08:39:58.1674328Z  2025-12-04T08:39:58.1674692Z  2025-12-04T08:39:58.1675087Z def get_runner_prefix( 2025-12-04T08:39:58.1675595Z  rollout_state: str, 2025-12-04T08:39:58.1676138Z  workflow_requestors: Iterable[str], 2025-12-04T08:39:58.1676705Z  branch: str, 2025-12-04T08:39:58.1677290Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:39:58.1678035Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:39:58.1678668Z  is_canary: bool = False, 2025-12-04T08:39:58.1679178Z ) -> str: 2025-12-04T08:39:58.1679674Z  settings = parse_settings(rollout_state) 2025-12-04T08:39:58.1680330Z  user_optins = parse_users(rollout_state) 2025-12-04T08:39:58.1680896Z  2025-12-04T08:39:58.1681408Z  fleet_prefix = "" 2025-12-04T08:39:58.1681901Z  prefixes = [] 2025-12-04T08:39:58.1682626Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:39:58.1683742Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:39:58.1684508Z  log.info( 2025-12-04T08:39:58.1685268Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:39:58.1686062Z  ) 2025-12-04T08:39:58.1686518Z  continue 2025-12-04T08:39:58.1686974Z  2025-12-04T08:39:58.1687375Z  if opt_out_experiments: 2025-12-04T08:39:58.1687987Z  if experiment_name in opt_out_experiments: 2025-12-04T08:39:58.1688697Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:39:58.1689356Z  log.info( 2025-12-04T08:39:58.1690360Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:39:58.1691388Z  ) 2025-12-04T08:39:58.1691855Z  continue 2025-12-04T08:39:58.1692368Z  2025-12-04T08:39:58.1692785Z  if eligible_experiments: 2025-12-04T08:39:58.1693422Z  if experiment_name not in eligible_experiments: 2025-12-04T08:39:58.1694216Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:39:58.1694808Z  log.info( 2025-12-04T08:39:58.1695669Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:39:58.1696558Z  ) 2025-12-04T08:39:58.1697015Z  continue 2025-12-04T08:39:58.1697709Z  elif not experiment_settings.default: 2025-12-04T08:39:58.1698284Z  log.info( 2025-12-04T08:39:58.1699024Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:39:58.1699806Z  ) 2025-12-04T08:39:58.1700239Z  continue 2025-12-04T08:39:58.1700700Z  2025-12-04T08:39:58.1701208Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:39:58.1701884Z  opted_out_users = [ 2025-12-04T08:39:58.1702396Z  requestor 2025-12-04T08:39:58.1702936Z  for requestor in workflow_requestors 2025-12-04T08:39:58.1703768Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:39:58.1704450Z  ] 2025-12-04T08:39:58.1704856Z  2025-12-04T08:39:58.1705257Z  if opted_out_users: 2025-12-04T08:39:58.1705795Z  log.info( 2025-12-04T08:39:58.1706504Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:39:58.1707244Z  ) 2025-12-04T08:39:58.1707679Z  continue 2025-12-04T08:39:58.1708135Z  2025-12-04T08:39:58.1708658Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:39:58.1709314Z  opted_in_users = [ 2025-12-04T08:39:58.1709850Z  requestor 2025-12-04T08:39:58.1710393Z  for requestor in workflow_requestors 2025-12-04T08:39:58.1711137Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:39:58.1711803Z  ] 2025-12-04T08:39:58.1712212Z  2025-12-04T08:39:58.1712600Z  enabled = False 2025-12-04T08:39:58.1713107Z  if opted_in_users: 2025-12-04T08:39:58.1713846Z  log.info( 2025-12-04T08:39:58.1714553Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:39:58.1715278Z  ) 2025-12-04T08:39:58.1715731Z  enabled = True 2025-12-04T08:39:58.1716223Z  2025-12-04T08:39:58.1716669Z  elif experiment_settings.rollout_perc: 2025-12-04T08:39:58.1717567Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:39:58.1718599Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:39:58.1719291Z  log.info( 2025-12-04T08:39:58.1720237Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:39:58.1721204Z  ) 2025-12-04T08:39:58.1721697Z  enabled = True 2025-12-04T08:39:58.1722203Z  2025-12-04T08:39:58.1722581Z  if enabled: 2025-12-04T08:39:58.1723087Z  label = experiment_name 2025-12-04T08:39:58.1723803Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:39:58.1724686Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:39:58.1725611Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:39:58.1726431Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:39:58.1727139Z  if is_canary: 2025-12-04T08:39:58.1727698Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:39:58.1728297Z  fleet_prefix = label 2025-12-04T08:39:58.1728840Z  else: 2025-12-04T08:39:58.1729481Z  prefixes.append(label) 2025-12-04T08:39:58.1730023Z  2025-12-04T08:39:58.1730418Z  if len(prefixes) > 1: 2025-12-04T08:39:58.1730928Z  log.error( 2025-12-04T08:39:58.1732045Z  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-12-04T08:39:58.1733212Z  ) 2025-12-04T08:39:58.1733746Z  prefixes = prefixes[:1] 2025-12-04T08:39:58.1734271Z  2025-12-04T08:39:58.1734674Z  # Fleet always comes first 2025-12-04T08:39:58.1735212Z  if fleet_prefix: 2025-12-04T08:39:58.1735738Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:39:58.1736282Z  2025-12-04T08:39:58.1736776Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:39:58.1737386Z  2025-12-04T08:39:58.1737763Z  2025-12-04T08:39:58.1738458Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:39:58.1739277Z  """ 2025-12-04T08:39:58.1739923Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:39:58.1740674Z  2025-12-04T08:39:58.1741291Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:39:58.1742033Z  """ 2025-12-04T08:39:58.1742483Z  gh = get_gh_client(github_token) 2025-12-04T08:39:58.1743089Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:39:58.1743908Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:39:58.1744563Z  2025-12-04T08:39:58.1744928Z  2025-12-04T08:39:58.1745579Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:39:58.1746509Z  for _ in range(num_retries): 2025-12-04T08:39:58.1747058Z  try: 2025-12-04T08:39:58.1747559Z  req = Request(url=url, headers=headers) 2025-12-04T08:39:58.1748281Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:39:58.1748999Z  return json.loads(content) 2025-12-04T08:39:58.1749576Z  except Exception as e: 2025-12-04T08:39:58.1750210Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:39:58.1750815Z  2025-12-04T08:39:58.1751440Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:39:58.1752203Z  return {} 2025-12-04T08:39:58.1752635Z  2025-12-04T08:39:58.1753001Z  2025-12-04T08:39:58.1753375Z @cache 2025-12-04T08:39:58.1754185Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:39:58.1754996Z  """ 2025-12-04T08:39:58.1755458Z  Dynamically get PR information 2025-12-04T08:39:58.1755994Z  """ 2025-12-04T08:39:58.1756556Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:39:58.1757235Z  headers = { 2025-12-04T08:39:58.1757778Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:39:58.1758445Z  "Authorization": f"token {github_token}", 2025-12-04T08:39:58.1759016Z  } 2025-12-04T08:39:58.1759512Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:39:58.1760177Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:39:58.1760768Z  headers=headers, 2025-12-04T08:39:58.1761257Z  ) 2025-12-04T08:39:58.1761649Z  2025-12-04T08:39:58.1762045Z  if not json_response: 2025-12-04T08:39:58.1762705Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:39:58.1763520Z  return {} 2025-12-04T08:39:58.1764075Z  2025-12-04T08:39:58.1764474Z  return json_response 2025-12-04T08:39:58.1764963Z  2025-12-04T08:39:58.1765331Z  2025-12-04T08:39:58.1765964Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:39:58.1766732Z  """ 2025-12-04T08:39:58.1767315Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:39:58.1768005Z  """ 2025-12-04T08:39:58.1768553Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:39:58.1769204Z  return { 2025-12-04T08:39:58.1769863Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:39:58.1770591Z  } 2025-12-04T08:39:58.1770980Z  2025-12-04T08:39:58.1771347Z  2025-12-04T08:39:58.1771737Z def main() -> None: 2025-12-04T08:39:58.1772222Z  args = parse_args() 2025-12-04T08:39:58.1772705Z  2025-12-04T08:39:58.1773168Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:39:58.1774041Z  2025-12-04T08:39:58.1774471Z  # Check if the PR is opt-out 2025-12-04T08:39:58.1775027Z  if args.pr_number: 2025-12-04T08:39:58.1775777Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:39:58.1776581Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:39:58.1777136Z  log.info( 2025-12-04T08:39:58.1777911Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:39:58.1778723Z  ) 2025-12-04T08:39:58.1779360Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:39:58.1780096Z  sys.exit() 2025-12-04T08:39:58.1780724Z  2025-12-04T08:39:58.1781103Z  try: 2025-12-04T08:39:58.1781610Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:39:58.1782392Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:39:58.1783069Z  ) 2025-12-04T08:39:58.1783482Z  2025-12-04T08:39:58.1784043Z  username = get_potential_pr_author( 2025-12-04T08:39:58.1784637Z  args.github_token, 2025-12-04T08:39:58.1785193Z  args.github_repo, 2025-12-04T08:39:58.1785737Z  args.github_actor, 2025-12-04T08:39:58.1786294Z  args.github_ref_type, 2025-12-04T08:39:58.1786848Z  args.github_branch, 2025-12-04T08:39:58.1787366Z  ) 2025-12-04T08:39:58.1787769Z  2025-12-04T08:39:58.1788302Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:39:58.1788955Z  2025-12-04T08:39:58.1789408Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:39:58.1790004Z  rollout_state, 2025-12-04T08:39:58.1790572Z  (args.github_issue_owner, username), 2025-12-04T08:39:58.1791173Z  args.github_branch, 2025-12-04T08:39:58.1791737Z  args.eligible_experiments, 2025-12-04T08:39:58.1792332Z  args.opt_out_experiments, 2025-12-04T08:39:58.1792884Z  is_canary, 2025-12-04T08:39:58.1793365Z  ) 2025-12-04T08:39:58.1793859Z  2025-12-04T08:39:58.1794267Z  except Exception as e: 2025-12-04T08:39:58.1794783Z  log.error( 2025-12-04T08:39:58.1795553Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:39:58.1796355Z  ) 2025-12-04T08:39:58.1796895Z  2025-12-04T08:39:58.1797467Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:39:58.1798165Z  2025-12-04T08:39:58.1798535Z  2025-12-04T08:39:58.1798922Z if __name__ == "__main__": 2025-12-04T08:39:58.1799425Z  main() 2025-12-04T08:39:58.1799832Z  2025-12-04T08:39:58.1800199Z EOF 2025-12-04T08:39:58.1800580Z  2025-12-04T08:39:58.1800977Z cat runner_determinator.py 2025-12-04T08:39:58.2452399Z shell: /usr/bin/bash -e {0} 2025-12-04T08:39:58.2453370Z env: 2025-12-04T08:39:58.2454391Z GITHUB_TOKEN: *** 2025-12-04T08:39:58.2454875Z ISSUE_NUMBER: 5132 2025-12-04T08:39:58.2455384Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:39:58.2455997Z ISSUE_OWNER: 2025-12-04T08:39:58.2456456Z CHECK_EXPERIMENTS: 2025-12-04T08:39:58.2456949Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:39:58.2457454Z PR_NUMBER: 2025-12-04T08:39:58.2457910Z ##[endgroup] 2025-12-04T08:39:58.2668988Z # flake8: noqa: G004 2025-12-04T08:39:58.2669360Z 2025-12-04T08:39:58.2669815Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:39:58.2670777Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:39:58.2671589Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:39:58.2672029Z 2025-12-04T08:39:58.2672199Z """ 2025-12-04T08:39:58.2672770Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:39:58.2673900Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:39:58.2674814Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:39:58.2675624Z of which runners should be used to run which job. 2025-12-04T08:39:58.2676030Z 2025-12-04T08:39:58.2676416Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:39:58.2677537Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:39:58.2678441Z settings are considered to be empty with only the second part, the user 2025-12-04T08:39:58.2679139Z list, defined. 2025-12-04T08:39:58.2679377Z 2025-12-04T08:39:58.2679741Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:39:58.2680667Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:39:58.2681494Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:39:58.2681931Z 2025-12-04T08:39:58.2682308Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:39:58.2683171Z The user list is also a comma separated list of additional features or 2025-12-04T08:39:58.2684211Z experiments which the user could be opted in to. 2025-12-04T08:39:58.2684626Z 2025-12-04T08:39:58.2684826Z The user list has the following rules: 2025-12-04T08:39:58.2685180Z 2025-12-04T08:39:58.2685513Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:39:58.2686385Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:39:58.2687153Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:39:58.2687544Z 2025-12-04T08:39:58.2687721Z Example config: 2025-12-04T08:39:58.2688168Z # A list of experiments that can be opted into. 2025-12-04T08:39:58.2688853Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:39:58.2689475Z # Expected syntax is: 2025-12-04T08:39:58.2690131Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:39:58.2691108Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:39:58.2691723Z 2025-12-04T08:39:58.2691893Z experiments: 2025-12-04T08:39:58.2692285Z lf: 2025-12-04T08:39:58.2692659Z rollout_percent: 25 2025-12-04T08:39:58.2693289Z all_branches: false 2025-12-04T08:39:58.2694436Z default: true 2025-12-04T08:39:58.2694887Z --- 2025-12-04T08:39:58.2695097Z 2025-12-04T08:39:58.2695266Z # Opt-ins: 2025-12-04T08:39:58.2695902Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:39:58.2696809Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:39:58.2697597Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:39:58.2698268Z # Experiments should be from the above list. 2025-12-04T08:39:58.2698651Z 2025-12-04T08:39:58.2698837Z @User1,-lf,split_build 2025-12-04T08:39:58.2699282Z @User2,lf 2025-12-04T08:39:58.2699666Z @User3,split_build 2025-12-04T08:39:58.2700084Z """ 2025-12-04T08:39:58.2700280Z 2025-12-04T08:39:58.2700453Z import json 2025-12-04T08:39:58.2700830Z import logging 2025-12-04T08:39:58.2701212Z import os 2025-12-04T08:39:58.2701584Z import random 2025-12-04T08:39:58.2701962Z import re 2025-12-04T08:39:58.2702334Z import sys 2025-12-04T08:39:58.2702737Z from argparse import ArgumentParser 2025-12-04T08:39:58.2703266Z from collections.abc import Iterable 2025-12-04T08:39:58.2704048Z from functools import cache 2025-12-04T08:39:58.2704523Z from logging import LogRecord 2025-12-04T08:39:58.2705015Z from typing import Any, NamedTuple 2025-12-04T08:39:58.2705562Z from urllib.request import Request, urlopen 2025-12-04T08:39:58.2705944Z 2025-12-04T08:39:58.2706109Z import yaml 2025-12-04T08:39:58.2706499Z from github import Auth, Github 2025-12-04T08:39:58.2706992Z from github.Issue import Issue 2025-12-04T08:39:58.2707291Z 2025-12-04T08:39:58.2707298Z 2025-12-04T08:39:58.2707520Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:39:58.2708214Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:39:58.2709099Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:39:58.2709659Z 2025-12-04T08:39:58.2709887Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:39:58.2710639Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:39:58.2711165Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:39:58.2711724Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:39:58.2712083Z 2025-12-04T08:39:58.2712286Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:39:58.2712618Z 2025-12-04T08:39:58.2712805Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:39:58.2713274Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:39:58.2713710Z 2025-12-04T08:39:58.2713719Z 2025-12-04T08:39:58.2713922Z class Experiment(NamedTuple): 2025-12-04T08:39:58.2714420Z rollout_perc: float = ( 2025-12-04T08:39:58.2715060Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:39:58.2715736Z ) 2025-12-04T08:39:58.2716105Z all_branches: bool = ( 2025-12-04T08:39:58.2716725Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:39:58.2717401Z ) 2025-12-04T08:39:58.2717760Z default: bool = ( 2025-12-04T08:39:58.2718331Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:39:58.2718974Z ) 2025-12-04T08:39:58.2719177Z 2025-12-04T08:39:58.2719359Z # Add more fields as needed 2025-12-04T08:39:58.2719658Z 2025-12-04T08:39:58.2719664Z 2025-12-04T08:39:58.2719858Z class Settings(NamedTuple): 2025-12-04T08:39:58.2720295Z """ 2025-12-04T08:39:58.2720746Z Settings for the experiments that can be opted into. 2025-12-04T08:39:58.2721325Z """ 2025-12-04T08:39:58.2721525Z 2025-12-04T08:39:58.2721739Z experiments: dict[str, Experiment] = {} 2025-12-04T08:39:58.2722101Z 2025-12-04T08:39:58.2722106Z 2025-12-04T08:39:58.2722315Z class ColorFormatter(logging.Formatter): 2025-12-04T08:39:58.2722942Z """Color codes the log messages based on the log level""" 2025-12-04T08:39:58.2723378Z 2025-12-04T08:39:58.2723688Z COLORS = { 2025-12-04T08:39:58.2724179Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:39:58.2724867Z "ERROR": "\033[31m", # Red 2025-12-04T08:39:58.2725365Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:39:58.2725879Z "INFO": "\033[0m", # Reset 2025-12-04T08:39:58.2726362Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:39:58.2726832Z } 2025-12-04T08:39:58.2727027Z 2025-12-04T08:39:58.2727249Z def format(self, record: LogRecord) -> str: 2025-12-04T08:39:58.2728002Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:39:58.2728789Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:39:58.2729365Z return super().format(record) 2025-12-04T08:39:58.2729700Z 2025-12-04T08:39:58.2729706Z 2025-12-04T08:39:58.2729907Z handler = logging.StreamHandler() 2025-12-04T08:39:58.2730611Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:39:58.2731173Z 2025-12-04T08:39:58.2731419Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:39:58.2731997Z log.addHandler(handler) 2025-12-04T08:39:58.2732457Z log.setLevel(logging.INFO) 2025-12-04T08:39:58.2732741Z 2025-12-04T08:39:58.2732748Z 2025-12-04T08:39:58.2733001Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:39:58.2733827Z """ 2025-12-04T08:39:58.2734362Z Defines outputs of the github action that invokes this script 2025-12-04T08:39:58.2734988Z """ 2025-12-04T08:39:58.2735368Z if not GITHUB_OUTPUT: 2025-12-04T08:39:58.2736441Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:39:58.2737556Z log.warning( 2025-12-04T08:39:58.2738419Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:39:58.2739346Z ) 2025-12-04T08:39:58.2749423Z print(f"::set-output name={key}::{value}") 2025-12-04T08:39:58.2750044Z return 2025-12-04T08:39:58.2750283Z 2025-12-04T08:39:58.2750690Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:39:58.2751300Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:39:58.2751892Z f.write(f"{key}={value}\n") 2025-12-04T08:39:58.2752227Z 2025-12-04T08:39:58.2752234Z 2025-12-04T08:39:58.2752558Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:39:58.2753200Z return frozenset( 2025-12-04T08:39:58.2754066Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:39:58.2754765Z ) 2025-12-04T08:39:58.2754972Z 2025-12-04T08:39:58.2754979Z 2025-12-04T08:39:58.2755163Z def parse_args() -> Any: 2025-12-04T08:39:58.2755734Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:39:58.2756626Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:39:58.2757414Z parser.add_argument( 2025-12-04T08:39:58.2757878Z "--github-issue-repo", 2025-12-04T08:39:58.2758358Z type=str, 2025-12-04T08:39:58.2758761Z required=False, 2025-12-04T08:39:58.2759218Z default="pytorch/test-infra", 2025-12-04T08:39:58.2759760Z help="GitHub repo to get the issue", 2025-12-04T08:39:58.2760278Z ) 2025-12-04T08:39:58.2760642Z parser.add_argument( 2025-12-04T08:39:58.2761104Z "--github-repo", 2025-12-04T08:39:58.2761541Z type=str, 2025-12-04T08:39:58.2761952Z required=True, 2025-12-04T08:39:58.2762412Z help="GitHub repo where CI is running", 2025-12-04T08:39:58.2762942Z ) 2025-12-04T08:39:58.2763319Z parser.add_argument( 2025-12-04T08:39:58.2764199Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:39:58.2764917Z ) 2025-12-04T08:39:58.2765289Z parser.add_argument( 2025-12-04T08:39:58.2765929Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:39:58.2766611Z ) 2025-12-04T08:39:58.2766978Z parser.add_argument( 2025-12-04T08:39:58.2767797Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:39:58.2768504Z ) 2025-12-04T08:39:58.2768868Z parser.add_argument( 2025-12-04T08:39:58.2769528Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:39:58.2770255Z ) 2025-12-04T08:39:58.2770624Z parser.add_argument( 2025-12-04T08:39:58.2771091Z "--github-ref-type", 2025-12-04T08:39:58.2771544Z type=str, 2025-12-04T08:39:58.2771952Z required=True, 2025-12-04T08:39:58.2772439Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:39:58.2772998Z ) 2025-12-04T08:39:58.2773369Z parser.add_argument( 2025-12-04T08:39:58.2774051Z "--eligible-experiments", 2025-12-04T08:39:58.2774584Z type=_str_comma_separated_to_set, 2025-12-04T08:39:58.2775115Z required=False, 2025-12-04T08:39:58.2775545Z default="", 2025-12-04T08:39:58.2776402Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:39:58.2830622Z ) 2025-12-04T08:39:58.2831137Z parser.add_argument( 2025-12-04T08:39:58.2831673Z "--opt-out-experiments", 2025-12-04T08:39:58.2832191Z type=_str_comma_separated_to_set, 2025-12-04T08:39:58.2832712Z required=False, 2025-12-04T08:39:58.2833130Z default="", 2025-12-04T08:39:58.2833510Z help=( 2025-12-04T08:39:58.2834316Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:39:58.2835450Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:39:58.2836273Z ), 2025-12-04T08:39:58.2836628Z ) 2025-12-04T08:39:58.2836989Z parser.add_argument( 2025-12-04T08:39:58.2837427Z "--pr-number", 2025-12-04T08:39:58.2837830Z type=str, 2025-12-04T08:39:58.2838223Z required=False, 2025-12-04T08:39:58.2838660Z default="", 2025-12-04T08:39:58.2839366Z help="the optional PR number where this is run", 2025-12-04T08:39:58.2839926Z ) 2025-12-04T08:39:58.2840134Z 2025-12-04T08:39:58.2840324Z return parser.parse_args() 2025-12-04T08:39:58.2840624Z 2025-12-04T08:39:58.2840632Z 2025-12-04T08:39:58.2841045Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:39:58.2841790Z auth = Auth.Token(github_token) 2025-12-04T08:39:58.2842288Z return Github(auth=auth) 2025-12-04T08:39:58.2842574Z 2025-12-04T08:39:58.2842582Z 2025-12-04T08:39:58.2843025Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:39:58.2844171Z repo = gh.get_repo(repo) 2025-12-04T08:39:58.2844677Z return repo.get_issue(number=issue_num) 2025-12-04T08:39:58.2845067Z 2025-12-04T08:39:58.2845074Z 2025-12-04T08:39:58.2845261Z def get_potential_pr_author( 2025-12-04T08:39:58.2845903Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:39:58.2846573Z ) -> str: 2025-12-04T08:39:58.2847075Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:39:58.2847861Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:39:58.2848585Z # embedded in the tag name: ciflow// 2025-12-04T08:39:58.2848992Z 2025-12-04T08:39:58.2849183Z gh = get_gh_client(github_token) 2025-12-04T08:39:58.2849513Z 2025-12-04T08:39:58.2849774Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:39:58.2850389Z split_tag = ref_name.split("/") 2025-12-04T08:39:58.2850874Z if ( 2025-12-04T08:39:58.2851255Z len(split_tag) == 3 2025-12-04T08:39:58.2851725Z and split_tag[0] == "ciflow" 2025-12-04T08:39:58.2852241Z and split_tag[2].isnumeric() 2025-12-04T08:39:58.2852732Z ): 2025-12-04T08:39:58.2853107Z pr_number = split_tag[2] 2025-12-04T08:39:58.2853905Z try: 2025-12-04T08:39:58.2854327Z repository = gh.get_repo(repo) 2025-12-04T08:39:58.2854928Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:39:58.2855511Z except Exception as e: 2025-12-04T08:39:58.2856024Z raise Exception( # noqa: TRY002 2025-12-04T08:39:58.2856679Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:39:58.2857319Z ) from e 2025-12-04T08:39:58.2857843Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:39:58.2858532Z # In all other cases, return the original input username 2025-12-04T08:39:58.2859109Z return username 2025-12-04T08:39:58.2859352Z 2025-12-04T08:39:58.2859358Z 2025-12-04T08:39:58.2859578Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:39:58.2860107Z """ 2025-12-04T08:39:58.2860740Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:39:58.2861514Z """ 2025-12-04T08:39:58.2862044Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:39:58.2862559Z 2025-12-04T08:39:58.2862566Z 2025-12-04T08:39:58.2862760Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:39:58.2863248Z try: 2025-12-04T08:39:58.2863731Z data = yaml.safe_load(yaml_text) 2025-12-04T08:39:58.2864241Z return data 2025-12-04T08:39:58.2864677Z except yaml.YAMLError: 2025-12-04T08:39:58.2865159Z log.exception("Error loading YAML") 2025-12-04T08:39:58.2865659Z raise 2025-12-04T08:39:58.2865875Z 2025-12-04T08:39:58.2865882Z 2025-12-04T08:39:58.2866299Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:39:58.2867030Z """ 2025-12-04T08:39:58.2867633Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:39:58.2868221Z 2025-12-04T08:39:58.2868708Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:39:58.2869455Z and the text below is the list of opted in users. 2025-12-04T08:39:58.2869860Z 2025-12-04T08:39:58.2870228Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:39:58.2870919Z """ 2025-12-04T08:39:58.2871355Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:39:58.2871969Z if len(rollout_state_parts) >= 2: 2025-12-04T08:39:58.2872556Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:39:58.2873140Z else: 2025-12-04T08:39:58.2873511Z return "", rollout_state 2025-12-04T08:39:58.2873953Z 2025-12-04T08:39:58.2873962Z 2025-12-04T08:39:58.2874164Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:39:58.2874669Z """ 2025-12-04T08:39:58.2875187Z Dictionary of users with a list of features they have opted into 2025-12-04T08:39:58.2875829Z """ 2025-12-04T08:39:58.2876024Z 2025-12-04T08:39:58.2876038Z 2025-12-04T08:39:58.2876377Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:39:58.2877026Z """ 2025-12-04T08:39:58.2877718Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:39:58.2878401Z 2025-12-04T08:39:58.2879009Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:39:58.2879980Z - Example line: "@User1,lf,split_build" 2025-12-04T08:39:58.2880658Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:39:58.2881130Z 2025-12-04T08:39:58.2881137Z 2025-12-04T08:39:58.2881300Z """ 2025-12-04T08:39:58.2881669Z optins = UserOptins() 2025-12-04T08:39:58.2882145Z for user in user_optin_text.split("\n"): 2025-12-04T08:39:58.2882690Z user = user.strip("\r\n\t -") 2025-12-04T08:39:58.2883226Z if not user or not user.startswith("@"): 2025-12-04T08:39:58.2884296Z # Not a valid user. Skip 2025-12-04T08:39:58.2884794Z continue 2025-12-04T08:39:58.2885045Z 2025-12-04T08:39:58.2885210Z if user: 2025-12-04T08:39:58.2885641Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:39:58.2886340Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:39:58.2886825Z 2025-12-04T08:39:58.2886991Z return optins 2025-12-04T08:39:58.2887238Z 2025-12-04T08:39:58.2887244Z 2025-12-04T08:39:58.2887527Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:39:58.2888117Z """ 2025-12-04T08:39:58.2888512Z Check if the experiment name is valid. 2025-12-04T08:39:58.2889028Z A valid name: 2025-12-04T08:39:58.2889664Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:39:58.2890646Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:39:58.2891374Z - Cannot contain spaces 2025-12-04T08:39:58.2891834Z """ 2025-12-04T08:39:58.2892030Z 2025-12-04T08:39:58.2892292Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:39:58.2892989Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:39:58.2893429Z 2025-12-04T08:39:58.2893699Z if valid: 2025-12-04T08:39:58.2894078Z return True 2025-12-04T08:39:58.2894317Z 2025-12-04T08:39:58.2894486Z log.error( 2025-12-04T08:39:58.2895933Z 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-12-04T08:39:58.2897490Z ) 2025-12-04T08:39:58.2897842Z return False 2025-12-04T08:39:58.2898072Z 2025-12-04T08:39:58.2898078Z 2025-12-04T08:39:58.2898375Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:39:58.2898989Z """ 2025-12-04T08:39:58.2899712Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:39:58.2900459Z """ 2025-12-04T08:39:58.2900813Z try: 2025-12-04T08:39:58.2901184Z if settings_text: 2025-12-04T08:39:58.2901896Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:39:58.2902676Z # for easy reading 2025-12-04T08:39:58.2903454Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:39:58.2904427Z # the backtick character in shell commands. 2025-12-04T08:39:58.2905026Z backtick = chr(96) # backtick character 2025-12-04T08:39:58.2905679Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:39:58.2906345Z settings = load_yaml(settings_text) 2025-12-04T08:39:58.2906714Z 2025-12-04T08:39:58.2907133Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:39:58.2907903Z experiments = {} 2025-12-04T08:39:58.2908199Z 2025-12-04T08:39:58.2908585Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:39:58.2909354Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:39:58.2910462Z # 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-12-04T08:39:58.2911503Z continue 2025-12-04T08:39:58.2911795Z 2025-12-04T08:39:58.2911973Z valid_settings = {} 2025-12-04T08:39:58.2912486Z for setting in exp_settings: 2025-12-04T08:39:58.2913046Z if setting not in Experiment._fields: 2025-12-04T08:39:58.2913690Z log.warning( 2025-12-04T08:39:58.2914386Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:39:58.2915250Z ) 2025-12-04T08:39:58.2915668Z else: 2025-12-04T08:39:58.2916176Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:39:58.2916599Z 2025-12-04T08:39:58.2916878Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:39:58.2917500Z return Settings(experiments) 2025-12-04T08:39:58.2917849Z 2025-12-04T08:39:58.2918030Z except Exception: 2025-12-04T08:39:58.2918497Z log.exception("Failed to parse settings") 2025-12-04T08:39:58.2918891Z 2025-12-04T08:39:58.2919058Z return Settings() 2025-12-04T08:39:58.2919316Z 2025-12-04T08:39:58.2919323Z 2025-12-04T08:39:58.2919567Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:39:58.2920135Z """ 2025-12-04T08:39:58.2920580Z Parse settings, if any, from the rollout state. 2025-12-04T08:39:58.2920990Z 2025-12-04T08:39:58.2921340Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:39:58.2922107Z and the text below is the list of opted in users. 2025-12-04T08:39:58.2922514Z 2025-12-04T08:39:58.2922922Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:39:58.2923933Z """ 2025-12-04T08:39:58.2924525Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:39:58.2925294Z return parse_settings_from_text(settings_text) 2025-12-04T08:39:58.2925700Z 2025-12-04T08:39:58.2925707Z 2025-12-04T08:39:58.2925961Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:39:58.2926517Z """ 2025-12-04T08:39:58.2926906Z Parse users from the rollout state. 2025-12-04T08:39:58.2927255Z 2025-12-04T08:39:58.2927413Z """ 2025-12-04T08:39:58.2927940Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:39:58.2928686Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:39:58.2929106Z 2025-12-04T08:39:58.2929114Z 2025-12-04T08:39:58.2929669Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:39:58.2930447Z """ 2025-12-04T08:39:58.2930862Z Check if a user is opted into an experiment 2025-12-04T08:39:58.2931398Z """ 2025-12-04T08:39:58.2931843Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:39:58.2932270Z 2025-12-04T08:39:58.2932276Z 2025-12-04T08:39:58.2932693Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:39:58.2933442Z """ 2025-12-04T08:39:58.2934504Z Check if a user explicitly opted out of an experiment 2025-12-04T08:39:58.2935092Z """ 2025-12-04T08:39:58.2935591Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:39:58.2936273Z experiment_optout = "-" + experiment_name 2025-12-04T08:39:58.2936903Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:39:58.2937509Z return False 2025-12-04T08:39:58.2937773Z 2025-12-04T08:39:58.2938048Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:39:58.2938653Z log.warning( 2025-12-04T08:39:58.2939459Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:39:58.2940342Z ) 2025-12-04T08:39:58.2940546Z 2025-12-04T08:39:58.2940722Z return True 2025-12-04T08:39:58.2940965Z 2025-12-04T08:39:58.2940971Z 2025-12-04T08:39:58.2941153Z def get_runner_prefix( 2025-12-04T08:39:58.2941593Z rollout_state: str, 2025-12-04T08:39:58.2942060Z workflow_requestors: Iterable[str], 2025-12-04T08:39:58.2942580Z branch: str, 2025-12-04T08:39:58.2943067Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:39:58.2943837Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:39:58.2944431Z is_canary: bool = False, 2025-12-04T08:39:58.2944884Z ) -> str: 2025-12-04T08:39:58.2945470Z settings = parse_settings(rollout_state) 2025-12-04T08:39:58.2946052Z user_optins = parse_users(rollout_state) 2025-12-04T08:39:58.2946431Z 2025-12-04T08:39:58.2946611Z fleet_prefix = "" 2025-12-04T08:39:58.2947036Z prefixes = [] 2025-12-04T08:39:58.2947666Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:39:58.2948609Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:39:58.2949323Z log.info( 2025-12-04T08:39:58.2950005Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:39:58.2950840Z ) 2025-12-04T08:39:58.2951228Z continue 2025-12-04T08:39:58.2951481Z 2025-12-04T08:39:58.2951675Z if opt_out_experiments: 2025-12-04T08:39:58.2952212Z if experiment_name in opt_out_experiments: 2025-12-04T08:39:58.2952857Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:39:58.2953459Z log.info( 2025-12-04T08:39:58.2954510Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:39:58.2955490Z ) 2025-12-04T08:39:58.2955888Z continue 2025-12-04T08:39:58.2956160Z 2025-12-04T08:39:58.2956348Z if eligible_experiments: 2025-12-04T08:39:58.2956941Z if experiment_name not in eligible_experiments: 2025-12-04T08:39:58.2957587Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:39:58.2958139Z log.info( 2025-12-04T08:39:58.2958921Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:39:58.2959834Z ) 2025-12-04T08:39:58.2960376Z continue 2025-12-04T08:39:58.2960852Z elif not experiment_settings.default: 2025-12-04T08:39:58.2961395Z log.info( 2025-12-04T08:39:58.2962201Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:39:58.2962961Z ) 2025-12-04T08:39:58.2963344Z continue 2025-12-04T08:39:58.2963713Z 2025-12-04T08:39:58.2964004Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:39:58.2964664Z opted_out_users = [ 2025-12-04T08:39:58.2965110Z requestor 2025-12-04T08:39:58.2965571Z for requestor in workflow_requestors 2025-12-04T08:39:58.2966236Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:39:58.2966868Z ] 2025-12-04T08:39:58.2967073Z 2025-12-04T08:39:58.2967255Z if opted_out_users: 2025-12-04T08:39:58.2967707Z log.info( 2025-12-04T08:39:58.2968324Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:39:58.2969019Z ) 2025-12-04T08:39:58.2969400Z continue 2025-12-04T08:39:58.2969654Z 2025-12-04T08:39:58.2969934Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:39:58.2970569Z opted_in_users = [ 2025-12-04T08:39:58.2971020Z requestor 2025-12-04T08:39:58.2971486Z for requestor in workflow_requestors 2025-12-04T08:39:58.2972153Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:39:58.2972777Z ] 2025-12-04T08:39:58.2972979Z 2025-12-04T08:39:58.2973159Z enabled = False 2025-12-04T08:39:58.2973697Z if opted_in_users: 2025-12-04T08:39:58.2974149Z log.info( 2025-12-04T08:39:58.2974746Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:39:58.2975434Z ) 2025-12-04T08:39:58.2975824Z enabled = True 2025-12-04T08:39:58.2976111Z 2025-12-04T08:39:58.2976329Z elif experiment_settings.rollout_perc: 2025-12-04T08:39:58.2977161Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:39:58.2978249Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:39:58.2978904Z log.info( 2025-12-04T08:39:58.2979768Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:39:58.2980707Z ) 2025-12-04T08:39:58.2981108Z enabled = True 2025-12-04T08:39:58.2981410Z 2025-12-04T08:39:58.2981576Z if enabled: 2025-12-04T08:39:58.2982000Z label = experiment_name 2025-12-04T08:39:58.2982553Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:39:58.2983387Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:39:58.2984372Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:39:58.2985136Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:39:58.2985802Z if is_canary: 2025-12-04T08:39:58.2986300Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:39:58.2986854Z fleet_prefix = label 2025-12-04T08:39:58.2987353Z else: 2025-12-04T08:39:58.2987790Z prefixes.append(label) 2025-12-04T08:39:58.2988135Z 2025-12-04T08:39:58.2988319Z if len(prefixes) > 1: 2025-12-04T08:39:58.2988769Z log.error( 2025-12-04T08:39:58.2989797Z 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-12-04T08:39:58.2990916Z ) 2025-12-04T08:39:58.2991305Z prefixes = prefixes[:1] 2025-12-04T08:39:58.2991624Z 2025-12-04T08:39:58.2991814Z # Fleet always comes first 2025-12-04T08:39:58.2992288Z if fleet_prefix: 2025-12-04T08:39:58.2992732Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:39:58.2993094Z 2025-12-04T08:39:58.2993467Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:39:58.2993994Z 2025-12-04T08:39:58.2994000Z 2025-12-04T08:39:58.2994450Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:39:58.2995231Z """ 2025-12-04T08:39:58.2995813Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:39:58.2996379Z 2025-12-04T08:39:58.2996763Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:39:58.2997467Z """ 2025-12-04T08:39:58.2997862Z gh = get_gh_client(github_token) 2025-12-04T08:39:58.2998400Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:39:58.2999026Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:39:58.2999480Z 2025-12-04T08:39:58.2999486Z 2025-12-04T08:39:58.2999884Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:39:58.3000652Z for _ in range(num_retries): 2025-12-04T08:39:58.3001128Z try: 2025-12-04T08:39:58.3001559Z req = Request(url=url, headers=headers) 2025-12-04T08:39:58.3002218Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:39:58.3002855Z return json.loads(content) 2025-12-04T08:39:58.3003376Z except Exception as e: 2025-12-04T08:39:58.3004006Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:39:58.3004407Z 2025-12-04T08:39:58.3004783Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:39:58.3005492Z return {} 2025-12-04T08:39:58.3005713Z 2025-12-04T08:39:58.3005720Z 2025-12-04T08:39:58.3005888Z @cache 2025-12-04T08:39:58.3006497Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:39:58.3007252Z """ 2025-12-04T08:39:58.3007641Z Dynamically get PR information 2025-12-04T08:39:58.3008129Z """ 2025-12-04T08:39:58.3008763Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:39:58.3009395Z headers = { 2025-12-04T08:39:58.3009850Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:39:58.3010454Z "Authorization": f"token {github_token}", 2025-12-04T08:39:58.3010995Z } 2025-12-04T08:39:58.3011420Z json_response: dict[str, Any] = download_json( 2025-12-04T08:39:58.3012022Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:39:58.3012564Z headers=headers, 2025-12-04T08:39:58.3012994Z ) 2025-12-04T08:39:58.3013193Z 2025-12-04T08:39:58.3013375Z if not json_response: 2025-12-04T08:39:58.3014045Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:39:58.3014654Z return {} 2025-12-04T08:39:58.3014896Z 2025-12-04T08:39:58.3015079Z return json_response 2025-12-04T08:39:58.3015354Z 2025-12-04T08:39:58.3015361Z 2025-12-04T08:39:58.3015759Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:39:58.3016494Z """ 2025-12-04T08:39:58.3017023Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:39:58.3017676Z """ 2025-12-04T08:39:58.3018158Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:39:58.3018760Z return { 2025-12-04T08:39:58.3019360Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:39:58.3020056Z } 2025-12-04T08:39:58.3020264Z 2025-12-04T08:39:58.3020271Z 2025-12-04T08:39:58.3020446Z def main() -> None: 2025-12-04T08:39:58.3020869Z args = parse_args() 2025-12-04T08:39:58.3021140Z 2025-12-04T08:39:58.3021361Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:39:58.3021750Z 2025-12-04T08:39:58.3021944Z # Check if the PR is opt-out 2025-12-04T08:39:58.3022428Z if args.pr_number: 2025-12-04T08:39:58.3023076Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:39:58.3024052Z if OPT_OUT_LABEL in labels: 2025-12-04T08:39:58.3024567Z log.info( 2025-12-04T08:39:58.3025250Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:39:58.3026010Z ) 2025-12-04T08:39:58.3026554Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:39:58.3027214Z sys.exit() 2025-12-04T08:39:58.3027481Z 2025-12-04T08:39:58.3027642Z try: 2025-12-04T08:39:58.3028074Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:39:58.3028783Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:39:58.3029420Z ) 2025-12-04T08:39:58.3029626Z 2025-12-04T08:39:58.3029832Z username = get_potential_pr_author( 2025-12-04T08:39:58.3030376Z args.github_token, 2025-12-04T08:39:58.3030857Z args.github_repo, 2025-12-04T08:39:58.3031332Z args.github_actor, 2025-12-04T08:39:58.3031813Z args.github_ref_type, 2025-12-04T08:39:58.3032319Z args.github_branch, 2025-12-04T08:39:58.3032782Z ) 2025-12-04T08:39:58.3032994Z 2025-12-04T08:39:58.3033273Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:39:58.3033830Z 2025-12-04T08:39:58.3034054Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:39:58.3034604Z rollout_state, 2025-12-04T08:39:58.3035083Z (args.github_issue_owner, username), 2025-12-04T08:39:58.3035626Z args.github_branch, 2025-12-04T08:39:58.3036118Z args.eligible_experiments, 2025-12-04T08:39:58.3036653Z args.opt_out_experiments, 2025-12-04T08:39:58.3037159Z is_canary, 2025-12-04T08:39:58.3037567Z ) 2025-12-04T08:39:58.3037784Z 2025-12-04T08:39:58.3037972Z except Exception as e: 2025-12-04T08:39:58.3038426Z log.error( 2025-12-04T08:39:58.3039085Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:39:58.3039987Z ) 2025-12-04T08:39:58.3040196Z 2025-12-04T08:39:58.3040520Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:39:58.3041030Z 2025-12-04T08:39:58.3041038Z 2025-12-04T08:39:58.3041214Z if __name__ == "__main__": 2025-12-04T08:39:58.3041649Z main() 2025-12-04T08:39:58.3041866Z 2025-12-04T08:39:58.3136435Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:39:58.3137339Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:39:58.3170685Z shell: /usr/bin/bash -e {0} 2025-12-04T08:39:58.3171187Z env: 2025-12-04T08:39:58.3171824Z GITHUB_TOKEN: *** 2025-12-04T08:39:58.3172239Z ISSUE_NUMBER: 5132 2025-12-04T08:39:58.3172675Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:39:58.3173190Z ISSUE_OWNER: 2025-12-04T08:39:58.3173740Z CHECK_EXPERIMENTS: 2025-12-04T08:39:58.3174193Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:39:58.3174657Z PR_NUMBER: 2025-12-04T08:39:58.3175051Z ##[endgroup] 2025-12-04T08:39:59.3884736Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:40:00.4404995Z Collecting urllib3==1.26.18 2025-12-04T08:40:00.4761467Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:40:00.4935523Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 6.8 MB/s eta 0:00:00 2025-12-04T08:40:00.5160589Z Collecting PyGithub==2.3.0 2025-12-04T08:40:00.5208770Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:40:00.5664652Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:40:00.5698310Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:40:00.5744656Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:40:00.5761870Z 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-12-04T08:40:00.5776632Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:40:00.6040587Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:40:00.6074189Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:40:00.6305119Z 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-12-04T08:40:00.7518665Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:00.7556481Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:40:00.9174426Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:40:00.9212634Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:40:00.9457610Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:00.9491085Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:40:00.9761458Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:40:00.9820955Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 34.8 MB/s eta 0:00:00 2025-12-04T08:40:00.9869376Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:40:00.9938485Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 68.4 MB/s eta 0:00:00 2025-12-04T08:40:00.9975825Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:40:01.0103943Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 129.9 MB/s eta 0:00:00 2025-12-04T08:40:01.0144462Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:40:01.0206937Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:40:01.0275864Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 44.5 MB/s eta 0:00:00 2025-12-04T08:40:01.0311838Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:40:01.0363147Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 38.8 MB/s eta 0:00:00 2025-12-04T08:40:01.0467998Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:40:01.0513047Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 38.5 MB/s eta 0:00:00 2025-12-04T08:40:01.3589817Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:40:01.9099012Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:40:02.0125550Z ##[group]Run curr_branch="main" 2025-12-04T08:40:02.0125845Z curr_branch="main" 2025-12-04T08:40:02.0126067Z curr_ref_type="branch" 2025-12-04T08:40:02.0126321Z echo "Current branch is '$curr_branch'" 2025-12-04T08:40:02.0126608Z  2025-12-04T08:40:02.0126793Z python3 runner_determinator.py \ 2025-12-04T08:40:02.0127081Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:40:02.0127358Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:40:02.0127611Z  --github-branch "$curr_branch" \ 2025-12-04T08:40:02.0127875Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:40:02.0128148Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:40:02.0128429Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:40:02.0128695Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:40:02.0128995Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:40:02.0129360Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:40:02.0129649Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:40:02.0163988Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:02.0164217Z env: 2025-12-04T08:40:02.0164769Z GITHUB_TOKEN: *** 2025-12-04T08:40:02.0164964Z ISSUE_NUMBER: 5132 2025-12-04T08:40:02.0165171Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:02.0165401Z ISSUE_OWNER: 2025-12-04T08:40:02.0165582Z CHECK_EXPERIMENTS: 2025-12-04T08:40:02.0165773Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:40:02.0165969Z PR_NUMBER: 2025-12-04T08:40:02.0166131Z ##[endgroup] 2025-12-04T08:40:02.0217276Z Current branch is 'main' 2025-12-04T08:40:03.7477710Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-12-04T08:40:03.7478804Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:40:03.7479555Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:40:03.7480276Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:40:03.7480845Z INFO : Setting output: label-type='' 2025-12-04T08:40:03.7834295Z Evaluate and set job outputs 2025-12-04T08:40:03.7841036Z Cleaning up orphan processes