2025-06-01T20:56:25.5502920Z Current runner version: '2.324.0' 2025-06-01T20:56:25.5535071Z ##[group]Operating System 2025-06-01T20:56:25.5536156Z Ubuntu 2025-06-01T20:56:25.5536905Z 24.04.2 2025-06-01T20:56:25.5537682Z LTS 2025-06-01T20:56:25.5538482Z ##[endgroup] 2025-06-01T20:56:25.5539203Z ##[group]Runner Image 2025-06-01T20:56:25.5540111Z Image: ubuntu-24.04 2025-06-01T20:56:25.5540965Z Version: 20250527.1.0 2025-06-01T20:56:25.5542599Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250527.1/images/ubuntu/Ubuntu2404-Readme.md 2025-06-01T20:56:25.5545265Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250527.1 2025-06-01T20:56:25.5546793Z ##[endgroup] 2025-06-01T20:56:25.5547679Z ##[group]Runner Image Provisioner 2025-06-01T20:56:25.5548591Z 2.0.437.1 2025-06-01T20:56:25.5549312Z ##[endgroup] 2025-06-01T20:56:25.5550906Z ##[group]GITHUB_TOKEN Permissions 2025-06-01T20:56:25.5553277Z Contents: read 2025-06-01T20:56:25.5554302Z Metadata: read 2025-06-01T20:56:25.5555366Z ##[endgroup] 2025-06-01T20:56:25.5558118Z Secret source: Actions 2025-06-01T20:56:25.5559171Z Prepare workflow directory 2025-06-01T20:56:25.6280313Z Prepare all required actions 2025-06-01T20:56:25.6356636Z Complete job name: before-test / get-label-type / runner-determinator 2025-06-01T20:56:26.1344129Z ##[group]Run cat < runner_determinator.py 2025-06-01T20:56:26.1346592Z cat < runner_determinator.py 2025-06-01T20:56:26.1347321Z # flake8: noqa: G004 2025-06-01T20:56:26.1347928Z  2025-06-01T20:56:26.1348798Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-01T20:56:26.1349880Z # must be kept in sync. You can do it easily by running the following command: 2025-06-01T20:56:26.1350866Z # python .github/scripts/update_runner_determinator.py 2025-06-01T20:56:26.1351671Z  2025-06-01T20:56:26.1352122Z """ 2025-06-01T20:56:26.1352866Z This runner determinator is used to determine which set of runners to run a 2025-06-01T20:56:26.1354142Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-01T20:56:26.1355386Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-01T20:56:26.1356412Z of which runners should be used to run which job. 2025-06-01T20:56:26.1357142Z  2025-06-01T20:56:26.1357850Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-01T20:56:26.1358976Z separated by a line containing "---". If the line is not present, the 2025-06-01T20:56:26.1360064Z settings are considered to be empty with only the second part, the user 2025-06-01T20:56:26.1360932Z list, defined. 2025-06-01T20:56:26.1361514Z  2025-06-01T20:56:26.1362214Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-01T20:56:26.1363317Z used to define any settings that are needed to determine which runners to use. 2025-06-01T20:56:26.1364594Z It's fields are defined by the RolloutSettings class below. 2025-06-01T20:56:26.1365352Z  2025-06-01T20:56:26.1366119Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-01T20:56:26.1367146Z The user list is also a comma separated list of additional features or 2025-06-01T20:56:26.1368139Z experiments which the user could be opted in to. 2025-06-01T20:56:26.1368851Z  2025-06-01T20:56:26.1369380Z The user list has the following rules: 2025-06-01T20:56:26.1370107Z  2025-06-01T20:56:26.1370792Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-01T20:56:26.1371806Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-01T20:56:26.1372824Z - A "#" prefix opts the user out of all experiments 2025-06-01T20:56:26.1374064Z  2025-06-01T20:56:26.1374690Z Example config: 2025-06-01T20:56:26.1375459Z  # A list of experiments that can be opted into. 2025-06-01T20:56:26.1376416Z  # This defines the behavior they'll induce when opted into. 2025-06-01T20:56:26.1377260Z  # Expected syntax is: 2025-06-01T20:56:26.1378158Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-01T20:56:26.1379312Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-01T20:56:26.1380195Z  2025-06-01T20:56:26.1380763Z  experiments: 2025-06-01T20:56:26.1381280Z  lf: 2025-06-01T20:56:26.1381814Z  rollout_percent: 25 2025-06-01T20:56:26.1382488Z  all_branches: false 2025-06-01T20:56:26.1383082Z  default: true 2025-06-01T20:56:26.1383656Z  --- 2025-06-01T20:56:26.1384346Z  2025-06-01T20:56:26.1384919Z  # Opt-ins: 2025-06-01T20:56:26.1385662Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-01T20:56:26.1386917Z  # and specifying experiments to enable in a comma-separated list. 2025-06-01T20:56:26.1387928Z  # To always opt out of an experiment, prefix it with a "-". 2025-06-01T20:56:26.1388731Z  # Experiments should be from the above list. 2025-06-01T20:56:26.1389486Z  2025-06-01T20:56:26.1389973Z  @User1,-lf,split_build 2025-06-01T20:56:26.1390631Z  @User2,lf 2025-06-01T20:56:26.1391231Z  @User3,split_build 2025-06-01T20:56:26.1391794Z """ 2025-06-01T20:56:26.1392276Z  2025-06-01T20:56:26.1392734Z import json 2025-06-01T20:56:26.1393338Z import logging 2025-06-01T20:56:26.1393970Z import os 2025-06-01T20:56:26.1394476Z import random 2025-06-01T20:56:26.1467678Z import re 2025-06-01T20:56:26.1468536Z import sys 2025-06-01T20:56:26.1469549Z from argparse import ArgumentParser 2025-06-01T20:56:26.1470726Z from collections.abc import Iterable 2025-06-01T20:56:26.1471943Z from functools import cache 2025-06-01T20:56:26.1472644Z from logging import LogRecord 2025-06-01T20:56:26.1473244Z from typing import Any, NamedTuple 2025-06-01T20:56:26.1474129Z from urllib.request import Request, urlopen 2025-06-01T20:56:26.1474745Z  2025-06-01T20:56:26.1475139Z import yaml 2025-06-01T20:56:26.1475611Z from github import Auth, Github 2025-06-01T20:56:26.1476203Z from github.Issue import Issue 2025-06-01T20:56:26.1476734Z  2025-06-01T20:56:26.1477101Z  2025-06-01T20:56:26.1477569Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-01T20:56:26.1478361Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-01T20:56:26.1479364Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-01T20:56:26.1480130Z  2025-06-01T20:56:26.1480616Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-01T20:56:26.1481264Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-01T20:56:26.1481868Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-01T20:56:26.1482523Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-01T20:56:26.1483102Z  2025-06-01T20:56:26.1483538Z SETTING_EXPERIMENTS = "experiments" 2025-06-01T20:56:26.1484318Z  2025-06-01T20:56:26.1484768Z LF_FLEET_EXPERIMENT = "lf" 2025-06-01T20:56:26.1485329Z CANARY_FLEET_SUFFIX = ".c" 2025-06-01T20:56:26.1485832Z  2025-06-01T20:56:26.1486197Z  2025-06-01T20:56:26.1486604Z class Experiment(NamedTuple): 2025-06-01T20:56:26.1487162Z  rollout_perc: float = ( 2025-06-01T20:56:26.1488150Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-01T20:56:26.1488898Z  ) 2025-06-01T20:56:26.1489330Z  all_branches: bool = ( 2025-06-01T20:56:26.1490079Z  False # If True, the experiment is also enabled on the exception branches 2025-06-01T20:56:26.1490865Z  ) 2025-06-01T20:56:26.1491286Z  default: bool = ( 2025-06-01T20:56:26.1491973Z  True # If True, the experiment is enabled by default for all queries 2025-06-01T20:56:26.1492685Z  ) 2025-06-01T20:56:26.1493089Z  2025-06-01T20:56:26.1493503Z  # Add more fields as needed 2025-06-01T20:56:26.1494224Z  2025-06-01T20:56:26.1494594Z  2025-06-01T20:56:26.1495002Z class Settings(NamedTuple): 2025-06-01T20:56:26.1495527Z  """ 2025-06-01T20:56:26.1496065Z  Settings for the experiments that can be opted into. 2025-06-01T20:56:26.1496726Z  """ 2025-06-01T20:56:26.1497134Z  2025-06-01T20:56:26.1497579Z  experiments: dict[str, Experiment] = {} 2025-06-01T20:56:26.1498138Z  2025-06-01T20:56:26.1498648Z  2025-06-01T20:56:26.1499116Z class ColorFormatter(logging.Formatter): 2025-06-01T20:56:26.1499833Z  """Color codes the log messages based on the log level""" 2025-06-01T20:56:26.1500480Z  2025-06-01T20:56:26.1500872Z  COLORS = { 2025-06-01T20:56:26.1501363Z  "WARNING": "\033[33m", # Yellow 2025-06-01T20:56:26.1501938Z  "ERROR": "\033[31m", # Red 2025-06-01T20:56:26.1502511Z  "CRITICAL": "\033[31m", # Red 2025-06-01T20:56:26.1503081Z  "INFO": "\033[0m", # Reset 2025-06-01T20:56:26.1503652Z  "DEBUG": "\033[0m", # Reset 2025-06-01T20:56:26.1504364Z  } 2025-06-01T20:56:26.1504767Z  2025-06-01T20:56:26.1505245Z  def format(self, record: LogRecord) -> str: 2025-06-01T20:56:26.1506089Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-01T20:56:26.1506952Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-01T20:56:26.1507603Z  return super().format(record) 2025-06-01T20:56:26.1508159Z  2025-06-01T20:56:26.1508529Z  2025-06-01T20:56:26.1508952Z handler = logging.StreamHandler() 2025-06-01T20:56:26.1509767Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-01T20:56:26.1510551Z  2025-06-01T20:56:26.1511054Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-01T20:56:26.1511708Z log.addHandler(handler) 2025-06-01T20:56:26.1512238Z log.setLevel(logging.INFO) 2025-06-01T20:56:26.1512743Z  2025-06-01T20:56:26.1513114Z  2025-06-01T20:56:26.1513614Z def set_github_output(key: str, value: str) -> None: 2025-06-01T20:56:26.1514425Z  """ 2025-06-01T20:56:26.1515014Z  Defines outputs of the github action that invokes this script 2025-06-01T20:56:26.1515702Z  """ 2025-06-01T20:56:26.1516131Z  if not GITHUB_OUTPUT: 2025-06-01T20:56:26.1517308Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-01T20:56:26.1518525Z  log.warning( 2025-06-01T20:56:26.1519500Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-01T20:56:26.1520514Z  ) 2025-06-01T20:56:26.1521021Z  print(f"::set-output name={key}::{value}") 2025-06-01T20:56:26.1521613Z  return 2025-06-01T20:56:26.1522057Z  2025-06-01T20:56:26.1522618Z  with open(GITHUB_OUTPUT, "a") as f: 2025-06-01T20:56:26.1523276Z  log.info(f"Setting output: {key}='{value}'") 2025-06-01T20:56:26.1524146Z  f.write(f"{key}={value}\n") 2025-06-01T20:56:26.1524685Z  2025-06-01T20:56:26.1525074Z  2025-06-01T20:56:26.1525632Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-01T20:56:26.1526356Z  return frozenset( 2025-06-01T20:56:26.1527061Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-01T20:56:26.1527810Z  ) 2025-06-01T20:56:26.1528207Z  2025-06-01T20:56:26.1528586Z  2025-06-01T20:56:26.1528991Z def parse_args() -> Any: 2025-06-01T20:56:26.1529668Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-06-01T20:56:26.1530650Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-01T20:56:26.1531517Z  parser.add_argument( 2025-06-01T20:56:26.1532064Z  "--github-issue-repo", 2025-06-01T20:56:26.1532614Z  type=str, 2025-06-01T20:56:26.1533118Z  required=False, 2025-06-01T20:56:26.1534356Z  default="pytorch/test-infra", 2025-06-01T20:56:26.1535102Z  help="GitHub repo to get the issue", 2025-06-01T20:56:26.1535684Z  ) 2025-06-01T20:56:26.1536113Z  parser.add_argument( 2025-06-01T20:56:26.1536639Z  "--github-repo", 2025-06-01T20:56:26.1537155Z  type=str, 2025-06-01T20:56:26.1537633Z  required=True, 2025-06-01T20:56:26.1538193Z  help="GitHub repo where CI is running", 2025-06-01T20:56:26.1538782Z  ) 2025-06-01T20:56:26.1539215Z  parser.add_argument( 2025-06-01T20:56:26.1539935Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-01T20:56:26.1540688Z  ) 2025-06-01T20:56:26.1541110Z  parser.add_argument( 2025-06-01T20:56:26.1541846Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-01T20:56:26.1542597Z  ) 2025-06-01T20:56:26.1543037Z  parser.add_argument( 2025-06-01T20:56:26.1543967Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-01T20:56:26.1544749Z  ) 2025-06-01T20:56:26.1545192Z  parser.add_argument( 2025-06-01T20:56:26.1545964Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-01T20:56:26.1546750Z  ) 2025-06-01T20:56:26.1547199Z  parser.add_argument( 2025-06-01T20:56:26.1547735Z  "--github-ref-type", 2025-06-01T20:56:26.1548271Z  type=str, 2025-06-01T20:56:26.1548758Z  required=True, 2025-06-01T20:56:26.1549352Z  help="Current GitHub ref type, branch or tag", 2025-06-01T20:56:26.1549960Z  ) 2025-06-01T20:56:26.1550388Z  parser.add_argument( 2025-06-01T20:56:26.1550944Z  "--eligible-experiments", 2025-06-01T20:56:26.1551545Z  type=_str_comma_separated_to_set, 2025-06-01T20:56:26.1552121Z  required=False, 2025-06-01T20:56:26.1552638Z  default="", 2025-06-01T20:56:26.1553614Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-01T20:56:26.1554810Z  ) 2025-06-01T20:56:26.1555235Z  parser.add_argument( 2025-06-01T20:56:26.1555779Z  "--opt-out-experiments", 2025-06-01T20:56:26.1556376Z  type=_str_comma_separated_to_set, 2025-06-01T20:56:26.1556964Z  required=False, 2025-06-01T20:56:26.1557474Z  default="", 2025-06-01T20:56:26.1558089Z  help=( 2025-06-01T20:56:26.1558859Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-01T20:56:26.1560113Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-01T20:56:26.1561032Z  ), 2025-06-01T20:56:26.1561461Z  ) 2025-06-01T20:56:26.1561882Z  parser.add_argument( 2025-06-01T20:56:26.1562406Z  "--pr-number", 2025-06-01T20:56:26.1562908Z  type=str, 2025-06-01T20:56:26.1563390Z  required=False, 2025-06-01T20:56:26.1564122Z  default="", 2025-06-01T20:56:26.1564697Z  help="the optional PR number where this is run", 2025-06-01T20:56:26.1565314Z  ) 2025-06-01T20:56:26.1565710Z  2025-06-01T20:56:26.1566132Z  return parser.parse_args() 2025-06-01T20:56:26.1566665Z  2025-06-01T20:56:26.1567040Z  2025-06-01T20:56:26.1567705Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-01T20:56:26.1568678Z  auth = Auth.Token(github_token) 2025-06-01T20:56:26.1569298Z  return Github(auth=auth) 2025-06-01T20:56:26.1569821Z  2025-06-01T20:56:26.1570199Z  2025-06-01T20:56:26.1570922Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-01T20:56:26.1571815Z  repo = gh.get_repo(repo) 2025-06-01T20:56:26.1572413Z  return repo.get_issue(number=issue_num) 2025-06-01T20:56:26.1573006Z  2025-06-01T20:56:26.1573386Z  2025-06-01T20:56:26.1574302Z def get_potential_pr_author( 2025-06-01T20:56:26.1575086Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-01T20:56:26.1575843Z ) -> str: 2025-06-01T20:56:26.1576468Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-01T20:56:26.1577382Z  # Fetch the actual username from the original PR. The PR number is 2025-06-01T20:56:26.1578239Z  # embedded in the tag name: ciflow// 2025-06-01T20:56:26.1578876Z  2025-06-01T20:56:26.1579313Z  gh = get_gh_client(github_token) 2025-06-01T20:56:26.1579866Z  2025-06-01T20:56:26.1580392Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-01T20:56:26.1581094Z  split_tag = ref_name.split("/") 2025-06-01T20:56:26.1581663Z  if ( 2025-06-01T20:56:26.1582124Z  len(split_tag) == 3 2025-06-01T20:56:26.1582692Z  and split_tag[0] == "ciflow" 2025-06-01T20:56:26.1583288Z  and split_tag[2].isnumeric() 2025-06-01T20:56:26.1583959Z  ): 2025-06-01T20:56:26.1584472Z  pr_number = split_tag[2] 2025-06-01T20:56:26.1585038Z  try: 2025-06-01T20:56:26.1585564Z  repository = gh.get_repo(repo) 2025-06-01T20:56:26.1586277Z  pull = repository.get_pull(number=int(pr_number)) 2025-06-01T20:56:26.1586981Z  except Exception as e: 2025-06-01T20:56:26.1587594Z  raise Exception( # noqa: TRY002 2025-06-01T20:56:26.1588370Z  f"issue with pull request {pr_number} from repo {repository}" 2025-06-01T20:56:26.1589095Z  ) from e 2025-06-01T20:56:26.1589746Z  return pull.user.login # type: ignore[no-any-return] 2025-06-01T20:56:26.1590556Z  # In all other cases, return the original input username 2025-06-01T20:56:26.1591236Z  return username 2025-06-01T20:56:26.1591719Z  2025-06-01T20:56:26.1592100Z  2025-06-01T20:56:26.1592730Z def is_exception_branch(branch: str) -> bool: 2025-06-01T20:56:26.1593339Z  """ 2025-06-01T20:56:26.1594199Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-01T20:56:26.1595250Z  """ 2025-06-01T20:56:26.1595902Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-01T20:56:26.1596643Z  2025-06-01T20:56:26.1597031Z  2025-06-01T20:56:26.1597464Z def load_yaml(yaml_text: str) -> Any: 2025-06-01T20:56:26.1598035Z  try: 2025-06-01T20:56:26.1598490Z  data = yaml.safe_load(yaml_text) 2025-06-01T20:56:26.1599077Z  return data 2025-06-01T20:56:26.1599580Z  except yaml.YAMLError: 2025-06-01T20:56:26.1600168Z  log.exception("Error loading YAML") 2025-06-01T20:56:26.1600752Z  raise 2025-06-01T20:56:26.1601194Z  2025-06-01T20:56:26.1601588Z  2025-06-01T20:56:26.1602271Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-01T20:56:26.1603094Z  """ 2025-06-01T20:56:26.1604110Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-01T20:56:26.1605011Z  2025-06-01T20:56:26.1605659Z  If the issue body contains "---" then the text above that is the settings 2025-06-01T20:56:26.1606527Z  and the text below is the list of opted in users. 2025-06-01T20:56:26.1607152Z  2025-06-01T20:56:26.1607791Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-01T20:56:26.1608573Z  """ 2025-06-01T20:56:26.1609099Z  rollout_state_parts = rollout_state.split("---") 2025-06-01T20:56:26.1609772Z  if len(rollout_state_parts) >= 2: 2025-06-01T20:56:26.1610475Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-06-01T20:56:26.1611235Z  else: 2025-06-01T20:56:26.1611941Z  return "", rollout_state 2025-06-01T20:56:26.1612472Z  2025-06-01T20:56:26.1612850Z  2025-06-01T20:56:26.1613299Z class UserOptins(dict[str, list[str]]): 2025-06-01T20:56:26.1613990Z  """ 2025-06-01T20:56:26.1614590Z  Dictionary of users with a list of features they have opted into 2025-06-01T20:56:26.1615317Z  """ 2025-06-01T20:56:26.1615722Z  2025-06-01T20:56:26.1616096Z  2025-06-01T20:56:26.1616688Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-01T20:56:26.1617425Z  """ 2025-06-01T20:56:26.1618242Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-01T20:56:26.1619159Z  2025-06-01T20:56:26.1620045Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-01T20:56:26.1621151Z  - Example line: "@User1,lf,split_build" 2025-06-01T20:56:26.1621924Z  - A "#" prefix indicates the user is opted out of all experiments 2025-06-01T20:56:26.1622622Z  2025-06-01T20:56:26.1622992Z  2025-06-01T20:56:26.1623370Z  """ 2025-06-01T20:56:26.1623888Z  optins = UserOptins() 2025-06-01T20:56:26.1624488Z  for user in user_optin_text.split("\n"): 2025-06-01T20:56:26.1625118Z  user = user.strip("\r\n\t -") 2025-06-01T20:56:26.1625741Z  if not user or not user.startswith("@"): 2025-06-01T20:56:26.1626361Z  # Not a valid user. Skip 2025-06-01T20:56:26.1626908Z  continue 2025-06-01T20:56:26.1627381Z  2025-06-01T20:56:26.1627767Z  if user: 2025-06-01T20:56:26.1628468Z  usr_name = user.split(",")[0].strip("@") 2025-06-01T20:56:26.1629239Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-01T20:56:26.1629947Z  2025-06-01T20:56:26.1630341Z  return optins 2025-06-01T20:56:26.1630808Z  2025-06-01T20:56:26.1631183Z  2025-06-01T20:56:26.1631726Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-01T20:56:26.1632408Z  """ 2025-06-01T20:56:26.1632879Z  Check if the experiment name is valid. 2025-06-01T20:56:26.1633460Z  A valid name: 2025-06-01T20:56:26.1634314Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-01T20:56:26.1635360Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-01T20:56:26.1636146Z  - Cannot contain spaces 2025-06-01T20:56:26.1636670Z  """ 2025-06-01T20:56:26.1637072Z  2025-06-01T20:56:26.1637583Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-01T20:56:26.1638381Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-01T20:56:26.1639158Z  2025-06-01T20:56:26.1639543Z  if valid: 2025-06-01T20:56:26.1639995Z  return True 2025-06-01T20:56:26.1640455Z  2025-06-01T20:56:26.1640834Z  log.error( 2025-06-01T20:56:26.1642420Z  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-06-01T20:56:26.1644264Z  ) 2025-06-01T20:56:26.1644692Z  return False 2025-06-01T20:56:26.1645150Z  2025-06-01T20:56:26.1645519Z  2025-06-01T20:56:26.1646093Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-01T20:56:26.1646812Z  """ 2025-06-01T20:56:26.1647486Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-01T20:56:26.1648294Z  """ 2025-06-01T20:56:26.1648704Z  try: 2025-06-01T20:56:26.1649135Z  if settings_text: 2025-06-01T20:56:26.1649971Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-01T20:56:26.1650847Z  # for easy reading 2025-06-01T20:56:26.1651752Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-01T20:56:26.1652733Z  # the backtick character in shell commands. 2025-06-01T20:56:26.1653424Z  backtick = chr(96) # backtick character 2025-06-01T20:56:26.1654310Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-01T20:56:26.1655056Z  settings = load_yaml(settings_text) 2025-06-01T20:56:26.1655631Z  2025-06-01T20:56:26.1656289Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-06-01T20:56:26.1657103Z  experiments = {} 2025-06-01T20:56:26.1657612Z  2025-06-01T20:56:26.1658233Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-01T20:56:26.1659084Z  if not is_valid_experiment_name(exp_name): 2025-06-01T20:56:26.1660299Z  # 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-06-01T20:56:26.1661444Z  continue 2025-06-01T20:56:26.1661945Z  2025-06-01T20:56:26.1662365Z  valid_settings = {} 2025-06-01T20:56:26.1663108Z  for setting in exp_settings: 2025-06-01T20:56:26.1663856Z  if setting not in Experiment._fields: 2025-06-01T20:56:26.1664523Z  log.warning( 2025-06-01T20:56:26.1665329Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-01T20:56:26.1666122Z  ) 2025-06-01T20:56:26.1666631Z  else: 2025-06-01T20:56:26.1667249Z  valid_settings[setting] = exp_settings[setting] 2025-06-01T20:56:26.1667887Z  2025-06-01T20:56:26.1668403Z  experiments[exp_name] = Experiment(**valid_settings) 2025-06-01T20:56:26.1669117Z  return Settings(experiments) 2025-06-01T20:56:26.1669674Z  2025-06-01T20:56:26.1670069Z  except Exception: 2025-06-01T20:56:26.1670644Z  log.exception("Failed to parse settings") 2025-06-01T20:56:26.1671255Z  2025-06-01T20:56:26.1671648Z  return Settings() 2025-06-01T20:56:26.1672133Z  2025-06-01T20:56:26.1672506Z  2025-06-01T20:56:26.1673131Z def parse_settings(rollout_state: str) -> Settings: 2025-06-01T20:56:26.1673882Z  """ 2025-06-01T20:56:26.1674391Z  Parse settings, if any, from the rollout state. 2025-06-01T20:56:26.1675000Z  2025-06-01T20:56:26.1675593Z  If the issue body contains "---" then the text above that is the settings 2025-06-01T20:56:26.1676443Z  and the text below is the list of opted in users. 2025-06-01T20:56:26.1677060Z  2025-06-01T20:56:26.1677712Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-01T20:56:26.1678514Z  """ 2025-06-01T20:56:26.1679151Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T20:56:26.1680007Z  return parse_settings_from_text(settings_text) 2025-06-01T20:56:26.1680609Z  2025-06-01T20:56:26.1680973Z  2025-06-01T20:56:26.1681475Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-01T20:56:26.1682101Z  """ 2025-06-01T20:56:26.1682561Z  Parse users from the rollout state. 2025-06-01T20:56:26.1683125Z  2025-06-01T20:56:26.1683507Z  """ 2025-06-01T20:56:26.1684220Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T20:56:26.1685092Z  return parse_user_opt_in_from_text(users_text) 2025-06-01T20:56:26.1685704Z  2025-06-01T20:56:26.1686073Z  2025-06-01T20:56:26.1686753Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T20:56:26.1687573Z  """ 2025-06-01T20:56:26.1688063Z  Check if a user is opted into an experiment 2025-06-01T20:56:26.1688659Z  """ 2025-06-01T20:56:26.1689198Z  return experiment_name in user_optins.get(user, []) 2025-06-01T20:56:26.1689829Z  2025-06-01T20:56:26.1690207Z  2025-06-01T20:56:26.1690904Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T20:56:26.1691741Z  """ 2025-06-01T20:56:26.1692288Z  Check if a user explicitly opted out of an experiment 2025-06-01T20:56:26.1692923Z  """ 2025-06-01T20:56:26.1693509Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-01T20:56:26.1694383Z  experiment_optout = "-" + experiment_name 2025-06-01T20:56:26.1695115Z  if experiment_optout not in user_optins.get(user, []): 2025-06-01T20:56:26.1695790Z  return False 2025-06-01T20:56:26.1696253Z  2025-06-01T20:56:26.1696762Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-06-01T20:56:26.1697587Z  log.warning( 2025-06-01T20:56:26.1698510Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-01T20:56:26.1699458Z  ) 2025-06-01T20:56:26.1699875Z  2025-06-01T20:56:26.1700263Z  return True 2025-06-01T20:56:26.1700709Z  2025-06-01T20:56:26.1701086Z  2025-06-01T20:56:26.1701478Z def get_runner_prefix( 2025-06-01T20:56:26.1701995Z  rollout_state: str, 2025-06-01T20:56:26.1702537Z  workflow_requestors: Iterable[str], 2025-06-01T20:56:26.1703117Z  branch: str, 2025-06-01T20:56:26.1703796Z  eligible_experiments: frozenset[str] = frozenset(), 2025-06-01T20:56:26.1704562Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-06-01T20:56:26.1705217Z  is_canary: bool = False, 2025-06-01T20:56:26.1705739Z ) -> str: 2025-06-01T20:56:26.1706231Z  settings = parse_settings(rollout_state) 2025-06-01T20:56:26.1706890Z  user_optins = parse_users(rollout_state) 2025-06-01T20:56:26.1707465Z  2025-06-01T20:56:26.1707973Z  fleet_prefix = "" 2025-06-01T20:56:26.1708483Z  prefixes = [] 2025-06-01T20:56:26.1709217Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-01T20:56:26.1710254Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-01T20:56:26.1711047Z  log.info( 2025-06-01T20:56:26.1711834Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-01T20:56:26.1712659Z  ) 2025-06-01T20:56:26.1713100Z  continue 2025-06-01T20:56:26.1713574Z  2025-06-01T20:56:26.1714131Z  if opt_out_experiments: 2025-06-01T20:56:26.1714771Z  if experiment_name in opt_out_experiments: 2025-06-01T20:56:26.1715497Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-01T20:56:26.1716147Z  log.info( 2025-06-01T20:56:26.1717181Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-01T20:56:26.1718237Z  ) 2025-06-01T20:56:26.1718716Z  continue 2025-06-01T20:56:26.1719208Z  2025-06-01T20:56:26.1719613Z  if eligible_experiments: 2025-06-01T20:56:26.1720267Z  if experiment_name not in eligible_experiments: 2025-06-01T20:56:26.1720985Z  exp_list = ", ".join(eligible_experiments) 2025-06-01T20:56:26.1721598Z  log.info( 2025-06-01T20:56:26.1722489Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-01T20:56:26.1723407Z  ) 2025-06-01T20:56:26.1723983Z  continue 2025-06-01T20:56:26.1724561Z  elif not experiment_settings.default: 2025-06-01T20:56:26.1725164Z  log.info( 2025-06-01T20:56:26.1725933Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-01T20:56:26.1726732Z  ) 2025-06-01T20:56:26.1727174Z  continue 2025-06-01T20:56:26.1727649Z  2025-06-01T20:56:26.1728168Z  # Is any workflow_requestor opted out to this experiment? 2025-06-01T20:56:26.1728849Z  opted_out_users = [ 2025-06-01T20:56:26.1729417Z  requestor 2025-06-01T20:56:26.1729966Z  for requestor in workflow_requestors 2025-06-01T20:56:26.1730845Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-01T20:56:26.1731537Z  ] 2025-06-01T20:56:26.1731947Z  2025-06-01T20:56:26.1732347Z  if opted_out_users: 2025-06-01T20:56:26.1732892Z  log.info( 2025-06-01T20:56:26.1733626Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-01T20:56:26.1734492Z  ) 2025-06-01T20:56:26.1734942Z  continue 2025-06-01T20:56:26.1735413Z  2025-06-01T20:56:26.1735927Z  # Is any workflow_requestor opted in to this experiment? 2025-06-01T20:56:26.1736598Z  opted_in_users = [ 2025-06-01T20:56:26.1737116Z  requestor 2025-06-01T20:56:26.1737672Z  for requestor in workflow_requestors 2025-06-01T20:56:26.1738417Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-01T20:56:26.1739105Z  ] 2025-06-01T20:56:26.1739515Z  2025-06-01T20:56:26.1739912Z  enabled = False 2025-06-01T20:56:26.1740426Z  if opted_in_users: 2025-06-01T20:56:26.1741068Z  log.info( 2025-06-01T20:56:26.1741797Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-01T20:56:26.1742545Z  ) 2025-06-01T20:56:26.1743004Z  enabled = True 2025-06-01T20:56:26.1743503Z  2025-06-01T20:56:26.1744194Z  elif experiment_settings.rollout_perc: 2025-06-01T20:56:26.1745112Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-01T20:56:26.1746148Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-01T20:56:26.1746876Z  log.info( 2025-06-01T20:56:26.1747852Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-01T20:56:26.1748860Z  ) 2025-06-01T20:56:26.1749339Z  enabled = True 2025-06-01T20:56:26.1749856Z  2025-06-01T20:56:26.1750243Z  if enabled: 2025-06-01T20:56:26.1750750Z  label = experiment_name 2025-06-01T20:56:26.1751383Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-01T20:56:26.1752284Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-01T20:56:26.1753239Z  # - If it's enabled, then we always list it's prefix first 2025-06-01T20:56:26.1754183Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-01T20:56:26.1754907Z  if is_canary: 2025-06-01T20:56:26.1755481Z  label += CANARY_FLEET_SUFFIX 2025-06-01T20:56:26.1756084Z  fleet_prefix = label 2025-06-01T20:56:26.1756638Z  else: 2025-06-01T20:56:26.1757143Z  prefixes.append(label) 2025-06-01T20:56:26.1757699Z  2025-06-01T20:56:26.1758092Z  if len(prefixes) > 1: 2025-06-01T20:56:26.1758607Z  log.error( 2025-06-01T20:56:26.1759767Z  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-06-01T20:56:26.1760971Z  ) 2025-06-01T20:56:26.1761732Z  prefixes = prefixes[:1] 2025-06-01T20:56:26.1762272Z  2025-06-01T20:56:26.1762674Z  # Fleet always comes first 2025-06-01T20:56:26.1763215Z  if fleet_prefix: 2025-06-01T20:56:26.1763852Z  prefixes.insert(0, fleet_prefix) 2025-06-01T20:56:26.1764593Z  2025-06-01T20:56:26.1765090Z  return ".".join(prefixes) + "." if prefixes else "" 2025-06-01T20:56:26.1765711Z  2025-06-01T20:56:26.1766078Z  2025-06-01T20:56:26.1766776Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-01T20:56:26.1767605Z  """ 2025-06-01T20:56:26.1768260Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-06-01T20:56:26.1769029Z  2025-06-01T20:56:26.1769888Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-01T20:56:26.1770696Z  """ 2025-06-01T20:56:26.1771147Z  gh = get_gh_client(github_token) 2025-06-01T20:56:26.1771771Z  issue = get_issue(gh, repo, issue_num) 2025-06-01T20:56:26.1772746Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-01T20:56:26.1773496Z  2025-06-01T20:56:26.1774133Z  2025-06-01T20:56:26.1774780Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-01T20:56:26.1775755Z  for _ in range(num_retries): 2025-06-01T20:56:26.1776304Z  try: 2025-06-01T20:56:26.1776807Z  req = Request(url=url, headers=headers) 2025-06-01T20:56:26.1777532Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-01T20:56:26.1778246Z  return json.loads(content) 2025-06-01T20:56:26.1778836Z  except Exception as e: 2025-06-01T20:56:26.1779457Z  log.warning(f"Could not download {url}: {e}") 2025-06-01T20:56:26.1780060Z  2025-06-01T20:56:26.1780679Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-01T20:56:26.1781459Z  return {} 2025-06-01T20:56:26.1781894Z  2025-06-01T20:56:26.1782262Z  2025-06-01T20:56:26.1782632Z @cache 2025-06-01T20:56:26.1783337Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-01T20:56:26.1784308Z  """ 2025-06-01T20:56:26.1784789Z  Dynamically get PR information 2025-06-01T20:56:26.1785339Z  """ 2025-06-01T20:56:26.1785905Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-01T20:56:26.1786590Z  headers = { 2025-06-01T20:56:26.1787141Z  "Accept": "application/vnd.github.v3+json", 2025-06-01T20:56:26.1787811Z  "Authorization": f"token {github_token}", 2025-06-01T20:56:26.1788444Z  } 2025-06-01T20:56:26.1788932Z  json_response: dict[str, Any] = download_json( 2025-06-01T20:56:26.1789603Z  url=f"{github_api}/issues/{pr_number}", 2025-06-01T20:56:26.1790193Z  headers=headers, 2025-06-01T20:56:26.1790693Z  ) 2025-06-01T20:56:26.1791077Z  2025-06-01T20:56:26.1791481Z  if not json_response: 2025-06-01T20:56:26.1792134Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-01T20:56:26.1792825Z  return {} 2025-06-01T20:56:26.1793283Z  2025-06-01T20:56:26.1793768Z  return json_response 2025-06-01T20:56:26.1794261Z  2025-06-01T20:56:26.1794622Z  2025-06-01T20:56:26.1795259Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-01T20:56:26.1796042Z  """ 2025-06-01T20:56:26.1796641Z  Dynamically get the latest list of labels from the pull request 2025-06-01T20:56:26.1797346Z  """ 2025-06-01T20:56:26.1797899Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-01T20:56:26.1798571Z  return { 2025-06-01T20:56:26.1799366Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-01T20:56:26.1800112Z  } 2025-06-01T20:56:26.1800505Z  2025-06-01T20:56:26.1800883Z  2025-06-01T20:56:26.1801272Z def main() -> None: 2025-06-01T20:56:26.1801773Z  args = parse_args() 2025-06-01T20:56:26.1802265Z  2025-06-01T20:56:26.1802727Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-01T20:56:26.1803314Z  2025-06-01T20:56:26.1803919Z  # Check if the PR is opt-out 2025-06-01T20:56:26.1804491Z  if args.pr_number: 2025-06-01T20:56:26.1805252Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-01T20:56:26.1806116Z  if OPT_OUT_LABEL in labels: 2025-06-01T20:56:26.1806672Z  log.info( 2025-06-01T20:56:26.1807457Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-01T20:56:26.1808291Z  ) 2025-06-01T20:56:26.1808935Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T20:56:26.1809679Z  sys.exit() 2025-06-01T20:56:26.1810282Z  2025-06-01T20:56:26.1810673Z  try: 2025-06-01T20:56:26.1811177Z  rollout_state = get_rollout_state_from_issue( 2025-06-01T20:56:26.1811963Z  args.github_token, args.github_issue_repo, args.github_issue 2025-06-01T20:56:26.1812665Z  ) 2025-06-01T20:56:26.1813076Z  2025-06-01T20:56:26.1813522Z  username = get_potential_pr_author( 2025-06-01T20:56:26.1814227Z  args.github_token, 2025-06-01T20:56:26.1814783Z  args.github_repo, 2025-06-01T20:56:26.1815334Z  args.github_actor, 2025-06-01T20:56:26.1815902Z  args.github_ref_type, 2025-06-01T20:56:26.1816475Z  args.github_branch, 2025-06-01T20:56:26.1816998Z  ) 2025-06-01T20:56:26.1817411Z  2025-06-01T20:56:26.1817944Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-01T20:56:26.1818608Z  2025-06-01T20:56:26.1819054Z  runner_label_prefix = get_runner_prefix( 2025-06-01T20:56:26.1819664Z  rollout_state, 2025-06-01T20:56:26.1820235Z  (args.github_issue_owner, username), 2025-06-01T20:56:26.1820840Z  args.github_branch, 2025-06-01T20:56:26.1821420Z  args.eligible_experiments, 2025-06-01T20:56:26.1822019Z  args.opt_out_experiments, 2025-06-01T20:56:26.1822584Z  is_canary, 2025-06-01T20:56:26.1823073Z  ) 2025-06-01T20:56:26.1823493Z  2025-06-01T20:56:26.1823995Z  except Exception as e: 2025-06-01T20:56:26.1824527Z  log.error( 2025-06-01T20:56:26.1825290Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-01T20:56:26.1826122Z  ) 2025-06-01T20:56:26.1826551Z  2025-06-01T20:56:26.1827125Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T20:56:26.1827838Z  2025-06-01T20:56:26.1828221Z  2025-06-01T20:56:26.1828620Z if __name__ == "__main__": 2025-06-01T20:56:26.1829120Z  main() 2025-06-01T20:56:26.1829538Z  2025-06-01T20:56:26.1829899Z EOF 2025-06-01T20:56:26.1830285Z  2025-06-01T20:56:26.1830697Z cat runner_determinator.py 2025-06-01T20:56:26.2201661Z shell: /usr/bin/bash -e {0} 2025-06-01T20:56:26.2202483Z env: 2025-06-01T20:56:26.2203221Z GITHUB_TOKEN: *** 2025-06-01T20:56:26.2203819Z ISSUE_NUMBER: 5132 2025-06-01T20:56:26.2204293Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T20:56:26.2205023Z ISSUE_OWNER: 2025-06-01T20:56:26.2205438Z CHECK_EXPERIMENTS: 2025-06-01T20:56:26.2205875Z OPT_OUT_EXPERIMENTS: 2025-06-01T20:56:26.2206331Z PR_NUMBER: 2025-06-01T20:56:26.2206722Z ##[endgroup] 2025-06-01T20:56:26.2424142Z # flake8: noqa: G004 2025-06-01T20:56:26.2424497Z 2025-06-01T20:56:26.2424936Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-01T20:56:26.2425909Z # must be kept in sync. You can do it easily by running the following command: 2025-06-01T20:56:26.2426719Z # python .github/scripts/update_runner_determinator.py 2025-06-01T20:56:26.2427164Z 2025-06-01T20:56:26.2427330Z """ 2025-06-01T20:56:26.2427917Z This runner determinator is used to determine which set of runners to run a 2025-06-01T20:56:26.2428807Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-01T20:56:26.2429726Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-01T20:56:26.2430554Z of which runners should be used to run which job. 2025-06-01T20:56:26.2430950Z 2025-06-01T20:56:26.2431345Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-01T20:56:26.2432432Z separated by a line containing "---". If the line is not present, the 2025-06-01T20:56:26.2433348Z settings are considered to be empty with only the second part, the user 2025-06-01T20:56:26.2434280Z list, defined. 2025-06-01T20:56:26.2434526Z 2025-06-01T20:56:26.2434908Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-01T20:56:26.2435840Z used to define any settings that are needed to determine which runners to use. 2025-06-01T20:56:26.2436703Z It's fields are defined by the RolloutSettings class below. 2025-06-01T20:56:26.2437146Z 2025-06-01T20:56:26.2437542Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-01T20:56:26.2438410Z The user list is also a comma separated list of additional features or 2025-06-01T20:56:26.2439159Z experiments which the user could be opted in to. 2025-06-01T20:56:26.2439560Z 2025-06-01T20:56:26.2439763Z The user list has the following rules: 2025-06-01T20:56:26.2440121Z 2025-06-01T20:56:26.2440446Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-01T20:56:26.2441295Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-01T20:56:26.2442063Z - A "#" prefix opts the user out of all experiments 2025-06-01T20:56:26.2442458Z 2025-06-01T20:56:26.2442639Z Example config: 2025-06-01T20:56:26.2443093Z # A list of experiments that can be opted into. 2025-06-01T20:56:26.2443939Z # This defines the behavior they'll induce when opted into. 2025-06-01T20:56:26.2444595Z # Expected syntax is: 2025-06-01T20:56:26.2445249Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-01T20:56:26.2446226Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-01T20:56:26.2446847Z 2025-06-01T20:56:26.2447019Z experiments: 2025-06-01T20:56:26.2447416Z lf: 2025-06-01T20:56:26.2447810Z rollout_percent: 25 2025-06-01T20:56:26.2448283Z all_branches: false 2025-06-01T20:56:26.2448743Z default: true 2025-06-01T20:56:26.2449173Z --- 2025-06-01T20:56:26.2449382Z 2025-06-01T20:56:26.2449546Z # Opt-ins: 2025-06-01T20:56:26.2450142Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-01T20:56:26.2451016Z # and specifying experiments to enable in a comma-separated list. 2025-06-01T20:56:26.2451810Z # To always opt out of an experiment, prefix it with a "-". 2025-06-01T20:56:26.2452477Z # Experiments should be from the above list. 2025-06-01T20:56:26.2452858Z 2025-06-01T20:56:26.2453044Z @User1,-lf,split_build 2025-06-01T20:56:26.2453480Z @User2,lf 2025-06-01T20:56:26.2454057Z @User3,split_build 2025-06-01T20:56:26.2454483Z """ 2025-06-01T20:56:26.2454834Z 2025-06-01T20:56:26.2455004Z import json 2025-06-01T20:56:26.2455384Z import logging 2025-06-01T20:56:26.2455771Z import os 2025-06-01T20:56:26.2456139Z import random 2025-06-01T20:56:26.2456529Z import re 2025-06-01T20:56:26.2456889Z import sys 2025-06-01T20:56:26.2457304Z from argparse import ArgumentParser 2025-06-01T20:56:26.2457846Z from collections.abc import Iterable 2025-06-01T20:56:26.2458370Z from functools import cache 2025-06-01T20:56:26.2458842Z from logging import LogRecord 2025-06-01T20:56:26.2459331Z from typing import Any, NamedTuple 2025-06-01T20:56:26.2459868Z from urllib.request import Request, urlopen 2025-06-01T20:56:26.2460253Z 2025-06-01T20:56:26.2460457Z import yaml 2025-06-01T20:56:26.2460871Z from github import Auth, Github 2025-06-01T20:56:26.2461368Z from github.Issue import Issue 2025-06-01T20:56:26.2461670Z 2025-06-01T20:56:26.2461676Z 2025-06-01T20:56:26.2461899Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-01T20:56:26.2462594Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-01T20:56:26.2463480Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-01T20:56:26.2464357Z 2025-06-01T20:56:26.2464598Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-01T20:56:26.2465328Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-01T20:56:26.2465857Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-01T20:56:26.2466422Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-01T20:56:26.2466783Z 2025-06-01T20:56:26.2466990Z SETTING_EXPERIMENTS = "experiments" 2025-06-01T20:56:26.2467325Z 2025-06-01T20:56:26.2467520Z LF_FLEET_EXPERIMENT = "lf" 2025-06-01T20:56:26.2467998Z CANARY_FLEET_SUFFIX = ".c" 2025-06-01T20:56:26.2468284Z 2025-06-01T20:56:26.2468290Z 2025-06-01T20:56:26.2468482Z class Experiment(NamedTuple): 2025-06-01T20:56:26.2468972Z rollout_perc: float = ( 2025-06-01T20:56:26.2469612Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-01T20:56:26.2470310Z ) 2025-06-01T20:56:26.2470694Z all_branches: bool = ( 2025-06-01T20:56:26.2471328Z False # If True, the experiment is also enabled on the exception branches 2025-06-01T20:56:26.2472019Z ) 2025-06-01T20:56:26.2472382Z default: bool = ( 2025-06-01T20:56:26.2472970Z True # If True, the experiment is enabled by default for all queries 2025-06-01T20:56:26.2473623Z ) 2025-06-01T20:56:26.2474056Z 2025-06-01T20:56:26.2474249Z # Add more fields as needed 2025-06-01T20:56:26.2474587Z 2025-06-01T20:56:26.2474593Z 2025-06-01T20:56:26.2474795Z class Settings(NamedTuple): 2025-06-01T20:56:26.2475247Z """ 2025-06-01T20:56:26.2475709Z Settings for the experiments that can be opted into. 2025-06-01T20:56:26.2476290Z """ 2025-06-01T20:56:26.2476489Z 2025-06-01T20:56:26.2476714Z experiments: dict[str, Experiment] = {} 2025-06-01T20:56:26.2477081Z 2025-06-01T20:56:26.2477089Z 2025-06-01T20:56:26.2477304Z class ColorFormatter(logging.Formatter): 2025-06-01T20:56:26.2477937Z """Color codes the log messages based on the log level""" 2025-06-01T20:56:26.2478384Z 2025-06-01T20:56:26.2478555Z COLORS = { 2025-06-01T20:56:26.2478955Z "WARNING": "\033[33m", # Yellow 2025-06-01T20:56:26.2479467Z "ERROR": "\033[31m", # Red 2025-06-01T20:56:26.2479967Z "CRITICAL": "\033[31m", # Red 2025-06-01T20:56:26.2480468Z "INFO": "\033[0m", # Reset 2025-06-01T20:56:26.2480956Z "DEBUG": "\033[0m", # Reset 2025-06-01T20:56:26.2481432Z } 2025-06-01T20:56:26.2481626Z 2025-06-01T20:56:26.2481845Z def format(self, record: LogRecord) -> str: 2025-06-01T20:56:26.2482621Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-01T20:56:26.2483418Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-01T20:56:26.2484115Z return super().format(record) 2025-06-01T20:56:26.2484452Z 2025-06-01T20:56:26.2484459Z 2025-06-01T20:56:26.2484661Z handler = logging.StreamHandler() 2025-06-01T20:56:26.2485536Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-01T20:56:26.2486110Z 2025-06-01T20:56:26.2486354Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-01T20:56:26.2486939Z log.addHandler(handler) 2025-06-01T20:56:26.2487397Z log.setLevel(logging.INFO) 2025-06-01T20:56:26.2487685Z 2025-06-01T20:56:26.2487692Z 2025-06-01T20:56:26.2487951Z def set_github_output(key: str, value: str) -> None: 2025-06-01T20:56:26.2488515Z """ 2025-06-01T20:56:26.2489022Z Defines outputs of the github action that invokes this script 2025-06-01T20:56:26.2489652Z """ 2025-06-01T20:56:26.2490020Z if not GITHUB_OUTPUT: 2025-06-01T20:56:26.2491096Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-01T20:56:26.2492233Z log.warning( 2025-06-01T20:56:26.2493093Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-01T20:56:26.2494255Z ) 2025-06-01T20:56:26.2504150Z print(f"::set-output name={key}::{value}") 2025-06-01T20:56:26.2504780Z return 2025-06-01T20:56:26.2505024Z 2025-06-01T20:56:26.2505410Z with open(GITHUB_OUTPUT, "a") as f: 2025-06-01T20:56:26.2506034Z log.info(f"Setting output: {key}='{value}'") 2025-06-01T20:56:26.2506639Z f.write(f"{key}={value}\n") 2025-06-01T20:56:26.2506967Z 2025-06-01T20:56:26.2506974Z 2025-06-01T20:56:26.2507288Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-01T20:56:26.2507933Z return frozenset( 2025-06-01T20:56:26.2508549Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-01T20:56:26.2509234Z ) 2025-06-01T20:56:26.2509439Z 2025-06-01T20:56:26.2509446Z 2025-06-01T20:56:26.2509629Z def parse_args() -> Any: 2025-06-01T20:56:26.2510179Z parser = ArgumentParser("Get dynamic rollout settings") 2025-06-01T20:56:26.2511058Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-01T20:56:26.2511850Z parser.add_argument( 2025-06-01T20:56:26.2512307Z "--github-issue-repo", 2025-06-01T20:56:26.2512775Z type=str, 2025-06-01T20:56:26.2513190Z required=False, 2025-06-01T20:56:26.2513657Z default="pytorch/test-infra", 2025-06-01T20:56:26.2514322Z help="GitHub repo to get the issue", 2025-06-01T20:56:26.2514839Z ) 2025-06-01T20:56:26.2515208Z parser.add_argument( 2025-06-01T20:56:26.2515662Z "--github-repo", 2025-06-01T20:56:26.2516094Z type=str, 2025-06-01T20:56:26.2516492Z required=True, 2025-06-01T20:56:26.2516956Z help="GitHub repo where CI is running", 2025-06-01T20:56:26.2517505Z ) 2025-06-01T20:56:26.2517884Z parser.add_argument( 2025-06-01T20:56:26.2518496Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-01T20:56:26.2519163Z ) 2025-06-01T20:56:26.2519528Z parser.add_argument( 2025-06-01T20:56:26.2520165Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-01T20:56:26.2520843Z ) 2025-06-01T20:56:26.2521214Z parser.add_argument( 2025-06-01T20:56:26.2521856Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-01T20:56:26.2522553Z ) 2025-06-01T20:56:26.2522927Z parser.add_argument( 2025-06-01T20:56:26.2523590Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-01T20:56:26.2524420Z ) 2025-06-01T20:56:26.2524784Z parser.add_argument( 2025-06-01T20:56:26.2525238Z "--github-ref-type", 2025-06-01T20:56:26.2525685Z type=str, 2025-06-01T20:56:26.2526087Z required=True, 2025-06-01T20:56:26.2526564Z help="Current GitHub ref type, branch or tag", 2025-06-01T20:56:26.2527125Z ) 2025-06-01T20:56:26.2527497Z parser.add_argument( 2025-06-01T20:56:26.2527958Z "--eligible-experiments", 2025-06-01T20:56:26.2528609Z type=_str_comma_separated_to_set, 2025-06-01T20:56:26.2529136Z required=False, 2025-06-01T20:56:26.2529564Z default="", 2025-06-01T20:56:26.2530423Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-01T20:56:26.2531360Z ) 2025-06-01T20:56:26.2531729Z parser.add_argument( 2025-06-01T20:56:26.2532188Z "--opt-out-experiments", 2025-06-01T20:56:26.2532697Z type=_str_comma_separated_to_set, 2025-06-01T20:56:26.2533221Z required=False, 2025-06-01T20:56:26.2533639Z default="", 2025-06-01T20:56:26.2534358Z help=( 2025-06-01T20:56:26.2535058Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-01T20:56:26.2536240Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-01T20:56:26.2537081Z ), 2025-06-01T20:56:26.2537464Z ) 2025-06-01T20:56:26.2537838Z parser.add_argument( 2025-06-01T20:56:26.2538271Z "--pr-number", 2025-06-01T20:56:26.2538685Z type=str, 2025-06-01T20:56:26.2539081Z required=False, 2025-06-01T20:56:26.2587439Z default="", 2025-06-01T20:56:26.2588337Z help="the optional PR number where this is run", 2025-06-01T20:56:26.2588998Z ) 2025-06-01T20:56:26.2589207Z 2025-06-01T20:56:26.2589413Z return parser.parse_args() 2025-06-01T20:56:26.2589741Z 2025-06-01T20:56:26.2589747Z 2025-06-01T20:56:26.2590166Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-01T20:56:26.2590944Z auth = Auth.Token(github_token) 2025-06-01T20:56:26.2591453Z return Github(auth=auth) 2025-06-01T20:56:26.2591759Z 2025-06-01T20:56:26.2591766Z 2025-06-01T20:56:26.2592222Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-01T20:56:26.2593024Z repo = gh.get_repo(repo) 2025-06-01T20:56:26.2593538Z return repo.get_issue(number=issue_num) 2025-06-01T20:56:26.2594078Z 2025-06-01T20:56:26.2594084Z 2025-06-01T20:56:26.2594286Z def get_potential_pr_author( 2025-06-01T20:56:26.2594951Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-01T20:56:26.2595633Z ) -> str: 2025-06-01T20:56:26.2596155Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-01T20:56:26.2596960Z # Fetch the actual username from the original PR. The PR number is 2025-06-01T20:56:26.2597709Z # embedded in the tag name: ciflow// 2025-06-01T20:56:26.2598140Z 2025-06-01T20:56:26.2598327Z gh = get_gh_client(github_token) 2025-06-01T20:56:26.2598661Z 2025-06-01T20:56:26.2598933Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-01T20:56:26.2599543Z split_tag = ref_name.split("/") 2025-06-01T20:56:26.2600038Z if ( 2025-06-01T20:56:26.2600422Z len(split_tag) == 3 2025-06-01T20:56:26.2600913Z and split_tag[0] == "ciflow" 2025-06-01T20:56:26.2601435Z and split_tag[2].isnumeric() 2025-06-01T20:56:26.2601936Z ): 2025-06-01T20:56:26.2602328Z pr_number = split_tag[2] 2025-06-01T20:56:26.2602814Z try: 2025-06-01T20:56:26.2603253Z repository = gh.get_repo(repo) 2025-06-01T20:56:26.2603972Z pull = repository.get_pull(number=int(pr_number)) 2025-06-01T20:56:26.2604577Z except Exception as e: 2025-06-01T20:56:26.2605090Z raise Exception( # noqa: TRY002 2025-06-01T20:56:26.2605770Z f"issue with pull request {pr_number} from repo {repository}" 2025-06-01T20:56:26.2606419Z ) from e 2025-06-01T20:56:26.2606961Z return pull.user.login # type: ignore[no-any-return] 2025-06-01T20:56:26.2607659Z # In all other cases, return the original input username 2025-06-01T20:56:26.2608233Z return username 2025-06-01T20:56:26.2608472Z 2025-06-01T20:56:26.2608606Z 2025-06-01T20:56:26.2608847Z def is_exception_branch(branch: str) -> bool: 2025-06-01T20:56:26.2609374Z """ 2025-06-01T20:56:26.2610016Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-01T20:56:26.2610793Z """ 2025-06-01T20:56:26.2611338Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-01T20:56:26.2611861Z 2025-06-01T20:56:26.2611868Z 2025-06-01T20:56:26.2612069Z def load_yaml(yaml_text: str) -> Any: 2025-06-01T20:56:26.2612556Z try: 2025-06-01T20:56:26.2612946Z data = yaml.safe_load(yaml_text) 2025-06-01T20:56:26.2613460Z return data 2025-06-01T20:56:26.2614044Z except yaml.YAMLError: 2025-06-01T20:56:26.2614525Z log.exception("Error loading YAML") 2025-06-01T20:56:26.2615045Z raise 2025-06-01T20:56:26.2615260Z 2025-06-01T20:56:26.2615267Z 2025-06-01T20:56:26.2615680Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-01T20:56:26.2616434Z """ 2025-06-01T20:56:26.2617062Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-01T20:56:26.2617668Z 2025-06-01T20:56:26.2618138Z If the issue body contains "---" then the text above that is the settings 2025-06-01T20:56:26.2618910Z and the text below is the list of opted in users. 2025-06-01T20:56:26.2619316Z 2025-06-01T20:56:26.2619686Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-01T20:56:26.2620387Z """ 2025-06-01T20:56:26.2620834Z rollout_state_parts = rollout_state.split("---") 2025-06-01T20:56:26.2621467Z if len(rollout_state_parts) >= 2: 2025-06-01T20:56:26.2622074Z return rollout_state_parts[0], rollout_state_parts[1] 2025-06-01T20:56:26.2622658Z else: 2025-06-01T20:56:26.2623045Z return "", rollout_state 2025-06-01T20:56:26.2623354Z 2025-06-01T20:56:26.2623361Z 2025-06-01T20:56:26.2623562Z class UserOptins(dict[str, list[str]]): 2025-06-01T20:56:26.2624201Z """ 2025-06-01T20:56:26.2624720Z Dictionary of users with a list of features they have opted into 2025-06-01T20:56:26.2625377Z """ 2025-06-01T20:56:26.2625574Z 2025-06-01T20:56:26.2625582Z 2025-06-01T20:56:26.2625946Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-01T20:56:26.2626613Z """ 2025-06-01T20:56:26.2627335Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-01T20:56:26.2628019Z 2025-06-01T20:56:26.2628641Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-01T20:56:26.2629641Z - Example line: "@User1,lf,split_build" 2025-06-01T20:56:26.2630324Z - A "#" prefix indicates the user is opted out of all experiments 2025-06-01T20:56:26.2630804Z 2025-06-01T20:56:26.2630811Z 2025-06-01T20:56:26.2630971Z """ 2025-06-01T20:56:26.2631350Z optins = UserOptins() 2025-06-01T20:56:26.2631841Z for user in user_optin_text.split("\n"): 2025-06-01T20:56:26.2632398Z user = user.strip("\r\n\t -") 2025-06-01T20:56:26.2632932Z if not user or not user.startswith("@"): 2025-06-01T20:56:26.2633510Z # Not a valid user. Skip 2025-06-01T20:56:26.2634114Z continue 2025-06-01T20:56:26.2634369Z 2025-06-01T20:56:26.2634535Z if user: 2025-06-01T20:56:26.2635021Z usr_name = user.split(",")[0].strip("@") 2025-06-01T20:56:26.2635715Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-01T20:56:26.2636241Z 2025-06-01T20:56:26.2636416Z return optins 2025-06-01T20:56:26.2636656Z 2025-06-01T20:56:26.2636662Z 2025-06-01T20:56:26.2636948Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-01T20:56:26.2637553Z """ 2025-06-01T20:56:26.2637946Z Check if the experiment name is valid. 2025-06-01T20:56:26.2638473Z A valid name: 2025-06-01T20:56:26.2639251Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-01T20:56:26.2640193Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-01T20:56:26.2640938Z - Cannot contain spaces 2025-06-01T20:56:26.2641410Z """ 2025-06-01T20:56:26.2641618Z 2025-06-01T20:56:26.2641885Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-01T20:56:26.2642583Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-01T20:56:26.2643039Z 2025-06-01T20:56:26.2643202Z if valid: 2025-06-01T20:56:26.2643588Z return True 2025-06-01T20:56:26.2643958Z 2025-06-01T20:56:26.2644132Z log.error( 2025-06-01T20:56:26.2645606Z 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-06-01T20:56:26.2647172Z ) 2025-06-01T20:56:26.2647547Z return False 2025-06-01T20:56:26.2647779Z 2025-06-01T20:56:26.2647785Z 2025-06-01T20:56:26.2648098Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-01T20:56:26.2648719Z """ 2025-06-01T20:56:26.2649433Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-01T20:56:26.2650163Z """ 2025-06-01T20:56:26.2650518Z try: 2025-06-01T20:56:26.2650886Z if settings_text: 2025-06-01T20:56:26.2651632Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-01T20:56:26.2652429Z # for easy reading 2025-06-01T20:56:26.2653218Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-01T20:56:26.2654277Z # the backtick character in shell commands. 2025-06-01T20:56:26.2654880Z backtick = chr(96) # backtick character 2025-06-01T20:56:26.2655550Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-01T20:56:26.2656219Z settings = load_yaml(settings_text) 2025-06-01T20:56:26.2656593Z 2025-06-01T20:56:26.2657012Z # For now we just load experiments. We can expand this if/when we add more settings 2025-06-01T20:56:26.2657789Z experiments = {} 2025-06-01T20:56:26.2658091Z 2025-06-01T20:56:26.2658470Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-01T20:56:26.2659251Z if not is_valid_experiment_name(exp_name): 2025-06-01T20:56:26.2660382Z # 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-06-01T20:56:26.2661455Z continue 2025-06-01T20:56:26.2661855Z 2025-06-01T20:56:26.2662177Z valid_settings = {} 2025-06-01T20:56:26.2663206Z for setting in exp_settings: 2025-06-01T20:56:26.2664450Z if setting not in Experiment._fields: 2025-06-01T20:56:26.2665458Z log.warning( 2025-06-01T20:56:26.2666885Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-01T20:56:26.2668278Z ) 2025-06-01T20:56:26.2669056Z else: 2025-06-01T20:56:26.2669924Z valid_settings[setting] = exp_settings[setting] 2025-06-01T20:56:26.2670659Z 2025-06-01T20:56:26.2671151Z experiments[exp_name] = Experiment(**valid_settings) 2025-06-01T20:56:26.2672332Z return Settings(experiments) 2025-06-01T20:56:26.2673042Z 2025-06-01T20:56:26.2673374Z except Exception: 2025-06-01T20:56:26.2674706Z log.exception("Failed to parse settings") 2025-06-01T20:56:26.2675558Z 2025-06-01T20:56:26.2675867Z return Settings() 2025-06-01T20:56:26.2676396Z 2025-06-01T20:56:26.2676407Z 2025-06-01T20:56:26.2676855Z def parse_settings(rollout_state: str) -> Settings: 2025-06-01T20:56:26.2678571Z """ 2025-06-01T20:56:26.2679372Z Parse settings, if any, from the rollout state. 2025-06-01T20:56:26.2680104Z 2025-06-01T20:56:26.2680741Z If the issue body contains "---" then the text above that is the settings 2025-06-01T20:56:26.2682206Z and the text below is the list of opted in users. 2025-06-01T20:56:26.2683003Z 2025-06-01T20:56:26.2683924Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-01T20:56:26.2685261Z """ 2025-06-01T20:56:26.2686258Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T20:56:26.2687710Z return parse_settings_from_text(settings_text) 2025-06-01T20:56:26.2688448Z 2025-06-01T20:56:26.2688460Z 2025-06-01T20:56:26.2688890Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-01T20:56:26.2689888Z """ 2025-06-01T20:56:26.2690598Z Parse users from the rollout state. 2025-06-01T20:56:26.2691293Z 2025-06-01T20:56:26.2691621Z """ 2025-06-01T20:56:26.2692636Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T20:56:26.2694213Z return parse_user_opt_in_from_text(users_text) 2025-06-01T20:56:26.2694777Z 2025-06-01T20:56:26.2694785Z 2025-06-01T20:56:26.2695511Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T20:56:26.2696297Z """ 2025-06-01T20:56:26.2696730Z Check if a user is opted into an experiment 2025-06-01T20:56:26.2697272Z """ 2025-06-01T20:56:26.2697729Z return experiment_name in user_optins.get(user, []) 2025-06-01T20:56:26.2698160Z 2025-06-01T20:56:26.2698167Z 2025-06-01T20:56:26.2698594Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T20:56:26.2699334Z """ 2025-06-01T20:56:26.2699802Z Check if a user explicitly opted out of an experiment 2025-06-01T20:56:26.2700381Z """ 2025-06-01T20:56:26.2700886Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-01T20:56:26.2701572Z experiment_optout = "-" + experiment_name 2025-06-01T20:56:26.2702208Z if experiment_optout not in user_optins.get(user, []): 2025-06-01T20:56:26.2702818Z return False 2025-06-01T20:56:26.2703071Z 2025-06-01T20:56:26.2703350Z if is_user_opted_in(user, user_optins, experiment_name): 2025-06-01T20:56:26.2704708Z log.warning( 2025-06-01T20:56:26.2705548Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-01T20:56:26.2706449Z ) 2025-06-01T20:56:26.2706657Z 2025-06-01T20:56:26.2706834Z return True 2025-06-01T20:56:26.2707071Z 2025-06-01T20:56:26.2707077Z 2025-06-01T20:56:26.2707263Z def get_runner_prefix( 2025-06-01T20:56:26.2707710Z rollout_state: str, 2025-06-01T20:56:26.2708178Z workflow_requestors: Iterable[str], 2025-06-01T20:56:26.2708709Z branch: str, 2025-06-01T20:56:26.2709192Z eligible_experiments: frozenset[str] = frozenset(), 2025-06-01T20:56:26.2709876Z opt_out_experiments: frozenset[str] = frozenset(), 2025-06-01T20:56:26.2710458Z is_canary: bool = False, 2025-06-01T20:56:26.2710920Z ) -> str: 2025-06-01T20:56:26.2711347Z settings = parse_settings(rollout_state) 2025-06-01T20:56:26.2711934Z user_optins = parse_users(rollout_state) 2025-06-01T20:56:26.2712306Z 2025-06-01T20:56:26.2712491Z fleet_prefix = "" 2025-06-01T20:56:26.2712911Z prefixes = [] 2025-06-01T20:56:26.2713557Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-01T20:56:26.2714686Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-01T20:56:26.2715418Z log.info( 2025-06-01T20:56:26.2716100Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-01T20:56:26.2716864Z ) 2025-06-01T20:56:26.2717248Z continue 2025-06-01T20:56:26.2717498Z 2025-06-01T20:56:26.2717688Z if opt_out_experiments: 2025-06-01T20:56:26.2718397Z if experiment_name in opt_out_experiments: 2025-06-01T20:56:26.2719045Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-01T20:56:26.2719645Z log.info( 2025-06-01T20:56:26.2720578Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-01T20:56:26.2721556Z ) 2025-06-01T20:56:26.2721960Z continue 2025-06-01T20:56:26.2722227Z 2025-06-01T20:56:26.2722415Z if eligible_experiments: 2025-06-01T20:56:26.2722992Z if experiment_name not in eligible_experiments: 2025-06-01T20:56:26.2723621Z exp_list = ", ".join(eligible_experiments) 2025-06-01T20:56:26.2724358Z log.info( 2025-06-01T20:56:26.2725161Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-01T20:56:26.2726005Z ) 2025-06-01T20:56:26.2726399Z continue 2025-06-01T20:56:26.2727036Z elif not experiment_settings.default: 2025-06-01T20:56:26.2727589Z log.info( 2025-06-01T20:56:26.2728431Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-01T20:56:26.2729194Z ) 2025-06-01T20:56:26.2729613Z continue 2025-06-01T20:56:26.2729868Z 2025-06-01T20:56:26.2730149Z # Is any workflow_requestor opted out to this experiment? 2025-06-01T20:56:26.2730765Z opted_out_users = [ 2025-06-01T20:56:26.2731211Z requestor 2025-06-01T20:56:26.2731665Z for requestor in workflow_requestors 2025-06-01T20:56:26.2732361Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-01T20:56:26.2732996Z ] 2025-06-01T20:56:26.2733200Z 2025-06-01T20:56:26.2733377Z if opted_out_users: 2025-06-01T20:56:26.2733991Z log.info( 2025-06-01T20:56:26.2734627Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-01T20:56:26.2735343Z ) 2025-06-01T20:56:26.2735728Z continue 2025-06-01T20:56:26.2736004Z 2025-06-01T20:56:26.2736286Z # Is any workflow_requestor opted in to this experiment? 2025-06-01T20:56:26.2736915Z opted_in_users = [ 2025-06-01T20:56:26.2737375Z requestor 2025-06-01T20:56:26.2737834Z for requestor in workflow_requestors 2025-06-01T20:56:26.2738509Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-01T20:56:26.2739136Z ] 2025-06-01T20:56:26.2739341Z 2025-06-01T20:56:26.2739521Z enabled = False 2025-06-01T20:56:26.2739959Z if opted_in_users: 2025-06-01T20:56:26.2740409Z log.info( 2025-06-01T20:56:26.2741015Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-01T20:56:26.2741701Z ) 2025-06-01T20:56:26.2742092Z enabled = True 2025-06-01T20:56:26.2742379Z 2025-06-01T20:56:26.2742596Z elif experiment_settings.rollout_perc: 2025-06-01T20:56:26.2743428Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-01T20:56:26.2744632Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-01T20:56:26.2745299Z log.info( 2025-06-01T20:56:26.2746162Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-01T20:56:26.2747088Z ) 2025-06-01T20:56:26.2747497Z enabled = True 2025-06-01T20:56:26.2747801Z 2025-06-01T20:56:26.2747969Z if enabled: 2025-06-01T20:56:26.2748388Z label = experiment_name 2025-06-01T20:56:26.2748948Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-01T20:56:26.2749785Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-01T20:56:26.2750824Z # - If it's enabled, then we always list it's prefix first 2025-06-01T20:56:26.2751598Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-01T20:56:26.2752267Z if is_canary: 2025-06-01T20:56:26.2752760Z label += CANARY_FLEET_SUFFIX 2025-06-01T20:56:26.2753421Z fleet_prefix = label 2025-06-01T20:56:26.2754093Z else: 2025-06-01T20:56:26.2754536Z prefixes.append(label) 2025-06-01T20:56:26.2754902Z 2025-06-01T20:56:26.2755089Z if len(prefixes) > 1: 2025-06-01T20:56:26.2755545Z log.error( 2025-06-01T20:56:26.2756576Z 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-06-01T20:56:26.2757710Z ) 2025-06-01T20:56:26.2758101Z prefixes = prefixes[:1] 2025-06-01T20:56:26.2758426Z 2025-06-01T20:56:26.2758615Z # Fleet always comes first 2025-06-01T20:56:26.2759089Z if fleet_prefix: 2025-06-01T20:56:26.2759548Z prefixes.insert(0, fleet_prefix) 2025-06-01T20:56:26.2759905Z 2025-06-01T20:56:26.2760298Z return ".".join(prefixes) + "." if prefixes else "" 2025-06-01T20:56:26.2760724Z 2025-06-01T20:56:26.2760731Z 2025-06-01T20:56:26.2761173Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-01T20:56:26.2761963Z """ 2025-06-01T20:56:26.2762537Z Gets the first comment of the issue, which contains the desired rollout state. 2025-06-01T20:56:26.2763106Z 2025-06-01T20:56:26.2763494Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-01T20:56:26.2764378Z """ 2025-06-01T20:56:26.2764770Z gh = get_gh_client(github_token) 2025-06-01T20:56:26.2765329Z issue = get_issue(gh, repo, issue_num) 2025-06-01T20:56:26.2765974Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-01T20:56:26.2766437Z 2025-06-01T20:56:26.2766443Z 2025-06-01T20:56:26.2766852Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-01T20:56:26.2767619Z for _ in range(num_retries): 2025-06-01T20:56:26.2768102Z try: 2025-06-01T20:56:26.2768530Z req = Request(url=url, headers=headers) 2025-06-01T20:56:26.2769193Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-01T20:56:26.2769843Z return json.loads(content) 2025-06-01T20:56:26.2770375Z except Exception as e: 2025-06-01T20:56:26.2770935Z log.warning(f"Could not download {url}: {e}") 2025-06-01T20:56:26.2771342Z 2025-06-01T20:56:26.2771713Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-01T20:56:26.2772452Z return {} 2025-06-01T20:56:26.2772671Z 2025-06-01T20:56:26.2772677Z 2025-06-01T20:56:26.2772840Z @cache 2025-06-01T20:56:26.2773448Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-01T20:56:26.2774375Z """ 2025-06-01T20:56:26.2774772Z Dynamically get PR information 2025-06-01T20:56:26.2775267Z """ 2025-06-01T20:56:26.2775776Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-01T20:56:26.2776411Z headers = { 2025-06-01T20:56:26.2776868Z "Accept": "application/vnd.github.v3+json", 2025-06-01T20:56:26.2777480Z "Authorization": f"token {github_token}", 2025-06-01T20:56:26.2778013Z } 2025-06-01T20:56:26.2778448Z json_response: dict[str, Any] = download_json( 2025-06-01T20:56:26.2779054Z url=f"{github_api}/issues/{pr_number}", 2025-06-01T20:56:26.2779597Z headers=headers, 2025-06-01T20:56:26.2780032Z ) 2025-06-01T20:56:26.2780234Z 2025-06-01T20:56:26.2780420Z if not json_response: 2025-06-01T20:56:26.2780999Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-01T20:56:26.2781625Z return {} 2025-06-01T20:56:26.2782005Z 2025-06-01T20:56:26.2782184Z return json_response 2025-06-01T20:56:26.2782464Z 2025-06-01T20:56:26.2782470Z 2025-06-01T20:56:26.2782878Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-01T20:56:26.2783616Z """ 2025-06-01T20:56:26.2784358Z Dynamically get the latest list of labels from the pull request 2025-06-01T20:56:26.2785026Z """ 2025-06-01T20:56:26.2785516Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-01T20:56:26.2786140Z return { 2025-06-01T20:56:26.2786734Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-01T20:56:26.2787441Z } 2025-06-01T20:56:26.2787651Z 2025-06-01T20:56:26.2787657Z 2025-06-01T20:56:26.2787833Z def main() -> None: 2025-06-01T20:56:26.2788268Z args = parse_args() 2025-06-01T20:56:26.2788537Z 2025-06-01T20:56:26.2788759Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-01T20:56:26.2789153Z 2025-06-01T20:56:26.2789355Z # Check if the PR is opt-out 2025-06-01T20:56:26.2789850Z if args.pr_number: 2025-06-01T20:56:26.2790517Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-01T20:56:26.2791433Z if OPT_OUT_LABEL in labels: 2025-06-01T20:56:26.2791950Z log.info( 2025-06-01T20:56:26.2792644Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-01T20:56:26.2793420Z ) 2025-06-01T20:56:26.2794231Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T20:56:26.2794929Z sys.exit() 2025-06-01T20:56:26.2795201Z 2025-06-01T20:56:26.2795369Z try: 2025-06-01T20:56:26.2795802Z rollout_state = get_rollout_state_from_issue( 2025-06-01T20:56:26.2796511Z args.github_token, args.github_issue_repo, args.github_issue 2025-06-01T20:56:26.2797143Z ) 2025-06-01T20:56:26.2797353Z 2025-06-01T20:56:26.2797559Z username = get_potential_pr_author( 2025-06-01T20:56:26.2798118Z args.github_token, 2025-06-01T20:56:26.2798596Z args.github_repo, 2025-06-01T20:56:26.2799076Z args.github_actor, 2025-06-01T20:56:26.2799550Z args.github_ref_type, 2025-06-01T20:56:26.2800056Z args.github_branch, 2025-06-01T20:56:26.2800508Z ) 2025-06-01T20:56:26.2800720Z 2025-06-01T20:56:26.2801003Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-01T20:56:26.2801468Z 2025-06-01T20:56:26.2801690Z runner_label_prefix = get_runner_prefix( 2025-06-01T20:56:26.2802250Z rollout_state, 2025-06-01T20:56:26.2802736Z (args.github_issue_owner, username), 2025-06-01T20:56:26.2803290Z args.github_branch, 2025-06-01T20:56:26.2803917Z args.eligible_experiments, 2025-06-01T20:56:26.2804469Z args.opt_out_experiments, 2025-06-01T20:56:26.2804971Z is_canary, 2025-06-01T20:56:26.2805383Z ) 2025-06-01T20:56:26.2805599Z 2025-06-01T20:56:26.2805787Z except Exception as e: 2025-06-01T20:56:26.2806239Z log.error( 2025-06-01T20:56:26.2806917Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-01T20:56:26.2807687Z ) 2025-06-01T20:56:26.2807893Z 2025-06-01T20:56:26.2808223Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T20:56:26.2808728Z 2025-06-01T20:56:26.2808734Z 2025-06-01T20:56:26.2808912Z if __name__ == "__main__": 2025-06-01T20:56:26.2809344Z main() 2025-06-01T20:56:26.2809559Z 2025-06-01T20:56:26.2897187Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-01T20:56:26.2898093Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-01T20:56:26.2948056Z shell: /usr/bin/bash -e {0} 2025-06-01T20:56:26.2948538Z env: 2025-06-01T20:56:26.2949145Z GITHUB_TOKEN: *** 2025-06-01T20:56:26.2949563Z ISSUE_NUMBER: 5132 2025-06-01T20:56:26.2950161Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T20:56:26.2950689Z ISSUE_OWNER: 2025-06-01T20:56:26.2951092Z CHECK_EXPERIMENTS: 2025-06-01T20:56:26.2951526Z OPT_OUT_EXPERIMENTS: 2025-06-01T20:56:26.2951955Z PR_NUMBER: 2025-06-01T20:56:26.2952350Z ##[endgroup] 2025-06-01T20:56:26.6511872Z Defaulting to user installation because normal site-packages is not writeable 2025-06-01T20:56:27.0391874Z Collecting urllib3==1.26.18 2025-06-01T20:56:27.0841022Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-06-01T20:56:27.1047880Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-06-01T20:56:27.1316570Z Collecting PyGithub==2.3.0 2025-06-01T20:56:27.1392507Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-06-01T20:56:27.1856396Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-06-01T20:56:27.1926880Z 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-06-01T20:56:27.1970561Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-06-01T20:56:27.1986800Z 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-06-01T20:56:27.2001098Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-06-01T20:56:27.2277580Z Collecting Deprecated (from PyGithub==2.3.0) 2025-06-01T20:56:27.2346953Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-06-01T20:56:27.2575084Z 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-06-01T20:56:27.3715901Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-01T20:56:27.3798885Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-06-01T20:56:27.4859415Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-06-01T20:56:27.4934726Z 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-06-01T20:56:27.5159833Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-01T20:56:27.5234453Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-06-01T20:56:27.5504804Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-06-01T20:56:27.5647565Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.7 MB/s eta 0:00:00 2025-06-01T20:56:27.5717732Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-06-01T20:56:27.5980502Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 14.0 MB/s eta 0:00:00 2025-06-01T20:56:27.6051528Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-06-01T20:56:27.6515751Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 18.9 MB/s eta 0:00:00 2025-06-01T20:56:27.6583103Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-06-01T20:56:27.6675500Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-06-01T20:56:27.6898881Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 22.7 MB/s eta 0:00:00 2025-06-01T20:56:27.6968619Z 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-06-01T20:56:27.7021515Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 21.3 MB/s eta 0:00:00 2025-06-01T20:56:27.7089382Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-06-01T20:56:27.7141716Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.1 MB/s eta 0:00:00 2025-06-01T20:56:28.0057476Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-06-01T20:56:28.5293230Z 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-06-01T20:56:28.6007002Z ##[group]Run curr_branch="main" 2025-06-01T20:56:28.6007336Z curr_branch="main" 2025-06-01T20:56:28.6007574Z curr_ref_type="branch" 2025-06-01T20:56:28.6007834Z echo "Current branch is '$curr_branch'" 2025-06-01T20:56:28.6008096Z  2025-06-01T20:56:28.6008294Z python3 runner_determinator.py \ 2025-06-01T20:56:28.6008587Z  --github-token "$GITHUB_TOKEN" \ 2025-06-01T20:56:28.6008865Z  --github-issue "$ISSUE_NUMBER" \ 2025-06-01T20:56:28.6009140Z  --github-branch "$curr_branch" \ 2025-06-01T20:56:28.6009418Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-06-01T20:56:28.6009717Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-06-01T20:56:28.6010016Z  --github-ref-type "$curr_ref_type" \ 2025-06-01T20:56:28.6010305Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-06-01T20:56:28.6010636Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-06-01T20:56:28.6011005Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-06-01T20:56:28.6011310Z  --pr-number "${PR_NUMBER}" 2025-06-01T20:56:28.6063573Z shell: /usr/bin/bash -e {0} 2025-06-01T20:56:28.6063950Z env: 2025-06-01T20:56:28.6064513Z GITHUB_TOKEN: *** 2025-06-01T20:56:28.6064724Z ISSUE_NUMBER: 5132 2025-06-01T20:56:28.6064945Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T20:56:28.6065191Z ISSUE_OWNER: 2025-06-01T20:56:28.6065385Z CHECK_EXPERIMENTS: 2025-06-01T20:56:28.6065592Z OPT_OUT_EXPERIMENTS: 2025-06-01T20:56:28.6065801Z PR_NUMBER: 2025-06-01T20:56:28.6065982Z ##[endgroup] 2025-06-01T20:56:28.6133854Z Current branch is 'main' 2025-06-01T20:56:29.8958467Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-06-01T20:56:29.8959712Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-06-01T20:56:29.8960540Z INFO : Setting output: label-type='' 2025-06-01T20:56:29.9271212Z Evaluate and set job outputs 2025-06-01T20:56:29.9278314Z Cleaning up orphan processes