2025-07-17T06:33:19.5231960Z Current runner version: '2.326.0' 2025-07-17T06:33:19.5264069Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.5265367Z Hosted Compute Agent 2025-07-17T06:33:19.5266503Z Version: 20250711.363 2025-07-17T06:33:19.5267665Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.5268718Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.5269640Z ##[endgroup] 2025-07-17T06:33:19.5270651Z ##[group]Operating System 2025-07-17T06:33:19.5271517Z Ubuntu 2025-07-17T06:33:19.5272296Z 24.04.2 2025-07-17T06:33:19.5273119Z LTS 2025-07-17T06:33:19.5273860Z ##[endgroup] 2025-07-17T06:33:19.5274652Z ##[group]Runner Image 2025-07-17T06:33:19.5275722Z Image: ubuntu-24.04 2025-07-17T06:33:19.5276795Z Version: 20250710.1.0 2025-07-17T06:33:19.5278635Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.5281394Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.5282995Z ##[endgroup] 2025-07-17T06:33:19.5284792Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.5287703Z Contents: read 2025-07-17T06:33:19.5288665Z Metadata: read 2025-07-17T06:33:19.5289477Z ##[endgroup] 2025-07-17T06:33:19.5292755Z Secret source: Actions 2025-07-17T06:33:19.5294343Z Prepare workflow directory 2025-07-17T06:33:19.6045532Z Prepare all required actions 2025-07-17T06:33:19.6128166Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.6135343Z ##[group] Inputs 2025-07-17T06:33:19.6136626Z check_experiments: 2025-07-17T06:33:19.6137671Z opt_out_experiments: lf 2025-07-17T06:33:19.6138703Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.6139895Z issue_owner: 2025-07-17T06:33:19.6140773Z curr_branch: main 2025-07-17T06:33:19.6141537Z curr_ref_type: branch 2025-07-17T06:33:19.6142712Z issue_number: 5132 2025-07-17T06:33:19.6143588Z ##[endgroup] 2025-07-17T06:33:19.6144674Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.1338068Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.1340590Z cat < runner_determinator.py 2025-07-17T06:33:20.1341295Z # flake8: noqa: G004 2025-07-17T06:33:20.1341871Z  2025-07-17T06:33:20.1342642Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.1343854Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.1344878Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.1345586Z  2025-07-17T06:33:20.1346348Z """ 2025-07-17T06:33:20.1347098Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.1348190Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.1349510Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.1350522Z of which runners should be used to run which job. 2025-07-17T06:33:20.1351326Z  2025-07-17T06:33:20.1352040Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.1353151Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.1354226Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.1355146Z list, defined. 2025-07-17T06:33:20.1355643Z  2025-07-17T06:33:20.1356521Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.1357675Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.1358675Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.1359484Z  2025-07-17T06:33:20.1360533Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.1361618Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.1362611Z experiments which the user could be opted in to. 2025-07-17T06:33:20.1363313Z  2025-07-17T06:33:20.1363844Z The user list has the following rules: 2025-07-17T06:33:20.1364457Z  2025-07-17T06:33:20.1365272Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.1366529Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.1367485Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.1368315Z  2025-07-17T06:33:20.1368762Z Example config: 2025-07-17T06:33:20.1369386Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.1370307Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.1371117Z  # Expected syntax is: 2025-07-17T06:33:20.1371935Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.1373125Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.1374058Z  2025-07-17T06:33:20.1374509Z  experiments: 2025-07-17T06:33:20.1375149Z  lf: 2025-07-17T06:33:20.1375645Z  rollout_percent: 25 2025-07-17T06:33:20.1376397Z  all_branches: false 2025-07-17T06:33:20.1377078Z  default: true 2025-07-17T06:33:20.1377626Z  --- 2025-07-17T06:33:20.1378132Z  2025-07-17T06:33:20.1452312Z  # Opt-ins: 2025-07-17T06:33:20.1453095Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.1454357Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.1455241Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.1456036Z  # Experiments should be from the above list. 2025-07-17T06:33:20.1456902Z  2025-07-17T06:33:20.1457309Z  @User1,-lf,split_build 2025-07-17T06:33:20.1457842Z  @User2,lf 2025-07-17T06:33:20.1458298Z  @User3,split_build 2025-07-17T06:33:20.1458781Z """ 2025-07-17T06:33:20.1459161Z  2025-07-17T06:33:20.1459541Z import json 2025-07-17T06:33:20.1459977Z import logging 2025-07-17T06:33:20.1460418Z import os 2025-07-17T06:33:20.1460841Z import random 2025-07-17T06:33:20.1461286Z import re 2025-07-17T06:33:20.1461702Z import sys 2025-07-17T06:33:20.1462175Z from argparse import ArgumentParser 2025-07-17T06:33:20.1462853Z from collections.abc import Iterable 2025-07-17T06:33:20.1463449Z from functools import cache 2025-07-17T06:33:20.1463989Z from logging import LogRecord 2025-07-17T06:33:20.1464550Z from typing import Any, NamedTuple 2025-07-17T06:33:20.1465164Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.1465739Z  2025-07-17T06:33:20.1466393Z import yaml 2025-07-17T06:33:20.1466870Z from github import Auth, Github 2025-07-17T06:33:20.1467425Z from github.Issue import Issue 2025-07-17T06:33:20.1467942Z  2025-07-17T06:33:20.1468300Z  2025-07-17T06:33:20.1468763Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.1469540Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.1470502Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.1471259Z  2025-07-17T06:33:20.1471924Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.1472562Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.1473159Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.1473818Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.1474389Z  2025-07-17T06:33:20.1474812Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.1475357Z  2025-07-17T06:33:20.1475750Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.1476400Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.1476894Z  2025-07-17T06:33:20.1477268Z  2025-07-17T06:33:20.1477664Z class Experiment(NamedTuple): 2025-07-17T06:33:20.1478215Z  rollout_perc: float = ( 2025-07-17T06:33:20.1478963Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.1479696Z  ) 2025-07-17T06:33:20.1480110Z  all_branches: bool = ( 2025-07-17T06:33:20.1480837Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.1481559Z  ) 2025-07-17T06:33:20.1481969Z  default: bool = ( 2025-07-17T06:33:20.1482628Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.1483311Z  ) 2025-07-17T06:33:20.1483693Z  2025-07-17T06:33:20.1484096Z  # Add more fields as needed 2025-07-17T06:33:20.1484600Z  2025-07-17T06:33:20.1484961Z  2025-07-17T06:33:20.1485354Z class Settings(NamedTuple): 2025-07-17T06:33:20.1485857Z  """ 2025-07-17T06:33:20.1486508Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.1487135Z  """ 2025-07-17T06:33:20.1487525Z  2025-07-17T06:33:20.1487965Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.1488525Z  2025-07-17T06:33:20.1489063Z  2025-07-17T06:33:20.1489527Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.1490228Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.1490856Z  2025-07-17T06:33:20.1491230Z  COLORS = { 2025-07-17T06:33:20.1491713Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.1492287Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.1492847Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.1493404Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.1493954Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.1494473Z  } 2025-07-17T06:33:20.1494859Z  2025-07-17T06:33:20.1495316Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.1496390Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.1497277Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.1497920Z  return super().format(record) 2025-07-17T06:33:20.1498453Z  2025-07-17T06:33:20.1498820Z  2025-07-17T06:33:20.1499238Z handler = logging.StreamHandler() 2025-07-17T06:33:20.1500031Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.1500792Z  2025-07-17T06:33:20.1501290Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.1501947Z log.addHandler(handler) 2025-07-17T06:33:20.1502471Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.1502971Z  2025-07-17T06:33:20.1503336Z  2025-07-17T06:33:20.1503829Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.1504441Z  """ 2025-07-17T06:33:20.1505015Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.1505839Z  """ 2025-07-17T06:33:20.1506372Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.1507543Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.1508728Z  log.warning( 2025-07-17T06:33:20.1509696Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.1510678Z  ) 2025-07-17T06:33:20.1511181Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.1511781Z  return 2025-07-17T06:33:20.1512213Z  2025-07-17T06:33:20.1512643Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.1513277Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.1513908Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.1514438Z  2025-07-17T06:33:20.1514812Z  2025-07-17T06:33:20.1515365Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.1516079Z  return frozenset( 2025-07-17T06:33:20.1516888Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.1517605Z  ) 2025-07-17T06:33:20.1518003Z  2025-07-17T06:33:20.1518366Z  2025-07-17T06:33:20.1518760Z def parse_args() -> Any: 2025-07-17T06:33:20.1519418Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.1520368Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.1521195Z  parser.add_argument( 2025-07-17T06:33:20.1521724Z  "--github-issue-repo", 2025-07-17T06:33:20.1522261Z  type=str, 2025-07-17T06:33:20.1522734Z  required=False, 2025-07-17T06:33:20.1523419Z  default="pytorch/test-infra", 2025-07-17T06:33:20.1524037Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.1524592Z  ) 2025-07-17T06:33:20.1525015Z  parser.add_argument( 2025-07-17T06:33:20.1525524Z  "--github-repo", 2025-07-17T06:33:20.1526025Z  type=str, 2025-07-17T06:33:20.1526602Z  required=True, 2025-07-17T06:33:20.1527155Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.1527715Z  ) 2025-07-17T06:33:20.1528136Z  parser.add_argument( 2025-07-17T06:33:20.1528830Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.1529536Z  ) 2025-07-17T06:33:20.1529954Z  parser.add_argument( 2025-07-17T06:33:20.1530699Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.1531438Z  ) 2025-07-17T06:33:20.1531854Z  parser.add_argument( 2025-07-17T06:33:20.1532582Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.1533315Z  ) 2025-07-17T06:33:20.1533730Z  parser.add_argument( 2025-07-17T06:33:20.1534481Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.1535233Z  ) 2025-07-17T06:33:20.1535667Z  parser.add_argument( 2025-07-17T06:33:20.1536443Z  "--github-ref-type", 2025-07-17T06:33:20.1536991Z  type=str, 2025-07-17T06:33:20.1537469Z  required=True, 2025-07-17T06:33:20.1538066Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.1538675Z  ) 2025-07-17T06:33:20.1539096Z  parser.add_argument( 2025-07-17T06:33:20.1539635Z  "--eligible-experiments", 2025-07-17T06:33:20.1540382Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.1540947Z  required=False, 2025-07-17T06:33:20.1541446Z  default="", 2025-07-17T06:33:20.1542393Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.1543397Z  ) 2025-07-17T06:33:20.1543815Z  parser.add_argument( 2025-07-17T06:33:20.1544343Z  "--opt-out-experiments", 2025-07-17T06:33:20.1544925Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.1545490Z  required=False, 2025-07-17T06:33:20.1545985Z  default="", 2025-07-17T06:33:20.1546579Z  help=( 2025-07-17T06:33:20.1547349Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.1548565Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.1549447Z  ), 2025-07-17T06:33:20.1549856Z  ) 2025-07-17T06:33:20.1550275Z  parser.add_argument( 2025-07-17T06:33:20.1550793Z  "--pr-number", 2025-07-17T06:33:20.1551285Z  type=str, 2025-07-17T06:33:20.1551764Z  required=False, 2025-07-17T06:33:20.1552258Z  default="", 2025-07-17T06:33:20.1552827Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.1553442Z  ) 2025-07-17T06:33:20.1553830Z  2025-07-17T06:33:20.1554246Z  return parser.parse_args() 2025-07-17T06:33:20.1554766Z  2025-07-17T06:33:20.1555135Z  2025-07-17T06:33:20.1555796Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.1557062Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.1557678Z  return Github(auth=auth) 2025-07-17T06:33:20.1558187Z  2025-07-17T06:33:20.1558546Z  2025-07-17T06:33:20.1559249Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.1560119Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.1560702Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.1561276Z  2025-07-17T06:33:20.1561638Z  2025-07-17T06:33:20.1562044Z def get_potential_pr_author( 2025-07-17T06:33:20.1562785Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.1563522Z ) -> str: 2025-07-17T06:33:20.1564124Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.1565008Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.1565846Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.1566582Z  2025-07-17T06:33:20.1567009Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.1567554Z  2025-07-17T06:33:20.1568066Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.1568769Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.1569318Z  if ( 2025-07-17T06:33:20.1569779Z  len(split_tag) == 3 2025-07-17T06:33:20.1570341Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.1570935Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.1571483Z  ): 2025-07-17T06:33:20.1571942Z  pr_number = split_tag[2] 2025-07-17T06:33:20.1572476Z  try: 2025-07-17T06:33:20.1572978Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.1573816Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.1574490Z  except Exception as e: 2025-07-17T06:33:20.1575088Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.1575833Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.1576807Z  ) from e 2025-07-17T06:33:20.1577453Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.1578223Z  # In all other cases, return the original input username 2025-07-17T06:33:20.1578868Z  return username 2025-07-17T06:33:20.1579324Z  2025-07-17T06:33:20.1579692Z  2025-07-17T06:33:20.1580157Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.1580737Z  """ 2025-07-17T06:33:20.1581468Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.1582309Z  """ 2025-07-17T06:33:20.1582928Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.1583642Z  2025-07-17T06:33:20.1584006Z  2025-07-17T06:33:20.1584429Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.1584978Z  try: 2025-07-17T06:33:20.1585431Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.1585985Z  return data 2025-07-17T06:33:20.1586585Z  except yaml.YAMLError: 2025-07-17T06:33:20.1587155Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.1587712Z  raise 2025-07-17T06:33:20.1588126Z  2025-07-17T06:33:20.1588495Z  2025-07-17T06:33:20.1589164Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.1589951Z  """ 2025-07-17T06:33:20.1590805Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.1591606Z  2025-07-17T06:33:20.1592189Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.1593029Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.1593636Z  2025-07-17T06:33:20.1594261Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.1595008Z  """ 2025-07-17T06:33:20.1595523Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.1596282Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.1596969Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.1597603Z  else: 2025-07-17T06:33:20.1598202Z  return "", rollout_state 2025-07-17T06:33:20.1598796Z  2025-07-17T06:33:20.1599169Z  2025-07-17T06:33:20.1599605Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.1600157Z  """ 2025-07-17T06:33:20.1600747Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.1601441Z  """ 2025-07-17T06:33:20.1601835Z  2025-07-17T06:33:20.1602192Z  2025-07-17T06:33:20.1602768Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.1603473Z  """ 2025-07-17T06:33:20.1604258Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.1605137Z  2025-07-17T06:33:20.1605994Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.1607162Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.1608060Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.1608729Z  2025-07-17T06:33:20.1609092Z  2025-07-17T06:33:20.1609439Z  """ 2025-07-17T06:33:20.1609848Z  optins = UserOptins() 2025-07-17T06:33:20.1610408Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.1611020Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.1611627Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.1612236Z  # Not a valid user. Skip 2025-07-17T06:33:20.1612774Z  continue 2025-07-17T06:33:20.1613226Z  2025-07-17T06:33:20.1613595Z  if user: 2025-07-17T06:33:20.1614134Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.1614892Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.1615575Z  2025-07-17T06:33:20.1615958Z  return optins 2025-07-17T06:33:20.1616678Z  2025-07-17T06:33:20.1617037Z  2025-07-17T06:33:20.1617574Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.1618232Z  """ 2025-07-17T06:33:20.1618697Z  Check if the experiment name is valid. 2025-07-17T06:33:20.1619264Z  A valid name: 2025-07-17T06:33:20.1619991Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.1620987Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.1621755Z  - Cannot contain spaces 2025-07-17T06:33:20.1622270Z  """ 2025-07-17T06:33:20.1622650Z  2025-07-17T06:33:20.1623146Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.1623915Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.1624713Z  2025-07-17T06:33:20.1625082Z  if valid: 2025-07-17T06:33:20.1625516Z  return True 2025-07-17T06:33:20.1625959Z  2025-07-17T06:33:20.1626837Z  log.error( 2025-07-17T06:33:20.1628406Z  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-07-17T06:33:20.1630008Z  ) 2025-07-17T06:33:20.1630429Z  return False 2025-07-17T06:33:20.1630869Z  2025-07-17T06:33:20.1631222Z  2025-07-17T06:33:20.1631774Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.1632454Z  """ 2025-07-17T06:33:20.1633112Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.1633881Z  """ 2025-07-17T06:33:20.1634278Z  try: 2025-07-17T06:33:20.1634686Z  if settings_text: 2025-07-17T06:33:20.1635495Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.1636553Z  # for easy reading 2025-07-17T06:33:20.1637438Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.1638387Z  # the backtick character in shell commands. 2025-07-17T06:33:20.1639053Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.1639790Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.1640509Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.1641057Z  2025-07-17T06:33:20.1641698Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.1642653Z  experiments = {} 2025-07-17T06:33:20.1643149Z  2025-07-17T06:33:20.1643745Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.1644573Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.1645748Z  # 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-07-17T06:33:20.1646948Z  continue 2025-07-17T06:33:20.1647436Z  2025-07-17T06:33:20.1647837Z  valid_settings = {} 2025-07-17T06:33:20.1648416Z  for setting in exp_settings: 2025-07-17T06:33:20.1649034Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.1649651Z  log.warning( 2025-07-17T06:33:20.1650452Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.1651202Z  ) 2025-07-17T06:33:20.1651693Z  else: 2025-07-17T06:33:20.1652280Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.1652892Z  2025-07-17T06:33:20.1653413Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.1654109Z  return Settings(experiments) 2025-07-17T06:33:20.1654654Z  2025-07-17T06:33:20.1655043Z  except Exception: 2025-07-17T06:33:20.1655605Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.1656275Z  2025-07-17T06:33:20.1656661Z  return Settings() 2025-07-17T06:33:20.1657119Z  2025-07-17T06:33:20.1657467Z  2025-07-17T06:33:20.1658147Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.1658773Z  """ 2025-07-17T06:33:20.1659266Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.1659852Z  2025-07-17T06:33:20.1660443Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.1661263Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.1661856Z  2025-07-17T06:33:20.1662493Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.1663260Z  """ 2025-07-17T06:33:20.1663883Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.1664702Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.1665285Z  2025-07-17T06:33:20.1665628Z  2025-07-17T06:33:20.1666232Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.1666845Z  """ 2025-07-17T06:33:20.1667299Z  Parse users from the rollout state. 2025-07-17T06:33:20.1667844Z  2025-07-17T06:33:20.1668196Z  """ 2025-07-17T06:33:20.1668800Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.1669600Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.1670183Z  2025-07-17T06:33:20.1670537Z  2025-07-17T06:33:20.1671203Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.1672002Z  """ 2025-07-17T06:33:20.1672480Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.1673060Z  """ 2025-07-17T06:33:20.1673583Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.1674202Z  2025-07-17T06:33:20.1674685Z  2025-07-17T06:33:20.1675370Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.1676274Z  """ 2025-07-17T06:33:20.1676807Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.1677431Z  """ 2025-07-17T06:33:20.1677991Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.1678752Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.1679459Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.1680104Z  return False 2025-07-17T06:33:20.1680557Z  2025-07-17T06:33:20.1681058Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.1681699Z  log.warning( 2025-07-17T06:33:20.1682592Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.1683517Z  ) 2025-07-17T06:33:20.1683917Z  2025-07-17T06:33:20.1684292Z  return True 2025-07-17T06:33:20.1684719Z  2025-07-17T06:33:20.1685082Z  2025-07-17T06:33:20.1685471Z def get_runner_prefix( 2025-07-17T06:33:20.1685980Z  rollout_state: str, 2025-07-17T06:33:20.1686620Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.1687176Z  branch: str, 2025-07-17T06:33:20.1687754Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.1688486Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.1689126Z  is_canary: bool = False, 2025-07-17T06:33:20.1689631Z ) -> str: 2025-07-17T06:33:20.1690125Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.1690767Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.1691331Z  2025-07-17T06:33:20.1691856Z  fleet_prefix = "" 2025-07-17T06:33:20.1692347Z  prefixes = [] 2025-07-17T06:33:20.1693059Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.1694086Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.1694852Z  log.info( 2025-07-17T06:33:20.1695612Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.1696500Z  ) 2025-07-17T06:33:20.1696952Z  continue 2025-07-17T06:33:20.1697397Z  2025-07-17T06:33:20.1697803Z  if opt_out_experiments: 2025-07-17T06:33:20.1698406Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.1699134Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.1699785Z  log.info( 2025-07-17T06:33:20.1700797Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.1701815Z  ) 2025-07-17T06:33:20.1702273Z  continue 2025-07-17T06:33:20.1702752Z  2025-07-17T06:33:20.1703153Z  if eligible_experiments: 2025-07-17T06:33:20.1703796Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.1704490Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.1705116Z  log.info( 2025-07-17T06:33:20.1705984Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.1706970Z  ) 2025-07-17T06:33:20.1707427Z  continue 2025-07-17T06:33:20.1708124Z  elif not experiment_settings.default: 2025-07-17T06:33:20.1708693Z  log.info( 2025-07-17T06:33:20.1709432Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.1710201Z  ) 2025-07-17T06:33:20.1710637Z  continue 2025-07-17T06:33:20.1711081Z  2025-07-17T06:33:20.1711594Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.1712295Z  opted_out_users = [ 2025-07-17T06:33:20.1712823Z  requestor 2025-07-17T06:33:20.1713359Z  for requestor in workflow_requestors 2025-07-17T06:33:20.1714089Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.1714764Z  ] 2025-07-17T06:33:20.1715156Z  2025-07-17T06:33:20.1715552Z  if opted_out_users: 2025-07-17T06:33:20.1716083Z  log.info( 2025-07-17T06:33:20.1716897Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.1717642Z  ) 2025-07-17T06:33:20.1718072Z  continue 2025-07-17T06:33:20.1718530Z  2025-07-17T06:33:20.1719029Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.1719694Z  opted_in_users = [ 2025-07-17T06:33:20.1720210Z  requestor 2025-07-17T06:33:20.1720750Z  for requestor in workflow_requestors 2025-07-17T06:33:20.1721471Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.1722135Z  ] 2025-07-17T06:33:20.1722533Z  2025-07-17T06:33:20.1722916Z  enabled = False 2025-07-17T06:33:20.1723428Z  if opted_in_users: 2025-07-17T06:33:20.1724071Z  log.info( 2025-07-17T06:33:20.1724779Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.1725508Z  ) 2025-07-17T06:33:20.1725946Z  enabled = True 2025-07-17T06:33:20.1726552Z  2025-07-17T06:33:20.1726997Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.1727894Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.1728899Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.1729608Z  log.info( 2025-07-17T06:33:20.1730590Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.1731550Z  ) 2025-07-17T06:33:20.1732034Z  enabled = True 2025-07-17T06:33:20.1732526Z  2025-07-17T06:33:20.1732901Z  if enabled: 2025-07-17T06:33:20.1733403Z  label = experiment_name 2025-07-17T06:33:20.1734018Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.1734908Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.1735838Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.1736766Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.1737472Z  if is_canary: 2025-07-17T06:33:20.1738038Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.1738636Z  fleet_prefix = label 2025-07-17T06:33:20.1739171Z  else: 2025-07-17T06:33:20.1739811Z  prefixes.append(label) 2025-07-17T06:33:20.1740352Z  2025-07-17T06:33:20.1740741Z  if len(prefixes) > 1: 2025-07-17T06:33:20.1741245Z  log.error( 2025-07-17T06:33:20.1742368Z  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-07-17T06:33:20.1743532Z  ) 2025-07-17T06:33:20.1743973Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.1744489Z  2025-07-17T06:33:20.1744894Z  # Fleet always comes first 2025-07-17T06:33:20.1745429Z  if fleet_prefix: 2025-07-17T06:33:20.1745940Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.1746604Z  2025-07-17T06:33:20.1747087Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.1747695Z  2025-07-17T06:33:20.1748067Z  2025-07-17T06:33:20.1748751Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.1749565Z  """ 2025-07-17T06:33:20.1750207Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.1750954Z  2025-07-17T06:33:20.1751560Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.1752303Z  """ 2025-07-17T06:33:20.1752749Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.1753357Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.1754073Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.1754704Z  2025-07-17T06:33:20.1755070Z  2025-07-17T06:33:20.1755707Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.1756794Z  for _ in range(num_retries): 2025-07-17T06:33:20.1757346Z  try: 2025-07-17T06:33:20.1757837Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.1758566Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.1759264Z  return json.loads(content) 2025-07-17T06:33:20.1759847Z  except Exception as e: 2025-07-17T06:33:20.1760462Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.1761053Z  2025-07-17T06:33:20.1761674Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.1762430Z  return {} 2025-07-17T06:33:20.1762863Z  2025-07-17T06:33:20.1763220Z  2025-07-17T06:33:20.1763592Z @cache 2025-07-17T06:33:20.1764282Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.1765102Z  """ 2025-07-17T06:33:20.1765544Z  Dynamically get PR information 2025-07-17T06:33:20.1766075Z  """ 2025-07-17T06:33:20.1766762Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.1767432Z  headers = { 2025-07-17T06:33:20.1767966Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.1768629Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.1769201Z  } 2025-07-17T06:33:20.1769687Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.1770349Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.1770934Z  headers=headers, 2025-07-17T06:33:20.1771417Z  ) 2025-07-17T06:33:20.1771800Z  2025-07-17T06:33:20.1772184Z  if not json_response: 2025-07-17T06:33:20.1772844Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.1773661Z  return {} 2025-07-17T06:33:20.1774113Z  2025-07-17T06:33:20.1774496Z  return json_response 2025-07-17T06:33:20.1774980Z  2025-07-17T06:33:20.1775418Z  2025-07-17T06:33:20.1776058Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.1776941Z  """ 2025-07-17T06:33:20.1777531Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.1778222Z  """ 2025-07-17T06:33:20.1778766Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.1779425Z  return { 2025-07-17T06:33:20.1780081Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.1780806Z  } 2025-07-17T06:33:20.1781195Z  2025-07-17T06:33:20.1781553Z  2025-07-17T06:33:20.1781958Z def main() -> None: 2025-07-17T06:33:20.1782439Z  args = parse_args() 2025-07-17T06:33:20.1782917Z  2025-07-17T06:33:20.1783368Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.1783950Z  2025-07-17T06:33:20.1784351Z  # Check if the PR is opt-out 2025-07-17T06:33:20.1784900Z  if args.pr_number: 2025-07-17T06:33:20.1785645Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.1786546Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.1787098Z  log.info( 2025-07-17T06:33:20.1787864Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.1788673Z  ) 2025-07-17T06:33:20.1789302Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.1790035Z  sys.exit() 2025-07-17T06:33:20.1790648Z  2025-07-17T06:33:20.1791019Z  try: 2025-07-17T06:33:20.1791520Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.1792297Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.1792983Z  ) 2025-07-17T06:33:20.1793381Z  2025-07-17T06:33:20.1793817Z  username = get_potential_pr_author( 2025-07-17T06:33:20.1794407Z  args.github_token, 2025-07-17T06:33:20.1794943Z  args.github_repo, 2025-07-17T06:33:20.1795485Z  args.github_actor, 2025-07-17T06:33:20.1796027Z  args.github_ref_type, 2025-07-17T06:33:20.1796683Z  args.github_branch, 2025-07-17T06:33:20.1797188Z  ) 2025-07-17T06:33:20.1797591Z  2025-07-17T06:33:20.1798110Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.1798766Z  2025-07-17T06:33:20.1799219Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.1799810Z  rollout_state, 2025-07-17T06:33:20.1800374Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.1801002Z  args.github_branch, 2025-07-17T06:33:20.1801575Z  args.eligible_experiments, 2025-07-17T06:33:20.1802164Z  args.opt_out_experiments, 2025-07-17T06:33:20.1802718Z  is_canary, 2025-07-17T06:33:20.1803189Z  ) 2025-07-17T06:33:20.1803596Z  2025-07-17T06:33:20.1803990Z  except Exception as e: 2025-07-17T06:33:20.1804501Z  log.error( 2025-07-17T06:33:20.1805267Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.1806074Z  ) 2025-07-17T06:33:20.1806738Z  2025-07-17T06:33:20.1807318Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.1808022Z  2025-07-17T06:33:20.1808388Z  2025-07-17T06:33:20.1808766Z if __name__ == "__main__": 2025-07-17T06:33:20.1809267Z  main() 2025-07-17T06:33:20.1809670Z  2025-07-17T06:33:20.1810035Z EOF 2025-07-17T06:33:20.1810412Z  2025-07-17T06:33:20.1810810Z cat runner_determinator.py 2025-07-17T06:33:20.1982090Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.1982919Z env: 2025-07-17T06:33:20.1983611Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.1984030Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.1984472Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.1984984Z ISSUE_OWNER: 2025-07-17T06:33:20.1985376Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.1985814Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:20.1986496Z PR_NUMBER: 2025-07-17T06:33:20.1986907Z ##[endgroup] 2025-07-17T06:33:20.2179668Z # flake8: noqa: G004 2025-07-17T06:33:20.2180007Z 2025-07-17T06:33:20.2180436Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.2181399Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.2182212Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.2182646Z 2025-07-17T06:33:20.2182810Z """ 2025-07-17T06:33:20.2183386Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.2184263Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.2185156Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.2185968Z of which runners should be used to run which job. 2025-07-17T06:33:20.2186717Z 2025-07-17T06:33:20.2187112Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.2188223Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.2189125Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.2189819Z list, defined. 2025-07-17T06:33:20.2190052Z 2025-07-17T06:33:20.2190417Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.2191344Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.2192162Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.2192593Z 2025-07-17T06:33:20.2192963Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.2193807Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.2194534Z experiments which the user could be opted in to. 2025-07-17T06:33:20.2194926Z 2025-07-17T06:33:20.2195127Z The user list has the following rules: 2025-07-17T06:33:20.2195473Z 2025-07-17T06:33:20.2195794Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.2196894Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.2197657Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.2198049Z 2025-07-17T06:33:20.2198228Z Example config: 2025-07-17T06:33:20.2198680Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.2199352Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.2199971Z # Expected syntax is: 2025-07-17T06:33:20.2200606Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.2201572Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.2202176Z 2025-07-17T06:33:20.2202351Z experiments: 2025-07-17T06:33:20.2202739Z lf: 2025-07-17T06:33:20.2203107Z rollout_percent: 25 2025-07-17T06:33:20.2203559Z all_branches: false 2025-07-17T06:33:20.2204160Z default: true 2025-07-17T06:33:20.2204568Z --- 2025-07-17T06:33:20.2204768Z 2025-07-17T06:33:20.2204932Z # Opt-ins: 2025-07-17T06:33:20.2205503Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.2206585Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.2207381Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.2208031Z # Experiments should be from the above list. 2025-07-17T06:33:20.2208419Z 2025-07-17T06:33:20.2208598Z @User1,-lf,split_build 2025-07-17T06:33:20.2209032Z @User2,lf 2025-07-17T06:33:20.2209415Z @User3,split_build 2025-07-17T06:33:20.2209817Z """ 2025-07-17T06:33:20.2210006Z 2025-07-17T06:33:20.2210167Z import json 2025-07-17T06:33:20.2210535Z import logging 2025-07-17T06:33:20.2210908Z import os 2025-07-17T06:33:20.2211272Z import random 2025-07-17T06:33:20.2211654Z import re 2025-07-17T06:33:20.2212018Z import sys 2025-07-17T06:33:20.2212421Z from argparse import ArgumentParser 2025-07-17T06:33:20.2212946Z from collections.abc import Iterable 2025-07-17T06:33:20.2213456Z from functools import cache 2025-07-17T06:33:20.2213921Z from logging import LogRecord 2025-07-17T06:33:20.2214405Z from typing import Any, NamedTuple 2025-07-17T06:33:20.2214932Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.2215301Z 2025-07-17T06:33:20.2215467Z import yaml 2025-07-17T06:33:20.2215856Z from github import Auth, Github 2025-07-17T06:33:20.2216581Z from github.Issue import Issue 2025-07-17T06:33:20.2216890Z 2025-07-17T06:33:20.2216897Z 2025-07-17T06:33:20.2217117Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.2217793Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.2218657Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.2219207Z 2025-07-17T06:33:20.2219433Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.2220164Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.2220685Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.2221240Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.2221585Z 2025-07-17T06:33:20.2221791Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.2222118Z 2025-07-17T06:33:20.2222305Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.2222760Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.2223033Z 2025-07-17T06:33:20.2223040Z 2025-07-17T06:33:20.2223228Z class Experiment(NamedTuple): 2025-07-17T06:33:20.2223704Z rollout_perc: float = ( 2025-07-17T06:33:20.2224318Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.2225001Z ) 2025-07-17T06:33:20.2225367Z all_branches: bool = ( 2025-07-17T06:33:20.2225984Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.2226943Z ) 2025-07-17T06:33:20.2227316Z default: bool = ( 2025-07-17T06:33:20.2227885Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.2228511Z ) 2025-07-17T06:33:20.2228702Z 2025-07-17T06:33:20.2228886Z # Add more fields as needed 2025-07-17T06:33:20.2229179Z 2025-07-17T06:33:20.2229186Z 2025-07-17T06:33:20.2229373Z class Settings(NamedTuple): 2025-07-17T06:33:20.2229819Z """ 2025-07-17T06:33:20.2230269Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.2230833Z """ 2025-07-17T06:33:20.2231025Z 2025-07-17T06:33:20.2231237Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.2231589Z 2025-07-17T06:33:20.2231597Z 2025-07-17T06:33:20.2231809Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.2232425Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.2232852Z 2025-07-17T06:33:20.2233016Z COLORS = { 2025-07-17T06:33:20.2233403Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.2234063Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.2234548Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.2235041Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.2235510Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.2235983Z } 2025-07-17T06:33:20.2236408Z 2025-07-17T06:33:20.2236636Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.2237388Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.2238160Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.2238732Z return super().format(record) 2025-07-17T06:33:20.2239060Z 2025-07-17T06:33:20.2239068Z 2025-07-17T06:33:20.2239269Z handler = logging.StreamHandler() 2025-07-17T06:33:20.2239963Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.2240515Z 2025-07-17T06:33:20.2240761Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.2241348Z log.addHandler(handler) 2025-07-17T06:33:20.2241802Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.2242085Z 2025-07-17T06:33:20.2242092Z 2025-07-17T06:33:20.2242346Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.2242898Z """ 2025-07-17T06:33:20.2243486Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.2244110Z """ 2025-07-17T06:33:20.2244475Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.2245542Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.2246773Z log.warning( 2025-07-17T06:33:20.2247614Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.2248531Z ) 2025-07-17T06:33:20.2258556Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.2259164Z return 2025-07-17T06:33:20.2259405Z 2025-07-17T06:33:20.2259816Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.2260437Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.2261016Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.2261335Z 2025-07-17T06:33:20.2261343Z 2025-07-17T06:33:20.2261654Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.2262285Z return frozenset( 2025-07-17T06:33:20.2262894Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.2263566Z ) 2025-07-17T06:33:20.2263770Z 2025-07-17T06:33:20.2263777Z 2025-07-17T06:33:20.2263961Z def parse_args() -> Any: 2025-07-17T06:33:20.2264509Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.2265372Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.2266384Z parser.add_argument( 2025-07-17T06:33:20.2266921Z "--github-issue-repo", 2025-07-17T06:33:20.2267376Z type=str, 2025-07-17T06:33:20.2267786Z required=False, 2025-07-17T06:33:20.2268227Z default="pytorch/test-infra", 2025-07-17T06:33:20.2268756Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.2269256Z ) 2025-07-17T06:33:20.2269618Z parser.add_argument( 2025-07-17T06:33:20.2270060Z "--github-repo", 2025-07-17T06:33:20.2270482Z type=str, 2025-07-17T06:33:20.2270915Z required=True, 2025-07-17T06:33:20.2271378Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.2271907Z ) 2025-07-17T06:33:20.2272286Z parser.add_argument( 2025-07-17T06:33:20.2272889Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.2273543Z ) 2025-07-17T06:33:20.2273908Z parser.add_argument( 2025-07-17T06:33:20.2274529Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.2275199Z ) 2025-07-17T06:33:20.2275561Z parser.add_argument( 2025-07-17T06:33:20.2276503Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.2277200Z ) 2025-07-17T06:33:20.2277570Z parser.add_argument( 2025-07-17T06:33:20.2278217Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.2278930Z ) 2025-07-17T06:33:20.2279293Z parser.add_argument( 2025-07-17T06:33:20.2279738Z "--github-ref-type", 2025-07-17T06:33:20.2280181Z type=str, 2025-07-17T06:33:20.2280575Z required=True, 2025-07-17T06:33:20.2281054Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.2281607Z ) 2025-07-17T06:33:20.2281965Z parser.add_argument( 2025-07-17T06:33:20.2282422Z "--eligible-experiments", 2025-07-17T06:33:20.2282930Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.2283442Z required=False, 2025-07-17T06:33:20.2283852Z default="", 2025-07-17T06:33:20.2284691Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.2285629Z ) 2025-07-17T06:33:20.2285986Z parser.add_argument( 2025-07-17T06:33:20.2334195Z "--opt-out-experiments", 2025-07-17T06:33:20.2334822Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.2335393Z required=False, 2025-07-17T06:33:20.2335814Z default="", 2025-07-17T06:33:20.2336333Z help=( 2025-07-17T06:33:20.2337011Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.2338146Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.2338967Z ), 2025-07-17T06:33:20.2339313Z ) 2025-07-17T06:33:20.2339682Z parser.add_argument( 2025-07-17T06:33:20.2340109Z "--pr-number", 2025-07-17T06:33:20.2340516Z type=str, 2025-07-17T06:33:20.2340900Z required=False, 2025-07-17T06:33:20.2341336Z default="", 2025-07-17T06:33:20.2341970Z help="the optional PR number where this is run", 2025-07-17T06:33:20.2342548Z ) 2025-07-17T06:33:20.2342750Z 2025-07-17T06:33:20.2342946Z return parser.parse_args() 2025-07-17T06:33:20.2343260Z 2025-07-17T06:33:20.2343267Z 2025-07-17T06:33:20.2343675Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.2344428Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.2344922Z return Github(auth=auth) 2025-07-17T06:33:20.2345213Z 2025-07-17T06:33:20.2345220Z 2025-07-17T06:33:20.2345666Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.2346785Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.2347299Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.2347662Z 2025-07-17T06:33:20.2347668Z 2025-07-17T06:33:20.2347860Z def get_potential_pr_author( 2025-07-17T06:33:20.2348503Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.2349174Z ) -> str: 2025-07-17T06:33:20.2349683Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.2350471Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.2351195Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.2351608Z 2025-07-17T06:33:20.2351795Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.2352121Z 2025-07-17T06:33:20.2352391Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.2353001Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.2353497Z if ( 2025-07-17T06:33:20.2353877Z len(split_tag) == 3 2025-07-17T06:33:20.2354352Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.2354869Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.2355360Z ): 2025-07-17T06:33:20.2355736Z pr_number = split_tag[2] 2025-07-17T06:33:20.2356548Z try: 2025-07-17T06:33:20.2356973Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.2357570Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.2358162Z except Exception as e: 2025-07-17T06:33:20.2358665Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.2359322Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.2359940Z ) from e 2025-07-17T06:33:20.2360472Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.2361156Z # In all other cases, return the original input username 2025-07-17T06:33:20.2361729Z return username 2025-07-17T06:33:20.2361963Z 2025-07-17T06:33:20.2361969Z 2025-07-17T06:33:20.2362198Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.2362720Z """ 2025-07-17T06:33:20.2363355Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.2364121Z """ 2025-07-17T06:33:20.2364663Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.2365168Z 2025-07-17T06:33:20.2365175Z 2025-07-17T06:33:20.2365367Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.2365846Z try: 2025-07-17T06:33:20.2366335Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.2366835Z return data 2025-07-17T06:33:20.2367243Z except yaml.YAMLError: 2025-07-17T06:33:20.2367708Z log.exception("Error loading YAML") 2025-07-17T06:33:20.2368208Z raise 2025-07-17T06:33:20.2368417Z 2025-07-17T06:33:20.2368424Z 2025-07-17T06:33:20.2368828Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.2369561Z """ 2025-07-17T06:33:20.2370170Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.2370790Z 2025-07-17T06:33:20.2371269Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.2372026Z and the text below is the list of opted in users. 2025-07-17T06:33:20.2372423Z 2025-07-17T06:33:20.2372791Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.2373479Z """ 2025-07-17T06:33:20.2373907Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.2374507Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.2375106Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.2375680Z else: 2025-07-17T06:33:20.2376055Z return "", rollout_state 2025-07-17T06:33:20.2376475Z 2025-07-17T06:33:20.2376483Z 2025-07-17T06:33:20.2376687Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.2377188Z """ 2025-07-17T06:33:20.2377695Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.2378333Z """ 2025-07-17T06:33:20.2378525Z 2025-07-17T06:33:20.2378542Z 2025-07-17T06:33:20.2378885Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.2379522Z """ 2025-07-17T06:33:20.2380224Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.2380890Z 2025-07-17T06:33:20.2381506Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.2382485Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.2383170Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.2383643Z 2025-07-17T06:33:20.2383650Z 2025-07-17T06:33:20.2383806Z """ 2025-07-17T06:33:20.2384172Z optins = UserOptins() 2025-07-17T06:33:20.2384646Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.2385202Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.2385732Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.2386776Z # Not a valid user. Skip 2025-07-17T06:33:20.2387268Z continue 2025-07-17T06:33:20.2387516Z 2025-07-17T06:33:20.2387677Z if user: 2025-07-17T06:33:20.2388119Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.2388816Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.2389299Z 2025-07-17T06:33:20.2389470Z return optins 2025-07-17T06:33:20.2389705Z 2025-07-17T06:33:20.2389712Z 2025-07-17T06:33:20.2389997Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.2390596Z """ 2025-07-17T06:33:20.2390980Z Check if the experiment name is valid. 2025-07-17T06:33:20.2391495Z A valid name: 2025-07-17T06:33:20.2392124Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.2393045Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.2393781Z - Cannot contain spaces 2025-07-17T06:33:20.2394236Z """ 2025-07-17T06:33:20.2394437Z 2025-07-17T06:33:20.2394697Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.2395399Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.2395841Z 2025-07-17T06:33:20.2396001Z if valid: 2025-07-17T06:33:20.2396489Z return True 2025-07-17T06:33:20.2396726Z 2025-07-17T06:33:20.2396887Z log.error( 2025-07-17T06:33:20.2398340Z 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-07-17T06:33:20.2399865Z ) 2025-07-17T06:33:20.2400214Z return False 2025-07-17T06:33:20.2400445Z 2025-07-17T06:33:20.2400451Z 2025-07-17T06:33:20.2400757Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.2401362Z """ 2025-07-17T06:33:20.2402095Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.2402817Z """ 2025-07-17T06:33:20.2403166Z try: 2025-07-17T06:33:20.2403528Z if settings_text: 2025-07-17T06:33:20.2404264Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.2405048Z # for easy reading 2025-07-17T06:33:20.2405821Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.2406809Z # the backtick character in shell commands. 2025-07-17T06:33:20.2407406Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.2408077Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.2408728Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.2409096Z 2025-07-17T06:33:20.2409750Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.2410559Z experiments = {} 2025-07-17T06:33:20.2410859Z 2025-07-17T06:33:20.2411248Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.2412012Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.2413130Z # 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-07-17T06:33:20.2414176Z continue 2025-07-17T06:33:20.2414456Z 2025-07-17T06:33:20.2414640Z valid_settings = {} 2025-07-17T06:33:20.2415152Z for setting in exp_settings: 2025-07-17T06:33:20.2415722Z if setting not in Experiment._fields: 2025-07-17T06:33:20.2416388Z log.warning( 2025-07-17T06:33:20.2417096Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.2417975Z ) 2025-07-17T06:33:20.2418393Z else: 2025-07-17T06:33:20.2418897Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.2419321Z 2025-07-17T06:33:20.2419596Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.2420225Z return Settings(experiments) 2025-07-17T06:33:20.2420570Z 2025-07-17T06:33:20.2420738Z except Exception: 2025-07-17T06:33:20.2421208Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.2421587Z 2025-07-17T06:33:20.2421756Z return Settings() 2025-07-17T06:33:20.2422010Z 2025-07-17T06:33:20.2422016Z 2025-07-17T06:33:20.2422260Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.2422819Z """ 2025-07-17T06:33:20.2423245Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.2423649Z 2025-07-17T06:33:20.2424009Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.2424777Z and the text below is the list of opted in users. 2025-07-17T06:33:20.2425195Z 2025-07-17T06:33:20.2425599Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.2426645Z """ 2025-07-17T06:33:20.2427228Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.2427982Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.2428376Z 2025-07-17T06:33:20.2428383Z 2025-07-17T06:33:20.2428632Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.2429187Z """ 2025-07-17T06:33:20.2429570Z Parse users from the rollout state. 2025-07-17T06:33:20.2429920Z 2025-07-17T06:33:20.2430072Z """ 2025-07-17T06:33:20.2430587Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.2431314Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.2431719Z 2025-07-17T06:33:20.2431736Z 2025-07-17T06:33:20.2432317Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.2433063Z """ 2025-07-17T06:33:20.2433478Z Check if a user is opted into an experiment 2025-07-17T06:33:20.2434005Z """ 2025-07-17T06:33:20.2434447Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.2434864Z 2025-07-17T06:33:20.2434871Z 2025-07-17T06:33:20.2435284Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.2436023Z """ 2025-07-17T06:33:20.2436632Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.2437206Z """ 2025-07-17T06:33:20.2437708Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.2438380Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.2439012Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.2439597Z return False 2025-07-17T06:33:20.2439863Z 2025-07-17T06:33:20.2440138Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.2440727Z log.warning( 2025-07-17T06:33:20.2441519Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.2442390Z ) 2025-07-17T06:33:20.2442591Z 2025-07-17T06:33:20.2442755Z return True 2025-07-17T06:33:20.2442982Z 2025-07-17T06:33:20.2442994Z 2025-07-17T06:33:20.2443168Z def get_runner_prefix( 2025-07-17T06:33:20.2443592Z rollout_state: str, 2025-07-17T06:33:20.2444047Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.2444549Z branch: str, 2025-07-17T06:33:20.2445036Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.2445693Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.2446371Z is_canary: bool = False, 2025-07-17T06:33:20.2446821Z ) -> str: 2025-07-17T06:33:20.2447231Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.2447960Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.2448328Z 2025-07-17T06:33:20.2448501Z fleet_prefix = "" 2025-07-17T06:33:20.2448920Z prefixes = [] 2025-07-17T06:33:20.2449540Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.2450470Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.2451184Z log.info( 2025-07-17T06:33:20.2451854Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.2452602Z ) 2025-07-17T06:33:20.2452975Z continue 2025-07-17T06:33:20.2453225Z 2025-07-17T06:33:20.2453409Z if opt_out_experiments: 2025-07-17T06:33:20.2453930Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.2454569Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.2455153Z log.info( 2025-07-17T06:33:20.2456076Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.2457162Z ) 2025-07-17T06:33:20.2457551Z continue 2025-07-17T06:33:20.2457820Z 2025-07-17T06:33:20.2458001Z if eligible_experiments: 2025-07-17T06:33:20.2458541Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.2459169Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.2459717Z log.info( 2025-07-17T06:33:20.2460482Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.2461309Z ) 2025-07-17T06:33:20.2461691Z continue 2025-07-17T06:33:20.2462163Z elif not experiment_settings.default: 2025-07-17T06:33:20.2462690Z log.info( 2025-07-17T06:33:20.2463467Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.2464205Z ) 2025-07-17T06:33:20.2464577Z continue 2025-07-17T06:33:20.2464586Z 2025-07-17T06:33:20.2464872Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.2465054Z opted_out_users = [ 2025-07-17T06:33:20.2465219Z requestor 2025-07-17T06:33:20.2465427Z for requestor in workflow_requestors 2025-07-17T06:33:20.2465728Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.2465893Z ] 2025-07-17T06:33:20.2465901Z 2025-07-17T06:33:20.2466078Z if opted_out_users: 2025-07-17T06:33:20.2466524Z log.info( 2025-07-17T06:33:20.2466924Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.2467084Z ) 2025-07-17T06:33:20.2467248Z continue 2025-07-17T06:33:20.2467269Z 2025-07-17T06:33:20.2467557Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.2467736Z opted_in_users = [ 2025-07-17T06:33:20.2467900Z requestor 2025-07-17T06:33:20.2468107Z for requestor in workflow_requestors 2025-07-17T06:33:20.2468404Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.2468563Z ] 2025-07-17T06:33:20.2468571Z 2025-07-17T06:33:20.2468739Z enabled = False 2025-07-17T06:33:20.2468916Z if opted_in_users: 2025-07-17T06:33:20.2469079Z log.info( 2025-07-17T06:33:20.2469429Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.2469593Z ) 2025-07-17T06:33:20.2469768Z enabled = True 2025-07-17T06:33:20.2469776Z 2025-07-17T06:33:20.2469988Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.2470441Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.2470942Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.2471114Z log.info( 2025-07-17T06:33:20.2471709Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.2471872Z ) 2025-07-17T06:33:20.2472044Z enabled = True 2025-07-17T06:33:20.2472052Z 2025-07-17T06:33:20.2472211Z if enabled: 2025-07-17T06:33:20.2472399Z label = experiment_name 2025-07-17T06:33:20.2472616Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.2473047Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.2473315Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.2473638Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.2473818Z if is_canary: 2025-07-17T06:33:20.2474019Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.2474203Z fleet_prefix = label 2025-07-17T06:33:20.2474362Z else: 2025-07-17T06:33:20.2474557Z prefixes.append(label) 2025-07-17T06:33:20.2474565Z 2025-07-17T06:33:20.2474745Z if len(prefixes) > 1: 2025-07-17T06:33:20.2474918Z log.error( 2025-07-17T06:33:20.2475744Z 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-07-17T06:33:20.2475902Z ) 2025-07-17T06:33:20.2476211Z prefixes = prefixes[:1] 2025-07-17T06:33:20.2476221Z 2025-07-17T06:33:20.2476411Z # Fleet always comes first 2025-07-17T06:33:20.2476581Z if fleet_prefix: 2025-07-17T06:33:20.2476792Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.2476809Z 2025-07-17T06:33:20.2477280Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.2477303Z 2025-07-17T06:33:20.2477313Z 2025-07-17T06:33:20.2477881Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.2478054Z """ 2025-07-17T06:33:20.2478448Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.2478456Z 2025-07-17T06:33:20.2478838Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.2479003Z """ 2025-07-17T06:33:20.2479194Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.2479397Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.2479675Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.2479683Z 2025-07-17T06:33:20.2479691Z 2025-07-17T06:33:20.2480092Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.2480288Z for _ in range(num_retries): 2025-07-17T06:33:20.2480458Z try: 2025-07-17T06:33:20.2480674Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.2480963Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.2481157Z return json.loads(content) 2025-07-17T06:33:20.2481351Z except Exception as e: 2025-07-17T06:33:20.2481582Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.2481590Z 2025-07-17T06:33:20.2481970Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.2482137Z return {} 2025-07-17T06:33:20.2482144Z 2025-07-17T06:33:20.2482151Z 2025-07-17T06:33:20.2482304Z @cache 2025-07-17T06:33:20.2482727Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.2482892Z """ 2025-07-17T06:33:20.2483085Z Dynamically get PR information 2025-07-17T06:33:20.2483239Z """ 2025-07-17T06:33:20.2483679Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.2483854Z headers = { 2025-07-17T06:33:20.2484081Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.2484298Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.2484458Z } 2025-07-17T06:33:20.2484689Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.2484900Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.2485075Z headers=headers, 2025-07-17T06:33:20.2485239Z ) 2025-07-17T06:33:20.2485248Z 2025-07-17T06:33:20.2485423Z if not json_response: 2025-07-17T06:33:20.2485708Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.2485873Z return {} 2025-07-17T06:33:20.2485882Z 2025-07-17T06:33:20.2486057Z return json_response 2025-07-17T06:33:20.2486065Z 2025-07-17T06:33:20.2486072Z 2025-07-17T06:33:20.2486602Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.2486781Z """ 2025-07-17T06:33:20.2487106Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.2487264Z """ 2025-07-17T06:33:20.2487546Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.2487713Z return { 2025-07-17T06:33:20.2488075Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.2488227Z } 2025-07-17T06:33:20.2488235Z 2025-07-17T06:33:20.2488241Z 2025-07-17T06:33:20.2488415Z def main() -> None: 2025-07-17T06:33:20.2488591Z args = parse_args() 2025-07-17T06:33:20.2488599Z 2025-07-17T06:33:20.2488815Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.2488823Z 2025-07-17T06:33:20.2489014Z # Check if the PR is opt-out 2025-07-17T06:33:20.2489191Z if args.pr_number: 2025-07-17T06:33:20.2489576Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.2489932Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.2490107Z log.info( 2025-07-17T06:33:20.2490550Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.2490707Z ) 2025-07-17T06:33:20.2491039Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.2491203Z sys.exit() 2025-07-17T06:33:20.2491211Z 2025-07-17T06:33:20.2491364Z try: 2025-07-17T06:33:20.2491597Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.2491904Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.2492060Z ) 2025-07-17T06:33:20.2492067Z 2025-07-17T06:33:20.2492276Z username = get_potential_pr_author( 2025-07-17T06:33:20.2492454Z args.github_token, 2025-07-17T06:33:20.2492632Z args.github_repo, 2025-07-17T06:33:20.2492804Z args.github_actor, 2025-07-17T06:33:20.2492997Z args.github_ref_type, 2025-07-17T06:33:20.2493232Z args.github_branch, 2025-07-17T06:33:20.2493408Z ) 2025-07-17T06:33:20.2493417Z 2025-07-17T06:33:20.2493705Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.2493713Z 2025-07-17T06:33:20.2493923Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.2494096Z rollout_state, 2025-07-17T06:33:20.2494308Z (args.github_issue_owner, username), 2025-07-17T06:33:20.2494487Z args.github_branch, 2025-07-17T06:33:20.2494683Z args.eligible_experiments, 2025-07-17T06:33:20.2494871Z args.opt_out_experiments, 2025-07-17T06:33:20.2495050Z is_canary, 2025-07-17T06:33:20.2495209Z ) 2025-07-17T06:33:20.2495217Z 2025-07-17T06:33:20.2495400Z except Exception as e: 2025-07-17T06:33:20.2495567Z log.error( 2025-07-17T06:33:20.2495998Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.2496408Z ) 2025-07-17T06:33:20.2496416Z 2025-07-17T06:33:20.2496754Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.2496763Z 2025-07-17T06:33:20.2496769Z 2025-07-17T06:33:20.2496944Z if __name__ == "__main__": 2025-07-17T06:33:20.2497105Z main() 2025-07-17T06:33:20.2497113Z 2025-07-17T06:33:20.2583805Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.2584693Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.2612671Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.2613131Z env: 2025-07-17T06:33:20.2613733Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.2614143Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.2614569Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.2615055Z ISSUE_OWNER: 2025-07-17T06:33:20.2615448Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.2615870Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:20.2616442Z PR_NUMBER: 2025-07-17T06:33:20.2616827Z ##[endgroup] 2025-07-17T06:33:20.6009668Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:20.8906972Z Collecting urllib3==1.26.18 2025-07-17T06:33:20.9263005Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:20.9452751Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.7 MB/s eta 0:00:00 2025-07-17T06:33:20.9667824Z Collecting PyGithub==2.3.0 2025-07-17T06:33:20.9709252Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.0131328Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.0170833Z 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-07-17T06:33:21.0212208Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.0228275Z 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-07-17T06:33:21.0242768Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.0489049Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.0529346Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.0753477Z 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-07-17T06:33:21.1817829Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.1860416Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.2864667Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.2908673Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:21.3082054Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.3124855Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.3353707Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.3507923Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.9 MB/s eta 0:00:00 2025-07-17T06:33:21.3553510Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.3694442Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 28.0 MB/s eta 0:00:00 2025-07-17T06:33:21.3738662Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:21.3995179Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 35.3 MB/s eta 0:00:00 2025-07-17T06:33:21.4034334Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.4095720Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.4212902Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 46.6 MB/s eta 0:00:00 2025-07-17T06:33:21.4253156Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:21.4291879Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 34.3 MB/s eta 0:00:00 2025-07-17T06:33:21.4332218Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.4373150Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 44.4 MB/s eta 0:00:00 2025-07-17T06:33:21.7229086Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.2600593Z 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.2 2025-07-17T06:33:22.3343479Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.3343810Z curr_branch="main" 2025-07-17T06:33:22.3344062Z curr_ref_type="branch" 2025-07-17T06:33:22.3344329Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.3344587Z  2025-07-17T06:33:22.3344792Z python3 runner_determinator.py \ 2025-07-17T06:33:22.3345078Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.3345360Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.3345619Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.3345882Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.3346408Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.3346703Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.3346987Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.3347308Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.3347677Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.3347978Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.3377283Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.3377529Z env: 2025-07-17T06:33:22.3378094Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.3378291Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.3378501Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.3378733Z ISSUE_OWNER: 2025-07-17T06:33:22.3378931Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.3379126Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:22.3379348Z PR_NUMBER: 2025-07-17T06:33:22.3379513Z ##[endgroup] 2025-07-17T06:33:22.3426723Z Current branch is 'main' 2025-07-17T06:33:24.1259516Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-07-17T06:33:24.1260985Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.1261919Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.1262608Z INFO : Setting output: label-type='' 2025-07-17T06:33:24.1567418Z Evaluate and set job outputs 2025-07-17T06:33:24.1574397Z Cleaning up orphan processes