2025-11-03T15:43:04.7783577Z Current runner version: '2.329.0' 2025-11-03T15:43:04.7807194Z ##[group]Runner Image Provisioner 2025-11-03T15:43:04.7808134Z Hosted Compute Agent 2025-11-03T15:43:04.7808668Z Version: 20251016.436 2025-11-03T15:43:04.7809279Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:04.7809992Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:04.7810609Z ##[endgroup] 2025-11-03T15:43:04.7811137Z ##[group]Operating System 2025-11-03T15:43:04.7811750Z Ubuntu 2025-11-03T15:43:04.7812213Z 24.04.3 2025-11-03T15:43:04.7812676Z LTS 2025-11-03T15:43:04.7813082Z ##[endgroup] 2025-11-03T15:43:04.7813656Z ##[group]Runner Image 2025-11-03T15:43:04.7814238Z Image: ubuntu-24.04 2025-11-03T15:43:04.7814690Z Version: 20251030.96.2 2025-11-03T15:43:04.7815990Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:04.7817505Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:04.7818543Z ##[endgroup] 2025-11-03T15:43:04.7819668Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:04.7821808Z Contents: read 2025-11-03T15:43:04.7822364Z Metadata: read 2025-11-03T15:43:04.7822830Z Packages: read 2025-11-03T15:43:04.7823457Z ##[endgroup] 2025-11-03T15:43:04.7825676Z Secret source: Actions 2025-11-03T15:43:04.7826394Z Prepare workflow directory 2025-11-03T15:43:04.8335641Z Prepare all required actions 2025-11-03T15:43:04.8391009Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:04.8396061Z ##[group] Inputs 2025-11-03T15:43:04.8396686Z check_experiments: 2025-11-03T15:43:04.8397214Z opt_out_experiments: 2025-11-03T15:43:04.8397901Z triggering_actor: pytorchmergebot 2025-11-03T15:43:04.8398489Z issue_owner: 2025-11-03T15:43:04.8398992Z curr_branch: main 2025-11-03T15:43:04.8399647Z curr_ref_type: branch 2025-11-03T15:43:04.8400259Z issue_number: 5132 2025-11-03T15:43:04.8400813Z ##[endgroup] 2025-11-03T15:43:04.8401441Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:04.8996246Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:04.8998560Z cat < runner_determinator.py 2025-11-03T15:43:04.8999243Z # flake8: noqa: G004 2025-11-03T15:43:04.8999744Z  2025-11-03T15:43:04.9000588Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:04.9001618Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:04.9002548Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:04.9003337Z  2025-11-03T15:43:04.9003746Z """ 2025-11-03T15:43:04.9004436Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:04.9005684Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:04.9006895Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:04.9007872Z of which runners should be used to run which job. 2025-11-03T15:43:04.9008565Z  2025-11-03T15:43:04.9009219Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:04.9010289Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:04.9011307Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:04.9012115Z list, defined. 2025-11-03T15:43:04.9012672Z  2025-11-03T15:43:04.9013326Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:04.9014402Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:04.9015763Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:04.9016726Z  2025-11-03T15:43:04.9017454Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:04.9018402Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:04.9019376Z experiments which the user could be opted in to. 2025-11-03T15:43:04.9020037Z  2025-11-03T15:43:04.9021014Z The user list has the following rules: 2025-11-03T15:43:04.9022242Z  2025-11-03T15:43:04.9022940Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:04.9023896Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:04.9025073Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:04.9025786Z  2025-11-03T15:43:04.9026231Z Example config: 2025-11-03T15:43:04.9026895Z  # A list of experiments that can be opted into. 2025-11-03T15:43:04.9027757Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:04.9028546Z  # Expected syntax is: 2025-11-03T15:43:04.9029421Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:04.9030512Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:04.9031348Z  2025-11-03T15:43:04.9031868Z  experiments: 2025-11-03T15:43:04.9032386Z  lf: 2025-11-03T15:43:04.9032884Z  rollout_percent: 25 2025-11-03T15:43:04.9033473Z  all_branches: false 2025-11-03T15:43:04.9034075Z  default: true 2025-11-03T15:43:04.9034611Z  --- 2025-11-03T15:43:04.9035202Z  2025-11-03T15:43:04.9035706Z  # Opt-ins: 2025-11-03T15:43:04.9036396Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:04.9037616Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:04.9038527Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:04.9039314Z  # Experiments should be from the above list. 2025-11-03T15:43:04.9039999Z  2025-11-03T15:43:04.9040482Z  @User1,-lf,split_build 2025-11-03T15:43:04.9041090Z  @User2,lf 2025-11-03T15:43:04.9041574Z  @User3,split_build 2025-11-03T15:43:04.9042200Z """ 2025-11-03T15:43:04.9042623Z  2025-11-03T15:43:04.9043064Z import json 2025-11-03T15:43:04.9043691Z import logging 2025-11-03T15:43:04.9044265Z import os 2025-11-03T15:43:04.9044760Z import random 2025-11-03T15:43:04.9045464Z import re 2025-11-03T15:43:04.9045968Z import sys 2025-11-03T15:43:04.9046493Z from argparse import ArgumentParser 2025-11-03T15:43:04.9047253Z from collections.abc import Iterable 2025-11-03T15:43:04.9047908Z from functools import cache 2025-11-03T15:43:04.9048479Z from logging import LogRecord 2025-11-03T15:43:04.9049202Z from typing import Any, NamedTuple 2025-11-03T15:43:04.9049856Z from urllib.request import Request, urlopen 2025-11-03T15:43:04.9050498Z  2025-11-03T15:43:04.9051040Z import yaml 2025-11-03T15:43:04.9051544Z from github import Auth, Github 2025-11-03T15:43:04.9052174Z from github.Issue import Issue 2025-11-03T15:43:04.9052780Z  2025-11-03T15:43:04.9053238Z  2025-11-03T15:43:04.9053736Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:04.9054638Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:04.9055966Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:04.9057017Z  2025-11-03T15:43:04.9057637Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:04.9058322Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:04.9059019Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:04.9059773Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:04.9060366Z  2025-11-03T15:43:04.9060863Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:04.9061491Z  2025-11-03T15:43:04.9062005Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:04.9062611Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:04.9063218Z  2025-11-03T15:43:04.9063645Z  2025-11-03T15:43:04.9064203Z class Experiment(NamedTuple): 2025-11-03T15:43:04.9065224Z  rollout_perc: float = ( 2025-11-03T15:43:04.9066071Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:04.9066921Z  ) 2025-11-03T15:43:04.9067373Z  all_branches: bool = ( 2025-11-03T15:43:04.9068240Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:04.9068988Z  ) 2025-11-03T15:43:04.9069459Z  default: bool = ( 2025-11-03T15:43:04.9070341Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:04.9071089Z  ) 2025-11-03T15:43:04.9071536Z  2025-11-03T15:43:04.9072057Z  # Add more fields as needed 2025-11-03T15:43:04.9072644Z  2025-11-03T15:43:04.9073050Z  2025-11-03T15:43:04.9073932Z class Settings(NamedTuple): 2025-11-03T15:43:04.9074571Z  """ 2025-11-03T15:43:04.9075287Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:04.9076077Z  """ 2025-11-03T15:43:04.9076522Z  2025-11-03T15:43:04.9077042Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:04.9077694Z  2025-11-03T15:43:04.9078347Z  2025-11-03T15:43:04.9078854Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:04.9079683Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:04.9080398Z  2025-11-03T15:43:04.9080816Z  COLORS = { 2025-11-03T15:43:04.9081408Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:04.9082059Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:04.9082686Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:04.9083358Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:04.9083958Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:04.9084549Z  } 2025-11-03T15:43:04.9085101Z  2025-11-03T15:43:04.9085747Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:04.9086610Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:04.9087585Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:04.9088319Z  return super().format(record) 2025-11-03T15:43:04.9088887Z  2025-11-03T15:43:04.9089365Z  2025-11-03T15:43:04.9089876Z handler = logging.StreamHandler() 2025-11-03T15:43:04.9090737Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:04.9091509Z  2025-11-03T15:43:04.9092148Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:04.9092864Z log.addHandler(handler) 2025-11-03T15:43:04.9093401Z log.setLevel(logging.INFO) 2025-11-03T15:43:04.9094072Z  2025-11-03T15:43:04.9094477Z  2025-11-03T15:43:04.9095397Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:04.9096169Z  """ 2025-11-03T15:43:04.9096825Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:04.9097873Z  """ 2025-11-03T15:43:04.9098431Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:04.9099638Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:04.9100796Z  log.warning( 2025-11-03T15:43:04.9101861Z  "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:04.9102881Z  ) 2025-11-03T15:43:04.9103395Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:04.9104160Z  return 2025-11-03T15:43:04.9104674Z  2025-11-03T15:43:04.9105468Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:04.9106233Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:04.9106927Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:04.9107517Z  2025-11-03T15:43:04.9108037Z  2025-11-03T15:43:04.9108660Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:04.9109390Z  return frozenset( 2025-11-03T15:43:04.9110223Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:04.9110969Z  ) 2025-11-03T15:43:04.9111414Z  2025-11-03T15:43:04.9111959Z  2025-11-03T15:43:04.9112390Z def parse_args() -> Any: 2025-11-03T15:43:04.9113085Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:04.9114174Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:04.9115170Z  parser.add_argument( 2025-11-03T15:43:04.9115730Z  "--github-issue-repo", 2025-11-03T15:43:04.9116427Z  type=str, 2025-11-03T15:43:04.9116975Z  required=False, 2025-11-03T15:43:04.9117655Z  default="pytorch/test-infra", 2025-11-03T15:43:04.9118433Z  help="GitHub repo to get the issue", 2025-11-03T15:43:04.9119022Z  ) 2025-11-03T15:43:04.9119529Z  parser.add_argument( 2025-11-03T15:43:04.9120155Z  "--github-repo", 2025-11-03T15:43:04.9120728Z  type=str, 2025-11-03T15:43:04.9121285Z  required=True, 2025-11-03T15:43:04.9121947Z  help="GitHub repo where CI is running", 2025-11-03T15:43:04.9122606Z  ) 2025-11-03T15:43:04.9123088Z  parser.add_argument( 2025-11-03T15:43:04.9123905Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:04.9124635Z  ) 2025-11-03T15:43:04.9125322Z  parser.add_argument( 2025-11-03T15:43:04.9126165Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:04.9126941Z  ) 2025-11-03T15:43:04.9127465Z  parser.add_argument( 2025-11-03T15:43:04.9216680Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:04.9217972Z  ) 2025-11-03T15:43:04.9218692Z  parser.add_argument( 2025-11-03T15:43:04.9219904Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:04.9221096Z  ) 2025-11-03T15:43:04.9221504Z  parser.add_argument( 2025-11-03T15:43:04.9221998Z  "--github-ref-type", 2025-11-03T15:43:04.9222480Z  type=str, 2025-11-03T15:43:04.9222928Z  required=True, 2025-11-03T15:43:04.9223467Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:04.9224031Z  ) 2025-11-03T15:43:04.9224422Z  parser.add_argument( 2025-11-03T15:43:04.9225763Z  "--eligible-experiments", 2025-11-03T15:43:04.9226343Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:04.9226880Z  required=False, 2025-11-03T15:43:04.9227342Z  default="", 2025-11-03T15:43:04.9228230Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:04.9229150Z  ) 2025-11-03T15:43:04.9229536Z  parser.add_argument( 2025-11-03T15:43:04.9230031Z  "--opt-out-experiments", 2025-11-03T15:43:04.9230576Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:04.9231120Z  required=False, 2025-11-03T15:43:04.9231581Z  default="", 2025-11-03T15:43:04.9232015Z  help=( 2025-11-03T15:43:04.9232721Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:04.9233875Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:04.9234708Z  ), 2025-11-03T15:43:04.9235266Z  ) 2025-11-03T15:43:04.9235658Z  parser.add_argument( 2025-11-03T15:43:04.9236137Z  "--pr-number", 2025-11-03T15:43:04.9236590Z  type=str, 2025-11-03T15:43:04.9237031Z  required=False, 2025-11-03T15:43:04.9237491Z  default="", 2025-11-03T15:43:04.9238026Z  help="the optional PR number where this is run", 2025-11-03T15:43:04.9238587Z  ) 2025-11-03T15:43:04.9238946Z  2025-11-03T15:43:04.9239323Z  return parser.parse_args() 2025-11-03T15:43:04.9239806Z  2025-11-03T15:43:04.9240142Z  2025-11-03T15:43:04.9240742Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.9241680Z  auth = Auth.Token(github_token) 2025-11-03T15:43:04.9242213Z  return Github(auth=auth) 2025-11-03T15:43:04.9242684Z  2025-11-03T15:43:04.9243016Z  2025-11-03T15:43:04.9243665Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.9244467Z  repo = gh.get_repo(repo) 2025-11-03T15:43:04.9245271Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:04.9245806Z  2025-11-03T15:43:04.9246140Z  2025-11-03T15:43:04.9246510Z def get_potential_pr_author( 2025-11-03T15:43:04.9247183Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:04.9247869Z ) -> str: 2025-11-03T15:43:04.9248431Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:04.9249255Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:04.9250038Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:04.9250614Z  2025-11-03T15:43:04.9251005Z  gh = get_gh_client(github_token) 2025-11-03T15:43:04.9251499Z  2025-11-03T15:43:04.9251979Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:04.9252625Z  split_tag = ref_name.split("/") 2025-11-03T15:43:04.9253138Z  if ( 2025-11-03T15:43:04.9253560Z  len(split_tag) == 3 2025-11-03T15:43:04.9254077Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:04.9254622Z  and split_tag[2].isnumeric() 2025-11-03T15:43:04.9255514Z  ): 2025-11-03T15:43:04.9255945Z  pr_number = split_tag[2] 2025-11-03T15:43:04.9256455Z  try: 2025-11-03T15:43:04.9256921Z  repository = gh.get_repo(repo) 2025-11-03T15:43:04.9257699Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:04.9258318Z  except Exception as e: 2025-11-03T15:43:04.9258869Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:04.9259552Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:04.9260207Z  ) from e 2025-11-03T15:43:04.9260791Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:04.9261516Z  # In all other cases, return the original input username 2025-11-03T15:43:04.9262121Z  return username 2025-11-03T15:43:04.9262542Z  2025-11-03T15:43:04.9262876Z  2025-11-03T15:43:04.9263296Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:04.9263824Z  """ 2025-11-03T15:43:04.9264490Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:04.9265561Z  """ 2025-11-03T15:43:04.9266140Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:04.9266812Z  2025-11-03T15:43:04.9267160Z  2025-11-03T15:43:04.9267546Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:04.9268052Z  try: 2025-11-03T15:43:04.9268470Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:04.9268991Z  return data 2025-11-03T15:43:04.9269459Z  except yaml.YAMLError: 2025-11-03T15:43:04.9269991Z  log.exception("Error loading YAML") 2025-11-03T15:43:04.9270509Z  raise 2025-11-03T15:43:04.9270897Z  2025-11-03T15:43:04.9271231Z  2025-11-03T15:43:04.9271839Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:04.9272592Z  """ 2025-11-03T15:43:04.9273354Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:04.9274116Z  2025-11-03T15:43:04.9274668Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.9275615Z  and the text below is the list of opted in users. 2025-11-03T15:43:04.9276171Z  2025-11-03T15:43:04.9276737Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:04.9277433Z  """ 2025-11-03T15:43:04.9277889Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:04.9278493Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:04.9279125Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:04.9279729Z  else: 2025-11-03T15:43:04.9280141Z  return "", rollout_state 2025-11-03T15:43:04.9280636Z  2025-11-03T15:43:04.9280976Z  2025-11-03T15:43:04.9281386Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:04.9281916Z  """ 2025-11-03T15:43:04.9282474Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:04.9283126Z  """ 2025-11-03T15:43:04.9283486Z  2025-11-03T15:43:04.9283831Z  2025-11-03T15:43:04.9284371Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:04.9285274Z  """ 2025-11-03T15:43:04.9286021Z  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:04.9286838Z  2025-11-03T15:43:04.9287631Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:04.9288627Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:04.9289463Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:04.9290093Z  2025-11-03T15:43:04.9290424Z  2025-11-03T15:43:04.9290754Z  """ 2025-11-03T15:43:04.9291135Z  optins = UserOptins() 2025-11-03T15:43:04.9291660Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:04.9292240Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:04.9292808Z  if not user or not user.startswith("@"): 2025-11-03T15:43:04.9293370Z  # Not a valid user. Skip 2025-11-03T15:43:04.9293865Z  continue 2025-11-03T15:43:04.9294287Z  2025-11-03T15:43:04.9294622Z  if user: 2025-11-03T15:43:04.9295309Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:04.9296023Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:04.9296666Z  2025-11-03T15:43:04.9297027Z  return optins 2025-11-03T15:43:04.9297438Z  2025-11-03T15:43:04.9297765Z  2025-11-03T15:43:04.9298256Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:04.9298878Z  """ 2025-11-03T15:43:04.9299306Z  Check if the experiment name is valid. 2025-11-03T15:43:04.9299846Z  A valid name: 2025-11-03T15:43:04.9300533Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:04.9301476Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:04.9302190Z  - Cannot contain spaces 2025-11-03T15:43:04.9302658Z  """ 2025-11-03T15:43:04.9303017Z  2025-11-03T15:43:04.9303479Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:04.9304213Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:04.9305136Z  2025-11-03T15:43:04.9305506Z  if valid: 2025-11-03T15:43:04.9305921Z  return True 2025-11-03T15:43:04.9306335Z  2025-11-03T15:43:04.9306681Z  log.error( 2025-11-03T15:43:04.9308155Z  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:04.9309651Z  ) 2025-11-03T15:43:04.9310018Z  return False 2025-11-03T15:43:04.9310413Z  2025-11-03T15:43:04.9310746Z  2025-11-03T15:43:04.9311253Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:04.9311888Z  """ 2025-11-03T15:43:04.9312492Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:04.9313205Z  """ 2025-11-03T15:43:04.9313578Z  try: 2025-11-03T15:43:04.9313951Z  if settings_text: 2025-11-03T15:43:04.9314702Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:04.9315741Z  # for easy reading 2025-11-03T15:43:04.9316622Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:04.9317523Z  # the backtick character in shell commands. 2025-11-03T15:43:04.9318143Z  backtick = chr(96) # backtick character 2025-11-03T15:43:04.9318834Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:04.9319505Z  settings = load_yaml(settings_text) 2025-11-03T15:43:04.9320019Z  2025-11-03T15:43:04.9320752Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:04.9321499Z  experiments = {} 2025-11-03T15:43:04.9321961Z  2025-11-03T15:43:04.9322524Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:04.9323298Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:04.9324387Z  # 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:04.9325545Z  continue 2025-11-03T15:43:04.9325995Z  2025-11-03T15:43:04.9326365Z  valid_settings = {} 2025-11-03T15:43:04.9326908Z  for setting in exp_settings: 2025-11-03T15:43:04.9327487Z  if setting not in Experiment._fields: 2025-11-03T15:43:04.9328060Z  log.warning( 2025-11-03T15:43:04.9328782Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:04.9329493Z  ) 2025-11-03T15:43:04.9329948Z  else: 2025-11-03T15:43:04.9330491Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:04.9331054Z  2025-11-03T15:43:04.9331518Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:04.9332178Z  return Settings(experiments) 2025-11-03T15:43:04.9332683Z  2025-11-03T15:43:04.9333040Z  except Exception: 2025-11-03T15:43:04.9333565Z  log.exception("Failed to parse settings") 2025-11-03T15:43:04.9334105Z  2025-11-03T15:43:04.9334455Z  return Settings() 2025-11-03T15:43:04.9334975Z  2025-11-03T15:43:04.9335311Z  2025-11-03T15:43:04.9335875Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:04.9336462Z  """ 2025-11-03T15:43:04.9336919Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:04.9337464Z  2025-11-03T15:43:04.9337997Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.9338758Z  and the text below is the list of opted in users. 2025-11-03T15:43:04.9339320Z  2025-11-03T15:43:04.9339912Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:04.9340636Z  """ 2025-11-03T15:43:04.9341210Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.9341987Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:04.9342533Z  2025-11-03T15:43:04.9342870Z  2025-11-03T15:43:04.9343330Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:04.9343900Z  """ 2025-11-03T15:43:04.9344321Z  Parse users from the rollout state. 2025-11-03T15:43:04.9345004Z  2025-11-03T15:43:04.9345371Z  """ 2025-11-03T15:43:04.9345931Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.9346682Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:04.9347229Z  2025-11-03T15:43:04.9347562Z  2025-11-03T15:43:04.9348190Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.9348926Z  """ 2025-11-03T15:43:04.9349379Z  Check if a user is opted into an experiment 2025-11-03T15:43:04.9349909Z  """ 2025-11-03T15:43:04.9350398Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:04.9351105Z  2025-11-03T15:43:04.9351435Z  2025-11-03T15:43:04.9352063Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.9352815Z  """ 2025-11-03T15:43:04.9353300Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:04.9353868Z  """ 2025-11-03T15:43:04.9354398Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:04.9355367Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:04.9356032Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:04.9356637Z  return False 2025-11-03T15:43:04.9357056Z  2025-11-03T15:43:04.9357518Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:04.9358114Z  log.warning( 2025-11-03T15:43:04.9358941Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:04.9359812Z  ) 2025-11-03T15:43:04.9360180Z  2025-11-03T15:43:04.9360531Z  return True 2025-11-03T15:43:04.9360934Z  2025-11-03T15:43:04.9361275Z  2025-11-03T15:43:04.9361631Z def get_runner_prefix( 2025-11-03T15:43:04.9362106Z  rollout_state: str, 2025-11-03T15:43:04.9362602Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:04.9363128Z  branch: str, 2025-11-03T15:43:04.9363665Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.9364351Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.9365093Z  is_canary: bool = False, 2025-11-03T15:43:04.9365556Z ) -> str: 2025-11-03T15:43:04.9366000Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:04.9366586Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:04.9367114Z  2025-11-03T15:43:04.9367600Z  fleet_prefix = "" 2025-11-03T15:43:04.9368062Z  prefixes = [] 2025-11-03T15:43:04.9368746Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:04.9369695Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:04.9370412Z  log.info( 2025-11-03T15:43:04.9371117Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:04.9371867Z  ) 2025-11-03T15:43:04.9372269Z  continue 2025-11-03T15:43:04.9372688Z  2025-11-03T15:43:04.9373066Z  if opt_out_experiments: 2025-11-03T15:43:04.9373633Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:04.9374285Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:04.9375030Z  log.info( 2025-11-03T15:43:04.9375977Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:04.9376937Z  ) 2025-11-03T15:43:04.9377365Z  continue 2025-11-03T15:43:04.9377806Z  2025-11-03T15:43:04.9378176Z  if eligible_experiments: 2025-11-03T15:43:04.9378761Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:04.9379402Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:04.9379957Z  log.info( 2025-11-03T15:43:04.9380763Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:04.9381581Z  ) 2025-11-03T15:43:04.9382134Z  continue 2025-11-03T15:43:04.9382644Z  elif not experiment_settings.default: 2025-11-03T15:43:04.9383180Z  log.info( 2025-11-03T15:43:04.9383871Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:04.9384585Z  ) 2025-11-03T15:43:04.9385228Z  continue 2025-11-03T15:43:04.9385649Z  2025-11-03T15:43:04.9386128Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:04.9386747Z  opted_out_users = [ 2025-11-03T15:43:04.9387230Z  requestor 2025-11-03T15:43:04.9387721Z  for requestor in workflow_requestors 2025-11-03T15:43:04.9388410Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.9389038Z  ] 2025-11-03T15:43:04.9389413Z  2025-11-03T15:43:04.9389779Z  if opted_out_users: 2025-11-03T15:43:04.9390256Z  log.info( 2025-11-03T15:43:04.9390917Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:04.9391603Z  ) 2025-11-03T15:43:04.9392011Z  continue 2025-11-03T15:43:04.9392432Z  2025-11-03T15:43:04.9392912Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:04.9393527Z  opted_in_users = [ 2025-11-03T15:43:04.9393997Z  requestor 2025-11-03T15:43:04.9394487Z  for requestor in workflow_requestors 2025-11-03T15:43:04.9395395Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.9396027Z  ] 2025-11-03T15:43:04.9396407Z  2025-11-03T15:43:04.9396760Z  enabled = False 2025-11-03T15:43:04.9397232Z  if opted_in_users: 2025-11-03T15:43:04.9397839Z  log.info( 2025-11-03T15:43:04.9398491Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:04.9399162Z  ) 2025-11-03T15:43:04.9399576Z  enabled = True 2025-11-03T15:43:04.9400032Z  2025-11-03T15:43:04.9400444Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:04.9401284Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:04.9402213Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:04.9402861Z  log.info( 2025-11-03T15:43:04.9403740Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:04.9404649Z  ) 2025-11-03T15:43:04.9405452Z  enabled = True 2025-11-03T15:43:04.9405937Z  2025-11-03T15:43:04.9406294Z  if enabled: 2025-11-03T15:43:04.9406766Z  label = experiment_name 2025-11-03T15:43:04.9407339Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:04.9408192Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:04.9409073Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:04.9409840Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:04.9410497Z  if is_canary: 2025-11-03T15:43:04.9411101Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:04.9411700Z  fleet_prefix = label 2025-11-03T15:43:04.9412350Z  else: 2025-11-03T15:43:04.9412828Z  prefixes.append(label) 2025-11-03T15:43:04.9413322Z  2025-11-03T15:43:04.9413684Z  if len(prefixes) > 1: 2025-11-03T15:43:04.9414148Z  log.error( 2025-11-03T15:43:04.9415334Z  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:04.9416882Z  ) 2025-11-03T15:43:04.9417584Z  prefixes = prefixes[:1] 2025-11-03T15:43:04.9418405Z  2025-11-03T15:43:04.9418995Z  # Fleet always comes first 2025-11-03T15:43:04.9419806Z  if fleet_prefix: 2025-11-03T15:43:04.9420582Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:04.9421414Z  2025-11-03T15:43:04.9422134Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:04.9423072Z  2025-11-03T15:43:04.9423583Z  2025-11-03T15:43:04.9430140Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:04.9431504Z  """ 2025-11-03T15:43:04.9432594Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:04.9433813Z  2025-11-03T15:43:04.9434977Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:04.9436209Z  """ 2025-11-03T15:43:04.9436905Z  gh = get_gh_client(github_token) 2025-11-03T15:43:04.9437880Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:04.9439004Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:04.9440019Z  2025-11-03T15:43:04.9440583Z  2025-11-03T15:43:04.9441559Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:04.9443024Z  for _ in range(num_retries): 2025-11-03T15:43:04.9443820Z  try: 2025-11-03T15:43:04.9444547Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:04.9445811Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:04.9446870Z  return json.loads(content) 2025-11-03T15:43:04.9447750Z  except Exception as e: 2025-11-03T15:43:04.9448677Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:04.9449585Z  2025-11-03T15:43:04.9450525Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:04.9451709Z  return {} 2025-11-03T15:43:04.9452355Z  2025-11-03T15:43:04.9452898Z  2025-11-03T15:43:04.9453442Z @cache 2025-11-03T15:43:04.9454492Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:04.9455929Z  """ 2025-11-03T15:43:04.9456593Z  Dynamically get PR information 2025-11-03T15:43:04.9457451Z  """ 2025-11-03T15:43:04.9458281Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:04.9458930Z  headers = { 2025-11-03T15:43:04.9459435Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:04.9460045Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:04.9460575Z  } 2025-11-03T15:43:04.9461027Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:04.9461649Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:04.9462190Z  headers=headers, 2025-11-03T15:43:04.9462642Z  ) 2025-11-03T15:43:04.9463017Z  2025-11-03T15:43:04.9463379Z  if not json_response: 2025-11-03T15:43:04.9464211Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:04.9465121Z  return {} 2025-11-03T15:43:04.9465583Z  2025-11-03T15:43:04.9465944Z  return json_response 2025-11-03T15:43:04.9466395Z  2025-11-03T15:43:04.9466727Z  2025-11-03T15:43:04.9467324Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:04.9468041Z  """ 2025-11-03T15:43:04.9468596Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:04.9469250Z  """ 2025-11-03T15:43:04.9469747Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:04.9470353Z  return { 2025-11-03T15:43:04.9470955Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:04.9471641Z  } 2025-11-03T15:43:04.9471997Z  2025-11-03T15:43:04.9472340Z  2025-11-03T15:43:04.9472705Z def main() -> None: 2025-11-03T15:43:04.9473155Z  args = parse_args() 2025-11-03T15:43:04.9473651Z  2025-11-03T15:43:04.9474077Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:04.9474620Z  2025-11-03T15:43:04.9475250Z  # Check if the PR is opt-out 2025-11-03T15:43:04.9475760Z  if args.pr_number: 2025-11-03T15:43:04.9476446Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:04.9477205Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:04.9477709Z  log.info( 2025-11-03T15:43:04.9478425Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:04.9479181Z  ) 2025-11-03T15:43:04.9479763Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.9480440Z  sys.exit() 2025-11-03T15:43:04.9481020Z  2025-11-03T15:43:04.9481361Z  try: 2025-11-03T15:43:04.9481834Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:04.9482548Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:04.9483187Z  ) 2025-11-03T15:43:04.9483553Z  2025-11-03T15:43:04.9483957Z  username = get_potential_pr_author( 2025-11-03T15:43:04.9484493Z  args.github_token, 2025-11-03T15:43:04.9485198Z  args.github_repo, 2025-11-03T15:43:04.9485712Z  args.github_actor, 2025-11-03T15:43:04.9486223Z  args.github_ref_type, 2025-11-03T15:43:04.9486738Z  args.github_branch, 2025-11-03T15:43:04.9487202Z  ) 2025-11-03T15:43:04.9487577Z  2025-11-03T15:43:04.9488065Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:04.9488671Z  2025-11-03T15:43:04.9489088Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:04.9489644Z  rollout_state, 2025-11-03T15:43:04.9490168Z  (args.github_issue_owner, username), 2025-11-03T15:43:04.9490716Z  args.github_branch, 2025-11-03T15:43:04.9491239Z  args.eligible_experiments, 2025-11-03T15:43:04.9491786Z  args.opt_out_experiments, 2025-11-03T15:43:04.9492299Z  is_canary, 2025-11-03T15:43:04.9492735Z  ) 2025-11-03T15:43:04.9493110Z  2025-11-03T15:43:04.9493479Z  except Exception as e: 2025-11-03T15:43:04.9493956Z  log.error( 2025-11-03T15:43:04.9494657Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:04.9495717Z  ) 2025-11-03T15:43:04.9496098Z  2025-11-03T15:43:04.9496622Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.9497271Z  2025-11-03T15:43:04.9497599Z  2025-11-03T15:43:04.9497960Z if __name__ == "__main__": 2025-11-03T15:43:04.9498427Z  main() 2025-11-03T15:43:04.9498795Z  2025-11-03T15:43:04.9499129Z EOF 2025-11-03T15:43:04.9499474Z  2025-11-03T15:43:04.9499845Z cat runner_determinator.py 2025-11-03T15:43:05.0949342Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:05.0950266Z env: 2025-11-03T15:43:05.0951058Z GITHUB_TOKEN: *** 2025-11-03T15:43:05.0951561Z ISSUE_NUMBER: 5132 2025-11-03T15:43:05.0952065Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:05.0952635Z ISSUE_OWNER: 2025-11-03T15:43:05.0953086Z CHECK_EXPERIMENTS: 2025-11-03T15:43:05.0954414Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:05.0955171Z PR_NUMBER: 2025-11-03T15:43:05.0955757Z ##[endgroup] 2025-11-03T15:43:05.1160280Z # flake8: noqa: G004 2025-11-03T15:43:05.1160600Z 2025-11-03T15:43:05.1161023Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:05.1161928Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:05.1162719Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:05.1163144Z 2025-11-03T15:43:05.1163292Z """ 2025-11-03T15:43:05.1163843Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:05.1164671Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:05.1165785Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:05.1166586Z of which runners should be used to run which job. 2025-11-03T15:43:05.1166974Z 2025-11-03T15:43:05.1167336Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:05.1168400Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:05.1169234Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:05.1169904Z list, defined. 2025-11-03T15:43:05.1170116Z 2025-11-03T15:43:05.1170471Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:05.1171331Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:05.1172121Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:05.1172540Z 2025-11-03T15:43:05.1172885Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:05.1173705Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:05.1174398Z experiments which the user could be opted in to. 2025-11-03T15:43:05.1174934Z 2025-11-03T15:43:05.1175143Z The user list has the following rules: 2025-11-03T15:43:05.1175480Z 2025-11-03T15:43:05.1175781Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:05.1176595Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:05.1177316Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:05.1177702Z 2025-11-03T15:43:05.1177860Z Example config: 2025-11-03T15:43:05.1178298Z # A list of experiments that can be opted into. 2025-11-03T15:43:05.1178935Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:05.1179524Z # Expected syntax is: 2025-11-03T15:43:05.1180141Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:05.1181062Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:05.1181645Z 2025-11-03T15:43:05.1181803Z experiments: 2025-11-03T15:43:05.1182170Z lf: 2025-11-03T15:43:05.1182532Z rollout_percent: 25 2025-11-03T15:43:05.1183106Z all_branches: false 2025-11-03T15:43:05.1183538Z default: true 2025-11-03T15:43:05.1183917Z --- 2025-11-03T15:43:05.1184117Z 2025-11-03T15:43:05.1184271Z # Opt-ins: 2025-11-03T15:43:05.1184998Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:05.1185959Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:05.1186698Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:05.1187318Z # Experiments should be from the above list. 2025-11-03T15:43:05.1187682Z 2025-11-03T15:43:05.1187856Z @User1,-lf,split_build 2025-11-03T15:43:05.1188263Z @User2,lf 2025-11-03T15:43:05.1188626Z @User3,split_build 2025-11-03T15:43:05.1189011Z """ 2025-11-03T15:43:05.1189190Z 2025-11-03T15:43:05.1189345Z import json 2025-11-03T15:43:05.1189697Z import logging 2025-11-03T15:43:05.1190054Z import os 2025-11-03T15:43:05.1190401Z import random 2025-11-03T15:43:05.1190762Z import re 2025-11-03T15:43:05.1191105Z import sys 2025-11-03T15:43:05.1191489Z from argparse import ArgumentParser 2025-11-03T15:43:05.1192001Z from collections.abc import Iterable 2025-11-03T15:43:05.1192488Z from functools import cache 2025-11-03T15:43:05.1192937Z from logging import LogRecord 2025-11-03T15:43:05.1193390Z from typing import Any, NamedTuple 2025-11-03T15:43:05.1193904Z from urllib.request import Request, urlopen 2025-11-03T15:43:05.1194261Z 2025-11-03T15:43:05.1194425Z import yaml 2025-11-03T15:43:05.1195112Z from github import Auth, Github 2025-11-03T15:43:05.1195602Z from github.Issue import Issue 2025-11-03T15:43:05.1195891Z 2025-11-03T15:43:05.1195897Z 2025-11-03T15:43:05.1196107Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:05.1196772Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:05.1197596Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:05.1198143Z 2025-11-03T15:43:05.1198362Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:05.1199045Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:05.1199541Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:05.1200080Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:05.1200418Z 2025-11-03T15:43:05.1200605Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:05.1200924Z 2025-11-03T15:43:05.1201101Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:05.1201537Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:05.1201810Z 2025-11-03T15:43:05.1201816Z 2025-11-03T15:43:05.1201993Z class Experiment(NamedTuple): 2025-11-03T15:43:05.1202446Z rollout_perc: float = ( 2025-11-03T15:43:05.1203049Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:05.1203696Z ) 2025-11-03T15:43:05.1204045Z all_branches: bool = ( 2025-11-03T15:43:05.1204643Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:05.1205476Z ) 2025-11-03T15:43:05.1205828Z default: bool = ( 2025-11-03T15:43:05.1206369Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:05.1206991Z ) 2025-11-03T15:43:05.1207179Z 2025-11-03T15:43:05.1207353Z # Add more fields as needed 2025-11-03T15:43:05.1207637Z 2025-11-03T15:43:05.1207643Z 2025-11-03T15:43:05.1207816Z class Settings(NamedTuple): 2025-11-03T15:43:05.1208242Z """ 2025-11-03T15:43:05.1208675Z Settings for the experiments that can be opted into. 2025-11-03T15:43:05.1209226Z """ 2025-11-03T15:43:05.1209412Z 2025-11-03T15:43:05.1209608Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:05.1209962Z 2025-11-03T15:43:05.1209969Z 2025-11-03T15:43:05.1210171Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:05.1210772Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:05.1211182Z 2025-11-03T15:43:05.1211337Z COLORS = { 2025-11-03T15:43:05.1211725Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:05.1212331Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:05.1212806Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:05.1213284Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:05.1213783Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:05.1214219Z } 2025-11-03T15:43:05.1214413Z 2025-11-03T15:43:05.1214620Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:05.1215590Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:05.1216327Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:05.1216885Z return super().format(record) 2025-11-03T15:43:05.1217202Z 2025-11-03T15:43:05.1217209Z 2025-11-03T15:43:05.1217392Z handler = logging.StreamHandler() 2025-11-03T15:43:05.1218060Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:05.1218583Z 2025-11-03T15:43:05.1218822Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:05.1219370Z log.addHandler(handler) 2025-11-03T15:43:05.1219802Z log.setLevel(logging.INFO) 2025-11-03T15:43:05.1220071Z 2025-11-03T15:43:05.1220077Z 2025-11-03T15:43:05.1220315Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:05.1220865Z """ 2025-11-03T15:43:05.1221335Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:05.1221928Z """ 2025-11-03T15:43:05.1222270Z if not GITHUB_OUTPUT: 2025-11-03T15:43:05.1223280Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:05.1224338Z log.warning( 2025-11-03T15:43:05.1225346Z "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:05.1226234Z ) 2025-11-03T15:43:05.1236404Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:05.1236982Z return 2025-11-03T15:43:05.1237215Z 2025-11-03T15:43:05.1237563Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:05.1238122Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:05.1238660Z f.write(f"{key}={value}\n") 2025-11-03T15:43:05.1238964Z 2025-11-03T15:43:05.1238971Z 2025-11-03T15:43:05.1239253Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:05.1239899Z return frozenset( 2025-11-03T15:43:05.1240464Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:05.1241120Z ) 2025-11-03T15:43:05.1241302Z 2025-11-03T15:43:05.1241310Z 2025-11-03T15:43:05.1241482Z def parse_args() -> Any: 2025-11-03T15:43:05.1241994Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:05.1242808Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:05.1243521Z parser.add_argument( 2025-11-03T15:43:05.1243954Z "--github-issue-repo", 2025-11-03T15:43:05.1244391Z type=str, 2025-11-03T15:43:05.1244896Z required=False, 2025-11-03T15:43:05.1245326Z default="pytorch/test-infra", 2025-11-03T15:43:05.1245841Z help="GitHub repo to get the issue", 2025-11-03T15:43:05.1246310Z ) 2025-11-03T15:43:05.1246665Z parser.add_argument( 2025-11-03T15:43:05.1247086Z "--github-repo", 2025-11-03T15:43:05.1247479Z type=str, 2025-11-03T15:43:05.1247847Z required=True, 2025-11-03T15:43:05.1248276Z help="GitHub repo where CI is running", 2025-11-03T15:43:05.1248769Z ) 2025-11-03T15:43:05.1249112Z parser.add_argument( 2025-11-03T15:43:05.1249679Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:05.1250287Z ) 2025-11-03T15:43:05.1250636Z parser.add_argument( 2025-11-03T15:43:05.1251218Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:05.1251853Z ) 2025-11-03T15:43:05.1252322Z parser.add_argument( 2025-11-03T15:43:05.1252915Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:05.1253565Z ) 2025-11-03T15:43:05.1253901Z parser.add_argument( 2025-11-03T15:43:05.1254513Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:05.1255304Z ) 2025-11-03T15:43:05.1255648Z parser.add_argument( 2025-11-03T15:43:05.1256061Z "--github-ref-type", 2025-11-03T15:43:05.1256493Z type=str, 2025-11-03T15:43:05.1256950Z required=True, 2025-11-03T15:43:05.1257406Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:05.1257928Z ) 2025-11-03T15:43:05.1258268Z parser.add_argument( 2025-11-03T15:43:05.1258697Z "--eligible-experiments", 2025-11-03T15:43:05.1259176Z type=_str_comma_separated_to_set, 2025-11-03T15:43:05.1259665Z required=False, 2025-11-03T15:43:05.1260051Z default="", 2025-11-03T15:43:05.1260859Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:05.1261739Z ) 2025-11-03T15:43:05.1262085Z parser.add_argument( 2025-11-03T15:43:05.1262509Z "--opt-out-experiments", 2025-11-03T15:43:05.1262986Z type=_str_comma_separated_to_set, 2025-11-03T15:43:05.1263472Z required=False, 2025-11-03T15:43:05.1263856Z default="", 2025-11-03T15:43:05.1264222Z help=( 2025-11-03T15:43:05.1264945Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:05.1266012Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:05.1266792Z ), 2025-11-03T15:43:05.1267125Z ) 2025-11-03T15:43:05.1267462Z parser.add_argument( 2025-11-03T15:43:05.1267872Z "--pr-number", 2025-11-03T15:43:05.1268258Z type=str, 2025-11-03T15:43:05.1268630Z required=False, 2025-11-03T15:43:05.1269021Z default="", 2025-11-03T15:43:05.1269576Z help="the optional PR number where this is run", 2025-11-03T15:43:05.1270104Z ) 2025-11-03T15:43:05.1270287Z 2025-11-03T15:43:05.1270462Z return parser.parse_args() 2025-11-03T15:43:05.1270755Z 2025-11-03T15:43:05.1270762Z 2025-11-03T15:43:05.1271135Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.1271840Z auth = Auth.Token(github_token) 2025-11-03T15:43:05.1272305Z return Github(auth=auth) 2025-11-03T15:43:05.1272583Z 2025-11-03T15:43:05.1272590Z 2025-11-03T15:43:05.1273017Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:05.1273761Z repo = gh.get_repo(repo) 2025-11-03T15:43:05.1274229Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:05.1274567Z 2025-11-03T15:43:05.1274574Z 2025-11-03T15:43:05.1274744Z def get_potential_pr_author( 2025-11-03T15:43:05.1275451Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:05.1276087Z ) -> str: 2025-11-03T15:43:05.1276564Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:05.1277313Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:05.1278003Z # embedded in the tag name: ciflow// 2025-11-03T15:43:05.1278396Z 2025-11-03T15:43:05.1278573Z gh = get_gh_client(github_token) 2025-11-03T15:43:05.1278889Z 2025-11-03T15:43:05.1279138Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:05.1279724Z split_tag = ref_name.split("/") 2025-11-03T15:43:05.1280193Z if ( 2025-11-03T15:43:05.1280551Z len(split_tag) == 3 2025-11-03T15:43:05.1280993Z and split_tag[0] == "ciflow" 2025-11-03T15:43:05.1281484Z and split_tag[2].isnumeric() 2025-11-03T15:43:05.1281941Z ): 2025-11-03T15:43:05.1282419Z pr_number = split_tag[2] 2025-11-03T15:43:05.1282871Z try: 2025-11-03T15:43:05.1330876Z repository = gh.get_repo(repo) 2025-11-03T15:43:05.1331592Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:05.1332208Z except Exception as e: 2025-11-03T15:43:05.1332714Z raise Exception( # noqa: TRY002 2025-11-03T15:43:05.1333351Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:05.1333968Z ) from e 2025-11-03T15:43:05.1334477Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:05.1335273Z # In all other cases, return the original input username 2025-11-03T15:43:05.1335830Z return username 2025-11-03T15:43:05.1336062Z 2025-11-03T15:43:05.1336068Z 2025-11-03T15:43:05.1336276Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:05.1336777Z """ 2025-11-03T15:43:05.1337374Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:05.1338112Z """ 2025-11-03T15:43:05.1338629Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:05.1339114Z 2025-11-03T15:43:05.1339122Z 2025-11-03T15:43:05.1339309Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:05.1339804Z try: 2025-11-03T15:43:05.1340162Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:05.1340642Z return data 2025-11-03T15:43:05.1341026Z except yaml.YAMLError: 2025-11-03T15:43:05.1341488Z log.exception("Error loading YAML") 2025-11-03T15:43:05.1341980Z raise 2025-11-03T15:43:05.1342189Z 2025-11-03T15:43:05.1342196Z 2025-11-03T15:43:05.1342581Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:05.1343278Z """ 2025-11-03T15:43:05.1343860Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:05.1344438Z 2025-11-03T15:43:05.1345028Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.1345765Z and the text below is the list of opted in users. 2025-11-03T15:43:05.1346148Z 2025-11-03T15:43:05.1346496Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:05.1347152Z """ 2025-11-03T15:43:05.1347561Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:05.1348149Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:05.1348706Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:05.1349255Z else: 2025-11-03T15:43:05.1349608Z return "", rollout_state 2025-11-03T15:43:05.1349899Z 2025-11-03T15:43:05.1349905Z 2025-11-03T15:43:05.1350089Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:05.1350561Z """ 2025-11-03T15:43:05.1351035Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:05.1351638Z """ 2025-11-03T15:43:05.1351824Z 2025-11-03T15:43:05.1351830Z 2025-11-03T15:43:05.1352147Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:05.1352762Z """ 2025-11-03T15:43:05.1353423Z 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:05.1354069Z 2025-11-03T15:43:05.1354654Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:05.1355702Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:05.1356336Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:05.1356783Z 2025-11-03T15:43:05.1356796Z 2025-11-03T15:43:05.1356943Z """ 2025-11-03T15:43:05.1357285Z optins = UserOptins() 2025-11-03T15:43:05.1357744Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:05.1358265Z user = user.strip("\r\n\t -") 2025-11-03T15:43:05.1358907Z if not user or not user.startswith("@"): 2025-11-03T15:43:05.1359434Z # Not a valid user. Skip 2025-11-03T15:43:05.1359881Z continue 2025-11-03T15:43:05.1360110Z 2025-11-03T15:43:05.1360267Z if user: 2025-11-03T15:43:05.1360705Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:05.1361355Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:05.1361813Z 2025-11-03T15:43:05.1361968Z return optins 2025-11-03T15:43:05.1362194Z 2025-11-03T15:43:05.1362201Z 2025-11-03T15:43:05.1362463Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:05.1363018Z """ 2025-11-03T15:43:05.1363382Z Check if the experiment name is valid. 2025-11-03T15:43:05.1363874Z A valid name: 2025-11-03T15:43:05.1364459Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:05.1365509Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:05.1366194Z - Cannot contain spaces 2025-11-03T15:43:05.1366623Z """ 2025-11-03T15:43:05.1366811Z 2025-11-03T15:43:05.1367049Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:05.1367708Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:05.1368121Z 2025-11-03T15:43:05.1368274Z if valid: 2025-11-03T15:43:05.1368611Z return True 2025-11-03T15:43:05.1368834Z 2025-11-03T15:43:05.1368993Z log.error( 2025-11-03T15:43:05.1370348Z 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:05.1371842Z ) 2025-11-03T15:43:05.1372166Z return False 2025-11-03T15:43:05.1372384Z 2025-11-03T15:43:05.1372390Z 2025-11-03T15:43:05.1372667Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:05.1373251Z """ 2025-11-03T15:43:05.1373909Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:05.1374585Z """ 2025-11-03T15:43:05.1375020Z try: 2025-11-03T15:43:05.1375366Z if settings_text: 2025-11-03T15:43:05.1376042Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:05.1376774Z # for easy reading 2025-11-03T15:43:05.1377505Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:05.1378334Z # the backtick character in shell commands. 2025-11-03T15:43:05.1378896Z backtick = chr(96) # backtick character 2025-11-03T15:43:05.1379510Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:05.1380132Z settings = load_yaml(settings_text) 2025-11-03T15:43:05.1380475Z 2025-11-03T15:43:05.1380860Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:05.1381561Z experiments = {} 2025-11-03T15:43:05.1381842Z 2025-11-03T15:43:05.1382198Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:05.1382895Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:05.1383935Z # 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:05.1385015Z continue 2025-11-03T15:43:05.1385282Z 2025-11-03T15:43:05.1385452Z valid_settings = {} 2025-11-03T15:43:05.1385935Z for setting in exp_settings: 2025-11-03T15:43:05.1386459Z if setting not in Experiment._fields: 2025-11-03T15:43:05.1386981Z log.warning( 2025-11-03T15:43:05.1387632Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:05.1388477Z ) 2025-11-03T15:43:05.1388868Z else: 2025-11-03T15:43:05.1389341Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:05.1389734Z 2025-11-03T15:43:05.1389995Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:05.1390579Z return Settings(experiments) 2025-11-03T15:43:05.1390916Z 2025-11-03T15:43:05.1391077Z except Exception: 2025-11-03T15:43:05.1391544Z log.exception("Failed to parse settings") 2025-11-03T15:43:05.1391905Z 2025-11-03T15:43:05.1392063Z return Settings() 2025-11-03T15:43:05.1392325Z 2025-11-03T15:43:05.1392331Z 2025-11-03T15:43:05.1392564Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:05.1393084Z """ 2025-11-03T15:43:05.1393482Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:05.1393853Z 2025-11-03T15:43:05.1394180Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:05.1394984Z and the text below is the list of opted in users. 2025-11-03T15:43:05.1395358Z 2025-11-03T15:43:05.1395738Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:05.1396419Z """ 2025-11-03T15:43:05.1396930Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.1397622Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:05.1397995Z 2025-11-03T15:43:05.1398002Z 2025-11-03T15:43:05.1398225Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:05.1398738Z """ 2025-11-03T15:43:05.1399100Z Parse users from the rollout state. 2025-11-03T15:43:05.1399425Z 2025-11-03T15:43:05.1399576Z """ 2025-11-03T15:43:05.1400055Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:05.1400746Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:05.1401117Z 2025-11-03T15:43:05.1401123Z 2025-11-03T15:43:05.1401621Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.1402318Z """ 2025-11-03T15:43:05.1402689Z Check if a user is opted into an experiment 2025-11-03T15:43:05.1403183Z """ 2025-11-03T15:43:05.1403594Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:05.1403988Z 2025-11-03T15:43:05.1403994Z 2025-11-03T15:43:05.1404378Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:05.1405206Z """ 2025-11-03T15:43:05.1405647Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:05.1406177Z """ 2025-11-03T15:43:05.1406631Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:05.1407269Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:05.1407852Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:05.1408416Z return False 2025-11-03T15:43:05.1408646Z 2025-11-03T15:43:05.1408902Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:05.1409451Z log.warning( 2025-11-03T15:43:05.1410190Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:05.1411005Z ) 2025-11-03T15:43:05.1411196Z 2025-11-03T15:43:05.1411343Z return True 2025-11-03T15:43:05.1411553Z 2025-11-03T15:43:05.1411559Z 2025-11-03T15:43:05.1411727Z def get_runner_prefix( 2025-11-03T15:43:05.1412126Z rollout_state: str, 2025-11-03T15:43:05.1412550Z workflow_requestors: Iterable[str], 2025-11-03T15:43:05.1413016Z branch: str, 2025-11-03T15:43:05.1413472Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.1414080Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:05.1414622Z is_canary: bool = False, 2025-11-03T15:43:05.1415149Z ) -> str: 2025-11-03T15:43:05.1415670Z settings = parse_settings(rollout_state) 2025-11-03T15:43:05.1416208Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:05.1416554Z 2025-11-03T15:43:05.1416713Z fleet_prefix = "" 2025-11-03T15:43:05.1417101Z prefixes = [] 2025-11-03T15:43:05.1417673Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:05.1418541Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:05.1419196Z log.info( 2025-11-03T15:43:05.1419819Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:05.1420517Z ) 2025-11-03T15:43:05.1420868Z continue 2025-11-03T15:43:05.1421098Z 2025-11-03T15:43:05.1421276Z if opt_out_experiments: 2025-11-03T15:43:05.1421768Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:05.1422358Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:05.1422893Z log.info( 2025-11-03T15:43:05.1423750Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:05.1424649Z ) 2025-11-03T15:43:05.1425124Z continue 2025-11-03T15:43:05.1425368Z 2025-11-03T15:43:05.1425536Z if eligible_experiments: 2025-11-03T15:43:05.1426043Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:05.1426622Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:05.1427133Z log.info( 2025-11-03T15:43:05.1427852Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:05.1428623Z ) 2025-11-03T15:43:05.1428990Z continue 2025-11-03T15:43:05.1429421Z elif not experiment_settings.default: 2025-11-03T15:43:05.1429921Z log.info( 2025-11-03T15:43:05.1430638Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:05.1431336Z ) 2025-11-03T15:43:05.1431688Z continue 2025-11-03T15:43:05.1431915Z 2025-11-03T15:43:05.1432165Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:05.1432740Z opted_out_users = [ 2025-11-03T15:43:05.1433146Z requestor 2025-11-03T15:43:05.1433567Z for requestor in workflow_requestors 2025-11-03T15:43:05.1434180Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.1434764Z ] 2025-11-03T15:43:05.1435049Z 2025-11-03T15:43:05.1435218Z if opted_out_users: 2025-11-03T15:43:05.1435627Z log.info( 2025-11-03T15:43:05.1436192Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:05.1436832Z ) 2025-11-03T15:43:05.1437208Z continue 2025-11-03T15:43:05.1437439Z 2025-11-03T15:43:05.1437685Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:05.1438253Z opted_in_users = [ 2025-11-03T15:43:05.1438655Z requestor 2025-11-03T15:43:05.1439077Z for requestor in workflow_requestors 2025-11-03T15:43:05.1439714Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:05.1440283Z ] 2025-11-03T15:43:05.1440464Z 2025-11-03T15:43:05.1440627Z enabled = False 2025-11-03T15:43:05.1441027Z if opted_in_users: 2025-11-03T15:43:05.1441440Z log.info( 2025-11-03T15:43:05.1441985Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:05.1442619Z ) 2025-11-03T15:43:05.1442970Z enabled = True 2025-11-03T15:43:05.1443233Z 2025-11-03T15:43:05.1443430Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:05.1444337Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:05.1445343Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:05.1445952Z log.info( 2025-11-03T15:43:05.1446755Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:05.1447619Z ) 2025-11-03T15:43:05.1447996Z enabled = True 2025-11-03T15:43:05.1448269Z 2025-11-03T15:43:05.1448421Z if enabled: 2025-11-03T15:43:05.1448814Z label = experiment_name 2025-11-03T15:43:05.1449320Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:05.1450089Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:05.1450922Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:05.1451634Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:05.1452252Z if is_canary: 2025-11-03T15:43:05.1452703Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:05.1453207Z fleet_prefix = label 2025-11-03T15:43:05.1453651Z else: 2025-11-03T15:43:05.1454043Z prefixes.append(label) 2025-11-03T15:43:05.1454360Z 2025-11-03T15:43:05.1454530Z if len(prefixes) > 1: 2025-11-03T15:43:05.1455188Z log.error( 2025-11-03T15:43:05.1456158Z 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:05.1457201Z ) 2025-11-03T15:43:05.1457562Z prefixes = prefixes[:1] 2025-11-03T15:43:05.1457851Z 2025-11-03T15:43:05.1458022Z # Fleet always comes first 2025-11-03T15:43:05.1458466Z if fleet_prefix: 2025-11-03T15:43:05.1458878Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:05.1459219Z 2025-11-03T15:43:05.1459586Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:05.1459981Z 2025-11-03T15:43:05.1459987Z 2025-11-03T15:43:05.1460393Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:05.1461111Z """ 2025-11-03T15:43:05.1461645Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:05.1462169Z 2025-11-03T15:43:05.1462531Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:05.1463183Z """ 2025-11-03T15:43:05.1463537Z gh = get_gh_client(github_token) 2025-11-03T15:43:05.1464047Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:05.1464625Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:05.1465156Z 2025-11-03T15:43:05.1465162Z 2025-11-03T15:43:05.1465538Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:05.1466248Z for _ in range(num_retries): 2025-11-03T15:43:05.1466688Z try: 2025-11-03T15:43:05.1467086Z req = Request(url=url, headers=headers) 2025-11-03T15:43:05.1467699Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:05.1468289Z return json.loads(content) 2025-11-03T15:43:05.1468770Z except Exception as e: 2025-11-03T15:43:05.1469277Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:05.1469649Z 2025-11-03T15:43:05.1470000Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:05.1470656Z return {} 2025-11-03T15:43:05.1470858Z 2025-11-03T15:43:05.1470863Z 2025-11-03T15:43:05.1471014Z @cache 2025-11-03T15:43:05.1471584Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:05.1472275Z """ 2025-11-03T15:43:05.1472636Z Dynamically get PR information 2025-11-03T15:43:05.1473240Z """ 2025-11-03T15:43:05.1473690Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:05.1474271Z headers = { 2025-11-03T15:43:05.1474698Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:05.1475352Z "Authorization": f"token {github_token}", 2025-11-03T15:43:05.1475846Z } 2025-11-03T15:43:05.1476239Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:05.1476803Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:05.1477299Z headers=headers, 2025-11-03T15:43:05.1477696Z ) 2025-11-03T15:43:05.1477878Z 2025-11-03T15:43:05.1478043Z if not json_response: 2025-11-03T15:43:05.1478576Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:05.1479152Z return {} 2025-11-03T15:43:05.1479370Z 2025-11-03T15:43:05.1479532Z return json_response 2025-11-03T15:43:05.1479787Z 2025-11-03T15:43:05.1479793Z 2025-11-03T15:43:05.1480169Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:05.1480847Z """ 2025-11-03T15:43:05.1481330Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:05.1481928Z """ 2025-11-03T15:43:05.1482363Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:05.1482933Z return { 2025-11-03T15:43:05.1483476Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:05.1484118Z } 2025-11-03T15:43:05.1484300Z 2025-11-03T15:43:05.1484305Z 2025-11-03T15:43:05.1484460Z def main() -> None: 2025-11-03T15:43:05.1484979Z args = parse_args() 2025-11-03T15:43:05.1485229Z 2025-11-03T15:43:05.1485433Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:05.1485796Z 2025-11-03T15:43:05.1485968Z # Check if the PR is opt-out 2025-11-03T15:43:05.1486419Z if args.pr_number: 2025-11-03T15:43:05.1487018Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:05.1487860Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:05.1488318Z log.info( 2025-11-03T15:43:05.1488954Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:05.1489681Z ) 2025-11-03T15:43:05.1490203Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.1490822Z sys.exit() 2025-11-03T15:43:05.1491068Z 2025-11-03T15:43:05.1491216Z try: 2025-11-03T15:43:05.1491616Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:05.1492265Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:05.1492853Z ) 2025-11-03T15:43:05.1493041Z 2025-11-03T15:43:05.1493226Z username = get_potential_pr_author( 2025-11-03T15:43:05.1493728Z args.github_token, 2025-11-03T15:43:05.1494172Z args.github_repo, 2025-11-03T15:43:05.1494624Z args.github_actor, 2025-11-03T15:43:05.1495488Z args.github_ref_type, 2025-11-03T15:43:05.1495958Z args.github_branch, 2025-11-03T15:43:05.1496386Z ) 2025-11-03T15:43:05.1496577Z 2025-11-03T15:43:05.1496834Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:05.1497252Z 2025-11-03T15:43:05.1497458Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:05.1497965Z rollout_state, 2025-11-03T15:43:05.1498416Z (args.github_issue_owner, username), 2025-11-03T15:43:05.1498920Z args.github_branch, 2025-11-03T15:43:05.1499378Z args.eligible_experiments, 2025-11-03T15:43:05.1499861Z args.opt_out_experiments, 2025-11-03T15:43:05.1500325Z is_canary, 2025-11-03T15:43:05.1500703Z ) 2025-11-03T15:43:05.1500892Z 2025-11-03T15:43:05.1501062Z except Exception as e: 2025-11-03T15:43:05.1501475Z log.error( 2025-11-03T15:43:05.1502099Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:05.1502941Z ) 2025-11-03T15:43:05.1503128Z 2025-11-03T15:43:05.1503431Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:05.1503898Z 2025-11-03T15:43:05.1503903Z 2025-11-03T15:43:05.1504066Z if __name__ == "__main__": 2025-11-03T15:43:05.1504468Z main() 2025-11-03T15:43:05.1504659Z 2025-11-03T15:43:05.1593566Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:05.1594407Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:05.1627707Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:05.1628158Z env: 2025-11-03T15:43:05.1628713Z GITHUB_TOKEN: *** 2025-11-03T15:43:05.1629097Z ISSUE_NUMBER: 5132 2025-11-03T15:43:05.1629515Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:05.1629975Z ISSUE_OWNER: 2025-11-03T15:43:05.1630356Z CHECK_EXPERIMENTS: 2025-11-03T15:43:05.1630762Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:05.1631173Z PR_NUMBER: 2025-11-03T15:43:05.1631523Z ##[endgroup] 2025-11-03T15:43:08.6341104Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:10.3203332Z Collecting urllib3==1.26.18 2025-11-03T15:43:10.3534049Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:10.3744251Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-11-03T15:43:10.3965206Z Collecting PyGithub==2.3.0 2025-11-03T15:43:10.3995697Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:10.4431061Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:10.4462214Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:10.4505674Z 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:10.4522582Z 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:10.4537970Z 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:10.4780211Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:10.4810340Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:10.5038632Z 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.6237752Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.6274776Z 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.7746756Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:10.7781873Z 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.7970147Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:10.8002294Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:10.8236966Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:10.8314315Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 23.1 MB/s eta 0:00:00 2025-11-03T15:43:10.8361624Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:10.8425576Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 76.0 MB/s eta 0:00:00 2025-11-03T15:43:10.8459921Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:10.8586107Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 128.6 MB/s eta 0:00:00 2025-11-03T15:43:10.8621721Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:10.8677998Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:10.8727695Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 64.1 MB/s eta 0:00:00 2025-11-03T15:43:10.8758135Z 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.8800570Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 43.7 MB/s eta 0:00:00 2025-11-03T15:43:10.8829699Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:10.8872648Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 40.5 MB/s eta 0:00:00 2025-11-03T15:43:11.2602629Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:11.8036808Z 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.8916350Z ##[group]Run curr_branch="main" 2025-11-03T15:43:11.8916682Z curr_branch="main" 2025-11-03T15:43:11.8916911Z curr_ref_type="branch" 2025-11-03T15:43:11.8917169Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:11.8917459Z  2025-11-03T15:43:11.8917654Z python3 runner_determinator.py \ 2025-11-03T15:43:11.8917937Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:11.8918213Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:11.8918465Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:11.8918736Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:11.8919014Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:11.8919298Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:11.8919568Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:11.8919885Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:11.8920255Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:11.8920544Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:11.8954158Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:11.8954405Z env: 2025-11-03T15:43:11.8955075Z GITHUB_TOKEN: *** 2025-11-03T15:43:11.8955284Z ISSUE_NUMBER: 5132 2025-11-03T15:43:11.8955499Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:11.8955743Z ISSUE_OWNER: 2025-11-03T15:43:11.8955930Z CHECK_EXPERIMENTS: 2025-11-03T15:43:11.8956122Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:11.8956317Z PR_NUMBER: 2025-11-03T15:43:11.8956482Z ##[endgroup] 2025-11-03T15:43:11.9007677Z Current branch is 'main' 2025-11-03T15:43:13.8888091Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:13.8889248Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:13.8890191Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:13.8891074Z INFO : Setting output: label-type='' 2025-11-03T15:43:13.9219125Z Evaluate and set job outputs 2025-11-03T15:43:13.9226488Z Cleaning up orphan processes