2025-08-26T19:31:42.9377394Z Current runner version: '2.328.0' 2025-08-26T19:31:42.9404271Z ##[group]Runner Image Provisioner 2025-08-26T19:31:42.9405051Z Hosted Compute Agent 2025-08-26T19:31:42.9405733Z Version: 20250818.377 2025-08-26T19:31:42.9406598Z Commit: 3c593e9f75fe0b87e893bca80d6e12ba089c61fc 2025-08-26T19:31:42.9407345Z Build Date: 2025-08-18T14:52:18Z 2025-08-26T19:31:42.9408018Z ##[endgroup] 2025-08-26T19:31:42.9408600Z ##[group]Operating System 2025-08-26T19:31:42.9409150Z Ubuntu 2025-08-26T19:31:42.9409709Z 24.04.2 2025-08-26T19:31:42.9410157Z LTS 2025-08-26T19:31:42.9410631Z ##[endgroup] 2025-08-26T19:31:42.9411144Z ##[group]Runner Image 2025-08-26T19:31:42.9411766Z Image: ubuntu-24.04 2025-08-26T19:31:42.9412301Z Version: 20250818.1.0 2025-08-26T19:31:42.9413425Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:42.9415158Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:42.9416403Z ##[endgroup] 2025-08-26T19:31:42.9417380Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:42.9419743Z Metadata: read 2025-08-26T19:31:42.9420279Z ##[endgroup] 2025-08-26T19:31:42.9422678Z Secret source: Actions 2025-08-26T19:31:42.9423948Z Prepare workflow directory 2025-08-26T19:31:42.9930439Z Prepare all required actions 2025-08-26T19:31:42.9988726Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:42.9994025Z ##[group] Inputs 2025-08-26T19:31:42.9994689Z check_experiments: 2025-08-26T19:31:42.9995281Z opt_out_experiments: 2025-08-26T19:31:42.9995862Z triggering_actor: pytorchmergebot 2025-08-26T19:31:42.9996827Z issue_owner: 2025-08-26T19:31:42.9997371Z curr_branch: main 2025-08-26T19:31:42.9997900Z curr_ref_type: branch 2025-08-26T19:31:42.9998495Z issue_number: 5132 2025-08-26T19:31:42.9999152Z ##[endgroup] 2025-08-26T19:31:42.9999735Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:43.5204078Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:43.5206902Z cat < runner_determinator.py 2025-08-26T19:31:43.5207693Z # flake8: noqa: G004 2025-08-26T19:31:43.5208319Z  2025-08-26T19:31:43.5209253Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.5210513Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.5211658Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.5212447Z  2025-08-26T19:31:43.5213016Z """ 2025-08-26T19:31:43.5213814Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.5215018Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.5216598Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.5217803Z of which runners should be used to run which job. 2025-08-26T19:31:43.5218660Z  2025-08-26T19:31:43.5219460Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.5220718Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.5221936Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.5222964Z list, defined. 2025-08-26T19:31:43.5223552Z  2025-08-26T19:31:43.5224339Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.5225640Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.5227032Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.5227962Z  2025-08-26T19:31:43.5228825Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.5230235Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.5231336Z experiments which the user could be opted in to. 2025-08-26T19:31:43.5232117Z  2025-08-26T19:31:43.5232690Z The user list has the following rules: 2025-08-26T19:31:43.5233361Z  2025-08-26T19:31:43.5234230Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.5235422Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.5236563Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.5237426Z  2025-08-26T19:31:43.5237911Z Example config: 2025-08-26T19:31:43.5238596Z  # A list of experiments that can be opted into. 2025-08-26T19:31:43.5239647Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.5240510Z  # Expected syntax is: 2025-08-26T19:31:43.5241457Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.5242812Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.5243857Z  2025-08-26T19:31:43.5244334Z  experiments: 2025-08-26T19:31:43.5325028Z  lf: 2025-08-26T19:31:43.5325544Z  rollout_percent: 25 2025-08-26T19:31:43.5326138Z  all_branches: false 2025-08-26T19:31:43.5327021Z  default: true 2025-08-26T19:31:43.5327532Z  --- 2025-08-26T19:31:43.5327946Z  2025-08-26T19:31:43.5328339Z  # Opt-ins: 2025-08-26T19:31:43.5329078Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.5330375Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.5331351Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.5332145Z  # Experiments should be from the above list. 2025-08-26T19:31:43.5332809Z  2025-08-26T19:31:43.5333235Z  @User1,-lf,split_build 2025-08-26T19:31:43.5333810Z  @User2,lf 2025-08-26T19:31:43.5334331Z  @User3,split_build 2025-08-26T19:31:43.5334885Z """ 2025-08-26T19:31:43.5335317Z  2025-08-26T19:31:43.5335741Z import json 2025-08-26T19:31:43.5336475Z import logging 2025-08-26T19:31:43.5336980Z import os 2025-08-26T19:31:43.5337449Z import random 2025-08-26T19:31:43.5337946Z import re 2025-08-26T19:31:43.5338407Z import sys 2025-08-26T19:31:43.5338933Z from argparse import ArgumentParser 2025-08-26T19:31:43.5339687Z from collections.abc import Iterable 2025-08-26T19:31:43.5340345Z from functools import cache 2025-08-26T19:31:43.5340957Z from logging import LogRecord 2025-08-26T19:31:43.5341605Z from typing import Any, NamedTuple 2025-08-26T19:31:43.5342323Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.5343000Z  2025-08-26T19:31:43.5343427Z import yaml 2025-08-26T19:31:43.5343956Z from github import Auth, Github 2025-08-26T19:31:43.5344562Z from github.Issue import Issue 2025-08-26T19:31:43.5345117Z  2025-08-26T19:31:43.5345496Z  2025-08-26T19:31:43.5345984Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.5346940Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.5348002Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.5348831Z  2025-08-26T19:31:43.5349327Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.5350215Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.5350860Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.5351590Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.5352199Z  2025-08-26T19:31:43.5352639Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.5353233Z  2025-08-26T19:31:43.5353649Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.5354214Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.5354722Z  2025-08-26T19:31:43.5355095Z  2025-08-26T19:31:43.5355500Z class Experiment(NamedTuple): 2025-08-26T19:31:43.5356067Z  rollout_perc: float = ( 2025-08-26T19:31:43.5356944Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.5357701Z  ) 2025-08-26T19:31:43.5358125Z  all_branches: bool = ( 2025-08-26T19:31:43.5358881Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.5359642Z  ) 2025-08-26T19:31:43.5360065Z  default: bool = ( 2025-08-26T19:31:43.5360755Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.5361474Z  ) 2025-08-26T19:31:43.5361864Z  2025-08-26T19:31:43.5362271Z  # Add more fields as needed 2025-08-26T19:31:43.5362804Z  2025-08-26T19:31:43.5363219Z  2025-08-26T19:31:43.5363618Z class Settings(NamedTuple): 2025-08-26T19:31:43.5364147Z  """ 2025-08-26T19:31:43.5364686Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:43.5365328Z  """ 2025-08-26T19:31:43.5365733Z  2025-08-26T19:31:43.5366178Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.5367077Z  2025-08-26T19:31:43.5367603Z  2025-08-26T19:31:43.5368078Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.5368800Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.5369452Z  2025-08-26T19:31:43.5369837Z  COLORS = { 2025-08-26T19:31:43.5370373Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.5370947Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.5371515Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.5372092Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.5372643Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.5373174Z  } 2025-08-26T19:31:43.5373611Z  2025-08-26T19:31:43.5374078Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.5374928Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.5375793Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.5376574Z  return super().format(record) 2025-08-26T19:31:43.5377156Z  2025-08-26T19:31:43.5377530Z  2025-08-26T19:31:43.5377959Z handler = logging.StreamHandler() 2025-08-26T19:31:43.5378797Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.5379584Z  2025-08-26T19:31:43.5380097Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.5380755Z log.addHandler(handler) 2025-08-26T19:31:43.5381285Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.5381794Z  2025-08-26T19:31:43.5382156Z  2025-08-26T19:31:43.5382667Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.5383302Z  """ 2025-08-26T19:31:43.5383899Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.5384595Z  """ 2025-08-26T19:31:43.5385157Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:43.5386444Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:43.5387674Z  log.warning( 2025-08-26T19:31:43.5388651Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:43.5389655Z  ) 2025-08-26T19:31:43.5390163Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.5390765Z  return 2025-08-26T19:31:43.5391197Z  2025-08-26T19:31:43.5391629Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.5392278Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.5392921Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:43.5393455Z  2025-08-26T19:31:43.5393838Z  2025-08-26T19:31:43.5394412Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.5395140Z  return frozenset( 2025-08-26T19:31:43.5395871Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.5396721Z  ) 2025-08-26T19:31:43.5397127Z  2025-08-26T19:31:43.5397494Z  2025-08-26T19:31:43.5397898Z def parse_args() -> Any: 2025-08-26T19:31:43.5398564Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.5399540Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.5400389Z  parser.add_argument( 2025-08-26T19:31:43.5400930Z  "--github-issue-repo", 2025-08-26T19:31:43.5401480Z  type=str, 2025-08-26T19:31:43.5401967Z  required=False, 2025-08-26T19:31:43.5402644Z  default="pytorch/test-infra", 2025-08-26T19:31:43.5403273Z  help="GitHub repo to get the issue", 2025-08-26T19:31:43.5403845Z  ) 2025-08-26T19:31:43.5404268Z  parser.add_argument( 2025-08-26T19:31:43.5404795Z  "--github-repo", 2025-08-26T19:31:43.5405312Z  type=str, 2025-08-26T19:31:43.5405791Z  required=True, 2025-08-26T19:31:43.5406641Z  help="GitHub repo where CI is running", 2025-08-26T19:31:43.5407254Z  ) 2025-08-26T19:31:43.5407688Z  parser.add_argument( 2025-08-26T19:31:43.5408403Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.5409132Z  ) 2025-08-26T19:31:43.5409563Z  parser.add_argument( 2025-08-26T19:31:43.5410296Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.5411056Z  ) 2025-08-26T19:31:43.5411479Z  parser.add_argument( 2025-08-26T19:31:43.5412220Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.5412968Z  ) 2025-08-26T19:31:43.5413394Z  parser.add_argument( 2025-08-26T19:31:43.5414173Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.5414961Z  ) 2025-08-26T19:31:43.5415410Z  parser.add_argument( 2025-08-26T19:31:43.5415937Z  "--github-ref-type", 2025-08-26T19:31:43.5416708Z  type=str, 2025-08-26T19:31:43.5417191Z  required=True, 2025-08-26T19:31:43.5417789Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.5418406Z  ) 2025-08-26T19:31:43.5418830Z  parser.add_argument( 2025-08-26T19:31:43.5419379Z  "--eligible-experiments", 2025-08-26T19:31:43.5420140Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.5420724Z  required=False, 2025-08-26T19:31:43.5421233Z  default="", 2025-08-26T19:31:43.5422213Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.5423232Z  ) 2025-08-26T19:31:43.5423655Z  parser.add_argument( 2025-08-26T19:31:43.5424216Z  "--opt-out-experiments", 2025-08-26T19:31:43.5424816Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.5425401Z  required=False, 2025-08-26T19:31:43.5425906Z  default="", 2025-08-26T19:31:43.5426497Z  help=( 2025-08-26T19:31:43.5427277Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.5428529Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.5429446Z  ), 2025-08-26T19:31:43.5429861Z  ) 2025-08-26T19:31:43.5430279Z  parser.add_argument( 2025-08-26T19:31:43.5430813Z  "--pr-number", 2025-08-26T19:31:43.5431308Z  type=str, 2025-08-26T19:31:43.5431785Z  required=False, 2025-08-26T19:31:43.5432294Z  default="", 2025-08-26T19:31:43.5432871Z  help="the optional PR number where this is run", 2025-08-26T19:31:43.5433486Z  ) 2025-08-26T19:31:43.5433875Z  2025-08-26T19:31:43.5434294Z  return parser.parse_args() 2025-08-26T19:31:43.5434828Z  2025-08-26T19:31:43.5435200Z  2025-08-26T19:31:43.5435860Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.5436973Z  auth = Auth.Token(github_token) 2025-08-26T19:31:43.5437596Z  return Github(auth=auth) 2025-08-26T19:31:43.5438115Z  2025-08-26T19:31:43.5438494Z  2025-08-26T19:31:43.5439222Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.5440114Z  repo = gh.get_repo(repo) 2025-08-26T19:31:43.5440705Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.5441290Z  2025-08-26T19:31:43.5441653Z  2025-08-26T19:31:43.5442063Z def get_potential_pr_author( 2025-08-26T19:31:43.5442815Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.5443565Z ) -> str: 2025-08-26T19:31:43.5444174Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.5445075Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.5445932Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:43.5446893Z  2025-08-26T19:31:43.5447331Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.5447883Z  2025-08-26T19:31:43.5448400Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.5449108Z  split_tag = ref_name.split("/") 2025-08-26T19:31:43.5449700Z  if ( 2025-08-26T19:31:43.5450168Z  len(split_tag) == 3 2025-08-26T19:31:43.5450735Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:43.5451338Z  and split_tag[2].isnumeric() 2025-08-26T19:31:43.5451897Z  ): 2025-08-26T19:31:43.5452354Z  pr_number = split_tag[2] 2025-08-26T19:31:43.5452912Z  try: 2025-08-26T19:31:43.5453425Z  repository = gh.get_repo(repo) 2025-08-26T19:31:43.5454132Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.5454971Z  except Exception as e: 2025-08-26T19:31:43.5455577Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:43.5456442Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.5457164Z  ) from e 2025-08-26T19:31:43.5457802Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.5458590Z  # In all other cases, return the original input username 2025-08-26T19:31:43.5459249Z  return username 2025-08-26T19:31:43.5459717Z  2025-08-26T19:31:43.5460085Z  2025-08-26T19:31:43.5460553Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.5461144Z  """ 2025-08-26T19:31:43.5461884Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.5462738Z  """ 2025-08-26T19:31:43.5463366Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.5464103Z  2025-08-26T19:31:43.5464484Z  2025-08-26T19:31:43.5464915Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.5465465Z  try: 2025-08-26T19:31:43.5465933Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.5466600Z  return data 2025-08-26T19:31:43.5467101Z  except yaml.YAMLError: 2025-08-26T19:31:43.5467670Z  log.exception("Error loading YAML") 2025-08-26T19:31:43.5468247Z  raise 2025-08-26T19:31:43.5468678Z  2025-08-26T19:31:43.5469046Z  2025-08-26T19:31:43.5469730Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.5470540Z  """ 2025-08-26T19:31:43.5471374Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.5472200Z  2025-08-26T19:31:43.5472792Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.5473651Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.5474271Z  2025-08-26T19:31:43.5474902Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.5475660Z  """ 2025-08-26T19:31:43.5476284Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.5476946Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.5477634Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.5478270Z  else: 2025-08-26T19:31:43.5478830Z  return "", rollout_state 2025-08-26T19:31:43.5479476Z  2025-08-26T19:31:43.5479843Z  2025-08-26T19:31:43.5480294Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.5480851Z  """ 2025-08-26T19:31:43.5481445Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.5482134Z  """ 2025-08-26T19:31:43.5482529Z  2025-08-26T19:31:43.5482892Z  2025-08-26T19:31:43.5483474Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.5484180Z  """ 2025-08-26T19:31:43.5484972Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:43.5485852Z  2025-08-26T19:31:43.5487030Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:43.5488117Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.5488880Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.5489711Z  2025-08-26T19:31:43.5490073Z  2025-08-26T19:31:43.5490433Z  """ 2025-08-26T19:31:43.5490855Z  optins = UserOptins() 2025-08-26T19:31:43.5491431Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.5492048Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:43.5492660Z  if not user or not user.startswith("@"): 2025-08-26T19:31:43.5493274Z  # Not a valid user. Skip 2025-08-26T19:31:43.5493821Z  continue 2025-08-26T19:31:43.5494274Z  2025-08-26T19:31:43.5494654Z  if user: 2025-08-26T19:31:43.5495201Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.5495970Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.5497148Z  2025-08-26T19:31:43.5497551Z  return optins 2025-08-26T19:31:43.5498006Z  2025-08-26T19:31:43.5498368Z  2025-08-26T19:31:43.5498907Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.5499567Z  """ 2025-08-26T19:31:43.5500032Z  Check if the experiment name is valid. 2025-08-26T19:31:43.5500603Z  A valid name: 2025-08-26T19:31:43.5501341Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.5502353Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.5503128Z  - Cannot contain spaces 2025-08-26T19:31:43.5503642Z  """ 2025-08-26T19:31:43.5504032Z  2025-08-26T19:31:43.5504549Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.5505355Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.5506161Z  2025-08-26T19:31:43.5506692Z  if valid: 2025-08-26T19:31:43.5507150Z  return True 2025-08-26T19:31:43.5507604Z  2025-08-26T19:31:43.5507970Z  log.error( 2025-08-26T19:31:43.5509624Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:43.5511363Z  ) 2025-08-26T19:31:43.5511781Z  return False 2025-08-26T19:31:43.5512235Z  2025-08-26T19:31:43.5512609Z  2025-08-26T19:31:43.5513187Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.5513908Z  """ 2025-08-26T19:31:43.5514590Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.5515383Z  """ 2025-08-26T19:31:43.5515792Z  try: 2025-08-26T19:31:43.5516302Z  if settings_text: 2025-08-26T19:31:43.5517144Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:43.5518010Z  # for easy reading 2025-08-26T19:31:43.5518942Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.5519928Z  # the backtick character in shell commands. 2025-08-26T19:31:43.5520608Z  backtick = chr(96) # backtick character 2025-08-26T19:31:43.5521368Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.5522118Z  settings = load_yaml(settings_text) 2025-08-26T19:31:43.5522678Z  2025-08-26T19:31:43.5523338Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.5524325Z  experiments = {} 2025-08-26T19:31:43.5524837Z  2025-08-26T19:31:43.5525456Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.5526587Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.5527837Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:43.5528971Z  continue 2025-08-26T19:31:43.5529472Z  2025-08-26T19:31:43.5529879Z  valid_settings = {} 2025-08-26T19:31:43.5530480Z  for setting in exp_settings: 2025-08-26T19:31:43.5531122Z  if setting not in Experiment._fields: 2025-08-26T19:31:43.5531751Z  log.warning( 2025-08-26T19:31:43.5532569Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.5533340Z  ) 2025-08-26T19:31:43.5533842Z  else: 2025-08-26T19:31:43.5534452Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.5535083Z  2025-08-26T19:31:43.5535610Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.5536420Z  return Settings(experiments) 2025-08-26T19:31:43.5536975Z  2025-08-26T19:31:43.5537363Z  except Exception: 2025-08-26T19:31:43.5537939Z  log.exception("Failed to parse settings") 2025-08-26T19:31:43.5538516Z  2025-08-26T19:31:43.5538909Z  return Settings() 2025-08-26T19:31:43.5539380Z  2025-08-26T19:31:43.5539743Z  2025-08-26T19:31:43.5540392Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.5541039Z  """ 2025-08-26T19:31:43.5541544Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.5542144Z  2025-08-26T19:31:43.5542737Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.5543577Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.5544199Z  2025-08-26T19:31:43.5544852Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.5545639Z  """ 2025-08-26T19:31:43.5546370Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.5547207Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.5547790Z  2025-08-26T19:31:43.5548148Z  2025-08-26T19:31:43.5548650Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.5549264Z  """ 2025-08-26T19:31:43.5549747Z  Parse users from the rollout state. 2025-08-26T19:31:43.5550299Z  2025-08-26T19:31:43.5550668Z  """ 2025-08-26T19:31:43.5551274Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.5552091Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.5552685Z  2025-08-26T19:31:43.5553047Z  2025-08-26T19:31:43.5553723Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.5554520Z  """ 2025-08-26T19:31:43.5555000Z  Check if a user is opted into an experiment 2025-08-26T19:31:43.5555580Z  """ 2025-08-26T19:31:43.5556100Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.5556820Z  2025-08-26T19:31:43.5557183Z  2025-08-26T19:31:43.5558000Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.5558813Z  """ 2025-08-26T19:31:43.5559345Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.5559974Z  """ 2025-08-26T19:31:43.5560543Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.5561310Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.5562015Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.5562681Z  return False 2025-08-26T19:31:43.5563137Z  2025-08-26T19:31:43.5563651Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.5564307Z  log.warning( 2025-08-26T19:31:43.5565210Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.5566148Z  ) 2025-08-26T19:31:43.5566661Z  2025-08-26T19:31:43.5567051Z  return True 2025-08-26T19:31:43.5567490Z  2025-08-26T19:31:43.5567860Z  2025-08-26T19:31:43.5568265Z def get_runner_prefix( 2025-08-26T19:31:43.5568768Z  rollout_state: str, 2025-08-26T19:31:43.5569316Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:43.5569880Z  branch: str, 2025-08-26T19:31:43.5570470Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.5571221Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.5571865Z  is_canary: bool = False, 2025-08-26T19:31:43.5572373Z ) -> str: 2025-08-26T19:31:43.5572870Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:43.5573518Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.5574082Z  2025-08-26T19:31:43.5574601Z  fleet_prefix = "" 2025-08-26T19:31:43.5575096Z  prefixes = [] 2025-08-26T19:31:43.5575832Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.5576975Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.5577757Z  log.info( 2025-08-26T19:31:43.5578533Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.5579348Z  ) 2025-08-26T19:31:43.5579802Z  continue 2025-08-26T19:31:43.5580252Z  2025-08-26T19:31:43.5580656Z  if opt_out_experiments: 2025-08-26T19:31:43.5581271Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.5582004Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.5582659Z  log.info( 2025-08-26T19:31:43.5583702Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.5584789Z  ) 2025-08-26T19:31:43.5585257Z  continue 2025-08-26T19:31:43.5585752Z  2025-08-26T19:31:43.5586166Z  if eligible_experiments: 2025-08-26T19:31:43.5586918Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.5587686Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.5588307Z  log.info( 2025-08-26T19:31:43.5589219Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.5590151Z  ) 2025-08-26T19:31:43.5590616Z  continue 2025-08-26T19:31:43.5591320Z  elif not experiment_settings.default: 2025-08-26T19:31:43.5591910Z  log.info( 2025-08-26T19:31:43.5592682Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.5593498Z  ) 2025-08-26T19:31:43.5593937Z  continue 2025-08-26T19:31:43.5594393Z  2025-08-26T19:31:43.5594916Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.5595613Z  opted_out_users = [ 2025-08-26T19:31:43.5596137Z  requestor 2025-08-26T19:31:43.5596797Z  for requestor in workflow_requestors 2025-08-26T19:31:43.5597559Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.5598271Z  ] 2025-08-26T19:31:43.5598675Z  2025-08-26T19:31:43.5599079Z  if opted_out_users: 2025-08-26T19:31:43.5599629Z  log.info( 2025-08-26T19:31:43.5600373Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.5601159Z  ) 2025-08-26T19:31:43.5601606Z  continue 2025-08-26T19:31:43.5602072Z  2025-08-26T19:31:43.5602590Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.5603283Z  opted_in_users = [ 2025-08-26T19:31:43.5603828Z  requestor 2025-08-26T19:31:43.5604383Z  for requestor in workflow_requestors 2025-08-26T19:31:43.5605155Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.5605854Z  ] 2025-08-26T19:31:43.5606357Z  2025-08-26T19:31:43.5606749Z  enabled = False 2025-08-26T19:31:43.5607266Z  if opted_in_users: 2025-08-26T19:31:43.5607923Z  log.info( 2025-08-26T19:31:43.5608642Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.5609400Z  ) 2025-08-26T19:31:43.5609846Z  enabled = True 2025-08-26T19:31:43.5610347Z  2025-08-26T19:31:43.5610796Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.5611741Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.5612801Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.5613534Z  log.info( 2025-08-26T19:31:43.5614537Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.5615607Z  ) 2025-08-26T19:31:43.5616091Z  enabled = True 2025-08-26T19:31:43.5616724Z  2025-08-26T19:31:43.5617118Z  if enabled: 2025-08-26T19:31:43.5617623Z  label = experiment_name 2025-08-26T19:31:43.5618261Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.5619193Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.5620175Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.5621040Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.5621778Z  if is_canary: 2025-08-26T19:31:43.5622361Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.5622980Z  fleet_prefix = label 2025-08-26T19:31:43.5623534Z  else: 2025-08-26T19:31:43.5624053Z  prefixes.append(label) 2025-08-26T19:31:43.5624733Z  2025-08-26T19:31:43.5625134Z  if len(prefixes) > 1: 2025-08-26T19:31:43.5625647Z  log.error( 2025-08-26T19:31:43.5626953Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:43.5628211Z  ) 2025-08-26T19:31:43.5628660Z  prefixes = prefixes[:1] 2025-08-26T19:31:43.5629193Z  2025-08-26T19:31:43.5629597Z  # Fleet always comes first 2025-08-26T19:31:43.5630148Z  if fleet_prefix: 2025-08-26T19:31:43.5630677Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.5631249Z  2025-08-26T19:31:43.5631742Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.5632373Z  2025-08-26T19:31:43.5632738Z  2025-08-26T19:31:43.5633453Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.5634322Z  """ 2025-08-26T19:31:43.5634982Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.5635751Z  2025-08-26T19:31:43.5636481Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.5637252Z  """ 2025-08-26T19:31:43.5637701Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.5638323Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.5639043Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.5639690Z  2025-08-26T19:31:43.5640065Z  2025-08-26T19:31:43.5640714Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.5641671Z  for _ in range(num_retries): 2025-08-26T19:31:43.5642232Z  try: 2025-08-26T19:31:43.5642729Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:43.5643461Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.5644170Z  return json.loads(content) 2025-08-26T19:31:43.5644754Z  except Exception as e: 2025-08-26T19:31:43.5645378Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.5645982Z  2025-08-26T19:31:43.5646728Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.5647505Z  return {} 2025-08-26T19:31:43.5648019Z  2025-08-26T19:31:43.5648376Z  2025-08-26T19:31:43.5648748Z @cache 2025-08-26T19:31:43.5649476Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.5650299Z  """ 2025-08-26T19:31:43.5650749Z  Dynamically get PR information 2025-08-26T19:31:43.5651291Z  """ 2025-08-26T19:31:43.5651858Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.5652543Z  headers = { 2025-08-26T19:31:43.5653081Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.5653757Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:43.5654342Z  } 2025-08-26T19:31:43.5654828Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.5655542Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.5656148Z  headers=headers, 2025-08-26T19:31:43.5656729Z  ) 2025-08-26T19:31:43.5657121Z  2025-08-26T19:31:43.5657511Z  if not json_response: 2025-08-26T19:31:43.5658171Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.5658989Z  return {} 2025-08-26T19:31:43.5659446Z  2025-08-26T19:31:43.5659834Z  return json_response 2025-08-26T19:31:43.5660345Z  2025-08-26T19:31:43.5660713Z  2025-08-26T19:31:43.5661357Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.5662145Z  """ 2025-08-26T19:31:43.5662746Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.5663458Z  """ 2025-08-26T19:31:43.5664004Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.5664681Z  return { 2025-08-26T19:31:43.5665348Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.5666088Z  } 2025-08-26T19:31:43.5666580Z  2025-08-26T19:31:43.5666949Z  2025-08-26T19:31:43.5667345Z def main() -> None: 2025-08-26T19:31:43.5667839Z  args = parse_args() 2025-08-26T19:31:43.5668322Z  2025-08-26T19:31:43.5668778Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.5669361Z  2025-08-26T19:31:43.5669770Z  # Check if the PR is opt-out 2025-08-26T19:31:43.5670321Z  if args.pr_number: 2025-08-26T19:31:43.5671075Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.5671895Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.5672456Z  log.info( 2025-08-26T19:31:43.5673247Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.5674073Z  ) 2025-08-26T19:31:43.5674720Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.5675460Z  sys.exit() 2025-08-26T19:31:43.5676060Z  2025-08-26T19:31:43.5676534Z  try: 2025-08-26T19:31:43.5677040Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.5677824Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.5678521Z  ) 2025-08-26T19:31:43.5678918Z  2025-08-26T19:31:43.5679355Z  username = get_potential_pr_author( 2025-08-26T19:31:43.5679955Z  args.github_token, 2025-08-26T19:31:43.5680507Z  args.github_repo, 2025-08-26T19:31:43.5681047Z  args.github_actor, 2025-08-26T19:31:43.5681593Z  args.github_ref_type, 2025-08-26T19:31:43.5682157Z  args.github_branch, 2025-08-26T19:31:43.5682663Z  ) 2025-08-26T19:31:43.5683064Z  2025-08-26T19:31:43.5683589Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.5684242Z  2025-08-26T19:31:43.5684701Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.5685304Z  rollout_state, 2025-08-26T19:31:43.5685878Z  (args.github_issue_owner, username), 2025-08-26T19:31:43.5686569Z  args.github_branch, 2025-08-26T19:31:43.5687149Z  args.eligible_experiments, 2025-08-26T19:31:43.5687746Z  args.opt_out_experiments, 2025-08-26T19:31:43.5688304Z  is_canary, 2025-08-26T19:31:43.5688783Z  ) 2025-08-26T19:31:43.5689190Z  2025-08-26T19:31:43.5689604Z  except Exception as e: 2025-08-26T19:31:43.5690122Z  log.error( 2025-08-26T19:31:43.5690898Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.5691715Z  ) 2025-08-26T19:31:43.5692133Z  2025-08-26T19:31:43.5692842Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.5693556Z  2025-08-26T19:31:43.5693929Z  2025-08-26T19:31:43.5694320Z if __name__ == "__main__": 2025-08-26T19:31:43.5694840Z  main() 2025-08-26T19:31:43.5695246Z  2025-08-26T19:31:43.5695612Z EOF 2025-08-26T19:31:43.5695989Z  2025-08-26T19:31:43.5696511Z cat runner_determinator.py 2025-08-26T19:31:43.6033118Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.6034215Z env: 2025-08-26T19:31:43.6035268Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.6035968Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.6036820Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.6037583Z ISSUE_OWNER: 2025-08-26T19:31:43.6038172Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.6038809Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.6039442Z PR_NUMBER: 2025-08-26T19:31:43.6040001Z ##[endgroup] 2025-08-26T19:31:43.6262904Z # flake8: noqa: G004 2025-08-26T19:31:43.6263290Z 2025-08-26T19:31:43.6263822Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.6265038Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.6266049Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.6266871Z 2025-08-26T19:31:43.6267049Z """ 2025-08-26T19:31:43.6267716Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.6268737Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.6269804Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.6270749Z of which runners should be used to run which job. 2025-08-26T19:31:43.6271221Z 2025-08-26T19:31:43.6271660Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.6272906Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.6273962Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.6274791Z list, defined. 2025-08-26T19:31:43.6275044Z 2025-08-26T19:31:43.6275471Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.6276750Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.6277715Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.6278237Z 2025-08-26T19:31:43.6278663Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.6279678Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.6280527Z experiments which the user could be opted in to. 2025-08-26T19:31:43.6280995Z 2025-08-26T19:31:43.6281222Z The user list has the following rules: 2025-08-26T19:31:43.6281624Z 2025-08-26T19:31:43.6281982Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.6282996Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.6283894Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.6284356Z 2025-08-26T19:31:43.6284542Z Example config: 2025-08-26T19:31:43.6285052Z # A list of experiments that can be opted into. 2025-08-26T19:31:43.6285820Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.6286731Z # Expected syntax is: 2025-08-26T19:31:43.6287462Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.6288613Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.6289346Z 2025-08-26T19:31:43.6289537Z experiments: 2025-08-26T19:31:43.6289966Z lf: 2025-08-26T19:31:43.6290386Z rollout_percent: 25 2025-08-26T19:31:43.6290900Z all_branches: false 2025-08-26T19:31:43.6291565Z default: true 2025-08-26T19:31:43.6292014Z --- 2025-08-26T19:31:43.6292241Z 2025-08-26T19:31:43.6292421Z # Opt-ins: 2025-08-26T19:31:43.6293074Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.6294094Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.6295002Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.6295798Z # Experiments should be from the above list. 2025-08-26T19:31:43.6296453Z 2025-08-26T19:31:43.6296675Z @User1,-lf,split_build 2025-08-26T19:31:43.6297169Z @User2,lf 2025-08-26T19:31:43.6297601Z @User3,split_build 2025-08-26T19:31:43.6298059Z """ 2025-08-26T19:31:43.6298280Z 2025-08-26T19:31:43.6298463Z import json 2025-08-26T19:31:43.6298877Z import logging 2025-08-26T19:31:43.6299350Z import os 2025-08-26T19:31:43.6299755Z import random 2025-08-26T19:31:43.6300177Z import re 2025-08-26T19:31:43.6300577Z import sys 2025-08-26T19:31:43.6301038Z from argparse import ArgumentParser 2025-08-26T19:31:43.6301654Z from collections.abc import Iterable 2025-08-26T19:31:43.6302250Z from functools import cache 2025-08-26T19:31:43.6302790Z from logging import LogRecord 2025-08-26T19:31:43.6303345Z from typing import Any, NamedTuple 2025-08-26T19:31:43.6303959Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.6304391Z 2025-08-26T19:31:43.6304574Z import yaml 2025-08-26T19:31:43.6305018Z from github import Auth, Github 2025-08-26T19:31:43.6305576Z from github.Issue import Issue 2025-08-26T19:31:43.6305936Z 2025-08-26T19:31:43.6305942Z 2025-08-26T19:31:43.6306339Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.6307194Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.6308207Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.6308894Z 2025-08-26T19:31:43.6309155Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.6309960Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.6310554Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.6311180Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.6311598Z 2025-08-26T19:31:43.6311814Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.6312199Z 2025-08-26T19:31:43.6312410Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.6312929Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.6313249Z 2025-08-26T19:31:43.6313264Z 2025-08-26T19:31:43.6313474Z class Experiment(NamedTuple): 2025-08-26T19:31:43.6314014Z rollout_perc: float = ( 2025-08-26T19:31:43.6314753Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.6315553Z ) 2025-08-26T19:31:43.6315965Z all_branches: bool = ( 2025-08-26T19:31:43.6316865Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.6317653Z ) 2025-08-26T19:31:43.6318055Z default: bool = ( 2025-08-26T19:31:43.6318710Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.6319464Z ) 2025-08-26T19:31:43.6319678Z 2025-08-26T19:31:43.6319876Z # Add more fields as needed 2025-08-26T19:31:43.6320229Z 2025-08-26T19:31:43.6320235Z 2025-08-26T19:31:43.6320440Z class Settings(NamedTuple): 2025-08-26T19:31:43.6320946Z """ 2025-08-26T19:31:43.6321455Z Settings for the experiments that can be opted into. 2025-08-26T19:31:43.6322124Z """ 2025-08-26T19:31:43.6322343Z 2025-08-26T19:31:43.6322578Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.6323003Z 2025-08-26T19:31:43.6323015Z 2025-08-26T19:31:43.6323248Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.6323968Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.6324488Z 2025-08-26T19:31:43.6324667Z COLORS = { 2025-08-26T19:31:43.6325111Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.6325692Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.6326598Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.6327188Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.6327735Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.6328258Z } 2025-08-26T19:31:43.6328474Z 2025-08-26T19:31:43.6328719Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.6329586Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.6330500Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.6331176Z return super().format(record) 2025-08-26T19:31:43.6331562Z 2025-08-26T19:31:43.6331568Z 2025-08-26T19:31:43.6331784Z handler = logging.StreamHandler() 2025-08-26T19:31:43.6332605Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.6333279Z 2025-08-26T19:31:43.6333551Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.6334233Z log.addHandler(handler) 2025-08-26T19:31:43.6334734Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.6335073Z 2025-08-26T19:31:43.6335080Z 2025-08-26T19:31:43.6335358Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.6336019Z """ 2025-08-26T19:31:43.6336783Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.6337522Z """ 2025-08-26T19:31:43.6337929Z if not GITHUB_OUTPUT: 2025-08-26T19:31:43.6339214Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:43.6340569Z log.warning( 2025-08-26T19:31:43.6341566Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:43.6342677Z ) 2025-08-26T19:31:43.6352791Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.6353496Z return 2025-08-26T19:31:43.6353761Z 2025-08-26T19:31:43.6354190Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.6354900Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.6355567Z f.write(f"{key}={value}\n") 2025-08-26T19:31:43.6355954Z 2025-08-26T19:31:43.6355961Z 2025-08-26T19:31:43.6356548Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.6357308Z return frozenset( 2025-08-26T19:31:43.6358008Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.6358820Z ) 2025-08-26T19:31:43.6359036Z 2025-08-26T19:31:43.6359043Z 2025-08-26T19:31:43.6359245Z def parse_args() -> Any: 2025-08-26T19:31:43.6359873Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.6360896Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.6361819Z parser.add_argument( 2025-08-26T19:31:43.6362339Z "--github-issue-repo", 2025-08-26T19:31:43.6362859Z type=str, 2025-08-26T19:31:43.6363317Z required=False, 2025-08-26T19:31:43.6363828Z default="pytorch/test-infra", 2025-08-26T19:31:43.6364440Z help="GitHub repo to get the issue", 2025-08-26T19:31:43.6365027Z ) 2025-08-26T19:31:43.6365448Z parser.add_argument( 2025-08-26T19:31:43.6365941Z "--github-repo", 2025-08-26T19:31:43.6366589Z type=str, 2025-08-26T19:31:43.6367008Z required=True, 2025-08-26T19:31:43.6367516Z help="GitHub repo where CI is running", 2025-08-26T19:31:43.6368093Z ) 2025-08-26T19:31:43.6368494Z parser.add_argument( 2025-08-26T19:31:43.6369162Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.6369899Z ) 2025-08-26T19:31:43.6370305Z parser.add_argument( 2025-08-26T19:31:43.6370991Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.6371747Z ) 2025-08-26T19:31:43.6372130Z parser.add_argument( 2025-08-26T19:31:43.6372833Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.6373765Z ) 2025-08-26T19:31:43.6374161Z parser.add_argument( 2025-08-26T19:31:43.6374870Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.6375671Z ) 2025-08-26T19:31:43.6376070Z parser.add_argument( 2025-08-26T19:31:43.6376833Z "--github-ref-type", 2025-08-26T19:31:43.6377338Z type=str, 2025-08-26T19:31:43.6377759Z required=True, 2025-08-26T19:31:43.6378288Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.6378905Z ) 2025-08-26T19:31:43.6379310Z parser.add_argument( 2025-08-26T19:31:43.6433013Z "--eligible-experiments", 2025-08-26T19:31:43.6433875Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.6434563Z required=False, 2025-08-26T19:31:43.6435077Z default="", 2025-08-26T19:31:43.6436296Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.6437503Z ) 2025-08-26T19:31:43.6437949Z parser.add_argument( 2025-08-26T19:31:43.6438502Z "--opt-out-experiments", 2025-08-26T19:31:43.6439120Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.6439762Z required=False, 2025-08-26T19:31:43.6440271Z default="", 2025-08-26T19:31:43.6440740Z help=( 2025-08-26T19:31:43.6441575Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.6443026Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.6444107Z ), 2025-08-26T19:31:43.6444538Z ) 2025-08-26T19:31:43.6444982Z parser.add_argument( 2025-08-26T19:31:43.6445520Z "--pr-number", 2025-08-26T19:31:43.6446015Z type=str, 2025-08-26T19:31:43.6446613Z required=False, 2025-08-26T19:31:43.6447115Z default="", 2025-08-26T19:31:43.6447862Z help="the optional PR number where this is run", 2025-08-26T19:31:43.6448557Z ) 2025-08-26T19:31:43.6448799Z 2025-08-26T19:31:43.6449026Z return parser.parse_args() 2025-08-26T19:31:43.6449403Z 2025-08-26T19:31:43.6449410Z 2025-08-26T19:31:43.6449918Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.6450864Z auth = Auth.Token(github_token) 2025-08-26T19:31:43.6451487Z return Github(auth=auth) 2025-08-26T19:31:43.6451849Z 2025-08-26T19:31:43.6451856Z 2025-08-26T19:31:43.6452418Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.6453430Z repo = gh.get_repo(repo) 2025-08-26T19:31:43.6454028Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.6454486Z 2025-08-26T19:31:43.6454492Z 2025-08-26T19:31:43.6454716Z def get_potential_pr_author( 2025-08-26T19:31:43.6455514Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.6456480Z ) -> str: 2025-08-26T19:31:43.6457068Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.6458000Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.6458857Z # embedded in the tag name: ciflow// 2025-08-26T19:31:43.6459337Z 2025-08-26T19:31:43.6459549Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.6459934Z 2025-08-26T19:31:43.6460227Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.6460939Z split_tag = ref_name.split("/") 2025-08-26T19:31:43.6461502Z if ( 2025-08-26T19:31:43.6461938Z len(split_tag) == 3 2025-08-26T19:31:43.6462486Z and split_tag[0] == "ciflow" 2025-08-26T19:31:43.6463091Z and split_tag[2].isnumeric() 2025-08-26T19:31:43.6463653Z ): 2025-08-26T19:31:43.6464084Z pr_number = split_tag[2] 2025-08-26T19:31:43.6464632Z try: 2025-08-26T19:31:43.6465252Z repository = gh.get_repo(repo) 2025-08-26T19:31:43.6465950Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.6466749Z except Exception as e: 2025-08-26T19:31:43.6467348Z raise Exception( # noqa: TRY002 2025-08-26T19:31:43.6468115Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.6468864Z ) from e 2025-08-26T19:31:43.6469471Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.6470282Z # In all other cases, return the original input username 2025-08-26T19:31:43.6470971Z return username 2025-08-26T19:31:43.6471243Z 2025-08-26T19:31:43.6471250Z 2025-08-26T19:31:43.6471498Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.6472115Z """ 2025-08-26T19:31:43.6472849Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.6473774Z """ 2025-08-26T19:31:43.6474392Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.6475014Z 2025-08-26T19:31:43.6475020Z 2025-08-26T19:31:43.6475236Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.6475795Z try: 2025-08-26T19:31:43.6476327Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.6476877Z return data 2025-08-26T19:31:43.6477315Z except yaml.YAMLError: 2025-08-26T19:31:43.6477836Z log.exception("Error loading YAML") 2025-08-26T19:31:43.6478379Z raise 2025-08-26T19:31:43.6478612Z 2025-08-26T19:31:43.6478618Z 2025-08-26T19:31:43.6479074Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.6479895Z """ 2025-08-26T19:31:43.6480572Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.6481239Z 2025-08-26T19:31:43.6481749Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.6482578Z and the text below is the list of opted in users. 2025-08-26T19:31:43.6483024Z 2025-08-26T19:31:43.6483427Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.6484191Z """ 2025-08-26T19:31:43.6484657Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.6485309Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.6485960Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.6486727Z else: 2025-08-26T19:31:43.6487120Z return "", rollout_state 2025-08-26T19:31:43.6487449Z 2025-08-26T19:31:43.6487456Z 2025-08-26T19:31:43.6487671Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.6488207Z """ 2025-08-26T19:31:43.6488766Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.6489464Z """ 2025-08-26T19:31:43.6489679Z 2025-08-26T19:31:43.6489686Z 2025-08-26T19:31:43.6490057Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.6490774Z """ 2025-08-26T19:31:43.6491546Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:43.6492314Z 2025-08-26T19:31:43.6493016Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:43.6494118Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.6494856Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.6495423Z 2025-08-26T19:31:43.6495429Z 2025-08-26T19:31:43.6495604Z """ 2025-08-26T19:31:43.6495992Z optins = UserOptins() 2025-08-26T19:31:43.6496611Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.6497212Z user = user.strip("\r\n\t -") 2025-08-26T19:31:43.6497786Z if not user or not user.startswith("@"): 2025-08-26T19:31:43.6498383Z # Not a valid user. Skip 2025-08-26T19:31:43.6499044Z continue 2025-08-26T19:31:43.6499299Z 2025-08-26T19:31:43.6499466Z if user: 2025-08-26T19:31:43.6499927Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.6500672Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.6501212Z 2025-08-26T19:31:43.6501385Z return optins 2025-08-26T19:31:43.6501636Z 2025-08-26T19:31:43.6501649Z 2025-08-26T19:31:43.6501953Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.6502596Z """ 2025-08-26T19:31:43.6503011Z Check if the experiment name is valid. 2025-08-26T19:31:43.6503562Z A valid name: 2025-08-26T19:31:43.6504246Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.6505279Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.6506083Z - Cannot contain spaces 2025-08-26T19:31:43.6506691Z """ 2025-08-26T19:31:43.6506900Z 2025-08-26T19:31:43.6507174Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.6507930Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.6508418Z 2025-08-26T19:31:43.6508586Z if valid: 2025-08-26T19:31:43.6508980Z return True 2025-08-26T19:31:43.6509229Z 2025-08-26T19:31:43.6509404Z log.error( 2025-08-26T19:31:43.6511044Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:43.6512816Z ) 2025-08-26T19:31:43.6513183Z return False 2025-08-26T19:31:43.6513437Z 2025-08-26T19:31:43.6513446Z 2025-08-26T19:31:43.6513772Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.6514443Z """ 2025-08-26T19:31:43.6515328Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.6516136Z """ 2025-08-26T19:31:43.6516669Z try: 2025-08-26T19:31:43.6517060Z if settings_text: 2025-08-26T19:31:43.6517852Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:43.6518730Z # for easy reading 2025-08-26T19:31:43.6519582Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.6520561Z # the backtick character in shell commands. 2025-08-26T19:31:43.6521206Z backtick = chr(96) # backtick character 2025-08-26T19:31:43.6521911Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.6522626Z settings = load_yaml(settings_text) 2025-08-26T19:31:43.6523025Z 2025-08-26T19:31:43.6523472Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.6524312Z experiments = {} 2025-08-26T19:31:43.6524628Z 2025-08-26T19:31:43.6525037Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.6525914Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.6527712Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:43.6528983Z continue 2025-08-26T19:31:43.6529313Z 2025-08-26T19:31:43.6529514Z valid_settings = {} 2025-08-26T19:31:43.6530102Z for setting in exp_settings: 2025-08-26T19:31:43.6530760Z if setting not in Experiment._fields: 2025-08-26T19:31:43.6531392Z log.warning( 2025-08-26T19:31:43.6532212Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.6533066Z ) 2025-08-26T19:31:43.6533726Z else: 2025-08-26T19:31:43.6534303Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.6534800Z 2025-08-26T19:31:43.6535107Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.6535853Z return Settings(experiments) 2025-08-26T19:31:43.6536374Z 2025-08-26T19:31:43.6536567Z except Exception: 2025-08-26T19:31:43.6537071Z log.exception("Failed to parse settings") 2025-08-26T19:31:43.6537496Z 2025-08-26T19:31:43.6537678Z return Settings() 2025-08-26T19:31:43.6537947Z 2025-08-26T19:31:43.6537954Z 2025-08-26T19:31:43.6538213Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.6538829Z """ 2025-08-26T19:31:43.6539275Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.6539734Z 2025-08-26T19:31:43.6540114Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.6540943Z and the text below is the list of opted in users. 2025-08-26T19:31:43.6541394Z 2025-08-26T19:31:43.6541833Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.6542693Z """ 2025-08-26T19:31:43.6543284Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.6544118Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.6544557Z 2025-08-26T19:31:43.6544563Z 2025-08-26T19:31:43.6544823Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.6545435Z """ 2025-08-26T19:31:43.6545845Z Parse users from the rollout state. 2025-08-26T19:31:43.6546326Z 2025-08-26T19:31:43.6546494Z """ 2025-08-26T19:31:43.6547063Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.6547863Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.6548310Z 2025-08-26T19:31:43.6548317Z 2025-08-26T19:31:43.6548896Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.6549725Z """ 2025-08-26T19:31:43.6550160Z Check if a user is opted into an experiment 2025-08-26T19:31:43.6550748Z """ 2025-08-26T19:31:43.6551220Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.6551683Z 2025-08-26T19:31:43.6551690Z 2025-08-26T19:31:43.6552159Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.6552987Z """ 2025-08-26T19:31:43.6553474Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.6554097Z """ 2025-08-26T19:31:43.6554629Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.6555368Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.6556050Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.6556808Z return False 2025-08-26T19:31:43.6557079Z 2025-08-26T19:31:43.6557375Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.6558031Z log.warning( 2025-08-26T19:31:43.6558905Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.6559893Z ) 2025-08-26T19:31:43.6560113Z 2025-08-26T19:31:43.6560285Z return True 2025-08-26T19:31:43.6560534Z 2025-08-26T19:31:43.6560541Z 2025-08-26T19:31:43.6560725Z def get_runner_prefix( 2025-08-26T19:31:43.6561190Z rollout_state: str, 2025-08-26T19:31:43.6561675Z workflow_requestors: Iterable[str], 2025-08-26T19:31:43.6562234Z branch: str, 2025-08-26T19:31:43.6562748Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.6563475Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.6564109Z is_canary: bool = False, 2025-08-26T19:31:43.6564603Z ) -> str: 2025-08-26T19:31:43.6565034Z settings = parse_settings(rollout_state) 2025-08-26T19:31:43.6565800Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.6566305Z 2025-08-26T19:31:43.6566501Z fleet_prefix = "" 2025-08-26T19:31:43.6566948Z prefixes = [] 2025-08-26T19:31:43.6567631Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.6568670Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.6569467Z log.info( 2025-08-26T19:31:43.6570192Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.6571032Z ) 2025-08-26T19:31:43.6571436Z continue 2025-08-26T19:31:43.6571695Z 2025-08-26T19:31:43.6571887Z if opt_out_experiments: 2025-08-26T19:31:43.6572450Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.6573132Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.6573769Z log.info( 2025-08-26T19:31:43.6574792Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.6575896Z ) 2025-08-26T19:31:43.6576414Z continue 2025-08-26T19:31:43.6576706Z 2025-08-26T19:31:43.6576905Z if eligible_experiments: 2025-08-26T19:31:43.6577497Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.6578179Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.6578780Z log.info( 2025-08-26T19:31:43.6579626Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.6580558Z ) 2025-08-26T19:31:43.6580975Z continue 2025-08-26T19:31:43.6581468Z elif not experiment_settings.default: 2025-08-26T19:31:43.6582036Z log.info( 2025-08-26T19:31:43.6582856Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.6583689Z ) 2025-08-26T19:31:43.6584078Z continue 2025-08-26T19:31:43.6584087Z 2025-08-26T19:31:43.6584384Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.6584568Z opted_out_users = [ 2025-08-26T19:31:43.6584737Z requestor 2025-08-26T19:31:43.6584953Z for requestor in workflow_requestors 2025-08-26T19:31:43.6585279Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.6585443Z ] 2025-08-26T19:31:43.6585451Z 2025-08-26T19:31:43.6585632Z if opted_out_users: 2025-08-26T19:31:43.6585807Z log.info( 2025-08-26T19:31:43.6586310Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.6586479Z ) 2025-08-26T19:31:43.6586658Z continue 2025-08-26T19:31:43.6586666Z 2025-08-26T19:31:43.6586955Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.6587147Z opted_in_users = [ 2025-08-26T19:31:43.6587320Z requestor 2025-08-26T19:31:43.6587538Z for requestor in workflow_requestors 2025-08-26T19:31:43.6587849Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.6588011Z ] 2025-08-26T19:31:43.6588019Z 2025-08-26T19:31:43.6588193Z enabled = False 2025-08-26T19:31:43.6588376Z if opted_in_users: 2025-08-26T19:31:43.6588545Z log.info( 2025-08-26T19:31:43.6588930Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.6589096Z ) 2025-08-26T19:31:43.6589272Z enabled = True 2025-08-26T19:31:43.6589279Z 2025-08-26T19:31:43.6589502Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.6590004Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.6590465Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.6590638Z log.info( 2025-08-26T19:31:43.6591299Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.6591461Z ) 2025-08-26T19:31:43.6591644Z enabled = True 2025-08-26T19:31:43.6591651Z 2025-08-26T19:31:43.6591824Z if enabled: 2025-08-26T19:31:43.6592014Z label = experiment_name 2025-08-26T19:31:43.6592241Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.6592712Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.6593000Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.6593338Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.6593521Z if is_canary: 2025-08-26T19:31:43.6593727Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.6593922Z fleet_prefix = label 2025-08-26T19:31:43.6594085Z else: 2025-08-26T19:31:43.6594285Z prefixes.append(label) 2025-08-26T19:31:43.6594294Z 2025-08-26T19:31:43.6594476Z if len(prefixes) > 1: 2025-08-26T19:31:43.6594648Z log.error( 2025-08-26T19:31:43.6595589Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:43.6595759Z ) 2025-08-26T19:31:43.6595957Z prefixes = prefixes[:1] 2025-08-26T19:31:43.6595965Z 2025-08-26T19:31:43.6596157Z # Fleet always comes first 2025-08-26T19:31:43.6596441Z if fleet_prefix: 2025-08-26T19:31:43.6596654Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.6596661Z 2025-08-26T19:31:43.6597045Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.6597056Z 2025-08-26T19:31:43.6597062Z 2025-08-26T19:31:43.6597561Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.6597728Z """ 2025-08-26T19:31:43.6598149Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.6598157Z 2025-08-26T19:31:43.6598575Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.6598738Z """ 2025-08-26T19:31:43.6598936Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.6599151Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.6599444Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.6599451Z 2025-08-26T19:31:43.6599458Z 2025-08-26T19:31:43.6599890Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.6600090Z for _ in range(num_retries): 2025-08-26T19:31:43.6600263Z try: 2025-08-26T19:31:43.6600486Z req = Request(url=url, headers=headers) 2025-08-26T19:31:43.6600788Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.6600993Z return json.loads(content) 2025-08-26T19:31:43.6601187Z except Exception as e: 2025-08-26T19:31:43.6601435Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.6601443Z 2025-08-26T19:31:43.6601859Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.6602029Z return {} 2025-08-26T19:31:43.6602037Z 2025-08-26T19:31:43.6602043Z 2025-08-26T19:31:43.6602205Z @cache 2025-08-26T19:31:43.6602678Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.6602843Z """ 2025-08-26T19:31:43.6603048Z Dynamically get PR information 2025-08-26T19:31:43.6603214Z """ 2025-08-26T19:31:43.6603536Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.6603826Z headers = { 2025-08-26T19:31:43.6604064Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.6604308Z "Authorization": f"token {github_token}", 2025-08-26T19:31:43.6604588Z } 2025-08-26T19:31:43.6604990Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.6605342Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.6605998Z headers=headers, 2025-08-26T19:31:43.6606662Z ) 2025-08-26T19:31:43.6606883Z 2025-08-26T19:31:43.6607075Z if not json_response: 2025-08-26T19:31:43.6607705Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.6608398Z return {} 2025-08-26T19:31:43.6608667Z 2025-08-26T19:31:43.6608853Z return json_response 2025-08-26T19:31:43.6609147Z 2025-08-26T19:31:43.6609154Z 2025-08-26T19:31:43.6609589Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.6610408Z """ 2025-08-26T19:31:43.6610970Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.6611708Z """ 2025-08-26T19:31:43.6612243Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.6612913Z return { 2025-08-26T19:31:43.6613535Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.6614306Z } 2025-08-26T19:31:43.6614522Z 2025-08-26T19:31:43.6614529Z 2025-08-26T19:31:43.6614710Z def main() -> None: 2025-08-26T19:31:43.6615152Z args = parse_args() 2025-08-26T19:31:43.6615437Z 2025-08-26T19:31:43.6615666Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.6616091Z 2025-08-26T19:31:43.6616431Z # Check if the PR is opt-out 2025-08-26T19:31:43.6616949Z if args.pr_number: 2025-08-26T19:31:43.6617649Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.6618636Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.6619183Z log.info( 2025-08-26T19:31:43.6619917Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.6620764Z ) 2025-08-26T19:31:43.6621341Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6622065Z sys.exit() 2025-08-26T19:31:43.6622337Z 2025-08-26T19:31:43.6622508Z try: 2025-08-26T19:31:43.6622957Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.6623726Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.6624418Z ) 2025-08-26T19:31:43.6624638Z 2025-08-26T19:31:43.6624845Z username = get_potential_pr_author( 2025-08-26T19:31:43.6625423Z args.github_token, 2025-08-26T19:31:43.6625921Z args.github_repo, 2025-08-26T19:31:43.6626569Z args.github_actor, 2025-08-26T19:31:43.6627076Z args.github_ref_type, 2025-08-26T19:31:43.6627609Z args.github_branch, 2025-08-26T19:31:43.6628091Z ) 2025-08-26T19:31:43.6628311Z 2025-08-26T19:31:43.6628606Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.6629102Z 2025-08-26T19:31:43.6629327Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.6629925Z rollout_state, 2025-08-26T19:31:43.6630441Z (args.github_issue_owner, username), 2025-08-26T19:31:43.6631034Z args.github_branch, 2025-08-26T19:31:43.6631563Z args.eligible_experiments, 2025-08-26T19:31:43.6632139Z args.opt_out_experiments, 2025-08-26T19:31:43.6632685Z is_canary, 2025-08-26T19:31:43.6633113Z ) 2025-08-26T19:31:43.6633333Z 2025-08-26T19:31:43.6633526Z except Exception as e: 2025-08-26T19:31:43.6634004Z log.error( 2025-08-26T19:31:43.6634725Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.6635709Z ) 2025-08-26T19:31:43.6635919Z 2025-08-26T19:31:43.6636385Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6636950Z 2025-08-26T19:31:43.6636957Z 2025-08-26T19:31:43.6637145Z if __name__ == "__main__": 2025-08-26T19:31:43.6637690Z main() 2025-08-26T19:31:43.6637995Z 2025-08-26T19:31:43.6731646Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.6732681Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.6774496Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.6775035Z env: 2025-08-26T19:31:43.6775703Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.6776177Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.6776859Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.6777439Z ISSUE_OWNER: 2025-08-26T19:31:43.6777881Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.6778367Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.6778848Z PR_NUMBER: 2025-08-26T19:31:43.6779267Z ##[endgroup] 2025-08-26T19:31:44.0543396Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:44.3862941Z Collecting urllib3==1.26.18 2025-08-26T19:31:44.4266726Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:44.4543438Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.1 MB/s eta 0:00:00 2025-08-26T19:31:44.4855510Z Collecting PyGithub==2.3.0 2025-08-26T19:31:44.4903370Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:44.5331595Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:44.5370625Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-26T19:31:44.5421432Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:44.5438400Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-26T19:31:44.5452568Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:44.5706870Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:44.5750670Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:44.5985307Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-26T19:31:44.7131751Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:44.7170528Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:44.8357768Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:44.8397614Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-26T19:31:44.8599169Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:44.8632805Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:44.8863829Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:44.8932100Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 28.1 MB/s eta 0:00:00 2025-08-26T19:31:44.8971895Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:44.9034334Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 77.0 MB/s eta 0:00:00 2025-08-26T19:31:44.9074097Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-26T19:31:44.9160021Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 121.0 MB/s eta 0:00:00 2025-08-26T19:31:44.9195686Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:44.9255014Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:44.9315008Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 105.5 MB/s eta 0:00:00 2025-08-26T19:31:44.9354765Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-26T19:31:44.9397596Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 29.1 MB/s eta 0:00:00 2025-08-26T19:31:44.9437669Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:44.9478691Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 43.2 MB/s eta 0:00:00 2025-08-26T19:31:45.2363551Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:45.7884004Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-26T19:31:45.8750346Z ##[group]Run curr_branch="main" 2025-08-26T19:31:45.8750713Z curr_branch="main" 2025-08-26T19:31:45.8750980Z curr_ref_type="branch" 2025-08-26T19:31:45.8751288Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:45.8751623Z  2025-08-26T19:31:45.8751867Z python3 runner_determinator.py \ 2025-08-26T19:31:45.8752200Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:45.8752543Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:45.8752858Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:45.8753169Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:45.8753541Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:45.8753896Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:45.8754222Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:45.8754568Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:45.8754994Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:45.8755328Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:45.8798099Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:45.8798410Z env: 2025-08-26T19:31:45.8799063Z GITHUB_TOKEN: *** 2025-08-26T19:31:45.8799320Z ISSUE_NUMBER: 5132 2025-08-26T19:31:45.8799601Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:45.8799914Z ISSUE_OWNER: 2025-08-26T19:31:45.8800160Z CHECK_EXPERIMENTS: 2025-08-26T19:31:45.8800422Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:45.8800680Z PR_NUMBER: 2025-08-26T19:31:45.8800915Z ##[endgroup] 2025-08-26T19:31:45.8862094Z Current branch is 'main' 2025-08-26T19:31:47.1040641Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:47.1042302Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:47.1043231Z INFO : Setting output: label-type='' 2025-08-26T19:31:47.1393665Z Evaluate and set job outputs 2025-08-26T19:31:47.1401246Z Cleaning up orphan processes