2025-12-04T08:40:43.0909499Z Current runner version: '2.329.0' 2025-12-04T08:40:43.0939014Z ##[group]Runner Image Provisioner 2025-12-04T08:40:43.0939839Z Hosted Compute Agent 2025-12-04T08:40:43.0940416Z Version: 20251124.448 2025-12-04T08:40:43.0941047Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:40:43.0941703Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:40:43.0942333Z ##[endgroup] 2025-12-04T08:40:43.0942849Z ##[group]Operating System 2025-12-04T08:40:43.0943453Z Ubuntu 2025-12-04T08:40:43.0943964Z 24.04.3 2025-12-04T08:40:43.0944412Z LTS 2025-12-04T08:40:43.0944861Z ##[endgroup] 2025-12-04T08:40:43.0945302Z ##[group]Runner Image 2025-12-04T08:40:43.0946205Z Image: ubuntu-24.04 2025-12-04T08:40:43.0946690Z Version: 20251126.144.1 2025-12-04T08:40:43.0947697Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:40:43.0949311Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:40:43.0950329Z ##[endgroup] 2025-12-04T08:40:43.0951319Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:40:43.0953362Z Contents: read 2025-12-04T08:40:43.0953992Z Metadata: read 2025-12-04T08:40:43.0954456Z ##[endgroup] 2025-12-04T08:40:43.0956864Z Secret source: Actions 2025-12-04T08:40:43.0957668Z Prepare workflow directory 2025-12-04T08:40:43.1471485Z Prepare all required actions 2025-12-04T08:40:43.1525950Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:40:43.1530737Z ##[group] Inputs 2025-12-04T08:40:43.1531439Z check_experiments: 2025-12-04T08:40:43.1531969Z opt_out_experiments: lf 2025-12-04T08:40:43.1532562Z triggering_actor: pytorchmergebot 2025-12-04T08:40:43.1533266Z issue_owner: 2025-12-04T08:40:43.1533737Z curr_branch: main 2025-12-04T08:40:43.1534257Z curr_ref_type: branch 2025-12-04T08:40:43.1534909Z issue_number: 5132 2025-12-04T08:40:43.1535461Z ##[endgroup] 2025-12-04T08:40:43.1536507Z Complete job name: get-label-type / runner-determinator 2025-12-04T08:40:43.8570379Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:40:43.8572884Z cat < runner_determinator.py 2025-12-04T08:40:43.8573556Z # flake8: noqa: G004 2025-12-04T08:40:43.8574226Z  2025-12-04T08:40:43.8575004Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:40:43.8576286Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:40:43.8577372Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:40:43.8578106Z  2025-12-04T08:40:43.8578595Z """ 2025-12-04T08:40:43.8579388Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:40:43.8580459Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:40:43.8581719Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:40:43.8582722Z of which runners should be used to run which job. 2025-12-04T08:40:43.8583448Z  2025-12-04T08:40:43.8584236Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:40:43.8585406Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:40:43.8586789Z settings are considered to be empty with only the second part, the user 2025-12-04T08:40:43.8587737Z list, defined. 2025-12-04T08:40:43.8588273Z  2025-12-04T08:40:43.8588991Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:40:43.8590137Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:40:43.8591157Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:40:43.8591912Z  2025-12-04T08:40:43.8592873Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:40:43.8594025Z The user list is also a comma separated list of additional features or 2025-12-04T08:40:43.8594970Z experiments which the user could be opted in to. 2025-12-04T08:40:43.8595637Z  2025-12-04T08:40:43.8596375Z The user list has the following rules: 2025-12-04T08:40:43.8597014Z  2025-12-04T08:40:43.8597751Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:40:43.8598838Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:40:43.8599789Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:40:43.8600486Z  2025-12-04T08:40:43.8601037Z Example config: 2025-12-04T08:40:43.8601706Z  # A list of experiments that can be opted into. 2025-12-04T08:40:43.8602562Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:40:43.8603427Z  # Expected syntax is: 2025-12-04T08:40:43.8604236Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:40:43.8605392Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:40:43.8606771Z  2025-12-04T08:40:43.8607255Z  experiments: 2025-12-04T08:40:43.8607857Z  lf: 2025-12-04T08:40:43.8608416Z  rollout_percent: 25 2025-12-04T08:40:43.8609076Z  all_branches: false 2025-12-04T08:40:43.8609708Z  default: true 2025-12-04T08:40:43.8610291Z  --- 2025-12-04T08:40:43.8610815Z  2025-12-04T08:40:43.8611301Z  # Opt-ins: 2025-12-04T08:40:43.8612124Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:40:43.8613362Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:40:43.8614361Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:40:43.8615254Z  # Experiments should be from the above list. 2025-12-04T08:40:43.8616145Z  2025-12-04T08:40:43.8616706Z  @User1,-lf,split_build 2025-12-04T08:40:43.8617290Z  @User2,lf 2025-12-04T08:40:43.8617936Z  @User3,split_build 2025-12-04T08:40:43.8618506Z """ 2025-12-04T08:40:43.8618982Z  2025-12-04T08:40:43.8696162Z import json 2025-12-04T08:40:43.8696686Z import logging 2025-12-04T08:40:43.8697157Z import os 2025-12-04T08:40:43.8697636Z import random 2025-12-04T08:40:43.8698097Z import re 2025-12-04T08:40:43.8698527Z import sys 2025-12-04T08:40:43.8699023Z from argparse import ArgumentParser 2025-12-04T08:40:43.8699724Z from collections.abc import Iterable 2025-12-04T08:40:43.8700376Z from functools import cache 2025-12-04T08:40:43.8700925Z from logging import LogRecord 2025-12-04T08:40:43.8701501Z from typing import Any, NamedTuple 2025-12-04T08:40:43.8702136Z from urllib.request import Request, urlopen 2025-12-04T08:40:43.8702753Z  2025-12-04T08:40:43.8703151Z import yaml 2025-12-04T08:40:43.8703635Z from github import Auth, Github 2025-12-04T08:40:43.8704202Z from github.Issue import Issue 2025-12-04T08:40:43.8704736Z  2025-12-04T08:40:43.8705115Z  2025-12-04T08:40:43.8705587Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:40:43.8706484Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:40:43.8707473Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:40:43.8708239Z  2025-12-04T08:40:43.8708999Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:40:43.8709659Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:40:43.8710262Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:40:43.8710922Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:40:43.8711503Z  2025-12-04T08:40:43.8711945Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:40:43.8712497Z  2025-12-04T08:40:43.8712908Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:40:43.8713464Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:40:43.8713977Z  2025-12-04T08:40:43.8714354Z  2025-12-04T08:40:43.8714772Z class Experiment(NamedTuple): 2025-12-04T08:40:43.8715342Z  rollout_perc: float = ( 2025-12-04T08:40:43.8716243Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:40:43.8716997Z  ) 2025-12-04T08:40:43.8717422Z  all_branches: bool = ( 2025-12-04T08:40:43.8718164Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:40:43.8718896Z  ) 2025-12-04T08:40:43.8719315Z  default: bool = ( 2025-12-04T08:40:43.8719989Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:40:43.8720696Z  ) 2025-12-04T08:40:43.8721099Z  2025-12-04T08:40:43.8721516Z  # Add more fields as needed 2025-12-04T08:40:43.8722036Z  2025-12-04T08:40:43.8722416Z  2025-12-04T08:40:43.8722840Z class Settings(NamedTuple): 2025-12-04T08:40:43.8723366Z  """ 2025-12-04T08:40:43.8723912Z  Settings for the experiments that can be opted into. 2025-12-04T08:40:43.8724550Z  """ 2025-12-04T08:40:43.8724953Z  2025-12-04T08:40:43.8725402Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:40:43.8726339Z  2025-12-04T08:40:43.8726999Z  2025-12-04T08:40:43.8727509Z class ColorFormatter(logging.Formatter): 2025-12-04T08:40:43.8728237Z  """Color codes the log messages based on the log level""" 2025-12-04T08:40:43.8728885Z  2025-12-04T08:40:43.8729280Z  COLORS = { 2025-12-04T08:40:43.8729764Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:40:43.8730343Z  "ERROR": "\033[31m", # Red 2025-12-04T08:40:43.8730914Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:40:43.8731488Z  "INFO": "\033[0m", # Reset 2025-12-04T08:40:43.8732084Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:40:43.8732623Z  } 2025-12-04T08:40:43.8733020Z  2025-12-04T08:40:43.8733486Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:40:43.8734311Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:40:43.8735165Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:40:43.8735954Z  return super().format(record) 2025-12-04T08:40:43.8736507Z  2025-12-04T08:40:43.8736898Z  2025-12-04T08:40:43.8737332Z handler = logging.StreamHandler() 2025-12-04T08:40:43.8738155Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:40:43.8738934Z  2025-12-04T08:40:43.8739446Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:40:43.8740114Z log.addHandler(handler) 2025-12-04T08:40:43.8740646Z log.setLevel(logging.INFO) 2025-12-04T08:40:43.8741156Z  2025-12-04T08:40:43.8741532Z  2025-12-04T08:40:43.8742043Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:40:43.8742674Z  """ 2025-12-04T08:40:43.8743259Z  Defines outputs of the github action that invokes this script 2025-12-04T08:40:43.8744106Z  """ 2025-12-04T08:40:43.8744594Z  if not GITHUB_OUTPUT: 2025-12-04T08:40:43.8745897Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:40:43.8747140Z  log.warning( 2025-12-04T08:40:43.8748110Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:40:43.8749098Z  ) 2025-12-04T08:40:43.8749617Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:40:43.8750226Z  return 2025-12-04T08:40:43.8750670Z  2025-12-04T08:40:43.8751116Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:40:43.8751766Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:40:43.8752407Z  f.write(f"{key}={value}\n") 2025-12-04T08:40:43.8752947Z  2025-12-04T08:40:43.8753339Z  2025-12-04T08:40:43.8753909Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:40:43.8754638Z  return frozenset( 2025-12-04T08:40:43.8755358Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:40:43.8756221Z  ) 2025-12-04T08:40:43.8756644Z  2025-12-04T08:40:43.8757024Z  2025-12-04T08:40:43.8757439Z def parse_args() -> Any: 2025-12-04T08:40:43.8758112Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:40:43.8759066Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:40:43.8759907Z  parser.add_argument( 2025-12-04T08:40:43.8760453Z  "--github-issue-repo", 2025-12-04T08:40:43.8761002Z  type=str, 2025-12-04T08:40:43.8761493Z  required=False, 2025-12-04T08:40:43.8762172Z  default="pytorch/test-infra", 2025-12-04T08:40:43.8762801Z  help="GitHub repo to get the issue", 2025-12-04T08:40:43.8763368Z  ) 2025-12-04T08:40:43.8763807Z  parser.add_argument( 2025-12-04T08:40:43.8764347Z  "--github-repo", 2025-12-04T08:40:43.8764854Z  type=str, 2025-12-04T08:40:43.8765341Z  required=True, 2025-12-04T08:40:43.8766183Z  help="GitHub repo where CI is running", 2025-12-04T08:40:43.8766805Z  ) 2025-12-04T08:40:43.8767243Z  parser.add_argument( 2025-12-04T08:40:43.8767942Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:40:43.8768658Z  ) 2025-12-04T08:40:43.8769102Z  parser.add_argument( 2025-12-04T08:40:43.8769827Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:40:43.8770584Z  ) 2025-12-04T08:40:43.8771013Z  parser.add_argument( 2025-12-04T08:40:43.8771763Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:40:43.8772527Z  ) 2025-12-04T08:40:43.8772955Z  parser.add_argument( 2025-12-04T08:40:43.8773733Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:40:43.8774506Z  ) 2025-12-04T08:40:43.8774964Z  parser.add_argument( 2025-12-04T08:40:43.8775501Z  "--github-ref-type", 2025-12-04T08:40:43.8776440Z  type=str, 2025-12-04T08:40:43.8776948Z  required=True, 2025-12-04T08:40:43.8777558Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:40:43.8778172Z  ) 2025-12-04T08:40:43.8778619Z  parser.add_argument( 2025-12-04T08:40:43.8779330Z  "--eligible-experiments", 2025-12-04T08:40:43.8779937Z  type=_str_comma_separated_to_set, 2025-12-04T08:40:43.8780515Z  required=False, 2025-12-04T08:40:43.8781025Z  default="", 2025-12-04T08:40:43.8781973Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:40:43.8782955Z  ) 2025-12-04T08:40:43.8783392Z  parser.add_argument( 2025-12-04T08:40:43.8783936Z  "--opt-out-experiments", 2025-12-04T08:40:43.8784542Z  type=_str_comma_separated_to_set, 2025-12-04T08:40:43.8785118Z  required=False, 2025-12-04T08:40:43.8785660Z  default="", 2025-12-04T08:40:43.8786259Z  help=( 2025-12-04T08:40:43.8787051Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:40:43.8788272Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:40:43.8789165Z  ), 2025-12-04T08:40:43.8789595Z  ) 2025-12-04T08:40:43.8790023Z  parser.add_argument( 2025-12-04T08:40:43.8790558Z  "--pr-number", 2025-12-04T08:40:43.8791061Z  type=str, 2025-12-04T08:40:43.8791551Z  required=False, 2025-12-04T08:40:43.8792056Z  default="", 2025-12-04T08:40:43.8792636Z  help="the optional PR number where this is run", 2025-12-04T08:40:43.8793247Z  ) 2025-12-04T08:40:43.8793660Z  2025-12-04T08:40:43.8794088Z  return parser.parse_args() 2025-12-04T08:40:43.8794620Z  2025-12-04T08:40:43.8794996Z  2025-12-04T08:40:43.8795658Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:40:43.8796763Z  auth = Auth.Token(github_token) 2025-12-04T08:40:43.8797372Z  return Github(auth=auth) 2025-12-04T08:40:43.8797895Z  2025-12-04T08:40:43.8798280Z  2025-12-04T08:40:43.8798997Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:40:43.8799874Z  repo = gh.get_repo(repo) 2025-12-04T08:40:43.8800471Z  return repo.get_issue(number=issue_num) 2025-12-04T08:40:43.8801060Z  2025-12-04T08:40:43.8801446Z  2025-12-04T08:40:43.8801866Z def get_potential_pr_author( 2025-12-04T08:40:43.8802614Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:40:43.8803351Z ) -> str: 2025-12-04T08:40:43.8803959Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:40:43.8804845Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:40:43.8805846Z  # embedded in the tag name: ciflow// 2025-12-04T08:40:43.8806616Z  2025-12-04T08:40:43.8807058Z  gh = get_gh_client(github_token) 2025-12-04T08:40:43.8807624Z  2025-12-04T08:40:43.8808149Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:40:43.8808861Z  split_tag = ref_name.split("/") 2025-12-04T08:40:43.8809428Z  if ( 2025-12-04T08:40:43.8809893Z  len(split_tag) == 3 2025-12-04T08:40:43.8810456Z  and split_tag[0] == "ciflow" 2025-12-04T08:40:43.8811065Z  and split_tag[2].isnumeric() 2025-12-04T08:40:43.8811612Z  ): 2025-12-04T08:40:43.8812077Z  pr_number = split_tag[2] 2025-12-04T08:40:43.8812627Z  try: 2025-12-04T08:40:43.8813141Z  repository = gh.get_repo(repo) 2025-12-04T08:40:43.8814000Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:40:43.8814681Z  except Exception as e: 2025-12-04T08:40:43.8815288Z  raise Exception( # noqa: TRY002 2025-12-04T08:40:43.8816171Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:40:43.8816901Z  ) from e 2025-12-04T08:40:43.8817542Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:40:43.8818325Z  # In all other cases, return the original input username 2025-12-04T08:40:43.8818982Z  return username 2025-12-04T08:40:43.8819454Z  2025-12-04T08:40:43.8819841Z  2025-12-04T08:40:43.8820328Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:40:43.8820928Z  """ 2025-12-04T08:40:43.8821656Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:40:43.8822505Z  """ 2025-12-04T08:40:43.8823127Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:40:43.8823849Z  2025-12-04T08:40:43.8824233Z  2025-12-04T08:40:43.8824667Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:40:43.8825226Z  try: 2025-12-04T08:40:43.8825786Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:40:43.8826360Z  return data 2025-12-04T08:40:43.8826867Z  except yaml.YAMLError: 2025-12-04T08:40:43.8827443Z  log.exception("Error loading YAML") 2025-12-04T08:40:43.8828025Z  raise 2025-12-04T08:40:43.8828464Z  2025-12-04T08:40:43.8828849Z  2025-12-04T08:40:43.8829515Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:40:43.8830331Z  """ 2025-12-04T08:40:43.8831165Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:40:43.8832013Z  2025-12-04T08:40:43.8832610Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:43.8833467Z  and the text below is the list of opted in users. 2025-12-04T08:40:43.8834120Z  2025-12-04T08:40:43.8834752Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:40:43.8835508Z  """ 2025-12-04T08:40:43.8836172Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:40:43.8836839Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:40:43.8837527Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:40:43.8838177Z  else: 2025-12-04T08:40:43.8838632Z  return "", rollout_state 2025-12-04T08:40:43.8839393Z  2025-12-04T08:40:43.8839781Z  2025-12-04T08:40:43.8840234Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:40:43.8840791Z  """ 2025-12-04T08:40:43.8841386Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:40:43.8842077Z  """ 2025-12-04T08:40:43.8842478Z  2025-12-04T08:40:43.8842850Z  2025-12-04T08:40:43.8843431Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:40:43.8844146Z  """ 2025-12-04T08:40:43.8844931Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:40:43.8846096Z  2025-12-04T08:40:43.8846996Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:40:43.8848069Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:40:43.8848979Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:40:43.8849671Z  2025-12-04T08:40:43.8850038Z  2025-12-04T08:40:43.8850408Z  """ 2025-12-04T08:40:43.8850832Z  optins = UserOptins() 2025-12-04T08:40:43.8851409Z  for user in user_optin_text.split("\n"): 2025-12-04T08:40:43.8852035Z  user = user.strip("\r\n\t -") 2025-12-04T08:40:43.8852656Z  if not user or not user.startswith("@"): 2025-12-04T08:40:43.8853286Z  # Not a valid user. Skip 2025-12-04T08:40:43.8853834Z  continue 2025-12-04T08:40:43.8854299Z  2025-12-04T08:40:43.8854683Z  if user: 2025-12-04T08:40:43.8855239Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:40:43.8856619Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:40:43.8857328Z  2025-12-04T08:40:43.8857728Z  return optins 2025-12-04T08:40:43.8858190Z  2025-12-04T08:40:43.8858562Z  2025-12-04T08:40:43.8859110Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:40:43.8859774Z  """ 2025-12-04T08:40:43.8860250Z  Check if the experiment name is valid. 2025-12-04T08:40:43.8860833Z  A valid name: 2025-12-04T08:40:43.8861576Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:40:43.8862578Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:40:43.8863355Z  - Cannot contain spaces 2025-12-04T08:40:43.8863882Z  """ 2025-12-04T08:40:43.8864286Z  2025-12-04T08:40:43.8864796Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:40:43.8865576Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:40:43.8866504Z  2025-12-04T08:40:43.8866894Z  if valid: 2025-12-04T08:40:43.8867495Z  return True 2025-12-04T08:40:43.8868074Z  2025-12-04T08:40:43.8868468Z  log.error( 2025-12-04T08:40:43.8870024Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:40:43.8871646Z  ) 2025-12-04T08:40:43.8872070Z  return False 2025-12-04T08:40:43.8872519Z  2025-12-04T08:40:43.8872897Z  2025-12-04T08:40:43.8873461Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:40:43.8874155Z  """ 2025-12-04T08:40:43.8874818Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:40:43.8875587Z  """ 2025-12-04T08:40:43.8876117Z  try: 2025-12-04T08:40:43.8876544Z  if settings_text: 2025-12-04T08:40:43.8877364Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:40:43.8878218Z  # for easy reading 2025-12-04T08:40:43.8879108Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:40:43.8880066Z  # the backtick character in shell commands. 2025-12-04T08:40:43.8880741Z  backtick = chr(96) # backtick character 2025-12-04T08:40:43.8881502Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:40:43.8882244Z  settings = load_yaml(settings_text) 2025-12-04T08:40:43.8882811Z  2025-12-04T08:40:43.8883481Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:40:43.8884426Z  experiments = {} 2025-12-04T08:40:43.8884945Z  2025-12-04T08:40:43.8885553Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:40:43.8886497Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:40:43.8887679Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:40:43.8888791Z  continue 2025-12-04T08:40:43.8889293Z  2025-12-04T08:40:43.8889711Z  valid_settings = {} 2025-12-04T08:40:43.8890301Z  for setting in exp_settings: 2025-12-04T08:40:43.8890929Z  if setting not in Experiment._fields: 2025-12-04T08:40:43.8891560Z  log.warning( 2025-12-04T08:40:43.8892355Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:40:43.8893117Z  ) 2025-12-04T08:40:43.8893625Z  else: 2025-12-04T08:40:43.8894224Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:40:43.8894851Z  2025-12-04T08:40:43.8895362Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:40:43.8896169Z  return Settings(experiments) 2025-12-04T08:40:43.8896731Z  2025-12-04T08:40:43.8897123Z  except Exception: 2025-12-04T08:40:43.8897699Z  log.exception("Failed to parse settings") 2025-12-04T08:40:43.8898306Z  2025-12-04T08:40:43.8898704Z  return Settings() 2025-12-04T08:40:43.8899178Z  2025-12-04T08:40:43.8899548Z  2025-12-04T08:40:43.8900164Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:40:43.8900806Z  """ 2025-12-04T08:40:43.8901316Z  Parse settings, if any, from the rollout state. 2025-12-04T08:40:43.8901908Z  2025-12-04T08:40:43.8902511Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:43.8903335Z  and the text below is the list of opted in users. 2025-12-04T08:40:43.8903940Z  2025-12-04T08:40:43.8904587Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:40:43.8905362Z  """ 2025-12-04T08:40:43.8906094Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:43.8906930Z  return parse_settings_from_text(settings_text) 2025-12-04T08:40:43.8907531Z  2025-12-04T08:40:43.8907896Z  2025-12-04T08:40:43.8908403Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:40:43.8909019Z  """ 2025-12-04T08:40:43.8909487Z  Parse users from the rollout state. 2025-12-04T08:40:43.8910044Z  2025-12-04T08:40:43.8910420Z  """ 2025-12-04T08:40:43.8911031Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:43.8911841Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:40:43.8912442Z  2025-12-04T08:40:43.8912813Z  2025-12-04T08:40:43.8913485Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:43.8914291Z  """ 2025-12-04T08:40:43.8914781Z  Check if a user is opted into an experiment 2025-12-04T08:40:43.8915366Z  """ 2025-12-04T08:40:43.8915996Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:40:43.8916636Z  2025-12-04T08:40:43.8917172Z  2025-12-04T08:40:43.8917856Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:43.8918669Z  """ 2025-12-04T08:40:43.8919198Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:40:43.8919821Z  """ 2025-12-04T08:40:43.8920393Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:40:43.8921153Z  experiment_optout = "-" + experiment_name 2025-12-04T08:40:43.8921862Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:40:43.8922523Z  return False 2025-12-04T08:40:43.8922983Z  2025-12-04T08:40:43.8923498Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:40:43.8924166Z  log.warning( 2025-12-04T08:40:43.8925082Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:40:43.8926122Z  ) 2025-12-04T08:40:43.8926540Z  2025-12-04T08:40:43.8926941Z  return True 2025-12-04T08:40:43.8927396Z  2025-12-04T08:40:43.8927773Z  2025-12-04T08:40:43.8928169Z def get_runner_prefix( 2025-12-04T08:40:43.8928683Z  rollout_state: str, 2025-12-04T08:40:43.8929247Z  workflow_requestors: Iterable[str], 2025-12-04T08:40:43.8929811Z  branch: str, 2025-12-04T08:40:43.8930395Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:43.8931140Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:43.8931789Z  is_canary: bool = False, 2025-12-04T08:40:43.8932334Z ) -> str: 2025-12-04T08:40:43.8932840Z  settings = parse_settings(rollout_state) 2025-12-04T08:40:43.8933495Z  user_optins = parse_users(rollout_state) 2025-12-04T08:40:43.8934070Z  2025-12-04T08:40:43.8934597Z  fleet_prefix = "" 2025-12-04T08:40:43.8935103Z  prefixes = [] 2025-12-04T08:40:43.8935927Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:40:43.8936946Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:40:43.8937718Z  log.info( 2025-12-04T08:40:43.8938487Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:40:43.8939289Z  ) 2025-12-04T08:40:43.8939760Z  continue 2025-12-04T08:40:43.8940215Z  2025-12-04T08:40:43.8940632Z  if opt_out_experiments: 2025-12-04T08:40:43.8941251Z  if experiment_name in opt_out_experiments: 2025-12-04T08:40:43.8941992Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:40:43.8942661Z  log.info( 2025-12-04T08:40:43.8943674Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:40:43.8944715Z  ) 2025-12-04T08:40:43.8945187Z  continue 2025-12-04T08:40:43.8945805Z  2025-12-04T08:40:43.8946224Z  if eligible_experiments: 2025-12-04T08:40:43.8946860Z  if experiment_name not in eligible_experiments: 2025-12-04T08:40:43.8947556Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:40:43.8948160Z  log.info( 2025-12-04T08:40:43.8949028Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:40:43.8949913Z  ) 2025-12-04T08:40:43.8950380Z  continue 2025-12-04T08:40:43.8951085Z  elif not experiment_settings.default: 2025-12-04T08:40:43.8951677Z  log.info( 2025-12-04T08:40:43.8952422Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:40:43.8953208Z  ) 2025-12-04T08:40:43.8953658Z  continue 2025-12-04T08:40:43.8954117Z  2025-12-04T08:40:43.8954636Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:40:43.8955309Z  opted_out_users = [ 2025-12-04T08:40:43.8955942Z  requestor 2025-12-04T08:40:43.8956489Z  for requestor in workflow_requestors 2025-12-04T08:40:43.8957232Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:40:43.8957914Z  ] 2025-12-04T08:40:43.8958322Z  2025-12-04T08:40:43.8958729Z  if opted_out_users: 2025-12-04T08:40:43.8959267Z  log.info( 2025-12-04T08:40:43.8959980Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:40:43.8960734Z  ) 2025-12-04T08:40:43.8961181Z  continue 2025-12-04T08:40:43.8961646Z  2025-12-04T08:40:43.8962161Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:40:43.8962834Z  opted_in_users = [ 2025-12-04T08:40:43.8963366Z  requestor 2025-12-04T08:40:43.8963917Z  for requestor in workflow_requestors 2025-12-04T08:40:43.8964662Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:40:43.8965334Z  ] 2025-12-04T08:40:43.8965847Z  2025-12-04T08:40:43.8966244Z  enabled = False 2025-12-04T08:40:43.8966764Z  if opted_in_users: 2025-12-04T08:40:43.8967406Z  log.info( 2025-12-04T08:40:43.8968108Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:40:43.8968842Z  ) 2025-12-04T08:40:43.8969306Z  enabled = True 2025-12-04T08:40:43.8969803Z  2025-12-04T08:40:43.8970262Z  elif experiment_settings.rollout_perc: 2025-12-04T08:40:43.8971169Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:40:43.8972182Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:40:43.8972894Z  log.info( 2025-12-04T08:40:43.8973851Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:40:43.8974817Z  ) 2025-12-04T08:40:43.8975313Z  enabled = True 2025-12-04T08:40:43.8975929Z  2025-12-04T08:40:43.8976330Z  if enabled: 2025-12-04T08:40:43.8976839Z  label = experiment_name 2025-12-04T08:40:43.8977461Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:40:43.8978355Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:40:43.8979289Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:40:43.8980126Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:40:43.8980839Z  if is_canary: 2025-12-04T08:40:43.8981412Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:40:43.8982019Z  fleet_prefix = label 2025-12-04T08:40:43.8982578Z  else: 2025-12-04T08:40:43.8983221Z  prefixes.append(label) 2025-12-04T08:40:43.8983766Z  2025-12-04T08:40:43.8984165Z  if len(prefixes) > 1: 2025-12-04T08:40:43.8984676Z  log.error( 2025-12-04T08:40:43.8985909Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:40:43.8987089Z  ) 2025-12-04T08:40:43.8987540Z  prefixes = prefixes[:1] 2025-12-04T08:40:43.8988072Z  2025-12-04T08:40:43.8988478Z  # Fleet always comes first 2025-12-04T08:40:43.8989024Z  if fleet_prefix: 2025-12-04T08:40:43.8989548Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:40:43.8990102Z  2025-12-04T08:40:43.8990594Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:40:43.8991236Z  2025-12-04T08:40:43.8991634Z  2025-12-04T08:40:43.8992320Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:40:43.8993151Z  """ 2025-12-04T08:40:43.8993798Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:40:43.8994555Z  2025-12-04T08:40:43.8995181Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:40:43.8996031Z  """ 2025-12-04T08:40:43.8996494Z  gh = get_gh_client(github_token) 2025-12-04T08:40:43.8997112Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:40:43.8997819Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:40:43.8998468Z  2025-12-04T08:40:43.8998845Z  2025-12-04T08:40:43.8999497Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:40:43.9000447Z  for _ in range(num_retries): 2025-12-04T08:40:43.9000988Z  try: 2025-12-04T08:40:43.9001487Z  req = Request(url=url, headers=headers) 2025-12-04T08:40:43.9002223Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:40:43.9002928Z  return json.loads(content) 2025-12-04T08:40:43.9003515Z  except Exception as e: 2025-12-04T08:40:43.9004134Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:40:43.9004734Z  2025-12-04T08:40:43.9005369Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:40:43.9006241Z  return {} 2025-12-04T08:40:43.9006685Z  2025-12-04T08:40:43.9007062Z  2025-12-04T08:40:43.9007443Z @cache 2025-12-04T08:40:43.9008140Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:40:43.9008956Z  """ 2025-12-04T08:40:43.9009412Z  Dynamically get PR information 2025-12-04T08:40:43.9009956Z  """ 2025-12-04T08:40:43.9010530Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:40:43.9011208Z  headers = { 2025-12-04T08:40:43.9011750Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:40:43.9012422Z  "Authorization": f"token {github_token}", 2025-12-04T08:40:43.9013008Z  } 2025-12-04T08:40:43.9013496Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:40:43.9014164Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:40:43.9014759Z  headers=headers, 2025-12-04T08:40:43.9015254Z  ) 2025-12-04T08:40:43.9015653Z  2025-12-04T08:40:43.9016151Z  if not json_response: 2025-12-04T08:40:43.9016813Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:40:43.9017627Z  return {} 2025-12-04T08:40:43.9018093Z  2025-12-04T08:40:43.9018495Z  return json_response 2025-12-04T08:40:43.9018999Z  2025-12-04T08:40:43.9019369Z  2025-12-04T08:40:43.9020018Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:40:43.9020799Z  """ 2025-12-04T08:40:43.9021390Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:40:43.9022091Z  """ 2025-12-04T08:40:43.9022643Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:40:43.9023307Z  return { 2025-12-04T08:40:43.9023959Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:40:43.9024699Z  } 2025-12-04T08:40:43.9025102Z  2025-12-04T08:40:43.9025504Z  2025-12-04T08:40:43.9026009Z def main() -> None: 2025-12-04T08:40:43.9026501Z  args = parse_args() 2025-12-04T08:40:43.9026988Z  2025-12-04T08:40:43.9027455Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:40:43.9028043Z  2025-12-04T08:40:43.9028471Z  # Check if the PR is opt-out 2025-12-04T08:40:43.9029024Z  if args.pr_number: 2025-12-04T08:40:43.9029769Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:40:43.9030582Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:40:43.9031141Z  log.info( 2025-12-04T08:40:43.9031947Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:40:43.9032768Z  ) 2025-12-04T08:40:43.9033398Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:43.9034140Z  sys.exit() 2025-12-04T08:40:43.9034745Z  2025-12-04T08:40:43.9035136Z  try: 2025-12-04T08:40:43.9035645Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:40:43.9036524Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:40:43.9037218Z  ) 2025-12-04T08:40:43.9037630Z  2025-12-04T08:40:43.9038074Z  username = get_potential_pr_author( 2025-12-04T08:40:43.9038688Z  args.github_token, 2025-12-04T08:40:43.9039238Z  args.github_repo, 2025-12-04T08:40:43.9039793Z  args.github_actor, 2025-12-04T08:40:43.9040351Z  args.github_ref_type, 2025-12-04T08:40:43.9040923Z  args.github_branch, 2025-12-04T08:40:43.9041438Z  ) 2025-12-04T08:40:43.9041863Z  2025-12-04T08:40:43.9042394Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:40:43.9043052Z  2025-12-04T08:40:43.9043513Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:40:43.9044111Z  rollout_state, 2025-12-04T08:40:43.9044683Z  (args.github_issue_owner, username), 2025-12-04T08:40:43.9045281Z  args.github_branch, 2025-12-04T08:40:43.9045954Z  args.eligible_experiments, 2025-12-04T08:40:43.9046547Z  args.opt_out_experiments, 2025-12-04T08:40:43.9047100Z  is_canary, 2025-12-04T08:40:43.9047573Z  ) 2025-12-04T08:40:43.9047982Z  2025-12-04T08:40:43.9048384Z  except Exception as e: 2025-12-04T08:40:43.9048904Z  log.error( 2025-12-04T08:40:43.9049668Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:40:43.9050480Z  ) 2025-12-04T08:40:43.9051028Z  2025-12-04T08:40:43.9051617Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:43.9052332Z  2025-12-04T08:40:43.9052714Z  2025-12-04T08:40:43.9053110Z if __name__ == "__main__": 2025-12-04T08:40:43.9053627Z  main() 2025-12-04T08:40:43.9054050Z  2025-12-04T08:40:43.9054438Z EOF 2025-12-04T08:40:43.9054825Z  2025-12-04T08:40:43.9055236Z cat runner_determinator.py 2025-12-04T08:40:43.9702420Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:43.9703378Z env: 2025-12-04T08:40:43.9704211Z GITHUB_TOKEN: *** 2025-12-04T08:40:43.9704688Z ISSUE_NUMBER: 5132 2025-12-04T08:40:43.9705195Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:43.9705945Z ISSUE_OWNER: 2025-12-04T08:40:43.9706413Z CHECK_EXPERIMENTS: 2025-12-04T08:40:43.9706911Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:40:43.9707427Z PR_NUMBER: 2025-12-04T08:40:43.9707889Z ##[endgroup] 2025-12-04T08:40:43.9917378Z # flake8: noqa: G004 2025-12-04T08:40:43.9917745Z 2025-12-04T08:40:43.9918183Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:40:43.9919152Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:40:43.9919964Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:40:43.9920459Z 2025-12-04T08:40:43.9920625Z """ 2025-12-04T08:40:43.9921220Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:40:43.9922105Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:40:43.9923025Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:40:43.9923844Z of which runners should be used to run which job. 2025-12-04T08:40:43.9924250Z 2025-12-04T08:40:43.9924636Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:40:43.9925958Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:40:43.9926909Z settings are considered to be empty with only the second part, the user 2025-12-04T08:40:43.9927618Z list, defined. 2025-12-04T08:40:43.9927854Z 2025-12-04T08:40:43.9928225Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:40:43.9929160Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:40:43.9929988Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:40:43.9930439Z 2025-12-04T08:40:43.9930812Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:40:43.9931679Z The user list is also a comma separated list of additional features or 2025-12-04T08:40:43.9932417Z experiments which the user could be opted in to. 2025-12-04T08:40:43.9932814Z 2025-12-04T08:40:43.9933019Z The user list has the following rules: 2025-12-04T08:40:43.9933370Z 2025-12-04T08:40:43.9933691Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:40:43.9934571Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:40:43.9935334Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:40:43.9935944Z 2025-12-04T08:40:43.9936160Z Example config: 2025-12-04T08:40:43.9936633Z # A list of experiments that can be opted into. 2025-12-04T08:40:43.9937294Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:40:43.9937923Z # Expected syntax is: 2025-12-04T08:40:43.9938560Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:40:43.9939544Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:40:43.9940151Z 2025-12-04T08:40:43.9940331Z experiments: 2025-12-04T08:40:43.9940725Z lf: 2025-12-04T08:40:43.9941111Z rollout_percent: 25 2025-12-04T08:40:43.9941743Z all_branches: false 2025-12-04T08:40:43.9942199Z default: true 2025-12-04T08:40:43.9942612Z --- 2025-12-04T08:40:43.9942831Z 2025-12-04T08:40:43.9943001Z # Opt-ins: 2025-12-04T08:40:43.9943578Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:40:43.9944462Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:40:43.9945265Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:40:43.9946051Z # Experiments should be from the above list. 2025-12-04T08:40:43.9946433Z 2025-12-04T08:40:43.9946626Z @User1,-lf,split_build 2025-12-04T08:40:43.9947070Z @User2,lf 2025-12-04T08:40:43.9947472Z @User3,split_build 2025-12-04T08:40:43.9947882Z """ 2025-12-04T08:40:43.9948084Z 2025-12-04T08:40:43.9948247Z import json 2025-12-04T08:40:43.9948623Z import logging 2025-12-04T08:40:43.9949016Z import os 2025-12-04T08:40:43.9949377Z import random 2025-12-04T08:40:43.9949771Z import re 2025-12-04T08:40:43.9950141Z import sys 2025-12-04T08:40:43.9950560Z from argparse import ArgumentParser 2025-12-04T08:40:43.9951105Z from collections.abc import Iterable 2025-12-04T08:40:43.9951628Z from functools import cache 2025-12-04T08:40:43.9952115Z from logging import LogRecord 2025-12-04T08:40:43.9952613Z from typing import Any, NamedTuple 2025-12-04T08:40:43.9953157Z from urllib.request import Request, urlopen 2025-12-04T08:40:43.9953524Z 2025-12-04T08:40:43.9953692Z import yaml 2025-12-04T08:40:43.9954098Z from github import Auth, Github 2025-12-04T08:40:43.9954589Z from github.Issue import Issue 2025-12-04T08:40:43.9954902Z 2025-12-04T08:40:43.9954910Z 2025-12-04T08:40:43.9955130Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:40:43.9956102Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:40:43.9957016Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:40:43.9957583Z 2025-12-04T08:40:43.9957813Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:40:43.9958543Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:40:43.9959074Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:40:43.9959628Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:40:43.9959983Z 2025-12-04T08:40:43.9960181Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:40:43.9960514Z 2025-12-04T08:40:43.9960712Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:40:43.9961174Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:40:43.9961454Z 2025-12-04T08:40:43.9961468Z 2025-12-04T08:40:43.9961657Z class Experiment(NamedTuple): 2025-12-04T08:40:43.9962145Z rollout_perc: float = ( 2025-12-04T08:40:43.9962790Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:40:43.9963476Z ) 2025-12-04T08:40:43.9963855Z all_branches: bool = ( 2025-12-04T08:40:43.9964492Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:40:43.9965168Z ) 2025-12-04T08:40:43.9965544Z default: bool = ( 2025-12-04T08:40:43.9966245Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:40:43.9966892Z ) 2025-12-04T08:40:43.9967089Z 2025-12-04T08:40:43.9967268Z # Add more fields as needed 2025-12-04T08:40:43.9967577Z 2025-12-04T08:40:43.9967584Z 2025-12-04T08:40:43.9967773Z class Settings(NamedTuple): 2025-12-04T08:40:43.9968220Z """ 2025-12-04T08:40:43.9968698Z Settings for the experiments that can be opted into. 2025-12-04T08:40:43.9969274Z """ 2025-12-04T08:40:43.9969474Z 2025-12-04T08:40:43.9969683Z experiments: dict[str, Experiment] = {} 2025-12-04T08:40:43.9970049Z 2025-12-04T08:40:43.9970062Z 2025-12-04T08:40:43.9970273Z class ColorFormatter(logging.Formatter): 2025-12-04T08:40:43.9970895Z """Color codes the log messages based on the log level""" 2025-12-04T08:40:43.9971332Z 2025-12-04T08:40:43.9971498Z COLORS = { 2025-12-04T08:40:43.9971902Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:40:43.9972550Z "ERROR": "\033[31m", # Red 2025-12-04T08:40:43.9973056Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:40:43.9973576Z "INFO": "\033[0m", # Reset 2025-12-04T08:40:43.9974075Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:40:43.9974542Z } 2025-12-04T08:40:43.9974752Z 2025-12-04T08:40:43.9974973Z def format(self, record: LogRecord) -> str: 2025-12-04T08:40:43.9975931Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:40:43.9976766Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:40:43.9977361Z return super().format(record) 2025-12-04T08:40:43.9977700Z 2025-12-04T08:40:43.9977707Z 2025-12-04T08:40:43.9977907Z handler = logging.StreamHandler() 2025-12-04T08:40:43.9978617Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:40:43.9979173Z 2025-12-04T08:40:43.9979440Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:40:43.9980035Z log.addHandler(handler) 2025-12-04T08:40:43.9980493Z log.setLevel(logging.INFO) 2025-12-04T08:40:43.9980789Z 2025-12-04T08:40:43.9980796Z 2025-12-04T08:40:43.9981046Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:40:43.9981611Z """ 2025-12-04T08:40:43.9982115Z Defines outputs of the github action that invokes this script 2025-12-04T08:40:43.9982755Z """ 2025-12-04T08:40:43.9983127Z if not GITHUB_OUTPUT: 2025-12-04T08:40:43.9984206Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:40:43.9985325Z log.warning( 2025-12-04T08:40:43.9986287Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:40:43.9987229Z ) 2025-12-04T08:40:43.9997820Z print(f"::set-output name={key}::{value}") 2025-12-04T08:40:43.9998436Z return 2025-12-04T08:40:43.9998672Z 2025-12-04T08:40:43.9999065Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:40:43.9999673Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:40:44.0000267Z f.write(f"{key}={value}\n") 2025-12-04T08:40:44.0000603Z 2025-12-04T08:40:44.0000610Z 2025-12-04T08:40:44.0000918Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:40:44.0001566Z return frozenset( 2025-12-04T08:40:44.0002181Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:40:44.0002871Z ) 2025-12-04T08:40:44.0003070Z 2025-12-04T08:40:44.0003077Z 2025-12-04T08:40:44.0003264Z def parse_args() -> Any: 2025-12-04T08:40:44.0003836Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:40:44.0004711Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:40:44.0005497Z parser.add_argument( 2025-12-04T08:40:44.0006148Z "--github-issue-repo", 2025-12-04T08:40:44.0006624Z type=str, 2025-12-04T08:40:44.0007037Z required=False, 2025-12-04T08:40:44.0007709Z default="pytorch/test-infra", 2025-12-04T08:40:44.0008266Z help="GitHub repo to get the issue", 2025-12-04T08:40:44.0008776Z ) 2025-12-04T08:40:44.0009157Z parser.add_argument( 2025-12-04T08:40:44.0009620Z "--github-repo", 2025-12-04T08:40:44.0010076Z type=str, 2025-12-04T08:40:44.0010491Z required=True, 2025-12-04T08:40:44.0010959Z help="GitHub repo where CI is running", 2025-12-04T08:40:44.0011494Z ) 2025-12-04T08:40:44.0011880Z parser.add_argument( 2025-12-04T08:40:44.0012504Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:40:44.0013176Z ) 2025-12-04T08:40:44.0013559Z parser.add_argument( 2025-12-04T08:40:44.0014182Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:40:44.0014873Z ) 2025-12-04T08:40:44.0015242Z parser.add_argument( 2025-12-04T08:40:44.0016319Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:40:44.0017027Z ) 2025-12-04T08:40:44.0017410Z parser.add_argument( 2025-12-04T08:40:44.0018070Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:40:44.0018805Z ) 2025-12-04T08:40:44.0019186Z parser.add_argument( 2025-12-04T08:40:44.0019635Z "--github-ref-type", 2025-12-04T08:40:44.0020102Z type=str, 2025-12-04T08:40:44.0020515Z required=True, 2025-12-04T08:40:44.0021013Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:40:44.0021581Z ) 2025-12-04T08:40:44.0021963Z parser.add_argument( 2025-12-04T08:40:44.0022419Z "--eligible-experiments", 2025-12-04T08:40:44.0022940Z type=_str_comma_separated_to_set, 2025-12-04T08:40:44.0023461Z required=False, 2025-12-04T08:40:44.0023883Z default="", 2025-12-04T08:40:44.0075501Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:40:44.0077089Z ) 2025-12-04T08:40:44.0077498Z parser.add_argument( 2025-12-04T08:40:44.0077986Z "--opt-out-experiments", 2025-12-04T08:40:44.0078502Z type=_str_comma_separated_to_set, 2025-12-04T08:40:44.0079041Z required=False, 2025-12-04T08:40:44.0079471Z default="", 2025-12-04T08:40:44.0079873Z help=( 2025-12-04T08:40:44.0080540Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:40:44.0081676Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:40:44.0082524Z ), 2025-12-04T08:40:44.0082884Z ) 2025-12-04T08:40:44.0083260Z parser.add_argument( 2025-12-04T08:40:44.0083705Z "--pr-number", 2025-12-04T08:40:44.0084125Z type=str, 2025-12-04T08:40:44.0084524Z required=False, 2025-12-04T08:40:44.0084957Z default="", 2025-12-04T08:40:44.0085655Z help="the optional PR number where this is run", 2025-12-04T08:40:44.0086403Z ) 2025-12-04T08:40:44.0086606Z 2025-12-04T08:40:44.0086800Z return parser.parse_args() 2025-12-04T08:40:44.0087113Z 2025-12-04T08:40:44.0087120Z 2025-12-04T08:40:44.0087524Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:40:44.0088279Z auth = Auth.Token(github_token) 2025-12-04T08:40:44.0088776Z return Github(auth=auth) 2025-12-04T08:40:44.0089080Z 2025-12-04T08:40:44.0089086Z 2025-12-04T08:40:44.0089530Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:40:44.0090330Z repo = gh.get_repo(repo) 2025-12-04T08:40:44.0090832Z return repo.get_issue(number=issue_num) 2025-12-04T08:40:44.0091194Z 2025-12-04T08:40:44.0091201Z 2025-12-04T08:40:44.0091393Z def get_potential_pr_author( 2025-12-04T08:40:44.0092030Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:40:44.0092713Z ) -> str: 2025-12-04T08:40:44.0093231Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:40:44.0094031Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:40:44.0094759Z # embedded in the tag name: ciflow// 2025-12-04T08:40:44.0095172Z 2025-12-04T08:40:44.0095364Z gh = get_gh_client(github_token) 2025-12-04T08:40:44.0095880Z 2025-12-04T08:40:44.0096235Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:40:44.0096895Z split_tag = ref_name.split("/") 2025-12-04T08:40:44.0097400Z if ( 2025-12-04T08:40:44.0097786Z len(split_tag) == 3 2025-12-04T08:40:44.0098283Z and split_tag[0] == "ciflow" 2025-12-04T08:40:44.0098810Z and split_tag[2].isnumeric() 2025-12-04T08:40:44.0099306Z ): 2025-12-04T08:40:44.0099696Z pr_number = split_tag[2] 2025-12-04T08:40:44.0100397Z try: 2025-12-04T08:40:44.0100835Z repository = gh.get_repo(repo) 2025-12-04T08:40:44.0101452Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:40:44.0102074Z except Exception as e: 2025-12-04T08:40:44.0102600Z raise Exception( # noqa: TRY002 2025-12-04T08:40:44.0103281Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:40:44.0103921Z ) from e 2025-12-04T08:40:44.0104463Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:40:44.0105155Z # In all other cases, return the original input username 2025-12-04T08:40:44.0105867Z return username 2025-12-04T08:40:44.0106120Z 2025-12-04T08:40:44.0106126Z 2025-12-04T08:40:44.0106361Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:40:44.0106898Z """ 2025-12-04T08:40:44.0107547Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:40:44.0108332Z """ 2025-12-04T08:40:44.0108891Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:40:44.0109413Z 2025-12-04T08:40:44.0109419Z 2025-12-04T08:40:44.0109629Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:40:44.0110125Z try: 2025-12-04T08:40:44.0110515Z data = yaml.safe_load(yaml_text) 2025-12-04T08:40:44.0111025Z return data 2025-12-04T08:40:44.0111452Z except yaml.YAMLError: 2025-12-04T08:40:44.0111937Z log.exception("Error loading YAML") 2025-12-04T08:40:44.0112460Z raise 2025-12-04T08:40:44.0112678Z 2025-12-04T08:40:44.0112686Z 2025-12-04T08:40:44.0113109Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:40:44.0113859Z """ 2025-12-04T08:40:44.0114486Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:40:44.0115081Z 2025-12-04T08:40:44.0115560Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:44.0116652Z and the text below is the list of opted in users. 2025-12-04T08:40:44.0117067Z 2025-12-04T08:40:44.0117447Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:40:44.0118154Z """ 2025-12-04T08:40:44.0118591Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:40:44.0119216Z if len(rollout_state_parts) >= 2: 2025-12-04T08:40:44.0119835Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:40:44.0120432Z else: 2025-12-04T08:40:44.0120819Z return "", rollout_state 2025-12-04T08:40:44.0121132Z 2025-12-04T08:40:44.0121139Z 2025-12-04T08:40:44.0121361Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:40:44.0121875Z """ 2025-12-04T08:40:44.0122400Z Dictionary of users with a list of features they have opted into 2025-12-04T08:40:44.0123057Z """ 2025-12-04T08:40:44.0123259Z 2025-12-04T08:40:44.0123276Z 2025-12-04T08:40:44.0123626Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:40:44.0124284Z """ 2025-12-04T08:40:44.0124996Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:40:44.0125794Z 2025-12-04T08:40:44.0126417Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:40:44.0127415Z - Example line: "@User1,lf,split_build" 2025-12-04T08:40:44.0128104Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:40:44.0128592Z 2025-12-04T08:40:44.0128599Z 2025-12-04T08:40:44.0128757Z """ 2025-12-04T08:40:44.0129143Z optins = UserOptins() 2025-12-04T08:40:44.0129629Z for user in user_optin_text.split("\n"): 2025-12-04T08:40:44.0130190Z user = user.strip("\r\n\t -") 2025-12-04T08:40:44.0130734Z if not user or not user.startswith("@"): 2025-12-04T08:40:44.0131514Z # Not a valid user. Skip 2025-12-04T08:40:44.0132018Z continue 2025-12-04T08:40:44.0132291Z 2025-12-04T08:40:44.0132459Z if user: 2025-12-04T08:40:44.0132902Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:40:44.0133597Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:40:44.0134098Z 2025-12-04T08:40:44.0134272Z return optins 2025-12-04T08:40:44.0134517Z 2025-12-04T08:40:44.0134524Z 2025-12-04T08:40:44.0134805Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:40:44.0135421Z """ 2025-12-04T08:40:44.0136040Z Check if the experiment name is valid. 2025-12-04T08:40:44.0136593Z A valid name: 2025-12-04T08:40:44.0137241Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:40:44.0138213Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:40:44.0138959Z - Cannot contain spaces 2025-12-04T08:40:44.0139427Z """ 2025-12-04T08:40:44.0139636Z 2025-12-04T08:40:44.0139901Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:40:44.0140597Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:40:44.0141047Z 2025-12-04T08:40:44.0141211Z if valid: 2025-12-04T08:40:44.0141593Z return True 2025-12-04T08:40:44.0141846Z 2025-12-04T08:40:44.0142014Z log.error( 2025-12-04T08:40:44.0143466Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-12-04T08:40:44.0145024Z ) 2025-12-04T08:40:44.0145392Z return False 2025-12-04T08:40:44.0145628Z 2025-12-04T08:40:44.0145634Z 2025-12-04T08:40:44.0146044Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:40:44.0146678Z """ 2025-12-04T08:40:44.0147408Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:40:44.0148148Z """ 2025-12-04T08:40:44.0148521Z try: 2025-12-04T08:40:44.0148918Z if settings_text: 2025-12-04T08:40:44.0149652Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:40:44.0150439Z # for easy reading 2025-12-04T08:40:44.0151220Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:40:44.0152104Z # the backtick character in shell commands. 2025-12-04T08:40:44.0152715Z backtick = chr(96) # backtick character 2025-12-04T08:40:44.0153387Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:40:44.0154059Z settings = load_yaml(settings_text) 2025-12-04T08:40:44.0154451Z 2025-12-04T08:40:44.0154862Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:40:44.0155632Z experiments = {} 2025-12-04T08:40:44.0156242Z 2025-12-04T08:40:44.0156654Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:40:44.0157449Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:40:44.0158567Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-12-04T08:40:44.0159625Z continue 2025-12-04T08:40:44.0159913Z 2025-12-04T08:40:44.0160099Z valid_settings = {} 2025-12-04T08:40:44.0160623Z for setting in exp_settings: 2025-12-04T08:40:44.0161196Z if setting not in Experiment._fields: 2025-12-04T08:40:44.0161759Z log.warning( 2025-12-04T08:40:44.0162467Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:40:44.0163353Z ) 2025-12-04T08:40:44.0163800Z else: 2025-12-04T08:40:44.0164315Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:40:44.0164741Z 2025-12-04T08:40:44.0165016Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:40:44.0165652Z return Settings(experiments) 2025-12-04T08:40:44.0166163Z 2025-12-04T08:40:44.0166343Z except Exception: 2025-12-04T08:40:44.0166831Z log.exception("Failed to parse settings") 2025-12-04T08:40:44.0167222Z 2025-12-04T08:40:44.0167400Z return Settings() 2025-12-04T08:40:44.0167661Z 2025-12-04T08:40:44.0167667Z 2025-12-04T08:40:44.0167931Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:40:44.0168505Z """ 2025-12-04T08:40:44.0168959Z Parse settings, if any, from the rollout state. 2025-12-04T08:40:44.0169360Z 2025-12-04T08:40:44.0169712Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:44.0170492Z and the text below is the list of opted in users. 2025-12-04T08:40:44.0170905Z 2025-12-04T08:40:44.0171321Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:40:44.0172059Z """ 2025-12-04T08:40:44.0172620Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:44.0173374Z return parse_settings_from_text(settings_text) 2025-12-04T08:40:44.0173794Z 2025-12-04T08:40:44.0173801Z 2025-12-04T08:40:44.0174051Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:40:44.0174625Z """ 2025-12-04T08:40:44.0175011Z Parse users from the rollout state. 2025-12-04T08:40:44.0175362Z 2025-12-04T08:40:44.0175530Z """ 2025-12-04T08:40:44.0176294Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:44.0177073Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:40:44.0177480Z 2025-12-04T08:40:44.0177488Z 2025-12-04T08:40:44.0178041Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:44.0178796Z """ 2025-12-04T08:40:44.0179218Z Check if a user is opted into an experiment 2025-12-04T08:40:44.0179751Z """ 2025-12-04T08:40:44.0180202Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:40:44.0180633Z 2025-12-04T08:40:44.0180639Z 2025-12-04T08:40:44.0181059Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:44.0181809Z """ 2025-12-04T08:40:44.0182274Z Check if a user explicitly opted out of an experiment 2025-12-04T08:40:44.0182860Z """ 2025-12-04T08:40:44.0183359Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:40:44.0184043Z experiment_optout = "-" + experiment_name 2025-12-04T08:40:44.0184683Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:40:44.0185288Z return False 2025-12-04T08:40:44.0185546Z 2025-12-04T08:40:44.0185941Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:40:44.0186546Z log.warning( 2025-12-04T08:40:44.0187348Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:40:44.0188229Z ) 2025-12-04T08:40:44.0188451Z 2025-12-04T08:40:44.0188621Z return True 2025-12-04T08:40:44.0188857Z 2025-12-04T08:40:44.0188863Z 2025-12-04T08:40:44.0189052Z def get_runner_prefix( 2025-12-04T08:40:44.0189493Z rollout_state: str, 2025-12-04T08:40:44.0189957Z workflow_requestors: Iterable[str], 2025-12-04T08:40:44.0190479Z branch: str, 2025-12-04T08:40:44.0190968Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:44.0191624Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:44.0192212Z is_canary: bool = False, 2025-12-04T08:40:44.0192667Z ) -> str: 2025-12-04T08:40:44.0193228Z settings = parse_settings(rollout_state) 2025-12-04T08:40:44.0193810Z user_optins = parse_users(rollout_state) 2025-12-04T08:40:44.0194176Z 2025-12-04T08:40:44.0194351Z fleet_prefix = "" 2025-12-04T08:40:44.0194792Z prefixes = [] 2025-12-04T08:40:44.0195417Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:40:44.0196727Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:40:44.0197464Z log.info( 2025-12-04T08:40:44.0198152Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:40:44.0198909Z ) 2025-12-04T08:40:44.0199292Z continue 2025-12-04T08:40:44.0199538Z 2025-12-04T08:40:44.0199734Z if opt_out_experiments: 2025-12-04T08:40:44.0200267Z if experiment_name in opt_out_experiments: 2025-12-04T08:40:44.0200914Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:40:44.0201507Z log.info( 2025-12-04T08:40:44.0202449Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:40:44.0203421Z ) 2025-12-04T08:40:44.0203823Z continue 2025-12-04T08:40:44.0204090Z 2025-12-04T08:40:44.0204289Z if eligible_experiments: 2025-12-04T08:40:44.0204872Z if experiment_name not in eligible_experiments: 2025-12-04T08:40:44.0205512Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:40:44.0206191Z log.info( 2025-12-04T08:40:44.0206979Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:40:44.0207818Z ) 2025-12-04T08:40:44.0208222Z continue 2025-12-04T08:40:44.0208697Z elif not experiment_settings.default: 2025-12-04T08:40:44.0209233Z log.info( 2025-12-04T08:40:44.0210037Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:40:44.0210785Z ) 2025-12-04T08:40:44.0211175Z continue 2025-12-04T08:40:44.0211421Z 2025-12-04T08:40:44.0211701Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:40:44.0212324Z opted_out_users = [ 2025-12-04T08:40:44.0212778Z requestor 2025-12-04T08:40:44.0213234Z for requestor in workflow_requestors 2025-12-04T08:40:44.0213906Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:40:44.0214534Z ] 2025-12-04T08:40:44.0214743Z 2025-12-04T08:40:44.0214932Z if opted_out_users: 2025-12-04T08:40:44.0215383Z log.info( 2025-12-04T08:40:44.0216228Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:40:44.0216932Z ) 2025-12-04T08:40:44.0217322Z continue 2025-12-04T08:40:44.0217579Z 2025-12-04T08:40:44.0217863Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:40:44.0218505Z opted_in_users = [ 2025-12-04T08:40:44.0218962Z requestor 2025-12-04T08:40:44.0219415Z for requestor in workflow_requestors 2025-12-04T08:40:44.0220083Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:40:44.0220703Z ] 2025-12-04T08:40:44.0220916Z 2025-12-04T08:40:44.0221089Z enabled = False 2025-12-04T08:40:44.0221521Z if opted_in_users: 2025-12-04T08:40:44.0221960Z log.info( 2025-12-04T08:40:44.0222563Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:40:44.0223246Z ) 2025-12-04T08:40:44.0223636Z enabled = True 2025-12-04T08:40:44.0223916Z 2025-12-04T08:40:44.0224142Z elif experiment_settings.rollout_perc: 2025-12-04T08:40:44.0224981Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:40:44.0226169Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:40:44.0226821Z log.info( 2025-12-04T08:40:44.0227684Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:40:44.0228607Z ) 2025-12-04T08:40:44.0229015Z enabled = True 2025-12-04T08:40:44.0229314Z 2025-12-04T08:40:44.0229479Z if enabled: 2025-12-04T08:40:44.0229905Z label = experiment_name 2025-12-04T08:40:44.0230446Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:40:44.0231282Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:40:44.0232164Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:40:44.0232928Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:40:44.0233608Z if is_canary: 2025-12-04T08:40:44.0234106Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:40:44.0234662Z fleet_prefix = label 2025-12-04T08:40:44.0235153Z else: 2025-12-04T08:40:44.0235586Z prefixes.append(label) 2025-12-04T08:40:44.0236219Z 2025-12-04T08:40:44.0236413Z if len(prefixes) > 1: 2025-12-04T08:40:44.0236873Z log.error( 2025-12-04T08:40:44.0237909Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-12-04T08:40:44.0239021Z ) 2025-12-04T08:40:44.0239417Z prefixes = prefixes[:1] 2025-12-04T08:40:44.0239727Z 2025-12-04T08:40:44.0239913Z # Fleet always comes first 2025-12-04T08:40:44.0240380Z if fleet_prefix: 2025-12-04T08:40:44.0240826Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:40:44.0241196Z 2025-12-04T08:40:44.0241582Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:40:44.0242010Z 2025-12-04T08:40:44.0242016Z 2025-12-04T08:40:44.0242465Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:40:44.0243239Z """ 2025-12-04T08:40:44.0243820Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:40:44.0244387Z 2025-12-04T08:40:44.0244766Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:40:44.0245485Z """ 2025-12-04T08:40:44.0246404Z gh = get_gh_client(github_token) 2025-12-04T08:40:44.0246958Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:40:44.0247592Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:40:44.0248040Z 2025-12-04T08:40:44.0248046Z 2025-12-04T08:40:44.0248443Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:40:44.0249221Z for _ in range(num_retries): 2025-12-04T08:40:44.0249698Z try: 2025-12-04T08:40:44.0250126Z req = Request(url=url, headers=headers) 2025-12-04T08:40:44.0250781Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:40:44.0251429Z return json.loads(content) 2025-12-04T08:40:44.0251958Z except Exception as e: 2025-12-04T08:40:44.0252497Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:40:44.0252899Z 2025-12-04T08:40:44.0253283Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:40:44.0253996Z return {} 2025-12-04T08:40:44.0254227Z 2025-12-04T08:40:44.0254233Z 2025-12-04T08:40:44.0254396Z @cache 2025-12-04T08:40:44.0255007Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:40:44.0256314Z """ 2025-12-04T08:40:44.0256842Z Dynamically get PR information 2025-12-04T08:40:44.0257346Z """ 2025-12-04T08:40:44.0258057Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:40:44.0258688Z headers = { 2025-12-04T08:40:44.0259141Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:40:44.0259739Z "Authorization": f"token {github_token}", 2025-12-04T08:40:44.0260271Z } 2025-12-04T08:40:44.0260686Z json_response: dict[str, Any] = download_json( 2025-12-04T08:40:44.0261281Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:40:44.0261817Z headers=headers, 2025-12-04T08:40:44.0262244Z ) 2025-12-04T08:40:44.0262452Z 2025-12-04T08:40:44.0262641Z if not json_response: 2025-12-04T08:40:44.0263213Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:40:44.0263834Z return {} 2025-12-04T08:40:44.0264069Z 2025-12-04T08:40:44.0264246Z return json_response 2025-12-04T08:40:44.0264527Z 2025-12-04T08:40:44.0264534Z 2025-12-04T08:40:44.0264929Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:40:44.0265664Z """ 2025-12-04T08:40:44.0266381Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:40:44.0267036Z """ 2025-12-04T08:40:44.0267510Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:40:44.0268118Z return { 2025-12-04T08:40:44.0268713Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:40:44.0269413Z } 2025-12-04T08:40:44.0269614Z 2025-12-04T08:40:44.0269621Z 2025-12-04T08:40:44.0269792Z def main() -> None: 2025-12-04T08:40:44.0270218Z args = parse_args() 2025-12-04T08:40:44.0270485Z 2025-12-04T08:40:44.0270710Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:40:44.0271096Z 2025-12-04T08:40:44.0271283Z # Check if the PR is opt-out 2025-12-04T08:40:44.0271770Z if args.pr_number: 2025-12-04T08:40:44.0272411Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:40:44.0273298Z if OPT_OUT_LABEL in labels: 2025-12-04T08:40:44.0273795Z log.info( 2025-12-04T08:40:44.0274473Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:40:44.0275225Z ) 2025-12-04T08:40:44.0275871Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:44.0276540Z sys.exit() 2025-12-04T08:40:44.0276800Z 2025-12-04T08:40:44.0276957Z try: 2025-12-04T08:40:44.0277391Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:40:44.0278081Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:40:44.0278722Z ) 2025-12-04T08:40:44.0278928Z 2025-12-04T08:40:44.0279128Z username = get_potential_pr_author( 2025-12-04T08:40:44.0279665Z args.github_token, 2025-12-04T08:40:44.0280135Z args.github_repo, 2025-12-04T08:40:44.0280614Z args.github_actor, 2025-12-04T08:40:44.0281101Z args.github_ref_type, 2025-12-04T08:40:44.0281597Z args.github_branch, 2025-12-04T08:40:44.0282070Z ) 2025-12-04T08:40:44.0282282Z 2025-12-04T08:40:44.0282559Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:40:44.0283017Z 2025-12-04T08:40:44.0283236Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:40:44.0283779Z rollout_state, 2025-12-04T08:40:44.0284270Z (args.github_issue_owner, username), 2025-12-04T08:40:44.0284819Z args.github_branch, 2025-12-04T08:40:44.0285311Z args.eligible_experiments, 2025-12-04T08:40:44.0285951Z args.opt_out_experiments, 2025-12-04T08:40:44.0286462Z is_canary, 2025-12-04T08:40:44.0286881Z ) 2025-12-04T08:40:44.0287086Z 2025-12-04T08:40:44.0287271Z except Exception as e: 2025-12-04T08:40:44.0287735Z log.error( 2025-12-04T08:40:44.0288384Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:40:44.0289288Z ) 2025-12-04T08:40:44.0289505Z 2025-12-04T08:40:44.0289845Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:44.0290337Z 2025-12-04T08:40:44.0290344Z 2025-12-04T08:40:44.0290527Z if __name__ == "__main__": 2025-12-04T08:40:44.0290965Z main() 2025-12-04T08:40:44.0291176Z 2025-12-04T08:40:44.0385367Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:40:44.0386448Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:40:44.0419462Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:44.0419938Z env: 2025-12-04T08:40:44.0420554Z GITHUB_TOKEN: *** 2025-12-04T08:40:44.0420973Z ISSUE_NUMBER: 5132 2025-12-04T08:40:44.0421409Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:44.0421931Z ISSUE_OWNER: 2025-12-04T08:40:44.0422338Z CHECK_EXPERIMENTS: 2025-12-04T08:40:44.0422786Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:40:44.0423240Z PR_NUMBER: 2025-12-04T08:40:44.0423617Z ##[endgroup] 2025-12-04T08:40:44.5741162Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:40:45.0050318Z Collecting urllib3==1.26.18 2025-12-04T08:40:45.2090151Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:40:45.2331170Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-12-04T08:40:45.2541448Z Collecting PyGithub==2.3.0 2025-12-04T08:40:45.2573310Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:40:45.3029311Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:40:45.3062509Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:40:45.3112131Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:40:45.3132373Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-12-04T08:40:45.3148773Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:40:45.3408813Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:40:45.3441098Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:40:45.3676792Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-12-04T08:40:45.4876520Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:45.4908562Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:40:45.6529462Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:40:45.6609767Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:40:45.6825293Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:45.6854727Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:40:45.7109689Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:40:45.7180257Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 28.0 MB/s eta 0:00:00 2025-12-04T08:40:45.7223115Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:40:45.7287004Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 74.7 MB/s eta 0:00:00 2025-12-04T08:40:45.7316982Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:40:45.7432450Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 143.2 MB/s eta 0:00:00 2025-12-04T08:40:45.7464831Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:40:45.7534780Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:40:45.7586004Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 60.1 MB/s eta 0:00:00 2025-12-04T08:40:45.7634675Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:40:45.7683118Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 36.7 MB/s eta 0:00:00 2025-12-04T08:40:45.7725278Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:40:45.7780907Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 27.4 MB/s eta 0:00:00 2025-12-04T08:40:46.0754087Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:40:46.6306557Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:40:46.7305370Z ##[group]Run curr_branch="main" 2025-12-04T08:40:46.7305931Z curr_branch="main" 2025-12-04T08:40:46.7306194Z curr_ref_type="branch" 2025-12-04T08:40:46.7306443Z echo "Current branch is '$curr_branch'" 2025-12-04T08:40:46.7306730Z  2025-12-04T08:40:46.7306925Z python3 runner_determinator.py \ 2025-12-04T08:40:46.7307208Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:40:46.7307497Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:40:46.7307775Z  --github-branch "$curr_branch" \ 2025-12-04T08:40:46.7308074Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:40:46.7308370Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:40:46.7308653Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:40:46.7308929Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:40:46.7309235Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:40:46.7309599Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:40:46.7309901Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:40:46.7344322Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:46.7344560Z env: 2025-12-04T08:40:46.7345148Z GITHUB_TOKEN: *** 2025-12-04T08:40:46.7345345Z ISSUE_NUMBER: 5132 2025-12-04T08:40:46.7345556Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:46.7345997Z ISSUE_OWNER: 2025-12-04T08:40:46.7346181Z CHECK_EXPERIMENTS: 2025-12-04T08:40:46.7346374Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T08:40:46.7346569Z PR_NUMBER: 2025-12-04T08:40:46.7346744Z ##[endgroup] 2025-12-04T08:40:46.7401138Z Current branch is 'main' 2025-12-04T08:40:48.5317769Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-12-04T08:40:48.5319468Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:40:48.5320768Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:40:48.5321801Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:40:48.5322450Z INFO : Setting output: label-type='' 2025-12-04T08:40:48.5670292Z Evaluate and set job outputs 2025-12-04T08:40:48.5677377Z Cleaning up orphan processes