2025-09-07T06:09:27.7085896Z Current runner version: '2.328.0' 2025-09-07T06:09:27.7110366Z ##[group]Runner Image Provisioner 2025-09-07T06:09:27.7111365Z Hosted Compute Agent 2025-09-07T06:09:27.7111862Z Version: 20250829.383 2025-09-07T06:09:27.7112544Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:27.7113182Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:27.7113748Z ##[endgroup] 2025-09-07T06:09:27.7114513Z ##[group]Operating System 2025-09-07T06:09:27.7115111Z Ubuntu 2025-09-07T06:09:27.7115543Z 24.04.3 2025-09-07T06:09:27.7116049Z LTS 2025-09-07T06:09:27.7116455Z ##[endgroup] 2025-09-07T06:09:27.7116935Z ##[group]Runner Image 2025-09-07T06:09:27.7117594Z Image: ubuntu-24.04 2025-09-07T06:09:27.7118067Z Version: 20250831.1.0 2025-09-07T06:09:27.7119063Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:27.7120578Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:27.7121524Z ##[endgroup] 2025-09-07T06:09:27.7122632Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:27.7125092Z Contents: read 2025-09-07T06:09:27.7125725Z Metadata: read 2025-09-07T06:09:27.7126198Z ##[endgroup] 2025-09-07T06:09:27.7128353Z Secret source: Actions 2025-09-07T06:09:27.7129407Z Prepare workflow directory 2025-09-07T06:09:27.7663788Z Prepare all required actions 2025-09-07T06:09:27.7721970Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:27.7727369Z ##[group] Inputs 2025-09-07T06:09:27.7727958Z check_experiments: 2025-09-07T06:09:27.7728582Z opt_out_experiments: 2025-09-07T06:09:27.7729151Z triggering_actor: pytorchmergebot 2025-09-07T06:09:27.7729746Z issue_owner: 2025-09-07T06:09:27.7730228Z curr_branch: main 2025-09-07T06:09:27.7730816Z curr_ref_type: branch 2025-09-07T06:09:27.7731479Z issue_number: 5132 2025-09-07T06:09:27.7731953Z ##[endgroup] 2025-09-07T06:09:27.7732710Z Complete job name: before-test / get-label-type / runner-determinator 2025-09-07T06:09:28.5047469Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:28.5050015Z cat < runner_determinator.py 2025-09-07T06:09:28.5050703Z # flake8: noqa: G004 2025-09-07T06:09:28.5051333Z  2025-09-07T06:09:28.5052139Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.5053185Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.5054404Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.5055172Z  2025-09-07T06:09:28.5055611Z """ 2025-09-07T06:09:28.5056427Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.5057446Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.5058729Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.5059736Z of which runners should be used to run which job. 2025-09-07T06:09:28.5060447Z  2025-09-07T06:09:28.5061133Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.5062302Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.5063347Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.5064482Z list, defined. 2025-09-07T06:09:28.5065167Z  2025-09-07T06:09:28.5065844Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.5066922Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.5068051Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.5068761Z  2025-09-07T06:09:28.5069768Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.5070859Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.5071775Z experiments which the user could be opted in to. 2025-09-07T06:09:28.5072457Z  2025-09-07T06:09:28.5073023Z The user list has the following rules: 2025-09-07T06:09:28.5073668Z  2025-09-07T06:09:28.5074793Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.5076013Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.5076914Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.5077597Z  2025-09-07T06:09:28.5078129Z Example config: 2025-09-07T06:09:28.5078733Z  # A list of experiments that can be opted into. 2025-09-07T06:09:28.5079730Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.5080516Z  # Expected syntax is: 2025-09-07T06:09:28.5081369Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.5082498Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.5161622Z  2025-09-07T06:09:28.5162228Z  experiments: 2025-09-07T06:09:28.5162706Z  lf: 2025-09-07T06:09:28.5163141Z  rollout_percent: 25 2025-09-07T06:09:28.5163711Z  all_branches: false 2025-09-07T06:09:28.5164362Z  default: true 2025-09-07T06:09:28.5164845Z  --- 2025-09-07T06:09:28.5165250Z  2025-09-07T06:09:28.5165622Z  # Opt-ins: 2025-09-07T06:09:28.5166302Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.5167655Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.5168620Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.5169352Z  # Experiments should be from the above list. 2025-09-07T06:09:28.5169940Z  2025-09-07T06:09:28.5170342Z  @User1,-lf,split_build 2025-09-07T06:09:28.5170853Z  @User2,lf 2025-09-07T06:09:28.5171311Z  @User3,split_build 2025-09-07T06:09:28.5171795Z """ 2025-09-07T06:09:28.5172172Z  2025-09-07T06:09:28.5172555Z import json 2025-09-07T06:09:28.5172998Z import logging 2025-09-07T06:09:28.5173447Z import os 2025-09-07T06:09:28.5173873Z import random 2025-09-07T06:09:28.5174425Z import re 2025-09-07T06:09:28.5174851Z import sys 2025-09-07T06:09:28.5175323Z from argparse import ArgumentParser 2025-09-07T06:09:28.5176013Z from collections.abc import Iterable 2025-09-07T06:09:28.5176603Z from functools import cache 2025-09-07T06:09:28.5177147Z from logging import LogRecord 2025-09-07T06:09:28.5177718Z from typing import Any, NamedTuple 2025-09-07T06:09:28.5178335Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.5178928Z  2025-09-07T06:09:28.5179312Z import yaml 2025-09-07T06:09:28.5179777Z from github import Auth, Github 2025-09-07T06:09:28.5180346Z from github.Issue import Issue 2025-09-07T06:09:28.5180861Z  2025-09-07T06:09:28.5181236Z  2025-09-07T06:09:28.5181691Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.5182453Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.5183419Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.5184491Z  2025-09-07T06:09:28.5185272Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.5185917Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.5186530Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.5187181Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.5187746Z  2025-09-07T06:09:28.5188174Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.5188723Z  2025-09-07T06:09:28.5189125Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.5189668Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.5190155Z  2025-09-07T06:09:28.5190518Z  2025-09-07T06:09:28.5190927Z class Experiment(NamedTuple): 2025-09-07T06:09:28.5191481Z  rollout_perc: float = ( 2025-09-07T06:09:28.5192216Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.5192938Z  ) 2025-09-07T06:09:28.5193361Z  all_branches: bool = ( 2025-09-07T06:09:28.5194214Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.5194941Z  ) 2025-09-07T06:09:28.5195350Z  default: bool = ( 2025-09-07T06:09:28.5196003Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.5196689Z  ) 2025-09-07T06:09:28.5197074Z  2025-09-07T06:09:28.5197481Z  # Add more fields as needed 2025-09-07T06:09:28.5197994Z  2025-09-07T06:09:28.5198374Z  2025-09-07T06:09:28.5198774Z class Settings(NamedTuple): 2025-09-07T06:09:28.5199274Z  """ 2025-09-07T06:09:28.5199802Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:28.5200426Z  """ 2025-09-07T06:09:28.5200824Z  2025-09-07T06:09:28.5201262Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.5201833Z  2025-09-07T06:09:28.5202336Z  2025-09-07T06:09:28.5202794Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.5203497Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.5204272Z  2025-09-07T06:09:28.5204669Z  COLORS = { 2025-09-07T06:09:28.5205151Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.5205726Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.5206281Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.5206845Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.5207394Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.5207918Z  } 2025-09-07T06:09:28.5208308Z  2025-09-07T06:09:28.5208758Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.5209583Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.5210435Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.5211075Z  return super().format(record) 2025-09-07T06:09:28.5211602Z  2025-09-07T06:09:28.5211977Z  2025-09-07T06:09:28.5212403Z handler = logging.StreamHandler() 2025-09-07T06:09:28.5213203Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.5214089Z  2025-09-07T06:09:28.5214594Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.5215245Z log.addHandler(handler) 2025-09-07T06:09:28.5215758Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.5216251Z  2025-09-07T06:09:28.5216621Z  2025-09-07T06:09:28.5217129Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.5217756Z  """ 2025-09-07T06:09:28.5218336Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.5219163Z  """ 2025-09-07T06:09:28.5219577Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:28.5220744Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.5221932Z  log.warning( 2025-09-07T06:09:28.5222886Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.5223862Z  ) 2025-09-07T06:09:28.5224690Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.5225286Z  return 2025-09-07T06:09:28.5225715Z  2025-09-07T06:09:28.5226154Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.5226792Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.5227420Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:28.5227958Z  2025-09-07T06:09:28.5228332Z  2025-09-07T06:09:28.5228899Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.5229617Z  return frozenset( 2025-09-07T06:09:28.5230324Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.5231051Z  ) 2025-09-07T06:09:28.5231463Z  2025-09-07T06:09:28.5231840Z  2025-09-07T06:09:28.5232235Z def parse_args() -> Any: 2025-09-07T06:09:28.5232898Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.5233845Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.5235091Z  parser.add_argument( 2025-09-07T06:09:28.5235630Z  "--github-issue-repo", 2025-09-07T06:09:28.5236170Z  type=str, 2025-09-07T06:09:28.5236666Z  required=False, 2025-09-07T06:09:28.5237371Z  default="pytorch/test-infra", 2025-09-07T06:09:28.5238005Z  help="GitHub repo to get the issue", 2025-09-07T06:09:28.5238565Z  ) 2025-09-07T06:09:28.5238997Z  parser.add_argument( 2025-09-07T06:09:28.5239509Z  "--github-repo", 2025-09-07T06:09:28.5240021Z  type=str, 2025-09-07T06:09:28.5240498Z  required=True, 2025-09-07T06:09:28.5241063Z  help="GitHub repo where CI is running", 2025-09-07T06:09:28.5241636Z  ) 2025-09-07T06:09:28.5242067Z  parser.add_argument( 2025-09-07T06:09:28.5242774Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.5243491Z  ) 2025-09-07T06:09:28.5244058Z  parser.add_argument( 2025-09-07T06:09:28.5244789Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.5245555Z  ) 2025-09-07T06:09:28.5245979Z  parser.add_argument( 2025-09-07T06:09:28.5246710Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.5247464Z  ) 2025-09-07T06:09:28.5247888Z  parser.add_argument( 2025-09-07T06:09:28.5248654Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.5249418Z  ) 2025-09-07T06:09:28.5249877Z  parser.add_argument( 2025-09-07T06:09:28.5250404Z  "--github-ref-type", 2025-09-07T06:09:28.5250933Z  type=str, 2025-09-07T06:09:28.5251419Z  required=True, 2025-09-07T06:09:28.5252026Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.5252625Z  ) 2025-09-07T06:09:28.5253053Z  parser.add_argument( 2025-09-07T06:09:28.5253739Z  "--eligible-experiments", 2025-09-07T06:09:28.5254456Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.5255035Z  required=False, 2025-09-07T06:09:28.5255538Z  default="", 2025-09-07T06:09:28.5256492Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.5257475Z  ) 2025-09-07T06:09:28.5257902Z  parser.add_argument( 2025-09-07T06:09:28.5258435Z  "--opt-out-experiments", 2025-09-07T06:09:28.5259029Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.5259599Z  required=False, 2025-09-07T06:09:28.5260099Z  default="", 2025-09-07T06:09:28.5260578Z  help=( 2025-09-07T06:09:28.5261336Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.5262554Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.5263447Z  ), 2025-09-07T06:09:28.5263872Z  ) 2025-09-07T06:09:28.5264579Z  parser.add_argument( 2025-09-07T06:09:28.5265108Z  "--pr-number", 2025-09-07T06:09:28.5265614Z  type=str, 2025-09-07T06:09:28.5266089Z  required=False, 2025-09-07T06:09:28.5266590Z  default="", 2025-09-07T06:09:28.5267163Z  help="the optional PR number where this is run", 2025-09-07T06:09:28.5267809Z  ) 2025-09-07T06:09:28.5268200Z  2025-09-07T06:09:28.5268620Z  return parser.parse_args() 2025-09-07T06:09:28.5269143Z  2025-09-07T06:09:28.5269524Z  2025-09-07T06:09:28.5270196Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.5271199Z  auth = Auth.Token(github_token) 2025-09-07T06:09:28.5271833Z  return Github(auth=auth) 2025-09-07T06:09:28.5272348Z  2025-09-07T06:09:28.5272719Z  2025-09-07T06:09:28.5273439Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.5274436Z  repo = gh.get_repo(repo) 2025-09-07T06:09:28.5275040Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.5275622Z  2025-09-07T06:09:28.5275992Z  2025-09-07T06:09:28.5276393Z def get_potential_pr_author( 2025-09-07T06:09:28.5277140Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.5277878Z ) -> str: 2025-09-07T06:09:28.5278488Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.5279396Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.5280239Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:28.5280874Z  2025-09-07T06:09:28.5281297Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.5281849Z  2025-09-07T06:09:28.5282363Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.5283074Z  split_tag = ref_name.split("/") 2025-09-07T06:09:28.5283637Z  if ( 2025-09-07T06:09:28.5284256Z  len(split_tag) == 3 2025-09-07T06:09:28.5284839Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:28.5285442Z  and split_tag[2].isnumeric() 2025-09-07T06:09:28.5286003Z  ): 2025-09-07T06:09:28.5286464Z  pr_number = split_tag[2] 2025-09-07T06:09:28.5287016Z  try: 2025-09-07T06:09:28.5287530Z  repository = gh.get_repo(repo) 2025-09-07T06:09:28.5288391Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.5289082Z  except Exception as e: 2025-09-07T06:09:28.5289681Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:28.5290436Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.5291139Z  ) from e 2025-09-07T06:09:28.5291778Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.5292562Z  # In all other cases, return the original input username 2025-09-07T06:09:28.5293212Z  return username 2025-09-07T06:09:28.5293685Z  2025-09-07T06:09:28.5294178Z  2025-09-07T06:09:28.5294653Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.5295242Z  """ 2025-09-07T06:09:28.5295984Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.5296840Z  """ 2025-09-07T06:09:28.5297459Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.5298190Z  2025-09-07T06:09:28.5298562Z  2025-09-07T06:09:28.5299007Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.5299583Z  try: 2025-09-07T06:09:28.5300048Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.5300621Z  return data 2025-09-07T06:09:28.5301127Z  except yaml.YAMLError: 2025-09-07T06:09:28.5301708Z  log.exception("Error loading YAML") 2025-09-07T06:09:28.5302281Z  raise 2025-09-07T06:09:28.5302715Z  2025-09-07T06:09:28.5303085Z  2025-09-07T06:09:28.5303766Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.5304888Z  """ 2025-09-07T06:09:28.5305770Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.5306612Z  2025-09-07T06:09:28.5307207Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.5308063Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.5308676Z  2025-09-07T06:09:28.5309309Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.5310070Z  """ 2025-09-07T06:09:28.5310595Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.5311280Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.5311976Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.5312628Z  else: 2025-09-07T06:09:28.5313289Z  return "", rollout_state 2025-09-07T06:09:28.5314732Z  2025-09-07T06:09:28.5315149Z  2025-09-07T06:09:28.5315616Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.5316189Z  """ 2025-09-07T06:09:28.5316798Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.5317513Z  """ 2025-09-07T06:09:28.5317907Z  2025-09-07T06:09:28.5318278Z  2025-09-07T06:09:28.5318867Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.5319588Z  """ 2025-09-07T06:09:28.5320378Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.5321289Z  2025-09-07T06:09:28.5322178Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.5323263Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.5324428Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.5325132Z  2025-09-07T06:09:28.5325508Z  2025-09-07T06:09:28.5325873Z  """ 2025-09-07T06:09:28.5326298Z  optins = UserOptins() 2025-09-07T06:09:28.5326880Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.5327517Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:28.5328147Z  if not user or not user.startswith("@"): 2025-09-07T06:09:28.5328769Z  # Not a valid user. Skip 2025-09-07T06:09:28.5329326Z  continue 2025-09-07T06:09:28.5329778Z  2025-09-07T06:09:28.5330159Z  if user: 2025-09-07T06:09:28.5330741Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.5331517Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.5332213Z  2025-09-07T06:09:28.5332605Z  return optins 2025-09-07T06:09:28.5333068Z  2025-09-07T06:09:28.5333436Z  2025-09-07T06:09:28.5334080Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.5334752Z  """ 2025-09-07T06:09:28.5335225Z  Check if the experiment name is valid. 2025-09-07T06:09:28.5335803Z  A valid name: 2025-09-07T06:09:28.5336541Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.5337564Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.5338337Z  - Cannot contain spaces 2025-09-07T06:09:28.5338869Z  """ 2025-09-07T06:09:28.5339261Z  2025-09-07T06:09:28.5339766Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.5340568Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.5341363Z  2025-09-07T06:09:28.5341755Z  if valid: 2025-09-07T06:09:28.5342200Z  return True 2025-09-07T06:09:28.5342659Z  2025-09-07T06:09:28.5343037Z  log.error( 2025-09-07T06:09:28.5344723Z  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-09-07T06:09:28.5346412Z  ) 2025-09-07T06:09:28.5346819Z  return False 2025-09-07T06:09:28.5347270Z  2025-09-07T06:09:28.5347635Z  2025-09-07T06:09:28.5348203Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.5348891Z  """ 2025-09-07T06:09:28.5349560Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.5350336Z  """ 2025-09-07T06:09:28.5350746Z  try: 2025-09-07T06:09:28.5351167Z  if settings_text: 2025-09-07T06:09:28.5351987Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.5352840Z  # for easy reading 2025-09-07T06:09:28.5353727Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.5354802Z  # the backtick character in shell commands. 2025-09-07T06:09:28.5355481Z  backtick = chr(96) # backtick character 2025-09-07T06:09:28.5356227Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.5356962Z  settings = load_yaml(settings_text) 2025-09-07T06:09:28.5357522Z  2025-09-07T06:09:28.5358174Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.5359113Z  experiments = {} 2025-09-07T06:09:28.5359625Z  2025-09-07T06:09:28.5360231Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.5361056Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.5362256Z  # 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-09-07T06:09:28.5363371Z  continue 2025-09-07T06:09:28.5363878Z  2025-09-07T06:09:28.5364384Z  valid_settings = {} 2025-09-07T06:09:28.5364975Z  for setting in exp_settings: 2025-09-07T06:09:28.5365606Z  if setting not in Experiment._fields: 2025-09-07T06:09:28.5366220Z  log.warning( 2025-09-07T06:09:28.5367021Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.5367817Z  ) 2025-09-07T06:09:28.5368321Z  else: 2025-09-07T06:09:28.5368921Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.5369535Z  2025-09-07T06:09:28.5370051Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.5370749Z  return Settings(experiments) 2025-09-07T06:09:28.5371293Z  2025-09-07T06:09:28.5371678Z  except Exception: 2025-09-07T06:09:28.5372243Z  log.exception("Failed to parse settings") 2025-09-07T06:09:28.5372837Z  2025-09-07T06:09:28.5373222Z  return Settings() 2025-09-07T06:09:28.5373708Z  2025-09-07T06:09:28.5374326Z  2025-09-07T06:09:28.5375223Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.5375900Z  """ 2025-09-07T06:09:28.5376410Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.5377006Z  2025-09-07T06:09:28.5377595Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.5378440Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.5379039Z  2025-09-07T06:09:28.5379691Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.5380466Z  """ 2025-09-07T06:09:28.5381113Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.5381956Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.5382555Z  2025-09-07T06:09:28.5382925Z  2025-09-07T06:09:28.5383425Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.5384151Z  """ 2025-09-07T06:09:28.5384607Z  Parse users from the rollout state. 2025-09-07T06:09:28.5385160Z  2025-09-07T06:09:28.5385521Z  """ 2025-09-07T06:09:28.5386125Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.5386955Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.5387547Z  2025-09-07T06:09:28.5387908Z  2025-09-07T06:09:28.5388590Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.5389409Z  """ 2025-09-07T06:09:28.5389892Z  Check if a user is opted into an experiment 2025-09-07T06:09:28.5390475Z  """ 2025-09-07T06:09:28.5391001Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.5391631Z  2025-09-07T06:09:28.5392137Z  2025-09-07T06:09:28.5392820Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.5393638Z  """ 2025-09-07T06:09:28.5394269Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.5394904Z  """ 2025-09-07T06:09:28.5395475Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.5396248Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.5396962Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.5397616Z  return False 2025-09-07T06:09:28.5398076Z  2025-09-07T06:09:28.5398581Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.5399241Z  log.warning( 2025-09-07T06:09:28.5400172Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.5401128Z  ) 2025-09-07T06:09:28.5401535Z  2025-09-07T06:09:28.5401913Z  return True 2025-09-07T06:09:28.5402357Z  2025-09-07T06:09:28.5402722Z  2025-09-07T06:09:28.5403121Z def get_runner_prefix( 2025-09-07T06:09:28.5403661Z  rollout_state: str, 2025-09-07T06:09:28.5404310Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:28.5404873Z  branch: str, 2025-09-07T06:09:28.5405458Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.5406234Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.5406873Z  is_canary: bool = False, 2025-09-07T06:09:28.5407384Z ) -> str: 2025-09-07T06:09:28.5407883Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:28.5408535Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.5409376Z  2025-09-07T06:09:28.5410072Z  fleet_prefix = "" 2025-09-07T06:09:28.5410592Z  prefixes = [] 2025-09-07T06:09:28.5411334Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.5412374Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.5413145Z  log.info( 2025-09-07T06:09:28.5414045Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.5414856Z  ) 2025-09-07T06:09:28.5415331Z  continue 2025-09-07T06:09:28.5415791Z  2025-09-07T06:09:28.5416197Z  if opt_out_experiments: 2025-09-07T06:09:28.5416810Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.5417532Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.5418186Z  log.info( 2025-09-07T06:09:28.5419209Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.5420297Z  ) 2025-09-07T06:09:28.5420767Z  continue 2025-09-07T06:09:28.5421244Z  2025-09-07T06:09:28.5421661Z  if eligible_experiments: 2025-09-07T06:09:28.5422297Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.5423002Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.5423602Z  log.info( 2025-09-07T06:09:28.5424587Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.5425484Z  ) 2025-09-07T06:09:28.5426087Z  continue 2025-09-07T06:09:28.5426655Z  elif not experiment_settings.default: 2025-09-07T06:09:28.5427235Z  log.info( 2025-09-07T06:09:28.5427984Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.5428771Z  ) 2025-09-07T06:09:28.5429204Z  continue 2025-09-07T06:09:28.5429662Z  2025-09-07T06:09:28.5430178Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.5430864Z  opted_out_users = [ 2025-09-07T06:09:28.5431390Z  requestor 2025-09-07T06:09:28.5431934Z  for requestor in workflow_requestors 2025-09-07T06:09:28.5432677Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.5433362Z  ] 2025-09-07T06:09:28.5433771Z  2025-09-07T06:09:28.5434459Z  if opted_out_users: 2025-09-07T06:09:28.5435019Z  log.info( 2025-09-07T06:09:28.5435735Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.5436491Z  ) 2025-09-07T06:09:28.5436927Z  continue 2025-09-07T06:09:28.5437392Z  2025-09-07T06:09:28.5437908Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.5438574Z  opted_in_users = [ 2025-09-07T06:09:28.5439119Z  requestor 2025-09-07T06:09:28.5439662Z  for requestor in workflow_requestors 2025-09-07T06:09:28.5440407Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.5441090Z  ] 2025-09-07T06:09:28.5441505Z  2025-09-07T06:09:28.5441889Z  enabled = False 2025-09-07T06:09:28.5442415Z  if opted_in_users: 2025-09-07T06:09:28.5443070Z  log.info( 2025-09-07T06:09:28.5443780Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.5444640Z  ) 2025-09-07T06:09:28.5445090Z  enabled = True 2025-09-07T06:09:28.5445586Z  2025-09-07T06:09:28.5446028Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.5446935Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.5447967Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.5448675Z  log.info( 2025-09-07T06:09:28.5449640Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.5450622Z  ) 2025-09-07T06:09:28.5451114Z  enabled = True 2025-09-07T06:09:28.5451631Z  2025-09-07T06:09:28.5452012Z  if enabled: 2025-09-07T06:09:28.5452525Z  label = experiment_name 2025-09-07T06:09:28.5453148Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.5454148Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.5455099Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.5455937Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.5456660Z  if is_canary: 2025-09-07T06:09:28.5457232Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.5457833Z  fleet_prefix = label 2025-09-07T06:09:28.5458376Z  else: 2025-09-07T06:09:28.5459037Z  prefixes.append(label) 2025-09-07T06:09:28.5459581Z  2025-09-07T06:09:28.5459982Z  if len(prefixes) > 1: 2025-09-07T06:09:28.5460497Z  log.error( 2025-09-07T06:09:28.5461637Z  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-09-07T06:09:28.5462821Z  ) 2025-09-07T06:09:28.5463265Z  prefixes = prefixes[:1] 2025-09-07T06:09:28.5463785Z  2025-09-07T06:09:28.5464286Z  # Fleet always comes first 2025-09-07T06:09:28.5464831Z  if fleet_prefix: 2025-09-07T06:09:28.5465354Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.5465902Z  2025-09-07T06:09:28.5466398Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.5467009Z  2025-09-07T06:09:28.5467385Z  2025-09-07T06:09:28.5468111Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.5468935Z  """ 2025-09-07T06:09:28.5469592Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.5470349Z  2025-09-07T06:09:28.5470982Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.5471737Z  """ 2025-09-07T06:09:28.5472190Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.5472805Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.5473522Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.5474266Z  2025-09-07T06:09:28.5474632Z  2025-09-07T06:09:28.5475280Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.5476236Z  for _ in range(num_retries): 2025-09-07T06:09:28.5476783Z  try: 2025-09-07T06:09:28.5477279Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:28.5478008Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.5478716Z  return json.loads(content) 2025-09-07T06:09:28.5479292Z  except Exception as e: 2025-09-07T06:09:28.5479917Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.5480506Z  2025-09-07T06:09:28.5481126Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.5481893Z  return {} 2025-09-07T06:09:28.5482329Z  2025-09-07T06:09:28.5482691Z  2025-09-07T06:09:28.5483066Z @cache 2025-09-07T06:09:28.5483773Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.5484701Z  """ 2025-09-07T06:09:28.5485156Z  Dynamically get PR information 2025-09-07T06:09:28.5485692Z  """ 2025-09-07T06:09:28.5486261Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.5486937Z  headers = { 2025-09-07T06:09:28.5487484Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.5488162Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:28.5488742Z  } 2025-09-07T06:09:28.5489241Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.5489930Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.5490519Z  headers=headers, 2025-09-07T06:09:28.5491007Z  ) 2025-09-07T06:09:28.5491410Z  2025-09-07T06:09:28.5491813Z  if not json_response: 2025-09-07T06:09:28.5492476Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.5493307Z  return {} 2025-09-07T06:09:28.5493769Z  2025-09-07T06:09:28.5494271Z  return json_response 2025-09-07T06:09:28.5494763Z  2025-09-07T06:09:28.5495139Z  2025-09-07T06:09:28.5495776Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.5496559Z  """ 2025-09-07T06:09:28.5497156Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.5497866Z  """ 2025-09-07T06:09:28.5498421Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.5499089Z  return { 2025-09-07T06:09:28.5499752Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.5500483Z  } 2025-09-07T06:09:28.5500879Z  2025-09-07T06:09:28.5501252Z  2025-09-07T06:09:28.5501649Z def main() -> None: 2025-09-07T06:09:28.5502145Z  args = parse_args() 2025-09-07T06:09:28.5502622Z  2025-09-07T06:09:28.5503089Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.5503665Z  2025-09-07T06:09:28.5504188Z  # Check if the PR is opt-out 2025-09-07T06:09:28.5504738Z  if args.pr_number: 2025-09-07T06:09:28.5505485Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.5506304Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.5506863Z  log.info( 2025-09-07T06:09:28.5507651Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.5508463Z  ) 2025-09-07T06:09:28.5509104Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.5509838Z  sys.exit() 2025-09-07T06:09:28.5510436Z  2025-09-07T06:09:28.5510820Z  try: 2025-09-07T06:09:28.5511333Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.5512125Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.5512810Z  ) 2025-09-07T06:09:28.5513227Z  2025-09-07T06:09:28.5513668Z  username = get_potential_pr_author( 2025-09-07T06:09:28.5514449Z  args.github_token, 2025-09-07T06:09:28.5515039Z  args.github_repo, 2025-09-07T06:09:28.5515577Z  args.github_actor, 2025-09-07T06:09:28.5516135Z  args.github_ref_type, 2025-09-07T06:09:28.5516693Z  args.github_branch, 2025-09-07T06:09:28.5517212Z  ) 2025-09-07T06:09:28.5517616Z  2025-09-07T06:09:28.5518149Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.5518803Z  2025-09-07T06:09:28.5519264Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.5519863Z  rollout_state, 2025-09-07T06:09:28.5520427Z  (args.github_issue_owner, username), 2025-09-07T06:09:28.5521037Z  args.github_branch, 2025-09-07T06:09:28.5521608Z  args.eligible_experiments, 2025-09-07T06:09:28.5522206Z  args.opt_out_experiments, 2025-09-07T06:09:28.5522760Z  is_canary, 2025-09-07T06:09:28.5523244Z  ) 2025-09-07T06:09:28.5523644Z  2025-09-07T06:09:28.5524149Z  except Exception as e: 2025-09-07T06:09:28.5524670Z  log.error( 2025-09-07T06:09:28.5525444Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.5526397Z  ) 2025-09-07T06:09:28.5526804Z  2025-09-07T06:09:28.5527383Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.5528079Z  2025-09-07T06:09:28.5528463Z  2025-09-07T06:09:28.5528855Z if __name__ == "__main__": 2025-09-07T06:09:28.5529361Z  main() 2025-09-07T06:09:28.5529775Z  2025-09-07T06:09:28.5530144Z EOF 2025-09-07T06:09:28.5530532Z  2025-09-07T06:09:28.5530944Z cat runner_determinator.py 2025-09-07T06:09:28.5918665Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.5919628Z env: 2025-09-07T06:09:28.5920427Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.5920857Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.5921326Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.5921876Z ISSUE_OWNER: 2025-09-07T06:09:28.5922305Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.5922758Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.5923214Z PR_NUMBER: 2025-09-07T06:09:28.5923643Z ##[endgroup] 2025-09-07T06:09:28.6146498Z # flake8: noqa: G004 2025-09-07T06:09:28.6146933Z 2025-09-07T06:09:28.6147385Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.6148373Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.6149212Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.6149687Z 2025-09-07T06:09:28.6149857Z """ 2025-09-07T06:09:28.6150482Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.6151380Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.6152332Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.6153178Z of which runners should be used to run which job. 2025-09-07T06:09:28.6153615Z 2025-09-07T06:09:28.6154260Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.6155428Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.6156378Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.6157125Z list, defined. 2025-09-07T06:09:28.6157388Z 2025-09-07T06:09:28.6157764Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.6158738Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.6159593Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.6160064Z 2025-09-07T06:09:28.6160438Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.6161345Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.6162112Z experiments which the user could be opted in to. 2025-09-07T06:09:28.6162536Z 2025-09-07T06:09:28.6162757Z The user list has the following rules: 2025-09-07T06:09:28.6163124Z 2025-09-07T06:09:28.6163459Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.6164649Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.6165455Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.6165886Z 2025-09-07T06:09:28.6166070Z Example config: 2025-09-07T06:09:28.6166572Z # A list of experiments that can be opted into. 2025-09-07T06:09:28.6167282Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.6167946Z # Expected syntax is: 2025-09-07T06:09:28.6168627Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.6169656Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.6170293Z 2025-09-07T06:09:28.6170474Z experiments: 2025-09-07T06:09:28.6170906Z lf: 2025-09-07T06:09:28.6171322Z rollout_percent: 25 2025-09-07T06:09:28.6172025Z all_branches: false 2025-09-07T06:09:28.6172514Z default: true 2025-09-07T06:09:28.6172961Z --- 2025-09-07T06:09:28.6173203Z 2025-09-07T06:09:28.6173381Z # Opt-ins: 2025-09-07T06:09:28.6174222Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.6175174Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.6175980Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.6176676Z # Experiments should be from the above list. 2025-09-07T06:09:28.6177086Z 2025-09-07T06:09:28.6177280Z @User1,-lf,split_build 2025-09-07T06:09:28.6177750Z @User2,lf 2025-09-07T06:09:28.6178178Z @User3,split_build 2025-09-07T06:09:28.6178619Z """ 2025-09-07T06:09:28.6178843Z 2025-09-07T06:09:28.6179015Z import json 2025-09-07T06:09:28.6179419Z import logging 2025-09-07T06:09:28.6179845Z import os 2025-09-07T06:09:28.6180246Z import random 2025-09-07T06:09:28.6180659Z import re 2025-09-07T06:09:28.6181065Z import sys 2025-09-07T06:09:28.6181512Z from argparse import ArgumentParser 2025-09-07T06:09:28.6182082Z from collections.abc import Iterable 2025-09-07T06:09:28.6182643Z from functools import cache 2025-09-07T06:09:28.6183152Z from logging import LogRecord 2025-09-07T06:09:28.6183677Z from typing import Any, NamedTuple 2025-09-07T06:09:28.6184550Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.6184979Z 2025-09-07T06:09:28.6185148Z import yaml 2025-09-07T06:09:28.6185583Z from github import Auth, Github 2025-09-07T06:09:28.6186102Z from github.Issue import Issue 2025-09-07T06:09:28.6186439Z 2025-09-07T06:09:28.6186447Z 2025-09-07T06:09:28.6186673Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.6187401Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.6188306Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.6188891Z 2025-09-07T06:09:28.6189129Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.6189892Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.6190471Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.6191061Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.6191449Z 2025-09-07T06:09:28.6191656Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.6192023Z 2025-09-07T06:09:28.6192228Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.6192732Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.6193051Z 2025-09-07T06:09:28.6193067Z 2025-09-07T06:09:28.6193277Z class Experiment(NamedTuple): 2025-09-07T06:09:28.6193796Z rollout_perc: float = ( 2025-09-07T06:09:28.6194603Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.6195316Z ) 2025-09-07T06:09:28.6195722Z all_branches: bool = ( 2025-09-07T06:09:28.6196388Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.6197092Z ) 2025-09-07T06:09:28.6197502Z default: bool = ( 2025-09-07T06:09:28.6198106Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.6198790Z ) 2025-09-07T06:09:28.6199015Z 2025-09-07T06:09:28.6199204Z # Add more fields as needed 2025-09-07T06:09:28.6199531Z 2025-09-07T06:09:28.6199538Z 2025-09-07T06:09:28.6199731Z class Settings(NamedTuple): 2025-09-07T06:09:28.6200208Z """ 2025-09-07T06:09:28.6200688Z Settings for the experiments that can be opted into. 2025-09-07T06:09:28.6201286Z """ 2025-09-07T06:09:28.6201512Z 2025-09-07T06:09:28.6201730Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.6202121Z 2025-09-07T06:09:28.6202138Z 2025-09-07T06:09:28.6202351Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.6203000Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.6203510Z 2025-09-07T06:09:28.6203683Z COLORS = { 2025-09-07T06:09:28.6204386Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.6205110Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.6205666Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.6206197Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.6206723Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.6207218Z } 2025-09-07T06:09:28.6207451Z 2025-09-07T06:09:28.6207676Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.6208455Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.6209267Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.6209882Z return super().format(record) 2025-09-07T06:09:28.6210242Z 2025-09-07T06:09:28.6210250Z 2025-09-07T06:09:28.6210453Z handler = logging.StreamHandler() 2025-09-07T06:09:28.6211189Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.6211774Z 2025-09-07T06:09:28.6212021Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.6212644Z log.addHandler(handler) 2025-09-07T06:09:28.6213121Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.6213440Z 2025-09-07T06:09:28.6213447Z 2025-09-07T06:09:28.6213705Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.6214418Z """ 2025-09-07T06:09:28.6214957Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.6215624Z """ 2025-09-07T06:09:28.6216028Z if not GITHUB_OUTPUT: 2025-09-07T06:09:28.6217126Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.6218275Z log.warning( 2025-09-07T06:09:28.6219163Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.6220153Z ) 2025-09-07T06:09:28.6230202Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.6230855Z return 2025-09-07T06:09:28.6231116Z 2025-09-07T06:09:28.6231522Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.6232167Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.6232779Z f.write(f"{key}={value}\n") 2025-09-07T06:09:28.6233143Z 2025-09-07T06:09:28.6233150Z 2025-09-07T06:09:28.6233470Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.6234325Z return frozenset( 2025-09-07T06:09:28.6234985Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.6235715Z ) 2025-09-07T06:09:28.6235942Z 2025-09-07T06:09:28.6235949Z 2025-09-07T06:09:28.6236141Z def parse_args() -> Any: 2025-09-07T06:09:28.6236736Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.6237625Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.6238712Z parser.add_argument( 2025-09-07T06:09:28.6239271Z "--github-issue-repo", 2025-09-07T06:09:28.6239893Z type=str, 2025-09-07T06:09:28.6240538Z required=False, 2025-09-07T06:09:28.6241056Z default="pytorch/test-infra", 2025-09-07T06:09:28.6241636Z help="GitHub repo to get the issue", 2025-09-07T06:09:28.6242174Z ) 2025-09-07T06:09:28.6242584Z parser.add_argument( 2025-09-07T06:09:28.6243381Z "--github-repo", 2025-09-07T06:09:28.6243879Z type=str, 2025-09-07T06:09:28.6244712Z required=True, 2025-09-07T06:09:28.6245441Z help="GitHub repo where CI is running", 2025-09-07T06:09:28.6246010Z ) 2025-09-07T06:09:28.6246418Z parser.add_argument( 2025-09-07T06:09:28.6247063Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.6247753Z ) 2025-09-07T06:09:28.6248153Z parser.add_argument( 2025-09-07T06:09:28.6248820Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.6304979Z ) 2025-09-07T06:09:28.6305620Z parser.add_argument( 2025-09-07T06:09:28.6306694Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.6307458Z ) 2025-09-07T06:09:28.6307865Z parser.add_argument( 2025-09-07T06:09:28.6308584Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.6309354Z ) 2025-09-07T06:09:28.6309766Z parser.add_argument( 2025-09-07T06:09:28.6310248Z "--github-ref-type", 2025-09-07T06:09:28.6310751Z type=str, 2025-09-07T06:09:28.6311179Z required=True, 2025-09-07T06:09:28.6311705Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.6312283Z ) 2025-09-07T06:09:28.6312693Z parser.add_argument( 2025-09-07T06:09:28.6313200Z "--eligible-experiments", 2025-09-07T06:09:28.6313754Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6314491Z required=False, 2025-09-07T06:09:28.6314939Z default="", 2025-09-07T06:09:28.6315828Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.6316799Z ) 2025-09-07T06:09:28.6317205Z parser.add_argument( 2025-09-07T06:09:28.6317690Z "--opt-out-experiments", 2025-09-07T06:09:28.6318239Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6318798Z required=False, 2025-09-07T06:09:28.6319256Z default="", 2025-09-07T06:09:28.6319687Z help=( 2025-09-07T06:09:28.6320393Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.6321558Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.6322428Z ), 2025-09-07T06:09:28.6322820Z ) 2025-09-07T06:09:28.6323213Z parser.add_argument( 2025-09-07T06:09:28.6323687Z "--pr-number", 2025-09-07T06:09:28.6324575Z type=str, 2025-09-07T06:09:28.6325056Z required=False, 2025-09-07T06:09:28.6325547Z default="", 2025-09-07T06:09:28.6326220Z help="the optional PR number where this is run", 2025-09-07T06:09:28.6326830Z ) 2025-09-07T06:09:28.6327053Z 2025-09-07T06:09:28.6327251Z return parser.parse_args() 2025-09-07T06:09:28.6327595Z 2025-09-07T06:09:28.6327603Z 2025-09-07T06:09:28.6328016Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6328803Z auth = Auth.Token(github_token) 2025-09-07T06:09:28.6329349Z return Github(auth=auth) 2025-09-07T06:09:28.6329672Z 2025-09-07T06:09:28.6329679Z 2025-09-07T06:09:28.6330145Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6330974Z repo = gh.get_repo(repo) 2025-09-07T06:09:28.6331507Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.6331895Z 2025-09-07T06:09:28.6331902Z 2025-09-07T06:09:28.6332098Z def get_potential_pr_author( 2025-09-07T06:09:28.6332780Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.6333499Z ) -> str: 2025-09-07T06:09:28.6334178Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.6335035Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.6335807Z # embedded in the tag name: ciflow// 2025-09-07T06:09:28.6336255Z 2025-09-07T06:09:28.6336457Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.6336816Z 2025-09-07T06:09:28.6337091Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.6337754Z split_tag = ref_name.split("/") 2025-09-07T06:09:28.6338294Z if ( 2025-09-07T06:09:28.6338725Z len(split_tag) == 3 2025-09-07T06:09:28.6339242Z and split_tag[0] == "ciflow" 2025-09-07T06:09:28.6339794Z and split_tag[2].isnumeric() 2025-09-07T06:09:28.6340324Z ): 2025-09-07T06:09:28.6340738Z pr_number = split_tag[2] 2025-09-07T06:09:28.6341504Z try: 2025-09-07T06:09:28.6341971Z repository = gh.get_repo(repo) 2025-09-07T06:09:28.6342630Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.6343262Z except Exception as e: 2025-09-07T06:09:28.6343821Z raise Exception( # noqa: TRY002 2025-09-07T06:09:28.6344639Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.6345322Z ) from e 2025-09-07T06:09:28.6345900Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.6346627Z # In all other cases, return the original input username 2025-09-07T06:09:28.6347253Z return username 2025-09-07T06:09:28.6347517Z 2025-09-07T06:09:28.6347524Z 2025-09-07T06:09:28.6347760Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.6348329Z """ 2025-09-07T06:09:28.6349001Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.6349823Z """ 2025-09-07T06:09:28.6350402Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.6350945Z 2025-09-07T06:09:28.6350952Z 2025-09-07T06:09:28.6351155Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.6351685Z try: 2025-09-07T06:09:28.6352098Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.6352647Z return data 2025-09-07T06:09:28.6353087Z except yaml.YAMLError: 2025-09-07T06:09:28.6353604Z log.exception("Error loading YAML") 2025-09-07T06:09:28.6354254Z raise 2025-09-07T06:09:28.6354499Z 2025-09-07T06:09:28.6354506Z 2025-09-07T06:09:28.6354938Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.6355720Z """ 2025-09-07T06:09:28.6356367Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.6357000Z 2025-09-07T06:09:28.6357477Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6358271Z and the text below is the list of opted in users. 2025-09-07T06:09:28.6358703Z 2025-09-07T06:09:28.6359082Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.6359822Z """ 2025-09-07T06:09:28.6360289Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.6360948Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.6361580Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.6362202Z else: 2025-09-07T06:09:28.6362598Z return "", rollout_state 2025-09-07T06:09:28.6362939Z 2025-09-07T06:09:28.6362946Z 2025-09-07T06:09:28.6363157Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.6363696Z """ 2025-09-07T06:09:28.6364531Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.6365233Z """ 2025-09-07T06:09:28.6365458Z 2025-09-07T06:09:28.6365465Z 2025-09-07T06:09:28.6365816Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.6366500Z """ 2025-09-07T06:09:28.6367238Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.6367946Z 2025-09-07T06:09:28.6368574Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.6369607Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.6370320Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.6370838Z 2025-09-07T06:09:28.6370845Z 2025-09-07T06:09:28.6371009Z """ 2025-09-07T06:09:28.6371411Z optins = UserOptins() 2025-09-07T06:09:28.6371929Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.6372509Z user = user.strip("\r\n\t -") 2025-09-07T06:09:28.6373080Z if not user or not user.startswith("@"): 2025-09-07T06:09:28.6373827Z # Not a valid user. Skip 2025-09-07T06:09:28.6374493Z continue 2025-09-07T06:09:28.6374764Z 2025-09-07T06:09:28.6374935Z if user: 2025-09-07T06:09:28.6375403Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.6376124Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.6376642Z 2025-09-07T06:09:28.6376817Z return optins 2025-09-07T06:09:28.6377082Z 2025-09-07T06:09:28.6377088Z 2025-09-07T06:09:28.6377382Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.6378015Z """ 2025-09-07T06:09:28.6378438Z Check if the experiment name is valid. 2025-09-07T06:09:28.6378990Z A valid name: 2025-09-07T06:09:28.6379654Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.6380661Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.6381416Z - Cannot contain spaces 2025-09-07T06:09:28.6381907Z """ 2025-09-07T06:09:28.6382126Z 2025-09-07T06:09:28.6382393Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.6383125Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.6383588Z 2025-09-07T06:09:28.6383758Z if valid: 2025-09-07T06:09:28.6384264Z return True 2025-09-07T06:09:28.6384531Z 2025-09-07T06:09:28.6384704Z log.error( 2025-09-07T06:09:28.6386187Z 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-09-07T06:09:28.6387778Z ) 2025-09-07T06:09:28.6388162Z return False 2025-09-07T06:09:28.6388419Z 2025-09-07T06:09:28.6388425Z 2025-09-07T06:09:28.6388741Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.6389393Z """ 2025-09-07T06:09:28.6390129Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.6390911Z """ 2025-09-07T06:09:28.6391286Z try: 2025-09-07T06:09:28.6391688Z if settings_text: 2025-09-07T06:09:28.6392441Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.6393271Z # for easy reading 2025-09-07T06:09:28.6394199Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.6395131Z # the backtick character in shell commands. 2025-09-07T06:09:28.6395773Z backtick = chr(96) # backtick character 2025-09-07T06:09:28.6396461Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.6397170Z settings = load_yaml(settings_text) 2025-09-07T06:09:28.6397567Z 2025-09-07T06:09:28.6397992Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.6398798Z experiments = {} 2025-09-07T06:09:28.6399122Z 2025-09-07T06:09:28.6399524Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.6400333Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.6401469Z # 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-09-07T06:09:28.6402538Z continue 2025-09-07T06:09:28.6402849Z 2025-09-07T06:09:28.6403069Z valid_settings = {} 2025-09-07T06:09:28.6403623Z for setting in exp_settings: 2025-09-07T06:09:28.6404475Z if setting not in Experiment._fields: 2025-09-07T06:09:28.6405083Z log.warning( 2025-09-07T06:09:28.6405810Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.6406784Z ) 2025-09-07T06:09:28.6407242Z else: 2025-09-07T06:09:28.6407782Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.6408236Z 2025-09-07T06:09:28.6408520Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.6409192Z return Settings(experiments) 2025-09-07T06:09:28.6409572Z 2025-09-07T06:09:28.6409756Z except Exception: 2025-09-07T06:09:28.6410262Z log.exception("Failed to parse settings") 2025-09-07T06:09:28.6410680Z 2025-09-07T06:09:28.6410856Z return Settings() 2025-09-07T06:09:28.6411133Z 2025-09-07T06:09:28.6411140Z 2025-09-07T06:09:28.6411394Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.6411990Z """ 2025-09-07T06:09:28.6412467Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.6412889Z 2025-09-07T06:09:28.6413238Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6414151Z and the text below is the list of opted in users. 2025-09-07T06:09:28.6414587Z 2025-09-07T06:09:28.6415004Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.6415772Z """ 2025-09-07T06:09:28.6416352Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6417147Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.6417569Z 2025-09-07T06:09:28.6417575Z 2025-09-07T06:09:28.6417827Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.6418415Z """ 2025-09-07T06:09:28.6418831Z Parse users from the rollout state. 2025-09-07T06:09:28.6419210Z 2025-09-07T06:09:28.6419372Z """ 2025-09-07T06:09:28.6419927Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6420714Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.6421154Z 2025-09-07T06:09:28.6421161Z 2025-09-07T06:09:28.6421708Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6422513Z """ 2025-09-07T06:09:28.6422960Z Check if a user is opted into an experiment 2025-09-07T06:09:28.6423534Z """ 2025-09-07T06:09:28.6424115Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.6424574Z 2025-09-07T06:09:28.6424581Z 2025-09-07T06:09:28.6425007Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6425801Z """ 2025-09-07T06:09:28.6426278Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.6426892Z """ 2025-09-07T06:09:28.6427418Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.6428136Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.6428805Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.6429447Z return False 2025-09-07T06:09:28.6429726Z 2025-09-07T06:09:28.6430013Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.6430649Z log.warning( 2025-09-07T06:09:28.6431490Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.6432417Z ) 2025-09-07T06:09:28.6432645Z 2025-09-07T06:09:28.6432832Z return True 2025-09-07T06:09:28.6433087Z 2025-09-07T06:09:28.6433095Z 2025-09-07T06:09:28.6433275Z def get_runner_prefix( 2025-09-07T06:09:28.6433742Z rollout_state: str, 2025-09-07T06:09:28.6434322Z workflow_requestors: Iterable[str], 2025-09-07T06:09:28.6434874Z branch: str, 2025-09-07T06:09:28.6435403Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6436097Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6436726Z is_canary: bool = False, 2025-09-07T06:09:28.6437206Z ) -> str: 2025-09-07T06:09:28.6437809Z settings = parse_settings(rollout_state) 2025-09-07T06:09:28.6438420Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.6438822Z 2025-09-07T06:09:28.6439005Z fleet_prefix = "" 2025-09-07T06:09:28.6439450Z prefixes = [] 2025-09-07T06:09:28.6440127Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.6441111Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.6441855Z log.info( 2025-09-07T06:09:28.6442571Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.6443369Z ) 2025-09-07T06:09:28.6443777Z continue 2025-09-07T06:09:28.6444311Z 2025-09-07T06:09:28.6444527Z if opt_out_experiments: 2025-09-07T06:09:28.6445120Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.6445798Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.6446429Z log.info( 2025-09-07T06:09:28.6447395Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.6448422Z ) 2025-09-07T06:09:28.6448853Z continue 2025-09-07T06:09:28.6449146Z 2025-09-07T06:09:28.6449340Z if eligible_experiments: 2025-09-07T06:09:28.6449967Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.6450650Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.6451260Z log.info( 2025-09-07T06:09:28.6452089Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.6452960Z ) 2025-09-07T06:09:28.6453389Z continue 2025-09-07T06:09:28.6454480Z elif not experiment_settings.default: 2025-09-07T06:09:28.6455084Z log.info( 2025-09-07T06:09:28.6455934Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.6456730Z ) 2025-09-07T06:09:28.6457140Z continue 2025-09-07T06:09:28.6457410Z 2025-09-07T06:09:28.6457698Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.6458359Z opted_out_users = [ 2025-09-07T06:09:28.6458842Z requestor 2025-09-07T06:09:28.6459333Z for requestor in workflow_requestors 2025-09-07T06:09:28.6460042Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6460709Z ] 2025-09-07T06:09:28.6460932Z 2025-09-07T06:09:28.6461119Z if opted_out_users: 2025-09-07T06:09:28.6461600Z log.info( 2025-09-07T06:09:28.6462250Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.6462977Z ) 2025-09-07T06:09:28.6463384Z continue 2025-09-07T06:09:28.6463655Z 2025-09-07T06:09:28.6464096Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.6464775Z opted_in_users = [ 2025-09-07T06:09:28.6465250Z requestor 2025-09-07T06:09:28.6465738Z for requestor in workflow_requestors 2025-09-07T06:09:28.6466436Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6467096Z ] 2025-09-07T06:09:28.6467319Z 2025-09-07T06:09:28.6467500Z enabled = False 2025-09-07T06:09:28.6467958Z if opted_in_users: 2025-09-07T06:09:28.6468430Z log.info( 2025-09-07T06:09:28.6469064Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.6469796Z ) 2025-09-07T06:09:28.6470211Z enabled = True 2025-09-07T06:09:28.6470515Z 2025-09-07T06:09:28.6470738Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.6471607Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.6472729Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.6473426Z log.info( 2025-09-07T06:09:28.6474435Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.6475406Z ) 2025-09-07T06:09:28.6475832Z enabled = True 2025-09-07T06:09:28.6476161Z 2025-09-07T06:09:28.6476334Z if enabled: 2025-09-07T06:09:28.6476776Z label = experiment_name 2025-09-07T06:09:28.6477369Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.6478250Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.6479178Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.6479984Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.6480701Z if is_canary: 2025-09-07T06:09:28.6481225Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.6481803Z fleet_prefix = label 2025-09-07T06:09:28.6482331Z else: 2025-09-07T06:09:28.6482779Z prefixes.append(label) 2025-09-07T06:09:28.6483156Z 2025-09-07T06:09:28.6483345Z if len(prefixes) > 1: 2025-09-07T06:09:28.6483818Z log.error( 2025-09-07T06:09:28.6484988Z 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-09-07T06:09:28.6486165Z ) 2025-09-07T06:09:28.6486575Z prefixes = prefixes[:1] 2025-09-07T06:09:28.6486917Z 2025-09-07T06:09:28.6487116Z # Fleet always comes first 2025-09-07T06:09:28.6487619Z if fleet_prefix: 2025-09-07T06:09:28.6488095Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.6488484Z 2025-09-07T06:09:28.6488940Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.6489411Z 2025-09-07T06:09:28.6489418Z 2025-09-07T06:09:28.6489883Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.6490699Z """ 2025-09-07T06:09:28.6491304Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.6491909Z 2025-09-07T06:09:28.6492300Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.6493056Z """ 2025-09-07T06:09:28.6493459Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.6494133Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.6494806Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.6495289Z 2025-09-07T06:09:28.6495295Z 2025-09-07T06:09:28.6495707Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.6496506Z for _ in range(num_retries): 2025-09-07T06:09:28.6497040Z try: 2025-09-07T06:09:28.6497497Z req = Request(url=url, headers=headers) 2025-09-07T06:09:28.6498192Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.6498873Z return json.loads(content) 2025-09-07T06:09:28.6499428Z except Exception as e: 2025-09-07T06:09:28.6499996Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.6500438Z 2025-09-07T06:09:28.6500820Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.6501575Z return {} 2025-09-07T06:09:28.6501816Z 2025-09-07T06:09:28.6501823Z 2025-09-07T06:09:28.6501995Z @cache 2025-09-07T06:09:28.6502641Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.6503476Z """ 2025-09-07T06:09:28.6503893Z Dynamically get PR information 2025-09-07T06:09:28.6504514Z """ 2025-09-07T06:09:28.6505167Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.6505835Z headers = { 2025-09-07T06:09:28.6506308Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.6506948Z "Authorization": f"token {github_token}", 2025-09-07T06:09:28.6507522Z } 2025-09-07T06:09:28.6507961Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.6508603Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.6509174Z headers=headers, 2025-09-07T06:09:28.6509633Z ) 2025-09-07T06:09:28.6509850Z 2025-09-07T06:09:28.6510039Z if not json_response: 2025-09-07T06:09:28.6510634Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.6511284Z return {} 2025-09-07T06:09:28.6511542Z 2025-09-07T06:09:28.6511730Z return json_response 2025-09-07T06:09:28.6512024Z 2025-09-07T06:09:28.6512031Z 2025-09-07T06:09:28.6512445Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.6513221Z """ 2025-09-07T06:09:28.6513768Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.6514558Z """ 2025-09-07T06:09:28.6515063Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.6515702Z return { 2025-09-07T06:09:28.6516349Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.6517082Z } 2025-09-07T06:09:28.6517300Z 2025-09-07T06:09:28.6517306Z 2025-09-07T06:09:28.6517483Z def main() -> None: 2025-09-07T06:09:28.6517927Z args = parse_args() 2025-09-07T06:09:28.6518218Z 2025-09-07T06:09:28.6518444Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.6518861Z 2025-09-07T06:09:28.6519057Z # Check if the PR is opt-out 2025-09-07T06:09:28.6519573Z if args.pr_number: 2025-09-07T06:09:28.6520263Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.6521182Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.6521724Z log.info( 2025-09-07T06:09:28.6522447Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.6523246Z ) 2025-09-07T06:09:28.6523824Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6524637Z sys.exit() 2025-09-07T06:09:28.6524922Z 2025-09-07T06:09:28.6525087Z try: 2025-09-07T06:09:28.6525542Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.6526286Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.6526962Z ) 2025-09-07T06:09:28.6527188Z 2025-09-07T06:09:28.6527400Z username = get_potential_pr_author( 2025-09-07T06:09:28.6527975Z args.github_token, 2025-09-07T06:09:28.6528481Z args.github_repo, 2025-09-07T06:09:28.6528995Z args.github_actor, 2025-09-07T06:09:28.6529506Z args.github_ref_type, 2025-09-07T06:09:28.6530038Z args.github_branch, 2025-09-07T06:09:28.6530525Z ) 2025-09-07T06:09:28.6530753Z 2025-09-07T06:09:28.6531038Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.6531522Z 2025-09-07T06:09:28.6531755Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.6532337Z rollout_state, 2025-09-07T06:09:28.6532854Z (args.github_issue_owner, username), 2025-09-07T06:09:28.6533431Z args.github_branch, 2025-09-07T06:09:28.6534053Z args.eligible_experiments, 2025-09-07T06:09:28.6534627Z args.opt_out_experiments, 2025-09-07T06:09:28.6535170Z is_canary, 2025-09-07T06:09:28.6535605Z ) 2025-09-07T06:09:28.6535836Z 2025-09-07T06:09:28.6536025Z except Exception as e: 2025-09-07T06:09:28.6536500Z log.error( 2025-09-07T06:09:28.6537191Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.6538136Z ) 2025-09-07T06:09:28.6538368Z 2025-09-07T06:09:28.6538703Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6539238Z 2025-09-07T06:09:28.6539245Z 2025-09-07T06:09:28.6539428Z if __name__ == "__main__": 2025-09-07T06:09:28.6539889Z main() 2025-09-07T06:09:28.6540121Z 2025-09-07T06:09:28.6636702Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.6637608Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.6669190Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.6669675Z env: 2025-09-07T06:09:28.6670319Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.6670741Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.6671184Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.6671700Z ISSUE_OWNER: 2025-09-07T06:09:28.6672102Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.6672524Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.6672962Z PR_NUMBER: 2025-09-07T06:09:28.6673332Z ##[endgroup] 2025-09-07T06:09:29.9126537Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:31.0370824Z Collecting urllib3==1.26.18 2025-09-07T06:09:31.0712228Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:31.0947257Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-09-07T06:09:31.1224372Z Collecting PyGithub==2.3.0 2025-09-07T06:09:31.2012691Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:31.2487490Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:31.2528340Z 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-09-07T06:09:31.2586678Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:31.2599748Z 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-09-07T06:09:31.2620946Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:31.2894700Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:31.2927075Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:31.3183628Z 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-09-07T06:09:31.4391046Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:31.4427519Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:31.5652489Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:31.5686922Z 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-09-07T06:09:31.5877209Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:31.5910461Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:31.6151155Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:31.6212856Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 31.0 MB/s eta 0:00:00 2025-09-07T06:09:31.6258594Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:31.6319056Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 81.1 MB/s eta 0:00:00 2025-09-07T06:09:31.6351479Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:31.6436367Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 126.8 MB/s eta 0:00:00 2025-09-07T06:09:31.6469425Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:31.6538026Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:31.6604420Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 93.6 MB/s eta 0:00:00 2025-09-07T06:09:31.6638691Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:31.6711648Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 14.2 MB/s eta 0:00:00 2025-09-07T06:09:31.6780933Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:31.6834882Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.2 MB/s eta 0:00:00 2025-09-07T06:09:32.0043795Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:32.5587953Z 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-09-07T06:09:32.6729274Z ##[group]Run curr_branch="main" 2025-09-07T06:09:32.6729573Z curr_branch="main" 2025-09-07T06:09:32.6729787Z curr_ref_type="branch" 2025-09-07T06:09:32.6730061Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:32.6730305Z  2025-09-07T06:09:32.6730496Z python3 runner_determinator.py \ 2025-09-07T06:09:32.6730772Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:32.6731039Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:32.6731289Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:32.6731549Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:32.6731833Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:32.6732110Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:32.6732383Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:32.6732676Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:32.6733042Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:32.6733326Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:32.6765488Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:32.6765710Z env: 2025-09-07T06:09:32.6766335Z GITHUB_TOKEN: *** 2025-09-07T06:09:32.6766526Z ISSUE_NUMBER: 5132 2025-09-07T06:09:32.6766730Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:32.6766966Z ISSUE_OWNER: 2025-09-07T06:09:32.6767146Z CHECK_EXPERIMENTS: 2025-09-07T06:09:32.6767332Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:32.6767517Z PR_NUMBER: 2025-09-07T06:09:32.6767681Z ##[endgroup] 2025-09-07T06:09:32.6819697Z Current branch is 'main' 2025-09-07T06:09:34.3931050Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-09-07T06:09:34.3932485Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:34.3933766Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:34.3935403Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:34.3936363Z INFO : Setting output: label-type='lf.' 2025-09-07T06:09:34.4335309Z Evaluate and set job outputs 2025-09-07T06:09:34.4341732Z Set output 'label-type' 2025-09-07T06:09:34.4343629Z Cleaning up orphan processes