2025-11-03T15:43:05.8641854Z Current runner version: '2.329.0' 2025-11-03T15:43:05.8663927Z ##[group]Runner Image Provisioner 2025-11-03T15:43:05.8664685Z Hosted Compute Agent 2025-11-03T15:43:05.8665319Z Version: 20251016.436 2025-11-03T15:43:05.8665951Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:05.8666607Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:05.8667249Z ##[endgroup] 2025-11-03T15:43:05.8667786Z ##[group]Operating System 2025-11-03T15:43:05.8668353Z Ubuntu 2025-11-03T15:43:05.8668779Z 24.04.3 2025-11-03T15:43:05.8669500Z LTS 2025-11-03T15:43:05.8669934Z ##[endgroup] 2025-11-03T15:43:05.8670411Z ##[group]Runner Image 2025-11-03T15:43:05.8671069Z Image: ubuntu-24.04 2025-11-03T15:43:05.8671543Z Version: 20251030.96.2 2025-11-03T15:43:05.8672521Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:05.8674066Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:05.8674991Z ##[endgroup] 2025-11-03T15:43:05.8676062Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:05.8678033Z Contents: read 2025-11-03T15:43:05.8678680Z Metadata: read 2025-11-03T15:43:05.8679150Z ##[endgroup] 2025-11-03T15:43:05.8681491Z Secret source: Actions 2025-11-03T15:43:05.8682626Z Prepare workflow directory 2025-11-03T15:43:05.9235846Z Prepare all required actions 2025-11-03T15:43:05.9289856Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:05.9295008Z ##[group] Inputs 2025-11-03T15:43:05.9295666Z check_experiments: 2025-11-03T15:43:05.9296329Z opt_out_experiments: 2025-11-03T15:43:05.9296861Z triggering_actor: pytorchmergebot 2025-11-03T15:43:05.9297472Z issue_owner: 2025-11-03T15:43:05.9298039Z curr_branch: main 2025-11-03T15:43:05.9298557Z curr_ref_type: branch 2025-11-03T15:43:05.9299201Z issue_number: 5132 2025-11-03T15:43:05.9300011Z ##[endgroup] 2025-11-03T15:43:05.9300733Z Complete job name: before-test / get-label-type / runner-determinator 2025-11-03T15:43:06.5952642Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:06.5955064Z cat < runner_determinator.py 2025-11-03T15:43:06.5955858Z # flake8: noqa: G004 2025-11-03T15:43:06.5956443Z  2025-11-03T15:43:06.5957215Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:06.5958390Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:06.5959560Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:06.5960334Z  2025-11-03T15:43:06.5960875Z """ 2025-11-03T15:43:06.5961599Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:06.5962661Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:06.5963929Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:06.5964922Z of which runners should be used to run which job. 2025-11-03T15:43:06.5965633Z  2025-11-03T15:43:06.5966455Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:06.5967497Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:06.5968527Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:06.5969626Z list, defined. 2025-11-03T15:43:06.5970148Z  2025-11-03T15:43:06.5970842Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:06.5971980Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:06.5972995Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:06.5973727Z  2025-11-03T15:43:06.5974791Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:06.5975876Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:06.5976767Z experiments which the user could be opted in to. 2025-11-03T15:43:06.5977525Z  2025-11-03T15:43:06.5978056Z The user list has the following rules: 2025-11-03T15:43:06.5978666Z  2025-11-03T15:43:06.5979807Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:06.5980884Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:06.5981827Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:06.5982558Z  2025-11-03T15:43:06.5983069Z Example config: 2025-11-03T15:43:06.5983709Z  # A list of experiments that can be opted into. 2025-11-03T15:43:06.5984597Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:06.5985416Z  # Expected syntax is: 2025-11-03T15:43:06.5986220Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:06.5987409Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:06.5988323Z  2025-11-03T15:43:06.5988765Z  experiments: 2025-11-03T15:43:06.6068102Z  lf: 2025-11-03T15:43:06.6069101Z  rollout_percent: 25 2025-11-03T15:43:06.6070520Z  all_branches: false 2025-11-03T15:43:06.6071533Z  default: true 2025-11-03T15:43:06.6072499Z  --- 2025-11-03T15:43:06.6073263Z  2025-11-03T15:43:06.6073945Z  # Opt-ins: 2025-11-03T15:43:06.6074689Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:06.6075883Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:06.6076766Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:06.6077513Z  # Experiments should be from the above list. 2025-11-03T15:43:06.6078097Z  2025-11-03T15:43:06.6078509Z  @User1,-lf,split_build 2025-11-03T15:43:06.6079026Z  @User2,lf 2025-11-03T15:43:06.6079759Z  @User3,split_build 2025-11-03T15:43:06.6080251Z """ 2025-11-03T15:43:06.6080641Z  2025-11-03T15:43:06.6081021Z import json 2025-11-03T15:43:06.6081462Z import logging 2025-11-03T15:43:06.6081907Z import os 2025-11-03T15:43:06.6082325Z import random 2025-11-03T15:43:06.6082763Z import re 2025-11-03T15:43:06.6083176Z import sys 2025-11-03T15:43:06.6083658Z from argparse import ArgumentParser 2025-11-03T15:43:06.6084316Z from collections.abc import Iterable 2025-11-03T15:43:06.6084913Z from functools import cache 2025-11-03T15:43:06.6085460Z from logging import LogRecord 2025-11-03T15:43:06.6086024Z from typing import Any, NamedTuple 2025-11-03T15:43:06.6086651Z from urllib.request import Request, urlopen 2025-11-03T15:43:06.6087232Z  2025-11-03T15:43:06.6087621Z import yaml 2025-11-03T15:43:06.6088090Z from github import Auth, Github 2025-11-03T15:43:06.6088651Z from github.Issue import Issue 2025-11-03T15:43:06.6089166Z  2025-11-03T15:43:06.6089722Z  2025-11-03T15:43:06.6090201Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:06.6090977Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:06.6091953Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:06.6092714Z  2025-11-03T15:43:06.6093523Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:06.6094177Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:06.6094773Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:06.6095428Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:06.6095990Z  2025-11-03T15:43:06.6096420Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:06.6096962Z  2025-11-03T15:43:06.6097375Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:06.6097912Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:06.6098410Z  2025-11-03T15:43:06.6098789Z  2025-11-03T15:43:06.6099190Z class Experiment(NamedTuple): 2025-11-03T15:43:06.6099993Z  rollout_perc: float = ( 2025-11-03T15:43:06.6100741Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:06.6101465Z  ) 2025-11-03T15:43:06.6101906Z  all_branches: bool = ( 2025-11-03T15:43:06.6102635Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:06.6103355Z  ) 2025-11-03T15:43:06.6103765Z  default: bool = ( 2025-11-03T15:43:06.6104427Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:06.6105110Z  ) 2025-11-03T15:43:06.6105503Z  2025-11-03T15:43:06.6105903Z  # Add more fields as needed 2025-11-03T15:43:06.6106416Z  2025-11-03T15:43:06.6106772Z  2025-11-03T15:43:06.6107172Z class Settings(NamedTuple): 2025-11-03T15:43:06.6107685Z  """ 2025-11-03T15:43:06.6108213Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:06.6108831Z  """ 2025-11-03T15:43:06.6109212Z  2025-11-03T15:43:06.6110021Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:06.6110609Z  2025-11-03T15:43:06.6111129Z  2025-11-03T15:43:06.6111589Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:06.6112293Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:06.6112926Z  2025-11-03T15:43:06.6113303Z  COLORS = { 2025-11-03T15:43:06.6113777Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:06.6114338Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:06.6114891Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:06.6115444Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:06.6116000Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:06.6116511Z  } 2025-11-03T15:43:06.6116901Z  2025-11-03T15:43:06.6117366Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:06.6118184Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:06.6119037Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:06.6119886Z  return super().format(record) 2025-11-03T15:43:06.6120425Z  2025-11-03T15:43:06.6120785Z  2025-11-03T15:43:06.6121202Z handler = logging.StreamHandler() 2025-11-03T15:43:06.6121996Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:06.6122758Z  2025-11-03T15:43:06.6123259Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:06.6123898Z log.addHandler(handler) 2025-11-03T15:43:06.6124417Z log.setLevel(logging.INFO) 2025-11-03T15:43:06.6124910Z  2025-11-03T15:43:06.6125273Z  2025-11-03T15:43:06.6125765Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:06.6126374Z  """ 2025-11-03T15:43:06.6126948Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:06.6127759Z  """ 2025-11-03T15:43:06.6128182Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:06.6129501Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:06.6130743Z  log.warning( 2025-11-03T15:43:06.6131703Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:06.6132674Z  ) 2025-11-03T15:43:06.6133175Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:06.6133760Z  return 2025-11-03T15:43:06.6134198Z  2025-11-03T15:43:06.6134626Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:06.6135270Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:06.6135904Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:06.6136437Z  2025-11-03T15:43:06.6136808Z  2025-11-03T15:43:06.6137369Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:06.6138092Z  return frozenset( 2025-11-03T15:43:06.6138799Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:06.6139748Z  ) 2025-11-03T15:43:06.6140155Z  2025-11-03T15:43:06.6140531Z  2025-11-03T15:43:06.6140937Z def parse_args() -> Any: 2025-11-03T15:43:06.6141596Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:06.6142534Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:06.6143352Z  parser.add_argument( 2025-11-03T15:43:06.6143883Z  "--github-issue-repo", 2025-11-03T15:43:06.6144419Z  type=str, 2025-11-03T15:43:06.6144899Z  required=False, 2025-11-03T15:43:06.6145576Z  default="pytorch/test-infra", 2025-11-03T15:43:06.6146207Z  help="GitHub repo to get the issue", 2025-11-03T15:43:06.6146764Z  ) 2025-11-03T15:43:06.6147182Z  parser.add_argument( 2025-11-03T15:43:06.6147694Z  "--github-repo", 2025-11-03T15:43:06.6148193Z  type=str, 2025-11-03T15:43:06.6148671Z  required=True, 2025-11-03T15:43:06.6149216Z  help="GitHub repo where CI is running", 2025-11-03T15:43:06.6150430Z  ) 2025-11-03T15:43:06.6150896Z  parser.add_argument( 2025-11-03T15:43:06.6151622Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:06.6152331Z  ) 2025-11-03T15:43:06.6152750Z  parser.add_argument( 2025-11-03T15:43:06.6153461Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:06.6154198Z  ) 2025-11-03T15:43:06.6154619Z  parser.add_argument( 2025-11-03T15:43:06.6155351Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:06.6156079Z  ) 2025-11-03T15:43:06.6156496Z  parser.add_argument( 2025-11-03T15:43:06.6157244Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:06.6158003Z  ) 2025-11-03T15:43:06.6158448Z  parser.add_argument( 2025-11-03T15:43:06.6158977Z  "--github-ref-type", 2025-11-03T15:43:06.6159720Z  type=str, 2025-11-03T15:43:06.6160205Z  required=True, 2025-11-03T15:43:06.6160794Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:06.6161387Z  ) 2025-11-03T15:43:06.6161812Z  parser.add_argument( 2025-11-03T15:43:06.6162518Z  "--eligible-experiments", 2025-11-03T15:43:06.6163121Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.6163700Z  required=False, 2025-11-03T15:43:06.6164201Z  default="", 2025-11-03T15:43:06.6165146Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:06.6166117Z  ) 2025-11-03T15:43:06.6166531Z  parser.add_argument( 2025-11-03T15:43:06.6167070Z  "--opt-out-experiments", 2025-11-03T15:43:06.6167658Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.6168228Z  required=False, 2025-11-03T15:43:06.6168716Z  default="", 2025-11-03T15:43:06.6169186Z  help=( 2025-11-03T15:43:06.6170060Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:06.6171280Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:06.6172159Z  ), 2025-11-03T15:43:06.6172572Z  ) 2025-11-03T15:43:06.6172994Z  parser.add_argument( 2025-11-03T15:43:06.6173510Z  "--pr-number", 2025-11-03T15:43:06.6173993Z  type=str, 2025-11-03T15:43:06.6174466Z  required=False, 2025-11-03T15:43:06.6174965Z  default="", 2025-11-03T15:43:06.6175531Z  help="the optional PR number where this is run", 2025-11-03T15:43:06.6176127Z  ) 2025-11-03T15:43:06.6176520Z  2025-11-03T15:43:06.6176933Z  return parser.parse_args() 2025-11-03T15:43:06.6177453Z  2025-11-03T15:43:06.6177815Z  2025-11-03T15:43:06.6178466Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.6179530Z  auth = Auth.Token(github_token) 2025-11-03T15:43:06.6180144Z  return Github(auth=auth) 2025-11-03T15:43:06.6180658Z  2025-11-03T15:43:06.6181026Z  2025-11-03T15:43:06.6181738Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.6182597Z  repo = gh.get_repo(repo) 2025-11-03T15:43:06.6183184Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:06.6183761Z  2025-11-03T15:43:06.6184129Z  2025-11-03T15:43:06.6184538Z def get_potential_pr_author( 2025-11-03T15:43:06.6185268Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:06.6185995Z ) -> str: 2025-11-03T15:43:06.6186588Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:06.6187468Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:06.6188294Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:06.6188914Z  2025-11-03T15:43:06.6189450Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.6189990Z  2025-11-03T15:43:06.6190517Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:06.6191215Z  split_tag = ref_name.split("/") 2025-11-03T15:43:06.6191772Z  if ( 2025-11-03T15:43:06.6192225Z  len(split_tag) == 3 2025-11-03T15:43:06.6192784Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:06.6193372Z  and split_tag[2].isnumeric() 2025-11-03T15:43:06.6193956Z  ): 2025-11-03T15:43:06.6194423Z  pr_number = split_tag[2] 2025-11-03T15:43:06.6194969Z  try: 2025-11-03T15:43:06.6195492Z  repository = gh.get_repo(repo) 2025-11-03T15:43:06.6196306Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:06.6196974Z  except Exception as e: 2025-11-03T15:43:06.6197568Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:06.6198299Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:06.6198998Z  ) from e 2025-11-03T15:43:06.6199724Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:06.6200501Z  # In all other cases, return the original input username 2025-11-03T15:43:06.6201142Z  return username 2025-11-03T15:43:06.6201602Z  2025-11-03T15:43:06.6201974Z  2025-11-03T15:43:06.6202435Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:06.6203020Z  """ 2025-11-03T15:43:06.6203746Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:06.6204575Z  """ 2025-11-03T15:43:06.6205183Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:06.6205891Z  2025-11-03T15:43:06.6206260Z  2025-11-03T15:43:06.6206684Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:06.6207234Z  try: 2025-11-03T15:43:06.6207682Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:06.6208238Z  return data 2025-11-03T15:43:06.6208727Z  except yaml.YAMLError: 2025-11-03T15:43:06.6209391Z  log.exception("Error loading YAML") 2025-11-03T15:43:06.6209965Z  raise 2025-11-03T15:43:06.6210383Z  2025-11-03T15:43:06.6210751Z  2025-11-03T15:43:06.6211412Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:06.6212203Z  """ 2025-11-03T15:43:06.6213015Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:06.6213816Z  2025-11-03T15:43:06.6214404Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.6215236Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.6215848Z  2025-11-03T15:43:06.6216464Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:06.6217205Z  """ 2025-11-03T15:43:06.6217709Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:06.6218364Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:06.6219047Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:06.6219784Z  else: 2025-11-03T15:43:06.6220224Z  return "", rollout_state 2025-11-03T15:43:06.6220939Z  2025-11-03T15:43:06.6221349Z  2025-11-03T15:43:06.6221787Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:06.6222348Z  """ 2025-11-03T15:43:06.6222944Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:06.6223628Z  """ 2025-11-03T15:43:06.6224015Z  2025-11-03T15:43:06.6224372Z  2025-11-03T15:43:06.6224946Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:06.6225642Z  """ 2025-11-03T15:43:06.6226420Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:06.6227292Z  2025-11-03T15:43:06.6228137Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:06.6229184Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:06.6230194Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:06.6230873Z  2025-11-03T15:43:06.6231227Z  2025-11-03T15:43:06.6231585Z  """ 2025-11-03T15:43:06.6232005Z  optins = UserOptins() 2025-11-03T15:43:06.6232576Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:06.6233182Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:06.6233780Z  if not user or not user.startswith("@"): 2025-11-03T15:43:06.6234388Z  # Not a valid user. Skip 2025-11-03T15:43:06.6234918Z  continue 2025-11-03T15:43:06.6235365Z  2025-11-03T15:43:06.6235737Z  if user: 2025-11-03T15:43:06.6236283Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:06.6237040Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:06.6237712Z  2025-11-03T15:43:06.6238092Z  return optins 2025-11-03T15:43:06.6238545Z  2025-11-03T15:43:06.6238903Z  2025-11-03T15:43:06.6239537Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:06.6240198Z  """ 2025-11-03T15:43:06.6240652Z  Check if the experiment name is valid. 2025-11-03T15:43:06.6241217Z  A valid name: 2025-11-03T15:43:06.6241953Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:06.6242953Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:06.6243712Z  - Cannot contain spaces 2025-11-03T15:43:06.6244220Z  """ 2025-11-03T15:43:06.6244607Z  2025-11-03T15:43:06.6245103Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:06.6245889Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:06.6246649Z  2025-11-03T15:43:06.6247070Z  if valid: 2025-11-03T15:43:06.6247515Z  return True 2025-11-03T15:43:06.6247963Z  2025-11-03T15:43:06.6248334Z  log.error( 2025-11-03T15:43:06.6249960Z  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-11-03T15:43:06.6251581Z  ) 2025-11-03T15:43:06.6251982Z  return False 2025-11-03T15:43:06.6252412Z  2025-11-03T15:43:06.6252775Z  2025-11-03T15:43:06.6253325Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:06.6254014Z  """ 2025-11-03T15:43:06.6254675Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:06.6255449Z  """ 2025-11-03T15:43:06.6255841Z  try: 2025-11-03T15:43:06.6256256Z  if settings_text: 2025-11-03T15:43:06.6257073Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:06.6257915Z  # for easy reading 2025-11-03T15:43:06.6258802Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:06.6259851Z  # the backtick character in shell commands. 2025-11-03T15:43:06.6260514Z  backtick = chr(96) # backtick character 2025-11-03T15:43:06.6261257Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:06.6261972Z  settings = load_yaml(settings_text) 2025-11-03T15:43:06.6262524Z  2025-11-03T15:43:06.6263170Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:06.6264091Z  experiments = {} 2025-11-03T15:43:06.6264584Z  2025-11-03T15:43:06.6265182Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:06.6266005Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:06.6267170Z  # 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-11-03T15:43:06.6268281Z  continue 2025-11-03T15:43:06.6268768Z  2025-11-03T15:43:06.6269178Z  valid_settings = {} 2025-11-03T15:43:06.6269867Z  for setting in exp_settings: 2025-11-03T15:43:06.6270488Z  if setting not in Experiment._fields: 2025-11-03T15:43:06.6271111Z  log.warning( 2025-11-03T15:43:06.6271888Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:06.6272645Z  ) 2025-11-03T15:43:06.6273135Z  else: 2025-11-03T15:43:06.6273724Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:06.6274336Z  2025-11-03T15:43:06.6274847Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:06.6275532Z  return Settings(experiments) 2025-11-03T15:43:06.6276070Z  2025-11-03T15:43:06.6276462Z  except Exception: 2025-11-03T15:43:06.6277016Z  log.exception("Failed to parse settings") 2025-11-03T15:43:06.6277594Z  2025-11-03T15:43:06.6277979Z  return Settings() 2025-11-03T15:43:06.6278438Z  2025-11-03T15:43:06.6278799Z  2025-11-03T15:43:06.6279542Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:06.6280196Z  """ 2025-11-03T15:43:06.6280698Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:06.6281282Z  2025-11-03T15:43:06.6281866Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.6282688Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.6283278Z  2025-11-03T15:43:06.6283912Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:06.6284671Z  """ 2025-11-03T15:43:06.6285287Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.6286119Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:06.6286703Z  2025-11-03T15:43:06.6287063Z  2025-11-03T15:43:06.6287572Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:06.6288186Z  """ 2025-11-03T15:43:06.6288638Z  Parse users from the rollout state. 2025-11-03T15:43:06.6289177Z  2025-11-03T15:43:06.6289648Z  """ 2025-11-03T15:43:06.6290252Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.6291060Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:06.6291647Z  2025-11-03T15:43:06.6292000Z  2025-11-03T15:43:06.6292670Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.6293481Z  """ 2025-11-03T15:43:06.6293964Z  Check if a user is opted into an experiment 2025-11-03T15:43:06.6294533Z  """ 2025-11-03T15:43:06.6295055Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:06.6295672Z  2025-11-03T15:43:06.6296160Z  2025-11-03T15:43:06.6296828Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.6297617Z  """ 2025-11-03T15:43:06.6298137Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:06.6298758Z  """ 2025-11-03T15:43:06.6299424Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:06.6300190Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:06.6300908Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:06.6301561Z  return False 2025-11-03T15:43:06.6302012Z  2025-11-03T15:43:06.6302513Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:06.6303150Z  log.warning( 2025-11-03T15:43:06.6304056Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:06.6304990Z  ) 2025-11-03T15:43:06.6305396Z  2025-11-03T15:43:06.6305778Z  return True 2025-11-03T15:43:06.6306210Z  2025-11-03T15:43:06.6306574Z  2025-11-03T15:43:06.6306961Z def get_runner_prefix( 2025-11-03T15:43:06.6307467Z  rollout_state: str, 2025-11-03T15:43:06.6308004Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:06.6308567Z  branch: str, 2025-11-03T15:43:06.6309138Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.6309977Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.6310623Z  is_canary: bool = False, 2025-11-03T15:43:06.6311133Z ) -> str: 2025-11-03T15:43:06.6311630Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:06.6312266Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:06.6312839Z  2025-11-03T15:43:06.6313346Z  fleet_prefix = "" 2025-11-03T15:43:06.6313845Z  prefixes = [] 2025-11-03T15:43:06.6314565Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:06.6315570Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:06.6316331Z  log.info( 2025-11-03T15:43:06.6317082Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:06.6317872Z  ) 2025-11-03T15:43:06.6318316Z  continue 2025-11-03T15:43:06.6318763Z  2025-11-03T15:43:06.6319164Z  if opt_out_experiments: 2025-11-03T15:43:06.6319877Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:06.6320591Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:06.6321240Z  log.info( 2025-11-03T15:43:06.6322251Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:06.6323267Z  ) 2025-11-03T15:43:06.6323723Z  continue 2025-11-03T15:43:06.6324201Z  2025-11-03T15:43:06.6324636Z  if eligible_experiments: 2025-11-03T15:43:06.6325268Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:06.6325963Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:06.6326554Z  log.info( 2025-11-03T15:43:06.6327416Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:06.6328290Z  ) 2025-11-03T15:43:06.6328871Z  continue 2025-11-03T15:43:06.6329529Z  elif not experiment_settings.default: 2025-11-03T15:43:06.6330136Z  log.info( 2025-11-03T15:43:06.6330868Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:06.6331642Z  ) 2025-11-03T15:43:06.6332080Z  continue 2025-11-03T15:43:06.6332528Z  2025-11-03T15:43:06.6333043Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:06.6333699Z  opted_out_users = [ 2025-11-03T15:43:06.6334213Z  requestor 2025-11-03T15:43:06.6334750Z  for requestor in workflow_requestors 2025-11-03T15:43:06.6335483Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.6336162Z  ] 2025-11-03T15:43:06.6336561Z  2025-11-03T15:43:06.6336961Z  if opted_out_users: 2025-11-03T15:43:06.6337486Z  log.info( 2025-11-03T15:43:06.6338192Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:06.6338932Z  ) 2025-11-03T15:43:06.6339470Z  continue 2025-11-03T15:43:06.6339917Z  2025-11-03T15:43:06.6340414Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:06.6341073Z  opted_in_users = [ 2025-11-03T15:43:06.6341593Z  requestor 2025-11-03T15:43:06.6342139Z  for requestor in workflow_requestors 2025-11-03T15:43:06.6342869Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.6343542Z  ] 2025-11-03T15:43:06.6343938Z  2025-11-03T15:43:06.6344330Z  enabled = False 2025-11-03T15:43:06.6344837Z  if opted_in_users: 2025-11-03T15:43:06.6345463Z  log.info( 2025-11-03T15:43:06.6346158Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:06.6346874Z  ) 2025-11-03T15:43:06.6347323Z  enabled = True 2025-11-03T15:43:06.6347805Z  2025-11-03T15:43:06.6348255Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:06.6349138Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:06.6350252Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:06.6350954Z  log.info( 2025-11-03T15:43:06.6351886Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:06.6352845Z  ) 2025-11-03T15:43:06.6353324Z  enabled = True 2025-11-03T15:43:06.6353835Z  2025-11-03T15:43:06.6354215Z  if enabled: 2025-11-03T15:43:06.6354705Z  label = experiment_name 2025-11-03T15:43:06.6355318Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:06.6356208Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:06.6357137Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:06.6357959Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:06.6358659Z  if is_canary: 2025-11-03T15:43:06.6359318Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:06.6359911Z  fleet_prefix = label 2025-11-03T15:43:06.6360451Z  else: 2025-11-03T15:43:06.6361084Z  prefixes.append(label) 2025-11-03T15:43:06.6361632Z  2025-11-03T15:43:06.6362020Z  if len(prefixes) > 1: 2025-11-03T15:43:06.6362534Z  log.error( 2025-11-03T15:43:06.6363652Z  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-11-03T15:43:06.6364813Z  ) 2025-11-03T15:43:06.6365259Z  prefixes = prefixes[:1] 2025-11-03T15:43:06.6365770Z  2025-11-03T15:43:06.6366174Z  # Fleet always comes first 2025-11-03T15:43:06.6366709Z  if fleet_prefix: 2025-11-03T15:43:06.6367228Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:06.6367776Z  2025-11-03T15:43:06.6368257Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:06.6368865Z  2025-11-03T15:43:06.6369331Z  2025-11-03T15:43:06.6370029Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:06.6370840Z  """ 2025-11-03T15:43:06.6371489Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:06.6372232Z  2025-11-03T15:43:06.6372846Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:06.6373592Z  """ 2025-11-03T15:43:06.6374031Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.6374642Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:06.6375344Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:06.6375993Z  2025-11-03T15:43:06.6376364Z  2025-11-03T15:43:06.6377001Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:06.6377931Z  for _ in range(num_retries): 2025-11-03T15:43:06.6378469Z  try: 2025-11-03T15:43:06.6378973Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:06.6379797Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:06.6380503Z  return json.loads(content) 2025-11-03T15:43:06.6381079Z  except Exception as e: 2025-11-03T15:43:06.6381695Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:06.6382286Z  2025-11-03T15:43:06.6382904Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:06.6383669Z  return {} 2025-11-03T15:43:06.6384089Z  2025-11-03T15:43:06.6384450Z  2025-11-03T15:43:06.6384806Z @cache 2025-11-03T15:43:06.6385503Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:06.6386314Z  """ 2025-11-03T15:43:06.6386757Z  Dynamically get PR information 2025-11-03T15:43:06.6387290Z  """ 2025-11-03T15:43:06.6387843Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:06.6388519Z  headers = { 2025-11-03T15:43:06.6389042Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:06.6389812Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:06.6390384Z  } 2025-11-03T15:43:06.6390869Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:06.6391529Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:06.6392106Z  headers=headers, 2025-11-03T15:43:06.6392588Z  ) 2025-11-03T15:43:06.6392969Z  2025-11-03T15:43:06.6393362Z  if not json_response: 2025-11-03T15:43:06.6394046Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:06.6394853Z  return {} 2025-11-03T15:43:06.6395307Z  2025-11-03T15:43:06.6395691Z  return json_response 2025-11-03T15:43:06.6396185Z  2025-11-03T15:43:06.6396544Z  2025-11-03T15:43:06.6397190Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:06.6397952Z  """ 2025-11-03T15:43:06.6398549Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:06.6399341Z  """ 2025-11-03T15:43:06.6399885Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:06.6400545Z  return { 2025-11-03T15:43:06.6401186Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:06.6401912Z  } 2025-11-03T15:43:06.6402291Z  2025-11-03T15:43:06.6402663Z  2025-11-03T15:43:06.6403044Z def main() -> None: 2025-11-03T15:43:06.6403530Z  args = parse_args() 2025-11-03T15:43:06.6404013Z  2025-11-03T15:43:06.6404468Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:06.6405047Z  2025-11-03T15:43:06.6405447Z  # Check if the PR is opt-out 2025-11-03T15:43:06.6405988Z  if args.pr_number: 2025-11-03T15:43:06.6406727Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:06.6407544Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:06.6408085Z  log.info( 2025-11-03T15:43:06.6408857Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:06.6409761Z  ) 2025-11-03T15:43:06.6410390Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.6411116Z  sys.exit() 2025-11-03T15:43:06.6411695Z  2025-11-03T15:43:06.6412068Z  try: 2025-11-03T15:43:06.6412567Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:06.6413338Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:06.6414021Z  ) 2025-11-03T15:43:06.6414414Z  2025-11-03T15:43:06.6414845Z  username = get_potential_pr_author( 2025-11-03T15:43:06.6415425Z  args.github_token, 2025-11-03T15:43:06.6415975Z  args.github_repo, 2025-11-03T15:43:06.6416504Z  args.github_actor, 2025-11-03T15:43:06.6417055Z  args.github_ref_type, 2025-11-03T15:43:06.6417609Z  args.github_branch, 2025-11-03T15:43:06.6418112Z  ) 2025-11-03T15:43:06.6418512Z  2025-11-03T15:43:06.6419025Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:06.6419779Z  2025-11-03T15:43:06.6420225Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:06.6420824Z  rollout_state, 2025-11-03T15:43:06.6421379Z  (args.github_issue_owner, username), 2025-11-03T15:43:06.6421972Z  args.github_branch, 2025-11-03T15:43:06.6422537Z  args.eligible_experiments, 2025-11-03T15:43:06.6423121Z  args.opt_out_experiments, 2025-11-03T15:43:06.6423672Z  is_canary, 2025-11-03T15:43:06.6424137Z  ) 2025-11-03T15:43:06.6424539Z  2025-11-03T15:43:06.6424930Z  except Exception as e: 2025-11-03T15:43:06.6425442Z  log.error( 2025-11-03T15:43:06.6426208Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:06.6427140Z  ) 2025-11-03T15:43:06.6427548Z  2025-11-03T15:43:06.6428114Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.6428811Z  2025-11-03T15:43:06.6429165Z  2025-11-03T15:43:06.6429655Z if __name__ == "__main__": 2025-11-03T15:43:06.6430149Z  main() 2025-11-03T15:43:06.6430559Z  2025-11-03T15:43:06.6430915Z EOF 2025-11-03T15:43:06.6431295Z  2025-11-03T15:43:06.6431695Z cat runner_determinator.py 2025-11-03T15:43:07.0800481Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:07.0801379Z env: 2025-11-03T15:43:07.0802103Z GITHUB_TOKEN: *** 2025-11-03T15:43:07.0802535Z ISSUE_NUMBER: 5132 2025-11-03T15:43:07.0802993Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:07.0803499Z ISSUE_OWNER: 2025-11-03T15:43:07.0803911Z CHECK_EXPERIMENTS: 2025-11-03T15:43:07.0804354Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:07.0804794Z PR_NUMBER: 2025-11-03T15:43:07.0805219Z ##[endgroup] 2025-11-03T15:43:07.1024649Z # flake8: noqa: G004 2025-11-03T15:43:07.1025006Z 2025-11-03T15:43:07.1025447Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:07.1026388Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:07.1027187Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:07.1027625Z 2025-11-03T15:43:07.1027786Z """ 2025-11-03T15:43:07.1028364Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:07.1029537Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:07.1030533Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:07.1031365Z of which runners should be used to run which job. 2025-11-03T15:43:07.1031767Z 2025-11-03T15:43:07.1032147Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:07.1033262Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:07.1034204Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:07.1034894Z list, defined. 2025-11-03T15:43:07.1035134Z 2025-11-03T15:43:07.1035497Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:07.1036423Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:07.1037247Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:07.1037687Z 2025-11-03T15:43:07.1038063Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:07.1038918Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:07.1039988Z experiments which the user could be opted in to. 2025-11-03T15:43:07.1040403Z 2025-11-03T15:43:07.1040609Z The user list has the following rules: 2025-11-03T15:43:07.1040976Z 2025-11-03T15:43:07.1041313Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:07.1042177Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:07.1042942Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:07.1043335Z 2025-11-03T15:43:07.1043510Z Example config: 2025-11-03T15:43:07.1043958Z # A list of experiments that can be opted into. 2025-11-03T15:43:07.1044640Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:07.1045266Z # Expected syntax is: 2025-11-03T15:43:07.1045911Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:07.1046882Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:07.1047494Z 2025-11-03T15:43:07.1047663Z experiments: 2025-11-03T15:43:07.1048069Z lf: 2025-11-03T15:43:07.1048443Z rollout_percent: 25 2025-11-03T15:43:07.1049076Z all_branches: false 2025-11-03T15:43:07.1049915Z default: true 2025-11-03T15:43:07.1050349Z --- 2025-11-03T15:43:07.1050556Z 2025-11-03T15:43:07.1050719Z # Opt-ins: 2025-11-03T15:43:07.1051311Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:07.1052176Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:07.1052949Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:07.1053608Z # Experiments should be from the above list. 2025-11-03T15:43:07.1053988Z 2025-11-03T15:43:07.1054167Z @User1,-lf,split_build 2025-11-03T15:43:07.1054620Z @User2,lf 2025-11-03T15:43:07.1055004Z @User3,split_build 2025-11-03T15:43:07.1055419Z """ 2025-11-03T15:43:07.1055610Z 2025-11-03T15:43:07.1055771Z import json 2025-11-03T15:43:07.1056146Z import logging 2025-11-03T15:43:07.1056527Z import os 2025-11-03T15:43:07.1056897Z import random 2025-11-03T15:43:07.1057270Z import re 2025-11-03T15:43:07.1057641Z import sys 2025-11-03T15:43:07.1058039Z from argparse import ArgumentParser 2025-11-03T15:43:07.1058585Z from collections.abc import Iterable 2025-11-03T15:43:07.1059120Z from functools import cache 2025-11-03T15:43:07.1059844Z from logging import LogRecord 2025-11-03T15:43:07.1060348Z from typing import Any, NamedTuple 2025-11-03T15:43:07.1060883Z from urllib.request import Request, urlopen 2025-11-03T15:43:07.1061257Z 2025-11-03T15:43:07.1061423Z import yaml 2025-11-03T15:43:07.1061809Z from github import Auth, Github 2025-11-03T15:43:07.1062302Z from github.Issue import Issue 2025-11-03T15:43:07.1062602Z 2025-11-03T15:43:07.1062609Z 2025-11-03T15:43:07.1062827Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:07.1063510Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:07.1064373Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:07.1064933Z 2025-11-03T15:43:07.1065168Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:07.1065922Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:07.1066447Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:07.1067003Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:07.1067356Z 2025-11-03T15:43:07.1067558Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:07.1067908Z 2025-11-03T15:43:07.1068093Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:07.1068566Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:07.1068852Z 2025-11-03T15:43:07.1068859Z 2025-11-03T15:43:07.1069046Z class Experiment(NamedTuple): 2025-11-03T15:43:07.1069686Z rollout_perc: float = ( 2025-11-03T15:43:07.1070328Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:07.1071004Z ) 2025-11-03T15:43:07.1071374Z all_branches: bool = ( 2025-11-03T15:43:07.1071997Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:07.1072681Z ) 2025-11-03T15:43:07.1073046Z default: bool = ( 2025-11-03T15:43:07.1073623Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:07.1074255Z ) 2025-11-03T15:43:07.1074453Z 2025-11-03T15:43:07.1074638Z # Add more fields as needed 2025-11-03T15:43:07.1074937Z 2025-11-03T15:43:07.1074944Z 2025-11-03T15:43:07.1075136Z class Settings(NamedTuple): 2025-11-03T15:43:07.1075577Z """ 2025-11-03T15:43:07.1076035Z Settings for the experiments that can be opted into. 2025-11-03T15:43:07.1076606Z """ 2025-11-03T15:43:07.1076802Z 2025-11-03T15:43:07.1077016Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:07.1077380Z 2025-11-03T15:43:07.1077387Z 2025-11-03T15:43:07.1077596Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:07.1078222Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:07.1078656Z 2025-11-03T15:43:07.1078826Z COLORS = { 2025-11-03T15:43:07.1079408Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:07.1080228Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:07.1080736Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:07.1081244Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:07.1081736Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:07.1082211Z } 2025-11-03T15:43:07.1082410Z 2025-11-03T15:43:07.1082635Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:07.1083403Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:07.1084185Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:07.1084811Z return super().format(record) 2025-11-03T15:43:07.1085170Z 2025-11-03T15:43:07.1085176Z 2025-11-03T15:43:07.1085401Z handler = logging.StreamHandler() 2025-11-03T15:43:07.1086098Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:07.1086651Z 2025-11-03T15:43:07.1086894Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:07.1087478Z log.addHandler(handler) 2025-11-03T15:43:07.1087924Z log.setLevel(logging.INFO) 2025-11-03T15:43:07.1088219Z 2025-11-03T15:43:07.1088226Z 2025-11-03T15:43:07.1088484Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:07.1089125Z """ 2025-11-03T15:43:07.1089860Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:07.1090493Z """ 2025-11-03T15:43:07.1090870Z if not GITHUB_OUTPUT: 2025-11-03T15:43:07.1091946Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:07.1093090Z log.warning( 2025-11-03T15:43:07.1093955Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:07.1094885Z ) 2025-11-03T15:43:07.1104407Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:07.1105032Z return 2025-11-03T15:43:07.1105295Z 2025-11-03T15:43:07.1105678Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:07.1106277Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:07.1106859Z f.write(f"{key}={value}\n") 2025-11-03T15:43:07.1107184Z 2025-11-03T15:43:07.1107191Z 2025-11-03T15:43:07.1107499Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:07.1108140Z return frozenset( 2025-11-03T15:43:07.1108767Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:07.1160978Z ) 2025-11-03T15:43:07.1161264Z 2025-11-03T15:43:07.1161271Z 2025-11-03T15:43:07.1161490Z def parse_args() -> Any: 2025-11-03T15:43:07.1162118Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:07.1162995Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:07.1163768Z parser.add_argument( 2025-11-03T15:43:07.1164230Z "--github-issue-repo", 2025-11-03T15:43:07.1164719Z type=str, 2025-11-03T15:43:07.1165133Z required=False, 2025-11-03T15:43:07.1165625Z default="pytorch/test-infra", 2025-11-03T15:43:07.1166165Z help="GitHub repo to get the issue", 2025-11-03T15:43:07.1166685Z ) 2025-11-03T15:43:07.1167055Z parser.add_argument( 2025-11-03T15:43:07.1167498Z "--github-repo", 2025-11-03T15:43:07.1167919Z type=str, 2025-11-03T15:43:07.1168312Z required=True, 2025-11-03T15:43:07.1168781Z help="GitHub repo where CI is running", 2025-11-03T15:43:07.1169481Z ) 2025-11-03T15:43:07.1169914Z parser.add_argument( 2025-11-03T15:43:07.1170519Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:07.1171425Z ) 2025-11-03T15:43:07.1171810Z parser.add_argument( 2025-11-03T15:43:07.1172437Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:07.1173112Z ) 2025-11-03T15:43:07.1173472Z parser.add_argument( 2025-11-03T15:43:07.1174443Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:07.1175127Z ) 2025-11-03T15:43:07.1175500Z parser.add_argument( 2025-11-03T15:43:07.1176145Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:07.1176857Z ) 2025-11-03T15:43:07.1177216Z parser.add_argument( 2025-11-03T15:43:07.1177674Z "--github-ref-type", 2025-11-03T15:43:07.1178129Z type=str, 2025-11-03T15:43:07.1178535Z required=True, 2025-11-03T15:43:07.1179031Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:07.1179713Z ) 2025-11-03T15:43:07.1180089Z parser.add_argument( 2025-11-03T15:43:07.1180544Z "--eligible-experiments", 2025-11-03T15:43:07.1181066Z type=_str_comma_separated_to_set, 2025-11-03T15:43:07.1181576Z required=False, 2025-11-03T15:43:07.1181999Z default="", 2025-11-03T15:43:07.1182850Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:07.1183774Z ) 2025-11-03T15:43:07.1184143Z parser.add_argument( 2025-11-03T15:43:07.1184591Z "--opt-out-experiments", 2025-11-03T15:43:07.1185095Z type=_str_comma_separated_to_set, 2025-11-03T15:43:07.1185608Z required=False, 2025-11-03T15:43:07.1186033Z default="", 2025-11-03T15:43:07.1186421Z help=( 2025-11-03T15:43:07.1187088Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:07.1188217Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:07.1189056Z ), 2025-11-03T15:43:07.1189516Z ) 2025-11-03T15:43:07.1189891Z parser.add_argument( 2025-11-03T15:43:07.1190331Z "--pr-number", 2025-11-03T15:43:07.1190735Z type=str, 2025-11-03T15:43:07.1191133Z required=False, 2025-11-03T15:43:07.1191554Z default="", 2025-11-03T15:43:07.1192152Z help="the optional PR number where this is run", 2025-11-03T15:43:07.1192709Z ) 2025-11-03T15:43:07.1192911Z 2025-11-03T15:43:07.1193099Z return parser.parse_args() 2025-11-03T15:43:07.1193402Z 2025-11-03T15:43:07.1193409Z 2025-11-03T15:43:07.1193806Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.1194557Z auth = Auth.Token(github_token) 2025-11-03T15:43:07.1195067Z return Github(auth=auth) 2025-11-03T15:43:07.1195359Z 2025-11-03T15:43:07.1195365Z 2025-11-03T15:43:07.1195805Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:07.1196599Z repo = gh.get_repo(repo) 2025-11-03T15:43:07.1197091Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:07.1197460Z 2025-11-03T15:43:07.1197467Z 2025-11-03T15:43:07.1197652Z def get_potential_pr_author( 2025-11-03T15:43:07.1198292Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:07.1198948Z ) -> str: 2025-11-03T15:43:07.1199784Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:07.1200603Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:07.1201332Z # embedded in the tag name: ciflow// 2025-11-03T15:43:07.1201739Z 2025-11-03T15:43:07.1201925Z gh = get_gh_client(github_token) 2025-11-03T15:43:07.1202260Z 2025-11-03T15:43:07.1202523Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:07.1203140Z split_tag = ref_name.split("/") 2025-11-03T15:43:07.1203631Z if ( 2025-11-03T15:43:07.1204021Z len(split_tag) == 3 2025-11-03T15:43:07.1204499Z and split_tag[0] == "ciflow" 2025-11-03T15:43:07.1205026Z and split_tag[2].isnumeric() 2025-11-03T15:43:07.1205511Z ): 2025-11-03T15:43:07.1205898Z pr_number = split_tag[2] 2025-11-03T15:43:07.1206534Z try: 2025-11-03T15:43:07.1206971Z repository = gh.get_repo(repo) 2025-11-03T15:43:07.1207572Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:07.1208164Z except Exception as e: 2025-11-03T15:43:07.1208675Z raise Exception( # noqa: TRY002 2025-11-03T15:43:07.1209480Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:07.1210131Z ) from e 2025-11-03T15:43:07.1210663Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:07.1211350Z # In all other cases, return the original input username 2025-11-03T15:43:07.1211923Z return username 2025-11-03T15:43:07.1212166Z 2025-11-03T15:43:07.1212174Z 2025-11-03T15:43:07.1212392Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:07.1212917Z """ 2025-11-03T15:43:07.1213545Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:07.1214310Z """ 2025-11-03T15:43:07.1214846Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:07.1215362Z 2025-11-03T15:43:07.1215369Z 2025-11-03T15:43:07.1215562Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:07.1216050Z try: 2025-11-03T15:43:07.1216437Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:07.1216953Z return data 2025-11-03T15:43:07.1217371Z except yaml.YAMLError: 2025-11-03T15:43:07.1217856Z log.exception("Error loading YAML") 2025-11-03T15:43:07.1218362Z raise 2025-11-03T15:43:07.1218580Z 2025-11-03T15:43:07.1218587Z 2025-11-03T15:43:07.1219006Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:07.1219841Z """ 2025-11-03T15:43:07.1220461Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:07.1221051Z 2025-11-03T15:43:07.1221528Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.1222295Z and the text below is the list of opted in users. 2025-11-03T15:43:07.1222721Z 2025-11-03T15:43:07.1223125Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:07.1223822Z """ 2025-11-03T15:43:07.1224268Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:07.1224857Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:07.1225462Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:07.1226047Z else: 2025-11-03T15:43:07.1226429Z return "", rollout_state 2025-11-03T15:43:07.1226735Z 2025-11-03T15:43:07.1226742Z 2025-11-03T15:43:07.1226947Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:07.1227450Z """ 2025-11-03T15:43:07.1227969Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:07.1228605Z """ 2025-11-03T15:43:07.1228816Z 2025-11-03T15:43:07.1228821Z 2025-11-03T15:43:07.1229160Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:07.1229919Z """ 2025-11-03T15:43:07.1230624Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:07.1231297Z 2025-11-03T15:43:07.1231926Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:07.1232906Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:07.1233589Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:07.1234078Z 2025-11-03T15:43:07.1234085Z 2025-11-03T15:43:07.1234241Z """ 2025-11-03T15:43:07.1234619Z optins = UserOptins() 2025-11-03T15:43:07.1235111Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:07.1235664Z user = user.strip("\r\n\t -") 2025-11-03T15:43:07.1236210Z if not user or not user.startswith("@"): 2025-11-03T15:43:07.1236897Z # Not a valid user. Skip 2025-11-03T15:43:07.1237394Z continue 2025-11-03T15:43:07.1237644Z 2025-11-03T15:43:07.1237803Z if user: 2025-11-03T15:43:07.1238245Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:07.1238937Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:07.1239746Z 2025-11-03T15:43:07.1239931Z return optins 2025-11-03T15:43:07.1240184Z 2025-11-03T15:43:07.1240192Z 2025-11-03T15:43:07.1240487Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:07.1241082Z """ 2025-11-03T15:43:07.1241479Z Check if the experiment name is valid. 2025-11-03T15:43:07.1241991Z A valid name: 2025-11-03T15:43:07.1242624Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:07.1243550Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:07.1244275Z - Cannot contain spaces 2025-11-03T15:43:07.1244739Z """ 2025-11-03T15:43:07.1244939Z 2025-11-03T15:43:07.1245201Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:07.1245890Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:07.1246330Z 2025-11-03T15:43:07.1246490Z if valid: 2025-11-03T15:43:07.1246872Z return True 2025-11-03T15:43:07.1247111Z 2025-11-03T15:43:07.1247270Z log.error( 2025-11-03T15:43:07.1248716Z 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-11-03T15:43:07.1250462Z ) 2025-11-03T15:43:07.1250822Z return False 2025-11-03T15:43:07.1251065Z 2025-11-03T15:43:07.1251072Z 2025-11-03T15:43:07.1251373Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:07.1251986Z """ 2025-11-03T15:43:07.1252726Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:07.1253464Z """ 2025-11-03T15:43:07.1253812Z try: 2025-11-03T15:43:07.1254189Z if settings_text: 2025-11-03T15:43:07.1254919Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:07.1255708Z # for easy reading 2025-11-03T15:43:07.1256489Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:07.1257377Z # the backtick character in shell commands. 2025-11-03T15:43:07.1257977Z backtick = chr(96) # backtick character 2025-11-03T15:43:07.1258631Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:07.1259439Z settings = load_yaml(settings_text) 2025-11-03T15:43:07.1259815Z 2025-11-03T15:43:07.1260229Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:07.1260983Z experiments = {} 2025-11-03T15:43:07.1261278Z 2025-11-03T15:43:07.1261662Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:07.1262413Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:07.1263511Z # 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-11-03T15:43:07.1264546Z continue 2025-11-03T15:43:07.1264830Z 2025-11-03T15:43:07.1265012Z valid_settings = {} 2025-11-03T15:43:07.1265559Z for setting in exp_settings: 2025-11-03T15:43:07.1266130Z if setting not in Experiment._fields: 2025-11-03T15:43:07.1266681Z log.warning( 2025-11-03T15:43:07.1267374Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:07.1268248Z ) 2025-11-03T15:43:07.1268675Z else: 2025-11-03T15:43:07.1269196Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:07.1269730Z 2025-11-03T15:43:07.1270008Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:07.1270645Z return Settings(experiments) 2025-11-03T15:43:07.1270995Z 2025-11-03T15:43:07.1271171Z except Exception: 2025-11-03T15:43:07.1271641Z log.exception("Failed to parse settings") 2025-11-03T15:43:07.1272029Z 2025-11-03T15:43:07.1272204Z return Settings() 2025-11-03T15:43:07.1272456Z 2025-11-03T15:43:07.1272462Z 2025-11-03T15:43:07.1272711Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:07.1273282Z """ 2025-11-03T15:43:07.1273706Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:07.1274115Z 2025-11-03T15:43:07.1274459Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:07.1275223Z and the text below is the list of opted in users. 2025-11-03T15:43:07.1275629Z 2025-11-03T15:43:07.1276030Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:07.1276762Z """ 2025-11-03T15:43:07.1277308Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.1278074Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:07.1278472Z 2025-11-03T15:43:07.1278479Z 2025-11-03T15:43:07.1278727Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:07.1279503Z """ 2025-11-03T15:43:07.1279990Z Parse users from the rollout state. 2025-11-03T15:43:07.1280352Z 2025-11-03T15:43:07.1280511Z """ 2025-11-03T15:43:07.1281044Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:07.1281778Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:07.1282191Z 2025-11-03T15:43:07.1282197Z 2025-11-03T15:43:07.1282781Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.1283541Z """ 2025-11-03T15:43:07.1283955Z Check if a user is opted into an experiment 2025-11-03T15:43:07.1284485Z """ 2025-11-03T15:43:07.1284927Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:07.1285350Z 2025-11-03T15:43:07.1285356Z 2025-11-03T15:43:07.1285768Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:07.1286502Z """ 2025-11-03T15:43:07.1286956Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:07.1287533Z """ 2025-11-03T15:43:07.1288037Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:07.1288716Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:07.1289460Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:07.1290071Z return False 2025-11-03T15:43:07.1290318Z 2025-11-03T15:43:07.1290590Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:07.1291186Z log.warning( 2025-11-03T15:43:07.1291972Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:07.1292843Z ) 2025-11-03T15:43:07.1293059Z 2025-11-03T15:43:07.1293226Z return True 2025-11-03T15:43:07.1293460Z 2025-11-03T15:43:07.1293467Z 2025-11-03T15:43:07.1293646Z def get_runner_prefix( 2025-11-03T15:43:07.1294079Z rollout_state: str, 2025-11-03T15:43:07.1294530Z workflow_requestors: Iterable[str], 2025-11-03T15:43:07.1295041Z branch: str, 2025-11-03T15:43:07.1295519Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.1296173Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:07.1296752Z is_canary: bool = False, 2025-11-03T15:43:07.1297202Z ) -> str: 2025-11-03T15:43:07.1297739Z settings = parse_settings(rollout_state) 2025-11-03T15:43:07.1298312Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:07.1298671Z 2025-11-03T15:43:07.1298845Z fleet_prefix = "" 2025-11-03T15:43:07.1299354Z prefixes = [] 2025-11-03T15:43:07.1299976Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:07.1300899Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:07.1301600Z log.info( 2025-11-03T15:43:07.1302281Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:07.1303021Z ) 2025-11-03T15:43:07.1303401Z continue 2025-11-03T15:43:07.1303652Z 2025-11-03T15:43:07.1303836Z if opt_out_experiments: 2025-11-03T15:43:07.1304373Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:07.1305001Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:07.1305586Z log.info( 2025-11-03T15:43:07.1306498Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:07.1307468Z ) 2025-11-03T15:43:07.1307869Z continue 2025-11-03T15:43:07.1308135Z 2025-11-03T15:43:07.1308323Z if eligible_experiments: 2025-11-03T15:43:07.1308881Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:07.1309610Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:07.1310182Z log.info( 2025-11-03T15:43:07.1310957Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:07.1311795Z ) 2025-11-03T15:43:07.1312192Z continue 2025-11-03T15:43:07.1312667Z elif not experiment_settings.default: 2025-11-03T15:43:07.1313223Z log.info( 2025-11-03T15:43:07.1314043Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:07.1314802Z ) 2025-11-03T15:43:07.1315175Z continue 2025-11-03T15:43:07.1315428Z 2025-11-03T15:43:07.1315707Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:07.1316317Z opted_out_users = [ 2025-11-03T15:43:07.1316760Z requestor 2025-11-03T15:43:07.1317216Z for requestor in workflow_requestors 2025-11-03T15:43:07.1317880Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.1318509Z ] 2025-11-03T15:43:07.1318713Z 2025-11-03T15:43:07.1318891Z if opted_out_users: 2025-11-03T15:43:07.1319621Z log.info( 2025-11-03T15:43:07.1320276Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:07.1320967Z ) 2025-11-03T15:43:07.1321341Z continue 2025-11-03T15:43:07.1321605Z 2025-11-03T15:43:07.1321879Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:07.1322487Z opted_in_users = [ 2025-11-03T15:43:07.1322922Z requestor 2025-11-03T15:43:07.1323373Z for requestor in workflow_requestors 2025-11-03T15:43:07.1324035Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:07.1324640Z ] 2025-11-03T15:43:07.1324845Z 2025-11-03T15:43:07.1325013Z enabled = False 2025-11-03T15:43:07.1325442Z if opted_in_users: 2025-11-03T15:43:07.1325871Z log.info( 2025-11-03T15:43:07.1326460Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:07.1327130Z ) 2025-11-03T15:43:07.1327509Z enabled = True 2025-11-03T15:43:07.1327786Z 2025-11-03T15:43:07.1328000Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:07.1328883Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:07.1330315Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:07.1330968Z log.info( 2025-11-03T15:43:07.1331824Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:07.1332741Z ) 2025-11-03T15:43:07.1333138Z enabled = True 2025-11-03T15:43:07.1333433Z 2025-11-03T15:43:07.1333597Z if enabled: 2025-11-03T15:43:07.1334009Z label = experiment_name 2025-11-03T15:43:07.1334552Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:07.1335361Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:07.1336229Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:07.1336980Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:07.1337661Z if is_canary: 2025-11-03T15:43:07.1338143Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:07.1338679Z fleet_prefix = label 2025-11-03T15:43:07.1339164Z else: 2025-11-03T15:43:07.1340160Z prefixes.append(label) 2025-11-03T15:43:07.1340563Z 2025-11-03T15:43:07.1340750Z if len(prefixes) > 1: 2025-11-03T15:43:07.1341198Z log.error( 2025-11-03T15:43:07.1342232Z 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-11-03T15:43:07.1343349Z ) 2025-11-03T15:43:07.1343738Z prefixes = prefixes[:1] 2025-11-03T15:43:07.1344048Z 2025-11-03T15:43:07.1344232Z # Fleet always comes first 2025-11-03T15:43:07.1344688Z if fleet_prefix: 2025-11-03T15:43:07.1345133Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:07.1345504Z 2025-11-03T15:43:07.1345922Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:07.1346349Z 2025-11-03T15:43:07.1346356Z 2025-11-03T15:43:07.1346795Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:07.1347558Z """ 2025-11-03T15:43:07.1348131Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:07.1348681Z 2025-11-03T15:43:07.1349057Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:07.1349931Z """ 2025-11-03T15:43:07.1350320Z gh = get_gh_client(github_token) 2025-11-03T15:43:07.1350851Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:07.1351467Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:07.1351896Z 2025-11-03T15:43:07.1351903Z 2025-11-03T15:43:07.1352297Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:07.1353041Z for _ in range(num_retries): 2025-11-03T15:43:07.1353511Z try: 2025-11-03T15:43:07.1353920Z req = Request(url=url, headers=headers) 2025-11-03T15:43:07.1354563Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:07.1355187Z return json.loads(content) 2025-11-03T15:43:07.1355702Z except Exception as e: 2025-11-03T15:43:07.1356228Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:07.1356619Z 2025-11-03T15:43:07.1356987Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:07.1357682Z return {} 2025-11-03T15:43:07.1357897Z 2025-11-03T15:43:07.1357904Z 2025-11-03T15:43:07.1358055Z @cache 2025-11-03T15:43:07.1358671Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:07.1359519Z """ 2025-11-03T15:43:07.1359899Z Dynamically get PR information 2025-11-03T15:43:07.1360518Z """ 2025-11-03T15:43:07.1361000Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:07.1361613Z headers = { 2025-11-03T15:43:07.1362054Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:07.1362643Z "Authorization": f"token {github_token}", 2025-11-03T15:43:07.1363153Z } 2025-11-03T15:43:07.1363567Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:07.1364156Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:07.1364690Z headers=headers, 2025-11-03T15:43:07.1365110Z ) 2025-11-03T15:43:07.1365345Z 2025-11-03T15:43:07.1365525Z if not json_response: 2025-11-03T15:43:07.1366084Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:07.1366681Z return {} 2025-11-03T15:43:07.1366916Z 2025-11-03T15:43:07.1367092Z return json_response 2025-11-03T15:43:07.1367364Z 2025-11-03T15:43:07.1367371Z 2025-11-03T15:43:07.1367761Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:07.1368486Z """ 2025-11-03T15:43:07.1369000Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:07.1369753Z """ 2025-11-03T15:43:07.1370236Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:07.1370834Z return { 2025-11-03T15:43:07.1371399Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:07.1372076Z } 2025-11-03T15:43:07.1372277Z 2025-11-03T15:43:07.1372284Z 2025-11-03T15:43:07.1372454Z def main() -> None: 2025-11-03T15:43:07.1372866Z args = parse_args() 2025-11-03T15:43:07.1373134Z 2025-11-03T15:43:07.1373347Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:07.1373731Z 2025-11-03T15:43:07.1373928Z # Check if the PR is opt-out 2025-11-03T15:43:07.1374411Z if args.pr_number: 2025-11-03T15:43:07.1375071Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:07.1375940Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:07.1376440Z log.info( 2025-11-03T15:43:07.1377113Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:07.1377866Z ) 2025-11-03T15:43:07.1378404Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.1379057Z sys.exit() 2025-11-03T15:43:07.1379414Z 2025-11-03T15:43:07.1379581Z try: 2025-11-03T15:43:07.1380001Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:07.1380693Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:07.1381308Z ) 2025-11-03T15:43:07.1381515Z 2025-11-03T15:43:07.1381716Z username = get_potential_pr_author( 2025-11-03T15:43:07.1382243Z args.github_token, 2025-11-03T15:43:07.1382716Z args.github_repo, 2025-11-03T15:43:07.1383179Z args.github_actor, 2025-11-03T15:43:07.1383652Z args.github_ref_type, 2025-11-03T15:43:07.1384140Z args.github_branch, 2025-11-03T15:43:07.1384579Z ) 2025-11-03T15:43:07.1384781Z 2025-11-03T15:43:07.1385063Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:07.1385517Z 2025-11-03T15:43:07.1385726Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:07.1386267Z rollout_state, 2025-11-03T15:43:07.1386727Z (args.github_issue_owner, username), 2025-11-03T15:43:07.1387261Z args.github_branch, 2025-11-03T15:43:07.1387747Z args.eligible_experiments, 2025-11-03T15:43:07.1388266Z args.opt_out_experiments, 2025-11-03T15:43:07.1388760Z is_canary, 2025-11-03T15:43:07.1389151Z ) 2025-11-03T15:43:07.1389453Z 2025-11-03T15:43:07.1389636Z except Exception as e: 2025-11-03T15:43:07.1390078Z log.error( 2025-11-03T15:43:07.1390727Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:07.1391627Z ) 2025-11-03T15:43:07.1391836Z 2025-11-03T15:43:07.1392155Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:07.1392643Z 2025-11-03T15:43:07.1392649Z 2025-11-03T15:43:07.1392830Z if __name__ == "__main__": 2025-11-03T15:43:07.1393253Z main() 2025-11-03T15:43:07.1393464Z 2025-11-03T15:43:07.1482314Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:07.1483192Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:07.1516102Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:07.1516580Z env: 2025-11-03T15:43:07.1517224Z GITHUB_TOKEN: *** 2025-11-03T15:43:07.1517640Z ISSUE_NUMBER: 5132 2025-11-03T15:43:07.1518084Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:07.1518576Z ISSUE_OWNER: 2025-11-03T15:43:07.1518972Z CHECK_EXPERIMENTS: 2025-11-03T15:43:07.1519524Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:07.1519956Z PR_NUMBER: 2025-11-03T15:43:07.1520328Z ##[endgroup] 2025-11-03T15:43:08.3656545Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:09.6891023Z Collecting urllib3==1.26.18 2025-11-03T15:43:09.7672699Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:09.8075303Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.1 MB/s eta 0:00:00 2025-11-03T15:43:09.8383822Z Collecting PyGithub==2.3.0 2025-11-03T15:43:09.8567300Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:09.9185801Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:09.9380118Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:09.9438606Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:09.9464382Z 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-11-03T15:43:09.9479760Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:09.9886398Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:10.0069735Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:10.0293159Z 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-11-03T15:43:10.1977245Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.2171112Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:10.3849896Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:10.4037575Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:10.4384956Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.4567840Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:10.4955558Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:10.5176535Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.6 MB/s eta 0:00:00 2025-11-03T15:43:10.5369153Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:10.5591606Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.7 MB/s eta 0:00:00 2025-11-03T15:43:10.5774599Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:10.6064485Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 51.0 MB/s eta 0:00:00 2025-11-03T15:43:10.6246611Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:10.6448914Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:10.6495260Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 70.1 MB/s eta 0:00:00 2025-11-03T15:43:10.6675403Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:10.6717887Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 44.4 MB/s eta 0:00:00 2025-11-03T15:43:10.6904449Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:10.6945077Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 44.3 MB/s eta 0:00:00 2025-11-03T15:43:11.0639879Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:11.5996632Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:11.6758645Z ##[group]Run curr_branch="main" 2025-11-03T15:43:11.6758955Z curr_branch="main" 2025-11-03T15:43:11.6759188Z curr_ref_type="branch" 2025-11-03T15:43:11.6759605Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:11.6759878Z  2025-11-03T15:43:11.6760056Z python3 runner_determinator.py \ 2025-11-03T15:43:11.6760326Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:11.6760589Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:11.6760834Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:11.6761092Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:11.6761362Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:11.6761641Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:11.6761911Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:11.6762204Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:11.6762553Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:11.6762832Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:11.6796463Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:11.6796697Z env: 2025-11-03T15:43:11.6797174Z GITHUB_TOKEN: *** 2025-11-03T15:43:11.6797362Z ISSUE_NUMBER: 5132 2025-11-03T15:43:11.6797564Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:11.6797792Z ISSUE_OWNER: 2025-11-03T15:43:11.6797966Z CHECK_EXPERIMENTS: 2025-11-03T15:43:11.6798148Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:11.6798332Z PR_NUMBER: 2025-11-03T15:43:11.6798493Z ##[endgroup] 2025-11-03T15:43:11.6849023Z Current branch is 'main' 2025-11-03T15:43:13.5441439Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-11-03T15:43:13.5442834Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:13.5444058Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:13.5445255Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:13.5445818Z INFO : Setting output: label-type='lf.' 2025-11-03T15:43:13.5769741Z Evaluate and set job outputs 2025-11-03T15:43:13.5775873Z Set output 'label-type' 2025-11-03T15:43:13.5777635Z Cleaning up orphan processes