2025-08-14T20:43:47.5956210Z Current runner version: '2.327.1' 2025-08-14T20:43:47.5978520Z ##[group]Runner Image Provisioner 2025-08-14T20:43:47.5979301Z Hosted Compute Agent 2025-08-14T20:43:47.5979948Z Version: 20250812.370 2025-08-14T20:43:47.5980518Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.5981177Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.5981789Z ##[endgroup] 2025-08-14T20:43:47.5982344Z ##[group]Operating System 2025-08-14T20:43:47.5982860Z Ubuntu 2025-08-14T20:43:47.5983375Z 24.04.2 2025-08-14T20:43:47.5983790Z LTS 2025-08-14T20:43:47.5984230Z ##[endgroup] 2025-08-14T20:43:47.5984759Z ##[group]Runner Image 2025-08-14T20:43:47.5985286Z Image: ubuntu-24.04 2025-08-14T20:43:47.5985779Z Version: 20250804.2.0 2025-08-14T20:43:47.5986788Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.5988603Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:47.5989635Z ##[endgroup] 2025-08-14T20:43:47.5990683Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.5992801Z Contents: read 2025-08-14T20:43:47.5993320Z Metadata: read 2025-08-14T20:43:47.5993808Z Packages: read 2025-08-14T20:43:47.5994239Z ##[endgroup] 2025-08-14T20:43:47.5996231Z Secret source: Actions 2025-08-14T20:43:47.5996879Z Prepare workflow directory 2025-08-14T20:43:47.6496834Z Prepare all required actions 2025-08-14T20:43:47.6550697Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.6555516Z ##[group] Inputs 2025-08-14T20:43:47.6556101Z check_experiments: 2025-08-14T20:43:47.6556647Z opt_out_experiments: 2025-08-14T20:43:47.6557153Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.6558141Z issue_owner: 2025-08-14T20:43:47.6558653Z curr_branch: main 2025-08-14T20:43:47.6559211Z curr_ref_type: branch 2025-08-14T20:43:47.6559861Z issue_number: 5132 2025-08-14T20:43:47.6560364Z ##[endgroup] 2025-08-14T20:43:47.6560937Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:47.7137477Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.7139863Z cat < runner_determinator.py 2025-08-14T20:43:47.7140494Z # flake8: noqa: G004 2025-08-14T20:43:47.7141029Z  2025-08-14T20:43:47.7141821Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.7142825Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.7143749Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.7144445Z  2025-08-14T20:43:47.7144896Z """ 2025-08-14T20:43:47.7145631Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.7146660Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.7148196Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.7149156Z of which runners should be used to run which job. 2025-08-14T20:43:47.7149910Z  2025-08-14T20:43:47.7150570Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.7151561Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.7152623Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.7153421Z list, defined. 2025-08-14T20:43:47.7153903Z  2025-08-14T20:43:47.7154582Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.7155603Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.7156513Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.7157515Z  2025-08-14T20:43:47.7158567Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.7159534Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.7160479Z experiments which the user could be opted in to. 2025-08-14T20:43:47.7161103Z  2025-08-14T20:43:47.7161588Z The user list has the following rules: 2025-08-14T20:43:47.7162238Z  2025-08-14T20:43:47.7162884Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.7163831Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.7164703Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.7165360Z  2025-08-14T20:43:47.7165766Z Example config: 2025-08-14T20:43:47.7166380Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.7167347Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.7168277Z  # Expected syntax is: 2025-08-14T20:43:47.7169103Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.7170146Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.7170982Z  2025-08-14T20:43:47.7171457Z  experiments: 2025-08-14T20:43:47.7171970Z  lf: 2025-08-14T20:43:47.7172457Z  rollout_percent: 25 2025-08-14T20:43:47.7172981Z  all_branches: false 2025-08-14T20:43:47.7173614Z  default: true 2025-08-14T20:43:47.7174100Z  --- 2025-08-14T20:43:47.7174530Z  2025-08-14T20:43:47.7175057Z  # Opt-ins: 2025-08-14T20:43:47.7175738Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.7176858Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.7177933Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.7178724Z  # Experiments should be from the above list. 2025-08-14T20:43:47.7179313Z  2025-08-14T20:43:47.7179855Z  @User1,-lf,split_build 2025-08-14T20:43:47.7180413Z  @User2,lf 2025-08-14T20:43:47.7180893Z  @User3,split_build 2025-08-14T20:43:47.7181480Z """ 2025-08-14T20:43:47.7181899Z  2025-08-14T20:43:47.7182339Z import json 2025-08-14T20:43:47.7182920Z import logging 2025-08-14T20:43:47.7183644Z import os 2025-08-14T20:43:47.7184151Z import random 2025-08-14T20:43:47.7184670Z import re 2025-08-14T20:43:47.7185179Z import sys 2025-08-14T20:43:47.7185675Z from argparse import ArgumentParser 2025-08-14T20:43:47.7186405Z from collections.abc import Iterable 2025-08-14T20:43:47.7187054Z from functools import cache 2025-08-14T20:43:47.7187615Z from logging import LogRecord 2025-08-14T20:43:47.7188557Z from typing import Any, NamedTuple 2025-08-14T20:43:47.7189235Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.7189867Z  2025-08-14T20:43:47.7190295Z import yaml 2025-08-14T20:43:47.7190885Z from github import Auth, Github 2025-08-14T20:43:47.7191494Z from github.Issue import Issue 2025-08-14T20:43:47.7192016Z  2025-08-14T20:43:47.7192510Z  2025-08-14T20:43:47.7193117Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.7194627Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.7195945Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.7197011Z  2025-08-14T20:43:47.7197534Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.7198502Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.7199194Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.7199841Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.7200497Z  2025-08-14T20:43:47.7200955Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.7201548Z  2025-08-14T20:43:47.7202083Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.7202696Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.7203247Z  2025-08-14T20:43:47.7203671Z  2025-08-14T20:43:47.7204156Z class Experiment(NamedTuple): 2025-08-14T20:43:47.7204715Z  rollout_perc: float = ( 2025-08-14T20:43:47.7205520Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.7206330Z  ) 2025-08-14T20:43:47.7206782Z  all_branches: bool = ( 2025-08-14T20:43:47.7207578Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.7208593Z  ) 2025-08-14T20:43:47.7209072Z  default: bool = ( 2025-08-14T20:43:47.7209726Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.7210576Z  ) 2025-08-14T20:43:47.7211024Z  2025-08-14T20:43:47.7211441Z  # Add more fields as needed 2025-08-14T20:43:47.7212080Z  2025-08-14T20:43:47.7212476Z  2025-08-14T20:43:47.7212921Z class Settings(NamedTuple): 2025-08-14T20:43:47.7213525Z  """ 2025-08-14T20:43:47.7214140Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.7214791Z  """ 2025-08-14T20:43:47.7215272Z  2025-08-14T20:43:47.7215775Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.7216359Z  2025-08-14T20:43:47.7217013Z  2025-08-14T20:43:47.7217506Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.7218392Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.7219077Z  2025-08-14T20:43:47.7219543Z  COLORS = { 2025-08-14T20:43:47.7220081Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.7220730Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.7221352Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.7221925Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.7222554Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.7223113Z  } 2025-08-14T20:43:47.7223559Z  2025-08-14T20:43:47.7224133Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.7224966Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.7225842Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.7226471Z  return super().format(record) 2025-08-14T20:43:47.7227120Z  2025-08-14T20:43:47.7227550Z  2025-08-14T20:43:47.7228306Z handler = logging.StreamHandler() 2025-08-14T20:43:47.7229556Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.7230335Z  2025-08-14T20:43:47.7230871Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.7231611Z log.addHandler(handler) 2025-08-14T20:43:47.7232187Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.7232759Z  2025-08-14T20:43:47.7233207Z  2025-08-14T20:43:47.7233767Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.7234399Z  """ 2025-08-14T20:43:47.7235069Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.7235912Z  """ 2025-08-14T20:43:47.7236424Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.7237658Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.7238928Z  log.warning( 2025-08-14T20:43:47.7239889Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.7240879Z  ) 2025-08-14T20:43:47.7241496Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.7242750Z  return 2025-08-14T20:43:47.7243574Z  2025-08-14T20:43:47.7244361Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.7245271Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.7245988Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.7246570Z  2025-08-14T20:43:47.7247036Z  2025-08-14T20:43:47.7247676Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.7248664Z  return frozenset( 2025-08-14T20:43:47.7249419Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.7250134Z  ) 2025-08-14T20:43:47.7250658Z  2025-08-14T20:43:47.7251081Z  2025-08-14T20:43:47.7251520Z def parse_args() -> Any: 2025-08-14T20:43:47.7252276Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.7253202Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.7254028Z  parser.add_argument( 2025-08-14T20:43:47.7254633Z  "--github-issue-repo", 2025-08-14T20:43:47.7255245Z  type=str, 2025-08-14T20:43:47.7255747Z  required=False, 2025-08-14T20:43:47.7256528Z  default="pytorch/test-infra", 2025-08-14T20:43:47.7257199Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.7257897Z  ) 2025-08-14T20:43:47.7258494Z  parser.add_argument( 2025-08-14T20:43:47.7259034Z  "--github-repo", 2025-08-14T20:43:47.7259581Z  type=str, 2025-08-14T20:43:47.7260164Z  required=True, 2025-08-14T20:43:47.7260796Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.7261441Z  ) 2025-08-14T20:43:47.7261914Z  parser.add_argument( 2025-08-14T20:43:47.7262700Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.7263448Z  ) 2025-08-14T20:43:47.7263957Z  parser.add_argument( 2025-08-14T20:43:47.7264707Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.7265480Z  ) 2025-08-14T20:43:47.7265985Z  parser.add_argument( 2025-08-14T20:43:47.7266756Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.7267525Z  ) 2025-08-14T20:43:47.7335418Z  parser.add_argument( 2025-08-14T20:43:47.7336802Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.7338292Z  ) 2025-08-14T20:43:47.7339008Z  parser.add_argument( 2025-08-14T20:43:47.7339893Z  "--github-ref-type", 2025-08-14T20:43:47.7340794Z  type=str, 2025-08-14T20:43:47.7341585Z  required=True, 2025-08-14T20:43:47.7342134Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.7342684Z  ) 2025-08-14T20:43:47.7343070Z  parser.add_argument( 2025-08-14T20:43:47.7343779Z  "--eligible-experiments", 2025-08-14T20:43:47.7344327Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.7344855Z  required=False, 2025-08-14T20:43:47.7345334Z  default="", 2025-08-14T20:43:47.7346221Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.7347129Z  ) 2025-08-14T20:43:47.7347508Z  parser.add_argument( 2025-08-14T20:43:47.7348217Z  "--opt-out-experiments", 2025-08-14T20:43:47.7348745Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.7349265Z  required=False, 2025-08-14T20:43:47.7349716Z  default="", 2025-08-14T20:43:47.7350144Z  help=( 2025-08-14T20:43:47.7350839Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.7351945Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.7352755Z  ), 2025-08-14T20:43:47.7353126Z  ) 2025-08-14T20:43:47.7353514Z  parser.add_argument( 2025-08-14T20:43:47.7353982Z  "--pr-number", 2025-08-14T20:43:47.7354430Z  type=str, 2025-08-14T20:43:47.7354857Z  required=False, 2025-08-14T20:43:47.7355301Z  default="", 2025-08-14T20:43:47.7355827Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.7356372Z  ) 2025-08-14T20:43:47.7356728Z  2025-08-14T20:43:47.7357096Z  return parser.parse_args() 2025-08-14T20:43:47.7357567Z  2025-08-14T20:43:47.7358205Z  2025-08-14T20:43:47.7358810Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.7359729Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.7360247Z  return Github(auth=auth) 2025-08-14T20:43:47.7360708Z  2025-08-14T20:43:47.7361041Z  2025-08-14T20:43:47.7361676Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.7362478Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.7363076Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.7363608Z  2025-08-14T20:43:47.7363940Z  2025-08-14T20:43:47.7364303Z def get_potential_pr_author( 2025-08-14T20:43:47.7364978Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.7365640Z ) -> str: 2025-08-14T20:43:47.7366171Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.7366968Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.7367719Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.7368588Z  2025-08-14T20:43:47.7368979Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.7369462Z  2025-08-14T20:43:47.7369926Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.7370555Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.7371063Z  if ( 2025-08-14T20:43:47.7371469Z  len(split_tag) == 3 2025-08-14T20:43:47.7371977Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.7372510Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.7373051Z  ): 2025-08-14T20:43:47.7373525Z  pr_number = split_tag[2] 2025-08-14T20:43:47.7374100Z  try: 2025-08-14T20:43:47.7374615Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.7375367Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.7375985Z  except Exception as e: 2025-08-14T20:43:47.7376524Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.7377189Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.7378004Z  ) from e 2025-08-14T20:43:47.7378575Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.7379268Z  # In all other cases, return the original input username 2025-08-14T20:43:47.7379851Z  return username 2025-08-14T20:43:47.7380262Z  2025-08-14T20:43:47.7380587Z  2025-08-14T20:43:47.7380999Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.7381527Z  """ 2025-08-14T20:43:47.7382177Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.7382934Z  """ 2025-08-14T20:43:47.7383484Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.7384138Z  2025-08-14T20:43:47.7384468Z  2025-08-14T20:43:47.7384851Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.7385351Z  try: 2025-08-14T20:43:47.7385776Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.7386302Z  return data 2025-08-14T20:43:47.7386762Z  except yaml.YAMLError: 2025-08-14T20:43:47.7387279Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.7388128Z  raise 2025-08-14T20:43:47.7388524Z  2025-08-14T20:43:47.7388852Z  2025-08-14T20:43:47.7389442Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.7390172Z  """ 2025-08-14T20:43:47.7390923Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.7391665Z  2025-08-14T20:43:47.7392194Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.7392944Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.7393490Z  2025-08-14T20:43:47.7394048Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.7394722Z  """ 2025-08-14T20:43:47.7395178Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.7395760Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.7396371Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.7396941Z  else: 2025-08-14T20:43:47.7397343Z  return "", rollout_state 2025-08-14T20:43:47.7398004Z  2025-08-14T20:43:47.7398410Z  2025-08-14T20:43:47.7398804Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.7399314Z  """ 2025-08-14T20:43:47.7399844Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.7400479Z  """ 2025-08-14T20:43:47.7400822Z  2025-08-14T20:43:47.7401151Z  2025-08-14T20:43:47.7401682Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.7402326Z  """ 2025-08-14T20:43:47.7403073Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.7403879Z  2025-08-14T20:43:47.7404658Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.7405623Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.7406461Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.7407083Z  2025-08-14T20:43:47.7407402Z  2025-08-14T20:43:47.7408275Z  """ 2025-08-14T20:43:47.7408684Z  optins = UserOptins() 2025-08-14T20:43:47.7409209Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.7409758Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.7410311Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.7410916Z  # Not a valid user. Skip 2025-08-14T20:43:47.7411425Z  continue 2025-08-14T20:43:47.7411833Z  2025-08-14T20:43:47.7412166Z  if user: 2025-08-14T20:43:47.7412630Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.7413305Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.7413933Z  2025-08-14T20:43:47.7414285Z  return optins 2025-08-14T20:43:47.7414683Z  2025-08-14T20:43:47.7415007Z  2025-08-14T20:43:47.7415493Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.7416094Z  """ 2025-08-14T20:43:47.7416500Z  Check if the experiment name is valid. 2025-08-14T20:43:47.7417016Z  A valid name: 2025-08-14T20:43:47.7417672Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.7418810Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.7419500Z  - Cannot contain spaces 2025-08-14T20:43:47.7419964Z  """ 2025-08-14T20:43:47.7420316Z  2025-08-14T20:43:47.7420759Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.7421456Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.7422159Z  2025-08-14T20:43:47.7422501Z  if valid: 2025-08-14T20:43:47.7422905Z  return True 2025-08-14T20:43:47.7423304Z  2025-08-14T20:43:47.7423635Z  log.error( 2025-08-14T20:43:47.7425031Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.7426493Z  ) 2025-08-14T20:43:47.7426856Z  return False 2025-08-14T20:43:47.7427244Z  2025-08-14T20:43:47.7427558Z  2025-08-14T20:43:47.7428167Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.7428784Z  """ 2025-08-14T20:43:47.7429369Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.7430055Z  """ 2025-08-14T20:43:47.7430406Z  try: 2025-08-14T20:43:47.7430778Z  if settings_text: 2025-08-14T20:43:47.7431502Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.7432253Z  # for easy reading 2025-08-14T20:43:47.7433049Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.7433902Z  # the backtick character in shell commands. 2025-08-14T20:43:47.7434498Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.7435159Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.7435806Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.7436300Z  2025-08-14T20:43:47.7437001Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.7437881Z  experiments = {} 2025-08-14T20:43:47.7438472Z  2025-08-14T20:43:47.7439012Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.7439765Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.7440816Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.7441808Z  continue 2025-08-14T20:43:47.7442245Z  2025-08-14T20:43:47.7442612Z  valid_settings = {} 2025-08-14T20:43:47.7443137Z  for setting in exp_settings: 2025-08-14T20:43:47.7443697Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.7444251Z  log.warning( 2025-08-14T20:43:47.7444951Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.7445653Z  ) 2025-08-14T20:43:47.7446092Z  else: 2025-08-14T20:43:47.7446630Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.7447180Z  2025-08-14T20:43:47.7447641Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.7448491Z  return Settings(experiments) 2025-08-14T20:43:47.7448971Z  2025-08-14T20:43:47.7449318Z  except Exception: 2025-08-14T20:43:47.7449818Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.7450347Z  2025-08-14T20:43:47.7450689Z  return Settings() 2025-08-14T20:43:47.7451099Z  2025-08-14T20:43:47.7451422Z  2025-08-14T20:43:47.7452007Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.7452585Z  """ 2025-08-14T20:43:47.7453024Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.7453558Z  2025-08-14T20:43:47.7454075Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.7454818Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.7455356Z  2025-08-14T20:43:47.7455928Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.7456626Z  """ 2025-08-14T20:43:47.7457177Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.7458046Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.7458582Z  2025-08-14T20:43:47.7458907Z  2025-08-14T20:43:47.7459345Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.7459883Z  """ 2025-08-14T20:43:47.7460282Z  Parse users from the rollout state. 2025-08-14T20:43:47.7460767Z  2025-08-14T20:43:47.7461087Z  """ 2025-08-14T20:43:47.7461619Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.7462349Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.7462902Z  2025-08-14T20:43:47.7463219Z  2025-08-14T20:43:47.7463825Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.7464540Z  """ 2025-08-14T20:43:47.7464973Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.7465480Z  """ 2025-08-14T20:43:47.7465953Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.7466632Z  2025-08-14T20:43:47.7466952Z  2025-08-14T20:43:47.7467557Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.7468391Z  """ 2025-08-14T20:43:47.7468866Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.7469418Z  """ 2025-08-14T20:43:47.7469932Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.7470608Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.7471243Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.7471827Z  return False 2025-08-14T20:43:47.7472230Z  2025-08-14T20:43:47.7472684Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.7473258Z  log.warning( 2025-08-14T20:43:47.7474059Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.7474892Z  ) 2025-08-14T20:43:47.7475254Z  2025-08-14T20:43:47.7475590Z  return True 2025-08-14T20:43:47.7475977Z  2025-08-14T20:43:47.7476296Z  2025-08-14T20:43:47.7476637Z def get_runner_prefix( 2025-08-14T20:43:47.7477090Z  rollout_state: str, 2025-08-14T20:43:47.7477567Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.7478318Z  branch: str, 2025-08-14T20:43:47.7478833Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.7479502Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.7480080Z  is_canary: bool = False, 2025-08-14T20:43:47.7480531Z ) -> str: 2025-08-14T20:43:47.7480969Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.7481535Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.7482047Z  2025-08-14T20:43:47.7482517Z  fleet_prefix = "" 2025-08-14T20:43:47.7482961Z  prefixes = [] 2025-08-14T20:43:47.7483622Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.7484548Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.7485229Z  log.info( 2025-08-14T20:43:47.7485903Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.7486618Z  ) 2025-08-14T20:43:47.7487011Z  continue 2025-08-14T20:43:47.7487408Z  2025-08-14T20:43:47.7488119Z  if opt_out_experiments: 2025-08-14T20:43:47.7488940Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.7489573Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.7490152Z  log.info( 2025-08-14T20:43:47.7491058Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.7491975Z  ) 2025-08-14T20:43:47.7492383Z  continue 2025-08-14T20:43:47.7492808Z  2025-08-14T20:43:47.7493165Z  if eligible_experiments: 2025-08-14T20:43:47.7493730Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.7494345Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.7494890Z  log.info( 2025-08-14T20:43:47.7495665Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.7496458Z  ) 2025-08-14T20:43:47.7497023Z  continue 2025-08-14T20:43:47.7497526Z  elif not experiment_settings.default: 2025-08-14T20:43:47.7498298Z  log.info( 2025-08-14T20:43:47.7498967Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.7499661Z  ) 2025-08-14T20:43:47.7500046Z  continue 2025-08-14T20:43:47.7500445Z  2025-08-14T20:43:47.7500899Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.7501497Z  opted_out_users = [ 2025-08-14T20:43:47.7501962Z  requestor 2025-08-14T20:43:47.7502440Z  for requestor in workflow_requestors 2025-08-14T20:43:47.7503100Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.7503706Z  ] 2025-08-14T20:43:47.7504067Z  2025-08-14T20:43:47.7504415Z  if opted_out_users: 2025-08-14T20:43:47.7504873Z  log.info( 2025-08-14T20:43:47.7505507Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.7506162Z  ) 2025-08-14T20:43:47.7506558Z  continue 2025-08-14T20:43:47.7506956Z  2025-08-14T20:43:47.7507411Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.7508113Z  opted_in_users = [ 2025-08-14T20:43:47.7508566Z  requestor 2025-08-14T20:43:47.7509048Z  for requestor in workflow_requestors 2025-08-14T20:43:47.7509699Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.7510297Z  ] 2025-08-14T20:43:47.7510651Z  2025-08-14T20:43:47.7510987Z  enabled = False 2025-08-14T20:43:47.7511440Z  if opted_in_users: 2025-08-14T20:43:47.7512016Z  log.info( 2025-08-14T20:43:47.7512649Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.7513296Z  ) 2025-08-14T20:43:47.7513690Z  enabled = True 2025-08-14T20:43:47.7514114Z  2025-08-14T20:43:47.7514521Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.7515323Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.7516221Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.7516840Z  log.info( 2025-08-14T20:43:47.7517683Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.7518664Z  ) 2025-08-14T20:43:47.7519082Z  enabled = True 2025-08-14T20:43:47.7519535Z  2025-08-14T20:43:47.7519875Z  if enabled: 2025-08-14T20:43:47.7520325Z  label = experiment_name 2025-08-14T20:43:47.7520877Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.7521666Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.7522509Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.7523258Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.7523894Z  if is_canary: 2025-08-14T20:43:47.7524402Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.7524932Z  fleet_prefix = label 2025-08-14T20:43:47.7525536Z  else: 2025-08-14T20:43:47.7525980Z  prefixes.append(label) 2025-08-14T20:43:47.7526466Z  2025-08-14T20:43:47.7526813Z  if len(prefixes) > 1: 2025-08-14T20:43:47.7527252Z  log.error( 2025-08-14T20:43:47.7528526Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.7529581Z  ) 2025-08-14T20:43:47.7529976Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.7530434Z  2025-08-14T20:43:47.7530785Z  # Fleet always comes first 2025-08-14T20:43:47.7531259Z  if fleet_prefix: 2025-08-14T20:43:47.7531716Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.7532212Z  2025-08-14T20:43:47.7532638Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.7533189Z  2025-08-14T20:43:47.7533506Z  2025-08-14T20:43:47.7534123Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.7534852Z  """ 2025-08-14T20:43:47.7535447Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.7536122Z  2025-08-14T20:43:47.7536672Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.7537340Z  """ 2025-08-14T20:43:47.7537879Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.7538475Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.7539106Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.7539682Z  2025-08-14T20:43:47.7540007Z  2025-08-14T20:43:47.7540573Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.7541430Z  for _ in range(num_retries): 2025-08-14T20:43:47.7541904Z  try: 2025-08-14T20:43:47.7542342Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.7542985Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.7543615Z  return json.loads(content) 2025-08-14T20:43:47.7544130Z  except Exception as e: 2025-08-14T20:43:47.7544681Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.7545215Z  2025-08-14T20:43:47.7545761Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.7546446Z  return {} 2025-08-14T20:43:47.7546822Z  2025-08-14T20:43:47.7547148Z  2025-08-14T20:43:47.7547481Z @cache 2025-08-14T20:43:47.7548219Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.7548955Z  """ 2025-08-14T20:43:47.7549353Z  Dynamically get PR information 2025-08-14T20:43:47.7549835Z  """ 2025-08-14T20:43:47.7550341Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.7550961Z  headers = { 2025-08-14T20:43:47.7551441Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.7552045Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.7552553Z  } 2025-08-14T20:43:47.7552982Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.7553585Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.7554108Z  headers=headers, 2025-08-14T20:43:47.7554546Z  ) 2025-08-14T20:43:47.7554890Z  2025-08-14T20:43:47.7555234Z  if not json_response: 2025-08-14T20:43:47.7555956Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.7556562Z  return {} 2025-08-14T20:43:47.7556967Z  2025-08-14T20:43:47.7557312Z  return json_response 2025-08-14T20:43:47.7557843Z  2025-08-14T20:43:47.7558162Z  2025-08-14T20:43:47.7558729Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.7559420Z  """ 2025-08-14T20:43:47.7559949Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.7560573Z  """ 2025-08-14T20:43:47.7561052Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.7561638Z  return { 2025-08-14T20:43:47.7562219Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.7562904Z  } 2025-08-14T20:43:47.7563237Z  2025-08-14T20:43:47.7563567Z  2025-08-14T20:43:47.7563908Z def main() -> None: 2025-08-14T20:43:47.7564342Z  args = parse_args() 2025-08-14T20:43:47.7564773Z  2025-08-14T20:43:47.7565174Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.7565694Z  2025-08-14T20:43:47.7566047Z  # Check if the PR is opt-out 2025-08-14T20:43:47.7566532Z  if args.pr_number: 2025-08-14T20:43:47.7567191Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.7568174Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.7568675Z  log.info( 2025-08-14T20:43:47.7569359Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.7570091Z  ) 2025-08-14T20:43:47.7570643Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.7571293Z  sys.exit() 2025-08-14T20:43:47.7571873Z  2025-08-14T20:43:47.7572206Z  try: 2025-08-14T20:43:47.7572649Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.7573348Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.7573961Z  ) 2025-08-14T20:43:47.7574316Z  2025-08-14T20:43:47.7574700Z  username = get_potential_pr_author( 2025-08-14T20:43:47.7575220Z  args.github_token, 2025-08-14T20:43:47.7575699Z  args.github_repo, 2025-08-14T20:43:47.7576170Z  args.github_actor, 2025-08-14T20:43:47.7576658Z  args.github_ref_type, 2025-08-14T20:43:47.7577158Z  args.github_branch, 2025-08-14T20:43:47.7577613Z  ) 2025-08-14T20:43:47.7578202Z  2025-08-14T20:43:47.7578673Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.7579250Z  2025-08-14T20:43:47.7579633Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.7580160Z  rollout_state, 2025-08-14T20:43:47.7580662Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.7581183Z  args.github_branch, 2025-08-14T20:43:47.7581687Z  args.eligible_experiments, 2025-08-14T20:43:47.7582216Z  args.opt_out_experiments, 2025-08-14T20:43:47.7582717Z  is_canary, 2025-08-14T20:43:47.7583130Z  ) 2025-08-14T20:43:47.7583488Z  2025-08-14T20:43:47.7583838Z  except Exception as e: 2025-08-14T20:43:47.7584297Z  log.error( 2025-08-14T20:43:47.7584975Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.7585821Z  ) 2025-08-14T20:43:47.7586177Z  2025-08-14T20:43:47.7586687Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.7587318Z  2025-08-14T20:43:47.7587635Z  2025-08-14T20:43:47.7588106Z if __name__ == "__main__": 2025-08-14T20:43:47.7588550Z  main() 2025-08-14T20:43:47.7588915Z  2025-08-14T20:43:47.7589237Z EOF 2025-08-14T20:43:47.7589567Z  2025-08-14T20:43:47.7589924Z cat runner_determinator.py 2025-08-14T20:43:47.7888762Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.7889608Z env: 2025-08-14T20:43:47.7890261Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.7890686Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.7891143Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.7891658Z ISSUE_OWNER: 2025-08-14T20:43:47.7892065Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.7892500Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.7893072Z PR_NUMBER: 2025-08-14T20:43:47.7893465Z ##[endgroup] 2025-08-14T20:43:47.8131828Z # flake8: noqa: G004 2025-08-14T20:43:47.8132329Z 2025-08-14T20:43:47.8133022Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.8134637Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.8135978Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.8136711Z 2025-08-14T20:43:47.8136979Z """ 2025-08-14T20:43:47.8144612Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.8146250Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.8147999Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.8149401Z of which runners should be used to run which job. 2025-08-14T20:43:47.8150119Z 2025-08-14T20:43:47.8150799Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.8152640Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.8154207Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.8155358Z list, defined. 2025-08-14T20:43:47.8155723Z 2025-08-14T20:43:47.8156115Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.8156958Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.8158025Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.8158458Z 2025-08-14T20:43:47.8158813Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.8159604Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.8160299Z experiments which the user could be opted in to. 2025-08-14T20:43:47.8160666Z 2025-08-14T20:43:47.8160847Z The user list has the following rules: 2025-08-14T20:43:47.8161183Z 2025-08-14T20:43:47.8161477Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.8162273Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.8162971Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.8163334Z 2025-08-14T20:43:47.8163494Z Example config: 2025-08-14T20:43:47.8163911Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.8164529Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.8165117Z # Expected syntax is: 2025-08-14T20:43:47.8165717Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.8166619Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.8167192Z 2025-08-14T20:43:47.8167349Z experiments: 2025-08-14T20:43:47.8167708Z lf: 2025-08-14T20:43:47.8168269Z rollout_percent: 25 2025-08-14T20:43:47.8168894Z all_branches: false 2025-08-14T20:43:47.8169307Z default: true 2025-08-14T20:43:47.8169682Z --- 2025-08-14T20:43:47.8169868Z 2025-08-14T20:43:47.8170015Z # Opt-ins: 2025-08-14T20:43:47.8170872Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.8171662Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.8172375Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.8172980Z # Experiments should be from the above list. 2025-08-14T20:43:47.8173326Z 2025-08-14T20:43:47.8173490Z @User1,-lf,split_build 2025-08-14T20:43:47.8173885Z @User2,lf 2025-08-14T20:43:47.8174229Z @User3,split_build 2025-08-14T20:43:47.8174600Z """ 2025-08-14T20:43:47.8174776Z 2025-08-14T20:43:47.8174925Z import json 2025-08-14T20:43:47.8175270Z import logging 2025-08-14T20:43:47.8175608Z import os 2025-08-14T20:43:47.8175943Z import random 2025-08-14T20:43:47.8176295Z import re 2025-08-14T20:43:47.8176621Z import sys 2025-08-14T20:43:47.8176987Z from argparse import ArgumentParser 2025-08-14T20:43:47.8177463Z from collections.abc import Iterable 2025-08-14T20:43:47.8178664Z from functools import cache 2025-08-14T20:43:47.8179104Z from logging import LogRecord 2025-08-14T20:43:47.8179554Z from typing import Any, NamedTuple 2025-08-14T20:43:47.8180080Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.8180442Z 2025-08-14T20:43:47.8180591Z import yaml 2025-08-14T20:43:47.8180945Z from github import Auth, Github 2025-08-14T20:43:47.8181396Z from github.Issue import Issue 2025-08-14T20:43:47.8181668Z 2025-08-14T20:43:47.8181674Z 2025-08-14T20:43:47.8181878Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.8182506Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.8183292Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.8183796Z 2025-08-14T20:43:47.8184011Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.8184681Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.8185155Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.8185664Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.8185984Z 2025-08-14T20:43:47.8186177Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.8186477Z 2025-08-14T20:43:47.8186644Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.8187065Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.8187317Z 2025-08-14T20:43:47.8187323Z 2025-08-14T20:43:47.8187502Z class Experiment(NamedTuple): 2025-08-14T20:43:47.8188172Z rollout_perc: float = ( 2025-08-14T20:43:47.8188765Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.8189380Z ) 2025-08-14T20:43:47.8189718Z all_branches: bool = ( 2025-08-14T20:43:47.8190292Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.8190914Z ) 2025-08-14T20:43:47.8191232Z default: bool = ( 2025-08-14T20:43:47.8191753Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.8192335Z ) 2025-08-14T20:43:47.8192516Z 2025-08-14T20:43:47.8192682Z # Add more fields as needed 2025-08-14T20:43:47.8192958Z 2025-08-14T20:43:47.8192964Z 2025-08-14T20:43:47.8193134Z class Settings(NamedTuple): 2025-08-14T20:43:47.8193529Z """ 2025-08-14T20:43:47.8193940Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.8194455Z """ 2025-08-14T20:43:47.8194635Z 2025-08-14T20:43:47.8194819Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.8195156Z 2025-08-14T20:43:47.8195162Z 2025-08-14T20:43:47.8195362Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.8195927Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.8196323Z 2025-08-14T20:43:47.8196474Z COLORS = { 2025-08-14T20:43:47.8196831Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.8197431Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.8198069Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.8198535Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.8198969Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.8199389Z } 2025-08-14T20:43:47.8199568Z 2025-08-14T20:43:47.8199776Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.8200453Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.8201159Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.8201687Z return super().format(record) 2025-08-14T20:43:47.8201996Z 2025-08-14T20:43:47.8202001Z 2025-08-14T20:43:47.8202180Z handler = logging.StreamHandler() 2025-08-14T20:43:47.8202815Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.8203326Z 2025-08-14T20:43:47.8203546Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.8204084Z log.addHandler(handler) 2025-08-14T20:43:47.8204481Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.8204739Z 2025-08-14T20:43:47.8204751Z 2025-08-14T20:43:47.8204976Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.8205483Z """ 2025-08-14T20:43:47.8205940Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.8206499Z """ 2025-08-14T20:43:47.8206827Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.8207995Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.8209034Z log.warning( 2025-08-14T20:43:47.8209816Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.8210648Z ) 2025-08-14T20:43:47.8220823Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.8221383Z return 2025-08-14T20:43:47.8221612Z 2025-08-14T20:43:47.8221976Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.8222521Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.8223035Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.8223330Z 2025-08-14T20:43:47.8223337Z 2025-08-14T20:43:47.8223617Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.8224187Z return frozenset( 2025-08-14T20:43:47.8224736Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.8225371Z ) 2025-08-14T20:43:47.8225551Z 2025-08-14T20:43:47.8225558Z 2025-08-14T20:43:47.8225720Z def parse_args() -> Any: 2025-08-14T20:43:47.8226218Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.8226990Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.8227682Z parser.add_argument( 2025-08-14T20:43:47.8228321Z "--github-issue-repo", 2025-08-14T20:43:47.8228744Z type=str, 2025-08-14T20:43:47.8229094Z required=False, 2025-08-14T20:43:47.8229494Z default="pytorch/test-infra", 2025-08-14T20:43:47.8229960Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.8230416Z ) 2025-08-14T20:43:47.8230742Z parser.add_argument( 2025-08-14T20:43:47.8231132Z "--github-repo", 2025-08-14T20:43:47.8231507Z type=str, 2025-08-14T20:43:47.8231855Z required=True, 2025-08-14T20:43:47.8232259Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.8232719Z ) 2025-08-14T20:43:47.8233040Z parser.add_argument( 2025-08-14T20:43:47.8233570Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.8234166Z ) 2025-08-14T20:43:47.8234492Z parser.add_argument( 2025-08-14T20:43:47.8235055Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.8235665Z ) 2025-08-14T20:43:47.8236124Z parser.add_argument( 2025-08-14T20:43:47.8236700Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.8237320Z ) 2025-08-14T20:43:47.8237643Z parser.add_argument( 2025-08-14T20:43:47.8238478Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.8239123Z ) 2025-08-14T20:43:47.8239445Z parser.add_argument( 2025-08-14T20:43:47.8239849Z "--github-ref-type", 2025-08-14T20:43:47.8240240Z type=str, 2025-08-14T20:43:47.8240633Z required=True, 2025-08-14T20:43:47.8241063Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.8241555Z ) 2025-08-14T20:43:47.8241882Z parser.add_argument( 2025-08-14T20:43:47.8242287Z "--eligible-experiments", 2025-08-14T20:43:47.8242747Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.8243204Z required=False, 2025-08-14T20:43:47.8243614Z default="", 2025-08-14T20:43:47.8244389Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.8245224Z ) 2025-08-14T20:43:47.8245548Z parser.add_argument( 2025-08-14T20:43:47.8245959Z "--opt-out-experiments", 2025-08-14T20:43:47.8246410Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.8246881Z required=False, 2025-08-14T20:43:47.8247256Z default="", 2025-08-14T20:43:47.8247601Z help=( 2025-08-14T20:43:47.8248424Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.8249458Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.8250220Z ), 2025-08-14T20:43:47.8250532Z ) 2025-08-14T20:43:47.8250880Z parser.add_argument( 2025-08-14T20:43:47.8251274Z "--pr-number", 2025-08-14T20:43:47.8251635Z type=str, 2025-08-14T20:43:47.8252006Z required=False, 2025-08-14T20:43:47.8252375Z default="", 2025-08-14T20:43:47.8252934Z help="the optional PR number where this is run", 2025-08-14T20:43:47.8253440Z ) 2025-08-14T20:43:47.8253621Z 2025-08-14T20:43:47.8253789Z return parser.parse_args() 2025-08-14T20:43:47.8254064Z 2025-08-14T20:43:47.8254071Z 2025-08-14T20:43:47.8254436Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.8255115Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.8255564Z return Github(auth=auth) 2025-08-14T20:43:47.8255826Z 2025-08-14T20:43:47.8255833Z 2025-08-14T20:43:47.8256237Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.8256963Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.8257410Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.8257857Z 2025-08-14T20:43:47.8257863Z 2025-08-14T20:43:47.8258033Z def get_potential_pr_author( 2025-08-14T20:43:47.8258618Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.8259221Z ) -> str: 2025-08-14T20:43:47.8259684Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.8260403Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.8261069Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.8261440Z 2025-08-14T20:43:47.8261609Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.8261911Z 2025-08-14T20:43:47.8262148Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.8262703Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.8263149Z if ( 2025-08-14T20:43:47.8263494Z len(split_tag) == 3 2025-08-14T20:43:47.8263926Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.8264400Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.8264839Z ): 2025-08-14T20:43:47.8265309Z pr_number = split_tag[2] 2025-08-14T20:43:47.8265737Z try: 2025-08-14T20:43:47.8266124Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.8266668Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.8267268Z except Exception as e: 2025-08-14T20:43:47.8267910Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.8268555Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.8269140Z ) from e 2025-08-14T20:43:47.8269625Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.8270256Z # In all other cases, return the original input username 2025-08-14T20:43:47.8270782Z return username 2025-08-14T20:43:47.8271009Z 2025-08-14T20:43:47.8271015Z 2025-08-14T20:43:47.8271216Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.8271699Z """ 2025-08-14T20:43:47.8272272Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.8272982Z """ 2025-08-14T20:43:47.8273469Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.8273948Z 2025-08-14T20:43:47.8273954Z 2025-08-14T20:43:47.8274127Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.8274564Z try: 2025-08-14T20:43:47.8274917Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.8275369Z return data 2025-08-14T20:43:47.8275744Z except yaml.YAMLError: 2025-08-14T20:43:47.8276174Z log.exception("Error loading YAML") 2025-08-14T20:43:47.8276632Z raise 2025-08-14T20:43:47.8276826Z 2025-08-14T20:43:47.8276831Z 2025-08-14T20:43:47.8277213Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.8278084Z """ 2025-08-14T20:43:47.8278658Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.8279217Z 2025-08-14T20:43:47.8279654Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.8280350Z and the text below is the list of opted in users. 2025-08-14T20:43:47.8280715Z 2025-08-14T20:43:47.8281058Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.8281680Z """ 2025-08-14T20:43:47.8282082Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.8282612Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.8283152Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.8283669Z else: 2025-08-14T20:43:47.8284011Z return "", rollout_state 2025-08-14T20:43:47.8284286Z 2025-08-14T20:43:47.8284292Z 2025-08-14T20:43:47.8284480Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.8284929Z """ 2025-08-14T20:43:47.8285399Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.8285988Z """ 2025-08-14T20:43:47.8286172Z 2025-08-14T20:43:47.8286178Z 2025-08-14T20:43:47.8286487Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.8287073Z """ 2025-08-14T20:43:47.8287712Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.8288458Z 2025-08-14T20:43:47.8289032Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.8289937Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.8290549Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.8290991Z 2025-08-14T20:43:47.8290997Z 2025-08-14T20:43:47.8291133Z """ 2025-08-14T20:43:47.8291468Z optins = UserOptins() 2025-08-14T20:43:47.8291901Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.8292392Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.8293012Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.8293512Z # Not a valid user. Skip 2025-08-14T20:43:47.8293945Z continue 2025-08-14T20:43:47.8294169Z 2025-08-14T20:43:47.8294313Z if user: 2025-08-14T20:43:47.8294705Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.8295323Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.8295791Z 2025-08-14T20:43:47.8295939Z return optins 2025-08-14T20:43:47.8296151Z 2025-08-14T20:43:47.8296157Z 2025-08-14T20:43:47.8296421Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.8296962Z """ 2025-08-14T20:43:47.8297312Z Check if the experiment name is valid. 2025-08-14T20:43:47.8297888Z A valid name: 2025-08-14T20:43:47.8298478Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.8370052Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.8370731Z - Cannot contain spaces 2025-08-14T20:43:47.8371153Z """ 2025-08-14T20:43:47.8371335Z 2025-08-14T20:43:47.8371574Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.8372219Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.8372627Z 2025-08-14T20:43:47.8372773Z if valid: 2025-08-14T20:43:47.8373110Z return True 2025-08-14T20:43:47.8373325Z 2025-08-14T20:43:47.8373475Z log.error( 2025-08-14T20:43:47.8374803Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.8376277Z ) 2025-08-14T20:43:47.8376595Z return False 2025-08-14T20:43:47.8376808Z 2025-08-14T20:43:47.8376814Z 2025-08-14T20:43:47.8377090Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.8377658Z """ 2025-08-14T20:43:47.8378459Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.8379134Z """ 2025-08-14T20:43:47.8379443Z try: 2025-08-14T20:43:47.8379776Z if settings_text: 2025-08-14T20:43:47.8380427Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.8381143Z # for easy reading 2025-08-14T20:43:47.8381853Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.8382650Z # the backtick character in shell commands. 2025-08-14T20:43:47.8383192Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.8383787Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.8384382Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.8384713Z 2025-08-14T20:43:47.8385081Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.8385763Z experiments = {} 2025-08-14T20:43:47.8386028Z 2025-08-14T20:43:47.8386375Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.8387051Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.8388348Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.8389482Z continue 2025-08-14T20:43:47.8389744Z 2025-08-14T20:43:47.8389907Z valid_settings = {} 2025-08-14T20:43:47.8390374Z for setting in exp_settings: 2025-08-14T20:43:47.8390882Z if setting not in Experiment._fields: 2025-08-14T20:43:47.8391384Z log.warning( 2025-08-14T20:43:47.8392018Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.8392831Z ) 2025-08-14T20:43:47.8393211Z else: 2025-08-14T20:43:47.8393675Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.8394054Z 2025-08-14T20:43:47.8394298Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.8394866Z return Settings(experiments) 2025-08-14T20:43:47.8395177Z 2025-08-14T20:43:47.8395338Z except Exception: 2025-08-14T20:43:47.8395759Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.8396117Z 2025-08-14T20:43:47.8396267Z return Settings() 2025-08-14T20:43:47.8396497Z 2025-08-14T20:43:47.8396503Z 2025-08-14T20:43:47.8396728Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.8397237Z """ 2025-08-14T20:43:47.8397614Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.8398214Z 2025-08-14T20:43:47.8398551Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.8399240Z and the text below is the list of opted in users. 2025-08-14T20:43:47.8399606Z 2025-08-14T20:43:47.8399967Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.8400631Z """ 2025-08-14T20:43:47.8401123Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.8401802Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.8402159Z 2025-08-14T20:43:47.8402165Z 2025-08-14T20:43:47.8402386Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.8402889Z """ 2025-08-14T20:43:47.8403230Z Parse users from the rollout state. 2025-08-14T20:43:47.8403543Z 2025-08-14T20:43:47.8403681Z """ 2025-08-14T20:43:47.8404155Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.8404804Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.8405165Z 2025-08-14T20:43:47.8405171Z 2025-08-14T20:43:47.8405664Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.8406336Z """ 2025-08-14T20:43:47.8406699Z Check if a user is opted into an experiment 2025-08-14T20:43:47.8407178Z """ 2025-08-14T20:43:47.8407572Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.8408085Z 2025-08-14T20:43:47.8408090Z 2025-08-14T20:43:47.8408464Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.8409134Z """ 2025-08-14T20:43:47.8409567Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.8410086Z """ 2025-08-14T20:43:47.8410530Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.8411153Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.8411722Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.8412257Z return False 2025-08-14T20:43:47.8412475Z 2025-08-14T20:43:47.8412716Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.8413281Z log.warning( 2025-08-14T20:43:47.8413993Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.8414775Z ) 2025-08-14T20:43:47.8414955Z 2025-08-14T20:43:47.8415103Z return True 2025-08-14T20:43:47.8415307Z 2025-08-14T20:43:47.8415314Z 2025-08-14T20:43:47.8415470Z def get_runner_prefix( 2025-08-14T20:43:47.8415857Z rollout_state: str, 2025-08-14T20:43:47.8416256Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.8416710Z branch: str, 2025-08-14T20:43:47.8417136Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.8417837Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.8418370Z is_canary: bool = False, 2025-08-14T20:43:47.8418763Z ) -> str: 2025-08-14T20:43:47.8419269Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.8419781Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.8420110Z 2025-08-14T20:43:47.8420264Z fleet_prefix = "" 2025-08-14T20:43:47.8420629Z prefixes = [] 2025-08-14T20:43:47.8421185Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.8422023Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.8422663Z log.info( 2025-08-14T20:43:47.8423272Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.8423944Z ) 2025-08-14T20:43:47.8424275Z continue 2025-08-14T20:43:47.8424492Z 2025-08-14T20:43:47.8424655Z if opt_out_experiments: 2025-08-14T20:43:47.8425125Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.8425689Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.8426220Z log.info( 2025-08-14T20:43:47.8427045Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.8428011Z ) 2025-08-14T20:43:47.8428361Z continue 2025-08-14T20:43:47.8428598Z 2025-08-14T20:43:47.8428761Z if eligible_experiments: 2025-08-14T20:43:47.8429247Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.8429801Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.8430295Z log.info( 2025-08-14T20:43:47.8430997Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.8431734Z ) 2025-08-14T20:43:47.8432084Z continue 2025-08-14T20:43:47.8432498Z elif not experiment_settings.default: 2025-08-14T20:43:47.8432978Z log.info( 2025-08-14T20:43:47.8433669Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.8434338Z ) 2025-08-14T20:43:47.8434664Z continue 2025-08-14T20:43:47.8434890Z 2025-08-14T20:43:47.8435134Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.8435684Z opted_out_users = [ 2025-08-14T20:43:47.8436078Z requestor 2025-08-14T20:43:47.8436480Z for requestor in workflow_requestors 2025-08-14T20:43:47.8437072Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.8437637Z ] 2025-08-14T20:43:47.8437916Z 2025-08-14T20:43:47.8438143Z if opted_out_users: 2025-08-14T20:43:47.8438545Z log.info( 2025-08-14T20:43:47.8439090Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.8439740Z ) 2025-08-14T20:43:47.8440132Z continue 2025-08-14T20:43:47.8440374Z 2025-08-14T20:43:47.8440643Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.8441244Z opted_in_users = [ 2025-08-14T20:43:47.8441684Z requestor 2025-08-14T20:43:47.8442085Z for requestor in workflow_requestors 2025-08-14T20:43:47.8442664Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.8443221Z ] 2025-08-14T20:43:47.8443401Z 2025-08-14T20:43:47.8443550Z enabled = False 2025-08-14T20:43:47.8443939Z if opted_in_users: 2025-08-14T20:43:47.8444327Z log.info( 2025-08-14T20:43:47.8444849Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.8445470Z ) 2025-08-14T20:43:47.8445810Z enabled = True 2025-08-14T20:43:47.8446066Z 2025-08-14T20:43:47.8446257Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.8446994Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.8448101Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.8448686Z log.info( 2025-08-14T20:43:47.8449453Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.8450274Z ) 2025-08-14T20:43:47.8450626Z enabled = True 2025-08-14T20:43:47.8450896Z 2025-08-14T20:43:47.8451038Z if enabled: 2025-08-14T20:43:47.8451405Z label = experiment_name 2025-08-14T20:43:47.8451890Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.8452619Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.8453399Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.8454078Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.8454658Z if is_canary: 2025-08-14T20:43:47.8455091Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.8455570Z fleet_prefix = label 2025-08-14T20:43:47.8456005Z else: 2025-08-14T20:43:47.8456371Z prefixes.append(label) 2025-08-14T20:43:47.8456688Z 2025-08-14T20:43:47.8456844Z if len(prefixes) > 1: 2025-08-14T20:43:47.8457226Z log.error( 2025-08-14T20:43:47.8458235Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.8459239Z ) 2025-08-14T20:43:47.8459573Z prefixes = prefixes[:1] 2025-08-14T20:43:47.8459851Z 2025-08-14T20:43:47.8460014Z # Fleet always comes first 2025-08-14T20:43:47.8460424Z if fleet_prefix: 2025-08-14T20:43:47.8460815Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.8461160Z 2025-08-14T20:43:47.8461520Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.8461899Z 2025-08-14T20:43:47.8461904Z 2025-08-14T20:43:47.8462299Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.8462992Z """ 2025-08-14T20:43:47.8463502Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.8464007Z 2025-08-14T20:43:47.8464347Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.8464977Z """ 2025-08-14T20:43:47.8465310Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.8465784Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.8466347Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.8466737Z 2025-08-14T20:43:47.8466749Z 2025-08-14T20:43:47.8467101Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.8467866Z for _ in range(num_retries): 2025-08-14T20:43:47.8468291Z try: 2025-08-14T20:43:47.8468662Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.8469248Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.8469814Z return json.loads(content) 2025-08-14T20:43:47.8470272Z except Exception as e: 2025-08-14T20:43:47.8470747Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.8471104Z 2025-08-14T20:43:47.8471440Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.8472070Z return {} 2025-08-14T20:43:47.8472264Z 2025-08-14T20:43:47.8472270Z 2025-08-14T20:43:47.8472407Z @cache 2025-08-14T20:43:47.8472953Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.8473619Z """ 2025-08-14T20:43:47.8473956Z Dynamically get PR information 2025-08-14T20:43:47.8474511Z """ 2025-08-14T20:43:47.8474963Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.8475530Z headers = { 2025-08-14T20:43:47.8475978Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.8476573Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.8477097Z } 2025-08-14T20:43:47.8477530Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.8478269Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.8478765Z headers=headers, 2025-08-14T20:43:47.8479143Z ) 2025-08-14T20:43:47.8479334Z 2025-08-14T20:43:47.8479492Z if not json_response: 2025-08-14T20:43:47.8480001Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.8480546Z return {} 2025-08-14T20:43:47.8480760Z 2025-08-14T20:43:47.8480918Z return json_response 2025-08-14T20:43:47.8481162Z 2025-08-14T20:43:47.8481168Z 2025-08-14T20:43:47.8481533Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.8482186Z """ 2025-08-14T20:43:47.8482653Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.8483227Z """ 2025-08-14T20:43:47.8483652Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.8484197Z return { 2025-08-14T20:43:47.8484716Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.8485327Z } 2025-08-14T20:43:47.8485504Z 2025-08-14T20:43:47.8485510Z 2025-08-14T20:43:47.8485658Z def main() -> None: 2025-08-14T20:43:47.8486030Z args = parse_args() 2025-08-14T20:43:47.8486262Z 2025-08-14T20:43:47.8486455Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.8486801Z 2025-08-14T20:43:47.8486967Z # Check if the PR is opt-out 2025-08-14T20:43:47.8487388Z if args.pr_number: 2025-08-14T20:43:47.8488075Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.8488916Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.8489363Z log.info( 2025-08-14T20:43:47.8489977Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.8490657Z ) 2025-08-14T20:43:47.8491136Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.8491732Z sys.exit() 2025-08-14T20:43:47.8491964Z 2025-08-14T20:43:47.8492103Z try: 2025-08-14T20:43:47.8492481Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.8493104Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.8493670Z ) 2025-08-14T20:43:47.8493845Z 2025-08-14T20:43:47.8494023Z username = get_potential_pr_author( 2025-08-14T20:43:47.8494506Z args.github_token, 2025-08-14T20:43:47.8494923Z args.github_repo, 2025-08-14T20:43:47.8495343Z args.github_actor, 2025-08-14T20:43:47.8495764Z args.github_ref_type, 2025-08-14T20:43:47.8496200Z args.github_branch, 2025-08-14T20:43:47.8496597Z ) 2025-08-14T20:43:47.8496783Z 2025-08-14T20:43:47.8497036Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.8497441Z 2025-08-14T20:43:47.8497633Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.8498220Z rollout_state, 2025-08-14T20:43:47.8498645Z (args.github_issue_owner, username), 2025-08-14T20:43:47.8499125Z args.github_branch, 2025-08-14T20:43:47.8499559Z args.eligible_experiments, 2025-08-14T20:43:47.8500024Z args.opt_out_experiments, 2025-08-14T20:43:47.8500465Z is_canary, 2025-08-14T20:43:47.8500819Z ) 2025-08-14T20:43:47.8501004Z 2025-08-14T20:43:47.8501164Z except Exception as e: 2025-08-14T20:43:47.8501557Z log.error( 2025-08-14T20:43:47.8502145Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.8502968Z ) 2025-08-14T20:43:47.8503148Z 2025-08-14T20:43:47.8503438Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.8503888Z 2025-08-14T20:43:47.8503894Z 2025-08-14T20:43:47.8504049Z if __name__ == "__main__": 2025-08-14T20:43:47.8504427Z main() 2025-08-14T20:43:47.8504617Z 2025-08-14T20:43:47.8607953Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.8609306Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.8663294Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.8664006Z env: 2025-08-14T20:43:47.8664844Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.8665475Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.8666181Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.8666959Z ISSUE_OWNER: 2025-08-14T20:43:47.8667558Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.8668405Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.8669078Z PR_NUMBER: 2025-08-14T20:43:47.8669676Z ##[endgroup] 2025-08-14T20:43:48.6306129Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.1049136Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.1451471Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.1700204Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.6 MB/s eta 0:00:00 2025-08-14T20:43:49.1905067Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.1936904Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.2338793Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:49.2370945Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:49.2414636Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:49.2430740Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:49.2445393Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:49.2678586Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:49.2705737Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:49.2935603Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:49.4108204Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.4141825Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:49.5316124Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:49.5351994Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:49.5542170Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.5572851Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:49.5831041Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:49.5903145Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 25.2 MB/s eta 0:00:00 2025-08-14T20:43:49.5944368Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:49.6005185Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 80.1 MB/s eta 0:00:00 2025-08-14T20:43:49.6035243Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:49.6121625Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 124.3 MB/s eta 0:00:00 2025-08-14T20:43:49.6154233Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:49.6204211Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:49.6270254Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 96.7 MB/s eta 0:00:00 2025-08-14T20:43:49.6300548Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:49.6339112Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.7 MB/s eta 0:00:00 2025-08-14T20:43:49.6370171Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:49.6413507Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 38.7 MB/s eta 0:00:00 2025-08-14T20:43:49.9229803Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:50.4572750Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:50.5296345Z ##[group]Run curr_branch="main" 2025-08-14T20:43:50.5296700Z curr_branch="main" 2025-08-14T20:43:50.5296988Z curr_ref_type="branch" 2025-08-14T20:43:50.5297286Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:50.5297582Z  2025-08-14T20:43:50.5298075Z python3 runner_determinator.py \ 2025-08-14T20:43:50.5298447Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:50.5298767Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:50.5299068Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:50.5299365Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:50.5299692Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:50.5300006Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:50.5300330Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:50.5300722Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:50.5301142Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:50.5301471Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:50.5343126Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:50.5343394Z env: 2025-08-14T20:43:50.5343954Z GITHUB_TOKEN: *** 2025-08-14T20:43:50.5344183Z ISSUE_NUMBER: 5132 2025-08-14T20:43:50.5344430Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:50.5344704Z ISSUE_OWNER: 2025-08-14T20:43:50.5344944Z CHECK_EXPERIMENTS: 2025-08-14T20:43:50.5345178Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:50.5345424Z PR_NUMBER: 2025-08-14T20:43:50.5345640Z ##[endgroup] 2025-08-14T20:43:50.5403795Z Current branch is 'main' 2025-08-14T20:43:52.0645537Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.0648044Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.0648842Z INFO : Setting output: label-type='' 2025-08-14T20:43:52.0962940Z Evaluate and set job outputs 2025-08-14T20:43:52.0969716Z Cleaning up orphan processes