2025-12-04T08:52:14.3679399Z Current runner version: '2.329.0' 2025-12-04T08:52:14.3702234Z ##[group]Runner Image Provisioner 2025-12-04T08:52:14.3703173Z Hosted Compute Agent 2025-12-04T08:52:14.3703693Z Version: 20251124.448 2025-12-04T08:52:14.3704297Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:52:14.3705048Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:52:14.3705679Z ##[endgroup] 2025-12-04T08:52:14.3706217Z ##[group]Operating System 2025-12-04T08:52:14.3706794Z Ubuntu 2025-12-04T08:52:14.3707368Z 24.04.3 2025-12-04T08:52:14.3707796Z LTS 2025-12-04T08:52:14.3708323Z ##[endgroup] 2025-12-04T08:52:14.3708846Z ##[group]Runner Image 2025-12-04T08:52:14.3709395Z Image: ubuntu-24.04 2025-12-04T08:52:14.3710174Z Version: 20251126.144.1 2025-12-04T08:52:14.3711306Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:52:14.3712853Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:52:14.3713920Z ##[endgroup] 2025-12-04T08:52:14.3714891Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:52:14.3717043Z Contents: read 2025-12-04T08:52:14.3717590Z Metadata: read 2025-12-04T08:52:14.3718074Z ##[endgroup] 2025-12-04T08:52:14.3720480Z Secret source: Actions 2025-12-04T08:52:14.3721188Z Prepare workflow directory 2025-12-04T08:52:14.4426495Z Prepare all required actions 2025-12-04T08:52:14.4508425Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:52:14.4516374Z ##[group] Inputs 2025-12-04T08:52:14.4517235Z check_experiments: 2025-12-04T08:52:14.4518073Z opt_out_experiments: 2025-12-04T08:52:14.4519720Z triggering_actor: pytorchmergebot 2025-12-04T08:52:14.4520741Z issue_owner: 2025-12-04T08:52:14.4521523Z curr_branch: main 2025-12-04T08:52:14.4522444Z curr_ref_type: branch 2025-12-04T08:52:14.4523513Z issue_number: 5132 2025-12-04T08:52:14.4524391Z ##[endgroup] 2025-12-04T08:52:14.4525434Z Complete job name: get-label-type / runner-determinator 2025-12-04T08:52:15.0021158Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:52:15.0023567Z cat < runner_determinator.py 2025-12-04T08:52:15.0024320Z # flake8: noqa: G004 2025-12-04T08:52:15.0024878Z  2025-12-04T08:52:15.0025745Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:52:15.0026872Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:52:15.0027903Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:52:15.0028698Z  2025-12-04T08:52:15.0029165Z """ 2025-12-04T08:52:15.0030111Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:52:15.0031159Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:52:15.0032589Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:52:15.0033603Z of which runners should be used to run which job. 2025-12-04T08:52:15.0034380Z  2025-12-04T08:52:15.0035146Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:52:15.0036224Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:52:15.0037365Z settings are considered to be empty with only the second part, the user 2025-12-04T08:52:15.0038210Z list, defined. 2025-12-04T08:52:15.0038803Z  2025-12-04T08:52:15.0039520Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:52:15.0040909Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:52:15.0041955Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:52:15.0042737Z  2025-12-04T08:52:15.0043774Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:52:15.0044812Z The user list is also a comma separated list of additional features or 2025-12-04T08:52:15.0045808Z experiments which the user could be opted in to. 2025-12-04T08:52:15.0046540Z  2025-12-04T08:52:15.0047045Z The user list has the following rules: 2025-12-04T08:52:15.0047738Z  2025-12-04T08:52:15.0048448Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:52:15.0049502Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:52:15.0050950Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:52:15.0051648Z  2025-12-04T08:52:15.0052151Z Example config: 2025-12-04T08:52:15.0052748Z  # A list of experiments that can be opted into. 2025-12-04T08:52:15.0053713Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:52:15.0054489Z  # Expected syntax is: 2025-12-04T08:52:15.0055321Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:52:15.0056554Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:52:15.0057438Z  2025-12-04T08:52:15.0057920Z  experiments: 2025-12-04T08:52:15.0058542Z  lf: 2025-12-04T08:52:15.0059093Z  rollout_percent: 25 2025-12-04T08:52:15.0059913Z  all_branches: false 2025-12-04T08:52:15.0060606Z  default: true 2025-12-04T08:52:15.0061209Z  --- 2025-12-04T08:52:15.0061684Z  2025-12-04T08:52:15.0062251Z  # Opt-ins: 2025-12-04T08:52:15.0063003Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:52:15.0064262Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:52:15.0065321Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:52:15.0066169Z  # Experiments should be from the above list. 2025-12-04T08:52:15.0066885Z  2025-12-04T08:52:15.0067436Z  @User1,-lf,split_build 2025-12-04T08:52:15.0068079Z  @User2,lf 2025-12-04T08:52:15.0068620Z  @User3,split_build 2025-12-04T08:52:15.0145061Z """ 2025-12-04T08:52:15.0145609Z  2025-12-04T08:52:15.0146043Z import json 2025-12-04T08:52:15.0146517Z import logging 2025-12-04T08:52:15.0146982Z import os 2025-12-04T08:52:15.0147429Z import random 2025-12-04T08:52:15.0147890Z import re 2025-12-04T08:52:15.0148326Z import sys 2025-12-04T08:52:15.0148821Z from argparse import ArgumentParser 2025-12-04T08:52:15.0149670Z from collections.abc import Iterable 2025-12-04T08:52:15.0150297Z from functools import cache 2025-12-04T08:52:15.0150861Z from logging import LogRecord 2025-12-04T08:52:15.0151451Z from typing import Any, NamedTuple 2025-12-04T08:52:15.0152090Z from urllib.request import Request, urlopen 2025-12-04T08:52:15.0152690Z  2025-12-04T08:52:15.0153091Z import yaml 2025-12-04T08:52:15.0153565Z from github import Auth, Github 2025-12-04T08:52:15.0154147Z from github.Issue import Issue 2025-12-04T08:52:15.0154678Z  2025-12-04T08:52:15.0155062Z  2025-12-04T08:52:15.0155535Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:52:15.0156322Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:52:15.0157319Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:52:15.0158093Z  2025-12-04T08:52:15.0158816Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:52:15.0159470Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:52:15.0160222Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:52:15.0160886Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:52:15.0161456Z  2025-12-04T08:52:15.0161897Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:52:15.0162446Z  2025-12-04T08:52:15.0162903Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:52:15.0163455Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:52:15.0163979Z  2025-12-04T08:52:15.0164363Z  2025-12-04T08:52:15.0164783Z class Experiment(NamedTuple): 2025-12-04T08:52:15.0165355Z  rollout_perc: float = ( 2025-12-04T08:52:15.0166103Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:52:15.0166854Z  ) 2025-12-04T08:52:15.0167287Z  all_branches: bool = ( 2025-12-04T08:52:15.0168039Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:52:15.0168783Z  ) 2025-12-04T08:52:15.0169218Z  default: bool = ( 2025-12-04T08:52:15.0170285Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:52:15.0171015Z  ) 2025-12-04T08:52:15.0171431Z  2025-12-04T08:52:15.0171844Z  # Add more fields as needed 2025-12-04T08:52:15.0172389Z  2025-12-04T08:52:15.0172779Z  2025-12-04T08:52:15.0173204Z class Settings(NamedTuple): 2025-12-04T08:52:15.0173723Z  """ 2025-12-04T08:52:15.0174276Z  Settings for the experiments that can be opted into. 2025-12-04T08:52:15.0174925Z  """ 2025-12-04T08:52:15.0175329Z  2025-12-04T08:52:15.0175785Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:52:15.0176371Z  2025-12-04T08:52:15.0176899Z  2025-12-04T08:52:15.0177373Z class ColorFormatter(logging.Formatter): 2025-12-04T08:52:15.0178098Z  """Color codes the log messages based on the log level""" 2025-12-04T08:52:15.0178740Z  2025-12-04T08:52:15.0179132Z  COLORS = { 2025-12-04T08:52:15.0179740Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:52:15.0180329Z  "ERROR": "\033[31m", # Red 2025-12-04T08:52:15.0180901Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:52:15.0181473Z  "INFO": "\033[0m", # Reset 2025-12-04T08:52:15.0182045Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:52:15.0182588Z  } 2025-12-04T08:52:15.0182992Z  2025-12-04T08:52:15.0183486Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:52:15.0184339Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:52:15.0185206Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:52:15.0185863Z  return super().format(record) 2025-12-04T08:52:15.0186410Z  2025-12-04T08:52:15.0186792Z  2025-12-04T08:52:15.0187225Z handler = logging.StreamHandler() 2025-12-04T08:52:15.0188047Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:52:15.0188844Z  2025-12-04T08:52:15.0189354Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:52:15.0190123Z log.addHandler(handler) 2025-12-04T08:52:15.0190658Z log.setLevel(logging.INFO) 2025-12-04T08:52:15.0191176Z  2025-12-04T08:52:15.0191560Z  2025-12-04T08:52:15.0192066Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:52:15.0192739Z  """ 2025-12-04T08:52:15.0193338Z  Defines outputs of the github action that invokes this script 2025-12-04T08:52:15.0194180Z  """ 2025-12-04T08:52:15.0194618Z  if not GITHUB_OUTPUT: 2025-12-04T08:52:15.0195795Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:52:15.0197019Z  log.warning( 2025-12-04T08:52:15.0197992Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:52:15.0198983Z  ) 2025-12-04T08:52:15.0199492Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:52:15.0200202Z  return 2025-12-04T08:52:15.0200653Z  2025-12-04T08:52:15.0201097Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:52:15.0201751Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:52:15.0202392Z  f.write(f"{key}={value}\n") 2025-12-04T08:52:15.0202948Z  2025-12-04T08:52:15.0203337Z  2025-12-04T08:52:15.0203915Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:52:15.0204642Z  return frozenset( 2025-12-04T08:52:15.0205369Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:52:15.0206114Z  ) 2025-12-04T08:52:15.0206523Z  2025-12-04T08:52:15.0206913Z  2025-12-04T08:52:15.0207317Z def parse_args() -> Any: 2025-12-04T08:52:15.0207989Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:52:15.0208956Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:52:15.0210101Z  parser.add_argument( 2025-12-04T08:52:15.0210690Z  "--github-issue-repo", 2025-12-04T08:52:15.0211247Z  type=str, 2025-12-04T08:52:15.0211746Z  required=False, 2025-12-04T08:52:15.0212442Z  default="pytorch/test-infra", 2025-12-04T08:52:15.0213086Z  help="GitHub repo to get the issue", 2025-12-04T08:52:15.0213677Z  ) 2025-12-04T08:52:15.0214119Z  parser.add_argument( 2025-12-04T08:52:15.0214657Z  "--github-repo", 2025-12-04T08:52:15.0215175Z  type=str, 2025-12-04T08:52:15.0215668Z  required=True, 2025-12-04T08:52:15.0216232Z  help="GitHub repo where CI is running", 2025-12-04T08:52:15.0216824Z  ) 2025-12-04T08:52:15.0217268Z  parser.add_argument( 2025-12-04T08:52:15.0217982Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:52:15.0218709Z  ) 2025-12-04T08:52:15.0219140Z  parser.add_argument( 2025-12-04T08:52:15.0220166Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:52:15.0220933Z  ) 2025-12-04T08:52:15.0221366Z  parser.add_argument( 2025-12-04T08:52:15.0222108Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:52:15.0222862Z  ) 2025-12-04T08:52:15.0223293Z  parser.add_argument( 2025-12-04T08:52:15.0224070Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:52:15.0224857Z  ) 2025-12-04T08:52:15.0225312Z  parser.add_argument( 2025-12-04T08:52:15.0225860Z  "--github-ref-type", 2025-12-04T08:52:15.0226403Z  type=str, 2025-12-04T08:52:15.0226907Z  required=True, 2025-12-04T08:52:15.0227513Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:52:15.0228136Z  ) 2025-12-04T08:52:15.0228572Z  parser.add_argument( 2025-12-04T08:52:15.0229272Z  "--eligible-experiments", 2025-12-04T08:52:15.0229999Z  type=_str_comma_separated_to_set, 2025-12-04T08:52:15.0230609Z  required=False, 2025-12-04T08:52:15.0231125Z  default="", 2025-12-04T08:52:15.0232090Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:52:15.0233092Z  ) 2025-12-04T08:52:15.0233529Z  parser.add_argument( 2025-12-04T08:52:15.0234085Z  "--opt-out-experiments", 2025-12-04T08:52:15.0234690Z  type=_str_comma_separated_to_set, 2025-12-04T08:52:15.0235286Z  required=False, 2025-12-04T08:52:15.0235794Z  default="", 2025-12-04T08:52:15.0236284Z  help=( 2025-12-04T08:52:15.0237061Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:52:15.0238304Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:52:15.0239210Z  ), 2025-12-04T08:52:15.0239735Z  ) 2025-12-04T08:52:15.0240174Z  parser.add_argument( 2025-12-04T08:52:15.0240703Z  "--pr-number", 2025-12-04T08:52:15.0241229Z  type=str, 2025-12-04T08:52:15.0241726Z  required=False, 2025-12-04T08:52:15.0242238Z  default="", 2025-12-04T08:52:15.0242815Z  help="the optional PR number where this is run", 2025-12-04T08:52:15.0243435Z  ) 2025-12-04T08:52:15.0243844Z  2025-12-04T08:52:15.0244270Z  return parser.parse_args() 2025-12-04T08:52:15.0244805Z  2025-12-04T08:52:15.0245181Z  2025-12-04T08:52:15.0245843Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:52:15.0246813Z  auth = Auth.Token(github_token) 2025-12-04T08:52:15.0247420Z  return Github(auth=auth) 2025-12-04T08:52:15.0247947Z  2025-12-04T08:52:15.0248332Z  2025-12-04T08:52:15.0249063Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:52:15.0250253Z  repo = gh.get_repo(repo) 2025-12-04T08:52:15.0250879Z  return repo.get_issue(number=issue_num) 2025-12-04T08:52:15.0251472Z  2025-12-04T08:52:15.0251859Z  2025-12-04T08:52:15.0252276Z def get_potential_pr_author( 2025-12-04T08:52:15.0253034Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:52:15.0253794Z ) -> str: 2025-12-04T08:52:15.0254419Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:52:15.0255338Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:52:15.0256196Z  # embedded in the tag name: ciflow// 2025-12-04T08:52:15.0256840Z  2025-12-04T08:52:15.0257280Z  gh = get_gh_client(github_token) 2025-12-04T08:52:15.0257838Z  2025-12-04T08:52:15.0258372Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:52:15.0259087Z  split_tag = ref_name.split("/") 2025-12-04T08:52:15.0259761Z  if ( 2025-12-04T08:52:15.0260230Z  len(split_tag) == 3 2025-12-04T08:52:15.0260820Z  and split_tag[0] == "ciflow" 2025-12-04T08:52:15.0261430Z  and split_tag[2].isnumeric() 2025-12-04T08:52:15.0261988Z  ): 2025-12-04T08:52:15.0262462Z  pr_number = split_tag[2] 2025-12-04T08:52:15.0263026Z  try: 2025-12-04T08:52:15.0263553Z  repository = gh.get_repo(repo) 2025-12-04T08:52:15.0264411Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:52:15.0265111Z  except Exception as e: 2025-12-04T08:52:15.0265726Z  raise Exception( # noqa: TRY002 2025-12-04T08:52:15.0266484Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:52:15.0267209Z  ) from e 2025-12-04T08:52:15.0267856Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:52:15.0268654Z  # In all other cases, return the original input username 2025-12-04T08:52:15.0269314Z  return username 2025-12-04T08:52:15.0269900Z  2025-12-04T08:52:15.0270311Z  2025-12-04T08:52:15.0270797Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:52:15.0271438Z  """ 2025-12-04T08:52:15.0272185Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:52:15.0273047Z  """ 2025-12-04T08:52:15.0273674Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:52:15.0274410Z  2025-12-04T08:52:15.0274794Z  2025-12-04T08:52:15.0275238Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:52:15.0275808Z  try: 2025-12-04T08:52:15.0276270Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:52:15.0276853Z  return data 2025-12-04T08:52:15.0277364Z  except yaml.YAMLError: 2025-12-04T08:52:15.0277954Z  log.exception("Error loading YAML") 2025-12-04T08:52:15.0278530Z  raise 2025-12-04T08:52:15.0278980Z  2025-12-04T08:52:15.0279363Z  2025-12-04T08:52:15.0280153Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:52:15.0280972Z  """ 2025-12-04T08:52:15.0281812Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:52:15.0282643Z  2025-12-04T08:52:15.0283238Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:52:15.0284103Z  and the text below is the list of opted in users. 2025-12-04T08:52:15.0284725Z  2025-12-04T08:52:15.0285361Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:52:15.0286135Z  """ 2025-12-04T08:52:15.0286663Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:52:15.0287336Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:52:15.0288034Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:52:15.0288692Z  else: 2025-12-04T08:52:15.0289279Z  return "", rollout_state 2025-12-04T08:52:15.0290284Z  2025-12-04T08:52:15.0290700Z  2025-12-04T08:52:15.0291155Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:52:15.0291734Z  """ 2025-12-04T08:52:15.0292368Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:52:15.0293079Z  """ 2025-12-04T08:52:15.0293475Z  2025-12-04T08:52:15.0293852Z  2025-12-04T08:52:15.0294443Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:52:15.0295165Z  """ 2025-12-04T08:52:15.0295967Z  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:52:15.0296873Z  2025-12-04T08:52:15.0297746Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:52:15.0298826Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:52:15.0300255Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:52:15.0300977Z  2025-12-04T08:52:15.0301348Z  2025-12-04T08:52:15.0301723Z  """ 2025-12-04T08:52:15.0302154Z  optins = UserOptins() 2025-12-04T08:52:15.0302740Z  for user in user_optin_text.split("\n"): 2025-12-04T08:52:15.0303365Z  user = user.strip("\r\n\t -") 2025-12-04T08:52:15.0303995Z  if not user or not user.startswith("@"): 2025-12-04T08:52:15.0304621Z  # Not a valid user. Skip 2025-12-04T08:52:15.0305171Z  continue 2025-12-04T08:52:15.0305644Z  2025-12-04T08:52:15.0306031Z  if user: 2025-12-04T08:52:15.0306598Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:52:15.0307373Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:52:15.0308080Z  2025-12-04T08:52:15.0308472Z  return optins 2025-12-04T08:52:15.0308939Z  2025-12-04T08:52:15.0309310Z  2025-12-04T08:52:15.0309961Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:52:15.0310640Z  """ 2025-12-04T08:52:15.0311121Z  Check if the experiment name is valid. 2025-12-04T08:52:15.0311706Z  A valid name: 2025-12-04T08:52:15.0312446Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:52:15.0313469Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:52:15.0314251Z  - Cannot contain spaces 2025-12-04T08:52:15.0314778Z  """ 2025-12-04T08:52:15.0315180Z  2025-12-04T08:52:15.0315686Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:52:15.0316473Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:52:15.0317255Z  2025-12-04T08:52:15.0317651Z  if valid: 2025-12-04T08:52:15.0318212Z  return True 2025-12-04T08:52:15.0318836Z  2025-12-04T08:52:15.0319240Z  log.error( 2025-12-04T08:52:15.0320924Z  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:52:15.0322579Z  ) 2025-12-04T08:52:15.0322994Z  return False 2025-12-04T08:52:15.0323460Z  2025-12-04T08:52:15.0323833Z  2025-12-04T08:52:15.0324405Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:52:15.0325107Z  """ 2025-12-04T08:52:15.0325773Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:52:15.0326561Z  """ 2025-12-04T08:52:15.0326976Z  try: 2025-12-04T08:52:15.0327411Z  if settings_text: 2025-12-04T08:52:15.0328233Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:52:15.0329092Z  # for easy reading 2025-12-04T08:52:15.0330091Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:52:15.0331067Z  # the backtick character in shell commands. 2025-12-04T08:52:15.0331753Z  backtick = chr(96) # backtick character 2025-12-04T08:52:15.0332501Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:52:15.0333243Z  settings = load_yaml(settings_text) 2025-12-04T08:52:15.0333812Z  2025-12-04T08:52:15.0334471Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:52:15.0335432Z  experiments = {} 2025-12-04T08:52:15.0335956Z  2025-12-04T08:52:15.0336574Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:52:15.0337404Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:52:15.0338599Z  # 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:52:15.0339828Z  continue 2025-12-04T08:52:15.0340336Z  2025-12-04T08:52:15.0340767Z  valid_settings = {} 2025-12-04T08:52:15.0341363Z  for setting in exp_settings: 2025-12-04T08:52:15.0341998Z  if setting not in Experiment._fields: 2025-12-04T08:52:15.0342625Z  log.warning( 2025-12-04T08:52:15.0343424Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:52:15.0344205Z  ) 2025-12-04T08:52:15.0344709Z  else: 2025-12-04T08:52:15.0345311Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:52:15.0345933Z  2025-12-04T08:52:15.0346459Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:52:15.0347171Z  return Settings(experiments) 2025-12-04T08:52:15.0347729Z  2025-12-04T08:52:15.0348134Z  except Exception: 2025-12-04T08:52:15.0348700Z  log.exception("Failed to parse settings") 2025-12-04T08:52:15.0349290Z  2025-12-04T08:52:15.0349790Z  return Settings() 2025-12-04T08:52:15.0350270Z  2025-12-04T08:52:15.0350643Z  2025-12-04T08:52:15.0351270Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:52:15.0351913Z  """ 2025-12-04T08:52:15.0352423Z  Parse settings, if any, from the rollout state. 2025-12-04T08:52:15.0353032Z  2025-12-04T08:52:15.0353619Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:52:15.0354457Z  and the text below is the list of opted in users. 2025-12-04T08:52:15.0355064Z  2025-12-04T08:52:15.0355717Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:52:15.0356505Z  """ 2025-12-04T08:52:15.0357131Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:52:15.0357973Z  return parse_settings_from_text(settings_text) 2025-12-04T08:52:15.0358565Z  2025-12-04T08:52:15.0358940Z  2025-12-04T08:52:15.0359442Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:52:15.0360178Z  """ 2025-12-04T08:52:15.0360645Z  Parse users from the rollout state. 2025-12-04T08:52:15.0361200Z  2025-12-04T08:52:15.0361576Z  """ 2025-12-04T08:52:15.0362185Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:52:15.0363013Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:52:15.0363614Z  2025-12-04T08:52:15.0363990Z  2025-12-04T08:52:15.0364670Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:52:15.0365486Z  """ 2025-12-04T08:52:15.0365988Z  Check if a user is opted into an experiment 2025-12-04T08:52:15.0366574Z  """ 2025-12-04T08:52:15.0367115Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:52:15.0367748Z  2025-12-04T08:52:15.0368268Z  2025-12-04T08:52:15.0368959Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:52:15.0369931Z  """ 2025-12-04T08:52:15.0370472Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:52:15.0371112Z  """ 2025-12-04T08:52:15.0371704Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:52:15.0372475Z  experiment_optout = "-" + experiment_name 2025-12-04T08:52:15.0373218Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:52:15.0373892Z  return False 2025-12-04T08:52:15.0374364Z  2025-12-04T08:52:15.0374884Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:52:15.0375548Z  log.warning( 2025-12-04T08:52:15.0376471Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:52:15.0377422Z  ) 2025-12-04T08:52:15.0377840Z  2025-12-04T08:52:15.0378226Z  return True 2025-12-04T08:52:15.0378687Z  2025-12-04T08:52:15.0379060Z  2025-12-04T08:52:15.0379464Z def get_runner_prefix( 2025-12-04T08:52:15.0380104Z  rollout_state: str, 2025-12-04T08:52:15.0380658Z  workflow_requestors: Iterable[str], 2025-12-04T08:52:15.0381235Z  branch: str, 2025-12-04T08:52:15.0381830Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:52:15.0382596Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:52:15.0383251Z  is_canary: bool = False, 2025-12-04T08:52:15.0383778Z ) -> str: 2025-12-04T08:52:15.0384291Z  settings = parse_settings(rollout_state) 2025-12-04T08:52:15.0384947Z  user_optins = parse_users(rollout_state) 2025-12-04T08:52:15.0385532Z  2025-12-04T08:52:15.0386057Z  fleet_prefix = "" 2025-12-04T08:52:15.0386571Z  prefixes = [] 2025-12-04T08:52:15.0387299Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:52:15.0388337Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:52:15.0389112Z  log.info( 2025-12-04T08:52:15.0389984Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:52:15.0390809Z  ) 2025-12-04T08:52:15.0391276Z  continue 2025-12-04T08:52:15.0391742Z  2025-12-04T08:52:15.0392152Z  if opt_out_experiments: 2025-12-04T08:52:15.0392816Z  if experiment_name in opt_out_experiments: 2025-12-04T08:52:15.0393549Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:52:15.0394211Z  log.info( 2025-12-04T08:52:15.0395245Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:52:15.0396278Z  ) 2025-12-04T08:52:15.0396793Z  continue 2025-12-04T08:52:15.0397283Z  2025-12-04T08:52:15.0397707Z  if eligible_experiments: 2025-12-04T08:52:15.0398352Z  if experiment_name not in eligible_experiments: 2025-12-04T08:52:15.0399056Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:52:15.0399771Z  log.info( 2025-12-04T08:52:15.0400643Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:52:15.0401547Z  ) 2025-12-04T08:52:15.0402012Z  continue 2025-12-04T08:52:15.0402725Z  elif not experiment_settings.default: 2025-12-04T08:52:15.0403318Z  log.info( 2025-12-04T08:52:15.0404061Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:52:15.0404867Z  ) 2025-12-04T08:52:15.0405315Z  continue 2025-12-04T08:52:15.0405787Z  2025-12-04T08:52:15.0406307Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:52:15.0406987Z  opted_out_users = [ 2025-12-04T08:52:15.0407518Z  requestor 2025-12-04T08:52:15.0408071Z  for requestor in workflow_requestors 2025-12-04T08:52:15.0408834Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:52:15.0409523Z  ] 2025-12-04T08:52:15.0410049Z  2025-12-04T08:52:15.0410458Z  if opted_out_users: 2025-12-04T08:52:15.0411006Z  log.info( 2025-12-04T08:52:15.0411729Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:52:15.0412486Z  ) 2025-12-04T08:52:15.0412940Z  continue 2025-12-04T08:52:15.0413400Z  2025-12-04T08:52:15.0413918Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:52:15.0414585Z  opted_in_users = [ 2025-12-04T08:52:15.0415125Z  requestor 2025-12-04T08:52:15.0415676Z  for requestor in workflow_requestors 2025-12-04T08:52:15.0416428Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:52:15.0417110Z  ] 2025-12-04T08:52:15.0417518Z  2025-12-04T08:52:15.0417922Z  enabled = False 2025-12-04T08:52:15.0418436Z  if opted_in_users: 2025-12-04T08:52:15.0419086Z  log.info( 2025-12-04T08:52:15.0419897Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:52:15.0420646Z  ) 2025-12-04T08:52:15.0421118Z  enabled = True 2025-12-04T08:52:15.0421617Z  2025-12-04T08:52:15.0422079Z  elif experiment_settings.rollout_perc: 2025-12-04T08:52:15.0422987Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:52:15.0424018Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:52:15.0424732Z  log.info( 2025-12-04T08:52:15.0425698Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:52:15.0426687Z  ) 2025-12-04T08:52:15.0427181Z  enabled = True 2025-12-04T08:52:15.0427707Z  2025-12-04T08:52:15.0428103Z  if enabled: 2025-12-04T08:52:15.0428621Z  label = experiment_name 2025-12-04T08:52:15.0429258Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:52:15.0430262Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:52:15.0431212Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:52:15.0432060Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:52:15.0432791Z  if is_canary: 2025-12-04T08:52:15.0433369Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:52:15.0433973Z  fleet_prefix = label 2025-12-04T08:52:15.0434534Z  else: 2025-12-04T08:52:15.0435184Z  prefixes.append(label) 2025-12-04T08:52:15.0435739Z  2025-12-04T08:52:15.0436137Z  if len(prefixes) > 1: 2025-12-04T08:52:15.0436656Z  log.error( 2025-12-04T08:52:15.0437790Z  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:52:15.0438982Z  ) 2025-12-04T08:52:15.0439443Z  prefixes = prefixes[:1] 2025-12-04T08:52:15.0440080Z  2025-12-04T08:52:15.0440493Z  # Fleet always comes first 2025-12-04T08:52:15.0441037Z  if fleet_prefix: 2025-12-04T08:52:15.0441583Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:52:15.0442142Z  2025-12-04T08:52:15.0442647Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:52:15.0443273Z  2025-12-04T08:52:15.0443652Z  2025-12-04T08:52:15.0444355Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:52:15.0445193Z  """ 2025-12-04T08:52:15.0445861Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:52:15.0446615Z  2025-12-04T08:52:15.0447247Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:52:15.0448003Z  """ 2025-12-04T08:52:15.0448458Z  gh = get_gh_client(github_token) 2025-12-04T08:52:15.0449089Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:52:15.0449917Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:52:15.0450570Z  2025-12-04T08:52:15.0450942Z  2025-12-04T08:52:15.0451594Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:52:15.0452546Z  for _ in range(num_retries): 2025-12-04T08:52:15.0453090Z  try: 2025-12-04T08:52:15.0453605Z  req = Request(url=url, headers=headers) 2025-12-04T08:52:15.0454343Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:52:15.0455061Z  return json.loads(content) 2025-12-04T08:52:15.0455653Z  except Exception as e: 2025-12-04T08:52:15.0456283Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:52:15.0456898Z  2025-12-04T08:52:15.0457530Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:52:15.0458309Z  return {} 2025-12-04T08:52:15.0458752Z  2025-12-04T08:52:15.0459134Z  2025-12-04T08:52:15.0459689Z @cache 2025-12-04T08:52:15.0460411Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:52:15.0461228Z  """ 2025-12-04T08:52:15.0461691Z  Dynamically get PR information 2025-12-04T08:52:15.0462240Z  """ 2025-12-04T08:52:15.0462816Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:52:15.0463505Z  headers = { 2025-12-04T08:52:15.0464052Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:52:15.0464727Z  "Authorization": f"token {github_token}", 2025-12-04T08:52:15.0465310Z  } 2025-12-04T08:52:15.0465816Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:52:15.0466497Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:52:15.0467095Z  headers=headers, 2025-12-04T08:52:15.0467604Z  ) 2025-12-04T08:52:15.0467998Z  2025-12-04T08:52:15.0468409Z  if not json_response: 2025-12-04T08:52:15.0469069Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:52:15.0470000Z  return {} 2025-12-04T08:52:15.0470464Z  2025-12-04T08:52:15.0470872Z  return json_response 2025-12-04T08:52:15.0471369Z  2025-12-04T08:52:15.0471740Z  2025-12-04T08:52:15.0472389Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:52:15.0473179Z  """ 2025-12-04T08:52:15.0473789Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:52:15.0474490Z  """ 2025-12-04T08:52:15.0475044Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:52:15.0475712Z  return { 2025-12-04T08:52:15.0476380Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:52:15.0477126Z  } 2025-12-04T08:52:15.0477521Z  2025-12-04T08:52:15.0477902Z  2025-12-04T08:52:15.0478299Z def main() -> None: 2025-12-04T08:52:15.0478795Z  args = parse_args() 2025-12-04T08:52:15.0479292Z  2025-12-04T08:52:15.0479861Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:52:15.0480445Z  2025-12-04T08:52:15.0480866Z  # Check if the PR is opt-out 2025-12-04T08:52:15.0481430Z  if args.pr_number: 2025-12-04T08:52:15.0482190Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:52:15.0483017Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:52:15.0483572Z  log.info( 2025-12-04T08:52:15.0484368Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:52:15.0485187Z  ) 2025-12-04T08:52:15.0485830Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:52:15.0486590Z  sys.exit() 2025-12-04T08:52:15.0487210Z  2025-12-04T08:52:15.0487657Z  try: 2025-12-04T08:52:15.0488167Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:52:15.0488971Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:52:15.0489773Z  ) 2025-12-04T08:52:15.0490201Z  2025-12-04T08:52:15.0490647Z  username = get_potential_pr_author( 2025-12-04T08:52:15.0491247Z  args.github_token, 2025-12-04T08:52:15.0491802Z  args.github_repo, 2025-12-04T08:52:15.0492351Z  args.github_actor, 2025-12-04T08:52:15.0492942Z  args.github_ref_type, 2025-12-04T08:52:15.0493511Z  args.github_branch, 2025-12-04T08:52:15.0494038Z  ) 2025-12-04T08:52:15.0494450Z  2025-12-04T08:52:15.0494993Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:52:15.0495655Z  2025-12-04T08:52:15.0496114Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:52:15.0496719Z  rollout_state, 2025-12-04T08:52:15.0497287Z  (args.github_issue_owner, username), 2025-12-04T08:52:15.0497888Z  args.github_branch, 2025-12-04T08:52:15.0498470Z  args.eligible_experiments, 2025-12-04T08:52:15.0499082Z  args.opt_out_experiments, 2025-12-04T08:52:15.0499751Z  is_canary, 2025-12-04T08:52:15.0500241Z  ) 2025-12-04T08:52:15.0500652Z  2025-12-04T08:52:15.0501060Z  except Exception as e: 2025-12-04T08:52:15.0501600Z  log.error( 2025-12-04T08:52:15.0502384Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:52:15.0503203Z  ) 2025-12-04T08:52:15.0503765Z  2025-12-04T08:52:15.0504352Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:52:15.0505065Z  2025-12-04T08:52:15.0505447Z  2025-12-04T08:52:15.0505852Z if __name__ == "__main__": 2025-12-04T08:52:15.0506357Z  main() 2025-12-04T08:52:15.0506786Z  2025-12-04T08:52:15.0507158Z EOF 2025-12-04T08:52:15.0507549Z  2025-12-04T08:52:15.0507961Z cat runner_determinator.py 2025-12-04T08:52:15.1258470Z shell: /usr/bin/bash -e {0} 2025-12-04T08:52:15.1259488Z env: 2025-12-04T08:52:15.1260719Z GITHUB_TOKEN: *** 2025-12-04T08:52:15.1261256Z ISSUE_NUMBER: 5132 2025-12-04T08:52:15.1261809Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:52:15.1262442Z ISSUE_OWNER: 2025-12-04T08:52:15.1262955Z CHECK_EXPERIMENTS: 2025-12-04T08:52:15.1263473Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:52:15.1263928Z PR_NUMBER: 2025-12-04T08:52:15.1264358Z ##[endgroup] 2025-12-04T08:52:15.1471686Z # flake8: noqa: G004 2025-12-04T08:52:15.1472083Z 2025-12-04T08:52:15.1472597Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:52:15.1473596Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:52:15.1474408Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:52:15.1474868Z 2025-12-04T08:52:15.1475033Z """ 2025-12-04T08:52:15.1475623Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:52:15.1476566Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:52:15.1477507Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:52:15.1478336Z of which runners should be used to run which job. 2025-12-04T08:52:15.1478750Z 2025-12-04T08:52:15.1479142Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:52:15.1480656Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:52:15.1481574Z settings are considered to be empty with only the second part, the user 2025-12-04T08:52:15.1482298Z list, defined. 2025-12-04T08:52:15.1482535Z 2025-12-04T08:52:15.1482903Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:52:15.1483864Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:52:15.1484706Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:52:15.1485171Z 2025-12-04T08:52:15.1485544Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:52:15.1486446Z The user list is also a comma separated list of additional features or 2025-12-04T08:52:15.1487192Z experiments which the user could be opted in to. 2025-12-04T08:52:15.1487603Z 2025-12-04T08:52:15.1487806Z The user list has the following rules: 2025-12-04T08:52:15.1488163Z 2025-12-04T08:52:15.1488487Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:52:15.1489360Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:52:15.1490822Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:52:15.1491243Z 2025-12-04T08:52:15.1491428Z Example config: 2025-12-04T08:52:15.1491907Z # A list of experiments that can be opted into. 2025-12-04T08:52:15.1492586Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:52:15.1493227Z # Expected syntax is: 2025-12-04T08:52:15.1493873Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:52:15.1494874Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:52:15.1495496Z 2025-12-04T08:52:15.1495679Z experiments: 2025-12-04T08:52:15.1496079Z lf: 2025-12-04T08:52:15.1496472Z rollout_percent: 25 2025-12-04T08:52:15.1496948Z all_branches: false 2025-12-04T08:52:15.1497589Z default: true 2025-12-04T08:52:15.1498041Z --- 2025-12-04T08:52:15.1498256Z 2025-12-04T08:52:15.1498426Z # Opt-ins: 2025-12-04T08:52:15.1499015Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:52:15.1500117Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:52:15.1500921Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:52:15.1501584Z # Experiments should be from the above list. 2025-12-04T08:52:15.1501970Z 2025-12-04T08:52:15.1502162Z @User1,-lf,split_build 2025-12-04T08:52:15.1502614Z @User2,lf 2025-12-04T08:52:15.1503013Z @User3,split_build 2025-12-04T08:52:15.1503431Z """ 2025-12-04T08:52:15.1503641Z 2025-12-04T08:52:15.1503809Z import json 2025-12-04T08:52:15.1504189Z import logging 2025-12-04T08:52:15.1504591Z import os 2025-12-04T08:52:15.1504959Z import random 2025-12-04T08:52:15.1505348Z import re 2025-12-04T08:52:15.1505737Z import sys 2025-12-04T08:52:15.1506151Z from argparse import ArgumentParser 2025-12-04T08:52:15.1506692Z from collections.abc import Iterable 2025-12-04T08:52:15.1507221Z from functools import cache 2025-12-04T08:52:15.1507710Z from logging import LogRecord 2025-12-04T08:52:15.1508218Z from typing import Any, NamedTuple 2025-12-04T08:52:15.1508761Z from urllib.request import Request, urlopen 2025-12-04T08:52:15.1509133Z 2025-12-04T08:52:15.1509301Z import yaml 2025-12-04T08:52:15.1509920Z from github import Auth, Github 2025-12-04T08:52:15.1510432Z from github.Issue import Issue 2025-12-04T08:52:15.1510755Z 2025-12-04T08:52:15.1510763Z 2025-12-04T08:52:15.1510985Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:52:15.1511675Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:52:15.1512557Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:52:15.1513143Z 2025-12-04T08:52:15.1513388Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:52:15.1514108Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:52:15.1514642Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:52:15.1515200Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:52:15.1515567Z 2025-12-04T08:52:15.1515766Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:52:15.1516103Z 2025-12-04T08:52:15.1516298Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:52:15.1516769Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:52:15.1517068Z 2025-12-04T08:52:15.1517075Z 2025-12-04T08:52:15.1517268Z class Experiment(NamedTuple): 2025-12-04T08:52:15.1517765Z rollout_perc: float = ( 2025-12-04T08:52:15.1518423Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:52:15.1519113Z ) 2025-12-04T08:52:15.1519497Z all_branches: bool = ( 2025-12-04T08:52:15.1520328Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:52:15.1521017Z ) 2025-12-04T08:52:15.1521397Z default: bool = ( 2025-12-04T08:52:15.1521977Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:52:15.1522638Z ) 2025-12-04T08:52:15.1522842Z 2025-12-04T08:52:15.1523028Z # Add more fields as needed 2025-12-04T08:52:15.1523338Z 2025-12-04T08:52:15.1523345Z 2025-12-04T08:52:15.1523535Z class Settings(NamedTuple): 2025-12-04T08:52:15.1523994Z """ 2025-12-04T08:52:15.1524457Z Settings for the experiments that can be opted into. 2025-12-04T08:52:15.1525044Z """ 2025-12-04T08:52:15.1525250Z 2025-12-04T08:52:15.1525463Z experiments: dict[str, Experiment] = {} 2025-12-04T08:52:15.1525837Z 2025-12-04T08:52:15.1525844Z 2025-12-04T08:52:15.1526055Z class ColorFormatter(logging.Formatter): 2025-12-04T08:52:15.1526682Z """Color codes the log messages based on the log level""" 2025-12-04T08:52:15.1527139Z 2025-12-04T08:52:15.1527309Z COLORS = { 2025-12-04T08:52:15.1527720Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:52:15.1528373Z "ERROR": "\033[31m", # Red 2025-12-04T08:52:15.1528892Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:52:15.1529417Z "INFO": "\033[0m", # Reset 2025-12-04T08:52:15.1530246Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:52:15.1530820Z } 2025-12-04T08:52:15.1531215Z 2025-12-04T08:52:15.1531447Z def format(self, record: LogRecord) -> str: 2025-12-04T08:52:15.1532207Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:52:15.1533005Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:52:15.1533595Z return super().format(record) 2025-12-04T08:52:15.1533932Z 2025-12-04T08:52:15.1533939Z 2025-12-04T08:52:15.1534140Z handler = logging.StreamHandler() 2025-12-04T08:52:15.1534855Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:52:15.1535418Z 2025-12-04T08:52:15.1535666Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:52:15.1536260Z log.addHandler(handler) 2025-12-04T08:52:15.1536733Z log.setLevel(logging.INFO) 2025-12-04T08:52:15.1537035Z 2025-12-04T08:52:15.1537042Z 2025-12-04T08:52:15.1537295Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:52:15.1537866Z """ 2025-12-04T08:52:15.1538368Z Defines outputs of the github action that invokes this script 2025-12-04T08:52:15.1539014Z """ 2025-12-04T08:52:15.1539381Z if not GITHUB_OUTPUT: 2025-12-04T08:52:15.1540668Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:52:15.1541820Z log.warning( 2025-12-04T08:52:15.1542691Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:52:15.1543649Z ) 2025-12-04T08:52:15.1553755Z print(f"::set-output name={key}::{value}") 2025-12-04T08:52:15.1554401Z return 2025-12-04T08:52:15.1554644Z 2025-12-04T08:52:15.1555038Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:52:15.1555647Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:52:15.1556242Z f.write(f"{key}={value}\n") 2025-12-04T08:52:15.1556583Z 2025-12-04T08:52:15.1556590Z 2025-12-04T08:52:15.1556903Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:52:15.1557576Z return frozenset( 2025-12-04T08:52:15.1558206Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:52:15.1558914Z ) 2025-12-04T08:52:15.1559121Z 2025-12-04T08:52:15.1559128Z 2025-12-04T08:52:15.1559315Z def parse_args() -> Any: 2025-12-04T08:52:15.1560154Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:52:15.1561040Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:52:15.1561836Z parser.add_argument( 2025-12-04T08:52:15.1562322Z "--github-issue-repo", 2025-12-04T08:52:15.1562805Z type=str, 2025-12-04T08:52:15.1563244Z required=False, 2025-12-04T08:52:15.1563726Z default="pytorch/test-infra", 2025-12-04T08:52:15.1564289Z help="GitHub repo to get the issue", 2025-12-04T08:52:15.1564813Z ) 2025-12-04T08:52:15.1565196Z parser.add_argument( 2025-12-04T08:52:15.1565661Z "--github-repo", 2025-12-04T08:52:15.1566114Z type=str, 2025-12-04T08:52:15.1566525Z required=True, 2025-12-04T08:52:15.1567002Z help="GitHub repo where CI is running", 2025-12-04T08:52:15.1567544Z ) 2025-12-04T08:52:15.1567930Z parser.add_argument( 2025-12-04T08:52:15.1568559Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:52:15.1569231Z ) 2025-12-04T08:52:15.1569841Z parser.add_argument( 2025-12-04T08:52:15.1570497Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:52:15.1571202Z ) 2025-12-04T08:52:15.1571580Z parser.add_argument( 2025-12-04T08:52:15.1572485Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:52:15.1573202Z ) 2025-12-04T08:52:15.1573588Z parser.add_argument( 2025-12-04T08:52:15.1574264Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:52:15.1575011Z ) 2025-12-04T08:52:15.1575402Z parser.add_argument( 2025-12-04T08:52:15.1575863Z "--github-ref-type", 2025-12-04T08:52:15.1576332Z type=str, 2025-12-04T08:52:15.1576731Z required=True, 2025-12-04T08:52:15.1577222Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:52:15.1577783Z ) 2025-12-04T08:52:15.1578165Z parser.add_argument( 2025-12-04T08:52:15.1578631Z "--eligible-experiments", 2025-12-04T08:52:15.1579160Z type=_str_comma_separated_to_set, 2025-12-04T08:52:15.1579957Z required=False, 2025-12-04T08:52:15.1630525Z default="", 2025-12-04T08:52:15.1631600Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:52:15.1632577Z ) 2025-12-04T08:52:15.1632973Z parser.add_argument( 2025-12-04T08:52:15.1633453Z "--opt-out-experiments", 2025-12-04T08:52:15.1633977Z type=_str_comma_separated_to_set, 2025-12-04T08:52:15.1634521Z required=False, 2025-12-04T08:52:15.1634949Z default="", 2025-12-04T08:52:15.1635350Z help=( 2025-12-04T08:52:15.1636050Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:52:15.1637221Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:52:15.1638076Z ), 2025-12-04T08:52:15.1638445Z ) 2025-12-04T08:52:15.1638835Z parser.add_argument( 2025-12-04T08:52:15.1639280Z "--pr-number", 2025-12-04T08:52:15.1639994Z type=str, 2025-12-04T08:52:15.1640412Z required=False, 2025-12-04T08:52:15.1640853Z default="", 2025-12-04T08:52:15.1641518Z help="the optional PR number where this is run", 2025-12-04T08:52:15.1642121Z ) 2025-12-04T08:52:15.1642326Z 2025-12-04T08:52:15.1642527Z return parser.parse_args() 2025-12-04T08:52:15.1642852Z 2025-12-04T08:52:15.1642859Z 2025-12-04T08:52:15.1643269Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:52:15.1644071Z auth = Auth.Token(github_token) 2025-12-04T08:52:15.1644585Z return Github(auth=auth) 2025-12-04T08:52:15.1644893Z 2025-12-04T08:52:15.1644899Z 2025-12-04T08:52:15.1645368Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:52:15.1646193Z repo = gh.get_repo(repo) 2025-12-04T08:52:15.1646707Z return repo.get_issue(number=issue_num) 2025-12-04T08:52:15.1647084Z 2025-12-04T08:52:15.1647090Z 2025-12-04T08:52:15.1647286Z def get_potential_pr_author( 2025-12-04T08:52:15.1647951Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:52:15.1648655Z ) -> str: 2025-12-04T08:52:15.1649176Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:52:15.1650353Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:52:15.1651111Z # embedded in the tag name: ciflow// 2025-12-04T08:52:15.1651540Z 2025-12-04T08:52:15.1651732Z gh = get_gh_client(github_token) 2025-12-04T08:52:15.1652072Z 2025-12-04T08:52:15.1652342Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:52:15.1652982Z split_tag = ref_name.split("/") 2025-12-04T08:52:15.1653503Z if ( 2025-12-04T08:52:15.1653907Z len(split_tag) == 3 2025-12-04T08:52:15.1654411Z and split_tag[0] == "ciflow" 2025-12-04T08:52:15.1654951Z and split_tag[2].isnumeric() 2025-12-04T08:52:15.1655455Z ): 2025-12-04T08:52:15.1655846Z pr_number = split_tag[2] 2025-12-04T08:52:15.1656489Z try: 2025-12-04T08:52:15.1656934Z repository = gh.get_repo(repo) 2025-12-04T08:52:15.1657559Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:52:15.1658181Z except Exception as e: 2025-12-04T08:52:15.1658713Z raise Exception( # noqa: TRY002 2025-12-04T08:52:15.1659411Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:52:15.1660317Z ) from e 2025-12-04T08:52:15.1660880Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:52:15.1661598Z # In all other cases, return the original input username 2025-12-04T08:52:15.1662210Z return username 2025-12-04T08:52:15.1662457Z 2025-12-04T08:52:15.1662464Z 2025-12-04T08:52:15.1662699Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:52:15.1663245Z """ 2025-12-04T08:52:15.1663895Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:52:15.1664698Z """ 2025-12-04T08:52:15.1665253Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:52:15.1665780Z 2025-12-04T08:52:15.1665787Z 2025-12-04T08:52:15.1665984Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:52:15.1666493Z try: 2025-12-04T08:52:15.1666880Z data = yaml.safe_load(yaml_text) 2025-12-04T08:52:15.1667409Z return data 2025-12-04T08:52:15.1667834Z except yaml.YAMLError: 2025-12-04T08:52:15.1668323Z log.exception("Error loading YAML") 2025-12-04T08:52:15.1668853Z raise 2025-12-04T08:52:15.1669076Z 2025-12-04T08:52:15.1669084Z 2025-12-04T08:52:15.1669511Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:52:15.1670448Z """ 2025-12-04T08:52:15.1671070Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:52:15.1671687Z 2025-12-04T08:52:15.1672216Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:52:15.1673003Z and the text below is the list of opted in users. 2025-12-04T08:52:15.1673418Z 2025-12-04T08:52:15.1673797Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:52:15.1674524Z """ 2025-12-04T08:52:15.1674965Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:52:15.1675594Z if len(rollout_state_parts) >= 2: 2025-12-04T08:52:15.1676203Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:52:15.1676805Z else: 2025-12-04T08:52:15.1677190Z return "", rollout_state 2025-12-04T08:52:15.1677507Z 2025-12-04T08:52:15.1677514Z 2025-12-04T08:52:15.1677717Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:52:15.1678242Z """ 2025-12-04T08:52:15.1678767Z Dictionary of users with a list of features they have opted into 2025-12-04T08:52:15.1679429Z """ 2025-12-04T08:52:15.1679826Z 2025-12-04T08:52:15.1679842Z 2025-12-04T08:52:15.1680194Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:52:15.1680858Z """ 2025-12-04T08:52:15.1681572Z 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:52:15.1682268Z 2025-12-04T08:52:15.1682890Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:52:15.1683903Z - Example line: "@User1,lf,split_build" 2025-12-04T08:52:15.1684595Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:52:15.1685094Z 2025-12-04T08:52:15.1685100Z 2025-12-04T08:52:15.1685259Z """ 2025-12-04T08:52:15.1685632Z optins = UserOptins() 2025-12-04T08:52:15.1686130Z for user in user_optin_text.split("\n"): 2025-12-04T08:52:15.1686695Z user = user.strip("\r\n\t -") 2025-12-04T08:52:15.1687242Z if not user or not user.startswith("@"): 2025-12-04T08:52:15.1687954Z # Not a valid user. Skip 2025-12-04T08:52:15.1688450Z continue 2025-12-04T08:52:15.1688706Z 2025-12-04T08:52:15.1688869Z if user: 2025-12-04T08:52:15.1689319Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:52:15.1690142Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:52:15.1690653Z 2025-12-04T08:52:15.1690829Z return optins 2025-12-04T08:52:15.1691072Z 2025-12-04T08:52:15.1691079Z 2025-12-04T08:52:15.1691369Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:52:15.1691987Z """ 2025-12-04T08:52:15.1692382Z Check if the experiment name is valid. 2025-12-04T08:52:15.1692918Z A valid name: 2025-12-04T08:52:15.1693554Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:52:15.1694544Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:52:15.1695307Z - Cannot contain spaces 2025-12-04T08:52:15.1695774Z """ 2025-12-04T08:52:15.1695977Z 2025-12-04T08:52:15.1696249Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:52:15.1696959Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:52:15.1697420Z 2025-12-04T08:52:15.1697585Z if valid: 2025-12-04T08:52:15.1697971Z return True 2025-12-04T08:52:15.1698219Z 2025-12-04T08:52:15.1698384Z log.error( 2025-12-04T08:52:15.1699973Z 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:52:15.1701581Z ) 2025-12-04T08:52:15.1701944Z return False 2025-12-04T08:52:15.1702187Z 2025-12-04T08:52:15.1702193Z 2025-12-04T08:52:15.1702501Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:52:15.1703138Z """ 2025-12-04T08:52:15.1703857Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:52:15.1704618Z """ 2025-12-04T08:52:15.1704982Z try: 2025-12-04T08:52:15.1705356Z if settings_text: 2025-12-04T08:52:15.1706097Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:52:15.1706911Z # for easy reading 2025-12-04T08:52:15.1707713Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:52:15.1708614Z # the backtick character in shell commands. 2025-12-04T08:52:15.1709231Z backtick = chr(96) # backtick character 2025-12-04T08:52:15.1710018Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:52:15.1710697Z settings = load_yaml(settings_text) 2025-12-04T08:52:15.1711085Z 2025-12-04T08:52:15.1711516Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:52:15.1712298Z experiments = {} 2025-12-04T08:52:15.1712613Z 2025-12-04T08:52:15.1713000Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:52:15.1713793Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:52:15.1714920Z # 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:52:15.1715987Z continue 2025-12-04T08:52:15.1716282Z 2025-12-04T08:52:15.1716471Z valid_settings = {} 2025-12-04T08:52:15.1717004Z for setting in exp_settings: 2025-12-04T08:52:15.1717589Z if setting not in Experiment._fields: 2025-12-04T08:52:15.1718159Z log.warning( 2025-12-04T08:52:15.1718874Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:52:15.1719907Z ) 2025-12-04T08:52:15.1720353Z else: 2025-12-04T08:52:15.1720890Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:52:15.1721327Z 2025-12-04T08:52:15.1721607Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:52:15.1722250Z return Settings(experiments) 2025-12-04T08:52:15.1722617Z 2025-12-04T08:52:15.1722798Z except Exception: 2025-12-04T08:52:15.1723289Z log.exception("Failed to parse settings") 2025-12-04T08:52:15.1723684Z 2025-12-04T08:52:15.1723857Z return Settings() 2025-12-04T08:52:15.1724114Z 2025-12-04T08:52:15.1724120Z 2025-12-04T08:52:15.1724376Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:52:15.1724956Z """ 2025-12-04T08:52:15.1725411Z Parse settings, if any, from the rollout state. 2025-12-04T08:52:15.1725823Z 2025-12-04T08:52:15.1726178Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:52:15.1726965Z and the text below is the list of opted in users. 2025-12-04T08:52:15.1727384Z 2025-12-04T08:52:15.1727802Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:52:15.1728549Z """ 2025-12-04T08:52:15.1729114Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:52:15.1730030Z return parse_settings_from_text(settings_text) 2025-12-04T08:52:15.1730446Z 2025-12-04T08:52:15.1730452Z 2025-12-04T08:52:15.1730698Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:52:15.1731267Z """ 2025-12-04T08:52:15.1731660Z Parse users from the rollout state. 2025-12-04T08:52:15.1732015Z 2025-12-04T08:52:15.1732181Z """ 2025-12-04T08:52:15.1732712Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:52:15.1733476Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:52:15.1733898Z 2025-12-04T08:52:15.1733904Z 2025-12-04T08:52:15.1734518Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:52:15.1735313Z """ 2025-12-04T08:52:15.1735732Z Check if a user is opted into an experiment 2025-12-04T08:52:15.1736279Z """ 2025-12-04T08:52:15.1736739Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:52:15.1737175Z 2025-12-04T08:52:15.1737183Z 2025-12-04T08:52:15.1737604Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:52:15.1738378Z """ 2025-12-04T08:52:15.1738840Z Check if a user explicitly opted out of an experiment 2025-12-04T08:52:15.1739434Z """ 2025-12-04T08:52:15.1740057Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:52:15.1740752Z experiment_optout = "-" + experiment_name 2025-12-04T08:52:15.1741400Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:52:15.1742008Z return False 2025-12-04T08:52:15.1742274Z 2025-12-04T08:52:15.1742566Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:52:15.1743177Z log.warning( 2025-12-04T08:52:15.1744004Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:52:15.1744903Z ) 2025-12-04T08:52:15.1745121Z 2025-12-04T08:52:15.1745290Z return True 2025-12-04T08:52:15.1745526Z 2025-12-04T08:52:15.1745533Z 2025-12-04T08:52:15.1745722Z def get_runner_prefix( 2025-12-04T08:52:15.1746168Z rollout_state: str, 2025-12-04T08:52:15.1746639Z workflow_requestors: Iterable[str], 2025-12-04T08:52:15.1747164Z branch: str, 2025-12-04T08:52:15.1747660Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:52:15.1748338Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:52:15.1748947Z is_canary: bool = False, 2025-12-04T08:52:15.1749414Z ) -> str: 2025-12-04T08:52:15.1749945Z settings = parse_settings(rollout_state) 2025-12-04T08:52:15.1750684Z user_optins = parse_users(rollout_state) 2025-12-04T08:52:15.1751068Z 2025-12-04T08:52:15.1751244Z fleet_prefix = "" 2025-12-04T08:52:15.1751684Z prefixes = [] 2025-12-04T08:52:15.1752317Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:52:15.1753277Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:52:15.1754009Z log.info( 2025-12-04T08:52:15.1754708Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:52:15.1755477Z ) 2025-12-04T08:52:15.1755868Z continue 2025-12-04T08:52:15.1756123Z 2025-12-04T08:52:15.1756320Z if opt_out_experiments: 2025-12-04T08:52:15.1756858Z if experiment_name in opt_out_experiments: 2025-12-04T08:52:15.1757522Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:52:15.1758136Z log.info( 2025-12-04T08:52:15.1759092Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:52:15.1760261Z ) 2025-12-04T08:52:15.1760666Z continue 2025-12-04T08:52:15.1760944Z 2025-12-04T08:52:15.1761143Z if eligible_experiments: 2025-12-04T08:52:15.1761734Z if experiment_name not in eligible_experiments: 2025-12-04T08:52:15.1762386Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:52:15.1762959Z log.info( 2025-12-04T08:52:15.1763758Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:52:15.1764611Z ) 2025-12-04T08:52:15.1765026Z continue 2025-12-04T08:52:15.1765510Z elif not experiment_settings.default: 2025-12-04T08:52:15.1766059Z log.info( 2025-12-04T08:52:15.1766857Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:52:15.1767611Z ) 2025-12-04T08:52:15.1767998Z continue 2025-12-04T08:52:15.1768251Z 2025-12-04T08:52:15.1768532Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:52:15.1769168Z opted_out_users = [ 2025-12-04T08:52:15.1769726Z requestor 2025-12-04T08:52:15.1770191Z for requestor in workflow_requestors 2025-12-04T08:52:15.1770868Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:52:15.1771511Z ] 2025-12-04T08:52:15.1771722Z 2025-12-04T08:52:15.1771910Z if opted_out_users: 2025-12-04T08:52:15.1772368Z log.info( 2025-12-04T08:52:15.1772990Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:52:15.1773705Z ) 2025-12-04T08:52:15.1774089Z continue 2025-12-04T08:52:15.1774347Z 2025-12-04T08:52:15.1774640Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:52:15.1775280Z opted_in_users = [ 2025-12-04T08:52:15.1775735Z requestor 2025-12-04T08:52:15.1776192Z for requestor in workflow_requestors 2025-12-04T08:52:15.1776870Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:52:15.1777495Z ] 2025-12-04T08:52:15.1777709Z 2025-12-04T08:52:15.1777886Z enabled = False 2025-12-04T08:52:15.1778324Z if opted_in_users: 2025-12-04T08:52:15.1778777Z log.info( 2025-12-04T08:52:15.1779387Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:52:15.1780212Z ) 2025-12-04T08:52:15.1780613Z enabled = True 2025-12-04T08:52:15.1780898Z 2025-12-04T08:52:15.1781116Z elif experiment_settings.rollout_perc: 2025-12-04T08:52:15.1781970Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:52:15.1783064Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:52:15.1783735Z log.info( 2025-12-04T08:52:15.1784915Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:52:15.1785902Z ) 2025-12-04T08:52:15.1786324Z enabled = True 2025-12-04T08:52:15.1786632Z 2025-12-04T08:52:15.1786803Z if enabled: 2025-12-04T08:52:15.1787235Z label = experiment_name 2025-12-04T08:52:15.1787791Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:52:15.1788644Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:52:15.1789669Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:52:15.1790472Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:52:15.1791164Z if is_canary: 2025-12-04T08:52:15.1791664Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:52:15.1792224Z fleet_prefix = label 2025-12-04T08:52:15.1792723Z else: 2025-12-04T08:52:15.1793169Z prefixes.append(label) 2025-12-04T08:52:15.1793528Z 2025-12-04T08:52:15.1793715Z if len(prefixes) > 1: 2025-12-04T08:52:15.1794167Z log.error( 2025-12-04T08:52:15.1795217Z 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:52:15.1796361Z ) 2025-12-04T08:52:15.1796765Z prefixes = prefixes[:1] 2025-12-04T08:52:15.1797081Z 2025-12-04T08:52:15.1797274Z # Fleet always comes first 2025-12-04T08:52:15.1797755Z if fleet_prefix: 2025-12-04T08:52:15.1798216Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:52:15.1798589Z 2025-12-04T08:52:15.1798979Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:52:15.1799409Z 2025-12-04T08:52:15.1799416Z 2025-12-04T08:52:15.1800042Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:52:15.1800847Z """ 2025-12-04T08:52:15.1801452Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:52:15.1802025Z 2025-12-04T08:52:15.1802408Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:52:15.1803130Z """ 2025-12-04T08:52:15.1803525Z gh = get_gh_client(github_token) 2025-12-04T08:52:15.1804071Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:52:15.1804714Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:52:15.1805164Z 2025-12-04T08:52:15.1805171Z 2025-12-04T08:52:15.1805571Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:52:15.1806351Z for _ in range(num_retries): 2025-12-04T08:52:15.1806835Z try: 2025-12-04T08:52:15.1807272Z req = Request(url=url, headers=headers) 2025-12-04T08:52:15.1807933Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:52:15.1808590Z return json.loads(content) 2025-12-04T08:52:15.1809125Z except Exception as e: 2025-12-04T08:52:15.1810033Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:52:15.1810454Z 2025-12-04T08:52:15.1810849Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:52:15.1811568Z return {} 2025-12-04T08:52:15.1811801Z 2025-12-04T08:52:15.1811807Z 2025-12-04T08:52:15.1811968Z @cache 2025-12-04T08:52:15.1812597Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:52:15.1813373Z """ 2025-12-04T08:52:15.1813765Z Dynamically get PR information 2025-12-04T08:52:15.1814269Z """ 2025-12-04T08:52:15.1814914Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:52:15.1815552Z headers = { 2025-12-04T08:52:15.1816019Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:52:15.1816631Z "Authorization": f"token {github_token}", 2025-12-04T08:52:15.1817186Z } 2025-12-04T08:52:15.1817615Z json_response: dict[str, Any] = download_json( 2025-12-04T08:52:15.1818235Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:52:15.1818791Z headers=headers, 2025-12-04T08:52:15.1819234Z ) 2025-12-04T08:52:15.1819440Z 2025-12-04T08:52:15.1820101Z if not json_response: 2025-12-04T08:52:15.1820810Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:52:15.1821448Z return {} 2025-12-04T08:52:15.1821691Z 2025-12-04T08:52:15.1821877Z return json_response 2025-12-04T08:52:15.1822180Z 2025-12-04T08:52:15.1822186Z 2025-12-04T08:52:15.1822593Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:52:15.1823353Z """ 2025-12-04T08:52:15.1823895Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:52:15.1824563Z """ 2025-12-04T08:52:15.1825039Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:52:15.1825664Z return { 2025-12-04T08:52:15.1826259Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:52:15.1826972Z } 2025-12-04T08:52:15.1827177Z 2025-12-04T08:52:15.1827184Z 2025-12-04T08:52:15.1827361Z def main() -> None: 2025-12-04T08:52:15.1827789Z args = parse_args() 2025-12-04T08:52:15.1828058Z 2025-12-04T08:52:15.1828280Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:52:15.1828672Z 2025-12-04T08:52:15.1828863Z # Check if the PR is opt-out 2025-12-04T08:52:15.1829352Z if args.pr_number: 2025-12-04T08:52:15.1830246Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:52:15.1831200Z if OPT_OUT_LABEL in labels: 2025-12-04T08:52:15.1831717Z log.info( 2025-12-04T08:52:15.1832411Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:52:15.1833172Z ) 2025-12-04T08:52:15.1833731Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:52:15.1834403Z sys.exit() 2025-12-04T08:52:15.1834661Z 2025-12-04T08:52:15.1834822Z try: 2025-12-04T08:52:15.1835260Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:52:15.1835962Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:52:15.1836605Z ) 2025-12-04T08:52:15.1836818Z 2025-12-04T08:52:15.1837019Z username = get_potential_pr_author( 2025-12-04T08:52:15.1837566Z args.github_token, 2025-12-04T08:52:15.1838042Z args.github_repo, 2025-12-04T08:52:15.1838520Z args.github_actor, 2025-12-04T08:52:15.1839008Z args.github_ref_type, 2025-12-04T08:52:15.1839505Z args.github_branch, 2025-12-04T08:52:15.1840088Z ) 2025-12-04T08:52:15.1840298Z 2025-12-04T08:52:15.1840580Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:52:15.1841036Z 2025-12-04T08:52:15.1841249Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:52:15.1841799Z rollout_state, 2025-12-04T08:52:15.1842284Z (args.github_issue_owner, username), 2025-12-04T08:52:15.1842839Z args.github_branch, 2025-12-04T08:52:15.1843347Z args.eligible_experiments, 2025-12-04T08:52:15.1843887Z args.opt_out_experiments, 2025-12-04T08:52:15.1844389Z is_canary, 2025-12-04T08:52:15.1844810Z ) 2025-12-04T08:52:15.1845017Z 2025-12-04T08:52:15.1845202Z except Exception as e: 2025-12-04T08:52:15.1845644Z log.error( 2025-12-04T08:52:15.1846304Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:52:15.1847246Z ) 2025-12-04T08:52:15.1847457Z 2025-12-04T08:52:15.1847780Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:52:15.1848282Z 2025-12-04T08:52:15.1848290Z 2025-12-04T08:52:15.1848466Z if __name__ == "__main__": 2025-12-04T08:52:15.1848906Z main() 2025-12-04T08:52:15.1849116Z 2025-12-04T08:52:15.1941101Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:52:15.1942021Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:52:15.1975455Z shell: /usr/bin/bash -e {0} 2025-12-04T08:52:15.1975933Z env: 2025-12-04T08:52:15.1976562Z GITHUB_TOKEN: *** 2025-12-04T08:52:15.1977033Z ISSUE_NUMBER: 5132 2025-12-04T08:52:15.1977510Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:52:15.1978030Z ISSUE_OWNER: 2025-12-04T08:52:15.1978453Z CHECK_EXPERIMENTS: 2025-12-04T08:52:15.1978896Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:52:15.1979338Z PR_NUMBER: 2025-12-04T08:52:15.1979972Z ##[endgroup] 2025-12-04T08:52:16.2430672Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:52:16.9678375Z Collecting urllib3==1.26.18 2025-12-04T08:52:17.0357865Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:52:17.0642464Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.3 MB/s eta 0:00:00 2025-12-04T08:52:17.0886583Z Collecting PyGithub==2.3.0 2025-12-04T08:52:17.1035433Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:52:17.1516765Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:52:17.1658101Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:52:17.1707952Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:52:17.1725989Z 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:52:17.1741441Z 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:52:17.1989336Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:52:17.2140239Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:52:17.2368659Z 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:52:17.3694440Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:52:17.3835241Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:52:17.5457780Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:52:17.5605902Z 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:52:17.5804253Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:52:17.5942827Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:52:17.6284864Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:52:17.6468257Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.4 MB/s eta 0:00:00 2025-12-04T08:52:17.6607906Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:52:17.6786445Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 21.5 MB/s eta 0:00:00 2025-12-04T08:52:17.6941628Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:52:17.7341868Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 36.5 MB/s eta 0:00:00 2025-12-04T08:52:17.7481856Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:52:17.7643143Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:52:17.7705663Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 46.3 MB/s eta 0:00:00 2025-12-04T08:52:17.7847207Z 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:52:17.7893526Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 38.5 MB/s eta 0:00:00 2025-12-04T08:52:17.8033953Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:52:17.8080727Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 35.9 MB/s eta 0:00:00 2025-12-04T08:52:18.1012649Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:52:18.6408721Z 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:52:18.7644800Z ##[group]Run curr_branch="main" 2025-12-04T08:52:18.7645101Z curr_branch="main" 2025-12-04T08:52:18.7645316Z curr_ref_type="branch" 2025-12-04T08:52:18.7645566Z echo "Current branch is '$curr_branch'" 2025-12-04T08:52:18.7645839Z  2025-12-04T08:52:18.7646028Z python3 runner_determinator.py \ 2025-12-04T08:52:18.7646304Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:52:18.7646583Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:52:18.7646850Z  --github-branch "$curr_branch" \ 2025-12-04T08:52:18.7647115Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:52:18.7647398Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:52:18.7647670Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:52:18.7647941Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:52:18.7648230Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:52:18.7648601Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:52:18.7648885Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:52:18.7683671Z shell: /usr/bin/bash -e {0} 2025-12-04T08:52:18.7683903Z env: 2025-12-04T08:52:18.7684570Z GITHUB_TOKEN: *** 2025-12-04T08:52:18.7684777Z ISSUE_NUMBER: 5132 2025-12-04T08:52:18.7684982Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:52:18.7685205Z ISSUE_OWNER: 2025-12-04T08:52:18.7685382Z CHECK_EXPERIMENTS: 2025-12-04T08:52:18.7685569Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:52:18.7685749Z PR_NUMBER: 2025-12-04T08:52:18.7685915Z ##[endgroup] 2025-12-04T08:52:18.7742090Z Current branch is 'main' 2025-12-04T08:52:20.2993692Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:52:20.2994925Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:52:20.2995902Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:52:20.2996592Z INFO : Setting output: label-type='' 2025-12-04T08:52:20.3317715Z Evaluate and set job outputs 2025-12-04T08:52:20.3324153Z Cleaning up orphan processes