2025-12-04T08:11:00.5513951Z Current runner version: '2.329.0' 2025-12-04T08:11:00.5538895Z ##[group]Runner Image Provisioner 2025-12-04T08:11:00.5540346Z Hosted Compute Agent 2025-12-04T08:11:00.5540910Z Version: 20251124.448 2025-12-04T08:11:00.5541486Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:11:00.5542495Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:11:00.5543064Z ##[endgroup] 2025-12-04T08:11:00.5543608Z ##[group]Operating System 2025-12-04T08:11:00.5544234Z Ubuntu 2025-12-04T08:11:00.5544688Z 24.04.3 2025-12-04T08:11:00.5545160Z LTS 2025-12-04T08:11:00.5545651Z ##[endgroup] 2025-12-04T08:11:00.5546182Z ##[group]Runner Image 2025-12-04T08:11:00.5546697Z Image: ubuntu-24.04 2025-12-04T08:11:00.5547243Z Version: 20251126.144.1 2025-12-04T08:11:00.5548252Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:11:00.5549846Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:11:00.5550879Z ##[endgroup] 2025-12-04T08:11:00.5551866Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:11:00.5554883Z Contents: read 2025-12-04T08:11:00.5555406Z Metadata: read 2025-12-04T08:11:00.5555892Z ##[endgroup] 2025-12-04T08:11:00.5558185Z Secret source: Actions 2025-12-04T08:11:00.5558855Z Prepare workflow directory 2025-12-04T08:11:00.6079677Z Prepare all required actions 2025-12-04T08:11:00.6139341Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:11:00.6144626Z ##[group] Inputs 2025-12-04T08:11:00.6145322Z check_experiments: 2025-12-04T08:11:00.6145853Z opt_out_experiments: 2025-12-04T08:11:00.6146434Z triggering_actor: pytorchmergebot 2025-12-04T08:11:00.6147056Z issue_owner: 2025-12-04T08:11:00.6147609Z curr_branch: main 2025-12-04T08:11:00.6148138Z curr_ref_type: branch 2025-12-04T08:11:00.6148846Z issue_number: 5132 2025-12-04T08:11:00.6149375Z ##[endgroup] 2025-12-04T08:11:00.6149962Z Complete job name: get-label-type / runner-determinator 2025-12-04T08:11:01.1529633Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:11:01.1532386Z cat < runner_determinator.py 2025-12-04T08:11:01.1533114Z # flake8: noqa: G004 2025-12-04T08:11:01.1533653Z  2025-12-04T08:11:01.1534543Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:11:01.1535639Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:11:01.1536655Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:11:01.1537439Z  2025-12-04T08:11:01.1537875Z """ 2025-12-04T08:11:01.1538623Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:11:01.1539685Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:11:01.1540941Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:11:01.1541906Z of which runners should be used to run which job. 2025-12-04T08:11:01.1543055Z  2025-12-04T08:11:01.1543770Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:11:01.1544851Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:11:01.1545981Z settings are considered to be empty with only the second part, the user 2025-12-04T08:11:01.1546835Z list, defined. 2025-12-04T08:11:01.1547356Z  2025-12-04T08:11:01.1548092Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:11:01.1549192Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:11:01.1550194Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:11:01.1550972Z  2025-12-04T08:11:01.1552227Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:11:01.1553448Z The user list is also a comma separated list of additional features or 2025-12-04T08:11:01.1554466Z experiments which the user could be opted in to. 2025-12-04T08:11:01.1555162Z  2025-12-04T08:11:01.1555654Z The user list has the following rules: 2025-12-04T08:11:01.1556358Z  2025-12-04T08:11:01.1557059Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:11:01.1558113Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:11:01.1559115Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:11:01.1559767Z  2025-12-04T08:11:01.1560255Z Example config: 2025-12-04T08:11:01.1560890Z  # A list of experiments that can be opted into. 2025-12-04T08:11:01.1561785Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:11:01.1562802Z  # Expected syntax is: 2025-12-04T08:11:01.1563702Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:11:01.1564862Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:11:01.1565722Z  2025-12-04T08:11:01.1566228Z  experiments: 2025-12-04T08:11:01.1566794Z  lf: 2025-12-04T08:11:01.1567329Z  rollout_percent: 25 2025-12-04T08:11:01.1567903Z  all_branches: false 2025-12-04T08:11:01.1568577Z  default: true 2025-12-04T08:11:01.1569149Z  --- 2025-12-04T08:11:01.1569588Z  2025-12-04T08:11:01.1570248Z  # Opt-ins: 2025-12-04T08:11:01.1570992Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:11:01.1572331Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:11:01.1573403Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:11:01.1574217Z  # Experiments should be from the above list. 2025-12-04T08:11:01.1574890Z  2025-12-04T08:11:01.1575468Z  @User1,-lf,split_build 2025-12-04T08:11:01.1576081Z  @User2,lf 2025-12-04T08:11:01.1576603Z  @User3,split_build 2025-12-04T08:11:01.1664498Z """ 2025-12-04T08:11:01.1664971Z  2025-12-04T08:11:01.1665411Z import json 2025-12-04T08:11:01.1665884Z import logging 2025-12-04T08:11:01.1666347Z import os 2025-12-04T08:11:01.1666788Z import random 2025-12-04T08:11:01.1667236Z import re 2025-12-04T08:11:01.1667670Z import sys 2025-12-04T08:11:01.1668178Z from argparse import ArgumentParser 2025-12-04T08:11:01.1668869Z from collections.abc import Iterable 2025-12-04T08:11:01.1669488Z from functools import cache 2025-12-04T08:11:01.1670059Z from logging import LogRecord 2025-12-04T08:11:01.1670646Z from typing import Any, NamedTuple 2025-12-04T08:11:01.1671282Z from urllib.request import Request, urlopen 2025-12-04T08:11:01.1671884Z  2025-12-04T08:11:01.1672631Z import yaml 2025-12-04T08:11:01.1673120Z from github import Auth, Github 2025-12-04T08:11:01.1673697Z from github.Issue import Issue 2025-12-04T08:11:01.1674225Z  2025-12-04T08:11:01.1674603Z  2025-12-04T08:11:01.1675092Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:11:01.1675877Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:11:01.1676856Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:11:01.1677619Z  2025-12-04T08:11:01.1678341Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:11:01.1678987Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:11:01.1679587Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:11:01.1680252Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:11:01.1680827Z  2025-12-04T08:11:01.1681267Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:11:01.1681807Z  2025-12-04T08:11:01.1682338Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:11:01.1682876Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:11:01.1683390Z  2025-12-04T08:11:01.1683764Z  2025-12-04T08:11:01.1684194Z class Experiment(NamedTuple): 2025-12-04T08:11:01.1684753Z  rollout_perc: float = ( 2025-12-04T08:11:01.1685522Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:11:01.1686263Z  ) 2025-12-04T08:11:01.1686685Z  all_branches: bool = ( 2025-12-04T08:11:01.1687450Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:11:01.1688183Z  ) 2025-12-04T08:11:01.1688598Z  default: bool = ( 2025-12-04T08:11:01.1689279Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:11:01.1689986Z  ) 2025-12-04T08:11:01.1690386Z  2025-12-04T08:11:01.1690795Z  # Add more fields as needed 2025-12-04T08:11:01.1691318Z  2025-12-04T08:11:01.1691681Z  2025-12-04T08:11:01.1692183Z class Settings(NamedTuple): 2025-12-04T08:11:01.1692696Z  """ 2025-12-04T08:11:01.1693240Z  Settings for the experiments that can be opted into. 2025-12-04T08:11:01.1693871Z  """ 2025-12-04T08:11:01.1694274Z  2025-12-04T08:11:01.1694734Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:11:01.1695316Z  2025-12-04T08:11:01.1695825Z  2025-12-04T08:11:01.1696283Z class ColorFormatter(logging.Formatter): 2025-12-04T08:11:01.1696998Z  """Color codes the log messages based on the log level""" 2025-12-04T08:11:01.1697628Z  2025-12-04T08:11:01.1698020Z  COLORS = { 2025-12-04T08:11:01.1698494Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:11:01.1699085Z  "ERROR": "\033[31m", # Red 2025-12-04T08:11:01.1699644Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:11:01.1700200Z  "INFO": "\033[0m", # Reset 2025-12-04T08:11:01.1700756Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:11:01.1701282Z  } 2025-12-04T08:11:01.1701679Z  2025-12-04T08:11:01.1702242Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:11:01.1703077Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:11:01.1703937Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:11:01.1704607Z  return super().format(record) 2025-12-04T08:11:01.1705148Z  2025-12-04T08:11:01.1705515Z  2025-12-04T08:11:01.1705939Z handler = logging.StreamHandler() 2025-12-04T08:11:01.1706742Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:11:01.1707510Z  2025-12-04T08:11:01.1708010Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:11:01.1708664Z log.addHandler(handler) 2025-12-04T08:11:01.1709189Z log.setLevel(logging.INFO) 2025-12-04T08:11:01.1709690Z  2025-12-04T08:11:01.1710063Z  2025-12-04T08:11:01.1710563Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:11:01.1711190Z  """ 2025-12-04T08:11:01.1711771Z  Defines outputs of the github action that invokes this script 2025-12-04T08:11:01.1713027Z  """ 2025-12-04T08:11:01.1713467Z  if not GITHUB_OUTPUT: 2025-12-04T08:11:01.1714634Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:11:01.1715839Z  log.warning( 2025-12-04T08:11:01.1716809Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:11:01.1717802Z  ) 2025-12-04T08:11:01.1718309Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:11:01.1718899Z  return 2025-12-04T08:11:01.1719340Z  2025-12-04T08:11:01.1719770Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:11:01.1720414Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:11:01.1721043Z  f.write(f"{key}={value}\n") 2025-12-04T08:11:01.1721585Z  2025-12-04T08:11:01.1722306Z  2025-12-04T08:11:01.1722879Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:11:01.1723604Z  return frozenset( 2025-12-04T08:11:01.1724324Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:11:01.1725054Z  ) 2025-12-04T08:11:01.1725473Z  2025-12-04T08:11:01.1725855Z  2025-12-04T08:11:01.1726259Z def parse_args() -> Any: 2025-12-04T08:11:01.1726932Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:11:01.1727883Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:11:01.1728725Z  parser.add_argument( 2025-12-04T08:11:01.1729269Z  "--github-issue-repo", 2025-12-04T08:11:01.1729810Z  type=str, 2025-12-04T08:11:01.1730299Z  required=False, 2025-12-04T08:11:01.1730994Z  default="pytorch/test-infra", 2025-12-04T08:11:01.1731632Z  help="GitHub repo to get the issue", 2025-12-04T08:11:01.1732304Z  ) 2025-12-04T08:11:01.1732749Z  parser.add_argument( 2025-12-04T08:11:01.1733283Z  "--github-repo", 2025-12-04T08:11:01.1733795Z  type=str, 2025-12-04T08:11:01.1734288Z  required=True, 2025-12-04T08:11:01.1734853Z  help="GitHub repo where CI is running", 2025-12-04T08:11:01.1735434Z  ) 2025-12-04T08:11:01.1735867Z  parser.add_argument( 2025-12-04T08:11:01.1736583Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:11:01.1737300Z  ) 2025-12-04T08:11:01.1737734Z  parser.add_argument( 2025-12-04T08:11:01.1738465Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:11:01.1739205Z  ) 2025-12-04T08:11:01.1739646Z  parser.add_argument( 2025-12-04T08:11:01.1740382Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:11:01.1741133Z  ) 2025-12-04T08:11:01.1741560Z  parser.add_argument( 2025-12-04T08:11:01.1742427Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:11:01.1743205Z  ) 2025-12-04T08:11:01.1743663Z  parser.add_argument( 2025-12-04T08:11:01.1744211Z  "--github-ref-type", 2025-12-04T08:11:01.1744749Z  type=str, 2025-12-04T08:11:01.1745249Z  required=True, 2025-12-04T08:11:01.1745856Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:11:01.1746474Z  ) 2025-12-04T08:11:01.1746918Z  parser.add_argument( 2025-12-04T08:11:01.1747621Z  "--eligible-experiments", 2025-12-04T08:11:01.1748230Z  type=_str_comma_separated_to_set, 2025-12-04T08:11:01.1748826Z  required=False, 2025-12-04T08:11:01.1749338Z  default="", 2025-12-04T08:11:01.1750300Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:11:01.1751293Z  ) 2025-12-04T08:11:01.1751737Z  parser.add_argument( 2025-12-04T08:11:01.1752570Z  "--opt-out-experiments", 2025-12-04T08:11:01.1753187Z  type=_str_comma_separated_to_set, 2025-12-04T08:11:01.1753779Z  required=False, 2025-12-04T08:11:01.1754290Z  default="", 2025-12-04T08:11:01.1754784Z  help=( 2025-12-04T08:11:01.1755554Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:11:01.1756810Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:11:01.1757716Z  ), 2025-12-04T08:11:01.1758150Z  ) 2025-12-04T08:11:01.1758595Z  parser.add_argument( 2025-12-04T08:11:01.1759120Z  "--pr-number", 2025-12-04T08:11:01.1759636Z  type=str, 2025-12-04T08:11:01.1760127Z  required=False, 2025-12-04T08:11:01.1760641Z  default="", 2025-12-04T08:11:01.1761225Z  help="the optional PR number where this is run", 2025-12-04T08:11:01.1761838Z  ) 2025-12-04T08:11:01.1762354Z  2025-12-04T08:11:01.1762786Z  return parser.parse_args() 2025-12-04T08:11:01.1763324Z  2025-12-04T08:11:01.1763704Z  2025-12-04T08:11:01.1764373Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:11:01.1765361Z  auth = Auth.Token(github_token) 2025-12-04T08:11:01.1765983Z  return Github(auth=auth) 2025-12-04T08:11:01.1766515Z  2025-12-04T08:11:01.1766900Z  2025-12-04T08:11:01.1767631Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:11:01.1768522Z  repo = gh.get_repo(repo) 2025-12-04T08:11:01.1769128Z  return repo.get_issue(number=issue_num) 2025-12-04T08:11:01.1769712Z  2025-12-04T08:11:01.1770108Z  2025-12-04T08:11:01.1770532Z def get_potential_pr_author( 2025-12-04T08:11:01.1771291Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:11:01.1772151Z ) -> str: 2025-12-04T08:11:01.1772780Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:11:01.1773693Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:11:01.1774550Z  # embedded in the tag name: ciflow// 2025-12-04T08:11:01.1775187Z  2025-12-04T08:11:01.1775620Z  gh = get_gh_client(github_token) 2025-12-04T08:11:01.1776176Z  2025-12-04T08:11:01.1776712Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:11:01.1777425Z  split_tag = ref_name.split("/") 2025-12-04T08:11:01.1778001Z  if ( 2025-12-04T08:11:01.1778468Z  len(split_tag) == 3 2025-12-04T08:11:01.1779046Z  and split_tag[0] == "ciflow" 2025-12-04T08:11:01.1779663Z  and split_tag[2].isnumeric() 2025-12-04T08:11:01.1780234Z  ): 2025-12-04T08:11:01.1780719Z  pr_number = split_tag[2] 2025-12-04T08:11:01.1781280Z  try: 2025-12-04T08:11:01.1781815Z  repository = gh.get_repo(repo) 2025-12-04T08:11:01.1782767Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:11:01.1783456Z  except Exception as e: 2025-12-04T08:11:01.1784080Z  raise Exception( # noqa: TRY002 2025-12-04T08:11:01.1784847Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:11:01.1785566Z  ) from e 2025-12-04T08:11:01.1786218Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:11:01.1787021Z  # In all other cases, return the original input username 2025-12-04T08:11:01.1787690Z  return username 2025-12-04T08:11:01.1788181Z  2025-12-04T08:11:01.1788570Z  2025-12-04T08:11:01.1789057Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:11:01.1789661Z  """ 2025-12-04T08:11:01.1790409Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:11:01.1791279Z  """ 2025-12-04T08:11:01.1791911Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:11:01.1792940Z  2025-12-04T08:11:01.1793331Z  2025-12-04T08:11:01.1793782Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:11:01.1794362Z  try: 2025-12-04T08:11:01.1794830Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:11:01.1795414Z  return data 2025-12-04T08:11:01.1795919Z  except yaml.YAMLError: 2025-12-04T08:11:01.1796505Z  log.exception("Error loading YAML") 2025-12-04T08:11:01.1797082Z  raise 2025-12-04T08:11:01.1797529Z  2025-12-04T08:11:01.1797909Z  2025-12-04T08:11:01.1798595Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:11:01.1799418Z  """ 2025-12-04T08:11:01.1800283Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:11:01.1801121Z  2025-12-04T08:11:01.1801729Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:11:01.1803513Z  and the text below is the list of opted in users. 2025-12-04T08:11:01.1804138Z  2025-12-04T08:11:01.1804825Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:11:01.1805606Z  """ 2025-12-04T08:11:01.1806140Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:11:01.1806820Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:11:01.1807513Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:11:01.1808178Z  else: 2025-12-04T08:11:01.1808749Z  return "", rollout_state 2025-12-04T08:11:01.1809451Z  2025-12-04T08:11:01.1809856Z  2025-12-04T08:11:01.1810307Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:11:01.1810886Z  """ 2025-12-04T08:11:01.1811496Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:11:01.1812312Z  """ 2025-12-04T08:11:01.1812713Z  2025-12-04T08:11:01.1813094Z  2025-12-04T08:11:01.1813687Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:11:01.1814410Z  """ 2025-12-04T08:11:01.1815217Z  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:11:01.1816117Z  2025-12-04T08:11:01.1817006Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:11:01.1818089Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:11:01.1819024Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:11:01.1819720Z  2025-12-04T08:11:01.1820102Z  2025-12-04T08:11:01.1820484Z  """ 2025-12-04T08:11:01.1820919Z  optins = UserOptins() 2025-12-04T08:11:01.1821501Z  for user in user_optin_text.split("\n"): 2025-12-04T08:11:01.1822263Z  user = user.strip("\r\n\t -") 2025-12-04T08:11:01.1822907Z  if not user or not user.startswith("@"): 2025-12-04T08:11:01.1823527Z  # Not a valid user. Skip 2025-12-04T08:11:01.1824089Z  continue 2025-12-04T08:11:01.1824553Z  2025-12-04T08:11:01.1824939Z  if user: 2025-12-04T08:11:01.1825504Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:11:01.1826278Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:11:01.1826987Z  2025-12-04T08:11:01.1827387Z  return optins 2025-12-04T08:11:01.1827855Z  2025-12-04T08:11:01.1828226Z  2025-12-04T08:11:01.1828787Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:11:01.1829467Z  """ 2025-12-04T08:11:01.1829943Z  Check if the experiment name is valid. 2025-12-04T08:11:01.1830530Z  A valid name: 2025-12-04T08:11:01.1831271Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:11:01.1832440Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:11:01.1833229Z  - Cannot contain spaces 2025-12-04T08:11:01.1833758Z  """ 2025-12-04T08:11:01.1834168Z  2025-12-04T08:11:01.1834688Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:11:01.1835488Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:11:01.1836276Z  2025-12-04T08:11:01.1836679Z  if valid: 2025-12-04T08:11:01.1837229Z  return True 2025-12-04T08:11:01.1837851Z  2025-12-04T08:11:01.1838248Z  log.error( 2025-12-04T08:11:01.1839808Z  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:11:01.1841460Z  ) 2025-12-04T08:11:01.1841888Z  return False 2025-12-04T08:11:01.1842448Z  2025-12-04T08:11:01.1842830Z  2025-12-04T08:11:01.1843405Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:11:01.1844105Z  """ 2025-12-04T08:11:01.1844782Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:11:01.1845575Z  """ 2025-12-04T08:11:01.1845986Z  try: 2025-12-04T08:11:01.1846419Z  if settings_text: 2025-12-04T08:11:01.1847246Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:11:01.1848114Z  # for easy reading 2025-12-04T08:11:01.1849028Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:11:01.1850016Z  # the backtick character in shell commands. 2025-12-04T08:11:01.1850701Z  backtick = chr(96) # backtick character 2025-12-04T08:11:01.1851462Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:11:01.1852304Z  settings = load_yaml(settings_text) 2025-12-04T08:11:01.1852879Z  2025-12-04T08:11:01.1853543Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:11:01.1854507Z  experiments = {} 2025-12-04T08:11:01.1855023Z  2025-12-04T08:11:01.1855661Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:11:01.1856507Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:11:01.1857715Z  # 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:11:01.1858856Z  continue 2025-12-04T08:11:01.1859366Z  2025-12-04T08:11:01.1859798Z  valid_settings = {} 2025-12-04T08:11:01.1860395Z  for setting in exp_settings: 2025-12-04T08:11:01.1861039Z  if setting not in Experiment._fields: 2025-12-04T08:11:01.1861673Z  log.warning( 2025-12-04T08:11:01.1862591Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:11:01.1863374Z  ) 2025-12-04T08:11:01.1863867Z  else: 2025-12-04T08:11:01.1864479Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:11:01.1865114Z  2025-12-04T08:11:01.1865648Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:11:01.1866359Z  return Settings(experiments) 2025-12-04T08:11:01.1866919Z  2025-12-04T08:11:01.1867325Z  except Exception: 2025-12-04T08:11:01.1867897Z  log.exception("Failed to parse settings") 2025-12-04T08:11:01.1868494Z  2025-12-04T08:11:01.1868890Z  return Settings() 2025-12-04T08:11:01.1869377Z  2025-12-04T08:11:01.1869755Z  2025-12-04T08:11:01.1870412Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:11:01.1871069Z  """ 2025-12-04T08:11:01.1871589Z  Parse settings, if any, from the rollout state. 2025-12-04T08:11:01.1872300Z  2025-12-04T08:11:01.1872905Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:11:01.1873754Z  and the text below is the list of opted in users. 2025-12-04T08:11:01.1874370Z  2025-12-04T08:11:01.1875036Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:11:01.1875844Z  """ 2025-12-04T08:11:01.1876483Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:11:01.1877336Z  return parse_settings_from_text(settings_text) 2025-12-04T08:11:01.1877941Z  2025-12-04T08:11:01.1878323Z  2025-12-04T08:11:01.1878839Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:11:01.1879471Z  """ 2025-12-04T08:11:01.1879939Z  Parse users from the rollout state. 2025-12-04T08:11:01.1880502Z  2025-12-04T08:11:01.1880878Z  """ 2025-12-04T08:11:01.1881500Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:11:01.1882599Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:11:01.1883217Z  2025-12-04T08:11:01.1883592Z  2025-12-04T08:11:01.1884283Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:11:01.1885107Z  """ 2025-12-04T08:11:01.1885609Z  Check if a user is opted into an experiment 2025-12-04T08:11:01.1886198Z  """ 2025-12-04T08:11:01.1886746Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:11:01.1887387Z  2025-12-04T08:11:01.1887928Z  2025-12-04T08:11:01.1888619Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:11:01.1889449Z  """ 2025-12-04T08:11:01.1889991Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:11:01.1890629Z  """ 2025-12-04T08:11:01.1891224Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:11:01.1892105Z  experiment_optout = "-" + experiment_name 2025-12-04T08:11:01.1892842Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:11:01.1893511Z  return False 2025-12-04T08:11:01.1893981Z  2025-12-04T08:11:01.1894522Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:11:01.1895190Z  log.warning( 2025-12-04T08:11:01.1896126Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:11:01.1897073Z  ) 2025-12-04T08:11:01.1897494Z  2025-12-04T08:11:01.1897885Z  return True 2025-12-04T08:11:01.1898344Z  2025-12-04T08:11:01.1898719Z  2025-12-04T08:11:01.1899132Z def get_runner_prefix( 2025-12-04T08:11:01.1899652Z  rollout_state: str, 2025-12-04T08:11:01.1900201Z  workflow_requestors: Iterable[str], 2025-12-04T08:11:01.1900776Z  branch: str, 2025-12-04T08:11:01.1901371Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:11:01.1902232Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:11:01.1902885Z  is_canary: bool = False, 2025-12-04T08:11:01.1903410Z ) -> str: 2025-12-04T08:11:01.1903923Z  settings = parse_settings(rollout_state) 2025-12-04T08:11:01.1904618Z  user_optins = parse_users(rollout_state) 2025-12-04T08:11:01.1905208Z  2025-12-04T08:11:01.1905806Z  fleet_prefix = "" 2025-12-04T08:11:01.1906321Z  prefixes = [] 2025-12-04T08:11:01.1907046Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:11:01.1908084Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:11:01.1908860Z  log.info( 2025-12-04T08:11:01.1909643Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:11:01.1910461Z  ) 2025-12-04T08:11:01.1910934Z  continue 2025-12-04T08:11:01.1911409Z  2025-12-04T08:11:01.1911825Z  if opt_out_experiments: 2025-12-04T08:11:01.1912655Z  if experiment_name in opt_out_experiments: 2025-12-04T08:11:01.1913399Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:11:01.1914113Z  log.info( 2025-12-04T08:11:01.1915142Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:11:01.1916181Z  ) 2025-12-04T08:11:01.1916705Z  continue 2025-12-04T08:11:01.1917202Z  2025-12-04T08:11:01.1917628Z  if eligible_experiments: 2025-12-04T08:11:01.1918282Z  if experiment_name not in eligible_experiments: 2025-12-04T08:11:01.1918993Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:11:01.1919615Z  log.info( 2025-12-04T08:11:01.1920491Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:11:01.1921395Z  ) 2025-12-04T08:11:01.1921865Z  continue 2025-12-04T08:11:01.1922705Z  elif not experiment_settings.default: 2025-12-04T08:11:01.1923303Z  log.info( 2025-12-04T08:11:01.1924050Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:11:01.1924847Z  ) 2025-12-04T08:11:01.1925291Z  continue 2025-12-04T08:11:01.1925760Z  2025-12-04T08:11:01.1926308Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:11:01.1927011Z  opted_out_users = [ 2025-12-04T08:11:01.1927551Z  requestor 2025-12-04T08:11:01.1928101Z  for requestor in workflow_requestors 2025-12-04T08:11:01.1928869Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:11:01.1929557Z  ] 2025-12-04T08:11:01.1929974Z  2025-12-04T08:11:01.1930381Z  if opted_out_users: 2025-12-04T08:11:01.1930927Z  log.info( 2025-12-04T08:11:01.1931648Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:11:01.1932507Z  ) 2025-12-04T08:11:01.1932963Z  continue 2025-12-04T08:11:01.1933426Z  2025-12-04T08:11:01.1933945Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:11:01.1934624Z  opted_in_users = [ 2025-12-04T08:11:01.1935162Z  requestor 2025-12-04T08:11:01.1935703Z  for requestor in workflow_requestors 2025-12-04T08:11:01.1936459Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:11:01.1937146Z  ] 2025-12-04T08:11:01.1937559Z  2025-12-04T08:11:01.1937962Z  enabled = False 2025-12-04T08:11:01.1938476Z  if opted_in_users: 2025-12-04T08:11:01.1939122Z  log.info( 2025-12-04T08:11:01.1939827Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:11:01.1940566Z  ) 2025-12-04T08:11:01.1941022Z  enabled = True 2025-12-04T08:11:01.1941514Z  2025-12-04T08:11:01.1942075Z  elif experiment_settings.rollout_perc: 2025-12-04T08:11:01.1943001Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:11:01.1944043Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:11:01.1944762Z  log.info( 2025-12-04T08:11:01.1945730Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:11:01.1946725Z  ) 2025-12-04T08:11:01.1947213Z  enabled = True 2025-12-04T08:11:01.1947731Z  2025-12-04T08:11:01.1948122Z  if enabled: 2025-12-04T08:11:01.1948641Z  label = experiment_name 2025-12-04T08:11:01.1949263Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:11:01.1950169Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:11:01.1951127Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:11:01.1952066Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:11:01.1952816Z  if is_canary: 2025-12-04T08:11:01.1953395Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:11:01.1954003Z  fleet_prefix = label 2025-12-04T08:11:01.1954555Z  else: 2025-12-04T08:11:01.1955210Z  prefixes.append(label) 2025-12-04T08:11:01.1955764Z  2025-12-04T08:11:01.1956171Z  if len(prefixes) > 1: 2025-12-04T08:11:01.1956713Z  log.error( 2025-12-04T08:11:01.1957852Z  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:11:01.1959034Z  ) 2025-12-04T08:11:01.1959494Z  prefixes = prefixes[:1] 2025-12-04T08:11:01.1960024Z  2025-12-04T08:11:01.1960435Z  # Fleet always comes first 2025-12-04T08:11:01.1960976Z  if fleet_prefix: 2025-12-04T08:11:01.1961507Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:11:01.1962161Z  2025-12-04T08:11:01.1962665Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:11:01.1963287Z  2025-12-04T08:11:01.1963666Z  2025-12-04T08:11:01.1964365Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:11:01.1965191Z  """ 2025-12-04T08:11:01.1965852Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:11:01.1966617Z  2025-12-04T08:11:01.1967257Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:11:01.1968030Z  """ 2025-12-04T08:11:01.1968484Z  gh = get_gh_client(github_token) 2025-12-04T08:11:01.1969119Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:11:01.1969846Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:11:01.1970506Z  2025-12-04T08:11:01.1970888Z  2025-12-04T08:11:01.1971563Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:11:01.1972705Z  for _ in range(num_retries): 2025-12-04T08:11:01.1973274Z  try: 2025-12-04T08:11:01.1973790Z  req = Request(url=url, headers=headers) 2025-12-04T08:11:01.1974533Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:11:01.1975255Z  return json.loads(content) 2025-12-04T08:11:01.1975852Z  except Exception as e: 2025-12-04T08:11:01.1976506Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:11:01.1977119Z  2025-12-04T08:11:01.1977765Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:11:01.1978548Z  return {} 2025-12-04T08:11:01.1978987Z  2025-12-04T08:11:01.1979371Z  2025-12-04T08:11:01.1979754Z @cache 2025-12-04T08:11:01.1980476Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:11:01.1981317Z  """ 2025-12-04T08:11:01.1981803Z  Dynamically get PR information 2025-12-04T08:11:01.1982463Z  """ 2025-12-04T08:11:01.1983049Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:11:01.1983747Z  headers = { 2025-12-04T08:11:01.1984297Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:11:01.1984994Z  "Authorization": f"token {github_token}", 2025-12-04T08:11:01.1985582Z  } 2025-12-04T08:11:01.1986093Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:11:01.1986773Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:11:01.1987381Z  headers=headers, 2025-12-04T08:11:01.1987884Z  ) 2025-12-04T08:11:01.1988285Z  2025-12-04T08:11:01.1988708Z  if not json_response: 2025-12-04T08:11:01.1989384Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:11:01.1990225Z  return {} 2025-12-04T08:11:01.1990687Z  2025-12-04T08:11:01.1991102Z  return json_response 2025-12-04T08:11:01.1991607Z  2025-12-04T08:11:01.1992182Z  2025-12-04T08:11:01.1992988Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:11:01.1993792Z  """ 2025-12-04T08:11:01.1994410Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:11:01.1995121Z  """ 2025-12-04T08:11:01.1995692Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:11:01.1996369Z  return { 2025-12-04T08:11:01.1997130Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:11:01.1997881Z  } 2025-12-04T08:11:01.1998286Z  2025-12-04T08:11:01.1998671Z  2025-12-04T08:11:01.1999089Z def main() -> None: 2025-12-04T08:11:01.1999597Z  args = parse_args() 2025-12-04T08:11:01.2000100Z  2025-12-04T08:11:01.2000580Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:11:01.2001173Z  2025-12-04T08:11:01.2001611Z  # Check if the PR is opt-out 2025-12-04T08:11:01.2002285Z  if args.pr_number: 2025-12-04T08:11:01.2003047Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:11:01.2003881Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:11:01.2004465Z  log.info( 2025-12-04T08:11:01.2005274Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:11:01.2006105Z  ) 2025-12-04T08:11:01.2006758Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:11:01.2007529Z  sys.exit() 2025-12-04T08:11:01.2008154Z  2025-12-04T08:11:01.2008556Z  try: 2025-12-04T08:11:01.2009073Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:11:01.2009881Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:11:01.2010592Z  ) 2025-12-04T08:11:01.2011024Z  2025-12-04T08:11:01.2011478Z  username = get_potential_pr_author( 2025-12-04T08:11:01.2012185Z  args.github_token, 2025-12-04T08:11:01.2012757Z  args.github_repo, 2025-12-04T08:11:01.2013312Z  args.github_actor, 2025-12-04T08:11:01.2013889Z  args.github_ref_type, 2025-12-04T08:11:01.2014460Z  args.github_branch, 2025-12-04T08:11:01.2015006Z  ) 2025-12-04T08:11:01.2015423Z  2025-12-04T08:11:01.2015970Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:11:01.2016650Z  2025-12-04T08:11:01.2017120Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:11:01.2017745Z  rollout_state, 2025-12-04T08:11:01.2018331Z  (args.github_issue_owner, username), 2025-12-04T08:11:01.2018949Z  args.github_branch, 2025-12-04T08:11:01.2019535Z  args.eligible_experiments, 2025-12-04T08:11:01.2020155Z  args.opt_out_experiments, 2025-12-04T08:11:01.2020730Z  is_canary, 2025-12-04T08:11:01.2021216Z  ) 2025-12-04T08:11:01.2021639Z  2025-12-04T08:11:01.2022144Z  except Exception as e: 2025-12-04T08:11:01.2022687Z  log.error( 2025-12-04T08:11:01.2023473Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:11:01.2024304Z  ) 2025-12-04T08:11:01.2024864Z  2025-12-04T08:11:01.2025466Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:11:01.2026186Z  2025-12-04T08:11:01.2026569Z  2025-12-04T08:11:01.2026984Z if __name__ == "__main__": 2025-12-04T08:11:01.2027499Z  main() 2025-12-04T08:11:01.2027930Z  2025-12-04T08:11:01.2028307Z EOF 2025-12-04T08:11:01.2028700Z  2025-12-04T08:11:01.2029111Z cat runner_determinator.py 2025-12-04T08:11:01.2472701Z shell: /usr/bin/bash -e {0} 2025-12-04T08:11:01.2473707Z env: 2025-12-04T08:11:01.2474496Z GITHUB_TOKEN: *** 2025-12-04T08:11:01.2474933Z ISSUE_NUMBER: 5132 2025-12-04T08:11:01.2475391Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:11:01.2475909Z ISSUE_OWNER: 2025-12-04T08:11:01.2476320Z CHECK_EXPERIMENTS: 2025-12-04T08:11:01.2476807Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:11:01.2477229Z PR_NUMBER: 2025-12-04T08:11:01.2477668Z ##[endgroup] 2025-12-04T08:11:01.2697640Z # flake8: noqa: G004 2025-12-04T08:11:01.2698015Z 2025-12-04T08:11:01.2698469Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:11:01.2699457Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:11:01.2700290Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:11:01.2700735Z 2025-12-04T08:11:01.2700915Z """ 2025-12-04T08:11:01.2701506Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:11:01.2702689Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:11:01.2703594Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:11:01.2704406Z of which runners should be used to run which job. 2025-12-04T08:11:01.2704807Z 2025-12-04T08:11:01.2705201Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:11:01.2706329Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:11:01.2707236Z settings are considered to be empty with only the second part, the user 2025-12-04T08:11:01.2707941Z list, defined. 2025-12-04T08:11:01.2708176Z 2025-12-04T08:11:01.2708551Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:11:01.2709493Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:11:01.2710338Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:11:01.2710779Z 2025-12-04T08:11:01.2711182Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:11:01.2712777Z The user list is also a comma separated list of additional features or 2025-12-04T08:11:01.2713577Z experiments which the user could be opted in to. 2025-12-04T08:11:01.2713982Z 2025-12-04T08:11:01.2714198Z The user list has the following rules: 2025-12-04T08:11:01.2714553Z 2025-12-04T08:11:01.2714897Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:11:01.2715772Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:11:01.2716560Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:11:01.2716957Z 2025-12-04T08:11:01.2717155Z Example config: 2025-12-04T08:11:01.2717621Z # A list of experiments that can be opted into. 2025-12-04T08:11:01.2718298Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:11:01.2718932Z # Expected syntax is: 2025-12-04T08:11:01.2719587Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:11:01.2720574Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:11:01.2721187Z 2025-12-04T08:11:01.2721375Z experiments: 2025-12-04T08:11:01.2721785Z lf: 2025-12-04T08:11:01.2722371Z rollout_percent: 25 2025-12-04T08:11:01.2722857Z all_branches: false 2025-12-04T08:11:01.2723517Z default: true 2025-12-04T08:11:01.2723950Z --- 2025-12-04T08:11:01.2724153Z 2025-12-04T08:11:01.2724331Z # Opt-ins: 2025-12-04T08:11:01.2724925Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:11:01.2725780Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:11:01.2726570Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:11:01.2727234Z # Experiments should be from the above list. 2025-12-04T08:11:01.2727614Z 2025-12-04T08:11:01.2727816Z @User1,-lf,split_build 2025-12-04T08:11:01.2728267Z @User2,lf 2025-12-04T08:11:01.2728666Z @User3,split_build 2025-12-04T08:11:01.2729091Z """ 2025-12-04T08:11:01.2729286Z 2025-12-04T08:11:01.2729469Z import json 2025-12-04T08:11:01.2729863Z import logging 2025-12-04T08:11:01.2730263Z import os 2025-12-04T08:11:01.2730656Z import random 2025-12-04T08:11:01.2731045Z import re 2025-12-04T08:11:01.2731496Z import sys 2025-12-04T08:11:01.2731917Z from argparse import ArgumentParser 2025-12-04T08:11:01.2732752Z from collections.abc import Iterable 2025-12-04T08:11:01.2733307Z from functools import cache 2025-12-04T08:11:01.2733796Z from logging import LogRecord 2025-12-04T08:11:01.2734299Z from typing import Any, NamedTuple 2025-12-04T08:11:01.2734842Z from urllib.request import Request, urlopen 2025-12-04T08:11:01.2735227Z 2025-12-04T08:11:01.2735404Z import yaml 2025-12-04T08:11:01.2735808Z from github import Auth, Github 2025-12-04T08:11:01.2736326Z from github.Issue import Issue 2025-12-04T08:11:01.2736631Z 2025-12-04T08:11:01.2736638Z 2025-12-04T08:11:01.2736878Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:11:01.2737747Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:11:01.2738631Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:11:01.2739198Z 2025-12-04T08:11:01.2739442Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:11:01.2740194Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:11:01.2740724Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:11:01.2741291Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:11:01.2741644Z 2025-12-04T08:11:01.2741863Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:11:01.2742477Z 2025-12-04T08:11:01.2742690Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:11:01.2743175Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:11:01.2743455Z 2025-12-04T08:11:01.2743461Z 2025-12-04T08:11:01.2743664Z class Experiment(NamedTuple): 2025-12-04T08:11:01.2744163Z rollout_perc: float = ( 2025-12-04T08:11:01.2744814Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:11:01.2745517Z ) 2025-12-04T08:11:01.2745908Z all_branches: bool = ( 2025-12-04T08:11:01.2746590Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:11:01.2747415Z ) 2025-12-04T08:11:01.2747804Z default: bool = ( 2025-12-04T08:11:01.2748392Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:11:01.2749052Z ) 2025-12-04T08:11:01.2749255Z 2025-12-04T08:11:01.2749448Z # Add more fields as needed 2025-12-04T08:11:01.2749754Z 2025-12-04T08:11:01.2749760Z 2025-12-04T08:11:01.2749966Z class Settings(NamedTuple): 2025-12-04T08:11:01.2750419Z """ 2025-12-04T08:11:01.2750884Z Settings for the experiments that can be opted into. 2025-12-04T08:11:01.2751466Z """ 2025-12-04T08:11:01.2751662Z 2025-12-04T08:11:01.2751890Z experiments: dict[str, Experiment] = {} 2025-12-04T08:11:01.2752498Z 2025-12-04T08:11:01.2752504Z 2025-12-04T08:11:01.2752734Z class ColorFormatter(logging.Formatter): 2025-12-04T08:11:01.2753379Z """Color codes the log messages based on the log level""" 2025-12-04T08:11:01.2753809Z 2025-12-04T08:11:01.2753992Z COLORS = { 2025-12-04T08:11:01.2754401Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:11:01.2755093Z "ERROR": "\033[31m", # Red 2025-12-04T08:11:01.2755611Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:11:01.2756127Z "INFO": "\033[0m", # Reset 2025-12-04T08:11:01.2756622Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:11:01.2757114Z } 2025-12-04T08:11:01.2757409Z 2025-12-04T08:11:01.2757821Z def format(self, record: LogRecord) -> str: 2025-12-04T08:11:01.2759039Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:11:01.2759884Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:11:01.2760482Z return super().format(record) 2025-12-04T08:11:01.2760818Z 2025-12-04T08:11:01.2760825Z 2025-12-04T08:11:01.2761039Z handler = logging.StreamHandler() 2025-12-04T08:11:01.2761746Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:11:01.2762517Z 2025-12-04T08:11:01.2762779Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:11:01.2763379Z log.addHandler(handler) 2025-12-04T08:11:01.2763860Z log.setLevel(logging.INFO) 2025-12-04T08:11:01.2764151Z 2025-12-04T08:11:01.2764157Z 2025-12-04T08:11:01.2764427Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:11:01.2764995Z """ 2025-12-04T08:11:01.2765512Z Defines outputs of the github action that invokes this script 2025-12-04T08:11:01.2766152Z """ 2025-12-04T08:11:01.2766529Z if not GITHUB_OUTPUT: 2025-12-04T08:11:01.2767610Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:11:01.2768743Z log.warning( 2025-12-04T08:11:01.2769606Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:11:01.2770537Z ) 2025-12-04T08:11:01.2781085Z print(f"::set-output name={key}::{value}") 2025-12-04T08:11:01.2781734Z return 2025-12-04T08:11:01.2782263Z 2025-12-04T08:11:01.2782751Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:11:01.2783508Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:11:01.2784104Z f.write(f"{key}={value}\n") 2025-12-04T08:11:01.2784431Z 2025-12-04T08:11:01.2784449Z 2025-12-04T08:11:01.2784765Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:11:01.2785405Z return frozenset( 2025-12-04T08:11:01.2786033Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:11:01.2786718Z ) 2025-12-04T08:11:01.2786923Z 2025-12-04T08:11:01.2786931Z 2025-12-04T08:11:01.2787121Z def parse_args() -> Any: 2025-12-04T08:11:01.2787703Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:11:01.2788565Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:11:01.2789344Z parser.add_argument( 2025-12-04T08:11:01.2789812Z "--github-issue-repo", 2025-12-04T08:11:01.2790289Z type=str, 2025-12-04T08:11:01.2790727Z required=False, 2025-12-04T08:11:01.2791206Z default="pytorch/test-infra", 2025-12-04T08:11:01.2791761Z help="GitHub repo to get the issue", 2025-12-04T08:11:01.2792519Z ) 2025-12-04T08:11:01.2792916Z parser.add_argument( 2025-12-04T08:11:01.2793391Z "--github-repo", 2025-12-04T08:11:01.2793848Z type=str, 2025-12-04T08:11:01.2794263Z required=True, 2025-12-04T08:11:01.2794745Z help="GitHub repo where CI is running", 2025-12-04T08:11:01.2795290Z ) 2025-12-04T08:11:01.2795693Z parser.add_argument( 2025-12-04T08:11:01.2796324Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:11:01.2797006Z ) 2025-12-04T08:11:01.2797388Z parser.add_argument( 2025-12-04T08:11:01.2798033Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:11:01.2798723Z ) 2025-12-04T08:11:01.2799105Z parser.add_argument( 2025-12-04T08:11:01.2799936Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:11:01.2800648Z ) 2025-12-04T08:11:01.2801036Z parser.add_argument( 2025-12-04T08:11:01.2801698Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:11:01.2802649Z ) 2025-12-04T08:11:01.2803041Z parser.add_argument( 2025-12-04T08:11:01.2803515Z "--github-ref-type", 2025-12-04T08:11:01.2803986Z type=str, 2025-12-04T08:11:01.2804403Z required=True, 2025-12-04T08:11:01.2804904Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:11:01.2805466Z ) 2025-12-04T08:11:01.2805856Z parser.add_argument( 2025-12-04T08:11:01.2806329Z "--eligible-experiments", 2025-12-04T08:11:01.2859932Z type=_str_comma_separated_to_set, 2025-12-04T08:11:01.2861098Z required=False, 2025-12-04T08:11:01.2861845Z default="", 2025-12-04T08:11:01.2863069Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:11:01.2864022Z ) 2025-12-04T08:11:01.2864412Z parser.add_argument( 2025-12-04T08:11:01.2864900Z "--opt-out-experiments", 2025-12-04T08:11:01.2865414Z type=_str_comma_separated_to_set, 2025-12-04T08:11:01.2865951Z required=False, 2025-12-04T08:11:01.2866380Z default="", 2025-12-04T08:11:01.2866787Z help=( 2025-12-04T08:11:01.2867464Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:11:01.2868593Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:11:01.2869430Z ), 2025-12-04T08:11:01.2869797Z ) 2025-12-04T08:11:01.2870186Z parser.add_argument( 2025-12-04T08:11:01.2870634Z "--pr-number", 2025-12-04T08:11:01.2871062Z type=str, 2025-12-04T08:11:01.2871473Z required=False, 2025-12-04T08:11:01.2871920Z default="", 2025-12-04T08:11:01.2872944Z help="the optional PR number where this is run", 2025-12-04T08:11:01.2873539Z ) 2025-12-04T08:11:01.2873744Z 2025-12-04T08:11:01.2873951Z return parser.parse_args() 2025-12-04T08:11:01.2874261Z 2025-12-04T08:11:01.2874268Z 2025-12-04T08:11:01.2874677Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:11:01.2875690Z auth = Auth.Token(github_token) 2025-12-04T08:11:01.2876213Z return Github(auth=auth) 2025-12-04T08:11:01.2876512Z 2025-12-04T08:11:01.2876520Z 2025-12-04T08:11:01.2876983Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:11:01.2877785Z repo = gh.get_repo(repo) 2025-12-04T08:11:01.2878429Z return repo.get_issue(number=issue_num) 2025-12-04T08:11:01.2878878Z 2025-12-04T08:11:01.2878885Z 2025-12-04T08:11:01.2879103Z def get_potential_pr_author( 2025-12-04T08:11:01.2879753Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:11:01.2880439Z ) -> str: 2025-12-04T08:11:01.2880956Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:11:01.2881769Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:11:01.2882732Z # embedded in the tag name: ciflow// 2025-12-04T08:11:01.2883156Z 2025-12-04T08:11:01.2883360Z gh = get_gh_client(github_token) 2025-12-04T08:11:01.2883690Z 2025-12-04T08:11:01.2883977Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:11:01.2884608Z split_tag = ref_name.split("/") 2025-12-04T08:11:01.2885119Z if ( 2025-12-04T08:11:01.2885520Z len(split_tag) == 3 2025-12-04T08:11:01.2886018Z and split_tag[0] == "ciflow" 2025-12-04T08:11:01.2886554Z and split_tag[2].isnumeric() 2025-12-04T08:11:01.2887061Z ): 2025-12-04T08:11:01.2887452Z pr_number = split_tag[2] 2025-12-04T08:11:01.2888129Z try: 2025-12-04T08:11:01.2888575Z repository = gh.get_repo(repo) 2025-12-04T08:11:01.2889194Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:11:01.2889802Z except Exception as e: 2025-12-04T08:11:01.2890328Z raise Exception( # noqa: TRY002 2025-12-04T08:11:01.2891002Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:11:01.2891646Z ) from e 2025-12-04T08:11:01.2892471Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:11:01.2893205Z # In all other cases, return the original input username 2025-12-04T08:11:01.2893796Z return username 2025-12-04T08:11:01.2894044Z 2025-12-04T08:11:01.2894051Z 2025-12-04T08:11:01.2894301Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:11:01.2894846Z """ 2025-12-04T08:11:01.2895496Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:11:01.2896280Z """ 2025-12-04T08:11:01.2896841Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:11:01.2897350Z 2025-12-04T08:11:01.2897358Z 2025-12-04T08:11:01.2897570Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:11:01.2898067Z try: 2025-12-04T08:11:01.2898472Z data = yaml.safe_load(yaml_text) 2025-12-04T08:11:01.2898987Z return data 2025-12-04T08:11:01.2899412Z except yaml.YAMLError: 2025-12-04T08:11:01.2899902Z log.exception("Error loading YAML") 2025-12-04T08:11:01.2900428Z raise 2025-12-04T08:11:01.2900645Z 2025-12-04T08:11:01.2900652Z 2025-12-04T08:11:01.2901084Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:11:01.2901833Z """ 2025-12-04T08:11:01.2902733Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:11:01.2903330Z 2025-12-04T08:11:01.2903878Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:11:01.2904679Z and the text below is the list of opted in users. 2025-12-04T08:11:01.2905078Z 2025-12-04T08:11:01.2905451Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:11:01.2906164Z """ 2025-12-04T08:11:01.2906807Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:11:01.2907929Z if len(rollout_state_parts) >= 2: 2025-12-04T08:11:01.2908978Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:11:01.2910104Z else: 2025-12-04T08:11:01.2910859Z return "", rollout_state 2025-12-04T08:11:01.2911460Z 2025-12-04T08:11:01.2911475Z 2025-12-04T08:11:01.2911848Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:11:01.2912665Z """ 2025-12-04T08:11:01.2913236Z Dictionary of users with a list of features they have opted into 2025-12-04T08:11:01.2913897Z """ 2025-12-04T08:11:01.2914099Z 2025-12-04T08:11:01.2914122Z 2025-12-04T08:11:01.2914485Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:11:01.2915153Z """ 2025-12-04T08:11:01.2915886Z 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:11:01.2916572Z 2025-12-04T08:11:01.2917192Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:11:01.2918195Z - Example line: "@User1,lf,split_build" 2025-12-04T08:11:01.2918884Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:11:01.2919370Z 2025-12-04T08:11:01.2919378Z 2025-12-04T08:11:01.2919547Z """ 2025-12-04T08:11:01.2919935Z optins = UserOptins() 2025-12-04T08:11:01.2920430Z for user in user_optin_text.split("\n"): 2025-12-04T08:11:01.2920998Z user = user.strip("\r\n\t -") 2025-12-04T08:11:01.2921547Z if not user or not user.startswith("@"): 2025-12-04T08:11:01.2922542Z # Not a valid user. Skip 2025-12-04T08:11:01.2923047Z continue 2025-12-04T08:11:01.2923302Z 2025-12-04T08:11:01.2923478Z if user: 2025-12-04T08:11:01.2923933Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:11:01.2924636Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:11:01.2925122Z 2025-12-04T08:11:01.2925304Z return optins 2025-12-04T08:11:01.2925540Z 2025-12-04T08:11:01.2925547Z 2025-12-04T08:11:01.2925839Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:11:01.2926456Z """ 2025-12-04T08:11:01.2926865Z Check if the experiment name is valid. 2025-12-04T08:11:01.2927397Z A valid name: 2025-12-04T08:11:01.2928038Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:11:01.2929003Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:11:01.2929747Z - Cannot contain spaces 2025-12-04T08:11:01.2930217Z """ 2025-12-04T08:11:01.2930424Z 2025-12-04T08:11:01.2930697Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:11:01.2931405Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:11:01.2931851Z 2025-12-04T08:11:01.2932250Z if valid: 2025-12-04T08:11:01.2932689Z return True 2025-12-04T08:11:01.2932932Z 2025-12-04T08:11:01.2933108Z log.error( 2025-12-04T08:11:01.2934566Z 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:11:01.2936222Z ) 2025-12-04T08:11:01.2936606Z return False 2025-12-04T08:11:01.2936839Z 2025-12-04T08:11:01.2936846Z 2025-12-04T08:11:01.2937164Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:11:01.2937797Z """ 2025-12-04T08:11:01.2938549Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:11:01.2939294Z """ 2025-12-04T08:11:01.2939664Z try: 2025-12-04T08:11:01.2940045Z if settings_text: 2025-12-04T08:11:01.2940783Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:11:01.2941584Z # for easy reading 2025-12-04T08:11:01.2943044Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:11:01.2943977Z # the backtick character in shell commands. 2025-12-04T08:11:01.2944587Z backtick = chr(96) # backtick character 2025-12-04T08:11:01.2945258Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:11:01.2945927Z settings = load_yaml(settings_text) 2025-12-04T08:11:01.2946321Z 2025-12-04T08:11:01.2946748Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:11:01.2947535Z experiments = {} 2025-12-04T08:11:01.2947835Z 2025-12-04T08:11:01.2948243Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:11:01.2949028Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:11:01.2950142Z # 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:11:01.2951204Z continue 2025-12-04T08:11:01.2951490Z 2025-12-04T08:11:01.2951694Z valid_settings = {} 2025-12-04T08:11:01.2952369Z for setting in exp_settings: 2025-12-04T08:11:01.2952957Z if setting not in Experiment._fields: 2025-12-04T08:11:01.2953520Z log.warning( 2025-12-04T08:11:01.2954231Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:11:01.2955123Z ) 2025-12-04T08:11:01.2955788Z else: 2025-12-04T08:11:01.2956510Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:11:01.2956949Z 2025-12-04T08:11:01.2957234Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:11:01.2957882Z return Settings(experiments) 2025-12-04T08:11:01.2958238Z 2025-12-04T08:11:01.2958426Z except Exception: 2025-12-04T08:11:01.2958915Z log.exception("Failed to parse settings") 2025-12-04T08:11:01.2959307Z 2025-12-04T08:11:01.2959490Z return Settings() 2025-12-04T08:11:01.2959760Z 2025-12-04T08:11:01.2959766Z 2025-12-04T08:11:01.2960025Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:11:01.2960604Z """ 2025-12-04T08:11:01.2961055Z Parse settings, if any, from the rollout state. 2025-12-04T08:11:01.2961460Z 2025-12-04T08:11:01.2961826Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:11:01.2962728Z and the text below is the list of opted in users. 2025-12-04T08:11:01.2963142Z 2025-12-04T08:11:01.2963558Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:11:01.2964300Z """ 2025-12-04T08:11:01.2964865Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:11:01.2965631Z return parse_settings_from_text(settings_text) 2025-12-04T08:11:01.2966028Z 2025-12-04T08:11:01.2966035Z 2025-12-04T08:11:01.2966288Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:11:01.2966861Z """ 2025-12-04T08:11:01.2967257Z Parse users from the rollout state. 2025-12-04T08:11:01.2967611Z 2025-12-04T08:11:01.2967781Z """ 2025-12-04T08:11:01.2968311Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:11:01.2969073Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:11:01.2969476Z 2025-12-04T08:11:01.2969483Z 2025-12-04T08:11:01.2970054Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:11:01.2970818Z """ 2025-12-04T08:11:01.2971250Z Check if a user is opted into an experiment 2025-12-04T08:11:01.2971798Z """ 2025-12-04T08:11:01.2972372Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:11:01.2972799Z 2025-12-04T08:11:01.2972805Z 2025-12-04T08:11:01.2973227Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:11:01.2973988Z """ 2025-12-04T08:11:01.2974459Z Check if a user explicitly opted out of an experiment 2025-12-04T08:11:01.2975040Z """ 2025-12-04T08:11:01.2975555Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:11:01.2976241Z experiment_optout = "-" + experiment_name 2025-12-04T08:11:01.2976896Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:11:01.2977514Z return False 2025-12-04T08:11:01.2977789Z 2025-12-04T08:11:01.2978077Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:11:01.2978694Z log.warning( 2025-12-04T08:11:01.2979509Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:11:01.2980404Z ) 2025-12-04T08:11:01.2980614Z 2025-12-04T08:11:01.2980791Z return True 2025-12-04T08:11:01.2981036Z 2025-12-04T08:11:01.2981043Z 2025-12-04T08:11:01.2981233Z def get_runner_prefix( 2025-12-04T08:11:01.2981683Z rollout_state: str, 2025-12-04T08:11:01.2982263Z workflow_requestors: Iterable[str], 2025-12-04T08:11:01.2982800Z branch: str, 2025-12-04T08:11:01.2983306Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:11:01.2983986Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:11:01.2984582Z is_canary: bool = False, 2025-12-04T08:11:01.2985053Z ) -> str: 2025-12-04T08:11:01.2985481Z settings = parse_settings(rollout_state) 2025-12-04T08:11:01.2986232Z user_optins = parse_users(rollout_state) 2025-12-04T08:11:01.2986609Z 2025-12-04T08:11:01.2986800Z fleet_prefix = "" 2025-12-04T08:11:01.2987240Z prefixes = [] 2025-12-04T08:11:01.2987875Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:11:01.2988828Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:11:01.2989557Z log.info( 2025-12-04T08:11:01.2990243Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:11:01.2991018Z ) 2025-12-04T08:11:01.2991408Z continue 2025-12-04T08:11:01.2991682Z 2025-12-04T08:11:01.2991889Z if opt_out_experiments: 2025-12-04T08:11:01.2992550Z if experiment_name in opt_out_experiments: 2025-12-04T08:11:01.2993210Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:11:01.2993819Z log.info( 2025-12-04T08:11:01.2994757Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:11:01.2995751Z ) 2025-12-04T08:11:01.2996166Z continue 2025-12-04T08:11:01.2996446Z 2025-12-04T08:11:01.2996646Z if eligible_experiments: 2025-12-04T08:11:01.2997250Z if experiment_name not in eligible_experiments: 2025-12-04T08:11:01.2997907Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:11:01.2998491Z log.info( 2025-12-04T08:11:01.2999286Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:11:01.3000144Z ) 2025-12-04T08:11:01.3000556Z continue 2025-12-04T08:11:01.3001045Z elif not experiment_settings.default: 2025-12-04T08:11:01.3001591Z log.info( 2025-12-04T08:11:01.3002491Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:11:01.3003259Z ) 2025-12-04T08:11:01.3003664Z continue 2025-12-04T08:11:01.3003918Z 2025-12-04T08:11:01.3004211Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:11:01.3004835Z opted_out_users = [ 2025-12-04T08:11:01.3005300Z requestor 2025-12-04T08:11:01.3005772Z for requestor in workflow_requestors 2025-12-04T08:11:01.3006463Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:11:01.3007103Z ] 2025-12-04T08:11:01.3007321Z 2025-12-04T08:11:01.3007509Z if opted_out_users: 2025-12-04T08:11:01.3007973Z log.info( 2025-12-04T08:11:01.3008603Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:11:01.3009322Z ) 2025-12-04T08:11:01.3009714Z continue 2025-12-04T08:11:01.3009972Z 2025-12-04T08:11:01.3010271Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:11:01.3010934Z opted_in_users = [ 2025-12-04T08:11:01.3011402Z requestor 2025-12-04T08:11:01.3011870Z for requestor in workflow_requestors 2025-12-04T08:11:01.3012658Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:11:01.3013345Z ] 2025-12-04T08:11:01.3013562Z 2025-12-04T08:11:01.3013745Z enabled = False 2025-12-04T08:11:01.3014209Z if opted_in_users: 2025-12-04T08:11:01.3014670Z log.info( 2025-12-04T08:11:01.3015296Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:11:01.3015995Z ) 2025-12-04T08:11:01.3016407Z enabled = True 2025-12-04T08:11:01.3016693Z 2025-12-04T08:11:01.3016923Z elif experiment_settings.rollout_perc: 2025-12-04T08:11:01.3017789Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:11:01.3018896Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:11:01.3019564Z log.info( 2025-12-04T08:11:01.3020446Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:11:01.3021385Z ) 2025-12-04T08:11:01.3021818Z enabled = True 2025-12-04T08:11:01.3022233Z 2025-12-04T08:11:01.3022415Z if enabled: 2025-12-04T08:11:01.3022864Z label = experiment_name 2025-12-04T08:11:01.3023435Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:11:01.3024275Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:11:01.3025185Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:11:01.3025971Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:11:01.3026680Z if is_canary: 2025-12-04T08:11:01.3027192Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:11:01.3027765Z fleet_prefix = label 2025-12-04T08:11:01.3028277Z else: 2025-12-04T08:11:01.3028725Z prefixes.append(label) 2025-12-04T08:11:01.3029083Z 2025-12-04T08:11:01.3029285Z if len(prefixes) > 1: 2025-12-04T08:11:01.3029744Z log.error( 2025-12-04T08:11:01.3030786Z 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:11:01.3031917Z ) 2025-12-04T08:11:01.3032428Z prefixes = prefixes[:1] 2025-12-04T08:11:01.3032749Z 2025-12-04T08:11:01.3032955Z # Fleet always comes first 2025-12-04T08:11:01.3033448Z if fleet_prefix: 2025-12-04T08:11:01.3033918Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:11:01.3034292Z 2025-12-04T08:11:01.3034675Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:11:01.3035110Z 2025-12-04T08:11:01.3035123Z 2025-12-04T08:11:01.3035585Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:11:01.3036367Z """ 2025-12-04T08:11:01.3036967Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:11:01.3037535Z 2025-12-04T08:11:01.3037930Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:11:01.3038649Z """ 2025-12-04T08:11:01.3039058Z gh = get_gh_client(github_token) 2025-12-04T08:11:01.3039608Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:11:01.3040255Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:11:01.3040707Z 2025-12-04T08:11:01.3040714Z 2025-12-04T08:11:01.3041121Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:11:01.3041902Z for _ in range(num_retries): 2025-12-04T08:11:01.3042510Z try: 2025-12-04T08:11:01.3042949Z req = Request(url=url, headers=headers) 2025-12-04T08:11:01.3043625Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:11:01.3044278Z return json.loads(content) 2025-12-04T08:11:01.3044824Z except Exception as e: 2025-12-04T08:11:01.3045373Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:11:01.3045782Z 2025-12-04T08:11:01.3046171Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:11:01.3046888Z return {} 2025-12-04T08:11:01.3047119Z 2025-12-04T08:11:01.3047127Z 2025-12-04T08:11:01.3047295Z @cache 2025-12-04T08:11:01.3047926Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:11:01.3048699Z """ 2025-12-04T08:11:01.3049111Z Dynamically get PR information 2025-12-04T08:11:01.3049612Z """ 2025-12-04T08:11:01.3050339Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:11:01.3050971Z headers = { 2025-12-04T08:11:01.3051438Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:11:01.3052166Z "Authorization": f"token {github_token}", 2025-12-04T08:11:01.3052722Z } 2025-12-04T08:11:01.3053176Z json_response: dict[str, Any] = download_json( 2025-12-04T08:11:01.3053798Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:11:01.3054371Z headers=headers, 2025-12-04T08:11:01.3054808Z ) 2025-12-04T08:11:01.3055011Z 2025-12-04T08:11:01.3055213Z if not json_response: 2025-12-04T08:11:01.3055791Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:11:01.3056431Z return {} 2025-12-04T08:11:01.3056671Z 2025-12-04T08:11:01.3056864Z return json_response 2025-12-04T08:11:01.3057154Z 2025-12-04T08:11:01.3057161Z 2025-12-04T08:11:01.3057564Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:11:01.3058317Z """ 2025-12-04T08:11:01.3058853Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:11:01.3059541Z """ 2025-12-04T08:11:01.3060038Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:11:01.3060675Z return { 2025-12-04T08:11:01.3061281Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:11:01.3062096Z } 2025-12-04T08:11:01.3062308Z 2025-12-04T08:11:01.3062315Z 2025-12-04T08:11:01.3062504Z def main() -> None: 2025-12-04T08:11:01.3062933Z args = parse_args() 2025-12-04T08:11:01.3063206Z 2025-12-04T08:11:01.3063444Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:11:01.3063835Z 2025-12-04T08:11:01.3064031Z # Check if the PR is opt-out 2025-12-04T08:11:01.3064541Z if args.pr_number: 2025-12-04T08:11:01.3065197Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:11:01.3066114Z if OPT_OUT_LABEL in labels: 2025-12-04T08:11:01.3066641Z log.info( 2025-12-04T08:11:01.3067340Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:11:01.3068122Z ) 2025-12-04T08:11:01.3068684Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:11:01.3069372Z sys.exit() 2025-12-04T08:11:01.3069638Z 2025-12-04T08:11:01.3069810Z try: 2025-12-04T08:11:01.3070264Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:11:01.3070975Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:11:01.3071635Z ) 2025-12-04T08:11:01.3071846Z 2025-12-04T08:11:01.3072166Z username = get_potential_pr_author( 2025-12-04T08:11:01.3072726Z args.github_token, 2025-12-04T08:11:01.3073226Z args.github_repo, 2025-12-04T08:11:01.3073717Z args.github_actor, 2025-12-04T08:11:01.3074232Z args.github_ref_type, 2025-12-04T08:11:01.3074737Z args.github_branch, 2025-12-04T08:11:01.3075226Z ) 2025-12-04T08:11:01.3075437Z 2025-12-04T08:11:01.3075728Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:11:01.3076190Z 2025-12-04T08:11:01.3076413Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:11:01.3077051Z rollout_state, 2025-12-04T08:11:01.3077822Z (args.github_issue_owner, username), 2025-12-04T08:11:01.3078406Z args.github_branch, 2025-12-04T08:11:01.3078919Z args.eligible_experiments, 2025-12-04T08:11:01.3079493Z args.opt_out_experiments, 2025-12-04T08:11:01.3080010Z is_canary, 2025-12-04T08:11:01.3080443Z ) 2025-12-04T08:11:01.3080659Z 2025-12-04T08:11:01.3080857Z except Exception as e: 2025-12-04T08:11:01.3081328Z log.error( 2025-12-04T08:11:01.3082126Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:11:01.3083085Z ) 2025-12-04T08:11:01.3083302Z 2025-12-04T08:11:01.3083643Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:11:01.3084148Z 2025-12-04T08:11:01.3084155Z 2025-12-04T08:11:01.3084353Z if __name__ == "__main__": 2025-12-04T08:11:01.3084817Z main() 2025-12-04T08:11:01.3085032Z 2025-12-04T08:11:01.3179075Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:11:01.3179988Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:11:01.3212976Z shell: /usr/bin/bash -e {0} 2025-12-04T08:11:01.3213447Z env: 2025-12-04T08:11:01.3214068Z GITHUB_TOKEN: *** 2025-12-04T08:11:01.3214473Z ISSUE_NUMBER: 5132 2025-12-04T08:11:01.3214906Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:11:01.3215406Z ISSUE_OWNER: 2025-12-04T08:11:01.3215800Z CHECK_EXPERIMENTS: 2025-12-04T08:11:01.3216219Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:11:01.3216646Z PR_NUMBER: 2025-12-04T08:11:01.3217054Z ##[endgroup] 2025-12-04T08:11:02.3845790Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:11:03.2041921Z Collecting urllib3==1.26.18 2025-12-04T08:11:03.2606279Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:11:03.2817969Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-12-04T08:11:03.3100571Z Collecting PyGithub==2.3.0 2025-12-04T08:11:03.3179151Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:11:03.3707222Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:11:03.3787696Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:11:03.3842860Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:11:03.3863350Z 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:11:03.3879246Z 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:11:03.4181496Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:11:03.4253363Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:11:03.4494110Z 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:11:03.5831742Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:11:03.5908474Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:11:03.7581252Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:11:03.7659458Z 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:11:03.7930408Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:11:03.8007145Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:11:03.8292732Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:11:03.8402239Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 15.9 MB/s eta 0:00:00 2025-12-04T08:11:03.8508049Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:11:03.8610186Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 42.0 MB/s eta 0:00:00 2025-12-04T08:11:03.8686302Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:11:03.8835258Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 109.1 MB/s eta 0:00:00 2025-12-04T08:11:03.8910220Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:11:03.9008973Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:11:03.9063045Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 59.4 MB/s eta 0:00:00 2025-12-04T08:11:03.9136725Z 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:11:03.9212427Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 19.8 MB/s eta 0:00:00 2025-12-04T08:11:03.9289664Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:11:03.9347933Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 27.3 MB/s eta 0:00:00 2025-12-04T08:11:04.2379575Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:11:04.8023402Z 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:11:04.9125399Z ##[group]Run curr_branch="main" 2025-12-04T08:11:04.9125704Z curr_branch="main" 2025-12-04T08:11:04.9125927Z curr_ref_type="branch" 2025-12-04T08:11:04.9126169Z echo "Current branch is '$curr_branch'" 2025-12-04T08:11:04.9126451Z  2025-12-04T08:11:04.9126632Z python3 runner_determinator.py \ 2025-12-04T08:11:04.9126914Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:11:04.9127195Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:11:04.9127454Z  --github-branch "$curr_branch" \ 2025-12-04T08:11:04.9127719Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:11:04.9127995Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:11:04.9128277Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:11:04.9128543Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:11:04.9128843Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:11:04.9129214Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:11:04.9129502Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:11:04.9163152Z shell: /usr/bin/bash -e {0} 2025-12-04T08:11:04.9163375Z env: 2025-12-04T08:11:04.9163950Z GITHUB_TOKEN: *** 2025-12-04T08:11:04.9164142Z ISSUE_NUMBER: 5132 2025-12-04T08:11:04.9164349Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:11:04.9164572Z ISSUE_OWNER: 2025-12-04T08:11:04.9164754Z CHECK_EXPERIMENTS: 2025-12-04T08:11:04.9164938Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:11:04.9165118Z PR_NUMBER: 2025-12-04T08:11:04.9165278Z ##[endgroup] 2025-12-04T08:11:04.9217468Z Current branch is 'main' 2025-12-04T08:11:06.4485671Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:11:06.4487882Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:11:06.4488850Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:11:06.4489413Z INFO : Setting output: label-type='' 2025-12-04T08:11:06.4833044Z Evaluate and set job outputs 2025-12-04T08:11:06.4840361Z Cleaning up orphan processes