2025-09-07T07:03:23.2384026Z Current runner version: '2.328.0' 2025-09-07T07:03:23.2406780Z ##[group]Runner Image Provisioner 2025-09-07T07:03:23.2407631Z Hosted Compute Agent 2025-09-07T07:03:23.2408205Z Version: 20250829.383 2025-09-07T07:03:23.2408764Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T07:03:23.2409494Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T07:03:23.2410070Z ##[endgroup] 2025-09-07T07:03:23.2410632Z ##[group]Operating System 2025-09-07T07:03:23.2411150Z Ubuntu 2025-09-07T07:03:23.2411685Z 24.04.3 2025-09-07T07:03:23.2412127Z LTS 2025-09-07T07:03:23.2412950Z ##[endgroup] 2025-09-07T07:03:23.2413500Z ##[group]Runner Image 2025-09-07T07:03:23.2414049Z Image: ubuntu-24.04 2025-09-07T07:03:23.2414605Z Version: 20250831.1.0 2025-09-07T07:03:23.2415603Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T07:03:23.2417136Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T07:03:23.2418181Z ##[endgroup] 2025-09-07T07:03:23.2419166Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T07:03:23.2421359Z Contents: read 2025-09-07T07:03:23.2421888Z Metadata: read 2025-09-07T07:03:23.2422747Z ##[endgroup] 2025-09-07T07:03:23.2424772Z Secret source: Actions 2025-09-07T07:03:23.2425477Z Prepare workflow directory 2025-09-07T07:03:23.2925068Z Prepare all required actions 2025-09-07T07:03:23.2981571Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T07:03:23.2987251Z ##[group] Inputs 2025-09-07T07:03:23.2987835Z check_experiments: 2025-09-07T07:03:23.2988515Z opt_out_experiments: lf 2025-09-07T07:03:23.2989075Z triggering_actor: pytorchmergebot 2025-09-07T07:03:23.2989692Z issue_owner: 2025-09-07T07:03:23.2990217Z curr_branch: main 2025-09-07T07:03:23.2990810Z curr_ref_type: branch 2025-09-07T07:03:23.2991452Z issue_number: 5132 2025-09-07T07:03:23.2992055Z ##[endgroup] 2025-09-07T07:03:23.2993160Z Complete job name: get-label-type / runner-determinator 2025-09-07T07:03:23.8127139Z ##[group]Run cat < runner_determinator.py 2025-09-07T07:03:23.8129509Z cat < runner_determinator.py 2025-09-07T07:03:23.8130281Z # flake8: noqa: G004 2025-09-07T07:03:23.8130827Z  2025-09-07T07:03:23.8131628Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:03:23.8132914Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:03:23.8133964Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:03:23.8134680Z  2025-09-07T07:03:23.8135193Z """ 2025-09-07T07:03:23.8135961Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:03:23.8136985Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:03:23.8138257Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:03:23.8139243Z of which runners should be used to run which job. 2025-09-07T07:03:23.8139921Z  2025-09-07T07:03:23.8140674Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:03:23.8141761Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:03:23.8142909Z settings are considered to be empty with only the second part, the user 2025-09-07T07:03:23.8143804Z list, defined. 2025-09-07T07:03:23.8144386Z  2025-09-07T07:03:23.8145064Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:03:23.8146220Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:03:23.8147236Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:03:23.8147946Z  2025-09-07T07:03:23.8149014Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:03:23.8150041Z The user list is also a comma separated list of additional features or 2025-09-07T07:03:23.8150970Z experiments which the user could be opted in to. 2025-09-07T07:03:23.8151724Z  2025-09-07T07:03:23.8152240Z The user list has the following rules: 2025-09-07T07:03:23.8153126Z  2025-09-07T07:03:23.8153868Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:03:23.8154930Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:03:23.8155826Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:03:23.8156543Z  2025-09-07T07:03:23.8157054Z Example config: 2025-09-07T07:03:23.8157653Z  # A list of experiments that can be opted into. 2025-09-07T07:03:23.8158546Z  # This defines the behavior they'll induce when opted into. 2025-09-07T07:03:23.8159313Z  # Expected syntax is: 2025-09-07T07:03:23.8160132Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:03:23.8161299Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:03:23.8162176Z  2025-09-07T07:03:23.8162790Z  experiments: 2025-09-07T07:03:23.8163334Z  lf: 2025-09-07T07:03:23.8163936Z  rollout_percent: 25 2025-09-07T07:03:23.8164521Z  all_branches: false 2025-09-07T07:03:23.8165120Z  default: true 2025-09-07T07:03:23.8165755Z  --- 2025-09-07T07:03:23.8166208Z  2025-09-07T07:03:23.8166698Z  # Opt-ins: 2025-09-07T07:03:23.8167501Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:03:23.8168742Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:03:23.8169692Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:03:23.8170597Z  # Experiments should be from the above list. 2025-09-07T07:03:23.8171298Z  2025-09-07T07:03:23.8171800Z  @User1,-lf,split_build 2025-09-07T07:03:23.8172646Z  @User2,lf 2025-09-07T07:03:23.8173197Z  @User3,split_build 2025-09-07T07:03:23.8173789Z """ 2025-09-07T07:03:23.8174290Z  2025-09-07T07:03:23.8174802Z import json 2025-09-07T07:03:23.8175338Z import logging 2025-09-07T07:03:23.8256410Z import os 2025-09-07T07:03:23.8257005Z import random 2025-09-07T07:03:23.8257497Z import re 2025-09-07T07:03:23.8257942Z import sys 2025-09-07T07:03:23.8258428Z from argparse import ArgumentParser 2025-09-07T07:03:23.8259124Z from collections.abc import Iterable 2025-09-07T07:03:23.8259782Z from functools import cache 2025-09-07T07:03:23.8260341Z from logging import LogRecord 2025-09-07T07:03:23.8260934Z from typing import Any, NamedTuple 2025-09-07T07:03:23.8261583Z from urllib.request import Request, urlopen 2025-09-07T07:03:23.8262185Z  2025-09-07T07:03:23.8262715Z import yaml 2025-09-07T07:03:23.8263189Z from github import Auth, Github 2025-09-07T07:03:23.8263768Z from github.Issue import Issue 2025-09-07T07:03:23.8264299Z  2025-09-07T07:03:23.8264702Z  2025-09-07T07:03:23.8265169Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:03:23.8265961Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:03:23.8266946Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:03:23.8267722Z  2025-09-07T07:03:23.8268444Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:03:23.8269105Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:03:23.8269716Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:03:23.8270370Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:03:23.8270951Z  2025-09-07T07:03:23.8271382Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:03:23.8271934Z  2025-09-07T07:03:23.8272340Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:03:23.8272980Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:03:23.8273486Z  2025-09-07T07:03:23.8273861Z  2025-09-07T07:03:23.8274284Z class Experiment(NamedTuple): 2025-09-07T07:03:23.8274842Z  rollout_perc: float = ( 2025-09-07T07:03:23.8275591Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:03:23.8276333Z  ) 2025-09-07T07:03:23.8276753Z  all_branches: bool = ( 2025-09-07T07:03:23.8277510Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:03:23.8278281Z  ) 2025-09-07T07:03:23.8278715Z  default: bool = ( 2025-09-07T07:03:23.8279389Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T07:03:23.8280090Z  ) 2025-09-07T07:03:23.8280495Z  2025-09-07T07:03:23.8280912Z  # Add more fields as needed 2025-09-07T07:03:23.8281441Z  2025-09-07T07:03:23.8281815Z  2025-09-07T07:03:23.8282229Z class Settings(NamedTuple): 2025-09-07T07:03:23.8282844Z  """ 2025-09-07T07:03:23.8283412Z  Settings for the experiments that can be opted into. 2025-09-07T07:03:23.8284039Z  """ 2025-09-07T07:03:23.8284447Z  2025-09-07T07:03:23.8284895Z  experiments: dict[str, Experiment] = {} 2025-09-07T07:03:23.8285450Z  2025-09-07T07:03:23.8285980Z  2025-09-07T07:03:23.8286446Z class ColorFormatter(logging.Formatter): 2025-09-07T07:03:23.8287160Z  """Color codes the log messages based on the log level""" 2025-09-07T07:03:23.8287800Z  2025-09-07T07:03:23.8288184Z  COLORS = { 2025-09-07T07:03:23.8288678Z  "WARNING": "\033[33m", # Yellow 2025-09-07T07:03:23.8289256Z  "ERROR": "\033[31m", # Red 2025-09-07T07:03:23.8289824Z  "CRITICAL": "\033[31m", # Red 2025-09-07T07:03:23.8290394Z  "INFO": "\033[0m", # Reset 2025-09-07T07:03:23.8290951Z  "DEBUG": "\033[0m", # Reset 2025-09-07T07:03:23.8291473Z  } 2025-09-07T07:03:23.8291876Z  2025-09-07T07:03:23.8292337Z  def format(self, record: LogRecord) -> str: 2025-09-07T07:03:23.8293451Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:03:23.8294313Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:03:23.8294950Z  return super().format(record) 2025-09-07T07:03:23.8295497Z  2025-09-07T07:03:23.8295870Z  2025-09-07T07:03:23.8296316Z handler = logging.StreamHandler() 2025-09-07T07:03:23.8297119Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:03:23.8297900Z  2025-09-07T07:03:23.8298406Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:03:23.8299067Z log.addHandler(handler) 2025-09-07T07:03:23.8299588Z log.setLevel(logging.INFO) 2025-09-07T07:03:23.8300096Z  2025-09-07T07:03:23.8300474Z  2025-09-07T07:03:23.8300972Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:03:23.8301613Z  """ 2025-09-07T07:03:23.8302195Z  Defines outputs of the github action that invokes this script 2025-09-07T07:03:23.8303146Z  """ 2025-09-07T07:03:23.8303580Z  if not GITHUB_OUTPUT: 2025-09-07T07:03:23.8304744Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:03:23.8305954Z  log.warning( 2025-09-07T07:03:23.8306905Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:03:23.8307883Z  ) 2025-09-07T07:03:23.8308387Z  print(f"::set-output name={key}::{value}") 2025-09-07T07:03:23.8308987Z  return 2025-09-07T07:03:23.8309427Z  2025-09-07T07:03:23.8309887Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:03:23.8310530Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:03:23.8311151Z  f.write(f"{key}={value}\n") 2025-09-07T07:03:23.8311700Z  2025-09-07T07:03:23.8312076Z  2025-09-07T07:03:23.8312743Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:03:23.8313465Z  return frozenset( 2025-09-07T07:03:23.8314179Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:03:23.8314921Z  ) 2025-09-07T07:03:23.8315349Z  2025-09-07T07:03:23.8315747Z  2025-09-07T07:03:23.8316149Z def parse_args() -> Any: 2025-09-07T07:03:23.8316818Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:03:23.8317765Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:03:23.8318597Z  parser.add_argument( 2025-09-07T07:03:23.8319139Z  "--github-issue-repo", 2025-09-07T07:03:23.8319681Z  type=str, 2025-09-07T07:03:23.8320176Z  required=False, 2025-09-07T07:03:23.8320854Z  default="pytorch/test-infra", 2025-09-07T07:03:23.8321491Z  help="GitHub repo to get the issue", 2025-09-07T07:03:23.8322053Z  ) 2025-09-07T07:03:23.8322578Z  parser.add_argument( 2025-09-07T07:03:23.8323108Z  "--github-repo", 2025-09-07T07:03:23.8323623Z  type=str, 2025-09-07T07:03:23.8324096Z  required=True, 2025-09-07T07:03:23.8324650Z  help="GitHub repo where CI is running", 2025-09-07T07:03:23.8325227Z  ) 2025-09-07T07:03:23.8325645Z  parser.add_argument( 2025-09-07T07:03:23.8326354Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:03:23.8327066Z  ) 2025-09-07T07:03:23.8327499Z  parser.add_argument( 2025-09-07T07:03:23.8328230Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:03:23.8328981Z  ) 2025-09-07T07:03:23.8329421Z  parser.add_argument( 2025-09-07T07:03:23.8330153Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:03:23.8330899Z  ) 2025-09-07T07:03:23.8331323Z  parser.add_argument( 2025-09-07T07:03:23.8332095Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:03:23.8333194Z  ) 2025-09-07T07:03:23.8333661Z  parser.add_argument( 2025-09-07T07:03:23.8334231Z  "--github-ref-type", 2025-09-07T07:03:23.8334794Z  type=str, 2025-09-07T07:03:23.8335315Z  required=True, 2025-09-07T07:03:23.8335944Z  help="Current GitHub ref type, branch or tag", 2025-09-07T07:03:23.8336581Z  ) 2025-09-07T07:03:23.8337044Z  parser.add_argument( 2025-09-07T07:03:23.8337624Z  "--eligible-experiments", 2025-09-07T07:03:23.8338431Z  type=_str_comma_separated_to_set, 2025-09-07T07:03:23.8339053Z  required=False, 2025-09-07T07:03:23.8339600Z  default="", 2025-09-07T07:03:23.8340599Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:03:23.8341621Z  ) 2025-09-07T07:03:23.8342091Z  parser.add_argument( 2025-09-07T07:03:23.8343220Z  "--opt-out-experiments", 2025-09-07T07:03:23.8343848Z  type=_str_comma_separated_to_set, 2025-09-07T07:03:23.8344436Z  required=False, 2025-09-07T07:03:23.8344931Z  default="", 2025-09-07T07:03:23.8345396Z  help=( 2025-09-07T07:03:23.8346150Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:03:23.8347369Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:03:23.8348245Z  ), 2025-09-07T07:03:23.8348663Z  ) 2025-09-07T07:03:23.8349079Z  parser.add_argument( 2025-09-07T07:03:23.8349594Z  "--pr-number", 2025-09-07T07:03:23.8350088Z  type=str, 2025-09-07T07:03:23.8350557Z  required=False, 2025-09-07T07:03:23.8351056Z  default="", 2025-09-07T07:03:23.8351605Z  help="the optional PR number where this is run", 2025-09-07T07:03:23.8352204Z  ) 2025-09-07T07:03:23.8352757Z  2025-09-07T07:03:23.8353163Z  return parser.parse_args() 2025-09-07T07:03:23.8353678Z  2025-09-07T07:03:23.8354041Z  2025-09-07T07:03:23.8354695Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:03:23.8355702Z  auth = Auth.Token(github_token) 2025-09-07T07:03:23.8356311Z  return Github(auth=auth) 2025-09-07T07:03:23.8356844Z  2025-09-07T07:03:23.8357225Z  2025-09-07T07:03:23.8357924Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:03:23.8358769Z  repo = gh.get_repo(repo) 2025-09-07T07:03:23.8359342Z  return repo.get_issue(number=issue_num) 2025-09-07T07:03:23.8359907Z  2025-09-07T07:03:23.8360294Z  2025-09-07T07:03:23.8360698Z def get_potential_pr_author( 2025-09-07T07:03:23.8361429Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:03:23.8362159Z ) -> str: 2025-09-07T07:03:23.8362860Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:03:23.8363749Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:03:23.8364580Z  # embedded in the tag name: ciflow// 2025-09-07T07:03:23.8365195Z  2025-09-07T07:03:23.8365614Z  gh = get_gh_client(github_token) 2025-09-07T07:03:23.8366154Z  2025-09-07T07:03:23.8366691Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:03:23.8367375Z  split_tag = ref_name.split("/") 2025-09-07T07:03:23.8367923Z  if ( 2025-09-07T07:03:23.8368372Z  len(split_tag) == 3 2025-09-07T07:03:23.8368934Z  and split_tag[0] == "ciflow" 2025-09-07T07:03:23.8369517Z  and split_tag[2].isnumeric() 2025-09-07T07:03:23.8370061Z  ): 2025-09-07T07:03:23.8370523Z  pr_number = split_tag[2] 2025-09-07T07:03:23.8371055Z  try: 2025-09-07T07:03:23.8371563Z  repository = gh.get_repo(repo) 2025-09-07T07:03:23.8372381Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:03:23.8373157Z  except Exception as e: 2025-09-07T07:03:23.8373750Z  raise Exception( # noqa: TRY002 2025-09-07T07:03:23.8374502Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:03:23.8375208Z  ) from e 2025-09-07T07:03:23.8375838Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:03:23.8376625Z  # In all other cases, return the original input username 2025-09-07T07:03:23.8377292Z  return username 2025-09-07T07:03:23.8377806Z  2025-09-07T07:03:23.8378196Z  2025-09-07T07:03:23.8378673Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:03:23.8379262Z  """ 2025-09-07T07:03:23.8379992Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:03:23.8380841Z  """ 2025-09-07T07:03:23.8381459Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:03:23.8382185Z  2025-09-07T07:03:23.8382657Z  2025-09-07T07:03:23.8383086Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:03:23.8383664Z  try: 2025-09-07T07:03:23.8384117Z  data = yaml.safe_load(yaml_text) 2025-09-07T07:03:23.8384691Z  return data 2025-09-07T07:03:23.8385186Z  except yaml.YAMLError: 2025-09-07T07:03:23.8385766Z  log.exception("Error loading YAML") 2025-09-07T07:03:23.8386325Z  raise 2025-09-07T07:03:23.8386756Z  2025-09-07T07:03:23.8387145Z  2025-09-07T07:03:23.8387814Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:03:23.8388602Z  """ 2025-09-07T07:03:23.8389432Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:03:23.8390234Z  2025-09-07T07:03:23.8390821Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:03:23.8391661Z  and the text below is the list of opted in users. 2025-09-07T07:03:23.8392263Z  2025-09-07T07:03:23.8393035Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:03:23.8393790Z  """ 2025-09-07T07:03:23.8394303Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T07:03:23.8394955Z  if len(rollout_state_parts) >= 2: 2025-09-07T07:03:23.8395634Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:03:23.8396275Z  else: 2025-09-07T07:03:23.8396719Z  return "", rollout_state 2025-09-07T07:03:23.8397405Z  2025-09-07T07:03:23.8397868Z  2025-09-07T07:03:23.8398302Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:03:23.8398862Z  """ 2025-09-07T07:03:23.8399447Z  Dictionary of users with a list of features they have opted into 2025-09-07T07:03:23.8400139Z  """ 2025-09-07T07:03:23.8400530Z  2025-09-07T07:03:23.8400892Z  2025-09-07T07:03:23.8401455Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:03:23.8402166Z  """ 2025-09-07T07:03:23.8403476Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:03:23.8404372Z  2025-09-07T07:03:23.8405239Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:03:23.8406288Z  - Example line: "@User1,lf,split_build" 2025-09-07T07:03:23.8407210Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:03:23.8407879Z  2025-09-07T07:03:23.8408236Z  2025-09-07T07:03:23.8408609Z  """ 2025-09-07T07:03:23.8409027Z  optins = UserOptins() 2025-09-07T07:03:23.8409594Z  for user in user_optin_text.split("\n"): 2025-09-07T07:03:23.8410195Z  user = user.strip("\r\n\t -") 2025-09-07T07:03:23.8410803Z  if not user or not user.startswith("@"): 2025-09-07T07:03:23.8411408Z  # Not a valid user. Skip 2025-09-07T07:03:23.8411947Z  continue 2025-09-07T07:03:23.8412561Z  2025-09-07T07:03:23.8412950Z  if user: 2025-09-07T07:03:23.8413479Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T07:03:23.8414228Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:03:23.8414943Z  2025-09-07T07:03:23.8415332Z  return optins 2025-09-07T07:03:23.8415800Z  2025-09-07T07:03:23.8416161Z  2025-09-07T07:03:23.8416695Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:03:23.8417348Z  """ 2025-09-07T07:03:23.8417806Z  Check if the experiment name is valid. 2025-09-07T07:03:23.8418374Z  A valid name: 2025-09-07T07:03:23.8419102Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:03:23.8420104Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:03:23.8420858Z  - Cannot contain spaces 2025-09-07T07:03:23.8421375Z  """ 2025-09-07T07:03:23.8421776Z  2025-09-07T07:03:23.8422276Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:03:23.8423169Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:03:23.8423946Z  2025-09-07T07:03:23.8424341Z  if valid: 2025-09-07T07:03:23.8424802Z  return True 2025-09-07T07:03:23.8425248Z  2025-09-07T07:03:23.8425622Z  log.error( 2025-09-07T07:03:23.8427151Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T07:03:23.8428736Z  ) 2025-09-07T07:03:23.8429134Z  return False 2025-09-07T07:03:23.8429579Z  2025-09-07T07:03:23.8429935Z  2025-09-07T07:03:23.8430496Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:03:23.8431180Z  """ 2025-09-07T07:03:23.8431825Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:03:23.8432697Z  """ 2025-09-07T07:03:23.8433089Z  try: 2025-09-07T07:03:23.8433504Z  if settings_text: 2025-09-07T07:03:23.8434305Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:03:23.8435137Z  # for easy reading 2025-09-07T07:03:23.8436006Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:03:23.8436958Z  # the backtick character in shell commands. 2025-09-07T07:03:23.8437622Z  backtick = chr(96) # backtick character 2025-09-07T07:03:23.8438368Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:03:23.8439095Z  settings = load_yaml(settings_text) 2025-09-07T07:03:23.8439650Z  2025-09-07T07:03:23.8440292Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:03:23.8441217Z  experiments = {} 2025-09-07T07:03:23.8441716Z  2025-09-07T07:03:23.8442321Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:03:23.8443247Z  if not is_valid_experiment_name(exp_name): 2025-09-07T07:03:23.8444425Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T07:03:23.8445536Z  continue 2025-09-07T07:03:23.8446042Z  2025-09-07T07:03:23.8446463Z  valid_settings = {} 2025-09-07T07:03:23.8447045Z  for setting in exp_settings: 2025-09-07T07:03:23.8447667Z  if setting not in Experiment._fields: 2025-09-07T07:03:23.8448281Z  log.warning( 2025-09-07T07:03:23.8449080Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:03:23.8449840Z  ) 2025-09-07T07:03:23.8450340Z  else: 2025-09-07T07:03:23.8450943Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T07:03:23.8451559Z  2025-09-07T07:03:23.8452574Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:03:23.8453853Z  return Settings(experiments) 2025-09-07T07:03:23.8454885Z  2025-09-07T07:03:23.8455631Z  except Exception: 2025-09-07T07:03:23.8456554Z  log.exception("Failed to parse settings") 2025-09-07T07:03:23.8457165Z  2025-09-07T07:03:23.8457555Z  return Settings() 2025-09-07T07:03:23.8458019Z  2025-09-07T07:03:23.8458383Z  2025-09-07T07:03:23.8459070Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:03:23.8459706Z  """ 2025-09-07T07:03:23.8460200Z  Parse settings, if any, from the rollout state. 2025-09-07T07:03:23.8460801Z  2025-09-07T07:03:23.8461369Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:03:23.8462197Z  and the text below is the list of opted in users. 2025-09-07T07:03:23.8462963Z  2025-09-07T07:03:23.8463602Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:03:23.8464374Z  """ 2025-09-07T07:03:23.8465002Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:03:23.8465825Z  return parse_settings_from_text(settings_text) 2025-09-07T07:03:23.8466402Z  2025-09-07T07:03:23.8466763Z  2025-09-07T07:03:23.8467255Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:03:23.8467880Z  """ 2025-09-07T07:03:23.8468328Z  Parse users from the rollout state. 2025-09-07T07:03:23.8468879Z  2025-09-07T07:03:23.8469243Z  """ 2025-09-07T07:03:23.8469851Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:03:23.8470649Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T07:03:23.8471238Z  2025-09-07T07:03:23.8471619Z  2025-09-07T07:03:23.8472273Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:03:23.8473173Z  """ 2025-09-07T07:03:23.8473664Z  Check if a user is opted into an experiment 2025-09-07T07:03:23.8474244Z  """ 2025-09-07T07:03:23.8474773Z  return experiment_name in user_optins.get(user, []) 2025-09-07T07:03:23.8475388Z  2025-09-07T07:03:23.8475902Z  2025-09-07T07:03:23.8476593Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:03:23.8477402Z  """ 2025-09-07T07:03:23.8477924Z  Check if a user explicitly opted out of an experiment 2025-09-07T07:03:23.8478550Z  """ 2025-09-07T07:03:23.8479122Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:03:23.8479875Z  experiment_optout = "-" + experiment_name 2025-09-07T07:03:23.8480588Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:03:23.8481232Z  return False 2025-09-07T07:03:23.8481699Z  2025-09-07T07:03:23.8482200Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:03:23.8482960Z  log.warning( 2025-09-07T07:03:23.8483922Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:03:23.8484872Z  ) 2025-09-07T07:03:23.8485315Z  2025-09-07T07:03:23.8485735Z  return True 2025-09-07T07:03:23.8486214Z  2025-09-07T07:03:23.8486618Z  2025-09-07T07:03:23.8487046Z def get_runner_prefix( 2025-09-07T07:03:23.8487579Z  rollout_state: str, 2025-09-07T07:03:23.8488156Z  workflow_requestors: Iterable[str], 2025-09-07T07:03:23.8488760Z  branch: str, 2025-09-07T07:03:23.8489363Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:03:23.8490137Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:03:23.8490803Z  is_canary: bool = False, 2025-09-07T07:03:23.8491343Z ) -> str: 2025-09-07T07:03:23.8491870Z  settings = parse_settings(rollout_state) 2025-09-07T07:03:23.8492640Z  user_optins = parse_users(rollout_state) 2025-09-07T07:03:23.8493253Z  2025-09-07T07:03:23.8493807Z  fleet_prefix = "" 2025-09-07T07:03:23.8494343Z  prefixes = [] 2025-09-07T07:03:23.8495098Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:03:23.8496150Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:03:23.8496945Z  log.info( 2025-09-07T07:03:23.8497740Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:03:23.8498564Z  ) 2025-09-07T07:03:23.8499062Z  continue 2025-09-07T07:03:23.8499565Z  2025-09-07T07:03:23.8500011Z  if opt_out_experiments: 2025-09-07T07:03:23.8500663Z  if experiment_name in opt_out_experiments: 2025-09-07T07:03:23.8501405Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:03:23.8502092Z  log.info( 2025-09-07T07:03:23.8503237Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:03:23.8504278Z  ) 2025-09-07T07:03:23.8504794Z  continue 2025-09-07T07:03:23.8505311Z  2025-09-07T07:03:23.8505768Z  if eligible_experiments: 2025-09-07T07:03:23.8506435Z  if experiment_name not in eligible_experiments: 2025-09-07T07:03:23.8507164Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T07:03:23.8507803Z  log.info( 2025-09-07T07:03:23.8508692Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:03:23.8509614Z  ) 2025-09-07T07:03:23.8510109Z  continue 2025-09-07T07:03:23.8510837Z  elif not experiment_settings.default: 2025-09-07T07:03:23.8511458Z  log.info( 2025-09-07T07:03:23.8512269Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:03:23.8513185Z  ) 2025-09-07T07:03:23.8513658Z  continue 2025-09-07T07:03:23.8514160Z  2025-09-07T07:03:23.8514702Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:03:23.8515399Z  opted_out_users = [ 2025-09-07T07:03:23.8515954Z  requestor 2025-09-07T07:03:23.8516520Z  for requestor in workflow_requestors 2025-09-07T07:03:23.8517294Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:03:23.8517995Z  ] 2025-09-07T07:03:23.8518437Z  2025-09-07T07:03:23.8518863Z  if opted_out_users: 2025-09-07T07:03:23.8519435Z  log.info( 2025-09-07T07:03:23.8520171Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:03:23.8520945Z  ) 2025-09-07T07:03:23.8521428Z  continue 2025-09-07T07:03:23.8521917Z  2025-09-07T07:03:23.8522556Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:03:23.8523254Z  opted_in_users = [ 2025-09-07T07:03:23.8523820Z  requestor 2025-09-07T07:03:23.8524406Z  for requestor in workflow_requestors 2025-09-07T07:03:23.8525180Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:03:23.8525883Z  ] 2025-09-07T07:03:23.8526322Z  2025-09-07T07:03:23.8526758Z  enabled = False 2025-09-07T07:03:23.8527300Z  if opted_in_users: 2025-09-07T07:03:23.8527981Z  log.info( 2025-09-07T07:03:23.8528721Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:03:23.8529484Z  ) 2025-09-07T07:03:23.8529979Z  enabled = True 2025-09-07T07:03:23.8530507Z  2025-09-07T07:03:23.8530998Z  elif experiment_settings.rollout_perc: 2025-09-07T07:03:23.8531925Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:03:23.8533067Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:03:23.8533821Z  log.info( 2025-09-07T07:03:23.8534808Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:03:23.8535816Z  ) 2025-09-07T07:03:23.8536346Z  enabled = True 2025-09-07T07:03:23.8536901Z  2025-09-07T07:03:23.8537328Z  if enabled: 2025-09-07T07:03:23.8537876Z  label = experiment_name 2025-09-07T07:03:23.8538528Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:03:23.8539452Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:03:23.8540426Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T07:03:23.8541294Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:03:23.8542053Z  if is_canary: 2025-09-07T07:03:23.8542747Z  label += CANARY_FLEET_SUFFIX 2025-09-07T07:03:23.8543384Z  fleet_prefix = label 2025-09-07T07:03:23.8543974Z  else: 2025-09-07T07:03:23.8544645Z  prefixes.append(label) 2025-09-07T07:03:23.8545228Z  2025-09-07T07:03:23.8545658Z  if len(prefixes) > 1: 2025-09-07T07:03:23.8546199Z  log.error( 2025-09-07T07:03:23.8547349Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T07:03:23.8548557Z  ) 2025-09-07T07:03:23.8549051Z  prefixes = prefixes[:1] 2025-09-07T07:03:23.8549611Z  2025-09-07T07:03:23.8550055Z  # Fleet always comes first 2025-09-07T07:03:23.8550619Z  if fleet_prefix: 2025-09-07T07:03:23.8551179Z  prefixes.insert(0, fleet_prefix) 2025-09-07T07:03:23.8551765Z  2025-09-07T07:03:23.8552295Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:03:23.8553045Z  2025-09-07T07:03:23.8553469Z  2025-09-07T07:03:23.8554199Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:03:23.8555045Z  """ 2025-09-07T07:03:23.8555735Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:03:23.8556519Z  2025-09-07T07:03:23.8557175Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:03:23.8557954Z  """ 2025-09-07T07:03:23.8558439Z  gh = get_gh_client(github_token) 2025-09-07T07:03:23.8559093Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T07:03:23.8559830Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:03:23.8560510Z  2025-09-07T07:03:23.8560917Z  2025-09-07T07:03:23.8561598Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:03:23.8562702Z  for _ in range(num_retries): 2025-09-07T07:03:23.8563298Z  try: 2025-09-07T07:03:23.8563835Z  req = Request(url=url, headers=headers) 2025-09-07T07:03:23.8564586Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:03:23.8565333Z  return json.loads(content) 2025-09-07T07:03:23.8565943Z  except Exception as e: 2025-09-07T07:03:23.8566602Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T07:03:23.8567230Z  2025-09-07T07:03:23.8567899Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:03:23.8568699Z  return {} 2025-09-07T07:03:23.8569165Z  2025-09-07T07:03:23.8569579Z  2025-09-07T07:03:23.8569991Z @cache 2025-09-07T07:03:23.8570728Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:03:23.8571576Z  """ 2025-09-07T07:03:23.8572106Z  Dynamically get PR information 2025-09-07T07:03:23.8572833Z  """ 2025-09-07T07:03:23.8573445Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:03:23.8574161Z  headers = { 2025-09-07T07:03:23.8574731Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T07:03:23.8575436Z  "Authorization": f"token {github_token}", 2025-09-07T07:03:23.8576044Z  } 2025-09-07T07:03:23.8576576Z  json_response: dict[str, Any] = download_json( 2025-09-07T07:03:23.8577266Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:03:23.8577893Z  headers=headers, 2025-09-07T07:03:23.8578420Z  ) 2025-09-07T07:03:23.8578851Z  2025-09-07T07:03:23.8579289Z  if not json_response: 2025-09-07T07:03:23.8579967Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:03:23.8580829Z  return {} 2025-09-07T07:03:23.8581317Z  2025-09-07T07:03:23.8581754Z  return json_response 2025-09-07T07:03:23.8582272Z  2025-09-07T07:03:23.8582793Z  2025-09-07T07:03:23.8583496Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:03:23.8584309Z  """ 2025-09-07T07:03:23.8584936Z  Dynamically get the latest list of labels from the pull request 2025-09-07T07:03:23.8585667Z  """ 2025-09-07T07:03:23.8586250Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:03:23.8586940Z  return { 2025-09-07T07:03:23.8587625Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:03:23.8588399Z  } 2025-09-07T07:03:23.8588820Z  2025-09-07T07:03:23.8589225Z  2025-09-07T07:03:23.8589653Z def main() -> None: 2025-09-07T07:03:23.8590177Z  args = parse_args() 2025-09-07T07:03:23.8590691Z  2025-09-07T07:03:23.8591185Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:03:23.8591799Z  2025-09-07T07:03:23.8592242Z  # Check if the PR is opt-out 2025-09-07T07:03:23.8592913Z  if args.pr_number: 2025-09-07T07:03:23.8593692Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:03:23.8594529Z  if OPT_OUT_LABEL in labels: 2025-09-07T07:03:23.8595107Z  log.info( 2025-09-07T07:03:23.8595908Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:03:23.8596744Z  ) 2025-09-07T07:03:23.8597414Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:03:23.8598197Z  sys.exit() 2025-09-07T07:03:23.8598828Z  2025-09-07T07:03:23.8599256Z  try: 2025-09-07T07:03:23.8599798Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T07:03:23.8600614Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:03:23.8601336Z  ) 2025-09-07T07:03:23.8601786Z  2025-09-07T07:03:23.8602253Z  username = get_potential_pr_author( 2025-09-07T07:03:23.8602989Z  args.github_token, 2025-09-07T07:03:23.8603574Z  args.github_repo, 2025-09-07T07:03:23.8604147Z  args.github_actor, 2025-09-07T07:03:23.8604737Z  args.github_ref_type, 2025-09-07T07:03:23.8605332Z  args.github_branch, 2025-09-07T07:03:23.8605883Z  ) 2025-09-07T07:03:23.8606321Z  2025-09-07T07:03:23.8606886Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:03:23.8607583Z  2025-09-07T07:03:23.8608067Z  runner_label_prefix = get_runner_prefix( 2025-09-07T07:03:23.8608696Z  rollout_state, 2025-09-07T07:03:23.8609289Z  (args.github_issue_owner, username), 2025-09-07T07:03:23.8609921Z  args.github_branch, 2025-09-07T07:03:23.8610523Z  args.eligible_experiments, 2025-09-07T07:03:23.8611154Z  args.opt_out_experiments, 2025-09-07T07:03:23.8611750Z  is_canary, 2025-09-07T07:03:23.8612258Z  ) 2025-09-07T07:03:23.8612794Z  2025-09-07T07:03:23.8613235Z  except Exception as e: 2025-09-07T07:03:23.8613788Z  log.error( 2025-09-07T07:03:23.8614579Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:03:23.8615414Z  ) 2025-09-07T07:03:23.8615992Z  2025-09-07T07:03:23.8616601Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:03:23.8617337Z  2025-09-07T07:03:23.8617744Z  2025-09-07T07:03:23.8618176Z if __name__ == "__main__": 2025-09-07T07:03:23.8618707Z  main() 2025-09-07T07:03:23.8619162Z  2025-09-07T07:03:23.8619568Z EOF 2025-09-07T07:03:23.8619993Z  2025-09-07T07:03:23.8620436Z cat runner_determinator.py 2025-09-07T07:03:24.0087171Z shell: /usr/bin/bash -e {0} 2025-09-07T07:03:24.0088047Z env: 2025-09-07T07:03:24.0088790Z GITHUB_TOKEN: *** 2025-09-07T07:03:24.0089268Z ISSUE_NUMBER: 5132 2025-09-07T07:03:24.0089770Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:03:24.0090362Z ISSUE_OWNER: 2025-09-07T07:03:24.0090809Z CHECK_EXPERIMENTS: 2025-09-07T07:03:24.0091301Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:03:24.0091797Z PR_NUMBER: 2025-09-07T07:03:24.0092256Z ##[endgroup] 2025-09-07T07:03:24.0295614Z # flake8: noqa: G004 2025-09-07T07:03:24.0295959Z 2025-09-07T07:03:24.0296404Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:03:24.0297374Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:03:24.0298185Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:03:24.0298628Z 2025-09-07T07:03:24.0298804Z """ 2025-09-07T07:03:24.0299393Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:03:24.0300272Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:03:24.0301195Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:03:24.0302029Z of which runners should be used to run which job. 2025-09-07T07:03:24.0302684Z 2025-09-07T07:03:24.0303089Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:03:24.0304195Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:03:24.0305102Z settings are considered to be empty with only the second part, the user 2025-09-07T07:03:24.0305814Z list, defined. 2025-09-07T07:03:24.0306041Z 2025-09-07T07:03:24.0306412Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:03:24.0307351Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:03:24.0308188Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:03:24.0308648Z 2025-09-07T07:03:24.0309022Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:03:24.0309906Z The user list is also a comma separated list of additional features or 2025-09-07T07:03:24.0310659Z experiments which the user could be opted in to. 2025-09-07T07:03:24.0311072Z 2025-09-07T07:03:24.0311287Z The user list has the following rules: 2025-09-07T07:03:24.0311639Z 2025-09-07T07:03:24.0311974Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:03:24.0313080Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:03:24.0313865Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:03:24.0314264Z 2025-09-07T07:03:24.0314442Z Example config: 2025-09-07T07:03:24.0314912Z # A list of experiments that can be opted into. 2025-09-07T07:03:24.0315585Z # This defines the behavior they'll induce when opted into. 2025-09-07T07:03:24.0316221Z # Expected syntax is: 2025-09-07T07:03:24.0316879Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:03:24.0317861Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:03:24.0318474Z 2025-09-07T07:03:24.0318656Z experiments: 2025-09-07T07:03:24.0319059Z lf: 2025-09-07T07:03:24.0319451Z rollout_percent: 25 2025-09-07T07:03:24.0319920Z all_branches: false 2025-09-07T07:03:24.0320553Z default: true 2025-09-07T07:03:24.0320975Z --- 2025-09-07T07:03:24.0321187Z 2025-09-07T07:03:24.0321366Z # Opt-ins: 2025-09-07T07:03:24.0321946Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:03:24.0323084Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:03:24.0323893Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:03:24.0324568Z # Experiments should be from the above list. 2025-09-07T07:03:24.0324957Z 2025-09-07T07:03:24.0325156Z @User1,-lf,split_build 2025-09-07T07:03:24.0325607Z @User2,lf 2025-09-07T07:03:24.0326016Z @User3,split_build 2025-09-07T07:03:24.0326442Z """ 2025-09-07T07:03:24.0326646Z 2025-09-07T07:03:24.0326822Z import json 2025-09-07T07:03:24.0327206Z import logging 2025-09-07T07:03:24.0327611Z import os 2025-09-07T07:03:24.0328000Z import random 2025-09-07T07:03:24.0328396Z import re 2025-09-07T07:03:24.0328791Z import sys 2025-09-07T07:03:24.0329208Z from argparse import ArgumentParser 2025-09-07T07:03:24.0329752Z from collections.abc import Iterable 2025-09-07T07:03:24.0330274Z from functools import cache 2025-09-07T07:03:24.0330757Z from logging import LogRecord 2025-09-07T07:03:24.0331250Z from typing import Any, NamedTuple 2025-09-07T07:03:24.0331798Z from urllib.request import Request, urlopen 2025-09-07T07:03:24.0332174Z 2025-09-07T07:03:24.0332348Z import yaml 2025-09-07T07:03:24.0333415Z from github import Auth, Github 2025-09-07T07:03:24.0333932Z from github.Issue import Issue 2025-09-07T07:03:24.0334246Z 2025-09-07T07:03:24.0334255Z 2025-09-07T07:03:24.0334480Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:03:24.0335184Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:03:24.0336067Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:03:24.0336634Z 2025-09-07T07:03:24.0336865Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:03:24.0337608Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:03:24.0338144Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:03:24.0338709Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:03:24.0339072Z 2025-09-07T07:03:24.0339282Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:03:24.0339616Z 2025-09-07T07:03:24.0339818Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:03:24.0340292Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:03:24.0340595Z 2025-09-07T07:03:24.0340602Z 2025-09-07T07:03:24.0340795Z class Experiment(NamedTuple): 2025-09-07T07:03:24.0341297Z rollout_perc: float = ( 2025-09-07T07:03:24.0341962Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:03:24.0342851Z ) 2025-09-07T07:03:24.0343245Z all_branches: bool = ( 2025-09-07T07:03:24.0343887Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:03:24.0344570Z ) 2025-09-07T07:03:24.0344952Z default: bool = ( 2025-09-07T07:03:24.0345530Z True # If True, the experiment is enabled by default for all queries 2025-09-07T07:03:24.0346192Z ) 2025-09-07T07:03:24.0346393Z 2025-09-07T07:03:24.0346579Z # Add more fields as needed 2025-09-07T07:03:24.0346885Z 2025-09-07T07:03:24.0346892Z 2025-09-07T07:03:24.0347084Z class Settings(NamedTuple): 2025-09-07T07:03:24.0347532Z """ 2025-09-07T07:03:24.0347990Z Settings for the experiments that can be opted into. 2025-09-07T07:03:24.0348574Z """ 2025-09-07T07:03:24.0348778Z 2025-09-07T07:03:24.0348999Z experiments: dict[str, Experiment] = {} 2025-09-07T07:03:24.0349374Z 2025-09-07T07:03:24.0349381Z 2025-09-07T07:03:24.0349601Z class ColorFormatter(logging.Formatter): 2025-09-07T07:03:24.0350240Z """Color codes the log messages based on the log level""" 2025-09-07T07:03:24.0350683Z 2025-09-07T07:03:24.0350855Z COLORS = { 2025-09-07T07:03:24.0351268Z "WARNING": "\033[33m", # Yellow 2025-09-07T07:03:24.0351934Z "ERROR": "\033[31m", # Red 2025-09-07T07:03:24.0352618Z "CRITICAL": "\033[31m", # Red 2025-09-07T07:03:24.0353152Z "INFO": "\033[0m", # Reset 2025-09-07T07:03:24.0353648Z "DEBUG": "\033[0m", # Reset 2025-09-07T07:03:24.0354127Z } 2025-09-07T07:03:24.0354329Z 2025-09-07T07:03:24.0354555Z def format(self, record: LogRecord) -> str: 2025-09-07T07:03:24.0355308Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:03:24.0356095Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:03:24.0356688Z return super().format(record) 2025-09-07T07:03:24.0357026Z 2025-09-07T07:03:24.0357033Z 2025-09-07T07:03:24.0357239Z handler = logging.StreamHandler() 2025-09-07T07:03:24.0357949Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:03:24.0358497Z 2025-09-07T07:03:24.0358746Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:03:24.0359343Z log.addHandler(handler) 2025-09-07T07:03:24.0359810Z log.setLevel(logging.INFO) 2025-09-07T07:03:24.0360106Z 2025-09-07T07:03:24.0360113Z 2025-09-07T07:03:24.0360369Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:03:24.0360943Z """ 2025-09-07T07:03:24.0361458Z Defines outputs of the github action that invokes this script 2025-09-07T07:03:24.0362094Z """ 2025-09-07T07:03:24.0362667Z if not GITHUB_OUTPUT: 2025-09-07T07:03:24.0363788Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:03:24.0364904Z log.warning( 2025-09-07T07:03:24.0365757Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:03:24.0366695Z ) 2025-09-07T07:03:24.0376957Z print(f"::set-output name={key}::{value}") 2025-09-07T07:03:24.0377595Z return 2025-09-07T07:03:24.0377833Z 2025-09-07T07:03:24.0378233Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:03:24.0378849Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:03:24.0379443Z f.write(f"{key}={value}\n") 2025-09-07T07:03:24.0379781Z 2025-09-07T07:03:24.0379789Z 2025-09-07T07:03:24.0380097Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:03:24.0380747Z return frozenset( 2025-09-07T07:03:24.0381372Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:03:24.0382088Z ) 2025-09-07T07:03:24.0382290Z 2025-09-07T07:03:24.0382298Z 2025-09-07T07:03:24.0382754Z def parse_args() -> Any: 2025-09-07T07:03:24.0383365Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:03:24.0384256Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:03:24.0385069Z parser.add_argument( 2025-09-07T07:03:24.0385551Z "--github-issue-repo", 2025-09-07T07:03:24.0386015Z type=str, 2025-09-07T07:03:24.0386448Z required=False, 2025-09-07T07:03:24.0386911Z default="pytorch/test-infra", 2025-09-07T07:03:24.0387472Z help="GitHub repo to get the issue", 2025-09-07T07:03:24.0388002Z ) 2025-09-07T07:03:24.0388391Z parser.add_argument( 2025-09-07T07:03:24.0388852Z "--github-repo", 2025-09-07T07:03:24.0389299Z type=str, 2025-09-07T07:03:24.0389704Z required=True, 2025-09-07T07:03:24.0390185Z help="GitHub repo where CI is running", 2025-09-07T07:03:24.0390734Z ) 2025-09-07T07:03:24.0391122Z parser.add_argument( 2025-09-07T07:03:24.0391743Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:03:24.0392584Z ) 2025-09-07T07:03:24.0392995Z parser.add_argument( 2025-09-07T07:03:24.0393627Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:03:24.0394321Z ) 2025-09-07T07:03:24.0394691Z parser.add_argument( 2025-09-07T07:03:24.0395510Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:03:24.0396219Z ) 2025-09-07T07:03:24.0396601Z parser.add_argument( 2025-09-07T07:03:24.0397270Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:03:24.0397994Z ) 2025-09-07T07:03:24.0398390Z parser.add_argument( 2025-09-07T07:03:24.0398857Z "--github-ref-type", 2025-09-07T07:03:24.0399322Z type=str, 2025-09-07T07:03:24.0399728Z required=True, 2025-09-07T07:03:24.0400229Z help="Current GitHub ref type, branch or tag", 2025-09-07T07:03:24.0400793Z ) 2025-09-07T07:03:24.0401182Z parser.add_argument( 2025-09-07T07:03:24.0401644Z "--eligible-experiments", 2025-09-07T07:03:24.0402178Z type=_str_comma_separated_to_set, 2025-09-07T07:03:24.0402943Z required=False, 2025-09-07T07:03:24.0403381Z default="", 2025-09-07T07:03:24.0404255Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:03:24.0405209Z ) 2025-09-07T07:03:24.0405595Z parser.add_argument( 2025-09-07T07:03:24.0455712Z "--opt-out-experiments", 2025-09-07T07:03:24.0456880Z type=_str_comma_separated_to_set, 2025-09-07T07:03:24.0457891Z required=False, 2025-09-07T07:03:24.0458376Z default="", 2025-09-07T07:03:24.0458777Z help=( 2025-09-07T07:03:24.0459484Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:03:24.0460681Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:03:24.0461563Z ), 2025-09-07T07:03:24.0461940Z ) 2025-09-07T07:03:24.0462319Z parser.add_argument( 2025-09-07T07:03:24.0463028Z "--pr-number", 2025-09-07T07:03:24.0463462Z type=str, 2025-09-07T07:03:24.0463877Z required=False, 2025-09-07T07:03:24.0464333Z default="", 2025-09-07T07:03:24.0465011Z help="the optional PR number where this is run", 2025-09-07T07:03:24.0465588Z ) 2025-09-07T07:03:24.0465802Z 2025-09-07T07:03:24.0466006Z return parser.parse_args() 2025-09-07T07:03:24.0466317Z 2025-09-07T07:03:24.0466323Z 2025-09-07T07:03:24.0466744Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:03:24.0467505Z auth = Auth.Token(github_token) 2025-09-07T07:03:24.0468032Z return Github(auth=auth) 2025-09-07T07:03:24.0468331Z 2025-09-07T07:03:24.0468338Z 2025-09-07T07:03:24.0468793Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:03:24.0469605Z repo = gh.get_repo(repo) 2025-09-07T07:03:24.0470158Z return repo.get_issue(number=issue_num) 2025-09-07T07:03:24.0470538Z 2025-09-07T07:03:24.0470544Z 2025-09-07T07:03:24.0470744Z def get_potential_pr_author( 2025-09-07T07:03:24.0471398Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:03:24.0472085Z ) -> str: 2025-09-07T07:03:24.0472858Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:03:24.0473692Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:03:24.0474430Z # embedded in the tag name: ciflow// 2025-09-07T07:03:24.0474847Z 2025-09-07T07:03:24.0475058Z gh = get_gh_client(github_token) 2025-09-07T07:03:24.0475384Z 2025-09-07T07:03:24.0475646Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:03:24.0476275Z split_tag = ref_name.split("/") 2025-09-07T07:03:24.0476777Z if ( 2025-09-07T07:03:24.0477172Z len(split_tag) == 3 2025-09-07T07:03:24.0477653Z and split_tag[0] == "ciflow" 2025-09-07T07:03:24.0478177Z and split_tag[2].isnumeric() 2025-09-07T07:03:24.0478681Z ): 2025-09-07T07:03:24.0479070Z pr_number = split_tag[2] 2025-09-07T07:03:24.0479725Z try: 2025-09-07T07:03:24.0480168Z repository = gh.get_repo(repo) 2025-09-07T07:03:24.0480792Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:03:24.0481395Z except Exception as e: 2025-09-07T07:03:24.0481925Z raise Exception( # noqa: TRY002 2025-09-07T07:03:24.0482818Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:03:24.0483506Z ) from e 2025-09-07T07:03:24.0484046Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:03:24.0484743Z # In all other cases, return the original input username 2025-09-07T07:03:24.0485337Z return username 2025-09-07T07:03:24.0485573Z 2025-09-07T07:03:24.0485580Z 2025-09-07T07:03:24.0485808Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:03:24.0486351Z """ 2025-09-07T07:03:24.0486992Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:03:24.0487781Z """ 2025-09-07T07:03:24.0488332Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:03:24.0488856Z 2025-09-07T07:03:24.0488863Z 2025-09-07T07:03:24.0489073Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:03:24.0489572Z try: 2025-09-07T07:03:24.0489969Z data = yaml.safe_load(yaml_text) 2025-09-07T07:03:24.0490485Z return data 2025-09-07T07:03:24.0490910Z except yaml.YAMLError: 2025-09-07T07:03:24.0491403Z log.exception("Error loading YAML") 2025-09-07T07:03:24.0491910Z raise 2025-09-07T07:03:24.0492128Z 2025-09-07T07:03:24.0492135Z 2025-09-07T07:03:24.0492756Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:03:24.0493532Z """ 2025-09-07T07:03:24.0494162Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:03:24.0494769Z 2025-09-07T07:03:24.0495280Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:03:24.0496037Z and the text below is the list of opted in users. 2025-09-07T07:03:24.0496443Z 2025-09-07T07:03:24.0496818Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:03:24.0497514Z """ 2025-09-07T07:03:24.0497963Z rollout_state_parts = rollout_state.split("---") 2025-09-07T07:03:24.0498598Z if len(rollout_state_parts) >= 2: 2025-09-07T07:03:24.0499237Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:03:24.0499861Z else: 2025-09-07T07:03:24.0500275Z return "", rollout_state 2025-09-07T07:03:24.0500594Z 2025-09-07T07:03:24.0500602Z 2025-09-07T07:03:24.0500825Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:03:24.0501361Z """ 2025-09-07T07:03:24.0502024Z Dictionary of users with a list of features they have opted into 2025-09-07T07:03:24.0502936Z """ 2025-09-07T07:03:24.0503170Z 2025-09-07T07:03:24.0503188Z 2025-09-07T07:03:24.0503555Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:03:24.0504249Z """ 2025-09-07T07:03:24.0504987Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:03:24.0505678Z 2025-09-07T07:03:24.0506322Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:03:24.0507335Z - Example line: "@User1,lf,split_build" 2025-09-07T07:03:24.0508054Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:03:24.0508546Z 2025-09-07T07:03:24.0508552Z 2025-09-07T07:03:24.0508737Z """ 2025-09-07T07:03:24.0509145Z optins = UserOptins() 2025-09-07T07:03:24.0509670Z for user in user_optin_text.split("\n"): 2025-09-07T07:03:24.0510254Z user = user.strip("\r\n\t -") 2025-09-07T07:03:24.0510834Z if not user or not user.startswith("@"): 2025-09-07T07:03:24.0511582Z # Not a valid user. Skip 2025-09-07T07:03:24.0512105Z continue 2025-09-07T07:03:24.0512363Z 2025-09-07T07:03:24.0512763Z if user: 2025-09-07T07:03:24.0513254Z usr_name = user.split(",")[0].strip("@") 2025-09-07T07:03:24.0513987Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:03:24.0514492Z 2025-09-07T07:03:24.0514686Z return optins 2025-09-07T07:03:24.0514938Z 2025-09-07T07:03:24.0514952Z 2025-09-07T07:03:24.0515259Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:03:24.0515898Z """ 2025-09-07T07:03:24.0516336Z Check if the experiment name is valid. 2025-09-07T07:03:24.0516885Z A valid name: 2025-09-07T07:03:24.0517556Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:03:24.0518541Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:03:24.0519309Z - Cannot contain spaces 2025-09-07T07:03:24.0519810Z """ 2025-09-07T07:03:24.0520022Z 2025-09-07T07:03:24.0520299Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:03:24.0521042Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:03:24.0521502Z 2025-09-07T07:03:24.0521686Z if valid: 2025-09-07T07:03:24.0522107Z return True 2025-09-07T07:03:24.0522361Z 2025-09-07T07:03:24.0522749Z log.error( 2025-09-07T07:03:24.0524260Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T07:03:24.0525878Z ) 2025-09-07T07:03:24.0526268Z return False 2025-09-07T07:03:24.0526527Z 2025-09-07T07:03:24.0526534Z 2025-09-07T07:03:24.0526853Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:03:24.0527511Z """ 2025-09-07T07:03:24.0528301Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:03:24.0529093Z """ 2025-09-07T07:03:24.0529479Z try: 2025-09-07T07:03:24.0529893Z if settings_text: 2025-09-07T07:03:24.0530656Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:03:24.0531491Z # for easy reading 2025-09-07T07:03:24.0532311Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:03:24.0533786Z # the backtick character in shell commands. 2025-09-07T07:03:24.0534436Z backtick = chr(96) # backtick character 2025-09-07T07:03:24.0535127Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:03:24.0535830Z settings = load_yaml(settings_text) 2025-09-07T07:03:24.0536233Z 2025-09-07T07:03:24.0536672Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:03:24.0537472Z experiments = {} 2025-09-07T07:03:24.0537784Z 2025-09-07T07:03:24.0538184Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:03:24.0538990Z if not is_valid_experiment_name(exp_name): 2025-09-07T07:03:24.0540138Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T07:03:24.0541221Z continue 2025-09-07T07:03:24.0541528Z 2025-09-07T07:03:24.0541729Z valid_settings = {} 2025-09-07T07:03:24.0542288Z for setting in exp_settings: 2025-09-07T07:03:24.0543009Z if setting not in Experiment._fields: 2025-09-07T07:03:24.0543606Z log.warning( 2025-09-07T07:03:24.0544343Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:03:24.0545265Z ) 2025-09-07T07:03:24.0545726Z else: 2025-09-07T07:03:24.0546277Z valid_settings[setting] = exp_settings[setting] 2025-09-07T07:03:24.0546718Z 2025-09-07T07:03:24.0547010Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:03:24.0547684Z return Settings(experiments) 2025-09-07T07:03:24.0548052Z 2025-09-07T07:03:24.0548253Z except Exception: 2025-09-07T07:03:24.0548758Z log.exception("Failed to parse settings") 2025-09-07T07:03:24.0549170Z 2025-09-07T07:03:24.0549358Z return Settings() 2025-09-07T07:03:24.0549626Z 2025-09-07T07:03:24.0549633Z 2025-09-07T07:03:24.0549895Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:03:24.0550500Z """ 2025-09-07T07:03:24.0550974Z Parse settings, if any, from the rollout state. 2025-09-07T07:03:24.0551398Z 2025-09-07T07:03:24.0551765Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:03:24.0552692Z and the text below is the list of opted in users. 2025-09-07T07:03:24.0553126Z 2025-09-07T07:03:24.0553559Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:03:24.0554342Z """ 2025-09-07T07:03:24.0554924Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:03:24.0555727Z return parse_settings_from_text(settings_text) 2025-09-07T07:03:24.0556145Z 2025-09-07T07:03:24.0556151Z 2025-09-07T07:03:24.0556421Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:03:24.0557016Z """ 2025-09-07T07:03:24.0557445Z Parse users from the rollout state. 2025-09-07T07:03:24.0557814Z 2025-09-07T07:03:24.0557992Z """ 2025-09-07T07:03:24.0558558Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:03:24.0559334Z return parse_user_opt_in_from_text(users_text) 2025-09-07T07:03:24.0559758Z 2025-09-07T07:03:24.0559772Z 2025-09-07T07:03:24.0560367Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:03:24.0561171Z """ 2025-09-07T07:03:24.0561626Z Check if a user is opted into an experiment 2025-09-07T07:03:24.0562202Z """ 2025-09-07T07:03:24.0562792Z return experiment_name in user_optins.get(user, []) 2025-09-07T07:03:24.0563249Z 2025-09-07T07:03:24.0563257Z 2025-09-07T07:03:24.0563705Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:03:24.0564506Z """ 2025-09-07T07:03:24.0565013Z Check if a user explicitly opted out of an experiment 2025-09-07T07:03:24.0565642Z """ 2025-09-07T07:03:24.0566182Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:03:24.0566914Z experiment_optout = "-" + experiment_name 2025-09-07T07:03:24.0567592Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:03:24.0568243Z return False 2025-09-07T07:03:24.0568521Z 2025-09-07T07:03:24.0568820Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:03:24.0569474Z log.warning( 2025-09-07T07:03:24.0570368Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:03:24.0571300Z ) 2025-09-07T07:03:24.0571523Z 2025-09-07T07:03:24.0571716Z return True 2025-09-07T07:03:24.0571968Z 2025-09-07T07:03:24.0571974Z 2025-09-07T07:03:24.0572171Z def get_runner_prefix( 2025-09-07T07:03:24.0572749Z rollout_state: str, 2025-09-07T07:03:24.0573245Z workflow_requestors: Iterable[str], 2025-09-07T07:03:24.0573807Z branch: str, 2025-09-07T07:03:24.0574336Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:03:24.0575051Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:03:24.0575688Z is_canary: bool = False, 2025-09-07T07:03:24.0576183Z ) -> str: 2025-09-07T07:03:24.0576646Z settings = parse_settings(rollout_state) 2025-09-07T07:03:24.0577422Z user_optins = parse_users(rollout_state) 2025-09-07T07:03:24.0577817Z 2025-09-07T07:03:24.0578015Z fleet_prefix = "" 2025-09-07T07:03:24.0578474Z prefixes = [] 2025-09-07T07:03:24.0579150Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:03:24.0580140Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:03:24.0580911Z log.info( 2025-09-07T07:03:24.0581639Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:03:24.0582555Z ) 2025-09-07T07:03:24.0582986Z continue 2025-09-07T07:03:24.0583251Z 2025-09-07T07:03:24.0583456Z if opt_out_experiments: 2025-09-07T07:03:24.0584045Z if experiment_name in opt_out_experiments: 2025-09-07T07:03:24.0584745Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:03:24.0585404Z log.info( 2025-09-07T07:03:24.0586417Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:03:24.0587491Z ) 2025-09-07T07:03:24.0587943Z continue 2025-09-07T07:03:24.0588235Z 2025-09-07T07:03:24.0588447Z if eligible_experiments: 2025-09-07T07:03:24.0589086Z if experiment_name not in eligible_experiments: 2025-09-07T07:03:24.0589777Z exp_list = ", ".join(eligible_experiments) 2025-09-07T07:03:24.0590405Z log.info( 2025-09-07T07:03:24.0591264Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:03:24.0592187Z ) 2025-09-07T07:03:24.0592736Z continue 2025-09-07T07:03:24.0593256Z elif not experiment_settings.default: 2025-09-07T07:03:24.0593846Z log.info( 2025-09-07T07:03:24.0594688Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:03:24.0595523Z ) 2025-09-07T07:03:24.0595943Z continue 2025-09-07T07:03:24.0596220Z 2025-09-07T07:03:24.0596525Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:03:24.0597201Z opted_out_users = [ 2025-09-07T07:03:24.0597692Z requestor 2025-09-07T07:03:24.0598194Z for requestor in workflow_requestors 2025-09-07T07:03:24.0598918Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:03:24.0599610Z ] 2025-09-07T07:03:24.0599836Z 2025-09-07T07:03:24.0600034Z if opted_out_users: 2025-09-07T07:03:24.0600532Z log.info( 2025-09-07T07:03:24.0601197Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:03:24.0601962Z ) 2025-09-07T07:03:24.0602385Z continue 2025-09-07T07:03:24.0602767Z 2025-09-07T07:03:24.0603073Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:03:24.0603760Z opted_in_users = [ 2025-09-07T07:03:24.0604249Z requestor 2025-09-07T07:03:24.0604745Z for requestor in workflow_requestors 2025-09-07T07:03:24.0605463Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:03:24.0606146Z ] 2025-09-07T07:03:24.0606370Z 2025-09-07T07:03:24.0606563Z enabled = False 2025-09-07T07:03:24.0607038Z if opted_in_users: 2025-09-07T07:03:24.0607522Z log.info( 2025-09-07T07:03:24.0608172Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:03:24.0608927Z ) 2025-09-07T07:03:24.0609350Z enabled = True 2025-09-07T07:03:24.0609658Z 2025-09-07T07:03:24.0609897Z elif experiment_settings.rollout_perc: 2025-09-07T07:03:24.0610807Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:03:24.0611951Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:03:24.0612778Z log.info( 2025-09-07T07:03:24.0613715Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:03:24.0614700Z ) 2025-09-07T07:03:24.0615141Z enabled = True 2025-09-07T07:03:24.0615466Z 2025-09-07T07:03:24.0615652Z if enabled: 2025-09-07T07:03:24.0616108Z label = experiment_name 2025-09-07T07:03:24.0616702Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:03:24.0617588Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:03:24.0618523Z # - If it's enabled, then we always list it's prefix first 2025-09-07T07:03:24.0619340Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:03:24.0620054Z if is_canary: 2025-09-07T07:03:24.0620582Z label += CANARY_FLEET_SUFFIX 2025-09-07T07:03:24.0621172Z fleet_prefix = label 2025-09-07T07:03:24.0621707Z else: 2025-09-07T07:03:24.0622170Z prefixes.append(label) 2025-09-07T07:03:24.0622639Z 2025-09-07T07:03:24.0622851Z if len(prefixes) > 1: 2025-09-07T07:03:24.0623351Z log.error( 2025-09-07T07:03:24.0624441Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T07:03:24.0625623Z ) 2025-09-07T07:03:24.0626044Z prefixes = prefixes[:1] 2025-09-07T07:03:24.0626377Z 2025-09-07T07:03:24.0626580Z # Fleet always comes first 2025-09-07T07:03:24.0627083Z if fleet_prefix: 2025-09-07T07:03:24.0627569Z prefixes.insert(0, fleet_prefix) 2025-09-07T07:03:24.0627956Z 2025-09-07T07:03:24.0628351Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:03:24.0628796Z 2025-09-07T07:03:24.0628804Z 2025-09-07T07:03:24.0629283Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:03:24.0630112Z """ 2025-09-07T07:03:24.0630736Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:03:24.0631335Z 2025-09-07T07:03:24.0631741Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:03:24.0632595Z """ 2025-09-07T07:03:24.0633030Z gh = get_gh_client(github_token) 2025-09-07T07:03:24.0633622Z issue = get_issue(gh, repo, issue_num) 2025-09-07T07:03:24.0634301Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:03:24.0634780Z 2025-09-07T07:03:24.0634787Z 2025-09-07T07:03:24.0635215Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:03:24.0636030Z for _ in range(num_retries): 2025-09-07T07:03:24.0636554Z try: 2025-09-07T07:03:24.0637017Z req = Request(url=url, headers=headers) 2025-09-07T07:03:24.0637719Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:03:24.0638412Z return json.loads(content) 2025-09-07T07:03:24.0638977Z except Exception as e: 2025-09-07T07:03:24.0639552Z log.warning(f"Could not download {url}: {e}") 2025-09-07T07:03:24.0639978Z 2025-09-07T07:03:24.0640381Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:03:24.0641143Z return {} 2025-09-07T07:03:24.0641387Z 2025-09-07T07:03:24.0641394Z 2025-09-07T07:03:24.0641576Z @cache 2025-09-07T07:03:24.0642237Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:03:24.0643153Z """ 2025-09-07T07:03:24.0643588Z Dynamically get PR information 2025-09-07T07:03:24.0644121Z """ 2025-09-07T07:03:24.0644787Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:03:24.0645462Z headers = { 2025-09-07T07:03:24.0645955Z "Accept": "application/vnd.github.v3+json", 2025-09-07T07:03:24.0646598Z "Authorization": f"token {github_token}", 2025-09-07T07:03:24.0647169Z } 2025-09-07T07:03:24.0647634Z json_response: dict[str, Any] = download_json( 2025-09-07T07:03:24.0648282Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:03:24.0648869Z headers=headers, 2025-09-07T07:03:24.0649339Z ) 2025-09-07T07:03:24.0649556Z 2025-09-07T07:03:24.0649758Z if not json_response: 2025-09-07T07:03:24.0650363Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:03:24.0651012Z return {} 2025-09-07T07:03:24.0651267Z 2025-09-07T07:03:24.0651467Z return json_response 2025-09-07T07:03:24.0651757Z 2025-09-07T07:03:24.0651764Z 2025-09-07T07:03:24.0652189Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:03:24.0653068Z """ 2025-09-07T07:03:24.0653652Z Dynamically get the latest list of labels from the pull request 2025-09-07T07:03:24.0654348Z """ 2025-09-07T07:03:24.0654870Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:03:24.0655518Z return { 2025-09-07T07:03:24.0656138Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:03:24.0656876Z } 2025-09-07T07:03:24.0657099Z 2025-09-07T07:03:24.0657106Z 2025-09-07T07:03:24.0657297Z def main() -> None: 2025-09-07T07:03:24.0657755Z args = parse_args() 2025-09-07T07:03:24.0658041Z 2025-09-07T07:03:24.0658280Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:03:24.0658681Z 2025-09-07T07:03:24.0658896Z # Check if the PR is opt-out 2025-09-07T07:03:24.0659418Z if args.pr_number: 2025-09-07T07:03:24.0660103Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:03:24.0661022Z if OPT_OUT_LABEL in labels: 2025-09-07T07:03:24.0661568Z log.info( 2025-09-07T07:03:24.0662290Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:03:24.0663211Z ) 2025-09-07T07:03:24.0663793Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:03:24.0664501Z sys.exit() 2025-09-07T07:03:24.0664783Z 2025-09-07T07:03:24.0664965Z try: 2025-09-07T07:03:24.0665429Z rollout_state = get_rollout_state_from_issue( 2025-09-07T07:03:24.0666174Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:03:24.0666874Z ) 2025-09-07T07:03:24.0667102Z 2025-09-07T07:03:24.0667327Z username = get_potential_pr_author( 2025-09-07T07:03:24.0667903Z args.github_token, 2025-09-07T07:03:24.0668417Z args.github_repo, 2025-09-07T07:03:24.0668929Z args.github_actor, 2025-09-07T07:03:24.0669444Z args.github_ref_type, 2025-09-07T07:03:24.0670011Z args.github_branch, 2025-09-07T07:03:24.0670507Z ) 2025-09-07T07:03:24.0670733Z 2025-09-07T07:03:24.0671028Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:03:24.0671492Z 2025-09-07T07:03:24.0671728Z runner_label_prefix = get_runner_prefix( 2025-09-07T07:03:24.0672318Z rollout_state, 2025-09-07T07:03:24.0672943Z (args.github_issue_owner, username), 2025-09-07T07:03:24.0673535Z args.github_branch, 2025-09-07T07:03:24.0674066Z args.eligible_experiments, 2025-09-07T07:03:24.0674634Z args.opt_out_experiments, 2025-09-07T07:03:24.0675182Z is_canary, 2025-09-07T07:03:24.0675632Z ) 2025-09-07T07:03:24.0675863Z 2025-09-07T07:03:24.0676067Z except Exception as e: 2025-09-07T07:03:24.0676549Z log.error( 2025-09-07T07:03:24.0677257Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:03:24.0678208Z ) 2025-09-07T07:03:24.0678436Z 2025-09-07T07:03:24.0678784Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:03:24.0679302Z 2025-09-07T07:03:24.0679316Z 2025-09-07T07:03:24.0679515Z if __name__ == "__main__": 2025-09-07T07:03:24.0679988Z main() 2025-09-07T07:03:24.0680219Z 2025-09-07T07:03:24.0770849Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:03:24.0771741Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:03:24.0802227Z shell: /usr/bin/bash -e {0} 2025-09-07T07:03:24.0803041Z env: 2025-09-07T07:03:24.0803682Z GITHUB_TOKEN: *** 2025-09-07T07:03:24.0804090Z ISSUE_NUMBER: 5132 2025-09-07T07:03:24.0804540Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:03:24.0805046Z ISSUE_OWNER: 2025-09-07T07:03:24.0805456Z CHECK_EXPERIMENTS: 2025-09-07T07:03:24.0805900Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:03:24.0806341Z PR_NUMBER: 2025-09-07T07:03:24.0806739Z ##[endgroup] 2025-09-07T07:03:26.7164661Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T07:03:27.9930544Z Collecting urllib3==1.26.18 2025-09-07T07:03:28.0278713Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T07:03:28.0496557Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 5.2 MB/s eta 0:00:00 2025-09-07T07:03:28.0727513Z Collecting PyGithub==2.3.0 2025-09-07T07:03:28.0768067Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T07:03:28.1200373Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T07:03:28.1230558Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-09-07T07:03:28.1278678Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T07:03:28.1291348Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-09-07T07:03:28.1312128Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T07:03:28.1554686Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T07:03:28.1583345Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T07:03:28.1809443Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-09-07T07:03:28.2950421Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:03:28.2980380Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T07:03:28.4170341Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T07:03:28.4198549Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T07:03:28.4367027Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:03:28.4394638Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T07:03:28.4613975Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T07:03:28.4686966Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 24.7 MB/s eta 0:00:00 2025-09-07T07:03:28.4713798Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T07:03:28.4808495Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 45.1 MB/s eta 0:00:00 2025-09-07T07:03:28.4837613Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T07:03:28.4973206Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 71.8 MB/s eta 0:00:00 2025-09-07T07:03:28.4999767Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T07:03:28.5047182Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T07:03:28.5124792Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 76.3 MB/s eta 0:00:00 2025-09-07T07:03:28.5151673Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T07:03:28.5190797Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.7 MB/s eta 0:00:00 2025-09-07T07:03:28.5217439Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T07:03:28.5266550Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 32.7 MB/s eta 0:00:00 2025-09-07T07:03:28.8770491Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T07:03:29.4064484Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-09-07T07:03:29.4832347Z ##[group]Run curr_branch="main" 2025-09-07T07:03:29.4832829Z curr_branch="main" 2025-09-07T07:03:29.4833042Z curr_ref_type="branch" 2025-09-07T07:03:29.4833319Z echo "Current branch is '$curr_branch'" 2025-09-07T07:03:29.4833568Z  2025-09-07T07:03:29.4833757Z python3 runner_determinator.py \ 2025-09-07T07:03:29.4834047Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T07:03:29.4834328Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T07:03:29.4834584Z  --github-branch "$curr_branch" \ 2025-09-07T07:03:29.4834842Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T07:03:29.4835120Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T07:03:29.4835389Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T07:03:29.4835658Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T07:03:29.4835949Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T07:03:29.4836316Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T07:03:29.4836606Z  --pr-number "${PR_NUMBER}" 2025-09-07T07:03:29.4867590Z shell: /usr/bin/bash -e {0} 2025-09-07T07:03:29.4867815Z env: 2025-09-07T07:03:29.4868370Z GITHUB_TOKEN: *** 2025-09-07T07:03:29.4868568Z ISSUE_NUMBER: 5132 2025-09-07T07:03:29.4868773Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:03:29.4869019Z ISSUE_OWNER: 2025-09-07T07:03:29.4869195Z CHECK_EXPERIMENTS: 2025-09-07T07:03:29.4869393Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:03:29.4869588Z PR_NUMBER: 2025-09-07T07:03:29.4869747Z ##[endgroup] 2025-09-07T07:03:29.4917583Z Current branch is 'main' 2025-09-07T07:03:31.0815187Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-09-07T07:03:31.0816434Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T07:03:31.0817445Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T07:03:31.0818435Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T07:03:31.0819225Z INFO : Setting output: label-type='' 2025-09-07T07:03:31.1130514Z Evaluate and set job outputs 2025-09-07T07:03:31.1137226Z Cleaning up orphan processes