2025-08-14T20:55:50.4038575Z Current runner version: '2.327.1' 2025-08-14T20:55:50.4062631Z ##[group]Runner Image Provisioner 2025-08-14T20:55:50.4063390Z Hosted Compute Agent 2025-08-14T20:55:50.4064034Z Version: 20250812.370 2025-08-14T20:55:50.4064665Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:55:50.4065389Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:55:50.4065920Z ##[endgroup] 2025-08-14T20:55:50.4066507Z ##[group]Operating System 2025-08-14T20:55:50.4067021Z Ubuntu 2025-08-14T20:55:50.4067472Z 24.04.2 2025-08-14T20:55:50.4067997Z LTS 2025-08-14T20:55:50.4068440Z ##[endgroup] 2025-08-14T20:55:50.4068895Z ##[group]Runner Image 2025-08-14T20:55:50.4069454Z Image: ubuntu-24.04 2025-08-14T20:55:50.4069946Z Version: 20250804.2.0 2025-08-14T20:55:50.4071093Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:55:50.4072732Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:55:50.4073669Z ##[endgroup] 2025-08-14T20:55:50.4074762Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:55:50.4077160Z Contents: read 2025-08-14T20:55:50.4077761Z Metadata: read 2025-08-14T20:55:50.4078268Z ##[endgroup] 2025-08-14T20:55:50.4080593Z Secret source: Actions 2025-08-14T20:55:50.4081383Z Prepare workflow directory 2025-08-14T20:55:50.4607547Z Prepare all required actions 2025-08-14T20:55:50.4665215Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:55:50.4670049Z ##[group] Inputs 2025-08-14T20:55:50.4670844Z check_experiments: 2025-08-14T20:55:50.4671485Z opt_out_experiments: 2025-08-14T20:55:50.4672015Z triggering_actor: pytorchmergebot 2025-08-14T20:55:50.4672653Z issue_owner: 2025-08-14T20:55:50.4673161Z curr_branch: main 2025-08-14T20:55:50.4673690Z curr_ref_type: branch 2025-08-14T20:55:50.4674304Z issue_number: 5132 2025-08-14T20:55:50.4674871Z ##[endgroup] 2025-08-14T20:55:50.4675568Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:55:51.1424478Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:55:51.1427032Z cat < runner_determinator.py 2025-08-14T20:55:51.1427796Z # flake8: noqa: G004 2025-08-14T20:55:51.1428377Z  2025-08-14T20:55:51.1429149Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:55:51.1430734Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:55:51.1431882Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:55:51.1432614Z  2025-08-14T20:55:51.1433162Z """ 2025-08-14T20:55:51.1433907Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:55:51.1434997Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:55:51.1436261Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:55:51.1437253Z of which runners should be used to run which job. 2025-08-14T20:55:51.1437950Z  2025-08-14T20:55:51.1438777Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:55:51.1439876Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:55:51.1441026Z settings are considered to be empty with only the second part, the user 2025-08-14T20:55:51.1442006Z list, defined. 2025-08-14T20:55:51.1442528Z  2025-08-14T20:55:51.1443222Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:55:51.1444402Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:55:51.1445392Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:55:51.1446138Z  2025-08-14T20:55:51.1447195Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:55:51.1448263Z The user list is also a comma separated list of additional features or 2025-08-14T20:55:51.1449178Z experiments which the user could be opted in to. 2025-08-14T20:55:51.1449922Z  2025-08-14T20:55:51.1450795Z The user list has the following rules: 2025-08-14T20:55:51.1451442Z  2025-08-14T20:55:51.1452231Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:55:51.1453246Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:55:51.1454192Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:55:51.1454936Z  2025-08-14T20:55:51.1455396Z Example config: 2025-08-14T20:55:51.1456033Z  # A list of experiments that can be opted into. 2025-08-14T20:55:51.1456916Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:55:51.1457748Z  # Expected syntax is: 2025-08-14T20:55:51.1458545Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:55:51.1459723Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:55:51.1460781Z  2025-08-14T20:55:51.1461240Z  experiments: 2025-08-14T20:55:51.1461873Z  lf: 2025-08-14T20:55:51.1462395Z  rollout_percent: 25 2025-08-14T20:55:51.1463026Z  all_branches: false 2025-08-14T20:55:51.1463678Z  default: true 2025-08-14T20:55:51.1464237Z  --- 2025-08-14T20:55:51.1464785Z  2025-08-14T20:55:51.1465259Z  # Opt-ins: 2025-08-14T20:55:51.1466112Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:55:51.1467322Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:55:51.1468303Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:55:51.1469221Z  # Experiments should be from the above list. 2025-08-14T20:55:51.1469880Z  2025-08-14T20:55:51.1470542Z  @User1,-lf,split_build 2025-08-14T20:55:51.1471209Z  @User2,lf 2025-08-14T20:55:51.1471775Z  @User3,split_build 2025-08-14T20:55:51.1472333Z """ 2025-08-14T20:55:51.1472866Z  2025-08-14T20:55:51.1473324Z import json 2025-08-14T20:55:51.1473910Z import logging 2025-08-14T20:55:51.1560748Z import os 2025-08-14T20:55:51.1561338Z import random 2025-08-14T20:55:51.1561829Z import re 2025-08-14T20:55:51.1562261Z import sys 2025-08-14T20:55:51.1562768Z from argparse import ArgumentParser 2025-08-14T20:55:51.1563497Z from collections.abc import Iterable 2025-08-14T20:55:51.1564204Z from functools import cache 2025-08-14T20:55:51.1564798Z from logging import LogRecord 2025-08-14T20:55:51.1565414Z from typing import Any, NamedTuple 2025-08-14T20:55:51.1566082Z from urllib.request import Request, urlopen 2025-08-14T20:55:51.1566727Z  2025-08-14T20:55:51.1567162Z import yaml 2025-08-14T20:55:51.1567676Z from github import Auth, Github 2025-08-14T20:55:51.1568283Z from github.Issue import Issue 2025-08-14T20:55:51.1568832Z  2025-08-14T20:55:51.1569201Z  2025-08-14T20:55:51.1569668Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:55:51.1570825Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:55:51.1571864Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:55:51.1572630Z  2025-08-14T20:55:51.1573488Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:55:51.1574129Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:55:51.1574715Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:55:51.1575366Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:55:51.1575929Z  2025-08-14T20:55:51.1576361Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:55:51.1576903Z  2025-08-14T20:55:51.1577306Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:55:51.1577834Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:55:51.1578324Z  2025-08-14T20:55:51.1578701Z  2025-08-14T20:55:51.1579125Z class Experiment(NamedTuple): 2025-08-14T20:55:51.1579695Z  rollout_perc: float = ( 2025-08-14T20:55:51.1580796Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:55:51.1581539Z  ) 2025-08-14T20:55:51.1581959Z  all_branches: bool = ( 2025-08-14T20:55:51.1582697Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:55:51.1583426Z  ) 2025-08-14T20:55:51.1583847Z  default: bool = ( 2025-08-14T20:55:51.1584519Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:55:51.1585222Z  ) 2025-08-14T20:55:51.1585613Z  2025-08-14T20:55:51.1586031Z  # Add more fields as needed 2025-08-14T20:55:51.1586557Z  2025-08-14T20:55:51.1586934Z  2025-08-14T20:55:51.1587344Z class Settings(NamedTuple): 2025-08-14T20:55:51.1587865Z  """ 2025-08-14T20:55:51.1588395Z  Settings for the experiments that can be opted into. 2025-08-14T20:55:51.1589033Z  """ 2025-08-14T20:55:51.1589429Z  2025-08-14T20:55:51.1589873Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:55:51.1590564Z  2025-08-14T20:55:51.1591083Z  2025-08-14T20:55:51.1591544Z class ColorFormatter(logging.Formatter): 2025-08-14T20:55:51.1592250Z  """Color codes the log messages based on the log level""" 2025-08-14T20:55:51.1592894Z  2025-08-14T20:55:51.1593268Z  COLORS = { 2025-08-14T20:55:51.1593755Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:55:51.1594330Z  "ERROR": "\033[31m", # Red 2025-08-14T20:55:51.1594886Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:55:51.1595452Z  "INFO": "\033[0m", # Reset 2025-08-14T20:55:51.1596004Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:55:51.1596535Z  } 2025-08-14T20:55:51.1596927Z  2025-08-14T20:55:51.1597389Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:55:51.1598214Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:55:51.1599070Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:55:51.1599714Z  return super().format(record) 2025-08-14T20:55:51.1600478Z  2025-08-14T20:55:51.1600892Z  2025-08-14T20:55:51.1601315Z handler = logging.StreamHandler() 2025-08-14T20:55:51.1602122Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:55:51.1602898Z  2025-08-14T20:55:51.1603403Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:55:51.1604060Z log.addHandler(handler) 2025-08-14T20:55:51.1604581Z log.setLevel(logging.INFO) 2025-08-14T20:55:51.1605087Z  2025-08-14T20:55:51.1605448Z  2025-08-14T20:55:51.1605947Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:55:51.1606570Z  """ 2025-08-14T20:55:51.1607158Z  Defines outputs of the github action that invokes this script 2025-08-14T20:55:51.1607997Z  """ 2025-08-14T20:55:51.1608422Z  if not GITHUB_OUTPUT: 2025-08-14T20:55:51.1609576Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:55:51.1611119Z  log.warning( 2025-08-14T20:55:51.1612087Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:55:51.1613073Z  ) 2025-08-14T20:55:51.1613577Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:55:51.1614172Z  return 2025-08-14T20:55:51.1614601Z  2025-08-14T20:55:51.1615037Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:55:51.1615675Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:55:51.1616306Z  f.write(f"{key}={value}\n") 2025-08-14T20:55:51.1616842Z  2025-08-14T20:55:51.1617214Z  2025-08-14T20:55:51.1617773Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:55:51.1618484Z  return frozenset( 2025-08-14T20:55:51.1619186Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:55:51.1619949Z  ) 2025-08-14T20:55:51.1620654Z  2025-08-14T20:55:51.1621036Z  2025-08-14T20:55:51.1621442Z def parse_args() -> Any: 2025-08-14T20:55:51.1622106Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:55:51.1623071Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:55:51.1623902Z  parser.add_argument( 2025-08-14T20:55:51.1624431Z  "--github-issue-repo", 2025-08-14T20:55:51.1624969Z  type=str, 2025-08-14T20:55:51.1625456Z  required=False, 2025-08-14T20:55:51.1626136Z  default="pytorch/test-infra", 2025-08-14T20:55:51.1626770Z  help="GitHub repo to get the issue", 2025-08-14T20:55:51.1627335Z  ) 2025-08-14T20:55:51.1627757Z  parser.add_argument( 2025-08-14T20:55:51.1628285Z  "--github-repo", 2025-08-14T20:55:51.1628790Z  type=str, 2025-08-14T20:55:51.1629255Z  required=True, 2025-08-14T20:55:51.1629814Z  help="GitHub repo where CI is running", 2025-08-14T20:55:51.1630496Z  ) 2025-08-14T20:55:51.1630930Z  parser.add_argument( 2025-08-14T20:55:51.1631635Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:55:51.1632353Z  ) 2025-08-14T20:55:51.1632785Z  parser.add_argument( 2025-08-14T20:55:51.1633500Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:55:51.1634251Z  ) 2025-08-14T20:55:51.1634671Z  parser.add_argument( 2025-08-14T20:55:51.1635404Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:55:51.1636144Z  ) 2025-08-14T20:55:51.1636567Z  parser.add_argument( 2025-08-14T20:55:51.1637327Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:55:51.1638081Z  ) 2025-08-14T20:55:51.1638528Z  parser.add_argument( 2025-08-14T20:55:51.1639053Z  "--github-ref-type", 2025-08-14T20:55:51.1639581Z  type=str, 2025-08-14T20:55:51.1640058Z  required=True, 2025-08-14T20:55:51.1640925Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:55:51.1641535Z  ) 2025-08-14T20:55:51.1641958Z  parser.add_argument( 2025-08-14T20:55:51.1642650Z  "--eligible-experiments", 2025-08-14T20:55:51.1643251Z  type=_str_comma_separated_to_set, 2025-08-14T20:55:51.1643817Z  required=False, 2025-08-14T20:55:51.1644313Z  default="", 2025-08-14T20:55:51.1645268Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:55:51.1646271Z  ) 2025-08-14T20:55:51.1646697Z  parser.add_argument( 2025-08-14T20:55:51.1647235Z  "--opt-out-experiments", 2025-08-14T20:55:51.1647828Z  type=_str_comma_separated_to_set, 2025-08-14T20:55:51.1648411Z  required=False, 2025-08-14T20:55:51.1648916Z  default="", 2025-08-14T20:55:51.1649388Z  help=( 2025-08-14T20:55:51.1650154Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:55:51.1651688Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:55:51.1652591Z  ), 2025-08-14T20:55:51.1653005Z  ) 2025-08-14T20:55:51.1653426Z  parser.add_argument( 2025-08-14T20:55:51.1653950Z  "--pr-number", 2025-08-14T20:55:51.1654438Z  type=str, 2025-08-14T20:55:51.1654919Z  required=False, 2025-08-14T20:55:51.1655417Z  default="", 2025-08-14T20:55:51.1655990Z  help="the optional PR number where this is run", 2025-08-14T20:55:51.1656604Z  ) 2025-08-14T20:55:51.1656995Z  2025-08-14T20:55:51.1657412Z  return parser.parse_args() 2025-08-14T20:55:51.1657927Z  2025-08-14T20:55:51.1658292Z  2025-08-14T20:55:51.1658937Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:55:51.1659916Z  auth = Auth.Token(github_token) 2025-08-14T20:55:51.1661200Z  return Github(auth=auth) 2025-08-14T20:55:51.1661720Z  2025-08-14T20:55:51.1662096Z  2025-08-14T20:55:51.1662814Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:55:51.1663681Z  repo = gh.get_repo(repo) 2025-08-14T20:55:51.1664269Z  return repo.get_issue(number=issue_num) 2025-08-14T20:55:51.1664846Z  2025-08-14T20:55:51.1665207Z  2025-08-14T20:55:51.1665607Z def get_potential_pr_author( 2025-08-14T20:55:51.1666353Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:55:51.1667081Z ) -> str: 2025-08-14T20:55:51.1667677Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:55:51.1668559Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:55:51.1669402Z  # embedded in the tag name: ciflow// 2025-08-14T20:55:51.1670024Z  2025-08-14T20:55:51.1670662Z  gh = get_gh_client(github_token) 2025-08-14T20:55:51.1671203Z  2025-08-14T20:55:51.1671711Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:55:51.1672405Z  split_tag = ref_name.split("/") 2025-08-14T20:55:51.1672956Z  if ( 2025-08-14T20:55:51.1673414Z  len(split_tag) == 3 2025-08-14T20:55:51.1673980Z  and split_tag[0] == "ciflow" 2025-08-14T20:55:51.1674576Z  and split_tag[2].isnumeric() 2025-08-14T20:55:51.1675121Z  ): 2025-08-14T20:55:51.1675579Z  pr_number = split_tag[2] 2025-08-14T20:55:51.1676129Z  try: 2025-08-14T20:55:51.1676637Z  repository = gh.get_repo(repo) 2025-08-14T20:55:51.1677495Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:55:51.1678168Z  except Exception as e: 2025-08-14T20:55:51.1678775Z  raise Exception( # noqa: TRY002 2025-08-14T20:55:51.1679522Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:55:51.1680341Z  ) from e 2025-08-14T20:55:51.1680975Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:55:51.1681775Z  # In all other cases, return the original input username 2025-08-14T20:55:51.1682430Z  return username 2025-08-14T20:55:51.1682890Z  2025-08-14T20:55:51.1683267Z  2025-08-14T20:55:51.1683740Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:55:51.1684329Z  """ 2025-08-14T20:55:51.1685064Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:55:51.1685913Z  """ 2025-08-14T20:55:51.1686542Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:55:51.1687259Z  2025-08-14T20:55:51.1687633Z  2025-08-14T20:55:51.1688066Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:55:51.1688617Z  try: 2025-08-14T20:55:51.1689070Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:55:51.1689635Z  return data 2025-08-14T20:55:51.1690134Z  except yaml.YAMLError: 2025-08-14T20:55:51.1690807Z  log.exception("Error loading YAML") 2025-08-14T20:55:51.1691389Z  raise 2025-08-14T20:55:51.1691817Z  2025-08-14T20:55:51.1692187Z  2025-08-14T20:55:51.1692852Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:55:51.1693650Z  """ 2025-08-14T20:55:51.1694481Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:55:51.1695295Z  2025-08-14T20:55:51.1695880Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:55:51.1696725Z  and the text below is the list of opted in users. 2025-08-14T20:55:51.1697332Z  2025-08-14T20:55:51.1697966Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:55:51.1698726Z  """ 2025-08-14T20:55:51.1699272Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:55:51.1699927Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:55:51.1700789Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:55:51.1701442Z  else: 2025-08-14T20:55:51.1701887Z  return "", rollout_state 2025-08-14T20:55:51.1702427Z  2025-08-14T20:55:51.1702792Z  2025-08-14T20:55:51.1703581Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:55:51.1704146Z  """ 2025-08-14T20:55:51.1704739Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:55:51.1705437Z  """ 2025-08-14T20:55:51.1705831Z  2025-08-14T20:55:51.1706190Z  2025-08-14T20:55:51.1706772Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:55:51.1707488Z  """ 2025-08-14T20:55:51.1708295Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:55:51.1709186Z  2025-08-14T20:55:51.1710045Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:55:51.1711235Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:55:51.1712137Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:55:51.1712817Z  2025-08-14T20:55:51.1713182Z  2025-08-14T20:55:51.1713541Z  """ 2025-08-14T20:55:51.1713959Z  optins = UserOptins() 2025-08-14T20:55:51.1714526Z  for user in user_optin_text.split("\n"): 2025-08-14T20:55:51.1715157Z  user = user.strip("\r\n\t -") 2025-08-14T20:55:51.1715769Z  if not user or not user.startswith("@"): 2025-08-14T20:55:51.1716392Z  # Not a valid user. Skip 2025-08-14T20:55:51.1716938Z  continue 2025-08-14T20:55:51.1717392Z  2025-08-14T20:55:51.1717766Z  if user: 2025-08-14T20:55:51.1718282Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:55:51.1719045Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:55:51.1719771Z  2025-08-14T20:55:51.1720292Z  return optins 2025-08-14T20:55:51.1720746Z  2025-08-14T20:55:51.1721112Z  2025-08-14T20:55:51.1721652Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:55:51.1722313Z  """ 2025-08-14T20:55:51.1722775Z  Check if the experiment name is valid. 2025-08-14T20:55:51.1723342Z  A valid name: 2025-08-14T20:55:51.1724078Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:55:51.1725087Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:55:51.1725861Z  - Cannot contain spaces 2025-08-14T20:55:51.1726377Z  """ 2025-08-14T20:55:51.1726759Z  2025-08-14T20:55:51.1727263Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:55:51.1728049Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:55:51.1728819Z  2025-08-14T20:55:51.1729201Z  if valid: 2025-08-14T20:55:51.1729656Z  return True 2025-08-14T20:55:51.1730099Z  2025-08-14T20:55:51.1730589Z  log.error( 2025-08-14T20:55:51.1732159Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:55:51.1733815Z  ) 2025-08-14T20:55:51.1734220Z  return False 2025-08-14T20:55:51.1734659Z  2025-08-14T20:55:51.1735020Z  2025-08-14T20:55:51.1735582Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:55:51.1736271Z  """ 2025-08-14T20:55:51.1736930Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:55:51.1737704Z  """ 2025-08-14T20:55:51.1738104Z  try: 2025-08-14T20:55:51.1738519Z  if settings_text: 2025-08-14T20:55:51.1739334Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:55:51.1740283Z  # for easy reading 2025-08-14T20:55:51.1741189Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:55:51.1742166Z  # the backtick character in shell commands. 2025-08-14T20:55:51.1742828Z  backtick = chr(96) # backtick character 2025-08-14T20:55:51.1743570Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:55:51.1744295Z  settings = load_yaml(settings_text) 2025-08-14T20:55:51.1744854Z  2025-08-14T20:55:51.1745510Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:55:51.1746443Z  experiments = {} 2025-08-14T20:55:51.1746953Z  2025-08-14T20:55:51.1747554Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:55:51.1748396Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:55:51.1749587Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:55:51.1750818Z  continue 2025-08-14T20:55:51.1751322Z  2025-08-14T20:55:51.1751736Z  valid_settings = {} 2025-08-14T20:55:51.1752317Z  for setting in exp_settings: 2025-08-14T20:55:51.1752938Z  if setting not in Experiment._fields: 2025-08-14T20:55:51.1753562Z  log.warning( 2025-08-14T20:55:51.1754363Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:55:51.1755116Z  ) 2025-08-14T20:55:51.1755612Z  else: 2025-08-14T20:55:51.1756195Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:55:51.1756804Z  2025-08-14T20:55:51.1757313Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:55:51.1758006Z  return Settings(experiments) 2025-08-14T20:55:51.1758546Z  2025-08-14T20:55:51.1758935Z  except Exception: 2025-08-14T20:55:51.1759494Z  log.exception("Failed to parse settings") 2025-08-14T20:55:51.1760067Z  2025-08-14T20:55:51.1760551Z  return Settings() 2025-08-14T20:55:51.1761012Z  2025-08-14T20:55:51.1761386Z  2025-08-14T20:55:51.1762001Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:55:51.1762638Z  """ 2025-08-14T20:55:51.1763138Z  Parse settings, if any, from the rollout state. 2025-08-14T20:55:51.1763725Z  2025-08-14T20:55:51.1764319Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:55:51.1765143Z  and the text below is the list of opted in users. 2025-08-14T20:55:51.1765742Z  2025-08-14T20:55:51.1766384Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:55:51.1767171Z  """ 2025-08-14T20:55:51.1767805Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:55:51.1768641Z  return parse_settings_from_text(settings_text) 2025-08-14T20:55:51.1769229Z  2025-08-14T20:55:51.1769587Z  2025-08-14T20:55:51.1770107Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:55:51.1770871Z  """ 2025-08-14T20:55:51.1771325Z  Parse users from the rollout state. 2025-08-14T20:55:51.1771873Z  2025-08-14T20:55:51.1772234Z  """ 2025-08-14T20:55:51.1772833Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:55:51.1773641Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:55:51.1774232Z  2025-08-14T20:55:51.1774591Z  2025-08-14T20:55:51.1775271Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:55:51.1776087Z  """ 2025-08-14T20:55:51.1776568Z  Check if a user is opted into an experiment 2025-08-14T20:55:51.1777151Z  """ 2025-08-14T20:55:51.1777679Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:55:51.1778310Z  2025-08-14T20:55:51.1778862Z  2025-08-14T20:55:51.1779550Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:55:51.1780466Z  """ 2025-08-14T20:55:51.1780998Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:55:51.1781635Z  """ 2025-08-14T20:55:51.1782208Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:55:51.1782978Z  experiment_optout = "-" + experiment_name 2025-08-14T20:55:51.1783681Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:55:51.1784333Z  return False 2025-08-14T20:55:51.1784782Z  2025-08-14T20:55:51.1785282Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:55:51.1785927Z  log.warning( 2025-08-14T20:55:51.1786835Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:55:51.1787781Z  ) 2025-08-14T20:55:51.1788169Z  2025-08-14T20:55:51.1788548Z  return True 2025-08-14T20:55:51.1788978Z  2025-08-14T20:55:51.1789340Z  2025-08-14T20:55:51.1789724Z def get_runner_prefix( 2025-08-14T20:55:51.1790330Z  rollout_state: str, 2025-08-14T20:55:51.1791093Z  workflow_requestors: Iterable[str], 2025-08-14T20:55:51.1791711Z  branch: str, 2025-08-14T20:55:51.1792284Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:55:51.1793023Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:55:51.1793663Z  is_canary: bool = False, 2025-08-14T20:55:51.1794167Z ) -> str: 2025-08-14T20:55:51.1794671Z  settings = parse_settings(rollout_state) 2025-08-14T20:55:51.1795313Z  user_optins = parse_users(rollout_state) 2025-08-14T20:55:51.1795878Z  2025-08-14T20:55:51.1796420Z  fleet_prefix = "" 2025-08-14T20:55:51.1796911Z  prefixes = [] 2025-08-14T20:55:51.1797633Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:55:51.1798640Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:55:51.1799402Z  log.info( 2025-08-14T20:55:51.1800160Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:55:51.1801070Z  ) 2025-08-14T20:55:51.1801531Z  continue 2025-08-14T20:55:51.1801983Z  2025-08-14T20:55:51.1802394Z  if opt_out_experiments: 2025-08-14T20:55:51.1803003Z  if experiment_name in opt_out_experiments: 2025-08-14T20:55:51.1803720Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:55:51.1804373Z  log.info( 2025-08-14T20:55:51.1805379Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:55:51.1806421Z  ) 2025-08-14T20:55:51.1806884Z  continue 2025-08-14T20:55:51.1807371Z  2025-08-14T20:55:51.1807810Z  if eligible_experiments: 2025-08-14T20:55:51.1808450Z  if experiment_name not in eligible_experiments: 2025-08-14T20:55:51.1809146Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:55:51.1809742Z  log.info( 2025-08-14T20:55:51.1810703Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:55:51.1811588Z  ) 2025-08-14T20:55:51.1812287Z  continue 2025-08-14T20:55:51.1812840Z  elif not experiment_settings.default: 2025-08-14T20:55:51.1813424Z  log.info( 2025-08-14T20:55:51.1814158Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:55:51.1814934Z  ) 2025-08-14T20:55:51.1815369Z  continue 2025-08-14T20:55:51.1815818Z  2025-08-14T20:55:51.1816329Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:55:51.1816993Z  opted_out_users = [ 2025-08-14T20:55:51.1817503Z  requestor 2025-08-14T20:55:51.1818036Z  for requestor in workflow_requestors 2025-08-14T20:55:51.1818762Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:55:51.1819433Z  ] 2025-08-14T20:55:51.1819832Z  2025-08-14T20:55:51.1820361Z  if opted_out_users: 2025-08-14T20:55:51.1820898Z  log.info( 2025-08-14T20:55:51.1821609Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:55:51.1822356Z  ) 2025-08-14T20:55:51.1822788Z  continue 2025-08-14T20:55:51.1823236Z  2025-08-14T20:55:51.1823736Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:55:51.1824395Z  opted_in_users = [ 2025-08-14T20:55:51.1824920Z  requestor 2025-08-14T20:55:51.1825467Z  for requestor in workflow_requestors 2025-08-14T20:55:51.1826204Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:55:51.1826870Z  ] 2025-08-14T20:55:51.1827275Z  2025-08-14T20:55:51.1827658Z  enabled = False 2025-08-14T20:55:51.1828168Z  if opted_in_users: 2025-08-14T20:55:51.1828790Z  log.info( 2025-08-14T20:55:51.1829496Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:55:51.1830336Z  ) 2025-08-14T20:55:51.1830779Z  enabled = True 2025-08-14T20:55:51.1831267Z  2025-08-14T20:55:51.1831708Z  elif experiment_settings.rollout_perc: 2025-08-14T20:55:51.1832601Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:55:51.1833609Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:55:51.1834313Z  log.info( 2025-08-14T20:55:51.1835265Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:55:51.1836239Z  ) 2025-08-14T20:55:51.1836725Z  enabled = True 2025-08-14T20:55:51.1837234Z  2025-08-14T20:55:51.1837620Z  if enabled: 2025-08-14T20:55:51.1838148Z  label = experiment_name 2025-08-14T20:55:51.1838771Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:55:51.1839667Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:55:51.1840703Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:55:51.1841528Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:55:51.1842253Z  if is_canary: 2025-08-14T20:55:51.1842815Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:55:51.1843413Z  fleet_prefix = label 2025-08-14T20:55:51.1843947Z  else: 2025-08-14T20:55:51.1844604Z  prefixes.append(label) 2025-08-14T20:55:51.1845150Z  2025-08-14T20:55:51.1845545Z  if len(prefixes) > 1: 2025-08-14T20:55:51.1846047Z  log.error( 2025-08-14T20:55:51.1847185Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:55:51.1848367Z  ) 2025-08-14T20:55:51.1848808Z  prefixes = prefixes[:1] 2025-08-14T20:55:51.1849323Z  2025-08-14T20:55:51.1849720Z  # Fleet always comes first 2025-08-14T20:55:51.1850359Z  if fleet_prefix: 2025-08-14T20:55:51.1850877Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:55:51.1851435Z  2025-08-14T20:55:51.1851911Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:55:51.1852513Z  2025-08-14T20:55:51.1852889Z  2025-08-14T20:55:51.1853576Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:55:51.1854394Z  """ 2025-08-14T20:55:51.1855037Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:55:51.1855798Z  2025-08-14T20:55:51.1856406Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:55:51.1857159Z  """ 2025-08-14T20:55:51.1857602Z  gh = get_gh_client(github_token) 2025-08-14T20:55:51.1858258Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:55:51.1859009Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:55:51.1859687Z  2025-08-14T20:55:51.1860100Z  2025-08-14T20:55:51.1860863Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:55:51.1861811Z  for _ in range(num_retries): 2025-08-14T20:55:51.1862350Z  try: 2025-08-14T20:55:51.1862837Z  req = Request(url=url, headers=headers) 2025-08-14T20:55:51.1863557Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:55:51.1864258Z  return json.loads(content) 2025-08-14T20:55:51.1864841Z  except Exception as e: 2025-08-14T20:55:51.1865456Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:55:51.1866046Z  2025-08-14T20:55:51.1866661Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:55:51.1867420Z  return {} 2025-08-14T20:55:51.1867851Z  2025-08-14T20:55:51.1868212Z  2025-08-14T20:55:51.1868579Z @cache 2025-08-14T20:55:51.1869284Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:55:51.1870107Z  """ 2025-08-14T20:55:51.1870659Z  Dynamically get PR information 2025-08-14T20:55:51.1871196Z  """ 2025-08-14T20:55:51.1871760Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:55:51.1872431Z  headers = { 2025-08-14T20:55:51.1872961Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:55:51.1873625Z  "Authorization": f"token {github_token}", 2025-08-14T20:55:51.1874201Z  } 2025-08-14T20:55:51.1874687Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:55:51.1875356Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:55:51.1875942Z  headers=headers, 2025-08-14T20:55:51.1876419Z  ) 2025-08-14T20:55:51.1876804Z  2025-08-14T20:55:51.1877195Z  if not json_response: 2025-08-14T20:55:51.1877842Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:55:51.1878652Z  return {} 2025-08-14T20:55:51.1879097Z  2025-08-14T20:55:51.1879487Z  return json_response 2025-08-14T20:55:51.1879969Z  2025-08-14T20:55:51.1880430Z  2025-08-14T20:55:51.1881063Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:55:51.1881846Z  """ 2025-08-14T20:55:51.1882430Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:55:51.1883124Z  """ 2025-08-14T20:55:51.1883659Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:55:51.1884326Z  return { 2025-08-14T20:55:51.1884978Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:55:51.1885704Z  } 2025-08-14T20:55:51.1886087Z  2025-08-14T20:55:51.1886454Z  2025-08-14T20:55:51.1886842Z def main() -> None: 2025-08-14T20:55:51.1887321Z  args = parse_args() 2025-08-14T20:55:51.1887799Z  2025-08-14T20:55:51.1888244Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:55:51.1888819Z  2025-08-14T20:55:51.1889213Z  # Check if the PR is opt-out 2025-08-14T20:55:51.1889760Z  if args.pr_number: 2025-08-14T20:55:51.1890826Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:55:51.1891648Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:55:51.1892201Z  log.info( 2025-08-14T20:55:51.1892969Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:55:51.1893777Z  ) 2025-08-14T20:55:51.1894415Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:55:51.1895153Z  sys.exit() 2025-08-14T20:55:51.1895756Z  2025-08-14T20:55:51.1896136Z  try: 2025-08-14T20:55:51.1896639Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:55:51.1897417Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:55:51.1898106Z  ) 2025-08-14T20:55:51.1898505Z  2025-08-14T20:55:51.1898941Z  username = get_potential_pr_author( 2025-08-14T20:55:51.1899528Z  args.github_token, 2025-08-14T20:55:51.1900064Z  args.github_repo, 2025-08-14T20:55:51.1900736Z  args.github_actor, 2025-08-14T20:55:51.1901283Z  args.github_ref_type, 2025-08-14T20:55:51.1901843Z  args.github_branch, 2025-08-14T20:55:51.1902348Z  ) 2025-08-14T20:55:51.1902755Z  2025-08-14T20:55:51.1903270Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:55:51.1903937Z  2025-08-14T20:55:51.1904386Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:55:51.1904976Z  rollout_state, 2025-08-14T20:55:51.1905539Z  (args.github_issue_owner, username), 2025-08-14T20:55:51.1906131Z  args.github_branch, 2025-08-14T20:55:51.1906698Z  args.eligible_experiments, 2025-08-14T20:55:51.1907286Z  args.opt_out_experiments, 2025-08-14T20:55:51.1907842Z  is_canary, 2025-08-14T20:55:51.1908313Z  ) 2025-08-14T20:55:51.1908711Z  2025-08-14T20:55:51.1909109Z  except Exception as e: 2025-08-14T20:55:51.1909613Z  log.error( 2025-08-14T20:55:51.1910480Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:55:51.1911429Z  ) 2025-08-14T20:55:51.1911837Z  2025-08-14T20:55:51.1912403Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:55:51.1913099Z  2025-08-14T20:55:51.1913463Z  2025-08-14T20:55:51.1913847Z if __name__ == "__main__": 2025-08-14T20:55:51.1914343Z  main() 2025-08-14T20:55:51.1914755Z  2025-08-14T20:55:51.1915123Z EOF 2025-08-14T20:55:51.1915493Z  2025-08-14T20:55:51.1915899Z cat runner_determinator.py 2025-08-14T20:55:51.2208501Z shell: /usr/bin/bash -e {0} 2025-08-14T20:55:51.2209381Z env: 2025-08-14T20:55:51.2210147Z GITHUB_TOKEN: *** 2025-08-14T20:55:51.2210915Z ISSUE_NUMBER: 5132 2025-08-14T20:55:51.2211400Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:55:51.2211932Z ISSUE_OWNER: 2025-08-14T20:55:51.2212351Z CHECK_EXPERIMENTS: 2025-08-14T20:55:51.2212829Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:55:51.2213284Z PR_NUMBER: 2025-08-14T20:55:51.2213711Z ##[endgroup] 2025-08-14T20:55:51.2438494Z # flake8: noqa: G004 2025-08-14T20:55:51.2438919Z 2025-08-14T20:55:51.2439354Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:55:51.2440546Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:55:51.2441391Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:55:51.2441845Z 2025-08-14T20:55:51.2442014Z """ 2025-08-14T20:55:51.2442608Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:55:51.2443504Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:55:51.2444409Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:55:51.2445238Z of which runners should be used to run which job. 2025-08-14T20:55:51.2445642Z 2025-08-14T20:55:51.2446032Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:55:51.2447153Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:55:51.2448052Z settings are considered to be empty with only the second part, the user 2025-08-14T20:55:51.2448762Z list, defined. 2025-08-14T20:55:51.2448997Z 2025-08-14T20:55:51.2449372Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:55:51.2450499Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:55:51.2451359Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:55:51.2451816Z 2025-08-14T20:55:51.2452191Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:55:51.2453059Z The user list is also a comma separated list of additional features or 2025-08-14T20:55:51.2453805Z experiments which the user could be opted in to. 2025-08-14T20:55:51.2454209Z 2025-08-14T20:55:51.2454414Z The user list has the following rules: 2025-08-14T20:55:51.2454769Z 2025-08-14T20:55:51.2455097Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:55:51.2455968Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:55:51.2456745Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:55:51.2457143Z 2025-08-14T20:55:51.2457324Z Example config: 2025-08-14T20:55:51.2457784Z # A list of experiments that can be opted into. 2025-08-14T20:55:51.2458452Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:55:51.2459077Z # Expected syntax is: 2025-08-14T20:55:51.2459723Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:55:51.2460918Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:55:51.2461535Z 2025-08-14T20:55:51.2461716Z experiments: 2025-08-14T20:55:51.2462118Z lf: 2025-08-14T20:55:51.2462513Z rollout_percent: 25 2025-08-14T20:55:51.2463158Z all_branches: false 2025-08-14T20:55:51.2463614Z default: true 2025-08-14T20:55:51.2464038Z --- 2025-08-14T20:55:51.2464249Z 2025-08-14T20:55:51.2464414Z # Opt-ins: 2025-08-14T20:55:51.2465009Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:55:51.2465924Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:55:51.2466714Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:55:51.2467386Z # Experiments should be from the above list. 2025-08-14T20:55:51.2467771Z 2025-08-14T20:55:51.2467958Z @User1,-lf,split_build 2025-08-14T20:55:51.2468402Z @User2,lf 2025-08-14T20:55:51.2468793Z @User3,split_build 2025-08-14T20:55:51.2469212Z """ 2025-08-14T20:55:51.2469410Z 2025-08-14T20:55:51.2469582Z import json 2025-08-14T20:55:51.2469963Z import logging 2025-08-14T20:55:51.2470634Z import os 2025-08-14T20:55:51.2471131Z import random 2025-08-14T20:55:51.2471526Z import re 2025-08-14T20:55:51.2471906Z import sys 2025-08-14T20:55:51.2472321Z from argparse import ArgumentParser 2025-08-14T20:55:51.2472864Z from collections.abc import Iterable 2025-08-14T20:55:51.2473395Z from functools import cache 2025-08-14T20:55:51.2473872Z from logging import LogRecord 2025-08-14T20:55:51.2474374Z from typing import Any, NamedTuple 2025-08-14T20:55:51.2474912Z from urllib.request import Request, urlopen 2025-08-14T20:55:51.2475294Z 2025-08-14T20:55:51.2475464Z import yaml 2025-08-14T20:55:51.2475857Z from github import Auth, Github 2025-08-14T20:55:51.2476355Z from github.Issue import Issue 2025-08-14T20:55:51.2476664Z 2025-08-14T20:55:51.2476672Z 2025-08-14T20:55:51.2476895Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:55:51.2477586Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:55:51.2478470Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:55:51.2479034Z 2025-08-14T20:55:51.2479271Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:55:51.2480008Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:55:51.2480770Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:55:51.2481338Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:55:51.2481697Z 2025-08-14T20:55:51.2481902Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:55:51.2482240Z 2025-08-14T20:55:51.2482430Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:55:51.2482903Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:55:51.2483187Z 2025-08-14T20:55:51.2483194Z 2025-08-14T20:55:51.2483385Z class Experiment(NamedTuple): 2025-08-14T20:55:51.2483885Z rollout_perc: float = ( 2025-08-14T20:55:51.2484523Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:55:51.2485214Z ) 2025-08-14T20:55:51.2485606Z all_branches: bool = ( 2025-08-14T20:55:51.2486232Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:55:51.2486920Z ) 2025-08-14T20:55:51.2487297Z default: bool = ( 2025-08-14T20:55:51.2487869Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:55:51.2488512Z ) 2025-08-14T20:55:51.2488719Z 2025-08-14T20:55:51.2488904Z # Add more fields as needed 2025-08-14T20:55:51.2489208Z 2025-08-14T20:55:51.2489215Z 2025-08-14T20:55:51.2489442Z class Settings(NamedTuple): 2025-08-14T20:55:51.2489893Z """ 2025-08-14T20:55:51.2490601Z Settings for the experiments that can be opted into. 2025-08-14T20:55:51.2491197Z """ 2025-08-14T20:55:51.2491397Z 2025-08-14T20:55:51.2491614Z experiments: dict[str, Experiment] = {} 2025-08-14T20:55:51.2491984Z 2025-08-14T20:55:51.2491992Z 2025-08-14T20:55:51.2492208Z class ColorFormatter(logging.Formatter): 2025-08-14T20:55:51.2492840Z """Color codes the log messages based on the log level""" 2025-08-14T20:55:51.2493278Z 2025-08-14T20:55:51.2493445Z COLORS = { 2025-08-14T20:55:51.2493854Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:55:51.2494525Z "ERROR": "\033[31m", # Red 2025-08-14T20:55:51.2495041Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:55:51.2495548Z "INFO": "\033[0m", # Reset 2025-08-14T20:55:51.2496037Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:55:51.2496516Z } 2025-08-14T20:55:51.2496715Z 2025-08-14T20:55:51.2496932Z def format(self, record: LogRecord) -> str: 2025-08-14T20:55:51.2497678Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:55:51.2498465Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:55:51.2499046Z return super().format(record) 2025-08-14T20:55:51.2499384Z 2025-08-14T20:55:51.2499391Z 2025-08-14T20:55:51.2499594Z handler = logging.StreamHandler() 2025-08-14T20:55:51.2500461Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:55:51.2501045Z 2025-08-14T20:55:51.2501293Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:55:51.2501888Z log.addHandler(handler) 2025-08-14T20:55:51.2502344Z log.setLevel(logging.INFO) 2025-08-14T20:55:51.2502635Z 2025-08-14T20:55:51.2502642Z 2025-08-14T20:55:51.2502903Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:55:51.2503476Z """ 2025-08-14T20:55:51.2503988Z Defines outputs of the github action that invokes this script 2025-08-14T20:55:51.2504626Z """ 2025-08-14T20:55:51.2505002Z if not GITHUB_OUTPUT: 2025-08-14T20:55:51.2506071Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:55:51.2507219Z log.warning( 2025-08-14T20:55:51.2508077Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:55:51.2509033Z ) 2025-08-14T20:55:51.2519002Z print(f"::set-output name={key}::{value}") 2025-08-14T20:55:51.2519619Z return 2025-08-14T20:55:51.2519866Z 2025-08-14T20:55:51.2520483Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:55:51.2521116Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:55:51.2521708Z f.write(f"{key}={value}\n") 2025-08-14T20:55:51.2522047Z 2025-08-14T20:55:51.2522054Z 2025-08-14T20:55:51.2522366Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:55:51.2523020Z return frozenset( 2025-08-14T20:55:51.2523640Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:55:51.2524321Z ) 2025-08-14T20:55:51.2524530Z 2025-08-14T20:55:51.2524537Z 2025-08-14T20:55:51.2524723Z def parse_args() -> Any: 2025-08-14T20:55:51.2525278Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:55:51.2526145Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:55:51.2526925Z parser.add_argument( 2025-08-14T20:55:51.2527377Z "--github-issue-repo", 2025-08-14T20:55:51.2527840Z type=str, 2025-08-14T20:55:51.2528246Z required=False, 2025-08-14T20:55:51.2528702Z default="pytorch/test-infra", 2025-08-14T20:55:51.2529239Z help="GitHub repo to get the issue", 2025-08-14T20:55:51.2529755Z ) 2025-08-14T20:55:51.2530126Z parser.add_argument( 2025-08-14T20:55:51.2530928Z "--github-repo", 2025-08-14T20:55:51.2531368Z type=str, 2025-08-14T20:55:51.2531771Z required=True, 2025-08-14T20:55:51.2532236Z help="GitHub repo where CI is running", 2025-08-14T20:55:51.2532772Z ) 2025-08-14T20:55:51.2533152Z parser.add_argument( 2025-08-14T20:55:51.2533756Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:55:51.2534431Z ) 2025-08-14T20:55:51.2534804Z parser.add_argument( 2025-08-14T20:55:51.2535424Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:55:51.2536102Z ) 2025-08-14T20:55:51.2536479Z parser.add_argument( 2025-08-14T20:55:51.2537297Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:55:51.2538004Z ) 2025-08-14T20:55:51.2538382Z parser.add_argument( 2025-08-14T20:55:51.2539029Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:55:51.2539758Z ) 2025-08-14T20:55:51.2540125Z parser.add_argument( 2025-08-14T20:55:51.2540694Z "--github-ref-type", 2025-08-14T20:55:51.2541154Z type=str, 2025-08-14T20:55:51.2541553Z required=True, 2025-08-14T20:55:51.2542030Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:55:51.2542584Z ) 2025-08-14T20:55:51.2542949Z parser.add_argument( 2025-08-14T20:55:51.2543412Z "--eligible-experiments", 2025-08-14T20:55:51.2543932Z type=_str_comma_separated_to_set, 2025-08-14T20:55:51.2544452Z required=False, 2025-08-14T20:55:51.2544870Z default="", 2025-08-14T20:55:51.2545721Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:55:51.2546670Z ) 2025-08-14T20:55:51.2597564Z parser.add_argument( 2025-08-14T20:55:51.2598234Z "--opt-out-experiments", 2025-08-14T20:55:51.2598836Z type=_str_comma_separated_to_set, 2025-08-14T20:55:51.2599367Z required=False, 2025-08-14T20:55:51.2599790Z default="", 2025-08-14T20:55:51.2600317Z help=( 2025-08-14T20:55:51.2601000Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:55:51.2602152Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:55:51.2602993Z ), 2025-08-14T20:55:51.2603349Z ) 2025-08-14T20:55:51.2603728Z parser.add_argument( 2025-08-14T20:55:51.2604165Z "--pr-number", 2025-08-14T20:55:51.2604581Z type=str, 2025-08-14T20:55:51.2604978Z required=False, 2025-08-14T20:55:51.2605416Z default="", 2025-08-14T20:55:51.2606070Z help="the optional PR number where this is run", 2025-08-14T20:55:51.2606654Z ) 2025-08-14T20:55:51.2606859Z 2025-08-14T20:55:51.2607051Z return parser.parse_args() 2025-08-14T20:55:51.2607364Z 2025-08-14T20:55:51.2607371Z 2025-08-14T20:55:51.2607779Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:55:51.2608548Z auth = Auth.Token(github_token) 2025-08-14T20:55:51.2609056Z return Github(auth=auth) 2025-08-14T20:55:51.2609358Z 2025-08-14T20:55:51.2609365Z 2025-08-14T20:55:51.2609819Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:55:51.2610727Z repo = gh.get_repo(repo) 2025-08-14T20:55:51.2611231Z return repo.get_issue(number=issue_num) 2025-08-14T20:55:51.2611595Z 2025-08-14T20:55:51.2611601Z 2025-08-14T20:55:51.2611800Z def get_potential_pr_author( 2025-08-14T20:55:51.2612440Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:55:51.2613125Z ) -> str: 2025-08-14T20:55:51.2613637Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:55:51.2614443Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:55:51.2615176Z # embedded in the tag name: ciflow// 2025-08-14T20:55:51.2615591Z 2025-08-14T20:55:51.2615778Z gh = get_gh_client(github_token) 2025-08-14T20:55:51.2616111Z 2025-08-14T20:55:51.2616382Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:55:51.2617014Z split_tag = ref_name.split("/") 2025-08-14T20:55:51.2617524Z if ( 2025-08-14T20:55:51.2617909Z len(split_tag) == 3 2025-08-14T20:55:51.2618396Z and split_tag[0] == "ciflow" 2025-08-14T20:55:51.2618922Z and split_tag[2].isnumeric() 2025-08-14T20:55:51.2619424Z ): 2025-08-14T20:55:51.2619803Z pr_number = split_tag[2] 2025-08-14T20:55:51.2620543Z try: 2025-08-14T20:55:51.2620980Z repository = gh.get_repo(repo) 2025-08-14T20:55:51.2621592Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:55:51.2622203Z except Exception as e: 2025-08-14T20:55:51.2622719Z raise Exception( # noqa: TRY002 2025-08-14T20:55:51.2623399Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:55:51.2624039Z ) from e 2025-08-14T20:55:51.2624569Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:55:51.2625250Z # In all other cases, return the original input username 2025-08-14T20:55:51.2625841Z return username 2025-08-14T20:55:51.2626082Z 2025-08-14T20:55:51.2626089Z 2025-08-14T20:55:51.2626319Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:55:51.2626855Z """ 2025-08-14T20:55:51.2627517Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:55:51.2628320Z """ 2025-08-14T20:55:51.2628884Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:55:51.2629412Z 2025-08-14T20:55:51.2629419Z 2025-08-14T20:55:51.2629623Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:55:51.2630115Z try: 2025-08-14T20:55:51.2630652Z data = yaml.safe_load(yaml_text) 2025-08-14T20:55:51.2631161Z return data 2025-08-14T20:55:51.2631584Z except yaml.YAMLError: 2025-08-14T20:55:51.2632074Z log.exception("Error loading YAML") 2025-08-14T20:55:51.2632580Z raise 2025-08-14T20:55:51.2632799Z 2025-08-14T20:55:51.2632806Z 2025-08-14T20:55:51.2633236Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:55:51.2633994Z """ 2025-08-14T20:55:51.2634614Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:55:51.2635208Z 2025-08-14T20:55:51.2635692Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:55:51.2636459Z and the text below is the list of opted in users. 2025-08-14T20:55:51.2636863Z 2025-08-14T20:55:51.2637231Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:55:51.2637947Z """ 2025-08-14T20:55:51.2638384Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:55:51.2639004Z if len(rollout_state_parts) >= 2: 2025-08-14T20:55:51.2639608Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:55:51.2640292Z else: 2025-08-14T20:55:51.2640680Z return "", rollout_state 2025-08-14T20:55:51.2640984Z 2025-08-14T20:55:51.2640991Z 2025-08-14T20:55:51.2641195Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:55:51.2641704Z """ 2025-08-14T20:55:51.2642212Z Dictionary of users with a list of features they have opted into 2025-08-14T20:55:51.2642862Z """ 2025-08-14T20:55:51.2643062Z 2025-08-14T20:55:51.2643069Z 2025-08-14T20:55:51.2643418Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:55:51.2644064Z """ 2025-08-14T20:55:51.2644777Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:55:51.2645461Z 2025-08-14T20:55:51.2646081Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:55:51.2647090Z - Example line: "@User1,lf,split_build" 2025-08-14T20:55:51.2647764Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:55:51.2648251Z 2025-08-14T20:55:51.2648257Z 2025-08-14T20:55:51.2648413Z """ 2025-08-14T20:55:51.2648785Z optins = UserOptins() 2025-08-14T20:55:51.2649268Z for user in user_optin_text.split("\n"): 2025-08-14T20:55:51.2649818Z user = user.strip("\r\n\t -") 2025-08-14T20:55:51.2650508Z if not user or not user.startswith("@"): 2025-08-14T20:55:51.2651226Z # Not a valid user. Skip 2025-08-14T20:55:51.2651707Z continue 2025-08-14T20:55:51.2651955Z 2025-08-14T20:55:51.2652112Z if user: 2025-08-14T20:55:51.2652549Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:55:51.2653233Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:55:51.2653728Z 2025-08-14T20:55:51.2653899Z return optins 2025-08-14T20:55:51.2654133Z 2025-08-14T20:55:51.2654140Z 2025-08-14T20:55:51.2654423Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:55:51.2655021Z """ 2025-08-14T20:55:51.2655414Z Check if the experiment name is valid. 2025-08-14T20:55:51.2655938Z A valid name: 2025-08-14T20:55:51.2656568Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:55:51.2657529Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:55:51.2658275Z - Cannot contain spaces 2025-08-14T20:55:51.2658727Z """ 2025-08-14T20:55:51.2658933Z 2025-08-14T20:55:51.2659194Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:55:51.2659884Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:55:51.2660874Z 2025-08-14T20:55:51.2661044Z if valid: 2025-08-14T20:55:51.2661429Z return True 2025-08-14T20:55:51.2661672Z 2025-08-14T20:55:51.2661831Z log.error( 2025-08-14T20:55:51.2663316Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:55:51.2664904Z ) 2025-08-14T20:55:51.2665256Z return False 2025-08-14T20:55:51.2665487Z 2025-08-14T20:55:51.2665493Z 2025-08-14T20:55:51.2665799Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:55:51.2666409Z """ 2025-08-14T20:55:51.2667134Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:55:51.2667873Z """ 2025-08-14T20:55:51.2668223Z try: 2025-08-14T20:55:51.2668581Z if settings_text: 2025-08-14T20:55:51.2669308Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:55:51.2670090Z # for easy reading 2025-08-14T20:55:51.2670989Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:55:51.2671876Z # the backtick character in shell commands. 2025-08-14T20:55:51.2672472Z backtick = chr(96) # backtick character 2025-08-14T20:55:51.2673136Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:55:51.2673803Z settings = load_yaml(settings_text) 2025-08-14T20:55:51.2674184Z 2025-08-14T20:55:51.2674600Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:55:51.2675369Z experiments = {} 2025-08-14T20:55:51.2675674Z 2025-08-14T20:55:51.2676051Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:55:51.2676826Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:55:51.2677939Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:55:51.2679000Z continue 2025-08-14T20:55:51.2679283Z 2025-08-14T20:55:51.2679461Z valid_settings = {} 2025-08-14T20:55:51.2679978Z for setting in exp_settings: 2025-08-14T20:55:51.2680648Z if setting not in Experiment._fields: 2025-08-14T20:55:51.2681196Z log.warning( 2025-08-14T20:55:51.2681904Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:55:51.2682770Z ) 2025-08-14T20:55:51.2683199Z else: 2025-08-14T20:55:51.2683702Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:55:51.2684133Z 2025-08-14T20:55:51.2684400Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:55:51.2685032Z return Settings(experiments) 2025-08-14T20:55:51.2685384Z 2025-08-14T20:55:51.2685554Z except Exception: 2025-08-14T20:55:51.2686024Z log.exception("Failed to parse settings") 2025-08-14T20:55:51.2686408Z 2025-08-14T20:55:51.2686578Z return Settings() 2025-08-14T20:55:51.2686835Z 2025-08-14T20:55:51.2686841Z 2025-08-14T20:55:51.2687085Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:55:51.2687655Z """ 2025-08-14T20:55:51.2688094Z Parse settings, if any, from the rollout state. 2025-08-14T20:55:51.2688496Z 2025-08-14T20:55:51.2688853Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:55:51.2689658Z and the text below is the list of opted in users. 2025-08-14T20:55:51.2690067Z 2025-08-14T20:55:51.2690581Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:55:51.2691313Z """ 2025-08-14T20:55:51.2691870Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:55:51.2692624Z return parse_settings_from_text(settings_text) 2025-08-14T20:55:51.2693030Z 2025-08-14T20:55:51.2693037Z 2025-08-14T20:55:51.2693277Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:55:51.2693830Z """ 2025-08-14T20:55:51.2694209Z Parse users from the rollout state. 2025-08-14T20:55:51.2694561Z 2025-08-14T20:55:51.2694717Z """ 2025-08-14T20:55:51.2695232Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:55:51.2695984Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:55:51.2696389Z 2025-08-14T20:55:51.2696395Z 2025-08-14T20:55:51.2696929Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:55:51.2697674Z """ 2025-08-14T20:55:51.2698081Z Check if a user is opted into an experiment 2025-08-14T20:55:51.2698614Z """ 2025-08-14T20:55:51.2699057Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:55:51.2699475Z 2025-08-14T20:55:51.2699481Z 2025-08-14T20:55:51.2699895Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:55:51.2700748Z """ 2025-08-14T20:55:51.2701191Z Check if a user explicitly opted out of an experiment 2025-08-14T20:55:51.2701765Z """ 2025-08-14T20:55:51.2702255Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:55:51.2702935Z experiment_optout = "-" + experiment_name 2025-08-14T20:55:51.2703568Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:55:51.2704167Z return False 2025-08-14T20:55:51.2704431Z 2025-08-14T20:55:51.2704703Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:55:51.2705292Z log.warning( 2025-08-14T20:55:51.2706089Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:55:51.2706966Z ) 2025-08-14T20:55:51.2707168Z 2025-08-14T20:55:51.2707329Z return True 2025-08-14T20:55:51.2707557Z 2025-08-14T20:55:51.2707563Z 2025-08-14T20:55:51.2707740Z def get_runner_prefix( 2025-08-14T20:55:51.2708165Z rollout_state: str, 2025-08-14T20:55:51.2708618Z workflow_requestors: Iterable[str], 2025-08-14T20:55:51.2709125Z branch: str, 2025-08-14T20:55:51.2709604Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:55:51.2710348Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:55:51.2710937Z is_canary: bool = False, 2025-08-14T20:55:51.2711386Z ) -> str: 2025-08-14T20:55:51.2711927Z settings = parse_settings(rollout_state) 2025-08-14T20:55:51.2712505Z user_optins = parse_users(rollout_state) 2025-08-14T20:55:51.2712866Z 2025-08-14T20:55:51.2713033Z fleet_prefix = "" 2025-08-14T20:55:51.2713451Z prefixes = [] 2025-08-14T20:55:51.2714068Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:55:51.2715005Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:55:51.2715712Z log.info( 2025-08-14T20:55:51.2716378Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:55:51.2717130Z ) 2025-08-14T20:55:51.2717497Z continue 2025-08-14T20:55:51.2717741Z 2025-08-14T20:55:51.2717935Z if opt_out_experiments: 2025-08-14T20:55:51.2718458Z if experiment_name in opt_out_experiments: 2025-08-14T20:55:51.2719091Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:55:51.2719675Z log.info( 2025-08-14T20:55:51.2720741Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:55:51.2721742Z ) 2025-08-14T20:55:51.2722130Z continue 2025-08-14T20:55:51.2722400Z 2025-08-14T20:55:51.2722581Z if eligible_experiments: 2025-08-14T20:55:51.2723161Z if experiment_name not in eligible_experiments: 2025-08-14T20:55:51.2723792Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:55:51.2724339Z log.info( 2025-08-14T20:55:51.2725112Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:55:51.2725953Z ) 2025-08-14T20:55:51.2726347Z continue 2025-08-14T20:55:51.2726817Z elif not experiment_settings.default: 2025-08-14T20:55:51.2727350Z log.info( 2025-08-14T20:55:51.2728173Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:55:51.2728923Z ) 2025-08-14T20:55:51.2729290Z continue 2025-08-14T20:55:51.2729536Z 2025-08-14T20:55:51.2729808Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:55:51.2730525Z opted_out_users = [ 2025-08-14T20:55:51.2730972Z requestor 2025-08-14T20:55:51.2731412Z for requestor in workflow_requestors 2025-08-14T20:55:51.2732069Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:55:51.2732693Z ] 2025-08-14T20:55:51.2732899Z 2025-08-14T20:55:51.2733072Z if opted_out_users: 2025-08-14T20:55:51.2733510Z log.info( 2025-08-14T20:55:51.2734116Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:55:51.2734801Z ) 2025-08-14T20:55:51.2735163Z continue 2025-08-14T20:55:51.2735417Z 2025-08-14T20:55:51.2735698Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:55:51.2736312Z opted_in_users = [ 2025-08-14T20:55:51.2736748Z requestor 2025-08-14T20:55:51.2737194Z for requestor in workflow_requestors 2025-08-14T20:55:51.2737848Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:55:51.2738473Z ] 2025-08-14T20:55:51.2738681Z 2025-08-14T20:55:51.2738847Z enabled = False 2025-08-14T20:55:51.2739275Z if opted_in_users: 2025-08-14T20:55:51.2739708Z log.info( 2025-08-14T20:55:51.2740395Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:55:51.2741076Z ) 2025-08-14T20:55:51.2741459Z enabled = True 2025-08-14T20:55:51.2741732Z 2025-08-14T20:55:51.2741945Z elif experiment_settings.rollout_perc: 2025-08-14T20:55:51.2742780Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:55:51.2743890Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:55:51.2744532Z log.info( 2025-08-14T20:55:51.2745396Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:55:51.2746314Z ) 2025-08-14T20:55:51.2746712Z enabled = True 2025-08-14T20:55:51.2747006Z 2025-08-14T20:55:51.2747166Z if enabled: 2025-08-14T20:55:51.2747582Z label = experiment_name 2025-08-14T20:55:51.2748118Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:55:51.2748948Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:55:51.2749829Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:55:51.2750689Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:55:51.2751352Z if is_canary: 2025-08-14T20:55:51.2751831Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:55:51.2752383Z fleet_prefix = label 2025-08-14T20:55:51.2752857Z else: 2025-08-14T20:55:51.2753278Z prefixes.append(label) 2025-08-14T20:55:51.2753621Z 2025-08-14T20:55:51.2753802Z if len(prefixes) > 1: 2025-08-14T20:55:51.2754236Z log.error( 2025-08-14T20:55:51.2755276Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:55:51.2756386Z ) 2025-08-14T20:55:51.2756773Z prefixes = prefixes[:1] 2025-08-14T20:55:51.2757072Z 2025-08-14T20:55:51.2757258Z # Fleet always comes first 2025-08-14T20:55:51.2757722Z if fleet_prefix: 2025-08-14T20:55:51.2758156Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:55:51.2758525Z 2025-08-14T20:55:51.2758899Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:55:51.2759327Z 2025-08-14T20:55:51.2759334Z 2025-08-14T20:55:51.2759781Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:55:51.2760650Z """ 2025-08-14T20:55:51.2761233Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:55:51.2761793Z 2025-08-14T20:55:51.2762174Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:55:51.2762874Z """ 2025-08-14T20:55:51.2763251Z gh = get_gh_client(github_token) 2025-08-14T20:55:51.2764047Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:55:51.2764988Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:55:51.2765454Z 2025-08-14T20:55:51.2765461Z 2025-08-14T20:55:51.2765908Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:55:51.2767187Z for _ in range(num_retries): 2025-08-14T20:55:51.2767679Z try: 2025-08-14T20:55:51.2768097Z req = Request(url=url, headers=headers) 2025-08-14T20:55:51.2768752Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:55:51.2769383Z return json.loads(content) 2025-08-14T20:55:51.2770017Z except Exception as e: 2025-08-14T20:55:51.2770726Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:55:51.2771142Z 2025-08-14T20:55:51.2771514Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:55:51.2772217Z return {} 2025-08-14T20:55:51.2772440Z 2025-08-14T20:55:51.2772446Z 2025-08-14T20:55:51.2772596Z @cache 2025-08-14T20:55:51.2773210Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:55:51.2773951Z """ 2025-08-14T20:55:51.2774338Z Dynamically get PR information 2025-08-14T20:55:51.2774812Z """ 2025-08-14T20:55:51.2775488Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:55:51.2776104Z headers = { 2025-08-14T20:55:51.2776555Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:55:51.2777147Z "Authorization": f"token {github_token}", 2025-08-14T20:55:51.2777677Z } 2025-08-14T20:55:51.2778090Z json_response: dict[str, Any] = download_json( 2025-08-14T20:55:51.2778691Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:55:51.2779234Z headers=headers, 2025-08-14T20:55:51.2779645Z ) 2025-08-14T20:55:51.2779842Z 2025-08-14T20:55:51.2780025Z if not json_response: 2025-08-14T20:55:51.2780688Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:55:51.2781293Z return {} 2025-08-14T20:55:51.2781522Z 2025-08-14T20:55:51.2781696Z return json_response 2025-08-14T20:55:51.2781970Z 2025-08-14T20:55:51.2781977Z 2025-08-14T20:55:51.2782374Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:55:51.2783109Z """ 2025-08-14T20:55:51.2783621Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:55:51.2784275Z """ 2025-08-14T20:55:51.2784741Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:55:51.2785343Z return { 2025-08-14T20:55:51.2785931Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:55:51.2786633Z } 2025-08-14T20:55:51.2786831Z 2025-08-14T20:55:51.2786837Z 2025-08-14T20:55:51.2787015Z def main() -> None: 2025-08-14T20:55:51.2787424Z args = parse_args() 2025-08-14T20:55:51.2787687Z 2025-08-14T20:55:51.2787908Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:55:51.2788289Z 2025-08-14T20:55:51.2788473Z # Check if the PR is opt-out 2025-08-14T20:55:51.2788951Z if args.pr_number: 2025-08-14T20:55:51.2789619Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:55:51.2790597Z if OPT_OUT_LABEL in labels: 2025-08-14T20:55:51.2791102Z log.info( 2025-08-14T20:55:51.2791789Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:55:51.2792547Z ) 2025-08-14T20:55:51.2793076Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:55:51.2793743Z sys.exit() 2025-08-14T20:55:51.2793998Z 2025-08-14T20:55:51.2794154Z try: 2025-08-14T20:55:51.2794584Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:55:51.2795279Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:55:51.2795909Z ) 2025-08-14T20:55:51.2796111Z 2025-08-14T20:55:51.2796315Z username = get_potential_pr_author( 2025-08-14T20:55:51.2796843Z args.github_token, 2025-08-14T20:55:51.2797308Z args.github_repo, 2025-08-14T20:55:51.2797769Z args.github_actor, 2025-08-14T20:55:51.2798245Z args.github_ref_type, 2025-08-14T20:55:51.2798727Z args.github_branch, 2025-08-14T20:55:51.2799180Z ) 2025-08-14T20:55:51.2799381Z 2025-08-14T20:55:51.2799659Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:55:51.2800114Z 2025-08-14T20:55:51.2800433Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:55:51.2800985Z rollout_state, 2025-08-14T20:55:51.2801456Z (args.github_issue_owner, username), 2025-08-14T20:55:51.2801998Z args.github_branch, 2025-08-14T20:55:51.2802480Z args.eligible_experiments, 2025-08-14T20:55:51.2803012Z args.opt_out_experiments, 2025-08-14T20:55:51.2803503Z is_canary, 2025-08-14T20:55:51.2803909Z ) 2025-08-14T20:55:51.2804112Z 2025-08-14T20:55:51.2804292Z except Exception as e: 2025-08-14T20:55:51.2804740Z log.error( 2025-08-14T20:55:51.2805395Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:55:51.2806301Z ) 2025-08-14T20:55:51.2806503Z 2025-08-14T20:55:51.2806831Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:55:51.2807323Z 2025-08-14T20:55:51.2807329Z 2025-08-14T20:55:51.2807502Z if __name__ == "__main__": 2025-08-14T20:55:51.2807927Z main() 2025-08-14T20:55:51.2808130Z 2025-08-14T20:55:51.2904568Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:55:51.2905502Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:55:51.2946601Z shell: /usr/bin/bash -e {0} 2025-08-14T20:55:51.2947085Z env: 2025-08-14T20:55:51.2947738Z GITHUB_TOKEN: *** 2025-08-14T20:55:51.2948155Z ISSUE_NUMBER: 5132 2025-08-14T20:55:51.2948592Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:55:51.2949112Z ISSUE_OWNER: 2025-08-14T20:55:51.2949515Z CHECK_EXPERIMENTS: 2025-08-14T20:55:51.2949950Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:55:51.2950534Z PR_NUMBER: 2025-08-14T20:55:51.2950917Z ##[endgroup] 2025-08-14T20:55:52.4637160Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:55:53.2069303Z Collecting urllib3==1.26.18 2025-08-14T20:55:53.2694352Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:55:53.2914815Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.4 MB/s eta 0:00:00 2025-08-14T20:55:53.3215910Z Collecting PyGithub==2.3.0 2025-08-14T20:55:53.3320546Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:55:53.3817163Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:55:53.3917923Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:55:53.3961495Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:55:53.3977308Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:55:53.3991564Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:55:53.4291200Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:55:53.4392326Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:55:53.4616125Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:55:53.5869978Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:55:53.5974458Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:55:53.7198655Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:55:53.7397843Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:55:53.7681867Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:55:53.7783294Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:55:53.8096624Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:55:53.8231424Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 12.0 MB/s eta 0:00:00 2025-08-14T20:55:53.8350062Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:55:53.8479533Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 32.1 MB/s eta 0:00:00 2025-08-14T20:55:53.8589777Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:55:53.8729855Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 71.8 MB/s eta 0:00:00 2025-08-14T20:55:53.8830802Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:55:53.8961928Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:55:53.9029419Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 101.2 MB/s eta 0:00:00 2025-08-14T20:55:53.9137312Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:55:53.9181610Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 29.6 MB/s eta 0:00:00 2025-08-14T20:55:53.9288427Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:55:53.9335769Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 36.2 MB/s eta 0:00:00 2025-08-14T20:55:54.2234669Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:55:54.7562319Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:55:54.8447585Z ##[group]Run curr_branch="main" 2025-08-14T20:55:54.8447884Z curr_branch="main" 2025-08-14T20:55:54.8448103Z curr_ref_type="branch" 2025-08-14T20:55:54.8448376Z echo "Current branch is '$curr_branch'" 2025-08-14T20:55:54.8448628Z  2025-08-14T20:55:54.8448807Z python3 runner_determinator.py \ 2025-08-14T20:55:54.8449086Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:55:54.8449349Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:55:54.8449593Z  --github-branch "$curr_branch" \ 2025-08-14T20:55:54.8449851Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:55:54.8450123Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:55:54.8450563Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:55:54.8450823Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:55:54.8451117Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:55:54.8451474Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:55:54.8451756Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:55:54.8493014Z shell: /usr/bin/bash -e {0} 2025-08-14T20:55:54.8493231Z env: 2025-08-14T20:55:54.8493780Z GITHUB_TOKEN: *** 2025-08-14T20:55:54.8493965Z ISSUE_NUMBER: 5132 2025-08-14T20:55:54.8494172Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:55:54.8494394Z ISSUE_OWNER: 2025-08-14T20:55:54.8494568Z CHECK_EXPERIMENTS: 2025-08-14T20:55:54.8494749Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:55:54.8494931Z PR_NUMBER: 2025-08-14T20:55:54.8495093Z ##[endgroup] 2025-08-14T20:55:54.8553969Z Current branch is 'main' 2025-08-14T20:55:56.7533100Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-08-14T20:55:56.7534431Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:55:56.7535744Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:55:56.7536739Z INFO : Setting output: label-type='lf.' 2025-08-14T20:55:56.7863668Z Evaluate and set job outputs 2025-08-14T20:55:56.7870001Z Set output 'label-type' 2025-08-14T20:55:56.7871961Z Cleaning up orphan processes