2025-12-04T08:32:39.0000322Z Current runner version: '2.329.0' 2025-12-04T08:32:39.0031942Z ##[group]Runner Image Provisioner 2025-12-04T08:32:39.0033125Z Hosted Compute Agent 2025-12-04T08:32:39.0034175Z Version: 20251124.448 2025-12-04T08:32:39.0035226Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:32:39.0036540Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:32:39.0037606Z ##[endgroup] 2025-12-04T08:32:39.0038464Z ##[group]Operating System 2025-12-04T08:32:39.0039300Z Ubuntu 2025-12-04T08:32:39.0040056Z 24.04.3 2025-12-04T08:32:39.0040843Z LTS 2025-12-04T08:32:39.0041596Z ##[endgroup] 2025-12-04T08:32:39.0042580Z ##[group]Runner Image 2025-12-04T08:32:39.0043544Z Image: ubuntu-24.04 2025-12-04T08:32:39.0044364Z Version: 20251126.144.1 2025-12-04T08:32:39.0046396Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:32:39.0049123Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:32:39.0050939Z ##[endgroup] 2025-12-04T08:32:39.0052737Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:32:39.0055706Z Contents: read 2025-12-04T08:32:39.0056733Z Metadata: read 2025-12-04T08:32:39.0057442Z ##[endgroup] 2025-12-04T08:32:39.0060342Z Secret source: Actions 2025-12-04T08:32:39.0061603Z Prepare workflow directory 2025-12-04T08:32:39.0866622Z Prepare all required actions 2025-12-04T08:32:39.0948094Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:32:39.0955119Z ##[group] Inputs 2025-12-04T08:32:39.0956304Z check_experiments: 2025-12-04T08:32:39.0957277Z opt_out_experiments: 2025-12-04T08:32:39.0958222Z triggering_actor: pytorchmergebot 2025-12-04T08:32:39.0959235Z issue_owner: 2025-12-04T08:32:39.0960006Z curr_branch: main 2025-12-04T08:32:39.0960865Z curr_ref_type: branch 2025-12-04T08:32:39.0961790Z issue_number: 5132 2025-12-04T08:32:39.0962765Z ##[endgroup] 2025-12-04T08:32:39.0963718Z Complete job name: get-label-type / runner-determinator 2025-12-04T08:32:39.6621590Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:32:39.6624128Z cat < runner_determinator.py 2025-12-04T08:32:39.6624873Z # flake8: noqa: G004 2025-12-04T08:32:39.6625453Z  2025-12-04T08:32:39.6626540Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:32:39.6627707Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:32:39.6628760Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:32:39.6629543Z  2025-12-04T08:32:39.6630049Z """ 2025-12-04T08:32:39.6630955Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:32:39.6632070Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:32:39.6633372Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:32:39.6634390Z of which runners should be used to run which job. 2025-12-04T08:32:39.6635206Z  2025-12-04T08:32:39.6635930Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:32:39.6637192Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:32:39.6638377Z settings are considered to be empty with only the second part, the user 2025-12-04T08:32:39.6639279Z list, defined. 2025-12-04T08:32:39.6639817Z  2025-12-04T08:32:39.6640580Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:32:39.6641728Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:32:39.6642778Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:32:39.6643590Z  2025-12-04T08:32:39.6644630Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:32:39.6645706Z The user list is also a comma separated list of additional features or 2025-12-04T08:32:39.6647304Z experiments which the user could be opted in to. 2025-12-04T08:32:39.6648045Z  2025-12-04T08:32:39.6648597Z The user list has the following rules: 2025-12-04T08:32:39.6649340Z  2025-12-04T08:32:39.6650059Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:32:39.6651158Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:32:39.6652196Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:32:39.6652936Z  2025-12-04T08:32:39.6653436Z Example config: 2025-12-04T08:32:39.6654092Z  # A list of experiments that can be opted into. 2025-12-04T08:32:39.6655018Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:32:39.6655815Z  # Expected syntax is: 2025-12-04T08:32:39.6656942Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:32:39.6658175Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:32:39.6659090Z  2025-12-04T08:32:39.6659620Z  experiments: 2025-12-04T08:32:39.6660207Z  lf: 2025-12-04T08:32:39.6660757Z  rollout_percent: 25 2025-12-04T08:32:39.6661351Z  all_branches: false 2025-12-04T08:32:39.6662052Z  default: true 2025-12-04T08:32:39.6662607Z  --- 2025-12-04T08:32:39.6663091Z  2025-12-04T08:32:39.6663677Z  # Opt-ins: 2025-12-04T08:32:39.6664438Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:32:39.6665721Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:32:39.6666954Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:32:39.6667852Z  # Experiments should be from the above list. 2025-12-04T08:32:39.6668590Z  2025-12-04T08:32:39.6669146Z  @User1,-lf,split_build 2025-12-04T08:32:39.6669792Z  @User2,lf 2025-12-04T08:32:39.6670329Z  @User3,split_build 2025-12-04T08:32:39.6755755Z """ 2025-12-04T08:32:39.6756367Z  2025-12-04T08:32:39.6756800Z import json 2025-12-04T08:32:39.6757317Z import logging 2025-12-04T08:32:39.6757815Z import os 2025-12-04T08:32:39.6758257Z import random 2025-12-04T08:32:39.6758707Z import re 2025-12-04T08:32:39.6759145Z import sys 2025-12-04T08:32:39.6759636Z from argparse import ArgumentParser 2025-12-04T08:32:39.6760351Z from collections.abc import Iterable 2025-12-04T08:32:39.6760984Z from functools import cache 2025-12-04T08:32:39.6761567Z from logging import LogRecord 2025-12-04T08:32:39.6762174Z from typing import Any, NamedTuple 2025-12-04T08:32:39.6762824Z from urllib.request import Request, urlopen 2025-12-04T08:32:39.6763446Z  2025-12-04T08:32:39.6763844Z import yaml 2025-12-04T08:32:39.6764327Z from github import Auth, Github 2025-12-04T08:32:39.6764913Z from github.Issue import Issue 2025-12-04T08:32:39.6765455Z  2025-12-04T08:32:39.6765833Z  2025-12-04T08:32:39.6766422Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:32:39.6767240Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:32:39.6768273Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:32:39.6769080Z  2025-12-04T08:32:39.6769804Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:32:39.6770480Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:32:39.6771107Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:32:39.6771782Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:32:39.6772380Z  2025-12-04T08:32:39.6772829Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:32:39.6773404Z  2025-12-04T08:32:39.6773827Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:32:39.6774407Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:32:39.6774942Z  2025-12-04T08:32:39.6775330Z  2025-12-04T08:32:39.6775758Z class Experiment(NamedTuple): 2025-12-04T08:32:39.6776771Z  rollout_perc: float = ( 2025-12-04T08:32:39.6777592Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:32:39.6778379Z  ) 2025-12-04T08:32:39.6778816Z  all_branches: bool = ( 2025-12-04T08:32:39.6779594Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:32:39.6780387Z  ) 2025-12-04T08:32:39.6780824Z  default: bool = ( 2025-12-04T08:32:39.6781519Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:32:39.6782263Z  ) 2025-12-04T08:32:39.6782669Z  2025-12-04T08:32:39.6783094Z  # Add more fields as needed 2025-12-04T08:32:39.6783656Z  2025-12-04T08:32:39.6784039Z  2025-12-04T08:32:39.6784466Z class Settings(NamedTuple): 2025-12-04T08:32:39.6785009Z  """ 2025-12-04T08:32:39.6785573Z  Settings for the experiments that can be opted into. 2025-12-04T08:32:39.6786391Z  """ 2025-12-04T08:32:39.6786808Z  2025-12-04T08:32:39.6787270Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:32:39.6787881Z  2025-12-04T08:32:39.6788409Z  2025-12-04T08:32:39.6788892Z class ColorFormatter(logging.Formatter): 2025-12-04T08:32:39.6789643Z  """Color codes the log messages based on the log level""" 2025-12-04T08:32:39.6790315Z  2025-12-04T08:32:39.6790707Z  COLORS = { 2025-12-04T08:32:39.6791200Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:32:39.6791793Z  "ERROR": "\033[31m", # Red 2025-12-04T08:32:39.6792378Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:32:39.6792969Z  "INFO": "\033[0m", # Reset 2025-12-04T08:32:39.6793552Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:32:39.6794095Z  } 2025-12-04T08:32:39.6794497Z  2025-12-04T08:32:39.6794968Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:32:39.6795841Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:32:39.6796994Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:32:39.6797673Z  return super().format(record) 2025-12-04T08:32:39.6798237Z  2025-12-04T08:32:39.6798612Z  2025-12-04T08:32:39.6799046Z handler = logging.StreamHandler() 2025-12-04T08:32:39.6799896Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:32:39.6800724Z  2025-12-04T08:32:39.6801239Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:32:39.6801932Z log.addHandler(handler) 2025-12-04T08:32:39.6802479Z log.setLevel(logging.INFO) 2025-12-04T08:32:39.6803011Z  2025-12-04T08:32:39.6803387Z  2025-12-04T08:32:39.6803902Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:32:39.6804565Z  """ 2025-12-04T08:32:39.6805174Z  Defines outputs of the github action that invokes this script 2025-12-04T08:32:39.6806154Z  """ 2025-12-04T08:32:39.6806595Z  if not GITHUB_OUTPUT: 2025-12-04T08:32:39.6807822Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:32:39.6809129Z  log.warning( 2025-12-04T08:32:39.6810125Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:32:39.6811189Z  ) 2025-12-04T08:32:39.6811704Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:32:39.6812352Z  return 2025-12-04T08:32:39.6812798Z  2025-12-04T08:32:39.6813244Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:32:39.6813923Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:32:39.6814584Z  f.write(f"{key}={value}\n") 2025-12-04T08:32:39.6815142Z  2025-12-04T08:32:39.6815518Z  2025-12-04T08:32:39.6816245Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:32:39.6817048Z  return frozenset( 2025-12-04T08:32:39.6817793Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:32:39.6818583Z  ) 2025-12-04T08:32:39.6818992Z  2025-12-04T08:32:39.6819373Z  2025-12-04T08:32:39.6819785Z def parse_args() -> Any: 2025-12-04T08:32:39.6820485Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:32:39.6821488Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:32:39.6822386Z  parser.add_argument( 2025-12-04T08:32:39.6822952Z  "--github-issue-repo", 2025-12-04T08:32:39.6823523Z  type=str, 2025-12-04T08:32:39.6824028Z  required=False, 2025-12-04T08:32:39.6824721Z  default="pytorch/test-infra", 2025-12-04T08:32:39.6825404Z  help="GitHub repo to get the issue", 2025-12-04T08:32:39.6826828Z  ) 2025-12-04T08:32:39.6827302Z  parser.add_argument( 2025-12-04T08:32:39.6827854Z  "--github-repo", 2025-12-04T08:32:39.6828390Z  type=str, 2025-12-04T08:32:39.6828890Z  required=True, 2025-12-04T08:32:39.6829466Z  help="GitHub repo where CI is running", 2025-12-04T08:32:39.6830073Z  ) 2025-12-04T08:32:39.6830506Z  parser.add_argument( 2025-12-04T08:32:39.6831245Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:32:39.6832001Z  ) 2025-12-04T08:32:39.6832439Z  parser.add_argument( 2025-12-04T08:32:39.6833193Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:32:39.6834008Z  ) 2025-12-04T08:32:39.6834455Z  parser.add_argument( 2025-12-04T08:32:39.6835225Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:32:39.6836167Z  ) 2025-12-04T08:32:39.6836609Z  parser.add_argument( 2025-12-04T08:32:39.6837412Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:32:39.6838236Z  ) 2025-12-04T08:32:39.6838700Z  parser.add_argument( 2025-12-04T08:32:39.6839258Z  "--github-ref-type", 2025-12-04T08:32:39.6839809Z  type=str, 2025-12-04T08:32:39.6840320Z  required=True, 2025-12-04T08:32:39.6840941Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:32:39.6841576Z  ) 2025-12-04T08:32:39.6842016Z  parser.add_argument( 2025-12-04T08:32:39.6842733Z  "--eligible-experiments", 2025-12-04T08:32:39.6843372Z  type=_str_comma_separated_to_set, 2025-12-04T08:32:39.6843988Z  required=False, 2025-12-04T08:32:39.6844511Z  default="", 2025-12-04T08:32:39.6845502Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:32:39.6846696Z  ) 2025-12-04T08:32:39.6847141Z  parser.add_argument( 2025-12-04T08:32:39.6847714Z  "--opt-out-experiments", 2025-12-04T08:32:39.6848340Z  type=_str_comma_separated_to_set, 2025-12-04T08:32:39.6848945Z  required=False, 2025-12-04T08:32:39.6849461Z  default="", 2025-12-04T08:32:39.6849955Z  help=( 2025-12-04T08:32:39.6850753Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:32:39.6852154Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:32:39.6853119Z  ), 2025-12-04T08:32:39.6853544Z  ) 2025-12-04T08:32:39.6853983Z  parser.add_argument( 2025-12-04T08:32:39.6854526Z  "--pr-number", 2025-12-04T08:32:39.6855052Z  type=str, 2025-12-04T08:32:39.6855546Z  required=False, 2025-12-04T08:32:39.6856232Z  default="", 2025-12-04T08:32:39.6856841Z  help="the optional PR number where this is run", 2025-12-04T08:32:39.6857485Z  ) 2025-12-04T08:32:39.6857888Z  2025-12-04T08:32:39.6858314Z  return parser.parse_args() 2025-12-04T08:32:39.6858872Z  2025-12-04T08:32:39.6859244Z  2025-12-04T08:32:39.6859924Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:32:39.6861298Z  auth = Auth.Token(github_token) 2025-12-04T08:32:39.6861937Z  return Github(auth=auth) 2025-12-04T08:32:39.6862479Z  2025-12-04T08:32:39.6862862Z  2025-12-04T08:32:39.6863607Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:32:39.6864546Z  repo = gh.get_repo(repo) 2025-12-04T08:32:39.6865158Z  return repo.get_issue(number=issue_num) 2025-12-04T08:32:39.6865767Z  2025-12-04T08:32:39.6866280Z  2025-12-04T08:32:39.6866707Z def get_potential_pr_author( 2025-12-04T08:32:39.6867486Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:32:39.6868265Z ) -> str: 2025-12-04T08:32:39.6868891Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:32:39.6869843Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:32:39.6870742Z  # embedded in the tag name: ciflow// 2025-12-04T08:32:39.6871402Z  2025-12-04T08:32:39.6871839Z  gh = get_gh_client(github_token) 2025-12-04T08:32:39.6872407Z  2025-12-04T08:32:39.6872937Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:32:39.6873673Z  split_tag = ref_name.split("/") 2025-12-04T08:32:39.6874260Z  if ( 2025-12-04T08:32:39.6874725Z  len(split_tag) == 3 2025-12-04T08:32:39.6875323Z  and split_tag[0] == "ciflow" 2025-12-04T08:32:39.6875937Z  and split_tag[2].isnumeric() 2025-12-04T08:32:39.6876633Z  ): 2025-12-04T08:32:39.6877117Z  pr_number = split_tag[2] 2025-12-04T08:32:39.6877693Z  try: 2025-12-04T08:32:39.6878232Z  repository = gh.get_repo(repo) 2025-12-04T08:32:39.6879102Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:32:39.6879834Z  except Exception as e: 2025-12-04T08:32:39.6880465Z  raise Exception( # noqa: TRY002 2025-12-04T08:32:39.6881263Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:32:39.6882020Z  ) from e 2025-12-04T08:32:39.6882682Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:32:39.6883528Z  # In all other cases, return the original input username 2025-12-04T08:32:39.6884227Z  return username 2025-12-04T08:32:39.6884718Z  2025-12-04T08:32:39.6885097Z  2025-12-04T08:32:39.6885590Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:32:39.6886320Z  """ 2025-12-04T08:32:39.6887086Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:32:39.6888017Z  """ 2025-12-04T08:32:39.6888649Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:32:39.6889420Z  2025-12-04T08:32:39.6889799Z  2025-12-04T08:32:39.6890253Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:32:39.6890839Z  try: 2025-12-04T08:32:39.6891315Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:32:39.6891917Z  return data 2025-12-04T08:32:39.6892442Z  except yaml.YAMLError: 2025-12-04T08:32:39.6893051Z  log.exception("Error loading YAML") 2025-12-04T08:32:39.6893647Z  raise 2025-12-04T08:32:39.6894096Z  2025-12-04T08:32:39.6894480Z  2025-12-04T08:32:39.6895178Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:32:39.6896138Z  """ 2025-12-04T08:32:39.6897010Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:32:39.6897903Z  2025-12-04T08:32:39.6898517Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:32:39.6899430Z  and the text below is the list of opted in users. 2025-12-04T08:32:39.6900064Z  2025-12-04T08:32:39.6900710Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:32:39.6901517Z  """ 2025-12-04T08:32:39.6902051Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:32:39.6902774Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:32:39.6903779Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:32:39.6904476Z  else: 2025-12-04T08:32:39.6904934Z  return "", rollout_state 2025-12-04T08:32:39.6905772Z  2025-12-04T08:32:39.6906332Z  2025-12-04T08:32:39.6906796Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:32:39.6907386Z  """ 2025-12-04T08:32:39.6907998Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:32:39.6908744Z  """ 2025-12-04T08:32:39.6909149Z  2025-12-04T08:32:39.6909531Z  2025-12-04T08:32:39.6910133Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:32:39.6910898Z  """ 2025-12-04T08:32:39.6911711Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:32:39.6912673Z  2025-12-04T08:32:39.6913566Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:32:39.6914722Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:32:39.6915682Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:32:39.6916554Z  2025-12-04T08:32:39.6916932Z  2025-12-04T08:32:39.6917312Z  """ 2025-12-04T08:32:39.6917746Z  optins = UserOptins() 2025-12-04T08:32:39.6918348Z  for user in user_optin_text.split("\n"): 2025-12-04T08:32:39.6918999Z  user = user.strip("\r\n\t -") 2025-12-04T08:32:39.6919655Z  if not user or not user.startswith("@"): 2025-12-04T08:32:39.6920304Z  # Not a valid user. Skip 2025-12-04T08:32:39.6920875Z  continue 2025-12-04T08:32:39.6921346Z  2025-12-04T08:32:39.6921739Z  if user: 2025-12-04T08:32:39.6922315Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:32:39.6923120Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:32:39.6923860Z  2025-12-04T08:32:39.6924259Z  return optins 2025-12-04T08:32:39.6924735Z  2025-12-04T08:32:39.6925101Z  2025-12-04T08:32:39.6925663Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:32:39.6926482Z  """ 2025-12-04T08:32:39.6926969Z  Check if the experiment name is valid. 2025-12-04T08:32:39.6927573Z  A valid name: 2025-12-04T08:32:39.6928336Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:32:39.6929429Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:32:39.6930253Z  - Cannot contain spaces 2025-12-04T08:32:39.6930802Z  """ 2025-12-04T08:32:39.6931201Z  2025-12-04T08:32:39.6931713Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:32:39.6932542Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:32:39.6933360Z  2025-12-04T08:32:39.6933753Z  if valid: 2025-12-04T08:32:39.6934312Z  return True 2025-12-04T08:32:39.6934940Z  2025-12-04T08:32:39.6935335Z  log.error( 2025-12-04T08:32:39.6937066Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:32:39.6938875Z  ) 2025-12-04T08:32:39.6939298Z  return False 2025-12-04T08:32:39.6939771Z  2025-12-04T08:32:39.6940147Z  2025-12-04T08:32:39.6940731Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:32:39.6941469Z  """ 2025-12-04T08:32:39.6942156Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:32:39.6942986Z  """ 2025-12-04T08:32:39.6943395Z  try: 2025-12-04T08:32:39.6943833Z  if settings_text: 2025-12-04T08:32:39.6944685Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:32:39.6945614Z  # for easy reading 2025-12-04T08:32:39.6946634Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:32:39.6947683Z  # the backtick character in shell commands. 2025-12-04T08:32:39.6948394Z  backtick = chr(96) # backtick character 2025-12-04T08:32:39.6949191Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:32:39.6949982Z  settings = load_yaml(settings_text) 2025-12-04T08:32:39.6950570Z  2025-12-04T08:32:39.6951250Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:32:39.6952298Z  experiments = {} 2025-12-04T08:32:39.6952825Z  2025-12-04T08:32:39.6953460Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:32:39.6954340Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:32:39.6955590Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:32:39.6956899Z  continue 2025-12-04T08:32:39.6957418Z  2025-12-04T08:32:39.6957840Z  valid_settings = {} 2025-12-04T08:32:39.6958461Z  for setting in exp_settings: 2025-12-04T08:32:39.6959126Z  if setting not in Experiment._fields: 2025-12-04T08:32:39.6959769Z  log.warning( 2025-12-04T08:32:39.6960598Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:32:39.6961414Z  ) 2025-12-04T08:32:39.6961919Z  else: 2025-12-04T08:32:39.6962542Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:32:39.6963193Z  2025-12-04T08:32:39.6963720Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:32:39.6964458Z  return Settings(experiments) 2025-12-04T08:32:39.6965031Z  2025-12-04T08:32:39.6965436Z  except Exception: 2025-12-04T08:32:39.6966125Z  log.exception("Failed to parse settings") 2025-12-04T08:32:39.6966745Z  2025-12-04T08:32:39.6967142Z  return Settings() 2025-12-04T08:32:39.6967627Z  2025-12-04T08:32:39.6967993Z  2025-12-04T08:32:39.6968632Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:32:39.6969295Z  """ 2025-12-04T08:32:39.6969815Z  Parse settings, if any, from the rollout state. 2025-12-04T08:32:39.6970450Z  2025-12-04T08:32:39.6971052Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:32:39.6971947Z  and the text below is the list of opted in users. 2025-12-04T08:32:39.6972575Z  2025-12-04T08:32:39.6973244Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:32:39.6974073Z  """ 2025-12-04T08:32:39.6974713Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:32:39.6975615Z  return parse_settings_from_text(settings_text) 2025-12-04T08:32:39.6976348Z  2025-12-04T08:32:39.6976724Z  2025-12-04T08:32:39.6977241Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:32:39.6977896Z  """ 2025-12-04T08:32:39.6978371Z  Parse users from the rollout state. 2025-12-04T08:32:39.6978951Z  2025-12-04T08:32:39.6979322Z  """ 2025-12-04T08:32:39.6979948Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:32:39.6980836Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:32:39.6981466Z  2025-12-04T08:32:39.6981848Z  2025-12-04T08:32:39.6982549Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:32:39.6983414Z  """ 2025-12-04T08:32:39.6983915Z  Check if a user is opted into an experiment 2025-12-04T08:32:39.6984535Z  """ 2025-12-04T08:32:39.6985082Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:32:39.6985756Z  2025-12-04T08:32:39.6986406Z  2025-12-04T08:32:39.6987133Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:32:39.6988017Z  """ 2025-12-04T08:32:39.6988571Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:32:39.6989255Z  """ 2025-12-04T08:32:39.6989863Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:32:39.6990677Z  experiment_optout = "-" + experiment_name 2025-12-04T08:32:39.6991437Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:32:39.6992130Z  return False 2025-12-04T08:32:39.6992605Z  2025-12-04T08:32:39.6993129Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:32:39.6993826Z  log.warning( 2025-12-04T08:32:39.6994772Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:32:39.6995789Z  ) 2025-12-04T08:32:39.6996308Z  2025-12-04T08:32:39.6996703Z  return True 2025-12-04T08:32:39.6997160Z  2025-12-04T08:32:39.6997530Z  2025-12-04T08:32:39.6997944Z def get_runner_prefix( 2025-12-04T08:32:39.6998475Z  rollout_state: str, 2025-12-04T08:32:39.6999049Z  workflow_requestors: Iterable[str], 2025-12-04T08:32:39.6999655Z  branch: str, 2025-12-04T08:32:39.7000255Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:32:39.7001061Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:32:39.7001738Z  is_canary: bool = False, 2025-12-04T08:32:39.7002279Z ) -> str: 2025-12-04T08:32:39.7002799Z  settings = parse_settings(rollout_state) 2025-12-04T08:32:39.7003490Z  user_optins = parse_users(rollout_state) 2025-12-04T08:32:39.7004105Z  2025-12-04T08:32:39.7004624Z  fleet_prefix = "" 2025-12-04T08:32:39.7005155Z  prefixes = [] 2025-12-04T08:32:39.7005909Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:32:39.7007108Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:32:39.7007936Z  log.info( 2025-12-04T08:32:39.7008728Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:32:39.7009594Z  ) 2025-12-04T08:32:39.7010065Z  continue 2025-12-04T08:32:39.7010543Z  2025-12-04T08:32:39.7010967Z  if opt_out_experiments: 2025-12-04T08:32:39.7011624Z  if experiment_name in opt_out_experiments: 2025-12-04T08:32:39.7012375Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:32:39.7013075Z  log.info( 2025-12-04T08:32:39.7014139Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:32:39.7015260Z  ) 2025-12-04T08:32:39.7015791Z  continue 2025-12-04T08:32:39.7016405Z  2025-12-04T08:32:39.7016832Z  if eligible_experiments: 2025-12-04T08:32:39.7017504Z  if experiment_name not in eligible_experiments: 2025-12-04T08:32:39.7018243Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:32:39.7018888Z  log.info( 2025-12-04T08:32:39.7019785Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:32:39.7020734Z  ) 2025-12-04T08:32:39.7021215Z  continue 2025-12-04T08:32:39.7021933Z  elif not experiment_settings.default: 2025-12-04T08:32:39.7022543Z  log.info( 2025-12-04T08:32:39.7023329Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:32:39.7024174Z  ) 2025-12-04T08:32:39.7024634Z  continue 2025-12-04T08:32:39.7025115Z  2025-12-04T08:32:39.7025647Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:32:39.7026474Z  opted_out_users = [ 2025-12-04T08:32:39.7027016Z  requestor 2025-12-04T08:32:39.7027582Z  for requestor in workflow_requestors 2025-12-04T08:32:39.7028366Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:32:39.7029083Z  ] 2025-12-04T08:32:39.7029507Z  2025-12-04T08:32:39.7029921Z  if opted_out_users: 2025-12-04T08:32:39.7030485Z  log.info( 2025-12-04T08:32:39.7031219Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:32:39.7032020Z  ) 2025-12-04T08:32:39.7032476Z  continue 2025-12-04T08:32:39.7032942Z  2025-12-04T08:32:39.7033467Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:32:39.7034173Z  opted_in_users = [ 2025-12-04T08:32:39.7034725Z  requestor 2025-12-04T08:32:39.7035299Z  for requestor in workflow_requestors 2025-12-04T08:32:39.7036186Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:32:39.7036910Z  ] 2025-12-04T08:32:39.7037322Z  2025-12-04T08:32:39.7037730Z  enabled = False 2025-12-04T08:32:39.7038259Z  if opted_in_users: 2025-12-04T08:32:39.7038926Z  log.info( 2025-12-04T08:32:39.7039667Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:32:39.7040451Z  ) 2025-12-04T08:32:39.7040918Z  enabled = True 2025-12-04T08:32:39.7041430Z  2025-12-04T08:32:39.7041898Z  elif experiment_settings.rollout_perc: 2025-12-04T08:32:39.7042849Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:32:39.7043933Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:32:39.7044681Z  log.info( 2025-12-04T08:32:39.7045700Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:32:39.7046875Z  ) 2025-12-04T08:32:39.7047374Z  enabled = True 2025-12-04T08:32:39.7047913Z  2025-12-04T08:32:39.7048307Z  if enabled: 2025-12-04T08:32:39.7048842Z  label = experiment_name 2025-12-04T08:32:39.7049496Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:32:39.7050438Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:32:39.7051486Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:32:39.7052367Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:32:39.7053127Z  if is_canary: 2025-12-04T08:32:39.7053729Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:32:39.7054369Z  fleet_prefix = label 2025-12-04T08:32:39.7054940Z  else: 2025-12-04T08:32:39.7055616Z  prefixes.append(label) 2025-12-04T08:32:39.7056308Z  2025-12-04T08:32:39.7056715Z  if len(prefixes) > 1: 2025-12-04T08:32:39.7057254Z  log.error( 2025-12-04T08:32:39.7058439Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:32:39.7059720Z  ) 2025-12-04T08:32:39.7060187Z  prefixes = prefixes[:1] 2025-12-04T08:32:39.7060731Z  2025-12-04T08:32:39.7061144Z  # Fleet always comes first 2025-12-04T08:32:39.7061707Z  if fleet_prefix: 2025-12-04T08:32:39.7062259Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:32:39.7062839Z  2025-12-04T08:32:39.7063344Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:32:39.7063986Z  2025-12-04T08:32:39.7064374Z  2025-12-04T08:32:39.7065084Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:32:39.7066066Z  """ 2025-12-04T08:32:39.7066752Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:32:39.7067558Z  2025-12-04T08:32:39.7068200Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:32:39.7068995Z  """ 2025-12-04T08:32:39.7069461Z  gh = get_gh_client(github_token) 2025-12-04T08:32:39.7070111Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:32:39.7070859Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:32:39.7071539Z  2025-12-04T08:32:39.7071913Z  2025-12-04T08:32:39.7072587Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:32:39.7073586Z  for _ in range(num_retries): 2025-12-04T08:32:39.7074225Z  try: 2025-12-04T08:32:39.7074745Z  req = Request(url=url, headers=headers) 2025-12-04T08:32:39.7075522Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:32:39.7076379Z  return json.loads(content) 2025-12-04T08:32:39.7076995Z  except Exception as e: 2025-12-04T08:32:39.7077650Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:32:39.7078280Z  2025-12-04T08:32:39.7078925Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:32:39.7079754Z  return {} 2025-12-04T08:32:39.7080199Z  2025-12-04T08:32:39.7080581Z  2025-12-04T08:32:39.7080962Z @cache 2025-12-04T08:32:39.7081698Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:32:39.7082574Z  """ 2025-12-04T08:32:39.7083047Z  Dynamically get PR information 2025-12-04T08:32:39.7083618Z  """ 2025-12-04T08:32:39.7084203Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:32:39.7084939Z  headers = { 2025-12-04T08:32:39.7085509Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:32:39.7086326Z  "Authorization": f"token {github_token}", 2025-12-04T08:32:39.7086927Z  } 2025-12-04T08:32:39.7087443Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:32:39.7088152Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:32:39.7088775Z  headers=headers, 2025-12-04T08:32:39.7089279Z  ) 2025-12-04T08:32:39.7089682Z  2025-12-04T08:32:39.7090155Z  if not json_response: 2025-12-04T08:32:39.7090849Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:32:39.7091706Z  return {} 2025-12-04T08:32:39.7092170Z  2025-12-04T08:32:39.7092586Z  return json_response 2025-12-04T08:32:39.7093095Z  2025-12-04T08:32:39.7093468Z  2025-12-04T08:32:39.7094127Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:32:39.7094959Z  """ 2025-12-04T08:32:39.7095582Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:32:39.7096451Z  """ 2025-12-04T08:32:39.7097027Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:32:39.7097726Z  return { 2025-12-04T08:32:39.7098417Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:32:39.7099201Z  } 2025-12-04T08:32:39.7099604Z  2025-12-04T08:32:39.7099981Z  2025-12-04T08:32:39.7100387Z def main() -> None: 2025-12-04T08:32:39.7100899Z  args = parse_args() 2025-12-04T08:32:39.7101400Z  2025-12-04T08:32:39.7101880Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:32:39.7102491Z  2025-12-04T08:32:39.7102913Z  # Check if the PR is opt-out 2025-12-04T08:32:39.7103486Z  if args.pr_number: 2025-12-04T08:32:39.7104267Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:32:39.7105142Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:32:39.7105714Z  log.info( 2025-12-04T08:32:39.7106629Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:32:39.7107501Z  ) 2025-12-04T08:32:39.7108167Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:32:39.7108946Z  sys.exit() 2025-12-04T08:32:39.7109570Z  2025-12-04T08:32:39.7109966Z  try: 2025-12-04T08:32:39.7110484Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:32:39.7111315Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:32:39.7112053Z  ) 2025-12-04T08:32:39.7112471Z  2025-12-04T08:32:39.7112915Z  username = get_potential_pr_author( 2025-12-04T08:32:39.7113538Z  args.github_token, 2025-12-04T08:32:39.7114108Z  args.github_repo, 2025-12-04T08:32:39.7114672Z  args.github_actor, 2025-12-04T08:32:39.7115255Z  args.github_ref_type, 2025-12-04T08:32:39.7115838Z  args.github_branch, 2025-12-04T08:32:39.7116489Z  ) 2025-12-04T08:32:39.7116899Z  2025-12-04T08:32:39.7117449Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:32:39.7118133Z  2025-12-04T08:32:39.7118602Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:32:39.7119231Z  rollout_state, 2025-12-04T08:32:39.7119819Z  (args.github_issue_owner, username), 2025-12-04T08:32:39.7120454Z  args.github_branch, 2025-12-04T08:32:39.7121047Z  args.eligible_experiments, 2025-12-04T08:32:39.7121679Z  args.opt_out_experiments, 2025-12-04T08:32:39.7122257Z  is_canary, 2025-12-04T08:32:39.7122755Z  ) 2025-12-04T08:32:39.7123168Z  2025-12-04T08:32:39.7123583Z  except Exception as e: 2025-12-04T08:32:39.7124134Z  log.error( 2025-12-04T08:32:39.7124934Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:32:39.7125813Z  ) 2025-12-04T08:32:39.7126476Z  2025-12-04T08:32:39.7127073Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:32:39.7127816Z  2025-12-04T08:32:39.7128195Z  2025-12-04T08:32:39.7128602Z if __name__ == "__main__": 2025-12-04T08:32:39.7129127Z  main() 2025-12-04T08:32:39.7129561Z  2025-12-04T08:32:39.7129937Z EOF 2025-12-04T08:32:39.7130328Z  2025-12-04T08:32:39.7130742Z cat runner_determinator.py 2025-12-04T08:32:39.7546773Z shell: /usr/bin/bash -e {0} 2025-12-04T08:32:39.7547665Z env: 2025-12-04T08:32:39.7548420Z GITHUB_TOKEN: *** 2025-12-04T08:32:39.7548909Z ISSUE_NUMBER: 5132 2025-12-04T08:32:39.7549421Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:32:39.7550005Z ISSUE_OWNER: 2025-12-04T08:32:39.7550461Z CHECK_EXPERIMENTS: 2025-12-04T08:32:39.7550958Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:32:39.7551449Z PR_NUMBER: 2025-12-04T08:32:39.7551911Z ##[endgroup] 2025-12-04T08:32:39.7756341Z # flake8: noqa: G004 2025-12-04T08:32:39.7756726Z 2025-12-04T08:32:39.7757194Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:32:39.7758171Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:32:39.7758982Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:32:39.7759434Z 2025-12-04T08:32:39.7759602Z """ 2025-12-04T08:32:39.7760238Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:32:39.7761151Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:32:39.7762070Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:32:39.7762892Z of which runners should be used to run which job. 2025-12-04T08:32:39.7763304Z 2025-12-04T08:32:39.7763690Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:32:39.7764821Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:32:39.7766587Z settings are considered to be empty with only the second part, the user 2025-12-04T08:32:39.7767867Z list, defined. 2025-12-04T08:32:39.7768355Z 2025-12-04T08:32:39.7769007Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:32:39.7770883Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:32:39.7772484Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:32:39.7773311Z 2025-12-04T08:32:39.7773995Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:32:39.7775490Z The user list is also a comma separated list of additional features or 2025-12-04T08:32:39.7777075Z experiments which the user could be opted in to. 2025-12-04T08:32:39.7777896Z 2025-12-04T08:32:39.7778522Z The user list has the following rules: 2025-12-04T08:32:39.7779214Z 2025-12-04T08:32:39.7779814Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:32:39.7781573Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:32:39.7783398Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:32:39.7784223Z 2025-12-04T08:32:39.7784534Z Example config: 2025-12-04T08:32:39.7785333Z # A list of experiments that can be opted into. 2025-12-04T08:32:39.7786866Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:32:39.7788102Z # Expected syntax is: 2025-12-04T08:32:39.7789287Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:32:39.7791111Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:32:39.7792341Z 2025-12-04T08:32:39.7792664Z experiments: 2025-12-04T08:32:39.7793364Z lf: 2025-12-04T08:32:39.7794025Z rollout_percent: 25 2025-12-04T08:32:39.7794845Z all_branches: false 2025-12-04T08:32:39.7796212Z default: true 2025-12-04T08:32:39.7797072Z --- 2025-12-04T08:32:39.7797495Z 2025-12-04T08:32:39.7797829Z # Opt-ins: 2025-12-04T08:32:39.7798940Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:32:39.7800421Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:32:39.7801243Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:32:39.7801946Z # Experiments should be from the above list. 2025-12-04T08:32:39.7802347Z 2025-12-04T08:32:39.7802540Z @User1,-lf,split_build 2025-12-04T08:32:39.7802989Z @User2,lf 2025-12-04T08:32:39.7803388Z @User3,split_build 2025-12-04T08:32:39.7803802Z """ 2025-12-04T08:32:39.7804002Z 2025-12-04T08:32:39.7804175Z import json 2025-12-04T08:32:39.7804553Z import logging 2025-12-04T08:32:39.7804944Z import os 2025-12-04T08:32:39.7805314Z import random 2025-12-04T08:32:39.7805699Z import re 2025-12-04T08:32:39.7806314Z import sys 2025-12-04T08:32:39.7806763Z from argparse import ArgumentParser 2025-12-04T08:32:39.7807304Z from collections.abc import Iterable 2025-12-04T08:32:39.7807841Z from functools import cache 2025-12-04T08:32:39.7808333Z from logging import LogRecord 2025-12-04T08:32:39.7808825Z from typing import Any, NamedTuple 2025-12-04T08:32:39.7809371Z from urllib.request import Request, urlopen 2025-12-04T08:32:39.7809746Z 2025-12-04T08:32:39.7809913Z import yaml 2025-12-04T08:32:39.7810310Z from github import Auth, Github 2025-12-04T08:32:39.7810804Z from github.Issue import Issue 2025-12-04T08:32:39.7811116Z 2025-12-04T08:32:39.7811122Z 2025-12-04T08:32:39.7811344Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:32:39.7812037Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:32:39.7812932Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:32:39.7813496Z 2025-12-04T08:32:39.7813733Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:32:39.7814479Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:32:39.7815023Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:32:39.7815585Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:32:39.7815947Z 2025-12-04T08:32:39.7816347Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:32:39.7816702Z 2025-12-04T08:32:39.7816901Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:32:39.7817378Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:32:39.7817665Z 2025-12-04T08:32:39.7817671Z 2025-12-04T08:32:39.7817867Z class Experiment(NamedTuple): 2025-12-04T08:32:39.7818388Z rollout_perc: float = ( 2025-12-04T08:32:39.7819048Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:32:39.7819728Z ) 2025-12-04T08:32:39.7820101Z all_branches: bool = ( 2025-12-04T08:32:39.7820742Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:32:39.7821435Z ) 2025-12-04T08:32:39.7821981Z default: bool = ( 2025-12-04T08:32:39.7822593Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:32:39.7823256Z ) 2025-12-04T08:32:39.7823450Z 2025-12-04T08:32:39.7823633Z # Add more fields as needed 2025-12-04T08:32:39.7823949Z 2025-12-04T08:32:39.7823955Z 2025-12-04T08:32:39.7824141Z class Settings(NamedTuple): 2025-12-04T08:32:39.7824584Z """ 2025-12-04T08:32:39.7825045Z Settings for the experiments that can be opted into. 2025-12-04T08:32:39.7825623Z """ 2025-12-04T08:32:39.7825831Z 2025-12-04T08:32:39.7826251Z experiments: dict[str, Experiment] = {} 2025-12-04T08:32:39.7826654Z 2025-12-04T08:32:39.7826661Z 2025-12-04T08:32:39.7826883Z class ColorFormatter(logging.Formatter): 2025-12-04T08:32:39.7827515Z """Color codes the log messages based on the log level""" 2025-12-04T08:32:39.7827962Z 2025-12-04T08:32:39.7828127Z COLORS = { 2025-12-04T08:32:39.7828531Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:32:39.7829218Z "ERROR": "\033[31m", # Red 2025-12-04T08:32:39.7829829Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:32:39.7830419Z "INFO": "\033[0m", # Reset 2025-12-04T08:32:39.7830945Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:32:39.7831422Z } 2025-12-04T08:32:39.7831619Z 2025-12-04T08:32:39.7831848Z def format(self, record: LogRecord) -> str: 2025-12-04T08:32:39.7832815Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:32:39.7833798Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:32:39.7834397Z return super().format(record) 2025-12-04T08:32:39.7834750Z 2025-12-04T08:32:39.7834756Z 2025-12-04T08:32:39.7834955Z handler = logging.StreamHandler() 2025-12-04T08:32:39.7835695Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:32:39.7836477Z 2025-12-04T08:32:39.7836736Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:32:39.7837335Z log.addHandler(handler) 2025-12-04T08:32:39.7837796Z log.setLevel(logging.INFO) 2025-12-04T08:32:39.7838094Z 2025-12-04T08:32:39.7838100Z 2025-12-04T08:32:39.7838355Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:32:39.7838920Z """ 2025-12-04T08:32:39.7839430Z Defines outputs of the github action that invokes this script 2025-12-04T08:32:39.7840078Z """ 2025-12-04T08:32:39.7840448Z if not GITHUB_OUTPUT: 2025-12-04T08:32:39.7841533Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:32:39.7842664Z log.warning( 2025-12-04T08:32:39.7843532Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:32:39.7844467Z ) 2025-12-04T08:32:39.7854789Z print(f"::set-output name={key}::{value}") 2025-12-04T08:32:39.7855429Z return 2025-12-04T08:32:39.7855670Z 2025-12-04T08:32:39.7856254Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:32:39.7856913Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:32:39.7857501Z f.write(f"{key}={value}\n") 2025-12-04T08:32:39.7857834Z 2025-12-04T08:32:39.7857842Z 2025-12-04T08:32:39.7858153Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:32:39.7858803Z return frozenset( 2025-12-04T08:32:39.7859436Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:32:39.7860135Z ) 2025-12-04T08:32:39.7860338Z 2025-12-04T08:32:39.7860345Z 2025-12-04T08:32:39.7860529Z def parse_args() -> Any: 2025-12-04T08:32:39.7861100Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:32:39.7861979Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:32:39.7862764Z parser.add_argument( 2025-12-04T08:32:39.7863227Z "--github-issue-repo", 2025-12-04T08:32:39.7863695Z type=str, 2025-12-04T08:32:39.7864110Z required=False, 2025-12-04T08:32:39.7864568Z default="pytorch/test-infra", 2025-12-04T08:32:39.7865114Z help="GitHub repo to get the issue", 2025-12-04T08:32:39.7865624Z ) 2025-12-04T08:32:39.7866149Z parser.add_argument( 2025-12-04T08:32:39.7866613Z "--github-repo", 2025-12-04T08:32:39.7867085Z type=str, 2025-12-04T08:32:39.7867484Z required=True, 2025-12-04T08:32:39.7867958Z help="GitHub repo where CI is running", 2025-12-04T08:32:39.7868492Z ) 2025-12-04T08:32:39.7868867Z parser.add_argument( 2025-12-04T08:32:39.7869489Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:32:39.7870160Z ) 2025-12-04T08:32:39.7870536Z parser.add_argument( 2025-12-04T08:32:39.7871163Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:32:39.7871851Z ) 2025-12-04T08:32:39.7872217Z parser.add_argument( 2025-12-04T08:32:39.7873037Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:32:39.7873741Z ) 2025-12-04T08:32:39.7874112Z parser.add_argument( 2025-12-04T08:32:39.7874776Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:32:39.7875519Z ) 2025-12-04T08:32:39.7875890Z parser.add_argument( 2025-12-04T08:32:39.7876521Z "--github-ref-type", 2025-12-04T08:32:39.7876985Z type=str, 2025-12-04T08:32:39.7877380Z required=True, 2025-12-04T08:32:39.7877884Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:32:39.7878439Z ) 2025-12-04T08:32:39.7878811Z parser.add_argument( 2025-12-04T08:32:39.7930302Z "--eligible-experiments", 2025-12-04T08:32:39.7931204Z type=_str_comma_separated_to_set, 2025-12-04T08:32:39.7931776Z required=False, 2025-12-04T08:32:39.7932200Z default="", 2025-12-04T08:32:39.7933095Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:32:39.7934028Z ) 2025-12-04T08:32:39.7934397Z parser.add_argument( 2025-12-04T08:32:39.7934864Z "--opt-out-experiments", 2025-12-04T08:32:39.7935374Z type=_str_comma_separated_to_set, 2025-12-04T08:32:39.7935913Z required=False, 2025-12-04T08:32:39.7936467Z default="", 2025-12-04T08:32:39.7936870Z help=( 2025-12-04T08:32:39.7937553Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:32:39.7938697Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:32:39.7939532Z ), 2025-12-04T08:32:39.7939887Z ) 2025-12-04T08:32:39.7940259Z parser.add_argument( 2025-12-04T08:32:39.7940699Z "--pr-number", 2025-12-04T08:32:39.7941116Z type=str, 2025-12-04T08:32:39.7941509Z required=False, 2025-12-04T08:32:39.7941936Z default="", 2025-12-04T08:32:39.7942586Z help="the optional PR number where this is run", 2025-12-04T08:32:39.7943163Z ) 2025-12-04T08:32:39.7943363Z 2025-12-04T08:32:39.7943555Z return parser.parse_args() 2025-12-04T08:32:39.7943878Z 2025-12-04T08:32:39.7943885Z 2025-12-04T08:32:39.7944292Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:32:39.7945062Z auth = Auth.Token(github_token) 2025-12-04T08:32:39.7945563Z return Github(auth=auth) 2025-12-04T08:32:39.7945869Z 2025-12-04T08:32:39.7945876Z 2025-12-04T08:32:39.7946496Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:32:39.7947299Z repo = gh.get_repo(repo) 2025-12-04T08:32:39.7947802Z return repo.get_issue(number=issue_num) 2025-12-04T08:32:39.7948163Z 2025-12-04T08:32:39.7948171Z 2025-12-04T08:32:39.7948365Z def get_potential_pr_author( 2025-12-04T08:32:39.7949008Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:32:39.7949690Z ) -> str: 2025-12-04T08:32:39.7950200Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:32:39.7951005Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:32:39.7951746Z # embedded in the tag name: ciflow// 2025-12-04T08:32:39.7952165Z 2025-12-04T08:32:39.7952354Z gh = get_gh_client(github_token) 2025-12-04T08:32:39.7952688Z 2025-12-04T08:32:39.7952956Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:32:39.7953571Z split_tag = ref_name.split("/") 2025-12-04T08:32:39.7954071Z if ( 2025-12-04T08:32:39.7954450Z len(split_tag) == 3 2025-12-04T08:32:39.7954931Z and split_tag[0] == "ciflow" 2025-12-04T08:32:39.7955454Z and split_tag[2].isnumeric() 2025-12-04T08:32:39.7955949Z ): 2025-12-04T08:32:39.7956462Z pr_number = split_tag[2] 2025-12-04T08:32:39.7957111Z try: 2025-12-04T08:32:39.7957561Z repository = gh.get_repo(repo) 2025-12-04T08:32:39.7958173Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:32:39.7958779Z except Exception as e: 2025-12-04T08:32:39.7959300Z raise Exception( # noqa: TRY002 2025-12-04T08:32:39.7959986Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:32:39.7960625Z ) from e 2025-12-04T08:32:39.7961165Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:32:39.7961868Z # In all other cases, return the original input username 2025-12-04T08:32:39.7962462Z return username 2025-12-04T08:32:39.7962701Z 2025-12-04T08:32:39.7962709Z 2025-12-04T08:32:39.7962940Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:32:39.7963473Z """ 2025-12-04T08:32:39.7964120Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:32:39.7964899Z """ 2025-12-04T08:32:39.7965448Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:32:39.7966084Z 2025-12-04T08:32:39.7966091Z 2025-12-04T08:32:39.7966297Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:32:39.7966790Z try: 2025-12-04T08:32:39.7967172Z data = yaml.safe_load(yaml_text) 2025-12-04T08:32:39.7967679Z return data 2025-12-04T08:32:39.7968095Z except yaml.YAMLError: 2025-12-04T08:32:39.7968576Z log.exception("Error loading YAML") 2025-12-04T08:32:39.7969089Z raise 2025-12-04T08:32:39.7969305Z 2025-12-04T08:32:39.7969312Z 2025-12-04T08:32:39.7969728Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:32:39.7970479Z """ 2025-12-04T08:32:39.7971105Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:32:39.7971707Z 2025-12-04T08:32:39.7972189Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:32:39.7972969Z and the text below is the list of opted in users. 2025-12-04T08:32:39.7973378Z 2025-12-04T08:32:39.7973756Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:32:39.7974463Z """ 2025-12-04T08:32:39.7974899Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:32:39.7975515Z if len(rollout_state_parts) >= 2: 2025-12-04T08:32:39.7976235Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:32:39.7976833Z else: 2025-12-04T08:32:39.7977217Z return "", rollout_state 2025-12-04T08:32:39.7977520Z 2025-12-04T08:32:39.7977527Z 2025-12-04T08:32:39.7977727Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:32:39.7978232Z """ 2025-12-04T08:32:39.7978751Z Dictionary of users with a list of features they have opted into 2025-12-04T08:32:39.7979405Z """ 2025-12-04T08:32:39.7979602Z 2025-12-04T08:32:39.7979615Z 2025-12-04T08:32:39.7979967Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:32:39.7980631Z """ 2025-12-04T08:32:39.7981358Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:32:39.7982043Z 2025-12-04T08:32:39.7982666Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:32:39.7983662Z - Example line: "@User1,lf,split_build" 2025-12-04T08:32:39.7984353Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:32:39.7984847Z 2025-12-04T08:32:39.7984855Z 2025-12-04T08:32:39.7985008Z """ 2025-12-04T08:32:39.7985385Z optins = UserOptins() 2025-12-04T08:32:39.7985873Z for user in user_optin_text.split("\n"): 2025-12-04T08:32:39.7986606Z user = user.strip("\r\n\t -") 2025-12-04T08:32:39.7987155Z if not user or not user.startswith("@"): 2025-12-04T08:32:39.7987921Z # Not a valid user. Skip 2025-12-04T08:32:39.7988418Z continue 2025-12-04T08:32:39.7988674Z 2025-12-04T08:32:39.7988834Z if user: 2025-12-04T08:32:39.7989280Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:32:39.7989987Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:32:39.7990487Z 2025-12-04T08:32:39.7990660Z return optins 2025-12-04T08:32:39.7990902Z 2025-12-04T08:32:39.7990909Z 2025-12-04T08:32:39.7991199Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:32:39.7991809Z """ 2025-12-04T08:32:39.7992203Z Check if the experiment name is valid. 2025-12-04T08:32:39.7992726Z A valid name: 2025-12-04T08:32:39.7993361Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:32:39.7994324Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:32:39.7995066Z - Cannot contain spaces 2025-12-04T08:32:39.7995527Z """ 2025-12-04T08:32:39.7995730Z 2025-12-04T08:32:39.7996108Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:32:39.7996836Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:32:39.7997299Z 2025-12-04T08:32:39.7997460Z if valid: 2025-12-04T08:32:39.7997839Z return True 2025-12-04T08:32:39.7998084Z 2025-12-04T08:32:39.7998245Z log.error( 2025-12-04T08:32:39.7999738Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:32:39.8001326Z ) 2025-12-04T08:32:39.8001689Z return False 2025-12-04T08:32:39.8001930Z 2025-12-04T08:32:39.8001937Z 2025-12-04T08:32:39.8002255Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:32:39.8002879Z """ 2025-12-04T08:32:39.8003617Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:32:39.8004356Z """ 2025-12-04T08:32:39.8004707Z try: 2025-12-04T08:32:39.8005079Z if settings_text: 2025-12-04T08:32:39.8005807Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:32:39.8006708Z # for easy reading 2025-12-04T08:32:39.8007497Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:32:39.8008393Z # the backtick character in shell commands. 2025-12-04T08:32:39.8009011Z backtick = chr(96) # backtick character 2025-12-04T08:32:39.8009682Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:32:39.8010339Z settings = load_yaml(settings_text) 2025-12-04T08:32:39.8010726Z 2025-12-04T08:32:39.8011143Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:32:39.8011904Z experiments = {} 2025-12-04T08:32:39.8012208Z 2025-12-04T08:32:39.8012593Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:32:39.8013376Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:32:39.8014508Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:32:39.8015566Z continue 2025-12-04T08:32:39.8015853Z 2025-12-04T08:32:39.8016127Z valid_settings = {} 2025-12-04T08:32:39.8016653Z for setting in exp_settings: 2025-12-04T08:32:39.8017227Z if setting not in Experiment._fields: 2025-12-04T08:32:39.8017783Z log.warning( 2025-12-04T08:32:39.8018520Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:32:39.8019394Z ) 2025-12-04T08:32:39.8019830Z else: 2025-12-04T08:32:39.8020347Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:32:39.8020780Z 2025-12-04T08:32:39.8021061Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:32:39.8021699Z return Settings(experiments) 2025-12-04T08:32:39.8022053Z 2025-12-04T08:32:39.8022228Z except Exception: 2025-12-04T08:32:39.8022718Z log.exception("Failed to parse settings") 2025-12-04T08:32:39.8023121Z 2025-12-04T08:32:39.8023300Z return Settings() 2025-12-04T08:32:39.8023559Z 2025-12-04T08:32:39.8023565Z 2025-12-04T08:32:39.8023815Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:32:39.8024391Z """ 2025-12-04T08:32:39.8024840Z Parse settings, if any, from the rollout state. 2025-12-04T08:32:39.8025248Z 2025-12-04T08:32:39.8025606Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:32:39.8026532Z and the text below is the list of opted in users. 2025-12-04T08:32:39.8026949Z 2025-12-04T08:32:39.8027368Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:32:39.8028103Z """ 2025-12-04T08:32:39.8028657Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:32:39.8029412Z return parse_settings_from_text(settings_text) 2025-12-04T08:32:39.8029824Z 2025-12-04T08:32:39.8029831Z 2025-12-04T08:32:39.8030080Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:32:39.8030705Z """ 2025-12-04T08:32:39.8031091Z Parse users from the rollout state. 2025-12-04T08:32:39.8031438Z 2025-12-04T08:32:39.8031595Z """ 2025-12-04T08:32:39.8032110Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:32:39.8032852Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:32:39.8033456Z 2025-12-04T08:32:39.8033463Z 2025-12-04T08:32:39.8034030Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:32:39.8034942Z """ 2025-12-04T08:32:39.8035366Z Check if a user is opted into an experiment 2025-12-04T08:32:39.8035903Z """ 2025-12-04T08:32:39.8036491Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:32:39.8036919Z 2025-12-04T08:32:39.8036926Z 2025-12-04T08:32:39.8037342Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:32:39.8038097Z """ 2025-12-04T08:32:39.8038553Z Check if a user explicitly opted out of an experiment 2025-12-04T08:32:39.8039191Z """ 2025-12-04T08:32:39.8039693Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:32:39.8040374Z experiment_optout = "-" + experiment_name 2025-12-04T08:32:39.8041014Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:32:39.8041611Z return False 2025-12-04T08:32:39.8041888Z 2025-12-04T08:32:39.8042168Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:32:39.8042778Z log.warning( 2025-12-04T08:32:39.8043585Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:32:39.8044468Z ) 2025-12-04T08:32:39.8044673Z 2025-12-04T08:32:39.8044836Z return True 2025-12-04T08:32:39.8045070Z 2025-12-04T08:32:39.8045076Z 2025-12-04T08:32:39.8045261Z def get_runner_prefix( 2025-12-04T08:32:39.8045697Z rollout_state: str, 2025-12-04T08:32:39.8046274Z workflow_requestors: Iterable[str], 2025-12-04T08:32:39.8046794Z branch: str, 2025-12-04T08:32:39.8047285Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:32:39.8047949Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:32:39.8048537Z is_canary: bool = False, 2025-12-04T08:32:39.8048996Z ) -> str: 2025-12-04T08:32:39.8049412Z settings = parse_settings(rollout_state) 2025-12-04T08:32:39.8050156Z user_optins = parse_users(rollout_state) 2025-12-04T08:32:39.8050531Z 2025-12-04T08:32:39.8050707Z fleet_prefix = "" 2025-12-04T08:32:39.8051134Z prefixes = [] 2025-12-04T08:32:39.8051763Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:32:39.8052718Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:32:39.8053428Z log.info( 2025-12-04T08:32:39.8054115Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:32:39.8054874Z ) 2025-12-04T08:32:39.8055254Z continue 2025-12-04T08:32:39.8055511Z 2025-12-04T08:32:39.8055699Z if opt_out_experiments: 2025-12-04T08:32:39.8056343Z if experiment_name in opt_out_experiments: 2025-12-04T08:32:39.8056991Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:32:39.8057584Z log.info( 2025-12-04T08:32:39.8058521Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:32:39.8059495Z ) 2025-12-04T08:32:39.8059887Z continue 2025-12-04T08:32:39.8060163Z 2025-12-04T08:32:39.8060360Z if eligible_experiments: 2025-12-04T08:32:39.8060945Z if experiment_name not in eligible_experiments: 2025-12-04T08:32:39.8061595Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:32:39.8062156Z log.info( 2025-12-04T08:32:39.8062944Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:32:39.8063781Z ) 2025-12-04T08:32:39.8064170Z continue 2025-12-04T08:32:39.8064646Z elif not experiment_settings.default: 2025-12-04T08:32:39.8065170Z log.info( 2025-12-04T08:32:39.8066111Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:32:39.8066898Z ) 2025-12-04T08:32:39.8067286Z continue 2025-12-04T08:32:39.8067534Z 2025-12-04T08:32:39.8067820Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:32:39.8068443Z opted_out_users = [ 2025-12-04T08:32:39.8068890Z requestor 2025-12-04T08:32:39.8069340Z for requestor in workflow_requestors 2025-12-04T08:32:39.8070012Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:32:39.8070635Z ] 2025-12-04T08:32:39.8070844Z 2025-12-04T08:32:39.8071022Z if opted_out_users: 2025-12-04T08:32:39.8071468Z log.info( 2025-12-04T08:32:39.8072090Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:32:39.8072795Z ) 2025-12-04T08:32:39.8073169Z continue 2025-12-04T08:32:39.8073421Z 2025-12-04T08:32:39.8073716Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:32:39.8074350Z opted_in_users = [ 2025-12-04T08:32:39.8074810Z requestor 2025-12-04T08:32:39.8075279Z for requestor in workflow_requestors 2025-12-04T08:32:39.8076074Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:32:39.8076716Z ] 2025-12-04T08:32:39.8076931Z 2025-12-04T08:32:39.8077106Z enabled = False 2025-12-04T08:32:39.8077550Z if opted_in_users: 2025-12-04T08:32:39.8077990Z log.info( 2025-12-04T08:32:39.8078608Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:32:39.8079311Z ) 2025-12-04T08:32:39.8079706Z enabled = True 2025-12-04T08:32:39.8079994Z 2025-12-04T08:32:39.8080212Z elif experiment_settings.rollout_perc: 2025-12-04T08:32:39.8081081Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:32:39.8082190Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:32:39.8082850Z log.info( 2025-12-04T08:32:39.8083738Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:32:39.8084679Z ) 2025-12-04T08:32:39.8085095Z enabled = True 2025-12-04T08:32:39.8085403Z 2025-12-04T08:32:39.8085571Z if enabled: 2025-12-04T08:32:39.8086110Z label = experiment_name 2025-12-04T08:32:39.8086676Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:32:39.8087545Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:32:39.8088442Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:32:39.8089216Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:32:39.8089896Z if is_canary: 2025-12-04T08:32:39.8090391Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:32:39.8090961Z fleet_prefix = label 2025-12-04T08:32:39.8091452Z else: 2025-12-04T08:32:39.8091888Z prefixes.append(label) 2025-12-04T08:32:39.8092239Z 2025-12-04T08:32:39.8092426Z if len(prefixes) > 1: 2025-12-04T08:32:39.8092867Z log.error( 2025-12-04T08:32:39.8093929Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:32:39.8095069Z ) 2025-12-04T08:32:39.8095459Z prefixes = prefixes[:1] 2025-12-04T08:32:39.8095772Z 2025-12-04T08:32:39.8096059Z # Fleet always comes first 2025-12-04T08:32:39.8096549Z if fleet_prefix: 2025-12-04T08:32:39.8096996Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:32:39.8097371Z 2025-12-04T08:32:39.8097767Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:32:39.8098211Z 2025-12-04T08:32:39.8098218Z 2025-12-04T08:32:39.8098688Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:32:39.8099476Z """ 2025-12-04T08:32:39.8100074Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:32:39.8100647Z 2025-12-04T08:32:39.8101041Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:32:39.8101766Z """ 2025-12-04T08:32:39.8102161Z gh = get_gh_client(github_token) 2025-12-04T08:32:39.8102708Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:32:39.8103353Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:32:39.8103810Z 2025-12-04T08:32:39.8103816Z 2025-12-04T08:32:39.8104217Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:32:39.8104994Z for _ in range(num_retries): 2025-12-04T08:32:39.8105477Z try: 2025-12-04T08:32:39.8105912Z req = Request(url=url, headers=headers) 2025-12-04T08:32:39.8106754Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:32:39.8107412Z return json.loads(content) 2025-12-04T08:32:39.8107963Z except Exception as e: 2025-12-04T08:32:39.8108502Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:32:39.8108917Z 2025-12-04T08:32:39.8109314Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:32:39.8110050Z return {} 2025-12-04T08:32:39.8110282Z 2025-12-04T08:32:39.8110288Z 2025-12-04T08:32:39.8110445Z @cache 2025-12-04T08:32:39.8111084Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:32:39.8111858Z """ 2025-12-04T08:32:39.8112263Z Dynamically get PR information 2025-12-04T08:32:39.8112752Z """ 2025-12-04T08:32:39.8113403Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:32:39.8114039Z headers = { 2025-12-04T08:32:39.8114506Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:32:39.8115124Z "Authorization": f"token {github_token}", 2025-12-04T08:32:39.8115667Z } 2025-12-04T08:32:39.8116590Z json_response: dict[str, Any] = download_json( 2025-12-04T08:32:39.8117231Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:32:39.8117798Z headers=headers, 2025-12-04T08:32:39.8118269Z ) 2025-12-04T08:32:39.8118474Z 2025-12-04T08:32:39.8118665Z if not json_response: 2025-12-04T08:32:39.8119255Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:32:39.8119887Z return {} 2025-12-04T08:32:39.8120129Z 2025-12-04T08:32:39.8120310Z return json_response 2025-12-04T08:32:39.8120596Z 2025-12-04T08:32:39.8120604Z 2025-12-04T08:32:39.8121013Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:32:39.8121776Z """ 2025-12-04T08:32:39.8122312Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:32:39.8122982Z """ 2025-12-04T08:32:39.8123475Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:32:39.8124104Z return { 2025-12-04T08:32:39.8124699Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:32:39.8125414Z } 2025-12-04T08:32:39.8125626Z 2025-12-04T08:32:39.8125633Z 2025-12-04T08:32:39.8125815Z def main() -> None: 2025-12-04T08:32:39.8126352Z args = parse_args() 2025-12-04T08:32:39.8126635Z 2025-12-04T08:32:39.8126867Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:32:39.8127263Z 2025-12-04T08:32:39.8127458Z # Check if the PR is opt-out 2025-12-04T08:32:39.8127956Z if args.pr_number: 2025-12-04T08:32:39.8128627Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:32:39.8129543Z if OPT_OUT_LABEL in labels: 2025-12-04T08:32:39.8130058Z log.info( 2025-12-04T08:32:39.8130765Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:32:39.8131547Z ) 2025-12-04T08:32:39.8132101Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:32:39.8132786Z sys.exit() 2025-12-04T08:32:39.8133054Z 2025-12-04T08:32:39.8133214Z try: 2025-12-04T08:32:39.8133662Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:32:39.8134377Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:32:39.8135032Z ) 2025-12-04T08:32:39.8135241Z 2025-12-04T08:32:39.8135459Z username = get_potential_pr_author( 2025-12-04T08:32:39.8136105Z args.github_token, 2025-12-04T08:32:39.8136599Z args.github_repo, 2025-12-04T08:32:39.8137076Z args.github_actor, 2025-12-04T08:32:39.8137571Z args.github_ref_type, 2025-12-04T08:32:39.8138071Z args.github_branch, 2025-12-04T08:32:39.8138537Z ) 2025-12-04T08:32:39.8138754Z 2025-12-04T08:32:39.8139044Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:32:39.8139508Z 2025-12-04T08:32:39.8139725Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:32:39.8140295Z rollout_state, 2025-12-04T08:32:39.8140782Z (args.github_issue_owner, username), 2025-12-04T08:32:39.8141343Z args.github_branch, 2025-12-04T08:32:39.8141841Z args.eligible_experiments, 2025-12-04T08:32:39.8142389Z args.opt_out_experiments, 2025-12-04T08:32:39.8142894Z is_canary, 2025-12-04T08:32:39.8143311Z ) 2025-12-04T08:32:39.8143517Z 2025-12-04T08:32:39.8143705Z except Exception as e: 2025-12-04T08:32:39.8144167Z log.error( 2025-12-04T08:32:39.8144849Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:32:39.8145785Z ) 2025-12-04T08:32:39.8146105Z 2025-12-04T08:32:39.8146455Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:32:39.8146970Z 2025-12-04T08:32:39.8146978Z 2025-12-04T08:32:39.8147160Z if __name__ == "__main__": 2025-12-04T08:32:39.8147607Z main() 2025-12-04T08:32:39.8147821Z 2025-12-04T08:32:39.8237929Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:32:39.8238837Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:32:39.8271384Z shell: /usr/bin/bash -e {0} 2025-12-04T08:32:39.8271875Z env: 2025-12-04T08:32:39.8272494Z GITHUB_TOKEN: *** 2025-12-04T08:32:39.8272916Z ISSUE_NUMBER: 5132 2025-12-04T08:32:39.8273356Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:32:39.8273871Z ISSUE_OWNER: 2025-12-04T08:32:39.8274281Z CHECK_EXPERIMENTS: 2025-12-04T08:32:39.8274720Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:32:39.8275152Z PR_NUMBER: 2025-12-04T08:32:39.8275548Z ##[endgroup] 2025-12-04T08:32:41.1155058Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:32:41.9753341Z Collecting urllib3==1.26.18 2025-12-04T08:32:42.0463731Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:32:42.0747910Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.3 MB/s eta 0:00:00 2025-12-04T08:32:42.1117194Z Collecting PyGithub==2.3.0 2025-12-04T08:32:42.1277544Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:32:42.1903913Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:32:42.2063323Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:32:42.2150864Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:32:42.2168980Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-12-04T08:32:42.2184139Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:32:42.2579571Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:32:42.2738040Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:32:42.2976758Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-12-04T08:32:42.4567459Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:32:42.4732361Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:32:42.6567442Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:32:42.6732396Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:32:42.7076358Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:32:42.7236795Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:32:42.7599637Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:32:42.7800061Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 7.4 MB/s eta 0:00:00 2025-12-04T08:32:42.7970198Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:32:42.8169100Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 19.0 MB/s eta 0:00:00 2025-12-04T08:32:42.8330417Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:32:42.8613438Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 52.3 MB/s eta 0:00:00 2025-12-04T08:32:42.8774781Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:32:42.8994179Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:32:42.9044271Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 68.5 MB/s eta 0:00:00 2025-12-04T08:32:42.9208440Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:32:42.9260220Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 35.7 MB/s eta 0:00:00 2025-12-04T08:32:42.9419047Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:32:42.9470936Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 30.0 MB/s eta 0:00:00 2025-12-04T08:32:43.2504130Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:32:43.7873779Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:32:43.8715573Z ##[group]Run curr_branch="main" 2025-12-04T08:32:43.8715886Z curr_branch="main" 2025-12-04T08:32:43.8716660Z curr_ref_type="branch" 2025-12-04T08:32:43.8716923Z echo "Current branch is '$curr_branch'" 2025-12-04T08:32:43.8717198Z  2025-12-04T08:32:43.8717386Z python3 runner_determinator.py \ 2025-12-04T08:32:43.8717676Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:32:43.8717957Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:32:43.8718216Z  --github-branch "$curr_branch" \ 2025-12-04T08:32:43.8718481Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:32:43.8718796Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:32:43.8719071Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:32:43.8719342Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:32:43.8719636Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:32:43.8719999Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:32:43.8720286Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:32:43.8754140Z shell: /usr/bin/bash -e {0} 2025-12-04T08:32:43.8754368Z env: 2025-12-04T08:32:43.8754925Z GITHUB_TOKEN: *** 2025-12-04T08:32:43.8755125Z ISSUE_NUMBER: 5132 2025-12-04T08:32:43.8755336Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:32:43.8755572Z ISSUE_OWNER: 2025-12-04T08:32:43.8755749Z CHECK_EXPERIMENTS: 2025-12-04T08:32:43.8755934Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:32:43.8756349Z PR_NUMBER: 2025-12-04T08:32:43.8756514Z ##[endgroup] 2025-12-04T08:32:43.8806332Z Current branch is 'main' 2025-12-04T08:32:45.4193297Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:32:45.4194271Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:32:45.4195439Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:32:45.4196381Z INFO : Setting output: label-type='' 2025-12-04T08:32:45.4515239Z Evaluate and set job outputs 2025-12-04T08:32:45.4522386Z Cleaning up orphan processes