2025-10-10T00:01:07.9242425Z Current runner version: '2.328.0' 2025-10-10T00:01:07.9277294Z ##[group]Runner Image Provisioner 2025-10-10T00:01:07.9278628Z Hosted Compute Agent 2025-10-10T00:01:07.9279579Z Version: 20250912.392 2025-10-10T00:01:07.9280826Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:07.9282047Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:07.9283153Z ##[endgroup] 2025-10-10T00:01:07.9285047Z ##[group]Operating System 2025-10-10T00:01:07.9286077Z Ubuntu 2025-10-10T00:01:07.9286984Z 24.04.3 2025-10-10T00:01:07.9287933Z LTS 2025-10-10T00:01:07.9288852Z ##[endgroup] 2025-10-10T00:01:07.9289767Z ##[group]Runner Image 2025-10-10T00:01:07.9290838Z Image: ubuntu-24.04 2025-10-10T00:01:07.9291813Z Version: 20250929.60.1 2025-10-10T00:01:07.9293657Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:07.9296811Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:07.9298793Z ##[endgroup] 2025-10-10T00:01:07.9300546Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:07.9303666Z Contents: read 2025-10-10T00:01:07.9304797Z Metadata: read 2025-10-10T00:01:07.9305719Z ##[endgroup] 2025-10-10T00:01:07.9309026Z Secret source: Actions 2025-10-10T00:01:07.9310590Z Prepare workflow directory 2025-10-10T00:01:08.0060230Z Prepare all required actions 2025-10-10T00:01:08.0144103Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.0152334Z ##[group] Inputs 2025-10-10T00:01:08.0153573Z check_experiments: 2025-10-10T00:01:08.0154782Z opt_out_experiments: lf 2025-10-10T00:01:08.0155934Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.0156985Z issue_owner: 2025-10-10T00:01:08.0157874Z curr_branch: main 2025-10-10T00:01:08.0158792Z curr_ref_type: branch 2025-10-10T00:01:08.0160098Z issue_number: 5132 2025-10-10T00:01:08.0161075Z ##[endgroup] 2025-10-10T00:01:08.0162272Z Complete job name: unit-test / get-label-type / runner-determinator 2025-10-10T00:01:08.4941536Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:08.4943953Z cat < runner_determinator.py 2025-10-10T00:01:08.4944821Z # flake8: noqa: G004 2025-10-10T00:01:08.4945475Z  2025-10-10T00:01:08.4946277Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.4947342Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.4948376Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.4949086Z  2025-10-10T00:01:08.4949562Z """ 2025-10-10T00:01:08.4950355Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.4951374Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.4952603Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.4953641Z of which runners should be used to run which job. 2025-10-10T00:01:08.4954348Z  2025-10-10T00:01:08.4955359Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.4956616Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.4957633Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.4958465Z list, defined. 2025-10-10T00:01:08.4959114Z  2025-10-10T00:01:08.4959779Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.4960841Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.4961891Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.4962637Z  2025-10-10T00:01:08.4963642Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.4965116Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.4966071Z experiments which the user could be opted in to. 2025-10-10T00:01:08.4966739Z  2025-10-10T00:01:08.4967355Z The user list has the following rules: 2025-10-10T00:01:08.4968004Z  2025-10-10T00:01:08.4968688Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.5052435Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.5053383Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.5054001Z  2025-10-10T00:01:08.5054404Z Example config: 2025-10-10T00:01:08.5055337Z  # A list of experiments that can be opted into. 2025-10-10T00:01:08.5056116Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.5056839Z  # Expected syntax is: 2025-10-10T00:01:08.5057576Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.5058610Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.5059398Z  2025-10-10T00:01:08.5059786Z  experiments: 2025-10-10T00:01:08.5060237Z  lf: 2025-10-10T00:01:08.5060685Z  rollout_percent: 25 2025-10-10T00:01:08.5061213Z  all_branches: false 2025-10-10T00:01:08.5061732Z  default: true 2025-10-10T00:01:08.5062211Z  --- 2025-10-10T00:01:08.5062604Z  2025-10-10T00:01:08.5063012Z  # Opt-ins: 2025-10-10T00:01:08.5063674Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.5065013Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.5065906Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.5066687Z  # Experiments should be from the above list. 2025-10-10T00:01:08.5067305Z  2025-10-10T00:01:08.5067713Z  @User1,-lf,split_build 2025-10-10T00:01:08.5068226Z  @User2,lf 2025-10-10T00:01:08.5068681Z  @User3,split_build 2025-10-10T00:01:08.5069168Z """ 2025-10-10T00:01:08.5069559Z  2025-10-10T00:01:08.5069950Z import json 2025-10-10T00:01:08.5070398Z import logging 2025-10-10T00:01:08.5070848Z import os 2025-10-10T00:01:08.5071271Z import random 2025-10-10T00:01:08.5071717Z import re 2025-10-10T00:01:08.5072137Z import sys 2025-10-10T00:01:08.5072610Z from argparse import ArgumentParser 2025-10-10T00:01:08.5073276Z from collections.abc import Iterable 2025-10-10T00:01:08.5073870Z from functools import cache 2025-10-10T00:01:08.5074415Z from logging import LogRecord 2025-10-10T00:01:08.5075119Z from typing import Any, NamedTuple 2025-10-10T00:01:08.5075738Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.5076331Z  2025-10-10T00:01:08.5076723Z import yaml 2025-10-10T00:01:08.5077192Z from github import Auth, Github 2025-10-10T00:01:08.5077760Z from github.Issue import Issue 2025-10-10T00:01:08.5078293Z  2025-10-10T00:01:08.5078674Z  2025-10-10T00:01:08.5079149Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.5079927Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.5080902Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.5081665Z  2025-10-10T00:01:08.5082382Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.5083028Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.5083624Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.5084293Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.5085206Z  2025-10-10T00:01:08.5085661Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.5086226Z  2025-10-10T00:01:08.5086645Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.5087183Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.5087682Z  2025-10-10T00:01:08.5088066Z  2025-10-10T00:01:08.5088481Z class Experiment(NamedTuple): 2025-10-10T00:01:08.5089045Z  rollout_perc: float = ( 2025-10-10T00:01:08.5089792Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.5090523Z  ) 2025-10-10T00:01:08.5090959Z  all_branches: bool = ( 2025-10-10T00:01:08.5091712Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.5092447Z  ) 2025-10-10T00:01:08.5092865Z  default: bool = ( 2025-10-10T00:01:08.5093537Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.5094241Z  ) 2025-10-10T00:01:08.5094874Z  2025-10-10T00:01:08.5095301Z  # Add more fields as needed 2025-10-10T00:01:08.5095820Z  2025-10-10T00:01:08.5096196Z  2025-10-10T00:01:08.5096601Z class Settings(NamedTuple): 2025-10-10T00:01:08.5097116Z  """ 2025-10-10T00:01:08.5097674Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:08.5098314Z  """ 2025-10-10T00:01:08.5098723Z  2025-10-10T00:01:08.5099168Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.5099752Z  2025-10-10T00:01:08.5100294Z  2025-10-10T00:01:08.5100767Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.5101471Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.5102119Z  2025-10-10T00:01:08.5102508Z  COLORS = { 2025-10-10T00:01:08.5102997Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.5103579Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.5104142Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.5104832Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.5105392Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.5105930Z  } 2025-10-10T00:01:08.5106327Z  2025-10-10T00:01:08.5106795Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.5107624Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.5108488Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.5109126Z  return super().format(record) 2025-10-10T00:01:08.5109661Z  2025-10-10T00:01:08.5110035Z  2025-10-10T00:01:08.5110468Z handler = logging.StreamHandler() 2025-10-10T00:01:08.5111275Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.5112047Z  2025-10-10T00:01:08.5112551Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.5113246Z log.addHandler(handler) 2025-10-10T00:01:08.5113772Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.5114282Z  2025-10-10T00:01:08.5114760Z  2025-10-10T00:01:08.5115266Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.5115889Z  """ 2025-10-10T00:01:08.5116479Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.5117306Z  """ 2025-10-10T00:01:08.5117741Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:08.5118906Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.5120110Z  log.warning( 2025-10-10T00:01:08.5121114Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.5122093Z  ) 2025-10-10T00:01:08.5122604Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.5123204Z  return 2025-10-10T00:01:08.5123644Z  2025-10-10T00:01:08.5124077Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.5125009Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.5125664Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:08.5126203Z  2025-10-10T00:01:08.5126592Z  2025-10-10T00:01:08.5127162Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.5127875Z  return frozenset( 2025-10-10T00:01:08.5128582Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.5129309Z  ) 2025-10-10T00:01:08.5129713Z  2025-10-10T00:01:08.5130086Z  2025-10-10T00:01:08.5130493Z def parse_args() -> Any: 2025-10-10T00:01:08.5131152Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.5132102Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.5132936Z  parser.add_argument( 2025-10-10T00:01:08.5133474Z  "--github-issue-repo", 2025-10-10T00:01:08.5134020Z  type=str, 2025-10-10T00:01:08.5134844Z  required=False, 2025-10-10T00:01:08.5135579Z  default="pytorch/test-infra", 2025-10-10T00:01:08.5136203Z  help="GitHub repo to get the issue", 2025-10-10T00:01:08.5136765Z  ) 2025-10-10T00:01:08.5137186Z  parser.add_argument( 2025-10-10T00:01:08.5137708Z  "--github-repo", 2025-10-10T00:01:08.5138218Z  type=str, 2025-10-10T00:01:08.5138692Z  required=True, 2025-10-10T00:01:08.5139254Z  help="GitHub repo where CI is running", 2025-10-10T00:01:08.5139821Z  ) 2025-10-10T00:01:08.5140246Z  parser.add_argument( 2025-10-10T00:01:08.5140942Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.5141657Z  ) 2025-10-10T00:01:08.5142079Z  parser.add_argument( 2025-10-10T00:01:08.5142793Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.5143540Z  ) 2025-10-10T00:01:08.5143960Z  parser.add_argument( 2025-10-10T00:01:08.5144821Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.5145567Z  ) 2025-10-10T00:01:08.5145997Z  parser.add_argument( 2025-10-10T00:01:08.5146753Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.5147516Z  ) 2025-10-10T00:01:08.5147961Z  parser.add_argument( 2025-10-10T00:01:08.5148484Z  "--github-ref-type", 2025-10-10T00:01:08.5149011Z  type=str, 2025-10-10T00:01:08.5149490Z  required=True, 2025-10-10T00:01:08.5150084Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.5150682Z  ) 2025-10-10T00:01:08.5151108Z  parser.add_argument( 2025-10-10T00:01:08.5151780Z  "--eligible-experiments", 2025-10-10T00:01:08.5152377Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.5152947Z  required=False, 2025-10-10T00:01:08.5153444Z  default="", 2025-10-10T00:01:08.5154388Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.5155565Z  ) 2025-10-10T00:01:08.5155988Z  parser.add_argument( 2025-10-10T00:01:08.5156523Z  "--opt-out-experiments", 2025-10-10T00:01:08.5157110Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.5157680Z  required=False, 2025-10-10T00:01:08.5158182Z  default="", 2025-10-10T00:01:08.5158656Z  help=( 2025-10-10T00:01:08.5159415Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.5160629Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.5161520Z  ), 2025-10-10T00:01:08.5161938Z  ) 2025-10-10T00:01:08.5162356Z  parser.add_argument( 2025-10-10T00:01:08.5162876Z  "--pr-number", 2025-10-10T00:01:08.5163366Z  type=str, 2025-10-10T00:01:08.5163844Z  required=False, 2025-10-10T00:01:08.5164341Z  default="", 2025-10-10T00:01:08.5165308Z  help="the optional PR number where this is run", 2025-10-10T00:01:08.5165925Z  ) 2025-10-10T00:01:08.5166315Z  2025-10-10T00:01:08.5166734Z  return parser.parse_args() 2025-10-10T00:01:08.5167252Z  2025-10-10T00:01:08.5167633Z  2025-10-10T00:01:08.5168284Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.5169257Z  auth = Auth.Token(github_token) 2025-10-10T00:01:08.5169869Z  return Github(auth=auth) 2025-10-10T00:01:08.5170377Z  2025-10-10T00:01:08.5170747Z  2025-10-10T00:01:08.5171458Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.5172330Z  repo = gh.get_repo(repo) 2025-10-10T00:01:08.5172920Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.5173506Z  2025-10-10T00:01:08.5173885Z  2025-10-10T00:01:08.5174295Z def get_potential_pr_author( 2025-10-10T00:01:08.5175322Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.5176058Z ) -> str: 2025-10-10T00:01:08.5176666Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.5177549Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.5178397Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:08.5179018Z  2025-10-10T00:01:08.5179438Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.5179975Z  2025-10-10T00:01:08.5180483Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.5181175Z  split_tag = ref_name.split("/") 2025-10-10T00:01:08.5181730Z  if ( 2025-10-10T00:01:08.5182188Z  len(split_tag) == 3 2025-10-10T00:01:08.5182747Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:08.5183343Z  and split_tag[2].isnumeric() 2025-10-10T00:01:08.5183893Z  ): 2025-10-10T00:01:08.5184350Z  pr_number = split_tag[2] 2025-10-10T00:01:08.5185012Z  try: 2025-10-10T00:01:08.5185524Z  repository = gh.get_repo(repo) 2025-10-10T00:01:08.5186365Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.5187032Z  except Exception as e: 2025-10-10T00:01:08.5187629Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:08.5188367Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.5189067Z  ) from e 2025-10-10T00:01:08.5189696Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.5190462Z  # In all other cases, return the original input username 2025-10-10T00:01:08.5191106Z  return username 2025-10-10T00:01:08.5191562Z  2025-10-10T00:01:08.5191935Z  2025-10-10T00:01:08.5192401Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.5192987Z  """ 2025-10-10T00:01:08.5193712Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.5194652Z  """ 2025-10-10T00:01:08.5195274Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.5196169Z  2025-10-10T00:01:08.5196621Z  2025-10-10T00:01:08.5197045Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.5197599Z  try: 2025-10-10T00:01:08.5198062Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.5198616Z  return data 2025-10-10T00:01:08.5199106Z  except yaml.YAMLError: 2025-10-10T00:01:08.5199671Z  log.exception("Error loading YAML") 2025-10-10T00:01:08.5200235Z  raise 2025-10-10T00:01:08.5200658Z  2025-10-10T00:01:08.5201029Z  2025-10-10T00:01:08.5201691Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.5202483Z  """ 2025-10-10T00:01:08.5203310Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.5204111Z  2025-10-10T00:01:08.5205005Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.5205877Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.5206483Z  2025-10-10T00:01:08.5207111Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.5207855Z  """ 2025-10-10T00:01:08.5208374Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.5209017Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.5209696Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.5210335Z  else: 2025-10-10T00:01:08.5210786Z  return "", rollout_state 2025-10-10T00:01:08.5211314Z  2025-10-10T00:01:08.5211673Z  2025-10-10T00:01:08.5212107Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.5212653Z  """ 2025-10-10T00:01:08.5213238Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.5213925Z  """ 2025-10-10T00:01:08.5214315Z  2025-10-10T00:01:08.5215302Z  2025-10-10T00:01:08.5215903Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.5216623Z  """ 2025-10-10T00:01:08.5217403Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.5218289Z  2025-10-10T00:01:08.5219148Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.5220206Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.5221159Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.5221831Z  2025-10-10T00:01:08.5222195Z  2025-10-10T00:01:08.5222555Z  """ 2025-10-10T00:01:08.5222973Z  optins = UserOptins() 2025-10-10T00:01:08.5223536Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.5224157Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:08.5224993Z  if not user or not user.startswith("@"): 2025-10-10T00:01:08.5225612Z  # Not a valid user. Skip 2025-10-10T00:01:08.5226153Z  continue 2025-10-10T00:01:08.5226597Z  2025-10-10T00:01:08.5227011Z  if user: 2025-10-10T00:01:08.5227522Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.5228274Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.5228979Z  2025-10-10T00:01:08.5229374Z  return optins 2025-10-10T00:01:08.5229812Z  2025-10-10T00:01:08.5230172Z  2025-10-10T00:01:08.5230710Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.5231363Z  """ 2025-10-10T00:01:08.5231829Z  Check if the experiment name is valid. 2025-10-10T00:01:08.5232397Z  A valid name: 2025-10-10T00:01:08.5233119Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.5234121Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.5234998Z  - Cannot contain spaces 2025-10-10T00:01:08.5235520Z  """ 2025-10-10T00:01:08.5235901Z  2025-10-10T00:01:08.5236400Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.5237168Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.5237938Z  2025-10-10T00:01:08.5238319Z  if valid: 2025-10-10T00:01:08.5238757Z  return True 2025-10-10T00:01:08.5239201Z  2025-10-10T00:01:08.5239579Z  log.error( 2025-10-10T00:01:08.5241114Z  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-10-10T00:01:08.5242719Z  ) 2025-10-10T00:01:08.5243125Z  return False 2025-10-10T00:01:08.5243560Z  2025-10-10T00:01:08.5243919Z  2025-10-10T00:01:08.5244579Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.5245262Z  """ 2025-10-10T00:01:08.5245917Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.5246677Z  """ 2025-10-10T00:01:08.5247077Z  try: 2025-10-10T00:01:08.5247485Z  if settings_text: 2025-10-10T00:01:08.5248290Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.5249165Z  # for easy reading 2025-10-10T00:01:08.5250036Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.5250985Z  # the backtick character in shell commands. 2025-10-10T00:01:08.5251642Z  backtick = chr(96) # backtick character 2025-10-10T00:01:08.5252375Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.5253095Z  settings = load_yaml(settings_text) 2025-10-10T00:01:08.5253639Z  2025-10-10T00:01:08.5254282Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.5255359Z  experiments = {} 2025-10-10T00:01:08.5255858Z  2025-10-10T00:01:08.5256456Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.5257280Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.5258459Z  # 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-10-10T00:01:08.5259571Z  continue 2025-10-10T00:01:08.5260061Z  2025-10-10T00:01:08.5260462Z  valid_settings = {} 2025-10-10T00:01:08.5261040Z  for setting in exp_settings: 2025-10-10T00:01:08.5261660Z  if setting not in Experiment._fields: 2025-10-10T00:01:08.5262275Z  log.warning( 2025-10-10T00:01:08.5263055Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.5263810Z  ) 2025-10-10T00:01:08.5264303Z  else: 2025-10-10T00:01:08.5264991Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.5265602Z  2025-10-10T00:01:08.5266114Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.5266800Z  return Settings(experiments) 2025-10-10T00:01:08.5267340Z  2025-10-10T00:01:08.5267728Z  except Exception: 2025-10-10T00:01:08.5268284Z  log.exception("Failed to parse settings") 2025-10-10T00:01:08.5268851Z  2025-10-10T00:01:08.5269238Z  return Settings() 2025-10-10T00:01:08.5269696Z  2025-10-10T00:01:08.5270062Z  2025-10-10T00:01:08.5270686Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.5271316Z  """ 2025-10-10T00:01:08.5271818Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.5272409Z  2025-10-10T00:01:08.5272992Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.5273810Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.5274404Z  2025-10-10T00:01:08.5275157Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.5275931Z  """ 2025-10-10T00:01:08.5276551Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.5277376Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.5277965Z  2025-10-10T00:01:08.5278326Z  2025-10-10T00:01:08.5278822Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.5279432Z  """ 2025-10-10T00:01:08.5279877Z  Parse users from the rollout state. 2025-10-10T00:01:08.5280423Z  2025-10-10T00:01:08.5280783Z  """ 2025-10-10T00:01:08.5281387Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.5282207Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.5282797Z  2025-10-10T00:01:08.5283156Z  2025-10-10T00:01:08.5283819Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.5284735Z  """ 2025-10-10T00:01:08.5285224Z  Check if a user is opted into an experiment 2025-10-10T00:01:08.5285804Z  """ 2025-10-10T00:01:08.5286324Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.5286944Z  2025-10-10T00:01:08.5287437Z  2025-10-10T00:01:08.5288122Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.5288933Z  """ 2025-10-10T00:01:08.5289462Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.5290085Z  """ 2025-10-10T00:01:08.5290651Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.5291406Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.5292108Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.5292761Z  return False 2025-10-10T00:01:08.5293216Z  2025-10-10T00:01:08.5293727Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.5294380Z  log.warning( 2025-10-10T00:01:08.5295399Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.5296340Z  ) 2025-10-10T00:01:08.5296754Z  2025-10-10T00:01:08.5297145Z  return True 2025-10-10T00:01:08.5297590Z  2025-10-10T00:01:08.5297976Z  2025-10-10T00:01:08.5298385Z def get_runner_prefix( 2025-10-10T00:01:08.5298889Z  rollout_state: str, 2025-10-10T00:01:08.5299439Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:08.5300000Z  branch: str, 2025-10-10T00:01:08.5300582Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.5301316Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.5301957Z  is_canary: bool = False, 2025-10-10T00:01:08.5302461Z ) -> str: 2025-10-10T00:01:08.5302961Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:08.5303609Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.5304173Z  2025-10-10T00:01:08.5304796Z  fleet_prefix = "" 2025-10-10T00:01:08.5305296Z  prefixes = [] 2025-10-10T00:01:08.5306019Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.5307017Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.5307782Z  log.info( 2025-10-10T00:01:08.5308549Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.5309340Z  ) 2025-10-10T00:01:08.5309798Z  continue 2025-10-10T00:01:08.5310249Z  2025-10-10T00:01:08.5310709Z  if opt_out_experiments: 2025-10-10T00:01:08.5311316Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.5312036Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.5312684Z  log.info( 2025-10-10T00:01:08.5313688Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.5314815Z  ) 2025-10-10T00:01:08.5315274Z  continue 2025-10-10T00:01:08.5315754Z  2025-10-10T00:01:08.5316158Z  if eligible_experiments: 2025-10-10T00:01:08.5316794Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.5317489Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.5318082Z  log.info( 2025-10-10T00:01:08.5318940Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.5319815Z  ) 2025-10-10T00:01:08.5320408Z  continue 2025-10-10T00:01:08.5321055Z  elif not experiment_settings.default: 2025-10-10T00:01:08.5321656Z  log.info( 2025-10-10T00:01:08.5322396Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.5323179Z  ) 2025-10-10T00:01:08.5323630Z  continue 2025-10-10T00:01:08.5324082Z  2025-10-10T00:01:08.5324703Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.5325380Z  opted_out_users = [ 2025-10-10T00:01:08.5325889Z  requestor 2025-10-10T00:01:08.5326423Z  for requestor in workflow_requestors 2025-10-10T00:01:08.5327154Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.5327871Z  ] 2025-10-10T00:01:08.5328275Z  2025-10-10T00:01:08.5328682Z  if opted_out_users: 2025-10-10T00:01:08.5329223Z  log.info( 2025-10-10T00:01:08.5329931Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.5330677Z  ) 2025-10-10T00:01:08.5331115Z  continue 2025-10-10T00:01:08.5331578Z  2025-10-10T00:01:08.5332087Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.5332744Z  opted_in_users = [ 2025-10-10T00:01:08.5333273Z  requestor 2025-10-10T00:01:08.5333818Z  for requestor in workflow_requestors 2025-10-10T00:01:08.5334654Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.5335332Z  ] 2025-10-10T00:01:08.5335742Z  2025-10-10T00:01:08.5336131Z  enabled = False 2025-10-10T00:01:08.5336647Z  if opted_in_users: 2025-10-10T00:01:08.5337278Z  log.info( 2025-10-10T00:01:08.5337975Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.5338714Z  ) 2025-10-10T00:01:08.5339165Z  enabled = True 2025-10-10T00:01:08.5339662Z  2025-10-10T00:01:08.5340108Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.5341015Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.5342024Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.5342729Z  log.info( 2025-10-10T00:01:08.5343674Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.5344751Z  ) 2025-10-10T00:01:08.5345237Z  enabled = True 2025-10-10T00:01:08.5345740Z  2025-10-10T00:01:08.5346133Z  if enabled: 2025-10-10T00:01:08.5346633Z  label = experiment_name 2025-10-10T00:01:08.5347253Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.5348147Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.5349085Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.5349912Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.5350616Z  if is_canary: 2025-10-10T00:01:08.5351184Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.5351782Z  fleet_prefix = label 2025-10-10T00:01:08.5352320Z  else: 2025-10-10T00:01:08.5352956Z  prefixes.append(label) 2025-10-10T00:01:08.5353490Z  2025-10-10T00:01:08.5353887Z  if len(prefixes) > 1: 2025-10-10T00:01:08.5354390Z  log.error( 2025-10-10T00:01:08.5355667Z  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-10-10T00:01:08.5356877Z  ) 2025-10-10T00:01:08.5357331Z  prefixes = prefixes[:1] 2025-10-10T00:01:08.5357848Z  2025-10-10T00:01:08.5358245Z  # Fleet always comes first 2025-10-10T00:01:08.5358783Z  if fleet_prefix: 2025-10-10T00:01:08.5359311Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.5359864Z  2025-10-10T00:01:08.5360349Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.5360962Z  2025-10-10T00:01:08.5361341Z  2025-10-10T00:01:08.5362018Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.5362840Z  """ 2025-10-10T00:01:08.5363481Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.5364233Z  2025-10-10T00:01:08.5364957Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.5365710Z  """ 2025-10-10T00:01:08.5366161Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.5366761Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.5367466Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.5368103Z  2025-10-10T00:01:08.5368471Z  2025-10-10T00:01:08.5369107Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.5370042Z  for _ in range(num_retries): 2025-10-10T00:01:08.5370584Z  try: 2025-10-10T00:01:08.5371070Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:08.5371789Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.5372481Z  return json.loads(content) 2025-10-10T00:01:08.5373057Z  except Exception as e: 2025-10-10T00:01:08.5373667Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.5374263Z  2025-10-10T00:01:08.5374997Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.5375764Z  return {} 2025-10-10T00:01:08.5376193Z  2025-10-10T00:01:08.5376559Z  2025-10-10T00:01:08.5376930Z @cache 2025-10-10T00:01:08.5377620Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.5378433Z  """ 2025-10-10T00:01:08.5378874Z  Dynamically get PR information 2025-10-10T00:01:08.5379417Z  """ 2025-10-10T00:01:08.5379982Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.5380653Z  headers = { 2025-10-10T00:01:08.5381197Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.5381867Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:08.5382443Z  } 2025-10-10T00:01:08.5382928Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.5383596Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.5384185Z  headers=headers, 2025-10-10T00:01:08.5384780Z  ) 2025-10-10T00:01:08.5385172Z  2025-10-10T00:01:08.5385568Z  if not json_response: 2025-10-10T00:01:08.5386219Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.5387020Z  return {} 2025-10-10T00:01:08.5387475Z  2025-10-10T00:01:08.5387858Z  return json_response 2025-10-10T00:01:08.5388347Z  2025-10-10T00:01:08.5388714Z  2025-10-10T00:01:08.5389339Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.5390117Z  """ 2025-10-10T00:01:08.5390726Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.5391432Z  """ 2025-10-10T00:01:08.5391970Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.5392627Z  return { 2025-10-10T00:01:08.5393277Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.5393999Z  } 2025-10-10T00:01:08.5394396Z  2025-10-10T00:01:08.5394889Z  2025-10-10T00:01:08.5395284Z def main() -> None: 2025-10-10T00:01:08.5395771Z  args = parse_args() 2025-10-10T00:01:08.5396249Z  2025-10-10T00:01:08.5396699Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.5397280Z  2025-10-10T00:01:08.5397683Z  # Check if the PR is opt-out 2025-10-10T00:01:08.5398227Z  if args.pr_number: 2025-10-10T00:01:08.5398960Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.5399759Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.5400311Z  log.info( 2025-10-10T00:01:08.5401077Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.5401882Z  ) 2025-10-10T00:01:08.5402513Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.5403241Z  sys.exit() 2025-10-10T00:01:08.5403829Z  2025-10-10T00:01:08.5404204Z  try: 2025-10-10T00:01:08.5404822Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.5405593Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.5406363Z  ) 2025-10-10T00:01:08.5406768Z  2025-10-10T00:01:08.5407202Z  username = get_potential_pr_author( 2025-10-10T00:01:08.5407789Z  args.github_token, 2025-10-10T00:01:08.5408324Z  args.github_repo, 2025-10-10T00:01:08.5408862Z  args.github_actor, 2025-10-10T00:01:08.5409408Z  args.github_ref_type, 2025-10-10T00:01:08.5409965Z  args.github_branch, 2025-10-10T00:01:08.5410474Z  ) 2025-10-10T00:01:08.5410876Z  2025-10-10T00:01:08.5411400Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.5412052Z  2025-10-10T00:01:08.5412504Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.5413095Z  rollout_state, 2025-10-10T00:01:08.5413658Z  (args.github_issue_owner, username), 2025-10-10T00:01:08.5414259Z  args.github_branch, 2025-10-10T00:01:08.5414945Z  args.eligible_experiments, 2025-10-10T00:01:08.5415532Z  args.opt_out_experiments, 2025-10-10T00:01:08.5416088Z  is_canary, 2025-10-10T00:01:08.5416561Z  ) 2025-10-10T00:01:08.5416965Z  2025-10-10T00:01:08.5417366Z  except Exception as e: 2025-10-10T00:01:08.5417878Z  log.error( 2025-10-10T00:01:08.5418643Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.5419571Z  ) 2025-10-10T00:01:08.5419992Z  2025-10-10T00:01:08.5420562Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.5421294Z  2025-10-10T00:01:08.5421670Z  2025-10-10T00:01:08.5422064Z if __name__ == "__main__": 2025-10-10T00:01:08.5422573Z  main() 2025-10-10T00:01:08.5422983Z  2025-10-10T00:01:08.5423352Z EOF 2025-10-10T00:01:08.5423727Z  2025-10-10T00:01:08.5424132Z cat runner_determinator.py 2025-10-10T00:01:09.0988862Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.0989984Z env: 2025-10-10T00:01:09.0991132Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.0991833Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.0992599Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.0993498Z ISSUE_OWNER: 2025-10-10T00:01:09.0994177Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.0995094Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:09.0995850Z PR_NUMBER: 2025-10-10T00:01:09.0996521Z ##[endgroup] 2025-10-10T00:01:09.1205150Z # flake8: noqa: G004 2025-10-10T00:01:09.1205846Z 2025-10-10T00:01:09.1206807Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.1209005Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.1210929Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.1212006Z 2025-10-10T00:01:09.1212419Z """ 2025-10-10T00:01:09.1213860Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.1216217Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.1218622Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.1220775Z of which runners should be used to run which job. 2025-10-10T00:01:09.1221814Z 2025-10-10T00:01:09.1222800Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.1225585Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.1227887Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.1229695Z list, defined. 2025-10-10T00:01:09.1230288Z 2025-10-10T00:01:09.1231224Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.1233637Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.1236497Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.1237677Z 2025-10-10T00:01:09.1238622Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.1240899Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.1242801Z experiments which the user could be opted in to. 2025-10-10T00:01:09.1243847Z 2025-10-10T00:01:09.1244355Z The user list has the following rules: 2025-10-10T00:01:09.1245470Z 2025-10-10T00:01:09.1246267Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.1248490Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.1250459Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.1251485Z 2025-10-10T00:01:09.1251907Z Example config: 2025-10-10T00:01:09.1253019Z # A list of experiments that can be opted into. 2025-10-10T00:01:09.1254870Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.1256424Z # Expected syntax is: 2025-10-10T00:01:09.1257986Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.1260471Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.1262025Z 2025-10-10T00:01:09.1262422Z experiments: 2025-10-10T00:01:09.1263369Z lf: 2025-10-10T00:01:09.1264265Z rollout_percent: 25 2025-10-10T00:01:09.1265723Z all_branches: false 2025-10-10T00:01:09.1266811Z default: true 2025-10-10T00:01:09.1267767Z --- 2025-10-10T00:01:09.1268243Z 2025-10-10T00:01:09.1268610Z # Opt-ins: 2025-10-10T00:01:09.1270021Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.1272173Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.1274049Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.1275892Z # Experiments should be from the above list. 2025-10-10T00:01:09.1276817Z 2025-10-10T00:01:09.1277230Z @User1,-lf,split_build 2025-10-10T00:01:09.1278276Z @User2,lf 2025-10-10T00:01:09.1279186Z @User3,split_build 2025-10-10T00:01:09.1280129Z """ 2025-10-10T00:01:09.1280584Z 2025-10-10T00:01:09.1280952Z import json 2025-10-10T00:01:09.1281817Z import logging 2025-10-10T00:01:09.1282710Z import os 2025-10-10T00:01:09.1283559Z import random 2025-10-10T00:01:09.1284449Z import re 2025-10-10T00:01:09.1285527Z import sys 2025-10-10T00:01:09.1286480Z from argparse import ArgumentParser 2025-10-10T00:01:09.1287737Z from collections.abc import Iterable 2025-10-10T00:01:09.1288999Z from functools import cache 2025-10-10T00:01:09.1290118Z from logging import LogRecord 2025-10-10T00:01:09.1291284Z from typing import Any, NamedTuple 2025-10-10T00:01:09.1292585Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.1293515Z 2025-10-10T00:01:09.1293876Z import yaml 2025-10-10T00:01:09.1294989Z from github import Auth, Github 2025-10-10T00:01:09.1296174Z from github.Issue import Issue 2025-10-10T00:01:09.1296930Z 2025-10-10T00:01:09.1296939Z 2025-10-10T00:01:09.1297424Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.1299122Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.1301247Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.1302646Z 2025-10-10T00:01:09.1303181Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.1304919Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.1306225Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.1307556Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.1308443Z 2025-10-10T00:01:09.1308876Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.1309704Z 2025-10-10T00:01:09.1310123Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.1311209Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.1311902Z 2025-10-10T00:01:09.1311911Z 2025-10-10T00:01:09.1312336Z class Experiment(NamedTuple): 2025-10-10T00:01:09.1313474Z rollout_perc: float = ( 2025-10-10T00:01:09.1315235Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.1316908Z ) 2025-10-10T00:01:09.1317770Z all_branches: bool = ( 2025-10-10T00:01:09.1319285Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.1320977Z ) 2025-10-10T00:01:09.1321814Z default: bool = ( 2025-10-10T00:01:09.1323162Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.1324826Z ) 2025-10-10T00:01:09.1325294Z 2025-10-10T00:01:09.1325678Z # Add more fields as needed 2025-10-10T00:01:09.1326413Z 2025-10-10T00:01:09.1326423Z 2025-10-10T00:01:09.1326818Z class Settings(NamedTuple): 2025-10-10T00:01:09.1327835Z """ 2025-10-10T00:01:09.1328895Z Settings for the experiments that can be opted into. 2025-10-10T00:01:09.1330276Z """ 2025-10-10T00:01:09.1330742Z 2025-10-10T00:01:09.1331190Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.1332070Z 2025-10-10T00:01:09.1332079Z 2025-10-10T00:01:09.1332544Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.1334020Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.1335180Z 2025-10-10T00:01:09.1335518Z COLORS = { 2025-10-10T00:01:09.1336414Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.1337745Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.1338880Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.1340036Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.1341146Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.1342216Z } 2025-10-10T00:01:09.1342661Z 2025-10-10T00:01:09.1343134Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.1345051Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.1346917Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.1348256Z return super().format(record) 2025-10-10T00:01:09.1349064Z 2025-10-10T00:01:09.1349071Z 2025-10-10T00:01:09.1349477Z handler = logging.StreamHandler() 2025-10-10T00:01:09.1351164Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.1352538Z 2025-10-10T00:01:09.1353066Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.1406926Z log.addHandler(handler) 2025-10-10T00:01:09.1408190Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.1408914Z 2025-10-10T00:01:09.1408933Z 2025-10-10T00:01:09.1409500Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.1410848Z """ 2025-10-10T00:01:09.1412023Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.1413905Z """ 2025-10-10T00:01:09.1415356Z if not GITHUB_OUTPUT: 2025-10-10T00:01:09.1419272Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.1423547Z log.warning( 2025-10-10T00:01:09.1425978Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.1428220Z ) 2025-10-10T00:01:09.1439204Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.1440506Z return 2025-10-10T00:01:09.1441043Z 2025-10-10T00:01:09.1441667Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.1442982Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.1444277Z f.write(f"{key}={value}\n") 2025-10-10T00:01:09.1445205Z 2025-10-10T00:01:09.1445213Z 2025-10-10T00:01:09.1445886Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.1447340Z return frozenset( 2025-10-10T00:01:09.1448784Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.1450374Z ) 2025-10-10T00:01:09.1450822Z 2025-10-10T00:01:09.1450828Z 2025-10-10T00:01:09.1451193Z def parse_args() -> Any: 2025-10-10T00:01:09.1452427Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.1454609Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.1456441Z parser.add_argument( 2025-10-10T00:01:09.1457445Z "--github-issue-repo", 2025-10-10T00:01:09.1458477Z type=str, 2025-10-10T00:01:09.1459356Z required=False, 2025-10-10T00:01:09.1460348Z default="pytorch/test-infra", 2025-10-10T00:01:09.1461541Z help="GitHub repo to get the issue", 2025-10-10T00:01:09.1462668Z ) 2025-10-10T00:01:09.1463465Z parser.add_argument( 2025-10-10T00:01:09.1464441Z "--github-repo", 2025-10-10T00:01:09.1465600Z type=str, 2025-10-10T00:01:09.1466454Z required=True, 2025-10-10T00:01:09.1467460Z help="GitHub repo where CI is running", 2025-10-10T00:01:09.1468621Z ) 2025-10-10T00:01:09.1469412Z parser.add_argument( 2025-10-10T00:01:09.1470779Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.1472277Z ) 2025-10-10T00:01:09.1473075Z parser.add_argument( 2025-10-10T00:01:09.1474594Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.1476160Z ) 2025-10-10T00:01:09.1476944Z parser.add_argument( 2025-10-10T00:01:09.1478599Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.1480197Z ) 2025-10-10T00:01:09.1481005Z parser.add_argument( 2025-10-10T00:01:09.1482520Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.1484165Z ) 2025-10-10T00:01:09.1485078Z parser.add_argument( 2025-10-10T00:01:09.1486056Z "--github-ref-type", 2025-10-10T00:01:09.1487056Z type=str, 2025-10-10T00:01:09.1487902Z required=True, 2025-10-10T00:01:09.1488963Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.1490190Z ) 2025-10-10T00:01:09.1490999Z parser.add_argument( 2025-10-10T00:01:09.1492007Z "--eligible-experiments", 2025-10-10T00:01:09.1493145Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.1494293Z required=False, 2025-10-10T00:01:09.1495356Z default="", 2025-10-10T00:01:09.1497340Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.1499491Z ) 2025-10-10T00:01:09.1500277Z parser.add_argument( 2025-10-10T00:01:09.1501267Z "--opt-out-experiments", 2025-10-10T00:01:09.1502370Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.1503498Z required=False, 2025-10-10T00:01:09.1504406Z default="", 2025-10-10T00:01:09.1505706Z help=( 2025-10-10T00:01:09.1507241Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.1509900Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.1511825Z ), 2025-10-10T00:01:09.1512598Z ) 2025-10-10T00:01:09.1513398Z parser.add_argument( 2025-10-10T00:01:09.1514361Z "--pr-number", 2025-10-10T00:01:09.1515407Z type=str, 2025-10-10T00:01:09.1516266Z required=False, 2025-10-10T00:01:09.1517177Z default="", 2025-10-10T00:01:09.1518360Z help="the optional PR number where this is run", 2025-10-10T00:01:09.1519638Z ) 2025-10-10T00:01:09.1520092Z 2025-10-10T00:01:09.1520475Z return parser.parse_args() 2025-10-10T00:01:09.1521160Z 2025-10-10T00:01:09.1521168Z 2025-10-10T00:01:09.1522064Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.1523722Z auth = Auth.Token(github_token) 2025-10-10T00:01:09.1525029Z return Github(auth=auth) 2025-10-10T00:01:09.1525691Z 2025-10-10T00:01:09.1525699Z 2025-10-10T00:01:09.1526703Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.1528485Z repo = gh.get_repo(repo) 2025-10-10T00:01:09.1529545Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.1530360Z 2025-10-10T00:01:09.1530368Z 2025-10-10T00:01:09.1530735Z def get_potential_pr_author( 2025-10-10T00:01:09.1532172Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.1533650Z ) -> str: 2025-10-10T00:01:09.1534953Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.1536760Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.1538405Z # embedded in the tag name: ciflow// 2025-10-10T00:01:09.1539349Z 2025-10-10T00:01:09.1539738Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.1540481Z 2025-10-10T00:01:09.1541042Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.1542398Z split_tag = ref_name.split("/") 2025-10-10T00:01:09.1543480Z if ( 2025-10-10T00:01:09.1544284Z len(split_tag) == 3 2025-10-10T00:01:09.1545540Z and split_tag[0] == "ciflow" 2025-10-10T00:01:09.1546691Z and split_tag[2].isnumeric() 2025-10-10T00:01:09.1547907Z ): 2025-10-10T00:01:09.1548778Z pr_number = split_tag[2] 2025-10-10T00:01:09.1550216Z try: 2025-10-10T00:01:09.1551188Z repository = gh.get_repo(repo) 2025-10-10T00:01:09.1552578Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.1553928Z except Exception as e: 2025-10-10T00:01:09.1555209Z raise Exception( # noqa: TRY002 2025-10-10T00:01:09.1556727Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.1558199Z ) from e 2025-10-10T00:01:09.1559394Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.1560951Z # In all other cases, return the original input username 2025-10-10T00:01:09.1562255Z return username 2025-10-10T00:01:09.1562797Z 2025-10-10T00:01:09.1562805Z 2025-10-10T00:01:09.1563265Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.1564446Z """ 2025-10-10T00:01:09.1566001Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.1567748Z """ 2025-10-10T00:01:09.1568972Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.1570166Z 2025-10-10T00:01:09.1570174Z 2025-10-10T00:01:09.1570579Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.1571646Z try: 2025-10-10T00:01:09.1572505Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.1573620Z return data 2025-10-10T00:01:09.1574648Z except yaml.YAMLError: 2025-10-10T00:01:09.1575730Z log.exception("Error loading YAML") 2025-10-10T00:01:09.1576857Z raise 2025-10-10T00:01:09.1577353Z 2025-10-10T00:01:09.1577361Z 2025-10-10T00:01:09.1578280Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.1579938Z """ 2025-10-10T00:01:09.1581344Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.1582725Z 2025-10-10T00:01:09.1583650Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.1585588Z and the text below is the list of opted in users. 2025-10-10T00:01:09.1586516Z 2025-10-10T00:01:09.1587338Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.1588909Z """ 2025-10-10T00:01:09.1589879Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.1591189Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.1592510Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.1593815Z else: 2025-10-10T00:01:09.1594821Z return "", rollout_state 2025-10-10T00:01:09.1595537Z 2025-10-10T00:01:09.1595546Z 2025-10-10T00:01:09.1595979Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.1597080Z """ 2025-10-10T00:01:09.1598240Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.1599675Z """ 2025-10-10T00:01:09.1600151Z 2025-10-10T00:01:09.1600159Z 2025-10-10T00:01:09.1600904Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.1602359Z """ 2025-10-10T00:01:09.1604005Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.1605710Z 2025-10-10T00:01:09.1607160Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.1609386Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.1610867Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.1611940Z 2025-10-10T00:01:09.1611947Z 2025-10-10T00:01:09.1612275Z """ 2025-10-10T00:01:09.1613077Z optins = UserOptins() 2025-10-10T00:01:09.1614120Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.1615441Z user = user.strip("\r\n\t -") 2025-10-10T00:01:09.1616636Z if not user or not user.startswith("@"): 2025-10-10T00:01:09.1618021Z # Not a valid user. Skip 2025-10-10T00:01:09.1619075Z continue 2025-10-10T00:01:09.1619615Z 2025-10-10T00:01:09.1619937Z if user: 2025-10-10T00:01:09.1620887Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.1622433Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.1623549Z 2025-10-10T00:01:09.1623886Z return optins 2025-10-10T00:01:09.1624404Z 2025-10-10T00:01:09.1624412Z 2025-10-10T00:01:09.1625138Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.1626441Z """ 2025-10-10T00:01:09.1627294Z Check if the experiment name is valid. 2025-10-10T00:01:09.1628405Z A valid name: 2025-10-10T00:01:09.1629810Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.1631876Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.1633443Z - Cannot contain spaces 2025-10-10T00:01:09.1634438Z """ 2025-10-10T00:01:09.1634985Z 2025-10-10T00:01:09.1635517Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.1637040Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.1638026Z 2025-10-10T00:01:09.1638355Z if valid: 2025-10-10T00:01:09.1639158Z return True 2025-10-10T00:01:09.1639682Z 2025-10-10T00:01:09.1640023Z log.error( 2025-10-10T00:01:09.1643377Z 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-10-10T00:01:09.1646895Z ) 2025-10-10T00:01:09.1647654Z return False 2025-10-10T00:01:09.1648239Z 2025-10-10T00:01:09.1648251Z 2025-10-10T00:01:09.1648958Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.1650324Z """ 2025-10-10T00:01:09.1651759Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.1653343Z """ 2025-10-10T00:01:09.1654098Z try: 2025-10-10T00:01:09.1655012Z if settings_text: 2025-10-10T00:01:09.1656600Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.1658349Z # for easy reading 2025-10-10T00:01:09.1660109Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.1662068Z # the backtick character in shell commands. 2025-10-10T00:01:09.1663363Z backtick = chr(96) # backtick character 2025-10-10T00:01:09.1664894Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.1666325Z settings = load_yaml(settings_text) 2025-10-10T00:01:09.1667133Z 2025-10-10T00:01:09.1668024Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.1669700Z experiments = {} 2025-10-10T00:01:09.1670350Z 2025-10-10T00:01:09.1671150Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.1672807Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.1675416Z # 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-10-10T00:01:09.1677716Z continue 2025-10-10T00:01:09.1678337Z 2025-10-10T00:01:09.1678713Z valid_settings = {} 2025-10-10T00:01:09.1679820Z for setting in exp_settings: 2025-10-10T00:01:09.1681034Z if setting not in Experiment._fields: 2025-10-10T00:01:09.1682207Z log.warning( 2025-10-10T00:01:09.1683743Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.1685579Z ) 2025-10-10T00:01:09.1686493Z else: 2025-10-10T00:01:09.1687593Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.1688527Z 2025-10-10T00:01:09.1689102Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.1690458Z return Settings(experiments) 2025-10-10T00:01:09.1691240Z 2025-10-10T00:01:09.1691592Z except Exception: 2025-10-10T00:01:09.1692599Z log.exception("Failed to parse settings") 2025-10-10T00:01:09.1693443Z 2025-10-10T00:01:09.1693793Z return Settings() 2025-10-10T00:01:09.1694342Z 2025-10-10T00:01:09.1694349Z 2025-10-10T00:01:09.1694950Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.1696160Z """ 2025-10-10T00:01:09.1697078Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.1697950Z 2025-10-10T00:01:09.1698683Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.1700323Z and the text below is the list of opted in users. 2025-10-10T00:01:09.1701200Z 2025-10-10T00:01:09.1702079Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.1703644Z """ 2025-10-10T00:01:09.1704922Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.1706570Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.1707441Z 2025-10-10T00:01:09.1707448Z 2025-10-10T00:01:09.1707958Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.1709157Z """ 2025-10-10T00:01:09.1709992Z Parse users from the rollout state. 2025-10-10T00:01:09.1710752Z 2025-10-10T00:01:09.1711080Z """ 2025-10-10T00:01:09.1712219Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.1713781Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.1714741Z 2025-10-10T00:01:09.1714750Z 2025-10-10T00:01:09.1715864Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.1717478Z """ 2025-10-10T00:01:09.1718359Z Check if a user is opted into an experiment 2025-10-10T00:01:09.1719493Z """ 2025-10-10T00:01:09.1720458Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.1721367Z 2025-10-10T00:01:09.1721375Z 2025-10-10T00:01:09.1722281Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.1723884Z """ 2025-10-10T00:01:09.1724970Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.1726203Z """ 2025-10-10T00:01:09.1727282Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.1728703Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.1730062Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.1731325Z return False 2025-10-10T00:01:09.1731867Z 2025-10-10T00:01:09.1732429Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.1733684Z log.warning( 2025-10-10T00:01:09.1735527Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.1737394Z ) 2025-10-10T00:01:09.1737858Z 2025-10-10T00:01:09.1738191Z return True 2025-10-10T00:01:09.1738688Z 2025-10-10T00:01:09.1738695Z 2025-10-10T00:01:09.1739056Z def get_runner_prefix( 2025-10-10T00:01:09.1739956Z rollout_state: str, 2025-10-10T00:01:09.1740908Z workflow_requestors: Iterable[str], 2025-10-10T00:01:09.1741986Z branch: str, 2025-10-10T00:01:09.1742994Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.1744375Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.1745686Z is_canary: bool = False, 2025-10-10T00:01:09.1746675Z ) -> str: 2025-10-10T00:01:09.1747715Z settings = parse_settings(rollout_state) 2025-10-10T00:01:09.1748947Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.1749731Z 2025-10-10T00:01:09.1750082Z fleet_prefix = "" 2025-10-10T00:01:09.1750978Z prefixes = [] 2025-10-10T00:01:09.1752306Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.1754270Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.1755856Z log.info( 2025-10-10T00:01:09.1757289Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.1758885Z ) 2025-10-10T00:01:09.1759683Z continue 2025-10-10T00:01:09.1760205Z 2025-10-10T00:01:09.1760578Z if opt_out_experiments: 2025-10-10T00:01:09.1761692Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.1763032Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.1764247Z log.info( 2025-10-10T00:01:09.1766336Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.1768370Z ) 2025-10-10T00:01:09.1769190Z continue 2025-10-10T00:01:09.1769752Z 2025-10-10T00:01:09.1770140Z if eligible_experiments: 2025-10-10T00:01:09.1771283Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.1772602Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.1773759Z log.info( 2025-10-10T00:01:09.1775525Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.1777292Z ) 2025-10-10T00:01:09.1778118Z continue 2025-10-10T00:01:09.1779099Z elif not experiment_settings.default: 2025-10-10T00:01:09.1780207Z log.info( 2025-10-10T00:01:09.1781750Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.1783311Z ) 2025-10-10T00:01:09.1784104Z continue 2025-10-10T00:01:09.1784718Z 2025-10-10T00:01:09.1785285Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.1786574Z opted_out_users = [ 2025-10-10T00:01:09.1787511Z requestor 2025-10-10T00:01:09.1788451Z for requestor in workflow_requestors 2025-10-10T00:01:09.1789847Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.1791162Z ] 2025-10-10T00:01:09.1791613Z 2025-10-10T00:01:09.1791968Z if opted_out_users: 2025-10-10T00:01:09.1792886Z log.info( 2025-10-10T00:01:09.1794174Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.1795724Z ) 2025-10-10T00:01:09.1796526Z continue 2025-10-10T00:01:09.1797049Z 2025-10-10T00:01:09.1797608Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.1798894Z opted_in_users = [ 2025-10-10T00:01:09.1799808Z requestor 2025-10-10T00:01:09.1800734Z for requestor in workflow_requestors 2025-10-10T00:01:09.1802118Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.1803403Z ] 2025-10-10T00:01:09.1803836Z 2025-10-10T00:01:09.1804175Z enabled = False 2025-10-10T00:01:09.1805177Z if opted_in_users: 2025-10-10T00:01:09.1806073Z log.info( 2025-10-10T00:01:09.1807326Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.1808742Z ) 2025-10-10T00:01:09.1809541Z enabled = True 2025-10-10T00:01:09.1810146Z 2025-10-10T00:01:09.1810568Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.1812297Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.1814400Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.1815844Z log.info( 2025-10-10T00:01:09.1817672Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.1819577Z ) 2025-10-10T00:01:09.1820408Z enabled = True 2025-10-10T00:01:09.1821036Z 2025-10-10T00:01:09.1821356Z if enabled: 2025-10-10T00:01:09.1822219Z label = experiment_name 2025-10-10T00:01:09.1823328Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.1825151Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.1826964Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.1828526Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.1829901Z if is_canary: 2025-10-10T00:01:09.1830893Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.1832008Z fleet_prefix = label 2025-10-10T00:01:09.1832992Z else: 2025-10-10T00:01:09.1833870Z prefixes.append(label) 2025-10-10T00:01:09.1834688Z 2025-10-10T00:01:09.1835042Z if len(prefixes) > 1: 2025-10-10T00:01:09.1835937Z log.error( 2025-10-10T00:01:09.1838146Z 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-10-10T00:01:09.1840567Z ) 2025-10-10T00:01:09.1841358Z prefixes = prefixes[:1] 2025-10-10T00:01:09.1841996Z 2025-10-10T00:01:09.1842360Z # Fleet always comes first 2025-10-10T00:01:09.1843326Z if fleet_prefix: 2025-10-10T00:01:09.1844244Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.1845087Z 2025-10-10T00:01:09.1845703Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.1846567Z 2025-10-10T00:01:09.1846576Z 2025-10-10T00:01:09.1847474Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.1849044Z """ 2025-10-10T00:01:09.1850272Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.1851431Z 2025-10-10T00:01:09.1852210Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.1853660Z """ 2025-10-10T00:01:09.1854559Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.1855654Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.1856936Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.1857857Z 2025-10-10T00:01:09.1857865Z 2025-10-10T00:01:09.1858683Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.1860233Z for _ in range(num_retries): 2025-10-10T00:01:09.1861193Z try: 2025-10-10T00:01:09.1862069Z req = Request(url=url, headers=headers) 2025-10-10T00:01:09.1863418Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.1864826Z return json.loads(content) 2025-10-10T00:01:09.1865892Z except Exception as e: 2025-10-10T00:01:09.1867005Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.1867840Z 2025-10-10T00:01:09.1868623Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.1870068Z return {} 2025-10-10T00:01:09.1870532Z 2025-10-10T00:01:09.1870541Z 2025-10-10T00:01:09.1870851Z @cache 2025-10-10T00:01:09.1872133Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.1873673Z """ 2025-10-10T00:01:09.1874567Z Dynamically get PR information 2025-10-10T00:01:09.1875725Z """ 2025-10-10T00:01:09.1876878Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.1878162Z headers = { 2025-10-10T00:01:09.1879088Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.1880313Z "Authorization": f"token {github_token}", 2025-10-10T00:01:09.1881404Z } 2025-10-10T00:01:09.1882266Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.1883490Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.1884709Z headers=headers, 2025-10-10T00:01:09.1885570Z ) 2025-10-10T00:01:09.1885999Z 2025-10-10T00:01:09.1886345Z if not json_response: 2025-10-10T00:01:09.1887484Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.1888732Z return {} 2025-10-10T00:01:09.1889231Z 2025-10-10T00:01:09.1889573Z return json_response 2025-10-10T00:01:09.1890156Z 2025-10-10T00:01:09.1890165Z 2025-10-10T00:01:09.1890972Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.1892444Z """ 2025-10-10T00:01:09.1893518Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.1895012Z """ 2025-10-10T00:01:09.1895978Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.1897202Z return { 2025-10-10T00:01:09.1898388Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.1899796Z } 2025-10-10T00:01:09.1900229Z 2025-10-10T00:01:09.1900238Z 2025-10-10T00:01:09.1900563Z def main() -> None: 2025-10-10T00:01:09.1901409Z args = parse_args() 2025-10-10T00:01:09.1901961Z 2025-10-10T00:01:09.1902388Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.1903193Z 2025-10-10T00:01:09.1903554Z # Check if the PR is opt-out 2025-10-10T00:01:09.1904626Z if args.pr_number: 2025-10-10T00:01:09.1906003Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.1907720Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.1908732Z log.info( 2025-10-10T00:01:09.1910154Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.1911718Z ) 2025-10-10T00:01:09.1912835Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.1914188Z sys.exit() 2025-10-10T00:01:09.1914963Z 2025-10-10T00:01:09.1915272Z try: 2025-10-10T00:01:09.1916163Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.1917611Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.1918920Z ) 2025-10-10T00:01:09.1919365Z 2025-10-10T00:01:09.1919761Z username = get_potential_pr_author( 2025-10-10T00:01:09.1920858Z args.github_token, 2025-10-10T00:01:09.1921834Z args.github_repo, 2025-10-10T00:01:09.1922803Z args.github_actor, 2025-10-10T00:01:09.1923803Z args.github_ref_type, 2025-10-10T00:01:09.1924916Z args.github_branch, 2025-10-10T00:01:09.1925850Z ) 2025-10-10T00:01:09.1926292Z 2025-10-10T00:01:09.1926853Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.1927772Z 2025-10-10T00:01:09.1928198Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.1929308Z rollout_state, 2025-10-10T00:01:09.1930300Z (args.github_issue_owner, username), 2025-10-10T00:01:09.1931409Z args.github_branch, 2025-10-10T00:01:09.1932411Z args.eligible_experiments, 2025-10-10T00:01:09.1933509Z args.opt_out_experiments, 2025-10-10T00:01:09.1934832Z is_canary, 2025-10-10T00:01:09.1935690Z ) 2025-10-10T00:01:09.1936120Z 2025-10-10T00:01:09.1936478Z except Exception as e: 2025-10-10T00:01:09.1937403Z log.error( 2025-10-10T00:01:09.1938783Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.1940517Z ) 2025-10-10T00:01:09.1940975Z 2025-10-10T00:01:09.1941637Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.1942678Z 2025-10-10T00:01:09.1942687Z 2025-10-10T00:01:09.1943042Z if __name__ == "__main__": 2025-10-10T00:01:09.1943947Z main() 2025-10-10T00:01:09.1944406Z 2025-10-10T00:01:09.2050975Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.2052668Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.2087091Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.2087959Z env: 2025-10-10T00:01:09.2089031Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.2089815Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.2090669Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.2091630Z ISSUE_OWNER: 2025-10-10T00:01:09.2092395Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.2093227Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:09.2094086Z PR_NUMBER: 2025-10-10T00:01:09.2094924Z ##[endgroup] 2025-10-10T00:01:11.9216177Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:13.3405469Z Collecting urllib3==1.26.18 2025-10-10T00:01:13.3777443Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:13.4075091Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 5.5 MB/s eta 0:00:00 2025-10-10T00:01:13.4193692Z Collecting PyGithub==2.3.0 2025-10-10T00:01:13.4239242Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:13.4674093Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:13.4705705Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:13.4751999Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:13.4769724Z 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-10-10T00:01:13.4784038Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:13.5042981Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:13.5075364Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:13.5385371Z 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-10-10T00:01:13.6747570Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.6784013Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:13.8096506Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:13.8176187Z 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-10-10T00:01:13.8376962Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.8411344Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:13.8647221Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:13.8728834Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 21.7 MB/s eta 0:00:00 2025-10-10T00:01:13.8834684Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:13.8918646Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 51.8 MB/s eta 0:00:00 2025-10-10T00:01:13.8964592Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:13.9116369Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 102.7 MB/s eta 0:00:00 2025-10-10T00:01:13.9165213Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:13.9219917Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:13.9277673Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 50.8 MB/s eta 0:00:00 2025-10-10T00:01:13.9317833Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:13.9361322Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 30.4 MB/s eta 0:00:00 2025-10-10T00:01:13.9391006Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:13.9448812Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 26.1 MB/s eta 0:00:00 2025-10-10T00:01:14.3306116Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:14.8663333Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:14.9455294Z ##[group]Run curr_branch="main" 2025-10-10T00:01:14.9455613Z curr_branch="main" 2025-10-10T00:01:14.9455841Z curr_ref_type="branch" 2025-10-10T00:01:14.9456106Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:14.9456397Z  2025-10-10T00:01:14.9456583Z python3 runner_determinator.py \ 2025-10-10T00:01:14.9456883Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:14.9457157Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:14.9457423Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:14.9457704Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:14.9457988Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:14.9458277Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:14.9458556Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:14.9458863Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:14.9459226Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:14.9459520Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:14.9492914Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:14.9493149Z env: 2025-10-10T00:01:14.9493569Z GITHUB_TOKEN: *** 2025-10-10T00:01:14.9493767Z ISSUE_NUMBER: 5132 2025-10-10T00:01:14.9493979Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:14.9494209Z ISSUE_OWNER: 2025-10-10T00:01:14.9494392Z CHECK_EXPERIMENTS: 2025-10-10T00:01:14.9494737Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:14.9494953Z PR_NUMBER: 2025-10-10T00:01:14.9495120Z ##[endgroup] 2025-10-10T00:01:14.9545490Z Current branch is 'main' 2025-10-10T00:01:17.6869626Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-10-10T00:01:17.6870728Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:17.6871570Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:17.6872191Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:17.6872672Z INFO : Setting output: label-type='' 2025-10-10T00:01:17.7182968Z Evaluate and set job outputs 2025-10-10T00:01:17.7189695Z Cleaning up orphan processes