2025-09-07T06:09:28.2752051Z Current runner version: '2.328.0' 2025-09-07T06:09:28.2775210Z ##[group]Runner Image Provisioner 2025-09-07T06:09:28.2776294Z Hosted Compute Agent 2025-09-07T06:09:28.2776873Z Version: 20250829.383 2025-09-07T06:09:28.2777447Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:28.2778183Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:28.2778751Z ##[endgroup] 2025-09-07T06:09:28.2779305Z ##[group]Operating System 2025-09-07T06:09:28.2779822Z Ubuntu 2025-09-07T06:09:28.2780490Z 24.04.3 2025-09-07T06:09:28.2780957Z LTS 2025-09-07T06:09:28.2781629Z ##[endgroup] 2025-09-07T06:09:28.2782302Z ##[group]Runner Image 2025-09-07T06:09:28.2782840Z Image: ubuntu-24.04 2025-09-07T06:09:28.2783317Z Version: 20250831.1.0 2025-09-07T06:09:28.2784399Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:28.2785953Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:28.2787028Z ##[endgroup] 2025-09-07T06:09:28.2787933Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:28.2790167Z Metadata: read 2025-09-07T06:09:28.2790698Z ##[endgroup] 2025-09-07T06:09:28.2793397Z Secret source: Actions 2025-09-07T06:09:28.2794686Z Prepare workflow directory 2025-09-07T06:09:28.3303494Z Prepare all required actions 2025-09-07T06:09:28.3360411Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:28.3365495Z ##[group] Inputs 2025-09-07T06:09:28.3366188Z check_experiments: 2025-09-07T06:09:28.3366777Z opt_out_experiments: 2025-09-07T06:09:28.3367318Z triggering_actor: pytorchmergebot 2025-09-07T06:09:28.3367984Z issue_owner: 2025-09-07T06:09:28.3368450Z curr_branch: main 2025-09-07T06:09:28.3368960Z curr_ref_type: branch 2025-09-07T06:09:28.3369503Z issue_number: 5132 2025-09-07T06:09:28.3370117Z ##[endgroup] 2025-09-07T06:09:28.3370718Z Complete job name: get-label-type / runner-determinator 2025-09-07T06:09:28.9287786Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:28.9290539Z cat < runner_determinator.py 2025-09-07T06:09:28.9291213Z # flake8: noqa: G004 2025-09-07T06:09:28.9291970Z  2025-09-07T06:09:28.9292854Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.9293980Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.9294980Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.9295783Z  2025-09-07T06:09:28.9296266Z """ 2025-09-07T06:09:28.9296993Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.9298136Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.9299362Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.9300412Z of which runners should be used to run which job. 2025-09-07T06:09:28.9301109Z  2025-09-07T06:09:28.9301977Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.9303116Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.9304149Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.9305035Z list, defined. 2025-09-07T06:09:28.9305523Z  2025-09-07T06:09:28.9306308Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.9307405Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.9308381Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.9309214Z  2025-09-07T06:09:28.9309941Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.9311223Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.9312502Z experiments which the user could be opted in to. 2025-09-07T06:09:28.9313174Z  2025-09-07T06:09:28.9313695Z The user list has the following rules: 2025-09-07T06:09:28.9314390Z  2025-09-07T06:09:28.9315113Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.9316109Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.9317111Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.9317790Z  2025-09-07T06:09:28.9318249Z Example config: 2025-09-07T06:09:28.9318952Z  # A list of experiments that can be opted into. 2025-09-07T06:09:28.9319808Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.9320605Z  # Expected syntax is: 2025-09-07T06:09:28.9321692Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.9322830Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.9323726Z  2025-09-07T06:09:28.9324245Z  experiments: 2025-09-07T06:09:28.9324850Z  lf: 2025-09-07T06:09:28.9325360Z  rollout_percent: 25 2025-09-07T06:09:28.9409035Z  all_branches: false 2025-09-07T06:09:28.9409704Z  default: true 2025-09-07T06:09:28.9410211Z  --- 2025-09-07T06:09:28.9410630Z  2025-09-07T06:09:28.9411022Z  # Opt-ins: 2025-09-07T06:09:28.9412032Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.9413264Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.9414157Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.9414913Z  # Experiments should be from the above list. 2025-09-07T06:09:28.9415502Z  2025-09-07T06:09:28.9415918Z  @User1,-lf,split_build 2025-09-07T06:09:28.9416448Z  @User2,lf 2025-09-07T06:09:28.9416924Z  @User3,split_build 2025-09-07T06:09:28.9417417Z """ 2025-09-07T06:09:28.9417810Z  2025-09-07T06:09:28.9418206Z import json 2025-09-07T06:09:28.9418654Z import logging 2025-09-07T06:09:28.9419103Z import os 2025-09-07T06:09:28.9419531Z import random 2025-09-07T06:09:28.9419981Z import re 2025-09-07T06:09:28.9420400Z import sys 2025-09-07T06:09:28.9420884Z from argparse import ArgumentParser 2025-09-07T06:09:28.9421680Z from collections.abc import Iterable 2025-09-07T06:09:28.9422295Z from functools import cache 2025-09-07T06:09:28.9422843Z from logging import LogRecord 2025-09-07T06:09:28.9423412Z from typing import Any, NamedTuple 2025-09-07T06:09:28.9424047Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.9424642Z  2025-09-07T06:09:28.9425022Z import yaml 2025-09-07T06:09:28.9425506Z from github import Auth, Github 2025-09-07T06:09:28.9426086Z from github.Issue import Issue 2025-09-07T06:09:28.9426614Z  2025-09-07T06:09:28.9427002Z  2025-09-07T06:09:28.9427494Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.9428276Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.9429259Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.9430037Z  2025-09-07T06:09:28.9430526Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.9431456Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.9432089Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.9432751Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.9433317Z  2025-09-07T06:09:28.9433767Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.9434322Z  2025-09-07T06:09:28.9434727Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.9435279Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.9435784Z  2025-09-07T06:09:28.9436167Z  2025-09-07T06:09:28.9436583Z class Experiment(NamedTuple): 2025-09-07T06:09:28.9437146Z  rollout_perc: float = ( 2025-09-07T06:09:28.9437900Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.9438689Z  ) 2025-09-07T06:09:28.9439162Z  all_branches: bool = ( 2025-09-07T06:09:28.9439940Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.9440672Z  ) 2025-09-07T06:09:28.9441700Z  default: bool = ( 2025-09-07T06:09:28.9442591Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.9443303Z  ) 2025-09-07T06:09:28.9443709Z  2025-09-07T06:09:28.9444127Z  # Add more fields as needed 2025-09-07T06:09:28.9444646Z  2025-09-07T06:09:28.9445023Z  2025-09-07T06:09:28.9445439Z class Settings(NamedTuple): 2025-09-07T06:09:28.9445962Z  """ 2025-09-07T06:09:28.9446498Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:28.9447138Z  """ 2025-09-07T06:09:28.9447535Z  2025-09-07T06:09:28.9447987Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.9448555Z  2025-09-07T06:09:28.9449113Z  2025-09-07T06:09:28.9449648Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.9450351Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.9450982Z  2025-09-07T06:09:28.9451523Z  COLORS = { 2025-09-07T06:09:28.9452025Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.9452596Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.9453167Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.9453742Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.9454301Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.9454830Z  } 2025-09-07T06:09:28.9455230Z  2025-09-07T06:09:28.9455694Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.9456506Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.9457356Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.9458001Z  return super().format(record) 2025-09-07T06:09:28.9458531Z  2025-09-07T06:09:28.9458911Z  2025-09-07T06:09:28.9459342Z handler = logging.StreamHandler() 2025-09-07T06:09:28.9460163Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.9460933Z  2025-09-07T06:09:28.9461596Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.9462315Z log.addHandler(handler) 2025-09-07T06:09:28.9462840Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.9463344Z  2025-09-07T06:09:28.9463723Z  2025-09-07T06:09:28.9464225Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.9464852Z  """ 2025-09-07T06:09:28.9465432Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.9466124Z  """ 2025-09-07T06:09:28.9466697Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:28.9468181Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.9469451Z  log.warning( 2025-09-07T06:09:28.9470437Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.9471712Z  ) 2025-09-07T06:09:28.9472229Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.9472824Z  return 2025-09-07T06:09:28.9473272Z  2025-09-07T06:09:28.9473707Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.9474345Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.9474984Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:28.9475523Z  2025-09-07T06:09:28.9475929Z  2025-09-07T06:09:28.9476491Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.9477223Z  return frozenset( 2025-09-07T06:09:28.9477938Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.9478669Z  ) 2025-09-07T06:09:28.9479090Z  2025-09-07T06:09:28.9479476Z  2025-09-07T06:09:28.9479886Z def parse_args() -> Any: 2025-09-07T06:09:28.9480555Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.9482108Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.9482961Z  parser.add_argument( 2025-09-07T06:09:28.9483519Z  "--github-issue-repo", 2025-09-07T06:09:28.9484072Z  type=str, 2025-09-07T06:09:28.9484569Z  required=False, 2025-09-07T06:09:28.9485281Z  default="pytorch/test-infra", 2025-09-07T06:09:28.9485923Z  help="GitHub repo to get the issue", 2025-09-07T06:09:28.9486501Z  ) 2025-09-07T06:09:28.9486942Z  parser.add_argument( 2025-09-07T06:09:28.9487482Z  "--github-repo", 2025-09-07T06:09:28.9487999Z  type=str, 2025-09-07T06:09:28.9488491Z  required=True, 2025-09-07T06:09:28.9489063Z  help="GitHub repo where CI is running", 2025-09-07T06:09:28.9489640Z  ) 2025-09-07T06:09:28.9490077Z  parser.add_argument( 2025-09-07T06:09:28.9490793Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.9491702Z  ) 2025-09-07T06:09:28.9492137Z  parser.add_argument( 2025-09-07T06:09:28.9492872Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.9493620Z  ) 2025-09-07T06:09:28.9494052Z  parser.add_argument( 2025-09-07T06:09:28.9494796Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.9495549Z  ) 2025-09-07T06:09:28.9495989Z  parser.add_argument( 2025-09-07T06:09:28.9496753Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.9497540Z  ) 2025-09-07T06:09:28.9497999Z  parser.add_argument( 2025-09-07T06:09:28.9498548Z  "--github-ref-type", 2025-09-07T06:09:28.9499096Z  type=str, 2025-09-07T06:09:28.9499587Z  required=True, 2025-09-07T06:09:28.9500189Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.9500811Z  ) 2025-09-07T06:09:28.9501257Z  parser.add_argument( 2025-09-07T06:09:28.9501976Z  "--eligible-experiments", 2025-09-07T06:09:28.9502728Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.9503318Z  required=False, 2025-09-07T06:09:28.9503840Z  default="", 2025-09-07T06:09:28.9504794Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.9505791Z  ) 2025-09-07T06:09:28.9506226Z  parser.add_argument( 2025-09-07T06:09:28.9506772Z  "--opt-out-experiments", 2025-09-07T06:09:28.9507366Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.9507952Z  required=False, 2025-09-07T06:09:28.9508471Z  default="", 2025-09-07T06:09:28.9508953Z  help=( 2025-09-07T06:09:28.9509718Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.9510926Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.9511985Z  ), 2025-09-07T06:09:28.9512424Z  ) 2025-09-07T06:09:28.9512856Z  parser.add_argument( 2025-09-07T06:09:28.9513385Z  "--pr-number", 2025-09-07T06:09:28.9513890Z  type=str, 2025-09-07T06:09:28.9514380Z  required=False, 2025-09-07T06:09:28.9514901Z  default="", 2025-09-07T06:09:28.9515486Z  help="the optional PR number where this is run", 2025-09-07T06:09:28.9516102Z  ) 2025-09-07T06:09:28.9516514Z  2025-09-07T06:09:28.9516948Z  return parser.parse_args() 2025-09-07T06:09:28.9517483Z  2025-09-07T06:09:28.9517876Z  2025-09-07T06:09:28.9518546Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.9519520Z  auth = Auth.Token(github_token) 2025-09-07T06:09:28.9520151Z  return Github(auth=auth) 2025-09-07T06:09:28.9520690Z  2025-09-07T06:09:28.9521075Z  2025-09-07T06:09:28.9522028Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.9522925Z  repo = gh.get_repo(repo) 2025-09-07T06:09:28.9523528Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.9524122Z  2025-09-07T06:09:28.9524513Z  2025-09-07T06:09:28.9524943Z def get_potential_pr_author( 2025-09-07T06:09:28.9525691Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.9526444Z ) -> str: 2025-09-07T06:09:28.9527050Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.9527940Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.9528782Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:28.9529424Z  2025-09-07T06:09:28.9529866Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.9530436Z  2025-09-07T06:09:28.9530964Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.9531782Z  split_tag = ref_name.split("/") 2025-09-07T06:09:28.9532354Z  if ( 2025-09-07T06:09:28.9532833Z  len(split_tag) == 3 2025-09-07T06:09:28.9533409Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:28.9534023Z  and split_tag[2].isnumeric() 2025-09-07T06:09:28.9534578Z  ): 2025-09-07T06:09:28.9535060Z  pr_number = split_tag[2] 2025-09-07T06:09:28.9535629Z  try: 2025-09-07T06:09:28.9536151Z  repository = gh.get_repo(repo) 2025-09-07T06:09:28.9536851Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.9537715Z  except Exception as e: 2025-09-07T06:09:28.9538321Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:28.9539066Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.9539784Z  ) from e 2025-09-07T06:09:28.9540430Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.9541212Z  # In all other cases, return the original input username 2025-09-07T06:09:28.9541980Z  return username 2025-09-07T06:09:28.9542460Z  2025-09-07T06:09:28.9542857Z  2025-09-07T06:09:28.9543346Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.9543953Z  """ 2025-09-07T06:09:28.9544697Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.9545549Z  """ 2025-09-07T06:09:28.9546176Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.9546907Z  2025-09-07T06:09:28.9547300Z  2025-09-07T06:09:28.9547744Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.9548322Z  try: 2025-09-07T06:09:28.9548795Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.9549404Z  return data 2025-09-07T06:09:28.9549922Z  except yaml.YAMLError: 2025-09-07T06:09:28.9550499Z  log.exception("Error loading YAML") 2025-09-07T06:09:28.9551077Z  raise 2025-09-07T06:09:28.9551618Z  2025-09-07T06:09:28.9552010Z  2025-09-07T06:09:28.9552691Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.9553516Z  """ 2025-09-07T06:09:28.9554358Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.9555184Z  2025-09-07T06:09:28.9555781Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.9556625Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.9557249Z  2025-09-07T06:09:28.9557886Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.9558659Z  """ 2025-09-07T06:09:28.9559189Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.9559860Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.9560549Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.9561200Z  else: 2025-09-07T06:09:28.9561884Z  return "", rollout_state 2025-09-07T06:09:28.9562534Z  2025-09-07T06:09:28.9562934Z  2025-09-07T06:09:28.9563396Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.9563970Z  """ 2025-09-07T06:09:28.9564577Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.9565286Z  """ 2025-09-07T06:09:28.9565699Z  2025-09-07T06:09:28.9566075Z  2025-09-07T06:09:28.9566667Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.9567390Z  """ 2025-09-07T06:09:28.9568388Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.9569315Z  2025-09-07T06:09:28.9570187Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.9571267Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.9572132Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.9572994Z  2025-09-07T06:09:28.9573376Z  2025-09-07T06:09:28.9573762Z  """ 2025-09-07T06:09:28.9574199Z  optins = UserOptins() 2025-09-07T06:09:28.9574781Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.9575416Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:28.9576032Z  if not user or not user.startswith("@"): 2025-09-07T06:09:28.9576659Z  # Not a valid user. Skip 2025-09-07T06:09:28.9577214Z  continue 2025-09-07T06:09:28.9577693Z  2025-09-07T06:09:28.9578097Z  if user: 2025-09-07T06:09:28.9578656Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.9579421Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.9580116Z  2025-09-07T06:09:28.9580517Z  return optins 2025-09-07T06:09:28.9580989Z  2025-09-07T06:09:28.9581580Z  2025-09-07T06:09:28.9582158Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.9582843Z  """ 2025-09-07T06:09:28.9583329Z  Check if the experiment name is valid. 2025-09-07T06:09:28.9583913Z  A valid name: 2025-09-07T06:09:28.9584645Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.9585652Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.9586430Z  - Cannot contain spaces 2025-09-07T06:09:28.9586960Z  """ 2025-09-07T06:09:28.9587375Z  2025-09-07T06:09:28.9587883Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.9588661Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.9589445Z  2025-09-07T06:09:28.9589843Z  if valid: 2025-09-07T06:09:28.9590302Z  return True 2025-09-07T06:09:28.9590765Z  2025-09-07T06:09:28.9591158Z  log.error( 2025-09-07T06:09:28.9592824Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T06:09:28.9594438Z  ) 2025-09-07T06:09:28.9594853Z  return False 2025-09-07T06:09:28.9595313Z  2025-09-07T06:09:28.9595694Z  2025-09-07T06:09:28.9596265Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.9596966Z  """ 2025-09-07T06:09:28.9597641Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.9598415Z  """ 2025-09-07T06:09:28.9598838Z  try: 2025-09-07T06:09:28.9599273Z  if settings_text: 2025-09-07T06:09:28.9600086Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.9600937Z  # for easy reading 2025-09-07T06:09:28.9601919Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.9602882Z  # the backtick character in shell commands. 2025-09-07T06:09:28.9603552Z  backtick = chr(96) # backtick character 2025-09-07T06:09:28.9604302Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.9605034Z  settings = load_yaml(settings_text) 2025-09-07T06:09:28.9605607Z  2025-09-07T06:09:28.9606262Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.9607201Z  experiments = {} 2025-09-07T06:09:28.9607719Z  2025-09-07T06:09:28.9608325Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.9609151Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.9610317Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T06:09:28.9611523Z  continue 2025-09-07T06:09:28.9612040Z  2025-09-07T06:09:28.9612458Z  valid_settings = {} 2025-09-07T06:09:28.9613049Z  for setting in exp_settings: 2025-09-07T06:09:28.9613674Z  if setting not in Experiment._fields: 2025-09-07T06:09:28.9614296Z  log.warning( 2025-09-07T06:09:28.9615090Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.9615860Z  ) 2025-09-07T06:09:28.9616361Z  else: 2025-09-07T06:09:28.9616961Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.9617591Z  2025-09-07T06:09:28.9618112Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.9618825Z  return Settings(experiments) 2025-09-07T06:09:28.9619388Z  2025-09-07T06:09:28.9619794Z  except Exception: 2025-09-07T06:09:28.9620375Z  log.exception("Failed to parse settings") 2025-09-07T06:09:28.9620967Z  2025-09-07T06:09:28.9621467Z  return Settings() 2025-09-07T06:09:28.9621952Z  2025-09-07T06:09:28.9622330Z  2025-09-07T06:09:28.9622991Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.9623655Z  """ 2025-09-07T06:09:28.9624162Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.9624765Z  2025-09-07T06:09:28.9625359Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.9626195Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.9626817Z  2025-09-07T06:09:28.9627473Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.9628267Z  """ 2025-09-07T06:09:28.9628900Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.9629739Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.9630343Z  2025-09-07T06:09:28.9630722Z  2025-09-07T06:09:28.9631226Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.9631961Z  """ 2025-09-07T06:09:28.9632433Z  Parse users from the rollout state. 2025-09-07T06:09:28.9632997Z  2025-09-07T06:09:28.9633389Z  """ 2025-09-07T06:09:28.9634005Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.9634829Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.9635435Z  2025-09-07T06:09:28.9635807Z  2025-09-07T06:09:28.9636490Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.9637294Z  """ 2025-09-07T06:09:28.9637785Z  Check if a user is opted into an experiment 2025-09-07T06:09:28.9638374Z  """ 2025-09-07T06:09:28.9638903Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.9639537Z  2025-09-07T06:09:28.9639910Z  2025-09-07T06:09:28.9641002Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.9641924Z  """ 2025-09-07T06:09:28.9642469Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.9643116Z  """ 2025-09-07T06:09:28.9643702Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.9644476Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.9645185Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.9645849Z  return False 2025-09-07T06:09:28.9646310Z  2025-09-07T06:09:28.9646824Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.9647480Z  log.warning( 2025-09-07T06:09:28.9648385Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.9649325Z  ) 2025-09-07T06:09:28.9649774Z  2025-09-07T06:09:28.9650168Z  return True 2025-09-07T06:09:28.9650615Z  2025-09-07T06:09:28.9650998Z  2025-09-07T06:09:28.9651490Z def get_runner_prefix( 2025-09-07T06:09:28.9652017Z  rollout_state: str, 2025-09-07T06:09:28.9652561Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:28.9653139Z  branch: str, 2025-09-07T06:09:28.9653731Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.9654478Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.9655129Z  is_canary: bool = False, 2025-09-07T06:09:28.9655652Z ) -> str: 2025-09-07T06:09:28.9656157Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:28.9656815Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.9657387Z  2025-09-07T06:09:28.9657921Z  fleet_prefix = "" 2025-09-07T06:09:28.9658435Z  prefixes = [] 2025-09-07T06:09:28.9659166Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.9660186Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.9660962Z  log.info( 2025-09-07T06:09:28.9661833Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.9662640Z  ) 2025-09-07T06:09:28.9663100Z  continue 2025-09-07T06:09:28.9663574Z  2025-09-07T06:09:28.9663995Z  if opt_out_experiments: 2025-09-07T06:09:28.9664609Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.9665335Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.9665982Z  log.info( 2025-09-07T06:09:28.9667004Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.9668041Z  ) 2025-09-07T06:09:28.9668510Z  continue 2025-09-07T06:09:28.9668999Z  2025-09-07T06:09:28.9669416Z  if eligible_experiments: 2025-09-07T06:09:28.9670060Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.9670766Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.9671466Z  log.info( 2025-09-07T06:09:28.9672333Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.9673228Z  ) 2025-09-07T06:09:28.9673693Z  continue 2025-09-07T06:09:28.9674385Z  elif not experiment_settings.default: 2025-09-07T06:09:28.9674979Z  log.info( 2025-09-07T06:09:28.9675728Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.9676514Z  ) 2025-09-07T06:09:28.9676957Z  continue 2025-09-07T06:09:28.9677416Z  2025-09-07T06:09:28.9677939Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.9678613Z  opted_out_users = [ 2025-09-07T06:09:28.9679147Z  requestor 2025-09-07T06:09:28.9679699Z  for requestor in workflow_requestors 2025-09-07T06:09:28.9680439Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.9681130Z  ] 2025-09-07T06:09:28.9681646Z  2025-09-07T06:09:28.9682054Z  if opted_out_users: 2025-09-07T06:09:28.9682601Z  log.info( 2025-09-07T06:09:28.9683324Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.9684089Z  ) 2025-09-07T06:09:28.9684540Z  continue 2025-09-07T06:09:28.9685018Z  2025-09-07T06:09:28.9685533Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.9686201Z  opted_in_users = [ 2025-09-07T06:09:28.9686732Z  requestor 2025-09-07T06:09:28.9687284Z  for requestor in workflow_requestors 2025-09-07T06:09:28.9688017Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.9688707Z  ] 2025-09-07T06:09:28.9689139Z  2025-09-07T06:09:28.9689535Z  enabled = False 2025-09-07T06:09:28.9690066Z  if opted_in_users: 2025-09-07T06:09:28.9690711Z  log.info( 2025-09-07T06:09:28.9691519Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.9692267Z  ) 2025-09-07T06:09:28.9692734Z  enabled = True 2025-09-07T06:09:28.9693244Z  2025-09-07T06:09:28.9693702Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.9694609Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.9695619Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.9696328Z  log.info( 2025-09-07T06:09:28.9697277Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.9698250Z  ) 2025-09-07T06:09:28.9698746Z  enabled = True 2025-09-07T06:09:28.9699269Z  2025-09-07T06:09:28.9699681Z  if enabled: 2025-09-07T06:09:28.9700201Z  label = experiment_name 2025-09-07T06:09:28.9700829Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.9701820Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.9702767Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.9703603Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.9704322Z  if is_canary: 2025-09-07T06:09:28.9704901Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.9705505Z  fleet_prefix = label 2025-09-07T06:09:28.9706065Z  else: 2025-09-07T06:09:28.9706585Z  prefixes.append(label) 2025-09-07T06:09:28.9707272Z  2025-09-07T06:09:28.9707679Z  if len(prefixes) > 1: 2025-09-07T06:09:28.9708196Z  log.error( 2025-09-07T06:09:28.9709323Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T06:09:28.9710497Z  ) 2025-09-07T06:09:28.9710953Z  prefixes = prefixes[:1] 2025-09-07T06:09:28.9711591Z  2025-09-07T06:09:28.9712003Z  # Fleet always comes first 2025-09-07T06:09:28.9712553Z  if fleet_prefix: 2025-09-07T06:09:28.9713089Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.9713651Z  2025-09-07T06:09:28.9714152Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.9714777Z  2025-09-07T06:09:28.9715152Z  2025-09-07T06:09:28.9715858Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.9716688Z  """ 2025-09-07T06:09:28.9717343Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.9718103Z  2025-09-07T06:09:28.9718727Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.9719492Z  """ 2025-09-07T06:09:28.9719947Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.9720570Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.9721387Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.9722118Z  2025-09-07T06:09:28.9722505Z  2025-09-07T06:09:28.9723158Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.9724111Z  for _ in range(num_retries): 2025-09-07T06:09:28.9724667Z  try: 2025-09-07T06:09:28.9725177Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:28.9725904Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.9726613Z  return json.loads(content) 2025-09-07T06:09:28.9727207Z  except Exception as e: 2025-09-07T06:09:28.9727832Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.9728435Z  2025-09-07T06:09:28.9729057Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.9729838Z  return {} 2025-09-07T06:09:28.9730287Z  2025-09-07T06:09:28.9730657Z  2025-09-07T06:09:28.9731047Z @cache 2025-09-07T06:09:28.9731876Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.9732696Z  """ 2025-09-07T06:09:28.9733155Z  Dynamically get PR information 2025-09-07T06:09:28.9733708Z  """ 2025-09-07T06:09:28.9734276Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.9734965Z  headers = { 2025-09-07T06:09:28.9735516Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.9736189Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:28.9736779Z  } 2025-09-07T06:09:28.9737277Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.9737948Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.9738544Z  headers=headers, 2025-09-07T06:09:28.9739049Z  ) 2025-09-07T06:09:28.9739447Z  2025-09-07T06:09:28.9739860Z  if not json_response: 2025-09-07T06:09:28.9740523Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.9741443Z  return {} 2025-09-07T06:09:28.9741931Z  2025-09-07T06:09:28.9742343Z  return json_response 2025-09-07T06:09:28.9742840Z  2025-09-07T06:09:28.9743215Z  2025-09-07T06:09:28.9743862Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.9744658Z  """ 2025-09-07T06:09:28.9745259Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.9745970Z  """ 2025-09-07T06:09:28.9746525Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.9747190Z  return { 2025-09-07T06:09:28.9747848Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.9748601Z  } 2025-09-07T06:09:28.9749010Z  2025-09-07T06:09:28.9749420Z  2025-09-07T06:09:28.9749830Z def main() -> None: 2025-09-07T06:09:28.9750329Z  args = parse_args() 2025-09-07T06:09:28.9750826Z  2025-09-07T06:09:28.9751379Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.9751979Z  2025-09-07T06:09:28.9752400Z  # Check if the PR is opt-out 2025-09-07T06:09:28.9752967Z  if args.pr_number: 2025-09-07T06:09:28.9753708Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.9754523Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.9755077Z  log.info( 2025-09-07T06:09:28.9755851Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.9756669Z  ) 2025-09-07T06:09:28.9757303Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.9758034Z  sys.exit() 2025-09-07T06:09:28.9758642Z  2025-09-07T06:09:28.9759036Z  try: 2025-09-07T06:09:28.9759548Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.9760319Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.9761018Z  ) 2025-09-07T06:09:28.9761535Z  2025-09-07T06:09:28.9761990Z  username = get_potential_pr_author( 2025-09-07T06:09:28.9762588Z  args.github_token, 2025-09-07T06:09:28.9763150Z  args.github_repo, 2025-09-07T06:09:28.9763699Z  args.github_actor, 2025-09-07T06:09:28.9764257Z  args.github_ref_type, 2025-09-07T06:09:28.9764827Z  args.github_branch, 2025-09-07T06:09:28.9765353Z  ) 2025-09-07T06:09:28.9765772Z  2025-09-07T06:09:28.9766306Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.9766973Z  2025-09-07T06:09:28.9767444Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.9768049Z  rollout_state, 2025-09-07T06:09:28.9768625Z  (args.github_issue_owner, username), 2025-09-07T06:09:28.9769228Z  args.github_branch, 2025-09-07T06:09:28.9769813Z  args.eligible_experiments, 2025-09-07T06:09:28.9770414Z  args.opt_out_experiments, 2025-09-07T06:09:28.9770988Z  is_canary, 2025-09-07T06:09:28.9771565Z  ) 2025-09-07T06:09:28.9771994Z  2025-09-07T06:09:28.9772407Z  except Exception as e: 2025-09-07T06:09:28.9772929Z  log.error( 2025-09-07T06:09:28.9773694Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.9774507Z  ) 2025-09-07T06:09:28.9774943Z  2025-09-07T06:09:28.9775651Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.9776362Z  2025-09-07T06:09:28.9776744Z  2025-09-07T06:09:28.9777150Z if __name__ == "__main__": 2025-09-07T06:09:28.9777678Z  main() 2025-09-07T06:09:28.9778106Z  2025-09-07T06:09:28.9778493Z EOF 2025-09-07T06:09:28.9778881Z  2025-09-07T06:09:28.9779299Z cat runner_determinator.py 2025-09-07T06:09:29.1018839Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:29.1019703Z env: 2025-09-07T06:09:29.1020458Z GITHUB_TOKEN: *** 2025-09-07T06:09:29.1020928Z ISSUE_NUMBER: 5132 2025-09-07T06:09:29.1021659Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:29.1022270Z ISSUE_OWNER: 2025-09-07T06:09:29.1022724Z CHECK_EXPERIMENTS: 2025-09-07T06:09:29.1023207Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:29.1023693Z PR_NUMBER: 2025-09-07T06:09:29.1024118Z ##[endgroup] 2025-09-07T06:09:29.1228815Z # flake8: noqa: G004 2025-09-07T06:09:29.1229170Z 2025-09-07T06:09:29.1229644Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:29.1230636Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:29.1231861Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:29.1232321Z 2025-09-07T06:09:29.1232506Z """ 2025-09-07T06:09:29.1233113Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:29.1234030Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:29.1234952Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:29.1235786Z of which runners should be used to run which job. 2025-09-07T06:09:29.1236188Z 2025-09-07T06:09:29.1236598Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:29.1237706Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:29.1238644Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:29.1239367Z list, defined. 2025-09-07T06:09:29.1239607Z 2025-09-07T06:09:29.1239988Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:29.1240955Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:29.1242142Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:29.1242592Z 2025-09-07T06:09:29.1242993Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:29.1243879Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:29.1244641Z experiments which the user could be opted in to. 2025-09-07T06:09:29.1245049Z 2025-09-07T06:09:29.1245272Z The user list has the following rules: 2025-09-07T06:09:29.1245623Z 2025-09-07T06:09:29.1245961Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:29.1246849Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:29.1247634Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:29.1248036Z 2025-09-07T06:09:29.1248231Z Example config: 2025-09-07T06:09:29.1248709Z # A list of experiments that can be opted into. 2025-09-07T06:09:29.1249409Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:29.1250052Z # Expected syntax is: 2025-09-07T06:09:29.1250724Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:29.1252351Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:29.1252990Z 2025-09-07T06:09:29.1253187Z experiments: 2025-09-07T06:09:29.1253608Z lf: 2025-09-07T06:09:29.1254012Z rollout_percent: 25 2025-09-07T06:09:29.1254496Z all_branches: false 2025-09-07T06:09:29.1255156Z default: true 2025-09-07T06:09:29.1255597Z --- 2025-09-07T06:09:29.1255812Z 2025-09-07T06:09:29.1255994Z # Opt-ins: 2025-09-07T06:09:29.1256609Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:29.1257510Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:29.1258321Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:29.1259013Z # Experiments should be from the above list. 2025-09-07T06:09:29.1259398Z 2025-09-07T06:09:29.1259599Z @User1,-lf,split_build 2025-09-07T06:09:29.1260060Z @User2,lf 2025-09-07T06:09:29.1260476Z @User3,split_build 2025-09-07T06:09:29.1260915Z """ 2025-09-07T06:09:29.1261112Z 2025-09-07T06:09:29.1261466Z import json 2025-09-07T06:09:29.1261996Z import logging 2025-09-07T06:09:29.1262412Z import os 2025-09-07T06:09:29.1262808Z import random 2025-09-07T06:09:29.1263212Z import re 2025-09-07T06:09:29.1263594Z import sys 2025-09-07T06:09:29.1264041Z from argparse import ArgumentParser 2025-09-07T06:09:29.1264601Z from collections.abc import Iterable 2025-09-07T06:09:29.1265152Z from functools import cache 2025-09-07T06:09:29.1265649Z from logging import LogRecord 2025-09-07T06:09:29.1266179Z from typing import Any, NamedTuple 2025-09-07T06:09:29.1266734Z from urllib.request import Request, urlopen 2025-09-07T06:09:29.1267118Z 2025-09-07T06:09:29.1267304Z import yaml 2025-09-07T06:09:29.1267723Z from github import Auth, Github 2025-09-07T06:09:29.1268240Z from github.Issue import Issue 2025-09-07T06:09:29.1268554Z 2025-09-07T06:09:29.1268561Z 2025-09-07T06:09:29.1268801Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:29.1269514Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:29.1270451Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:29.1271019Z 2025-09-07T06:09:29.1271268Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:29.1272215Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:29.1272771Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:29.1273347Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:29.1273705Z 2025-09-07T06:09:29.1273921Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:29.1274261Z 2025-09-07T06:09:29.1274468Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:29.1274956Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:29.1275244Z 2025-09-07T06:09:29.1275251Z 2025-09-07T06:09:29.1275455Z class Experiment(NamedTuple): 2025-09-07T06:09:29.1275969Z rollout_perc: float = ( 2025-09-07T06:09:29.1276627Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:29.1277325Z ) 2025-09-07T06:09:29.1277718Z all_branches: bool = ( 2025-09-07T06:09:29.1278359Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:29.1279054Z ) 2025-09-07T06:09:29.1279436Z default: bool = ( 2025-09-07T06:09:29.1280042Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:29.1280701Z ) 2025-09-07T06:09:29.1280906Z 2025-09-07T06:09:29.1281106Z # Add more fields as needed 2025-09-07T06:09:29.1281640Z 2025-09-07T06:09:29.1281648Z 2025-09-07T06:09:29.1281873Z class Settings(NamedTuple): 2025-09-07T06:09:29.1282346Z """ 2025-09-07T06:09:29.1282821Z Settings for the experiments that can be opted into. 2025-09-07T06:09:29.1283413Z """ 2025-09-07T06:09:29.1283615Z 2025-09-07T06:09:29.1283850Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:29.1284219Z 2025-09-07T06:09:29.1284227Z 2025-09-07T06:09:29.1284454Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:29.1285101Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:29.1285535Z 2025-09-07T06:09:29.1285721Z COLORS = { 2025-09-07T06:09:29.1286144Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:29.1286674Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:29.1287339Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:29.1287888Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:29.1288394Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:29.1288885Z } 2025-09-07T06:09:29.1289084Z 2025-09-07T06:09:29.1289322Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:29.1290102Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:29.1290914Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:29.1291687Z return super().format(record) 2025-09-07T06:09:29.1292033Z 2025-09-07T06:09:29.1292041Z 2025-09-07T06:09:29.1292259Z handler = logging.StreamHandler() 2025-09-07T06:09:29.1292979Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:29.1293545Z 2025-09-07T06:09:29.1293804Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:29.1294400Z log.addHandler(handler) 2025-09-07T06:09:29.1294874Z log.setLevel(logging.INFO) 2025-09-07T06:09:29.1295171Z 2025-09-07T06:09:29.1295178Z 2025-09-07T06:09:29.1295444Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:29.1296025Z """ 2025-09-07T06:09:29.1296552Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:29.1297205Z """ 2025-09-07T06:09:29.1297603Z if not GITHUB_OUTPUT: 2025-09-07T06:09:29.1298687Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:29.1299822Z log.warning( 2025-09-07T06:09:29.1300700Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:29.1301859Z ) 2025-09-07T06:09:29.1311779Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:29.1312445Z return 2025-09-07T06:09:29.1312686Z 2025-09-07T06:09:29.1313089Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:29.1313718Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:29.1314332Z f.write(f"{key}={value}\n") 2025-09-07T06:09:29.1314664Z 2025-09-07T06:09:29.1314672Z 2025-09-07T06:09:29.1315001Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:29.1315665Z return frozenset( 2025-09-07T06:09:29.1316303Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:29.1317004Z ) 2025-09-07T06:09:29.1317213Z 2025-09-07T06:09:29.1317220Z 2025-09-07T06:09:29.1317417Z def parse_args() -> Any: 2025-09-07T06:09:29.1318011Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:29.1318912Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:29.1319715Z parser.add_argument( 2025-09-07T06:09:29.1320201Z "--github-issue-repo", 2025-09-07T06:09:29.1320703Z type=str, 2025-09-07T06:09:29.1321141Z required=False, 2025-09-07T06:09:29.1321869Z default="pytorch/test-infra", 2025-09-07T06:09:29.1322452Z help="GitHub repo to get the issue", 2025-09-07T06:09:29.1322995Z ) 2025-09-07T06:09:29.1323386Z parser.add_argument( 2025-09-07T06:09:29.1323873Z "--github-repo", 2025-09-07T06:09:29.1324335Z type=str, 2025-09-07T06:09:29.1324770Z required=True, 2025-09-07T06:09:29.1325260Z help="GitHub repo where CI is running", 2025-09-07T06:09:29.1325825Z ) 2025-09-07T06:09:29.1326228Z parser.add_argument( 2025-09-07T06:09:29.1326855Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:29.1327545Z ) 2025-09-07T06:09:29.1327937Z parser.add_argument( 2025-09-07T06:09:29.1328585Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:29.1329279Z ) 2025-09-07T06:09:29.1329675Z parser.add_argument( 2025-09-07T06:09:29.1330334Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:29.1381563Z ) 2025-09-07T06:09:29.1382205Z parser.add_argument( 2025-09-07T06:09:29.1382980Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:29.1383745Z ) 2025-09-07T06:09:29.1384158Z parser.add_argument( 2025-09-07T06:09:29.1384650Z "--github-ref-type", 2025-09-07T06:09:29.1385128Z type=str, 2025-09-07T06:09:29.1385560Z required=True, 2025-09-07T06:09:29.1386074Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:29.1386651Z ) 2025-09-07T06:09:29.1387045Z parser.add_argument( 2025-09-07T06:09:29.1387537Z "--eligible-experiments", 2025-09-07T06:09:29.1388068Z type=_str_comma_separated_to_set, 2025-09-07T06:09:29.1388616Z required=False, 2025-09-07T06:09:29.1389064Z default="", 2025-09-07T06:09:29.1389956Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:29.1390915Z ) 2025-09-07T06:09:29.1391430Z parser.add_argument( 2025-09-07T06:09:29.1391924Z "--opt-out-experiments", 2025-09-07T06:09:29.1392452Z type=_str_comma_separated_to_set, 2025-09-07T06:09:29.1392997Z required=False, 2025-09-07T06:09:29.1393441Z default="", 2025-09-07T06:09:29.1393859Z help=( 2025-09-07T06:09:29.1394552Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:29.1395708Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:29.1396558Z ), 2025-09-07T06:09:29.1396934Z ) 2025-09-07T06:09:29.1397331Z parser.add_argument( 2025-09-07T06:09:29.1397790Z "--pr-number", 2025-09-07T06:09:29.1398239Z type=str, 2025-09-07T06:09:29.1398661Z required=False, 2025-09-07T06:09:29.1399109Z default="", 2025-09-07T06:09:29.1399787Z help="the optional PR number where this is run", 2025-09-07T06:09:29.1400382Z ) 2025-09-07T06:09:29.1400589Z 2025-09-07T06:09:29.1400804Z return parser.parse_args() 2025-09-07T06:09:29.1401123Z 2025-09-07T06:09:29.1401130Z 2025-09-07T06:09:29.1401661Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.1402459Z auth = Auth.Token(github_token) 2025-09-07T06:09:29.1402995Z return Github(auth=auth) 2025-09-07T06:09:29.1403292Z 2025-09-07T06:09:29.1403305Z 2025-09-07T06:09:29.1403770Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.1404585Z repo = gh.get_repo(repo) 2025-09-07T06:09:29.1405112Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:29.1405484Z 2025-09-07T06:09:29.1405492Z 2025-09-07T06:09:29.1405702Z def get_potential_pr_author( 2025-09-07T06:09:29.1406378Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:29.1407092Z ) -> str: 2025-09-07T06:09:29.1407642Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:29.1408473Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:29.1409235Z # embedded in the tag name: ciflow// 2025-09-07T06:09:29.1409660Z 2025-09-07T06:09:29.1409869Z gh = get_gh_client(github_token) 2025-09-07T06:09:29.1410207Z 2025-09-07T06:09:29.1410500Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:29.1411154Z split_tag = ref_name.split("/") 2025-09-07T06:09:29.1411784Z if ( 2025-09-07T06:09:29.1412193Z len(split_tag) == 3 2025-09-07T06:09:29.1412698Z and split_tag[0] == "ciflow" 2025-09-07T06:09:29.1413246Z and split_tag[2].isnumeric() 2025-09-07T06:09:29.1413769Z ): 2025-09-07T06:09:29.1414169Z pr_number = split_tag[2] 2025-09-07T06:09:29.1414675Z try: 2025-09-07T06:09:29.1415275Z repository = gh.get_repo(repo) 2025-09-07T06:09:29.1415922Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:29.1416545Z except Exception as e: 2025-09-07T06:09:29.1417082Z raise Exception( # noqa: TRY002 2025-09-07T06:09:29.1417774Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:29.1418433Z ) from e 2025-09-07T06:09:29.1418993Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:29.1419699Z # In all other cases, return the original input username 2025-09-07T06:09:29.1420306Z return username 2025-09-07T06:09:29.1420554Z 2025-09-07T06:09:29.1420561Z 2025-09-07T06:09:29.1420812Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:29.1421617Z """ 2025-09-07T06:09:29.1422372Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:29.1423176Z """ 2025-09-07T06:09:29.1423754Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:29.1424279Z 2025-09-07T06:09:29.1424287Z 2025-09-07T06:09:29.1424504Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:29.1425022Z try: 2025-09-07T06:09:29.1425436Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:29.1425962Z return data 2025-09-07T06:09:29.1426400Z except yaml.YAMLError: 2025-09-07T06:09:29.1426902Z log.exception("Error loading YAML") 2025-09-07T06:09:29.1427447Z raise 2025-09-07T06:09:29.1427677Z 2025-09-07T06:09:29.1427685Z 2025-09-07T06:09:29.1428122Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:29.1428883Z """ 2025-09-07T06:09:29.1429521Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:29.1430129Z 2025-09-07T06:09:29.1430636Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.1431576Z and the text below is the list of opted in users. 2025-09-07T06:09:29.1431997Z 2025-09-07T06:09:29.1432381Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:29.1433106Z """ 2025-09-07T06:09:29.1433572Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:29.1434224Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:29.1434856Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:29.1435484Z else: 2025-09-07T06:09:29.1435899Z return "", rollout_state 2025-09-07T06:09:29.1436215Z 2025-09-07T06:09:29.1436223Z 2025-09-07T06:09:29.1436443Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:29.1436976Z """ 2025-09-07T06:09:29.1437519Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:29.1438187Z """ 2025-09-07T06:09:29.1438395Z 2025-09-07T06:09:29.1438402Z 2025-09-07T06:09:29.1438766Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:29.1439451Z """ 2025-09-07T06:09:29.1440194Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:29.1440883Z 2025-09-07T06:09:29.1441627Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:29.1442650Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:29.1443357Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:29.1443850Z 2025-09-07T06:09:29.1443858Z 2025-09-07T06:09:29.1444034Z """ 2025-09-07T06:09:29.1444443Z optins = UserOptins() 2025-09-07T06:09:29.1444951Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:29.1445543Z user = user.strip("\r\n\t -") 2025-09-07T06:09:29.1446104Z if not user or not user.startswith("@"): 2025-09-07T06:09:29.1446684Z # Not a valid user. Skip 2025-09-07T06:09:29.1447333Z continue 2025-09-07T06:09:29.1447589Z 2025-09-07T06:09:29.1447770Z if user: 2025-09-07T06:09:29.1448223Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:29.1448940Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:29.1449436Z 2025-09-07T06:09:29.1449631Z return optins 2025-09-07T06:09:29.1449878Z 2025-09-07T06:09:29.1449885Z 2025-09-07T06:09:29.1450186Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:29.1450805Z """ 2025-09-07T06:09:29.1451220Z Check if the experiment name is valid. 2025-09-07T06:09:29.1451877Z A valid name: 2025-09-07T06:09:29.1452522Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:29.1453508Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:29.1454267Z - Cannot contain spaces 2025-09-07T06:09:29.1454758Z """ 2025-09-07T06:09:29.1454963Z 2025-09-07T06:09:29.1455247Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:29.1455964Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:29.1456422Z 2025-09-07T06:09:29.1456598Z if valid: 2025-09-07T06:09:29.1457001Z return True 2025-09-07T06:09:29.1457250Z 2025-09-07T06:09:29.1457428Z log.error( 2025-09-07T06:09:29.1458897Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T06:09:29.1460514Z ) 2025-09-07T06:09:29.1460913Z return False 2025-09-07T06:09:29.1461154Z 2025-09-07T06:09:29.1461162Z 2025-09-07T06:09:29.1461772Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:29.1462437Z """ 2025-09-07T06:09:29.1463192Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:29.1463953Z """ 2025-09-07T06:09:29.1464336Z try: 2025-09-07T06:09:29.1464738Z if settings_text: 2025-09-07T06:09:29.1465499Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:29.1466307Z # for easy reading 2025-09-07T06:09:29.1467113Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:29.1468023Z # the backtick character in shell commands. 2025-09-07T06:09:29.1468652Z backtick = chr(96) # backtick character 2025-09-07T06:09:29.1469337Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:29.1470068Z settings = load_yaml(settings_text) 2025-09-07T06:09:29.1470462Z 2025-09-07T06:09:29.1470888Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:29.1471780Z experiments = {} 2025-09-07T06:09:29.1472090Z 2025-09-07T06:09:29.1472486Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:29.1473285Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:29.1474411Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T06:09:29.1475474Z continue 2025-09-07T06:09:29.1475769Z 2025-09-07T06:09:29.1475972Z valid_settings = {} 2025-09-07T06:09:29.1476529Z for setting in exp_settings: 2025-09-07T06:09:29.1477132Z if setting not in Experiment._fields: 2025-09-07T06:09:29.1477708Z log.warning( 2025-09-07T06:09:29.1478441Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:29.1479187Z ) 2025-09-07T06:09:29.1479819Z else: 2025-09-07T06:09:29.1480364Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:29.1480798Z 2025-09-07T06:09:29.1481099Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:29.1481873Z return Settings(experiments) 2025-09-07T06:09:29.1482234Z 2025-09-07T06:09:29.1482425Z except Exception: 2025-09-07T06:09:29.1482929Z log.exception("Failed to parse settings") 2025-09-07T06:09:29.1483320Z 2025-09-07T06:09:29.1483507Z return Settings() 2025-09-07T06:09:29.1483767Z 2025-09-07T06:09:29.1483774Z 2025-09-07T06:09:29.1484041Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:29.1484625Z """ 2025-09-07T06:09:29.1485100Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:29.1485512Z 2025-09-07T06:09:29.1485887Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.1486671Z and the text below is the list of opted in users. 2025-09-07T06:09:29.1487081Z 2025-09-07T06:09:29.1487507Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:29.1488254Z """ 2025-09-07T06:09:29.1488845Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.1489625Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:29.1490049Z 2025-09-07T06:09:29.1490056Z 2025-09-07T06:09:29.1490316Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:29.1490897Z """ 2025-09-07T06:09:29.1491411Z Parse users from the rollout state. 2025-09-07T06:09:29.1491778Z 2025-09-07T06:09:29.1491960Z """ 2025-09-07T06:09:29.1492503Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.1493284Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:29.1493689Z 2025-09-07T06:09:29.1493697Z 2025-09-07T06:09:29.1494259Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.1495040Z """ 2025-09-07T06:09:29.1495489Z Check if a user is opted into an experiment 2025-09-07T06:09:29.1496036Z """ 2025-09-07T06:09:29.1496518Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:29.1496949Z 2025-09-07T06:09:29.1496956Z 2025-09-07T06:09:29.1497389Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.1498171Z """ 2025-09-07T06:09:29.1498657Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:29.1499268Z """ 2025-09-07T06:09:29.1499797Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:29.1500502Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:29.1501170Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:29.1502125Z return False 2025-09-07T06:09:29.1502401Z 2025-09-07T06:09:29.1502704Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:29.1503335Z log.warning( 2025-09-07T06:09:29.1504164Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:29.1505078Z ) 2025-09-07T06:09:29.1505294Z 2025-09-07T06:09:29.1505480Z return True 2025-09-07T06:09:29.1505722Z 2025-09-07T06:09:29.1505729Z 2025-09-07T06:09:29.1505932Z def get_runner_prefix( 2025-09-07T06:09:29.1506399Z rollout_state: str, 2025-09-07T06:09:29.1506886Z workflow_requestors: Iterable[str], 2025-09-07T06:09:29.1507431Z branch: str, 2025-09-07T06:09:29.1507951Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.1508642Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.1509260Z is_canary: bool = False, 2025-09-07T06:09:29.1509755Z ) -> str: 2025-09-07T06:09:29.1510202Z settings = parse_settings(rollout_state) 2025-09-07T06:09:29.1510975Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:29.1511724Z 2025-09-07T06:09:29.1511929Z fleet_prefix = "" 2025-09-07T06:09:29.1512379Z prefixes = [] 2025-09-07T06:09:29.1513031Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:29.1513993Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:29.1514731Z log.info( 2025-09-07T06:09:29.1515431Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:29.1516213Z ) 2025-09-07T06:09:29.1516619Z continue 2025-09-07T06:09:29.1516882Z 2025-09-07T06:09:29.1517095Z if opt_out_experiments: 2025-09-07T06:09:29.1517653Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:29.1518321Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:29.1519153Z log.info( 2025-09-07T06:09:29.1520149Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:29.1521152Z ) 2025-09-07T06:09:29.1521900Z continue 2025-09-07T06:09:29.1522184Z 2025-09-07T06:09:29.1522402Z if eligible_experiments: 2025-09-07T06:09:29.1523012Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:29.1523674Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:29.1524264Z log.info( 2025-09-07T06:09:29.1525072Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:29.1525937Z ) 2025-09-07T06:09:29.1526360Z continue 2025-09-07T06:09:29.1526868Z elif not experiment_settings.default: 2025-09-07T06:09:29.1527426Z log.info( 2025-09-07T06:09:29.1528254Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:29.1529043Z ) 2025-09-07T06:09:29.1529452Z continue 2025-09-07T06:09:29.1529710Z 2025-09-07T06:09:29.1530009Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:29.1530656Z opted_out_users = [ 2025-09-07T06:09:29.1531141Z requestor 2025-09-07T06:09:29.1531744Z for requestor in workflow_requestors 2025-09-07T06:09:29.1532446Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.1533097Z ] 2025-09-07T06:09:29.1533321Z 2025-09-07T06:09:29.1533526Z if opted_out_users: 2025-09-07T06:09:29.1534000Z log.info( 2025-09-07T06:09:29.1534640Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:29.1535364Z ) 2025-09-07T06:09:29.1535767Z continue 2025-09-07T06:09:29.1536024Z 2025-09-07T06:09:29.1536327Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:29.1536988Z opted_in_users = [ 2025-09-07T06:09:29.1537465Z requestor 2025-09-07T06:09:29.1537954Z for requestor in workflow_requestors 2025-09-07T06:09:29.1538656Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.1539299Z ] 2025-09-07T06:09:29.1539518Z 2025-09-07T06:09:29.1539715Z enabled = False 2025-09-07T06:09:29.1540182Z if opted_in_users: 2025-09-07T06:09:29.1540651Z log.info( 2025-09-07T06:09:29.1541499Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:29.1542288Z ) 2025-09-07T06:09:29.1542723Z enabled = True 2025-09-07T06:09:29.1543019Z 2025-09-07T06:09:29.1543260Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:29.1544138Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:29.1545251Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:29.1545941Z log.info( 2025-09-07T06:09:29.1546832Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:29.1547785Z ) 2025-09-07T06:09:29.1548225Z enabled = True 2025-09-07T06:09:29.1548535Z 2025-09-07T06:09:29.1548722Z if enabled: 2025-09-07T06:09:29.1549178Z label = experiment_name 2025-09-07T06:09:29.1549753Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:29.1550613Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:29.1551639Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:29.1552426Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:29.1553119Z if is_canary: 2025-09-07T06:09:29.1553643Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:29.1554224Z fleet_prefix = label 2025-09-07T06:09:29.1554744Z else: 2025-09-07T06:09:29.1555203Z prefixes.append(label) 2025-09-07T06:09:29.1555559Z 2025-09-07T06:09:29.1555770Z if len(prefixes) > 1: 2025-09-07T06:09:29.1556235Z log.error( 2025-09-07T06:09:29.1557296Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T06:09:29.1558441Z ) 2025-09-07T06:09:29.1558866Z prefixes = prefixes[:1] 2025-09-07T06:09:29.1559180Z 2025-09-07T06:09:29.1559386Z # Fleet always comes first 2025-09-07T06:09:29.1559892Z if fleet_prefix: 2025-09-07T06:09:29.1560367Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:29.1560737Z 2025-09-07T06:09:29.1561134Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:29.1561674Z 2025-09-07T06:09:29.1561681Z 2025-09-07T06:09:29.1562146Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:29.1562942Z """ 2025-09-07T06:09:29.1563563Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:29.1564133Z 2025-09-07T06:09:29.1564533Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:29.1565270Z """ 2025-09-07T06:09:29.1565688Z gh = get_gh_client(github_token) 2025-09-07T06:09:29.1566256Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:29.1566926Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:29.1567387Z 2025-09-07T06:09:29.1567394Z 2025-09-07T06:09:29.1567808Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:29.1568600Z for _ in range(num_retries): 2025-09-07T06:09:29.1569113Z try: 2025-09-07T06:09:29.1569574Z req = Request(url=url, headers=headers) 2025-09-07T06:09:29.1570299Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:29.1570974Z return json.loads(content) 2025-09-07T06:09:29.1571634Z except Exception as e: 2025-09-07T06:09:29.1572197Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:29.1572611Z 2025-09-07T06:09:29.1573003Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:29.1573740Z return {} 2025-09-07T06:09:29.1573978Z 2025-09-07T06:09:29.1573985Z 2025-09-07T06:09:29.1574165Z @cache 2025-09-07T06:09:29.1574810Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:29.1575586Z """ 2025-09-07T06:09:29.1576009Z Dynamically get PR information 2025-09-07T06:09:29.1576521Z """ 2025-09-07T06:09:29.1577058Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:29.1577848Z headers = { 2025-09-07T06:09:29.1578339Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:29.1578974Z "Authorization": f"token {github_token}", 2025-09-07T06:09:29.1579549Z } 2025-09-07T06:09:29.1579998Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:29.1580639Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:29.1581206Z headers=headers, 2025-09-07T06:09:29.1581766Z ) 2025-09-07T06:09:29.1581974Z 2025-09-07T06:09:29.1582181Z if not json_response: 2025-09-07T06:09:29.1582771Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:29.1583418Z return {} 2025-09-07T06:09:29.1583663Z 2025-09-07T06:09:29.1583862Z return json_response 2025-09-07T06:09:29.1584153Z 2025-09-07T06:09:29.1584160Z 2025-09-07T06:09:29.1584580Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:29.1585353Z """ 2025-09-07T06:09:29.1585903Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:29.1586595Z """ 2025-09-07T06:09:29.1587106Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:29.1587745Z return { 2025-09-07T06:09:29.1588360Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:29.1589097Z } 2025-09-07T06:09:29.1589308Z 2025-09-07T06:09:29.1589315Z 2025-09-07T06:09:29.1589508Z def main() -> None: 2025-09-07T06:09:29.1589964Z args = parse_args() 2025-09-07T06:09:29.1590242Z 2025-09-07T06:09:29.1590491Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:29.1590884Z 2025-09-07T06:09:29.1591098Z # Check if the PR is opt-out 2025-09-07T06:09:29.1591718Z if args.pr_number: 2025-09-07T06:09:29.1592397Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:29.1593309Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:29.1593849Z log.info( 2025-09-07T06:09:29.1594563Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:29.1595360Z ) 2025-09-07T06:09:29.1595926Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.1596629Z sys.exit() 2025-09-07T06:09:29.1596897Z 2025-09-07T06:09:29.1597081Z try: 2025-09-07T06:09:29.1597547Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:29.1598278Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:29.1598951Z ) 2025-09-07T06:09:29.1599167Z 2025-09-07T06:09:29.1599394Z username = get_potential_pr_author( 2025-09-07T06:09:29.1599966Z args.github_token, 2025-09-07T06:09:29.1600468Z args.github_repo, 2025-09-07T06:09:29.1600967Z args.github_actor, 2025-09-07T06:09:29.1601581Z args.github_ref_type, 2025-09-07T06:09:29.1602113Z args.github_branch, 2025-09-07T06:09:29.1602605Z ) 2025-09-07T06:09:29.1602825Z 2025-09-07T06:09:29.1603124Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:29.1603587Z 2025-09-07T06:09:29.1603823Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:29.1604410Z rollout_state, 2025-09-07T06:09:29.1604916Z (args.github_issue_owner, username), 2025-09-07T06:09:29.1605497Z args.github_branch, 2025-09-07T06:09:29.1606014Z args.eligible_experiments, 2025-09-07T06:09:29.1606579Z args.opt_out_experiments, 2025-09-07T06:09:29.1607103Z is_canary, 2025-09-07T06:09:29.1607540Z ) 2025-09-07T06:09:29.1607759Z 2025-09-07T06:09:29.1607967Z except Exception as e: 2025-09-07T06:09:29.1608449Z log.error( 2025-09-07T06:09:29.1609142Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:29.1610081Z ) 2025-09-07T06:09:29.1610292Z 2025-09-07T06:09:29.1610643Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.1611160Z 2025-09-07T06:09:29.1611167Z 2025-09-07T06:09:29.1611460Z if __name__ == "__main__": 2025-09-07T06:09:29.1611930Z main() 2025-09-07T06:09:29.1612151Z 2025-09-07T06:09:29.1705019Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:29.1705915Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:29.1736171Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:29.1736644Z env: 2025-09-07T06:09:29.1737268Z GITHUB_TOKEN: *** 2025-09-07T06:09:29.1737685Z ISSUE_NUMBER: 5132 2025-09-07T06:09:29.1738128Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:29.1738643Z ISSUE_OWNER: 2025-09-07T06:09:29.1739055Z CHECK_EXPERIMENTS: 2025-09-07T06:09:29.1739482Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:29.1739925Z PR_NUMBER: 2025-09-07T06:09:29.1740311Z ##[endgroup] 2025-09-07T06:09:30.7884464Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:31.8567593Z Collecting urllib3==1.26.18 2025-09-07T06:09:31.9133629Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:31.9369286Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.1 MB/s eta 0:00:00 2025-09-07T06:09:31.9685132Z Collecting PyGithub==2.3.0 2025-09-07T06:09:31.9805337Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:32.0314415Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:32.0422510Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-09-07T06:09:32.0468247Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:32.0480399Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-09-07T06:09:32.0500183Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:32.0860488Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:32.0965626Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:32.1199926Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-09-07T06:09:32.2524841Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.2631773Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:32.3933707Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:32.4042014Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T06:09:32.4286030Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.4390062Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:32.4702660Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:32.4838273Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.5 MB/s eta 0:00:00 2025-09-07T06:09:32.4946444Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:32.5087194Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 28.3 MB/s eta 0:00:00 2025-09-07T06:09:32.5197792Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:32.5342122Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 67.3 MB/s eta 0:00:00 2025-09-07T06:09:32.5452521Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:32.5585888Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:32.5651046Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 103.3 MB/s eta 0:00:00 2025-09-07T06:09:32.5760400Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:32.5800927Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.9 MB/s eta 0:00:00 2025-09-07T06:09:32.5907224Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:32.5950232Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.1 MB/s eta 0:00:00 2025-09-07T06:09:32.9272277Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:33.4606280Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-09-07T06:09:33.5335330Z ##[group]Run curr_branch="main" 2025-09-07T06:09:33.5335625Z curr_branch="main" 2025-09-07T06:09:33.5335839Z curr_ref_type="branch" 2025-09-07T06:09:33.5336090Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:33.5336357Z  2025-09-07T06:09:33.5336539Z python3 runner_determinator.py \ 2025-09-07T06:09:33.5336805Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:33.5337069Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:33.5337324Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:33.5337575Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:33.5337847Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:33.5338115Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:33.5338386Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:33.5338676Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:33.5339033Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:33.5339310Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:33.5370397Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:33.5370636Z env: 2025-09-07T06:09:33.5371168Z GITHUB_TOKEN: *** 2025-09-07T06:09:33.5371563Z ISSUE_NUMBER: 5132 2025-09-07T06:09:33.5371761Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:33.5371983Z ISSUE_OWNER: 2025-09-07T06:09:33.5372152Z CHECK_EXPERIMENTS: 2025-09-07T06:09:33.5372339Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:33.5372537Z PR_NUMBER: 2025-09-07T06:09:33.5372696Z ##[endgroup] 2025-09-07T06:09:33.5420769Z Current branch is 'main' 2025-09-07T06:09:34.9634825Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:34.9636013Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:34.9641922Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:34.9642796Z INFO : Setting output: label-type='' 2025-09-07T06:09:34.9942290Z Evaluate and set job outputs 2025-09-07T06:09:34.9948456Z Cleaning up orphan processes