2025-08-14T20:43:45.9421347Z Current runner version: '2.327.1' 2025-08-14T20:43:45.9444703Z ##[group]Runner Image Provisioner 2025-08-14T20:43:45.9445490Z Hosted Compute Agent 2025-08-14T20:43:45.9446135Z Version: 20250812.370 2025-08-14T20:43:45.9446726Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:45.9447416Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:45.9447957Z ##[endgroup] 2025-08-14T20:43:45.9448577Z ##[group]Operating System 2025-08-14T20:43:45.9449306Z Ubuntu 2025-08-14T20:43:45.9449849Z 24.04.2 2025-08-14T20:43:45.9450298Z LTS 2025-08-14T20:43:45.9450757Z ##[endgroup] 2025-08-14T20:43:45.9451279Z ##[group]Runner Image 2025-08-14T20:43:45.9451829Z Image: ubuntu-24.04 2025-08-14T20:43:45.9452334Z Version: 20250810.1.0 2025-08-14T20:43:45.9453294Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250810.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:45.9454933Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250810.1 2025-08-14T20:43:45.9455936Z ##[endgroup] 2025-08-14T20:43:45.9456858Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:45.9459296Z Metadata: read 2025-08-14T20:43:45.9459910Z ##[endgroup] 2025-08-14T20:43:45.9462234Z Secret source: Actions 2025-08-14T20:43:45.9463123Z Prepare workflow directory 2025-08-14T20:43:45.9961802Z Prepare all required actions 2025-08-14T20:43:46.0017316Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:46.0022555Z ##[group] Inputs 2025-08-14T20:43:46.0023193Z check_experiments: 2025-08-14T20:43:46.0023849Z opt_out_experiments: 2025-08-14T20:43:46.0024408Z triggering_actor: pytorchmergebot 2025-08-14T20:43:46.0025023Z issue_owner: 2025-08-14T20:43:46.0025472Z curr_branch: main 2025-08-14T20:43:46.0026063Z curr_ref_type: branch 2025-08-14T20:43:46.0026558Z issue_number: 5132 2025-08-14T20:43:46.0027251Z ##[endgroup] 2025-08-14T20:43:46.0027906Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:46.5408473Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:46.5411110Z cat < runner_determinator.py 2025-08-14T20:43:46.5411845Z # flake8: noqa: G004 2025-08-14T20:43:46.5412400Z  2025-08-14T20:43:46.5413274Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:46.5414401Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:46.5415373Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:46.5416175Z  2025-08-14T20:43:46.5416623Z """ 2025-08-14T20:43:46.5417370Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:46.5418482Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:46.5420466Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:46.5421550Z of which runners should be used to run which job. 2025-08-14T20:43:46.5422250Z  2025-08-14T20:43:46.5422994Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:46.5424030Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:46.5425150Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:46.5426048Z list, defined. 2025-08-14T20:43:46.5426542Z  2025-08-14T20:43:46.5427316Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:46.5428375Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:46.5429619Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:46.5430619Z  2025-08-14T20:43:46.5431359Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:46.5432655Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:46.5433624Z experiments which the user could be opted in to. 2025-08-14T20:43:46.5434335Z  2025-08-14T20:43:46.5434831Z The user list has the following rules: 2025-08-14T20:43:46.5435532Z  2025-08-14T20:43:46.5436261Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:46.5437272Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:46.5438277Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:46.5439076Z  2025-08-14T20:43:46.5439574Z Example config: 2025-08-14T20:43:46.5440305Z  # A list of experiments that can be opted into. 2025-08-14T20:43:46.5441122Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:46.5441922Z  # Expected syntax is: 2025-08-14T20:43:46.5524740Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:46.5525984Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:46.5526811Z  2025-08-14T20:43:46.5527204Z  experiments: 2025-08-14T20:43:46.5527685Z  lf: 2025-08-14T20:43:46.5528122Z  rollout_percent: 25 2025-08-14T20:43:46.5528800Z  all_branches: false 2025-08-14T20:43:46.5529321Z  default: true 2025-08-14T20:43:46.5529788Z  --- 2025-08-14T20:43:46.5530182Z  2025-08-14T20:43:46.5530554Z  # Opt-ins: 2025-08-14T20:43:46.5531227Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:46.5532396Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:46.5533282Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:46.5534021Z  # Experiments should be from the above list. 2025-08-14T20:43:46.5534604Z  2025-08-14T20:43:46.5535010Z  @User1,-lf,split_build 2025-08-14T20:43:46.5535520Z  @User2,lf 2025-08-14T20:43:46.5535980Z  @User3,split_build 2025-08-14T20:43:46.5536465Z """ 2025-08-14T20:43:46.5536856Z  2025-08-14T20:43:46.5537238Z import json 2025-08-14T20:43:46.5537687Z import logging 2025-08-14T20:43:46.5538133Z import os 2025-08-14T20:43:46.5538556Z import random 2025-08-14T20:43:46.5539158Z import re 2025-08-14T20:43:46.5539571Z import sys 2025-08-14T20:43:46.5540068Z from argparse import ArgumentParser 2025-08-14T20:43:46.5540785Z from collections.abc import Iterable 2025-08-14T20:43:46.5541380Z from functools import cache 2025-08-14T20:43:46.5541926Z from logging import LogRecord 2025-08-14T20:43:46.5542504Z from typing import Any, NamedTuple 2025-08-14T20:43:46.5543125Z from urllib.request import Request, urlopen 2025-08-14T20:43:46.5543700Z  2025-08-14T20:43:46.5544081Z import yaml 2025-08-14T20:43:46.5544540Z from github import Auth, Github 2025-08-14T20:43:46.5545106Z from github.Issue import Issue 2025-08-14T20:43:46.5545637Z  2025-08-14T20:43:46.5546003Z  2025-08-14T20:43:46.5546467Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:46.5547234Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:46.5548206Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:46.5549248Z  2025-08-14T20:43:46.5549742Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:46.5550570Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:46.5551172Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:46.5551820Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:46.5552389Z  2025-08-14T20:43:46.5552827Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:46.5553375Z  2025-08-14T20:43:46.5553777Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:46.5554306Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:46.5554807Z  2025-08-14T20:43:46.5555172Z  2025-08-14T20:43:46.5555586Z class Experiment(NamedTuple): 2025-08-14T20:43:46.5556133Z  rollout_perc: float = ( 2025-08-14T20:43:46.5556872Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:46.5557602Z  ) 2025-08-14T20:43:46.5558021Z  all_branches: bool = ( 2025-08-14T20:43:46.5558856Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:46.5559584Z  ) 2025-08-14T20:43:46.5560002Z  default: bool = ( 2025-08-14T20:43:46.5560652Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:46.5561347Z  ) 2025-08-14T20:43:46.5561738Z  2025-08-14T20:43:46.5562129Z  # Add more fields as needed 2025-08-14T20:43:46.5562681Z  2025-08-14T20:43:46.5563046Z  2025-08-14T20:43:46.5563455Z class Settings(NamedTuple): 2025-08-14T20:43:46.5563958Z  """ 2025-08-14T20:43:46.5564487Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:46.5565118Z  """ 2025-08-14T20:43:46.5565531Z  2025-08-14T20:43:46.5566016Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:46.5566609Z  2025-08-14T20:43:46.5567161Z  2025-08-14T20:43:46.5567651Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:46.5568374Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:46.5569145Z  2025-08-14T20:43:46.5569528Z  COLORS = { 2025-08-14T20:43:46.5570019Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:46.5570579Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:46.5571135Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:46.5571692Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:46.5572290Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:46.5572813Z  } 2025-08-14T20:43:46.5573206Z  2025-08-14T20:43:46.5573688Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:46.5574525Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:46.5575373Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:46.5576011Z  return super().format(record) 2025-08-14T20:43:46.5576550Z  2025-08-14T20:43:46.5576922Z  2025-08-14T20:43:46.5577335Z handler = logging.StreamHandler() 2025-08-14T20:43:46.5578133Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:46.5579044Z  2025-08-14T20:43:46.5579554Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:46.5580249Z log.addHandler(handler) 2025-08-14T20:43:46.5580818Z log.setLevel(logging.INFO) 2025-08-14T20:43:46.5581374Z  2025-08-14T20:43:46.5581805Z  2025-08-14T20:43:46.5582316Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:46.5582942Z  """ 2025-08-14T20:43:46.5583524Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:46.5584222Z  """ 2025-08-14T20:43:46.5584778Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:46.5585933Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:46.5587209Z  log.warning( 2025-08-14T20:43:46.5588169Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:46.5589439Z  ) 2025-08-14T20:43:46.5589944Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:46.5590538Z  return 2025-08-14T20:43:46.5590996Z  2025-08-14T20:43:46.5591420Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:46.5592061Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:46.5592683Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:46.5593217Z  2025-08-14T20:43:46.5593604Z  2025-08-14T20:43:46.5594157Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:46.5594874Z  return frozenset( 2025-08-14T20:43:46.5595582Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:46.5596310Z  ) 2025-08-14T20:43:46.5596709Z  2025-08-14T20:43:46.5597108Z  2025-08-14T20:43:46.5597536Z def parse_args() -> Any: 2025-08-14T20:43:46.5598217Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:46.5599307Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:46.5600133Z  parser.add_argument( 2025-08-14T20:43:46.5600672Z  "--github-issue-repo", 2025-08-14T20:43:46.5601203Z  type=str, 2025-08-14T20:43:46.5601677Z  required=False, 2025-08-14T20:43:46.5602352Z  default="pytorch/test-infra", 2025-08-14T20:43:46.5602995Z  help="GitHub repo to get the issue", 2025-08-14T20:43:46.5603558Z  ) 2025-08-14T20:43:46.5603983Z  parser.add_argument( 2025-08-14T20:43:46.5604505Z  "--github-repo", 2025-08-14T20:43:46.5605009Z  type=str, 2025-08-14T20:43:46.5605494Z  required=True, 2025-08-14T20:43:46.5606047Z  help="GitHub repo where CI is running", 2025-08-14T20:43:46.5606612Z  ) 2025-08-14T20:43:46.5607034Z  parser.add_argument( 2025-08-14T20:43:46.5607738Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:46.5608453Z  ) 2025-08-14T20:43:46.5608975Z  parser.add_argument( 2025-08-14T20:43:46.5609711Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:46.5610449Z  ) 2025-08-14T20:43:46.5610886Z  parser.add_argument( 2025-08-14T20:43:46.5611634Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:46.5612384Z  ) 2025-08-14T20:43:46.5612808Z  parser.add_argument( 2025-08-14T20:43:46.5613559Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:46.5614371Z  ) 2025-08-14T20:43:46.5614810Z  parser.add_argument( 2025-08-14T20:43:46.5615339Z  "--github-ref-type", 2025-08-14T20:43:46.5615871Z  type=str, 2025-08-14T20:43:46.5616353Z  required=True, 2025-08-14T20:43:46.5616944Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:46.5617551Z  ) 2025-08-14T20:43:46.5617971Z  parser.add_argument( 2025-08-14T20:43:46.5618528Z  "--eligible-experiments", 2025-08-14T20:43:46.5619443Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:46.5620021Z  required=False, 2025-08-14T20:43:46.5620517Z  default="", 2025-08-14T20:43:46.5621477Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:46.5622467Z  ) 2025-08-14T20:43:46.5622896Z  parser.add_argument( 2025-08-14T20:43:46.5623435Z  "--opt-out-experiments", 2025-08-14T20:43:46.5624018Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:46.5624595Z  required=False, 2025-08-14T20:43:46.5625091Z  default="", 2025-08-14T20:43:46.5625561Z  help=( 2025-08-14T20:43:46.5626316Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:46.5627531Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:46.5628431Z  ), 2025-08-14T20:43:46.5628946Z  ) 2025-08-14T20:43:46.5629372Z  parser.add_argument( 2025-08-14T20:43:46.5629880Z  "--pr-number", 2025-08-14T20:43:46.5630379Z  type=str, 2025-08-14T20:43:46.5630862Z  required=False, 2025-08-14T20:43:46.5631364Z  default="", 2025-08-14T20:43:46.5631942Z  help="the optional PR number where this is run", 2025-08-14T20:43:46.5632546Z  ) 2025-08-14T20:43:46.5632941Z  2025-08-14T20:43:46.5633355Z  return parser.parse_args() 2025-08-14T20:43:46.5633875Z  2025-08-14T20:43:46.5634235Z  2025-08-14T20:43:46.5634894Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.5635847Z  auth = Auth.Token(github_token) 2025-08-14T20:43:46.5636449Z  return Github(auth=auth) 2025-08-14T20:43:46.5636971Z  2025-08-14T20:43:46.5637344Z  2025-08-14T20:43:46.5638065Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.5639039Z  repo = gh.get_repo(repo) 2025-08-14T20:43:46.5639629Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:46.5640200Z  2025-08-14T20:43:46.5640581Z  2025-08-14T20:43:46.5640997Z def get_potential_pr_author( 2025-08-14T20:43:46.5641748Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:46.5642488Z ) -> str: 2025-08-14T20:43:46.5643090Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:46.5643978Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:46.5644817Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:46.5645447Z  2025-08-14T20:43:46.5645875Z  gh = get_gh_client(github_token) 2025-08-14T20:43:46.5646410Z  2025-08-14T20:43:46.5646927Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:46.5647615Z  split_tag = ref_name.split("/") 2025-08-14T20:43:46.5648179Z  if ( 2025-08-14T20:43:46.5648728Z  len(split_tag) == 3 2025-08-14T20:43:46.5649305Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:46.5649897Z  and split_tag[2].isnumeric() 2025-08-14T20:43:46.5650435Z  ): 2025-08-14T20:43:46.5650898Z  pr_number = split_tag[2] 2025-08-14T20:43:46.5651444Z  try: 2025-08-14T20:43:46.5651958Z  repository = gh.get_repo(repo) 2025-08-14T20:43:46.5652643Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:46.5653454Z  except Exception as e: 2025-08-14T20:43:46.5654050Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:46.5654789Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:46.5655496Z  ) from e 2025-08-14T20:43:46.5656116Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:46.5656894Z  # In all other cases, return the original input username 2025-08-14T20:43:46.5657545Z  return username 2025-08-14T20:43:46.5658006Z  2025-08-14T20:43:46.5658387Z  2025-08-14T20:43:46.5658989Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:46.5659579Z  """ 2025-08-14T20:43:46.5660297Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:46.5661142Z  """ 2025-08-14T20:43:46.5661754Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:46.5662476Z  2025-08-14T20:43:46.5662845Z  2025-08-14T20:43:46.5663283Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:46.5663839Z  try: 2025-08-14T20:43:46.5664282Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:46.5664849Z  return data 2025-08-14T20:43:46.5665342Z  except yaml.YAMLError: 2025-08-14T20:43:46.5665915Z  log.exception("Error loading YAML") 2025-08-14T20:43:46.5666480Z  raise 2025-08-14T20:43:46.5666917Z  2025-08-14T20:43:46.5667286Z  2025-08-14T20:43:46.5667964Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:46.5669265Z  """ 2025-08-14T20:43:46.5670120Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:46.5670944Z  2025-08-14T20:43:46.5671531Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.5672394Z  and the text below is the list of opted in users. 2025-08-14T20:43:46.5673025Z  2025-08-14T20:43:46.5673680Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:46.5674438Z  """ 2025-08-14T20:43:46.5674957Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:46.5675615Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:46.5676292Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:46.5677176Z  else: 2025-08-14T20:43:46.5677620Z  return "", rollout_state 2025-08-14T20:43:46.5678133Z  2025-08-14T20:43:46.5678496Z  2025-08-14T20:43:46.5679046Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:46.5679616Z  """ 2025-08-14T20:43:46.5680202Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:46.5680901Z  """ 2025-08-14T20:43:46.5681284Z  2025-08-14T20:43:46.5681644Z  2025-08-14T20:43:46.5682217Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:46.5682920Z  """ 2025-08-14T20:43:46.5683707Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:46.5684588Z  2025-08-14T20:43:46.5685454Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:46.5686521Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:46.5687271Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:46.5688094Z  2025-08-14T20:43:46.5688483Z  2025-08-14T20:43:46.5688948Z  """ 2025-08-14T20:43:46.5689361Z  optins = UserOptins() 2025-08-14T20:43:46.5689927Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:46.5690528Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:46.5691143Z  if not user or not user.startswith("@"): 2025-08-14T20:43:46.5691748Z  # Not a valid user. Skip 2025-08-14T20:43:46.5692292Z  continue 2025-08-14T20:43:46.5692775Z  2025-08-14T20:43:46.5693149Z  if user: 2025-08-14T20:43:46.5693677Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:46.5694423Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:46.5695107Z  2025-08-14T20:43:46.5695504Z  return optins 2025-08-14T20:43:46.5695955Z  2025-08-14T20:43:46.5696322Z  2025-08-14T20:43:46.5696860Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:46.5697519Z  """ 2025-08-14T20:43:46.5697969Z  Check if the experiment name is valid. 2025-08-14T20:43:46.5698545Z  A valid name: 2025-08-14T20:43:46.5699376Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:46.5700374Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:46.5701140Z  - Cannot contain spaces 2025-08-14T20:43:46.5701648Z  """ 2025-08-14T20:43:46.5702031Z  2025-08-14T20:43:46.5702527Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:46.5703303Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:46.5704123Z  2025-08-14T20:43:46.5704704Z  if valid: 2025-08-14T20:43:46.5705154Z  return True 2025-08-14T20:43:46.5705601Z  2025-08-14T20:43:46.5705978Z  log.error( 2025-08-14T20:43:46.5707523Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:46.5709244Z  ) 2025-08-14T20:43:46.5709642Z  return False 2025-08-14T20:43:46.5710088Z  2025-08-14T20:43:46.5710450Z  2025-08-14T20:43:46.5711002Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:46.5711687Z  """ 2025-08-14T20:43:46.5712345Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:46.5713112Z  """ 2025-08-14T20:43:46.5713520Z  try: 2025-08-14T20:43:46.5713957Z  if settings_text: 2025-08-14T20:43:46.5714767Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:46.5715613Z  # for easy reading 2025-08-14T20:43:46.5716502Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:46.5717461Z  # the backtick character in shell commands. 2025-08-14T20:43:46.5718125Z  backtick = chr(96) # backtick character 2025-08-14T20:43:46.5718955Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:46.5719684Z  settings = load_yaml(settings_text) 2025-08-14T20:43:46.5720243Z  2025-08-14T20:43:46.5720888Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:46.5721833Z  experiments = {} 2025-08-14T20:43:46.5722330Z  2025-08-14T20:43:46.5722931Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:46.5723750Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:46.5724933Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:46.5726047Z  continue 2025-08-14T20:43:46.5726539Z  2025-08-14T20:43:46.5726940Z  valid_settings = {} 2025-08-14T20:43:46.5727511Z  for setting in exp_settings: 2025-08-14T20:43:46.5728125Z  if setting not in Experiment._fields: 2025-08-14T20:43:46.5728842Z  log.warning( 2025-08-14T20:43:46.5729634Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:46.5730393Z  ) 2025-08-14T20:43:46.5730873Z  else: 2025-08-14T20:43:46.5731460Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:46.5732076Z  2025-08-14T20:43:46.5732581Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:46.5733280Z  return Settings(experiments) 2025-08-14T20:43:46.5733811Z  2025-08-14T20:43:46.5734197Z  except Exception: 2025-08-14T20:43:46.5734754Z  log.exception("Failed to parse settings") 2025-08-14T20:43:46.5735326Z  2025-08-14T20:43:46.5735701Z  return Settings() 2025-08-14T20:43:46.5736158Z  2025-08-14T20:43:46.5736517Z  2025-08-14T20:43:46.5737117Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:46.5737760Z  """ 2025-08-14T20:43:46.5738255Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:46.5738948Z  2025-08-14T20:43:46.5739523Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.5740344Z  and the text below is the list of opted in users. 2025-08-14T20:43:46.5740943Z  2025-08-14T20:43:46.5741569Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:46.5742345Z  """ 2025-08-14T20:43:46.5742962Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.5743791Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:46.5744372Z  2025-08-14T20:43:46.5744735Z  2025-08-14T20:43:46.5745223Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:46.5745845Z  """ 2025-08-14T20:43:46.5746290Z  Parse users from the rollout state. 2025-08-14T20:43:46.5746832Z  2025-08-14T20:43:46.5747211Z  """ 2025-08-14T20:43:46.5747809Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.5748716Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:46.5749300Z  2025-08-14T20:43:46.5749663Z  2025-08-14T20:43:46.5750333Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.5751125Z  """ 2025-08-14T20:43:46.5751604Z  Check if a user is opted into an experiment 2025-08-14T20:43:46.5752183Z  """ 2025-08-14T20:43:46.5752712Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:46.5753323Z  2025-08-14T20:43:46.5753679Z  2025-08-14T20:43:46.5754504Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.5755305Z  """ 2025-08-14T20:43:46.5755831Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:46.5756450Z  """ 2025-08-14T20:43:46.5757019Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:46.5757775Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:46.5758484Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:46.5759233Z  return False 2025-08-14T20:43:46.5759697Z  2025-08-14T20:43:46.5760206Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:46.5760853Z  log.warning( 2025-08-14T20:43:46.5761753Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:46.5762681Z  ) 2025-08-14T20:43:46.5763085Z  2025-08-14T20:43:46.5763464Z  return True 2025-08-14T20:43:46.5763902Z  2025-08-14T20:43:46.5764266Z  2025-08-14T20:43:46.5764652Z def get_runner_prefix( 2025-08-14T20:43:46.5765158Z  rollout_state: str, 2025-08-14T20:43:46.5765694Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:46.5766257Z  branch: str, 2025-08-14T20:43:46.5766830Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.5767564Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.5768195Z  is_canary: bool = False, 2025-08-14T20:43:46.5768800Z ) -> str: 2025-08-14T20:43:46.5769292Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:46.5769931Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:46.5770491Z  2025-08-14T20:43:46.5771002Z  fleet_prefix = "" 2025-08-14T20:43:46.5771500Z  prefixes = [] 2025-08-14T20:43:46.5772208Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:46.5773220Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:46.5773975Z  log.info( 2025-08-14T20:43:46.5774719Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:46.5775517Z  ) 2025-08-14T20:43:46.5775970Z  continue 2025-08-14T20:43:46.5776424Z  2025-08-14T20:43:46.5776821Z  if opt_out_experiments: 2025-08-14T20:43:46.5777424Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:46.5778130Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:46.5778868Z  log.info( 2025-08-14T20:43:46.5779891Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:46.5780925Z  ) 2025-08-14T20:43:46.5781424Z  continue 2025-08-14T20:43:46.5781909Z  2025-08-14T20:43:46.5782310Z  if eligible_experiments: 2025-08-14T20:43:46.5782940Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:46.5783624Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:46.5784223Z  log.info( 2025-08-14T20:43:46.5785076Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:46.5785964Z  ) 2025-08-14T20:43:46.5786425Z  continue 2025-08-14T20:43:46.5787105Z  elif not experiment_settings.default: 2025-08-14T20:43:46.5787682Z  log.info( 2025-08-14T20:43:46.5788414Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:46.5789365Z  ) 2025-08-14T20:43:46.5789803Z  continue 2025-08-14T20:43:46.5790259Z  2025-08-14T20:43:46.5790767Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:46.5791430Z  opted_out_users = [ 2025-08-14T20:43:46.5791955Z  requestor 2025-08-14T20:43:46.5792482Z  for requestor in workflow_requestors 2025-08-14T20:43:46.5793217Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.5793879Z  ] 2025-08-14T20:43:46.5794286Z  2025-08-14T20:43:46.5794677Z  if opted_out_users: 2025-08-14T20:43:46.5795215Z  log.info( 2025-08-14T20:43:46.5795923Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:46.5796658Z  ) 2025-08-14T20:43:46.5797101Z  continue 2025-08-14T20:43:46.5797547Z  2025-08-14T20:43:46.5798059Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:46.5798848Z  opted_in_users = [ 2025-08-14T20:43:46.5799387Z  requestor 2025-08-14T20:43:46.5799934Z  for requestor in workflow_requestors 2025-08-14T20:43:46.5800666Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.5801329Z  ] 2025-08-14T20:43:46.5801729Z  2025-08-14T20:43:46.5802121Z  enabled = False 2025-08-14T20:43:46.5802622Z  if opted_in_users: 2025-08-14T20:43:46.5803266Z  log.info( 2025-08-14T20:43:46.5803972Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:46.5804702Z  ) 2025-08-14T20:43:46.5805154Z  enabled = True 2025-08-14T20:43:46.5805645Z  2025-08-14T20:43:46.5806096Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:46.5806988Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:46.5807995Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:46.5808900Z  log.info( 2025-08-14T20:43:46.5809869Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:46.5810852Z  ) 2025-08-14T20:43:46.5811327Z  enabled = True 2025-08-14T20:43:46.5811846Z  2025-08-14T20:43:46.5812223Z  if enabled: 2025-08-14T20:43:46.5812723Z  label = experiment_name 2025-08-14T20:43:46.5813344Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:46.5814235Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:46.5815177Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:46.5815999Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:46.5816711Z  if is_canary: 2025-08-14T20:43:46.5817282Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:46.5817874Z  fleet_prefix = label 2025-08-14T20:43:46.5818412Z  else: 2025-08-14T20:43:46.5819012Z  prefixes.append(label) 2025-08-14T20:43:46.5819702Z  2025-08-14T20:43:46.5820093Z  if len(prefixes) > 1: 2025-08-14T20:43:46.5820604Z  log.error( 2025-08-14T20:43:46.5821742Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:46.5822914Z  ) 2025-08-14T20:43:46.5823362Z  prefixes = prefixes[:1] 2025-08-14T20:43:46.5823877Z  2025-08-14T20:43:46.5824283Z  # Fleet always comes first 2025-08-14T20:43:46.5824811Z  if fleet_prefix: 2025-08-14T20:43:46.5825333Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:46.5825875Z  2025-08-14T20:43:46.5826360Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:46.5826975Z  2025-08-14T20:43:46.5827336Z  2025-08-14T20:43:46.5828040Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:46.5828964Z  """ 2025-08-14T20:43:46.5829631Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:46.5830450Z  2025-08-14T20:43:46.5831070Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:46.5831839Z  """ 2025-08-14T20:43:46.5832289Z  gh = get_gh_client(github_token) 2025-08-14T20:43:46.5832908Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:46.5833606Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:46.5834257Z  2025-08-14T20:43:46.5834620Z  2025-08-14T20:43:46.5835266Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:46.5836206Z  for _ in range(num_retries): 2025-08-14T20:43:46.5836753Z  try: 2025-08-14T20:43:46.5837251Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:46.5837962Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:46.5838770Z  return json.loads(content) 2025-08-14T20:43:46.5839414Z  except Exception as e: 2025-08-14T20:43:46.5840031Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:46.5840623Z  2025-08-14T20:43:46.5841259Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:46.5842030Z  return {} 2025-08-14T20:43:46.5842462Z  2025-08-14T20:43:46.5842831Z  2025-08-14T20:43:46.5843193Z @cache 2025-08-14T20:43:46.5843895Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:46.5844703Z  """ 2025-08-14T20:43:46.5845163Z  Dynamically get PR information 2025-08-14T20:43:46.5845707Z  """ 2025-08-14T20:43:46.5846263Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:46.5846935Z  headers = { 2025-08-14T20:43:46.5847465Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:46.5848137Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:46.5848805Z  } 2025-08-14T20:43:46.5849302Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:46.5849967Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:46.5850549Z  headers=headers, 2025-08-14T20:43:46.5851040Z  ) 2025-08-14T20:43:46.5851425Z  2025-08-14T20:43:46.5851817Z  if not json_response: 2025-08-14T20:43:46.5852470Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:46.5853296Z  return {} 2025-08-14T20:43:46.5853747Z  2025-08-14T20:43:46.5854146Z  return json_response 2025-08-14T20:43:46.5854630Z  2025-08-14T20:43:46.5854987Z  2025-08-14T20:43:46.5855625Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:46.5856396Z  """ 2025-08-14T20:43:46.5856986Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:46.5857673Z  """ 2025-08-14T20:43:46.5858221Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:46.5858988Z  return { 2025-08-14T20:43:46.5859642Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:46.5860376Z  } 2025-08-14T20:43:46.5860761Z  2025-08-14T20:43:46.5861137Z  2025-08-14T20:43:46.5861516Z def main() -> None: 2025-08-14T20:43:46.5862005Z  args = parse_args() 2025-08-14T20:43:46.5862484Z  2025-08-14T20:43:46.5862941Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:46.5863517Z  2025-08-14T20:43:46.5863912Z  # Check if the PR is opt-out 2025-08-14T20:43:46.5864464Z  if args.pr_number: 2025-08-14T20:43:46.5865199Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:46.5866014Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:46.5866563Z  log.info( 2025-08-14T20:43:46.5867327Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:46.5868127Z  ) 2025-08-14T20:43:46.5868840Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.5869575Z  sys.exit() 2025-08-14T20:43:46.5870163Z  2025-08-14T20:43:46.5870542Z  try: 2025-08-14T20:43:46.5871037Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:46.5871820Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:46.5872501Z  ) 2025-08-14T20:43:46.5872901Z  2025-08-14T20:43:46.5873333Z  username = get_potential_pr_author( 2025-08-14T20:43:46.5873908Z  args.github_token, 2025-08-14T20:43:46.5874447Z  args.github_repo, 2025-08-14T20:43:46.5874977Z  args.github_actor, 2025-08-14T20:43:46.5875524Z  args.github_ref_type, 2025-08-14T20:43:46.5876070Z  args.github_branch, 2025-08-14T20:43:46.5876585Z  ) 2025-08-14T20:43:46.5876985Z  2025-08-14T20:43:46.5877502Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:46.5878162Z  2025-08-14T20:43:46.5878599Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:46.5879301Z  rollout_state, 2025-08-14T20:43:46.5879857Z  (args.github_issue_owner, username), 2025-08-14T20:43:46.5880455Z  args.github_branch, 2025-08-14T20:43:46.5881016Z  args.eligible_experiments, 2025-08-14T20:43:46.5881610Z  args.opt_out_experiments, 2025-08-14T20:43:46.5882159Z  is_canary, 2025-08-14T20:43:46.5882629Z  ) 2025-08-14T20:43:46.5883059Z  2025-08-14T20:43:46.5883456Z  except Exception as e: 2025-08-14T20:43:46.5883983Z  log.error( 2025-08-14T20:43:46.5884737Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:46.5885537Z  ) 2025-08-14T20:43:46.5885955Z  2025-08-14T20:43:46.5886652Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.5887359Z  2025-08-14T20:43:46.5887721Z  2025-08-14T20:43:46.5888113Z if __name__ == "__main__": 2025-08-14T20:43:46.5888740Z  main() 2025-08-14T20:43:46.5889159Z  2025-08-14T20:43:46.5889523Z EOF 2025-08-14T20:43:46.5889912Z  2025-08-14T20:43:46.5890311Z cat runner_determinator.py 2025-08-14T20:43:46.6152682Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:46.6153490Z env: 2025-08-14T20:43:46.6154162Z GITHUB_TOKEN: *** 2025-08-14T20:43:46.6154596Z ISSUE_NUMBER: 5132 2025-08-14T20:43:46.6155053Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:46.6155553Z ISSUE_OWNER: 2025-08-14T20:43:46.6155959Z CHECK_EXPERIMENTS: 2025-08-14T20:43:46.6156396Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:46.6156827Z PR_NUMBER: 2025-08-14T20:43:46.6157215Z ##[endgroup] 2025-08-14T20:43:46.6363616Z # flake8: noqa: G004 2025-08-14T20:43:46.6363974Z 2025-08-14T20:43:46.6364419Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:46.6365382Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:46.6366253Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:46.6366707Z 2025-08-14T20:43:46.6366877Z """ 2025-08-14T20:43:46.6367464Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:46.6368351Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:46.6369519Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:46.6370350Z of which runners should be used to run which job. 2025-08-14T20:43:46.6370760Z 2025-08-14T20:43:46.6371154Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:46.6372258Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:46.6373194Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:46.6373905Z list, defined. 2025-08-14T20:43:46.6374143Z 2025-08-14T20:43:46.6374511Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:46.6375442Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:46.6376270Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:46.6376712Z 2025-08-14T20:43:46.6377090Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:46.6377964Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:46.6378929Z experiments which the user could be opted in to. 2025-08-14T20:43:46.6379392Z 2025-08-14T20:43:46.6379602Z The user list has the following rules: 2025-08-14T20:43:46.6379954Z 2025-08-14T20:43:46.6380280Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:46.6381145Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:46.6381912Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:46.6382316Z 2025-08-14T20:43:46.6382493Z Example config: 2025-08-14T20:43:46.6382947Z # A list of experiments that can be opted into. 2025-08-14T20:43:46.6383625Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:46.6384257Z # Expected syntax is: 2025-08-14T20:43:46.6384925Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:46.6385909Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:46.6386523Z 2025-08-14T20:43:46.6386700Z experiments: 2025-08-14T20:43:46.6387099Z lf: 2025-08-14T20:43:46.6387478Z rollout_percent: 25 2025-08-14T20:43:46.6387945Z all_branches: false 2025-08-14T20:43:46.6388573Z default: true 2025-08-14T20:43:46.6389245Z --- 2025-08-14T20:43:46.6389456Z 2025-08-14T20:43:46.6389624Z # Opt-ins: 2025-08-14T20:43:46.6390217Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:46.6391083Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:46.6391875Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:46.6392541Z # Experiments should be from the above list. 2025-08-14T20:43:46.6392930Z 2025-08-14T20:43:46.6393118Z @User1,-lf,split_build 2025-08-14T20:43:46.6393568Z @User2,lf 2025-08-14T20:43:46.6393992Z @User3,split_build 2025-08-14T20:43:46.6394409Z """ 2025-08-14T20:43:46.6394602Z 2025-08-14T20:43:46.6394772Z import json 2025-08-14T20:43:46.6395152Z import logging 2025-08-14T20:43:46.6395536Z import os 2025-08-14T20:43:46.6395903Z import random 2025-08-14T20:43:46.6396287Z import re 2025-08-14T20:43:46.6396656Z import sys 2025-08-14T20:43:46.6397084Z from argparse import ArgumentParser 2025-08-14T20:43:46.6397619Z from collections.abc import Iterable 2025-08-14T20:43:46.6398142Z from functools import cache 2025-08-14T20:43:46.6398734Z from logging import LogRecord 2025-08-14T20:43:46.6399236Z from typing import Any, NamedTuple 2025-08-14T20:43:46.6399780Z from urllib.request import Request, urlopen 2025-08-14T20:43:46.6400157Z 2025-08-14T20:43:46.6400324Z import yaml 2025-08-14T20:43:46.6400722Z from github import Auth, Github 2025-08-14T20:43:46.6401225Z from github.Issue import Issue 2025-08-14T20:43:46.6401531Z 2025-08-14T20:43:46.6401537Z 2025-08-14T20:43:46.6401772Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:46.6402463Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:46.6403350Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:46.6403916Z 2025-08-14T20:43:46.6404148Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:46.6404877Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:46.6405413Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:46.6405980Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:46.6406339Z 2025-08-14T20:43:46.6406540Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:46.6406874Z 2025-08-14T20:43:46.6407069Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:46.6407551Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:46.6407835Z 2025-08-14T20:43:46.6407842Z 2025-08-14T20:43:46.6408031Z class Experiment(NamedTuple): 2025-08-14T20:43:46.6408523Z rollout_perc: float = ( 2025-08-14T20:43:46.6409402Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:46.6410106Z ) 2025-08-14T20:43:46.6410482Z all_branches: bool = ( 2025-08-14T20:43:46.6411105Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:46.6411792Z ) 2025-08-14T20:43:46.6412151Z default: bool = ( 2025-08-14T20:43:46.6412733Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:46.6413387Z ) 2025-08-14T20:43:46.6413591Z 2025-08-14T20:43:46.6413773Z # Add more fields as needed 2025-08-14T20:43:46.6414076Z 2025-08-14T20:43:46.6414082Z 2025-08-14T20:43:46.6414274Z class Settings(NamedTuple): 2025-08-14T20:43:46.6414714Z """ 2025-08-14T20:43:46.6415172Z Settings for the experiments that can be opted into. 2025-08-14T20:43:46.6415739Z """ 2025-08-14T20:43:46.6415937Z 2025-08-14T20:43:46.6416156Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:46.6416523Z 2025-08-14T20:43:46.6416530Z 2025-08-14T20:43:46.6416735Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:46.6417360Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:46.6417791Z 2025-08-14T20:43:46.6417964Z COLORS = { 2025-08-14T20:43:46.6418362Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:46.6419018Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:46.6419661Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:46.6420171Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:46.6420657Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:46.6421133Z } 2025-08-14T20:43:46.6421329Z 2025-08-14T20:43:46.6421553Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:46.6422318Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:46.6423098Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:46.6423674Z return super().format(record) 2025-08-14T20:43:46.6424010Z 2025-08-14T20:43:46.6424017Z 2025-08-14T20:43:46.6424218Z handler = logging.StreamHandler() 2025-08-14T20:43:46.6424920Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:46.6425483Z 2025-08-14T20:43:46.6425733Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:46.6426310Z log.addHandler(handler) 2025-08-14T20:43:46.6426766Z log.setLevel(logging.INFO) 2025-08-14T20:43:46.6427052Z 2025-08-14T20:43:46.6427059Z 2025-08-14T20:43:46.6427316Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:46.6427884Z """ 2025-08-14T20:43:46.6428397Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:46.6429157Z """ 2025-08-14T20:43:46.6429528Z if not GITHUB_OUTPUT: 2025-08-14T20:43:46.6430612Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:46.6431741Z log.warning( 2025-08-14T20:43:46.6432599Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:46.6433531Z ) 2025-08-14T20:43:46.6443218Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:46.6443842Z return 2025-08-14T20:43:46.6444084Z 2025-08-14T20:43:46.6444487Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:46.6445114Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:46.6445693Z f.write(f"{key}={value}\n") 2025-08-14T20:43:46.6446023Z 2025-08-14T20:43:46.6446031Z 2025-08-14T20:43:46.6446341Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:46.6446979Z return frozenset( 2025-08-14T20:43:46.6447596Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:46.6448277Z ) 2025-08-14T20:43:46.6448477Z 2025-08-14T20:43:46.6448484Z 2025-08-14T20:43:46.6448831Z def parse_args() -> Any: 2025-08-14T20:43:46.6449408Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:46.6450294Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:46.6451069Z parser.add_argument( 2025-08-14T20:43:46.6451520Z "--github-issue-repo", 2025-08-14T20:43:46.6451992Z type=str, 2025-08-14T20:43:46.6452415Z required=False, 2025-08-14T20:43:46.6452876Z default="pytorch/test-infra", 2025-08-14T20:43:46.6453413Z help="GitHub repo to get the issue", 2025-08-14T20:43:46.6453925Z ) 2025-08-14T20:43:46.6454303Z parser.add_argument( 2025-08-14T20:43:46.6454758Z "--github-repo", 2025-08-14T20:43:46.6455185Z type=str, 2025-08-14T20:43:46.6455588Z required=True, 2025-08-14T20:43:46.6456054Z help="GitHub repo where CI is running", 2025-08-14T20:43:46.6456585Z ) 2025-08-14T20:43:46.6456959Z parser.add_argument( 2025-08-14T20:43:46.6457572Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:46.6458246Z ) 2025-08-14T20:43:46.6458776Z parser.add_argument( 2025-08-14T20:43:46.6459417Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:46.6460101Z ) 2025-08-14T20:43:46.6460476Z parser.add_argument( 2025-08-14T20:43:46.6461112Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:46.6461956Z ) 2025-08-14T20:43:46.6462350Z parser.add_argument( 2025-08-14T20:43:46.6463004Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:46.6463729Z ) 2025-08-14T20:43:46.6464098Z parser.add_argument( 2025-08-14T20:43:46.6464552Z "--github-ref-type", 2025-08-14T20:43:46.6465006Z type=str, 2025-08-14T20:43:46.6514538Z required=True, 2025-08-14T20:43:46.6515262Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:46.6515919Z ) 2025-08-14T20:43:46.6516305Z parser.add_argument( 2025-08-14T20:43:46.6516777Z "--eligible-experiments", 2025-08-14T20:43:46.6517296Z type=_str_comma_separated_to_set, 2025-08-14T20:43:46.6517832Z required=False, 2025-08-14T20:43:46.6518259Z default="", 2025-08-14T20:43:46.6519267Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:46.6520218Z ) 2025-08-14T20:43:46.6520590Z parser.add_argument( 2025-08-14T20:43:46.6521152Z "--opt-out-experiments", 2025-08-14T20:43:46.6521884Z type=_str_comma_separated_to_set, 2025-08-14T20:43:46.6522428Z required=False, 2025-08-14T20:43:46.6522849Z default="", 2025-08-14T20:43:46.6523291Z help=( 2025-08-14T20:43:46.6523962Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:46.6525099Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:46.6525936Z ), 2025-08-14T20:43:46.6526290Z ) 2025-08-14T20:43:46.6526665Z parser.add_argument( 2025-08-14T20:43:46.6527098Z "--pr-number", 2025-08-14T20:43:46.6527527Z type=str, 2025-08-14T20:43:46.6527923Z required=False, 2025-08-14T20:43:46.6528343Z default="", 2025-08-14T20:43:46.6529215Z help="the optional PR number where this is run", 2025-08-14T20:43:46.6529819Z ) 2025-08-14T20:43:46.6530016Z 2025-08-14T20:43:46.6530210Z return parser.parse_args() 2025-08-14T20:43:46.6530514Z 2025-08-14T20:43:46.6530520Z 2025-08-14T20:43:46.6530932Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.6531699Z auth = Auth.Token(github_token) 2025-08-14T20:43:46.6532202Z return Github(auth=auth) 2025-08-14T20:43:46.6532507Z 2025-08-14T20:43:46.6532514Z 2025-08-14T20:43:46.6532971Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:46.6533780Z repo = gh.get_repo(repo) 2025-08-14T20:43:46.6534285Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:46.6534646Z 2025-08-14T20:43:46.6534653Z 2025-08-14T20:43:46.6534853Z def get_potential_pr_author( 2025-08-14T20:43:46.6535497Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:46.6536187Z ) -> str: 2025-08-14T20:43:46.6536699Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:46.6537494Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:46.6538230Z # embedded in the tag name: ciflow// 2025-08-14T20:43:46.6538780Z 2025-08-14T20:43:46.6538977Z gh = get_gh_client(github_token) 2025-08-14T20:43:46.6539311Z 2025-08-14T20:43:46.6539586Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:46.6540211Z split_tag = ref_name.split("/") 2025-08-14T20:43:46.6540718Z if ( 2025-08-14T20:43:46.6541101Z len(split_tag) == 3 2025-08-14T20:43:46.6541591Z and split_tag[0] == "ciflow" 2025-08-14T20:43:46.6542121Z and split_tag[2].isnumeric() 2025-08-14T20:43:46.6542619Z ): 2025-08-14T20:43:46.6543007Z pr_number = split_tag[2] 2025-08-14T20:43:46.6543494Z try: 2025-08-14T20:43:46.6544070Z repository = gh.get_repo(repo) 2025-08-14T20:43:46.6544692Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:46.6545297Z except Exception as e: 2025-08-14T20:43:46.6545808Z raise Exception( # noqa: TRY002 2025-08-14T20:43:46.6546480Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:46.6547119Z ) from e 2025-08-14T20:43:46.6547650Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:46.6548345Z # In all other cases, return the original input username 2025-08-14T20:43:46.6549051Z return username 2025-08-14T20:43:46.6549296Z 2025-08-14T20:43:46.6549303Z 2025-08-14T20:43:46.6549533Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:46.6550062Z """ 2025-08-14T20:43:46.6550701Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:46.6551490Z """ 2025-08-14T20:43:46.6552055Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:46.6552576Z 2025-08-14T20:43:46.6552584Z 2025-08-14T20:43:46.6552785Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:46.6553282Z try: 2025-08-14T20:43:46.6553678Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:46.6554181Z return data 2025-08-14T20:43:46.6554598Z except yaml.YAMLError: 2025-08-14T20:43:46.6555083Z log.exception("Error loading YAML") 2025-08-14T20:43:46.6555604Z raise 2025-08-14T20:43:46.6555817Z 2025-08-14T20:43:46.6555824Z 2025-08-14T20:43:46.6556238Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:46.6557032Z """ 2025-08-14T20:43:46.6557656Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:46.6558250Z 2025-08-14T20:43:46.6558817Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.6559621Z and the text below is the list of opted in users. 2025-08-14T20:43:46.6560023Z 2025-08-14T20:43:46.6560396Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:46.6561105Z """ 2025-08-14T20:43:46.6561546Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:46.6562155Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:46.6562757Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:46.6563343Z else: 2025-08-14T20:43:46.6563730Z return "", rollout_state 2025-08-14T20:43:46.6564031Z 2025-08-14T20:43:46.6564038Z 2025-08-14T20:43:46.6564237Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:46.6564743Z """ 2025-08-14T20:43:46.6565259Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:46.6565943Z """ 2025-08-14T20:43:46.6566144Z 2025-08-14T20:43:46.6566151Z 2025-08-14T20:43:46.6566508Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:46.6567156Z """ 2025-08-14T20:43:46.6567888Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:46.6568586Z 2025-08-14T20:43:46.6569346Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:46.6570348Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:46.6571024Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:46.6571500Z 2025-08-14T20:43:46.6571506Z 2025-08-14T20:43:46.6571672Z """ 2025-08-14T20:43:46.6572048Z optins = UserOptins() 2025-08-14T20:43:46.6572531Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:46.6573089Z user = user.strip("\r\n\t -") 2025-08-14T20:43:46.6573627Z if not user or not user.startswith("@"): 2025-08-14T20:43:46.6574188Z # Not a valid user. Skip 2025-08-14T20:43:46.6574824Z continue 2025-08-14T20:43:46.6575076Z 2025-08-14T20:43:46.6575240Z if user: 2025-08-14T20:43:46.6575680Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:46.6576362Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:46.6576851Z 2025-08-14T20:43:46.6577027Z return optins 2025-08-14T20:43:46.6577264Z 2025-08-14T20:43:46.6577271Z 2025-08-14T20:43:46.6577557Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:46.6578159Z """ 2025-08-14T20:43:46.6578552Z Check if the experiment name is valid. 2025-08-14T20:43:46.6579185Z A valid name: 2025-08-14T20:43:46.6579831Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:46.6580772Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:46.6581511Z - Cannot contain spaces 2025-08-14T20:43:46.6581987Z """ 2025-08-14T20:43:46.6582192Z 2025-08-14T20:43:46.6582456Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:46.6583158Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:46.6583609Z 2025-08-14T20:43:46.6583774Z if valid: 2025-08-14T20:43:46.6584157Z return True 2025-08-14T20:43:46.6584391Z 2025-08-14T20:43:46.6584564Z log.error( 2025-08-14T20:43:46.6586037Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:46.6587601Z ) 2025-08-14T20:43:46.6587956Z return False 2025-08-14T20:43:46.6588187Z 2025-08-14T20:43:46.6588194Z 2025-08-14T20:43:46.6588496Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:46.6589206Z """ 2025-08-14T20:43:46.6589914Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:46.6590661Z """ 2025-08-14T20:43:46.6591020Z try: 2025-08-14T20:43:46.6591390Z if settings_text: 2025-08-14T20:43:46.6592129Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:46.6592920Z # for easy reading 2025-08-14T20:43:46.6593708Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:46.6594586Z # the backtick character in shell commands. 2025-08-14T20:43:46.6595180Z backtick = chr(96) # backtick character 2025-08-14T20:43:46.6595838Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:46.6596504Z settings = load_yaml(settings_text) 2025-08-14T20:43:46.6596877Z 2025-08-14T20:43:46.6597296Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:46.6598067Z experiments = {} 2025-08-14T20:43:46.6598358Z 2025-08-14T20:43:46.6598843Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:46.6599603Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:46.6600722Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:46.6601775Z continue 2025-08-14T20:43:46.6602058Z 2025-08-14T20:43:46.6602241Z valid_settings = {} 2025-08-14T20:43:46.6602758Z for setting in exp_settings: 2025-08-14T20:43:46.6603332Z if setting not in Experiment._fields: 2025-08-14T20:43:46.6603888Z log.warning( 2025-08-14T20:43:46.6604598Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:46.6605322Z ) 2025-08-14T20:43:46.6605893Z else: 2025-08-14T20:43:46.6606404Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:46.6606831Z 2025-08-14T20:43:46.6607110Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:46.6607755Z return Settings(experiments) 2025-08-14T20:43:46.6608110Z 2025-08-14T20:43:46.6608287Z except Exception: 2025-08-14T20:43:46.6608922Z log.exception("Failed to parse settings") 2025-08-14T20:43:46.6609318Z 2025-08-14T20:43:46.6609494Z return Settings() 2025-08-14T20:43:46.6609748Z 2025-08-14T20:43:46.6609755Z 2025-08-14T20:43:46.6610002Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:46.6610571Z """ 2025-08-14T20:43:46.6611001Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:46.6611404Z 2025-08-14T20:43:46.6611755Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:46.6612525Z and the text below is the list of opted in users. 2025-08-14T20:43:46.6612935Z 2025-08-14T20:43:46.6613339Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:46.6614141Z """ 2025-08-14T20:43:46.6614695Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.6615453Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:46.6615862Z 2025-08-14T20:43:46.6615869Z 2025-08-14T20:43:46.6616115Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:46.6616680Z """ 2025-08-14T20:43:46.6617066Z Parse users from the rollout state. 2025-08-14T20:43:46.6617416Z 2025-08-14T20:43:46.6617575Z """ 2025-08-14T20:43:46.6618101Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:46.6619367Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:46.6619784Z 2025-08-14T20:43:46.6619790Z 2025-08-14T20:43:46.6620357Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.6621115Z """ 2025-08-14T20:43:46.6621536Z Check if a user is opted into an experiment 2025-08-14T20:43:46.6622077Z """ 2025-08-14T20:43:46.6622527Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:46.6622944Z 2025-08-14T20:43:46.6622951Z 2025-08-14T20:43:46.6623369Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:46.6624122Z """ 2025-08-14T20:43:46.6624580Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:46.6625154Z """ 2025-08-14T20:43:46.6625656Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:46.6626334Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:46.6626977Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:46.6627575Z return False 2025-08-14T20:43:46.6627833Z 2025-08-14T20:43:46.6628113Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:46.6628825Z log.warning( 2025-08-14T20:43:46.6629648Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:46.6630543Z ) 2025-08-14T20:43:46.6630750Z 2025-08-14T20:43:46.6630918Z return True 2025-08-14T20:43:46.6631147Z 2025-08-14T20:43:46.6631158Z 2025-08-14T20:43:46.6631337Z def get_runner_prefix( 2025-08-14T20:43:46.6631764Z rollout_state: str, 2025-08-14T20:43:46.6632224Z workflow_requestors: Iterable[str], 2025-08-14T20:43:46.6632735Z branch: str, 2025-08-14T20:43:46.6633218Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.6633884Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:46.6634467Z is_canary: bool = False, 2025-08-14T20:43:46.6634924Z ) -> str: 2025-08-14T20:43:46.6635342Z settings = parse_settings(rollout_state) 2025-08-14T20:43:46.6636063Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:46.6636431Z 2025-08-14T20:43:46.6636607Z fleet_prefix = "" 2025-08-14T20:43:46.6637035Z prefixes = [] 2025-08-14T20:43:46.6637659Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:46.6638606Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:46.6639428Z log.info( 2025-08-14T20:43:46.6640099Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:46.6640860Z ) 2025-08-14T20:43:46.6641234Z continue 2025-08-14T20:43:46.6641484Z 2025-08-14T20:43:46.6641672Z if opt_out_experiments: 2025-08-14T20:43:46.6642195Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:46.6642843Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:46.6643429Z log.info( 2025-08-14T20:43:46.6644348Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:46.6645329Z ) 2025-08-14T20:43:46.6645721Z continue 2025-08-14T20:43:46.6645995Z 2025-08-14T20:43:46.6646182Z if eligible_experiments: 2025-08-14T20:43:46.6646729Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:46.6647360Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:46.6647919Z log.info( 2025-08-14T20:43:46.6648798Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:46.6649644Z ) 2025-08-14T20:43:46.6650037Z continue 2025-08-14T20:43:46.6650512Z elif not experiment_settings.default: 2025-08-14T20:43:46.6651039Z log.info( 2025-08-14T20:43:46.6651815Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:46.6652568Z ) 2025-08-14T20:43:46.6652943Z continue 2025-08-14T20:43:46.6652951Z 2025-08-14T20:43:46.6653227Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:46.6653409Z opted_out_users = [ 2025-08-14T20:43:46.6653576Z requestor 2025-08-14T20:43:46.6653785Z for requestor in workflow_requestors 2025-08-14T20:43:46.6654087Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.6654256Z ] 2025-08-14T20:43:46.6654264Z 2025-08-14T20:43:46.6654445Z if opted_out_users: 2025-08-14T20:43:46.6654613Z log.info( 2025-08-14T20:43:46.6654989Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:46.6655149Z ) 2025-08-14T20:43:46.6655317Z continue 2025-08-14T20:43:46.6655325Z 2025-08-14T20:43:46.6655599Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:46.6655785Z opted_in_users = [ 2025-08-14T20:43:46.6655948Z requestor 2025-08-14T20:43:46.6656156Z for requestor in workflow_requestors 2025-08-14T20:43:46.6656454Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:46.6656613Z ] 2025-08-14T20:43:46.6656620Z 2025-08-14T20:43:46.6656796Z enabled = False 2025-08-14T20:43:46.6656982Z if opted_in_users: 2025-08-14T20:43:46.6657147Z log.info( 2025-08-14T20:43:46.6657502Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:46.6657672Z ) 2025-08-14T20:43:46.6657847Z enabled = True 2025-08-14T20:43:46.6657855Z 2025-08-14T20:43:46.6658071Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:46.6658527Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:46.6659084Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:46.6659260Z log.info( 2025-08-14T20:43:46.6659862Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:46.6660028Z ) 2025-08-14T20:43:46.6660206Z enabled = True 2025-08-14T20:43:46.6660214Z 2025-08-14T20:43:46.6660379Z if enabled: 2025-08-14T20:43:46.6660568Z label = experiment_name 2025-08-14T20:43:46.6660792Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:46.6661231Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:46.6661504Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:46.6661822Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:46.6662004Z if is_canary: 2025-08-14T20:43:46.6662206Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:46.6662395Z fleet_prefix = label 2025-08-14T20:43:46.6662556Z else: 2025-08-14T20:43:46.6662754Z prefixes.append(label) 2025-08-14T20:43:46.6662761Z 2025-08-14T20:43:46.6662946Z if len(prefixes) > 1: 2025-08-14T20:43:46.6663112Z log.error( 2025-08-14T20:43:46.6663929Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:46.6664098Z ) 2025-08-14T20:43:46.6664289Z prefixes = prefixes[:1] 2025-08-14T20:43:46.6664297Z 2025-08-14T20:43:46.6664490Z # Fleet always comes first 2025-08-14T20:43:46.6664662Z if fleet_prefix: 2025-08-14T20:43:46.6664870Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:46.6664879Z 2025-08-14T20:43:46.6665259Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:46.6665269Z 2025-08-14T20:43:46.6665276Z 2025-08-14T20:43:46.6665729Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:46.6665933Z """ 2025-08-14T20:43:46.6666326Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:46.6666334Z 2025-08-14T20:43:46.6666719Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:46.6666889Z """ 2025-08-14T20:43:46.6667085Z gh = get_gh_client(github_token) 2025-08-14T20:43:46.6667290Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:46.6667572Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:46.6667580Z 2025-08-14T20:43:46.6667587Z 2025-08-14T20:43:46.6667987Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:46.6668176Z for _ in range(num_retries): 2025-08-14T20:43:46.6668347Z try: 2025-08-14T20:43:46.6668565Z req = Request(url=url, headers=headers) 2025-08-14T20:43:46.6668958Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:46.6669149Z return json.loads(content) 2025-08-14T20:43:46.6669342Z except Exception as e: 2025-08-14T20:43:46.6669582Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:46.6669589Z 2025-08-14T20:43:46.6669970Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:46.6670140Z return {} 2025-08-14T20:43:46.6670148Z 2025-08-14T20:43:46.6670155Z 2025-08-14T20:43:46.6670311Z @cache 2025-08-14T20:43:46.6670738Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:46.6670903Z """ 2025-08-14T20:43:46.6671101Z Dynamically get PR information 2025-08-14T20:43:46.6671259Z """ 2025-08-14T20:43:46.6671558Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:46.6671858Z headers = { 2025-08-14T20:43:46.6672093Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:46.6672310Z "Authorization": f"token {github_token}", 2025-08-14T20:43:46.6672640Z } 2025-08-14T20:43:46.6673059Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:46.6673297Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:46.6673916Z headers=headers, 2025-08-14T20:43:46.6674389Z ) 2025-08-14T20:43:46.6674627Z 2025-08-14T20:43:46.6674866Z if not json_response: 2025-08-14T20:43:46.6675577Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:46.6676203Z return {} 2025-08-14T20:43:46.6676437Z 2025-08-14T20:43:46.6676623Z return json_response 2025-08-14T20:43:46.6676897Z 2025-08-14T20:43:46.6676904Z 2025-08-14T20:43:46.6677315Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:46.6678073Z """ 2025-08-14T20:43:46.6678596Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:46.6679380Z """ 2025-08-14T20:43:46.6679870Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:46.6680495Z return { 2025-08-14T20:43:46.6681069Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:46.6681777Z } 2025-08-14T20:43:46.6681972Z 2025-08-14T20:43:46.6681979Z 2025-08-14T20:43:46.6682158Z def main() -> None: 2025-08-14T20:43:46.6682572Z args = parse_args() 2025-08-14T20:43:46.6682838Z 2025-08-14T20:43:46.6683067Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:46.6683496Z 2025-08-14T20:43:46.6683800Z # Check if the PR is opt-out 2025-08-14T20:43:46.6684371Z if args.pr_number: 2025-08-14T20:43:46.6685028Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:46.6685957Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:46.6686497Z log.info( 2025-08-14T20:43:46.6687188Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:46.6687957Z ) 2025-08-14T20:43:46.6688608Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.6689541Z sys.exit() 2025-08-14T20:43:46.6689802Z 2025-08-14T20:43:46.6689969Z try: 2025-08-14T20:43:46.6690407Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:46.6691110Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:46.6691749Z ) 2025-08-14T20:43:46.6691954Z 2025-08-14T20:43:46.6692166Z username = get_potential_pr_author( 2025-08-14T20:43:46.6692699Z args.github_token, 2025-08-14T20:43:46.6693187Z args.github_repo, 2025-08-14T20:43:46.6693661Z args.github_actor, 2025-08-14T20:43:46.6694155Z args.github_ref_type, 2025-08-14T20:43:46.6694676Z args.github_branch, 2025-08-14T20:43:46.6695136Z ) 2025-08-14T20:43:46.6695341Z 2025-08-14T20:43:46.6695627Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:46.6696218Z 2025-08-14T20:43:46.6696548Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:46.6697271Z rollout_state, 2025-08-14T20:43:46.6697757Z (args.github_issue_owner, username), 2025-08-14T20:43:46.6698307Z args.github_branch, 2025-08-14T20:43:46.6698914Z args.eligible_experiments, 2025-08-14T20:43:46.6699464Z args.opt_out_experiments, 2025-08-14T20:43:46.6699960Z is_canary, 2025-08-14T20:43:46.6700380Z ) 2025-08-14T20:43:46.6700584Z 2025-08-14T20:43:46.6700773Z except Exception as e: 2025-08-14T20:43:46.6701213Z log.error( 2025-08-14T20:43:46.6701886Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:46.6702824Z ) 2025-08-14T20:43:46.6703030Z 2025-08-14T20:43:46.6703355Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:46.6703845Z 2025-08-14T20:43:46.6703852Z 2025-08-14T20:43:46.6704030Z if __name__ == "__main__": 2025-08-14T20:43:46.6704475Z main() 2025-08-14T20:43:46.6704681Z 2025-08-14T20:43:46.6794417Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:46.6795331Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:46.6832699Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:46.6833185Z env: 2025-08-14T20:43:46.6833777Z GITHUB_TOKEN: *** 2025-08-14T20:43:46.6834205Z ISSUE_NUMBER: 5132 2025-08-14T20:43:46.6834647Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:46.6835143Z ISSUE_OWNER: 2025-08-14T20:43:46.6835542Z CHECK_EXPERIMENTS: 2025-08-14T20:43:46.6835975Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:46.6836395Z PR_NUMBER: 2025-08-14T20:43:46.6836773Z ##[endgroup] 2025-08-14T20:43:48.2255421Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.4164838Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.4802942Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.5034097Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-08-14T20:43:49.5449715Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.5534370Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.6016094Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:49.6096380Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:49.6142488Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:49.6159155Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:49.6174160Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:49.6481143Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:49.6554575Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:49.6786989Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:49.7974699Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.8064650Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:49.9202416Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:49.9314609Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:49.9549780Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.9620398Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:49.9906978Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.0013250Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 15.1 MB/s eta 0:00:00 2025-08-14T20:43:50.0096794Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.0207716Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 37.1 MB/s eta 0:00:00 2025-08-14T20:43:50.0280819Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.0383496Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 97.4 MB/s eta 0:00:00 2025-08-14T20:43:50.0459687Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.0553297Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.0617574Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 103.9 MB/s eta 0:00:00 2025-08-14T20:43:50.0695754Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:50.0735522Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.1 MB/s eta 0:00:00 2025-08-14T20:43:50.0805111Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:50.0845471Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 43.2 MB/s eta 0:00:00 2025-08-14T20:43:50.4099239Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:50.9316526Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:51.0050847Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.0051161Z curr_branch="main" 2025-08-14T20:43:51.0051385Z curr_ref_type="branch" 2025-08-14T20:43:51.0051630Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.0051912Z  2025-08-14T20:43:51.0052096Z python3 runner_determinator.py \ 2025-08-14T20:43:51.0052378Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.0052645Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.0052895Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.0053159Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.0053434Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.0053709Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.0053971Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.0054269Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.0054622Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.0054909Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.0096594Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.0096833Z env: 2025-08-14T20:43:51.0097393Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.0097588Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.0097800Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.0098028Z ISSUE_OWNER: 2025-08-14T20:43:51.0098210Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.0098406Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:51.0098592Z PR_NUMBER: 2025-08-14T20:43:51.0098963Z ##[endgroup] 2025-08-14T20:43:51.0156418Z Current branch is 'main' 2025-08-14T20:43:52.6047112Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.6048311Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.6049406Z INFO : Setting output: label-type='' 2025-08-14T20:43:52.6344619Z Evaluate and set job outputs 2025-08-14T20:43:52.6351534Z Cleaning up orphan processes