2025-08-14T20:50:53.6499619Z Current runner version: '2.327.1' 2025-08-14T20:50:53.6523034Z ##[group]Runner Image Provisioner 2025-08-14T20:50:53.6523828Z Hosted Compute Agent 2025-08-14T20:50:53.6524508Z Version: 20250812.370 2025-08-14T20:50:53.6525102Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:50:53.6526168Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:50:53.6526840Z ##[endgroup] 2025-08-14T20:50:53.6527425Z ##[group]Operating System 2025-08-14T20:50:53.6527987Z Ubuntu 2025-08-14T20:50:53.6528535Z 24.04.2 2025-08-14T20:50:53.6529010Z LTS 2025-08-14T20:50:53.6529491Z ##[endgroup] 2025-08-14T20:50:53.6530041Z ##[group]Runner Image 2025-08-14T20:50:53.6530589Z Image: ubuntu-24.04 2025-08-14T20:50:53.6531130Z Version: 20250810.1.0 2025-08-14T20:50:53.6532172Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250810.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:50:53.6533749Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250810.1 2025-08-14T20:50:53.6534756Z ##[endgroup] 2025-08-14T20:50:53.6536096Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:50:53.6538353Z Contents: read 2025-08-14T20:50:53.6538916Z Metadata: read 2025-08-14T20:50:53.6539432Z ##[endgroup] 2025-08-14T20:50:53.6542116Z Secret source: Actions 2025-08-14T20:50:53.6543050Z Prepare workflow directory 2025-08-14T20:50:53.7041090Z Prepare all required actions 2025-08-14T20:50:53.7097282Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:50:53.7102019Z ##[group] Inputs 2025-08-14T20:50:53.7102643Z check_experiments: 2025-08-14T20:50:53.7103337Z opt_out_experiments: 2025-08-14T20:50:53.7103936Z triggering_actor: pytorchmergebot 2025-08-14T20:50:53.7104621Z issue_owner: 2025-08-14T20:50:53.7105134Z curr_branch: main 2025-08-14T20:50:53.7105869Z curr_ref_type: branch 2025-08-14T20:50:53.7106479Z issue_number: 5132 2025-08-14T20:50:53.7107146Z ##[endgroup] 2025-08-14T20:50:53.7107812Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:50:54.2387375Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:50:54.2389706Z cat < runner_determinator.py 2025-08-14T20:50:54.2390428Z # flake8: noqa: G004 2025-08-14T20:50:54.2390958Z  2025-08-14T20:50:54.2391829Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:50:54.2392907Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:50:54.2393887Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:50:54.2394662Z  2025-08-14T20:50:54.2395132Z """ 2025-08-14T20:50:54.2396234Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:50:54.2397362Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:50:54.2398586Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:50:54.2399608Z of which runners should be used to run which job. 2025-08-14T20:50:54.2400337Z  2025-08-14T20:50:54.2401042Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:50:54.2402152Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:50:54.2403222Z settings are considered to be empty with only the second part, the user 2025-08-14T20:50:54.2404065Z list, defined. 2025-08-14T20:50:54.2404636Z  2025-08-14T20:50:54.2405572Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:50:54.2406725Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:50:54.2407798Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:50:54.2408545Z  2025-08-14T20:50:54.2409564Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:50:54.2410576Z The user list is also a comma separated list of additional features or 2025-08-14T20:50:54.2411588Z experiments which the user could be opted in to. 2025-08-14T20:50:54.2412273Z  2025-08-14T20:50:54.2412794Z The user list has the following rules: 2025-08-14T20:50:54.2413502Z  2025-08-14T20:50:54.2414173Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:50:54.2415419Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:50:54.2416439Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:50:54.2417174Z  2025-08-14T20:50:54.2417616Z Example config: 2025-08-14T20:50:54.2418314Z  # A list of experiments that can be opted into. 2025-08-14T20:50:54.2419197Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:50:54.2419943Z  # Expected syntax is: 2025-08-14T20:50:54.2420831Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:50:54.2421974Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:50:54.2422840Z  2025-08-14T20:50:54.2497571Z  experiments: 2025-08-14T20:50:54.2498496Z  lf: 2025-08-14T20:50:54.2499319Z  rollout_percent: 25 2025-08-14T20:50:54.2500348Z  all_branches: false 2025-08-14T20:50:54.2501381Z  default: true 2025-08-14T20:50:54.2502174Z  --- 2025-08-14T20:50:54.2502588Z  2025-08-14T20:50:54.2502979Z  # Opt-ins: 2025-08-14T20:50:54.2503661Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:50:54.2504881Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:50:54.2506087Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:50:54.2506894Z  # Experiments should be from the above list. 2025-08-14T20:50:54.2507504Z  2025-08-14T20:50:54.2507918Z  @User1,-lf,split_build 2025-08-14T20:50:54.2508450Z  @User2,lf 2025-08-14T20:50:54.2508931Z  @User3,split_build 2025-08-14T20:50:54.2509422Z """ 2025-08-14T20:50:54.2509817Z  2025-08-14T20:50:54.2510205Z import json 2025-08-14T20:50:54.2510643Z import logging 2025-08-14T20:50:54.2511093Z import os 2025-08-14T20:50:54.2511520Z import random 2025-08-14T20:50:54.2511964Z import re 2025-08-14T20:50:54.2512375Z import sys 2025-08-14T20:50:54.2512843Z from argparse import ArgumentParser 2025-08-14T20:50:54.2513493Z from collections.abc import Iterable 2025-08-14T20:50:54.2514105Z from functools import cache 2025-08-14T20:50:54.2514643Z from logging import LogRecord 2025-08-14T20:50:54.2515534Z from typing import Any, NamedTuple 2025-08-14T20:50:54.2516168Z from urllib.request import Request, urlopen 2025-08-14T20:50:54.2516764Z  2025-08-14T20:50:54.2517155Z import yaml 2025-08-14T20:50:54.2517631Z from github import Auth, Github 2025-08-14T20:50:54.2518197Z from github.Issue import Issue 2025-08-14T20:50:54.2518721Z  2025-08-14T20:50:54.2519094Z  2025-08-14T20:50:54.2519569Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:50:54.2520353Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:50:54.2521327Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:50:54.2522098Z  2025-08-14T20:50:54.2522780Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:50:54.2523423Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:50:54.2524034Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:50:54.2524690Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:50:54.2525443Z  2025-08-14T20:50:54.2525892Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:50:54.2526456Z  2025-08-14T20:50:54.2526864Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:50:54.2527414Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:50:54.2527924Z  2025-08-14T20:50:54.2528298Z  2025-08-14T20:50:54.2528715Z class Experiment(NamedTuple): 2025-08-14T20:50:54.2529269Z  rollout_perc: float = ( 2025-08-14T20:50:54.2530012Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:50:54.2530746Z  ) 2025-08-14T20:50:54.2531188Z  all_branches: bool = ( 2025-08-14T20:50:54.2531962Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:50:54.2532699Z  ) 2025-08-14T20:50:54.2533121Z  default: bool = ( 2025-08-14T20:50:54.2533790Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:50:54.2534514Z  ) 2025-08-14T20:50:54.2534918Z  2025-08-14T20:50:54.2535506Z  # Add more fields as needed 2025-08-14T20:50:54.2536040Z  2025-08-14T20:50:54.2536410Z  2025-08-14T20:50:54.2536823Z class Settings(NamedTuple): 2025-08-14T20:50:54.2537348Z  """ 2025-08-14T20:50:54.2537899Z  Settings for the experiments that can be opted into. 2025-08-14T20:50:54.2538536Z  """ 2025-08-14T20:50:54.2538942Z  2025-08-14T20:50:54.2539385Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:50:54.2539956Z  2025-08-14T20:50:54.2540466Z  2025-08-14T20:50:54.2540939Z class ColorFormatter(logging.Formatter): 2025-08-14T20:50:54.2541657Z  """Color codes the log messages based on the log level""" 2025-08-14T20:50:54.2542304Z  2025-08-14T20:50:54.2542690Z  COLORS = { 2025-08-14T20:50:54.2543177Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:50:54.2543743Z  "ERROR": "\033[31m", # Red 2025-08-14T20:50:54.2544295Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:50:54.2544872Z  "INFO": "\033[0m", # Reset 2025-08-14T20:50:54.2545669Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:50:54.2546208Z  } 2025-08-14T20:50:54.2546612Z  2025-08-14T20:50:54.2547089Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:50:54.2547932Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:50:54.2548794Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:50:54.2549441Z  return super().format(record) 2025-08-14T20:50:54.2549996Z  2025-08-14T20:50:54.2550380Z  2025-08-14T20:50:54.2550804Z handler = logging.StreamHandler() 2025-08-14T20:50:54.2551608Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:50:54.2552375Z  2025-08-14T20:50:54.2552876Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:50:54.2553528Z log.addHandler(handler) 2025-08-14T20:50:54.2554049Z log.setLevel(logging.INFO) 2025-08-14T20:50:54.2554553Z  2025-08-14T20:50:54.2554926Z  2025-08-14T20:50:54.2555603Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:50:54.2556231Z  """ 2025-08-14T20:50:54.2556812Z  Defines outputs of the github action that invokes this script 2025-08-14T20:50:54.2557637Z  """ 2025-08-14T20:50:54.2558062Z  if not GITHUB_OUTPUT: 2025-08-14T20:50:54.2559226Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:50:54.2560425Z  log.warning( 2025-08-14T20:50:54.2561379Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:50:54.2562357Z  ) 2025-08-14T20:50:54.2562866Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:50:54.2563470Z  return 2025-08-14T20:50:54.2563907Z  2025-08-14T20:50:54.2564337Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:50:54.2564972Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:50:54.2565800Z  f.write(f"{key}={value}\n") 2025-08-14T20:50:54.2566355Z  2025-08-14T20:50:54.2566733Z  2025-08-14T20:50:54.2567301Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:50:54.2568013Z  return frozenset( 2025-08-14T20:50:54.2568731Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:50:54.2569468Z  ) 2025-08-14T20:50:54.2569881Z  2025-08-14T20:50:54.2570255Z  2025-08-14T20:50:54.2570667Z def parse_args() -> Any: 2025-08-14T20:50:54.2571344Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:50:54.2572285Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:50:54.2573112Z  parser.add_argument( 2025-08-14T20:50:54.2573645Z  "--github-issue-repo", 2025-08-14T20:50:54.2574202Z  type=str, 2025-08-14T20:50:54.2574696Z  required=False, 2025-08-14T20:50:54.2575516Z  default="pytorch/test-infra", 2025-08-14T20:50:54.2576181Z  help="GitHub repo to get the issue", 2025-08-14T20:50:54.2576742Z  ) 2025-08-14T20:50:54.2577170Z  parser.add_argument( 2025-08-14T20:50:54.2577691Z  "--github-repo", 2025-08-14T20:50:54.2578203Z  type=str, 2025-08-14T20:50:54.2578683Z  required=True, 2025-08-14T20:50:54.2579240Z  help="GitHub repo where CI is running", 2025-08-14T20:50:54.2579811Z  ) 2025-08-14T20:50:54.2580243Z  parser.add_argument( 2025-08-14T20:50:54.2580952Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:50:54.2581661Z  ) 2025-08-14T20:50:54.2582089Z  parser.add_argument( 2025-08-14T20:50:54.2582813Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:50:54.2583560Z  ) 2025-08-14T20:50:54.2583985Z  parser.add_argument( 2025-08-14T20:50:54.2584722Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:50:54.2585699Z  ) 2025-08-14T20:50:54.2586153Z  parser.add_argument( 2025-08-14T20:50:54.2586954Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:50:54.2587727Z  ) 2025-08-14T20:50:54.2588179Z  parser.add_argument( 2025-08-14T20:50:54.2588709Z  "--github-ref-type", 2025-08-14T20:50:54.2589241Z  type=str, 2025-08-14T20:50:54.2589726Z  required=True, 2025-08-14T20:50:54.2590329Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:50:54.2590939Z  ) 2025-08-14T20:50:54.2591376Z  parser.add_argument( 2025-08-14T20:50:54.2592064Z  "--eligible-experiments", 2025-08-14T20:50:54.2592680Z  type=_str_comma_separated_to_set, 2025-08-14T20:50:54.2593269Z  required=False, 2025-08-14T20:50:54.2593774Z  default="", 2025-08-14T20:50:54.2594746Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:50:54.2596045Z  ) 2025-08-14T20:50:54.2596483Z  parser.add_argument( 2025-08-14T20:50:54.2597029Z  "--opt-out-experiments", 2025-08-14T20:50:54.2597639Z  type=_str_comma_separated_to_set, 2025-08-14T20:50:54.2598220Z  required=False, 2025-08-14T20:50:54.2598723Z  default="", 2025-08-14T20:50:54.2599210Z  help=( 2025-08-14T20:50:54.2599978Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:50:54.2601203Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:50:54.2602094Z  ), 2025-08-14T20:50:54.2602518Z  ) 2025-08-14T20:50:54.2602946Z  parser.add_argument( 2025-08-14T20:50:54.2603467Z  "--pr-number", 2025-08-14T20:50:54.2603975Z  type=str, 2025-08-14T20:50:54.2604453Z  required=False, 2025-08-14T20:50:54.2604959Z  default="", 2025-08-14T20:50:54.2605651Z  help="the optional PR number where this is run", 2025-08-14T20:50:54.2606281Z  ) 2025-08-14T20:50:54.2606680Z  2025-08-14T20:50:54.2607105Z  return parser.parse_args() 2025-08-14T20:50:54.2607639Z  2025-08-14T20:50:54.2608015Z  2025-08-14T20:50:54.2608689Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:50:54.2609667Z  auth = Auth.Token(github_token) 2025-08-14T20:50:54.2610289Z  return Github(auth=auth) 2025-08-14T20:50:54.2610815Z  2025-08-14T20:50:54.2611201Z  2025-08-14T20:50:54.2611930Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:50:54.2612821Z  repo = gh.get_repo(repo) 2025-08-14T20:50:54.2613429Z  return repo.get_issue(number=issue_num) 2025-08-14T20:50:54.2614014Z  2025-08-14T20:50:54.2614399Z  2025-08-14T20:50:54.2614812Z def get_potential_pr_author( 2025-08-14T20:50:54.2615670Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:50:54.2616403Z ) -> str: 2025-08-14T20:50:54.2617008Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:50:54.2617901Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:50:54.2618769Z  # embedded in the tag name: ciflow// 2025-08-14T20:50:54.2619397Z  2025-08-14T20:50:54.2619825Z  gh = get_gh_client(github_token) 2025-08-14T20:50:54.2620385Z  2025-08-14T20:50:54.2620908Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:50:54.2621617Z  split_tag = ref_name.split("/") 2025-08-14T20:50:54.2622187Z  if ( 2025-08-14T20:50:54.2622651Z  len(split_tag) == 3 2025-08-14T20:50:54.2623226Z  and split_tag[0] == "ciflow" 2025-08-14T20:50:54.2623818Z  and split_tag[2].isnumeric() 2025-08-14T20:50:54.2624375Z  ): 2025-08-14T20:50:54.2624842Z  pr_number = split_tag[2] 2025-08-14T20:50:54.2625568Z  try: 2025-08-14T20:50:54.2626100Z  repository = gh.get_repo(repo) 2025-08-14T20:50:54.2626990Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:50:54.2627688Z  except Exception as e: 2025-08-14T20:50:54.2628293Z  raise Exception( # noqa: TRY002 2025-08-14T20:50:54.2629067Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:50:54.2629765Z  ) from e 2025-08-14T20:50:54.2630413Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:50:54.2631199Z  # In all other cases, return the original input username 2025-08-14T20:50:54.2631881Z  return username 2025-08-14T20:50:54.2632352Z  2025-08-14T20:50:54.2632727Z  2025-08-14T20:50:54.2633206Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:50:54.2633787Z  """ 2025-08-14T20:50:54.2634519Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:50:54.2635459Z  """ 2025-08-14T20:50:54.2636082Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:50:54.2636818Z  2025-08-14T20:50:54.2637186Z  2025-08-14T20:50:54.2637627Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:50:54.2638183Z  try: 2025-08-14T20:50:54.2638645Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:50:54.2639219Z  return data 2025-08-14T20:50:54.2639726Z  except yaml.YAMLError: 2025-08-14T20:50:54.2640304Z  log.exception("Error loading YAML") 2025-08-14T20:50:54.2640868Z  raise 2025-08-14T20:50:54.2641295Z  2025-08-14T20:50:54.2641662Z  2025-08-14T20:50:54.2642336Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:50:54.2643135Z  """ 2025-08-14T20:50:54.2643963Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:50:54.2644776Z  2025-08-14T20:50:54.2645476Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:54.2646345Z  and the text below is the list of opted in users. 2025-08-14T20:50:54.2646958Z  2025-08-14T20:50:54.2647575Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:50:54.2648323Z  """ 2025-08-14T20:50:54.2648852Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:50:54.2649513Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:50:54.2650207Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:50:54.2650852Z  else: 2025-08-14T20:50:54.2651294Z  return "", rollout_state 2025-08-14T20:50:54.2652067Z  2025-08-14T20:50:54.2652440Z  2025-08-14T20:50:54.2652888Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:50:54.2653451Z  """ 2025-08-14T20:50:54.2654055Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:50:54.2654754Z  """ 2025-08-14T20:50:54.2655244Z  2025-08-14T20:50:54.2655620Z  2025-08-14T20:50:54.2656206Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:50:54.2656917Z  """ 2025-08-14T20:50:54.2657705Z  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:50:54.2658605Z  2025-08-14T20:50:54.2659471Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:50:54.2660555Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:50:54.2661457Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:50:54.2662143Z  2025-08-14T20:50:54.2662511Z  2025-08-14T20:50:54.2662878Z  """ 2025-08-14T20:50:54.2663303Z  optins = UserOptins() 2025-08-14T20:50:54.2663876Z  for user in user_optin_text.split("\n"): 2025-08-14T20:50:54.2664499Z  user = user.strip("\r\n\t -") 2025-08-14T20:50:54.2665127Z  if not user or not user.startswith("@"): 2025-08-14T20:50:54.2665898Z  # Not a valid user. Skip 2025-08-14T20:50:54.2666462Z  continue 2025-08-14T20:50:54.2666917Z  2025-08-14T20:50:54.2667310Z  if user: 2025-08-14T20:50:54.2667828Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:50:54.2668626Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:50:54.2669338Z  2025-08-14T20:50:54.2669727Z  return optins 2025-08-14T20:50:54.2670184Z  2025-08-14T20:50:54.2670542Z  2025-08-14T20:50:54.2671081Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:50:54.2671738Z  """ 2025-08-14T20:50:54.2672206Z  Check if the experiment name is valid. 2025-08-14T20:50:54.2672782Z  A valid name: 2025-08-14T20:50:54.2673513Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:50:54.2674525Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:50:54.2675729Z  - Cannot contain spaces 2025-08-14T20:50:54.2676262Z  """ 2025-08-14T20:50:54.2676658Z  2025-08-14T20:50:54.2677163Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:50:54.2677941Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:50:54.2678729Z  2025-08-14T20:50:54.2679120Z  if valid: 2025-08-14T20:50:54.2679557Z  return True 2025-08-14T20:50:54.2680004Z  2025-08-14T20:50:54.2680376Z  log.error( 2025-08-14T20:50:54.2681923Z  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:50:54.2683546Z  ) 2025-08-14T20:50:54.2683946Z  return False 2025-08-14T20:50:54.2684385Z  2025-08-14T20:50:54.2684746Z  2025-08-14T20:50:54.2685413Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:50:54.2686105Z  """ 2025-08-14T20:50:54.2686767Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:50:54.2687540Z  """ 2025-08-14T20:50:54.2687945Z  try: 2025-08-14T20:50:54.2688363Z  if settings_text: 2025-08-14T20:50:54.2689187Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:50:54.2690043Z  # for easy reading 2025-08-14T20:50:54.2690928Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:50:54.2691904Z  # the backtick character in shell commands. 2025-08-14T20:50:54.2692577Z  backtick = chr(96) # backtick character 2025-08-14T20:50:54.2693333Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:50:54.2694066Z  settings = load_yaml(settings_text) 2025-08-14T20:50:54.2694626Z  2025-08-14T20:50:54.2695374Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:50:54.2696312Z  experiments = {} 2025-08-14T20:50:54.2696826Z  2025-08-14T20:50:54.2697434Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:50:54.2698256Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:50:54.2699437Z  # 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:50:54.2700532Z  continue 2025-08-14T20:50:54.2701027Z  2025-08-14T20:50:54.2701433Z  valid_settings = {} 2025-08-14T20:50:54.2702013Z  for setting in exp_settings: 2025-08-14T20:50:54.2702644Z  if setting not in Experiment._fields: 2025-08-14T20:50:54.2703258Z  log.warning( 2025-08-14T20:50:54.2704052Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:50:54.2704813Z  ) 2025-08-14T20:50:54.2705405Z  else: 2025-08-14T20:50:54.2706015Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:50:54.2706631Z  2025-08-14T20:50:54.2707155Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:50:54.2707858Z  return Settings(experiments) 2025-08-14T20:50:54.2708402Z  2025-08-14T20:50:54.2708792Z  except Exception: 2025-08-14T20:50:54.2709367Z  log.exception("Failed to parse settings") 2025-08-14T20:50:54.2709950Z  2025-08-14T20:50:54.2710341Z  return Settings() 2025-08-14T20:50:54.2710811Z  2025-08-14T20:50:54.2711177Z  2025-08-14T20:50:54.2711837Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:50:54.2712471Z  """ 2025-08-14T20:50:54.2712974Z  Parse settings, if any, from the rollout state. 2025-08-14T20:50:54.2713569Z  2025-08-14T20:50:54.2714155Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:54.2714988Z  and the text below is the list of opted in users. 2025-08-14T20:50:54.2715682Z  2025-08-14T20:50:54.2716333Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:50:54.2717108Z  """ 2025-08-14T20:50:54.2717735Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:54.2718568Z  return parse_settings_from_text(settings_text) 2025-08-14T20:50:54.2719159Z  2025-08-14T20:50:54.2719525Z  2025-08-14T20:50:54.2720029Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:50:54.2720650Z  """ 2025-08-14T20:50:54.2721108Z  Parse users from the rollout state. 2025-08-14T20:50:54.2721665Z  2025-08-14T20:50:54.2722040Z  """ 2025-08-14T20:50:54.2722651Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:54.2723458Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:50:54.2724046Z  2025-08-14T20:50:54.2724406Z  2025-08-14T20:50:54.2725073Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:54.2725970Z  """ 2025-08-14T20:50:54.2726453Z  Check if a user is opted into an experiment 2025-08-14T20:50:54.2727033Z  """ 2025-08-14T20:50:54.2727558Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:50:54.2728181Z  2025-08-14T20:50:54.2728705Z  2025-08-14T20:50:54.2729528Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:54.2730494Z  """ 2025-08-14T20:50:54.2731103Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:50:54.2731739Z  """ 2025-08-14T20:50:54.2732353Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:50:54.2733123Z  experiment_optout = "-" + experiment_name 2025-08-14T20:50:54.2733836Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:50:54.2734492Z  return False 2025-08-14T20:50:54.2734961Z  2025-08-14T20:50:54.2735567Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:50:54.2736220Z  log.warning( 2025-08-14T20:50:54.2737117Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:50:54.2738055Z  ) 2025-08-14T20:50:54.2738465Z  2025-08-14T20:50:54.2738856Z  return True 2025-08-14T20:50:54.2739304Z  2025-08-14T20:50:54.2739665Z  2025-08-14T20:50:54.2740067Z def get_runner_prefix( 2025-08-14T20:50:54.2740568Z  rollout_state: str, 2025-08-14T20:50:54.2741114Z  workflow_requestors: Iterable[str], 2025-08-14T20:50:54.2741841Z  branch: str, 2025-08-14T20:50:54.2742432Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:54.2743183Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:54.2743833Z  is_canary: bool = False, 2025-08-14T20:50:54.2744343Z ) -> str: 2025-08-14T20:50:54.2744839Z  settings = parse_settings(rollout_state) 2025-08-14T20:50:54.2745590Z  user_optins = parse_users(rollout_state) 2025-08-14T20:50:54.2746165Z  2025-08-14T20:50:54.2746693Z  fleet_prefix = "" 2025-08-14T20:50:54.2747194Z  prefixes = [] 2025-08-14T20:50:54.2747926Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:50:54.2748947Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:50:54.2749710Z  log.info( 2025-08-14T20:50:54.2750481Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:50:54.2751278Z  ) 2025-08-14T20:50:54.2751729Z  continue 2025-08-14T20:50:54.2752180Z  2025-08-14T20:50:54.2752589Z  if opt_out_experiments: 2025-08-14T20:50:54.2753205Z  if experiment_name in opt_out_experiments: 2025-08-14T20:50:54.2753924Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:50:54.2754583Z  log.info( 2025-08-14T20:50:54.2755820Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:50:54.2756863Z  ) 2025-08-14T20:50:54.2757339Z  continue 2025-08-14T20:50:54.2757820Z  2025-08-14T20:50:54.2758231Z  if eligible_experiments: 2025-08-14T20:50:54.2758870Z  if experiment_name not in eligible_experiments: 2025-08-14T20:50:54.2759613Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:50:54.2760226Z  log.info( 2025-08-14T20:50:54.2761091Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:50:54.2761973Z  ) 2025-08-14T20:50:54.2762568Z  continue 2025-08-14T20:50:54.2763138Z  elif not experiment_settings.default: 2025-08-14T20:50:54.2763710Z  log.info( 2025-08-14T20:50:54.2764466Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:50:54.2765355Z  ) 2025-08-14T20:50:54.2765811Z  continue 2025-08-14T20:50:54.2766270Z  2025-08-14T20:50:54.2766789Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:50:54.2767467Z  opted_out_users = [ 2025-08-14T20:50:54.2767988Z  requestor 2025-08-14T20:50:54.2768536Z  for requestor in workflow_requestors 2025-08-14T20:50:54.2769290Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:50:54.2769970Z  ] 2025-08-14T20:50:54.2770383Z  2025-08-14T20:50:54.2770785Z  if opted_out_users: 2025-08-14T20:50:54.2771326Z  log.info( 2025-08-14T20:50:54.2772035Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:50:54.2772785Z  ) 2025-08-14T20:50:54.2773225Z  continue 2025-08-14T20:50:54.2773685Z  2025-08-14T20:50:54.2774191Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:50:54.2774857Z  opted_in_users = [ 2025-08-14T20:50:54.2775484Z  requestor 2025-08-14T20:50:54.2776021Z  for requestor in workflow_requestors 2025-08-14T20:50:54.2776763Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:50:54.2777424Z  ] 2025-08-14T20:50:54.2777834Z  2025-08-14T20:50:54.2778221Z  enabled = False 2025-08-14T20:50:54.2778733Z  if opted_in_users: 2025-08-14T20:50:54.2779366Z  log.info( 2025-08-14T20:50:54.2780072Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:50:54.2780804Z  ) 2025-08-14T20:50:54.2781254Z  enabled = True 2025-08-14T20:50:54.2781745Z  2025-08-14T20:50:54.2782192Z  elif experiment_settings.rollout_perc: 2025-08-14T20:50:54.2783098Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:50:54.2784124Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:50:54.2784828Z  log.info( 2025-08-14T20:50:54.2785883Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:50:54.2786853Z  ) 2025-08-14T20:50:54.2787342Z  enabled = True 2025-08-14T20:50:54.2787850Z  2025-08-14T20:50:54.2788238Z  if enabled: 2025-08-14T20:50:54.2788748Z  label = experiment_name 2025-08-14T20:50:54.2789382Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:50:54.2790279Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:50:54.2791229Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:50:54.2792060Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:50:54.2792788Z  if is_canary: 2025-08-14T20:50:54.2793356Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:50:54.2793956Z  fleet_prefix = label 2025-08-14T20:50:54.2794493Z  else: 2025-08-14T20:50:54.2795135Z  prefixes.append(label) 2025-08-14T20:50:54.2795784Z  2025-08-14T20:50:54.2796186Z  if len(prefixes) > 1: 2025-08-14T20:50:54.2796700Z  log.error( 2025-08-14T20:50:54.2797822Z  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:50:54.2799011Z  ) 2025-08-14T20:50:54.2799468Z  prefixes = prefixes[:1] 2025-08-14T20:50:54.2799987Z  2025-08-14T20:50:54.2800383Z  # Fleet always comes first 2025-08-14T20:50:54.2800924Z  if fleet_prefix: 2025-08-14T20:50:54.2801453Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:50:54.2802000Z  2025-08-14T20:50:54.2802496Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:50:54.2803112Z  2025-08-14T20:50:54.2803493Z  2025-08-14T20:50:54.2804180Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:50:54.2804998Z  """ 2025-08-14T20:50:54.2805751Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:50:54.2806506Z  2025-08-14T20:50:54.2807130Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:50:54.2807883Z  """ 2025-08-14T20:50:54.2808333Z  gh = get_gh_client(github_token) 2025-08-14T20:50:54.2808949Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:50:54.2809673Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:50:54.2810307Z  2025-08-14T20:50:54.2810675Z  2025-08-14T20:50:54.2811321Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:50:54.2812253Z  for _ in range(num_retries): 2025-08-14T20:50:54.2812785Z  try: 2025-08-14T20:50:54.2813278Z  req = Request(url=url, headers=headers) 2025-08-14T20:50:54.2814011Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:50:54.2814711Z  return json.loads(content) 2025-08-14T20:50:54.2815394Z  except Exception as e: 2025-08-14T20:50:54.2816041Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:50:54.2816635Z  2025-08-14T20:50:54.2817259Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:50:54.2818023Z  return {} 2025-08-14T20:50:54.2818454Z  2025-08-14T20:50:54.2818813Z  2025-08-14T20:50:54.2819188Z @cache 2025-08-14T20:50:54.2819888Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:50:54.2820701Z  """ 2025-08-14T20:50:54.2821157Z  Dynamically get PR information 2025-08-14T20:50:54.2821689Z  """ 2025-08-14T20:50:54.2822257Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:50:54.2822927Z  headers = { 2025-08-14T20:50:54.2823467Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:50:54.2824133Z  "Authorization": f"token {github_token}", 2025-08-14T20:50:54.2824708Z  } 2025-08-14T20:50:54.2825300Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:50:54.2825967Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:50:54.2826572Z  headers=headers, 2025-08-14T20:50:54.2827051Z  ) 2025-08-14T20:50:54.2827441Z  2025-08-14T20:50:54.2827839Z  if not json_response: 2025-08-14T20:50:54.2828493Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:50:54.2829312Z  return {} 2025-08-14T20:50:54.2829768Z  2025-08-14T20:50:54.2830159Z  return json_response 2025-08-14T20:50:54.2830642Z  2025-08-14T20:50:54.2831004Z  2025-08-14T20:50:54.2831642Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:50:54.2832449Z  """ 2025-08-14T20:50:54.2833054Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:50:54.2833754Z  """ 2025-08-14T20:50:54.2834307Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:50:54.2834964Z  return { 2025-08-14T20:50:54.2835724Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:50:54.2836449Z  } 2025-08-14T20:50:54.2836838Z  2025-08-14T20:50:54.2837205Z  2025-08-14T20:50:54.2837602Z def main() -> None: 2025-08-14T20:50:54.2838085Z  args = parse_args() 2025-08-14T20:50:54.2838571Z  2025-08-14T20:50:54.2839037Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:50:54.2839618Z  2025-08-14T20:50:54.2840028Z  # Check if the PR is opt-out 2025-08-14T20:50:54.2840574Z  if args.pr_number: 2025-08-14T20:50:54.2841328Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:50:54.2842128Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:50:54.2842676Z  log.info( 2025-08-14T20:50:54.2843453Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:50:54.2844252Z  ) 2025-08-14T20:50:54.2844899Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:54.2845721Z  sys.exit() 2025-08-14T20:50:54.2846313Z  2025-08-14T20:50:54.2846693Z  try: 2025-08-14T20:50:54.2847197Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:50:54.2847975Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:50:54.2848660Z  ) 2025-08-14T20:50:54.2849067Z  2025-08-14T20:50:54.2849501Z  username = get_potential_pr_author( 2025-08-14T20:50:54.2850085Z  args.github_token, 2025-08-14T20:50:54.2850623Z  args.github_repo, 2025-08-14T20:50:54.2851167Z  args.github_actor, 2025-08-14T20:50:54.2851717Z  args.github_ref_type, 2025-08-14T20:50:54.2852278Z  args.github_branch, 2025-08-14T20:50:54.2852789Z  ) 2025-08-14T20:50:54.2853194Z  2025-08-14T20:50:54.2853723Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:50:54.2854375Z  2025-08-14T20:50:54.2854832Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:50:54.2855531Z  rollout_state, 2025-08-14T20:50:54.2856103Z  (args.github_issue_owner, username), 2025-08-14T20:50:54.2856715Z  args.github_branch, 2025-08-14T20:50:54.2857296Z  args.eligible_experiments, 2025-08-14T20:50:54.2857901Z  args.opt_out_experiments, 2025-08-14T20:50:54.2858460Z  is_canary, 2025-08-14T20:50:54.2858943Z  ) 2025-08-14T20:50:54.2859355Z  2025-08-14T20:50:54.2859758Z  except Exception as e: 2025-08-14T20:50:54.2860272Z  log.error( 2025-08-14T20:50:54.2861037Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:50:54.2861958Z  ) 2025-08-14T20:50:54.2862368Z  2025-08-14T20:50:54.2862939Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:54.2863633Z  2025-08-14T20:50:54.2863995Z  2025-08-14T20:50:54.2864388Z if __name__ == "__main__": 2025-08-14T20:50:54.2864891Z  main() 2025-08-14T20:50:54.2865426Z  2025-08-14T20:50:54.2865796Z EOF 2025-08-14T20:50:54.2866170Z  2025-08-14T20:50:54.2866579Z cat runner_determinator.py 2025-08-14T20:50:54.3182254Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:54.3183071Z env: 2025-08-14T20:50:54.3183787Z GITHUB_TOKEN: *** 2025-08-14T20:50:54.3184214Z ISSUE_NUMBER: 5132 2025-08-14T20:50:54.3184656Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:54.3185355Z ISSUE_OWNER: 2025-08-14T20:50:54.3185792Z CHECK_EXPERIMENTS: 2025-08-14T20:50:54.3186228Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:54.3186651Z PR_NUMBER: 2025-08-14T20:50:54.3187059Z ##[endgroup] 2025-08-14T20:50:54.3393760Z # flake8: noqa: G004 2025-08-14T20:50:54.3394101Z 2025-08-14T20:50:54.3394528Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:50:54.3395823Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:50:54.3396657Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:50:54.3397098Z 2025-08-14T20:50:54.3397264Z """ 2025-08-14T20:50:54.3397844Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:50:54.3398715Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:50:54.3399600Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:50:54.3400401Z of which runners should be used to run which job. 2025-08-14T20:50:54.3400797Z 2025-08-14T20:50:54.3401193Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:50:54.3402275Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:50:54.3403172Z settings are considered to be empty with only the second part, the user 2025-08-14T20:50:54.3403869Z list, defined. 2025-08-14T20:50:54.3404100Z 2025-08-14T20:50:54.3404467Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:50:54.3405860Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:50:54.3406709Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:50:54.3407149Z 2025-08-14T20:50:54.3407517Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:50:54.3408376Z The user list is also a comma separated list of additional features or 2025-08-14T20:50:54.3409103Z experiments which the user could be opted in to. 2025-08-14T20:50:54.3409494Z 2025-08-14T20:50:54.3409691Z The user list has the following rules: 2025-08-14T20:50:54.3410046Z 2025-08-14T20:50:54.3410365Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:50:54.3411237Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:50:54.3411998Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:50:54.3412390Z 2025-08-14T20:50:54.3412565Z Example config: 2025-08-14T20:50:54.3413007Z # A list of experiments that can be opted into. 2025-08-14T20:50:54.3413676Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:50:54.3414285Z # Expected syntax is: 2025-08-14T20:50:54.3414921Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:50:54.3416033Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:50:54.3416656Z 2025-08-14T20:50:54.3416829Z experiments: 2025-08-14T20:50:54.3417220Z lf: 2025-08-14T20:50:54.3417592Z rollout_percent: 25 2025-08-14T20:50:54.3418216Z all_branches: false 2025-08-14T20:50:54.3418659Z default: true 2025-08-14T20:50:54.3419063Z --- 2025-08-14T20:50:54.3419263Z 2025-08-14T20:50:54.3419424Z # Opt-ins: 2025-08-14T20:50:54.3420000Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:50:54.3420850Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:50:54.3421619Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:50:54.3422268Z # Experiments should be from the above list. 2025-08-14T20:50:54.3422647Z 2025-08-14T20:50:54.3422825Z @User1,-lf,split_build 2025-08-14T20:50:54.3423255Z @User2,lf 2025-08-14T20:50:54.3423634Z @User3,split_build 2025-08-14T20:50:54.3424051Z """ 2025-08-14T20:50:54.3424245Z 2025-08-14T20:50:54.3424410Z import json 2025-08-14T20:50:54.3424788Z import logging 2025-08-14T20:50:54.3425298Z import os 2025-08-14T20:50:54.3425714Z import random 2025-08-14T20:50:54.3426095Z import re 2025-08-14T20:50:54.3426463Z import sys 2025-08-14T20:50:54.3426862Z from argparse import ArgumentParser 2025-08-14T20:50:54.3427388Z from collections.abc import Iterable 2025-08-14T20:50:54.3427918Z from functools import cache 2025-08-14T20:50:54.3428386Z from logging import LogRecord 2025-08-14T20:50:54.3428887Z from typing import Any, NamedTuple 2025-08-14T20:50:54.3429421Z from urllib.request import Request, urlopen 2025-08-14T20:50:54.3429805Z 2025-08-14T20:50:54.3429973Z import yaml 2025-08-14T20:50:54.3430370Z from github import Auth, Github 2025-08-14T20:50:54.3430858Z from github.Issue import Issue 2025-08-14T20:50:54.3431164Z 2025-08-14T20:50:54.3431170Z 2025-08-14T20:50:54.3431383Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:50:54.3432050Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:50:54.3432904Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:50:54.3433465Z 2025-08-14T20:50:54.3433690Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:50:54.3434389Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:50:54.3434904Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:50:54.3435733Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:50:54.3436105Z 2025-08-14T20:50:54.3436307Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:50:54.3436639Z 2025-08-14T20:50:54.3436825Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:50:54.3437285Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:50:54.3437561Z 2025-08-14T20:50:54.3437568Z 2025-08-14T20:50:54.3437754Z class Experiment(NamedTuple): 2025-08-14T20:50:54.3438235Z rollout_perc: float = ( 2025-08-14T20:50:54.3438862Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:50:54.3439553Z ) 2025-08-14T20:50:54.3439917Z all_branches: bool = ( 2025-08-14T20:50:54.3440531Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:50:54.3441197Z ) 2025-08-14T20:50:54.3441551Z default: bool = ( 2025-08-14T20:50:54.3442114Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:50:54.3442753Z ) 2025-08-14T20:50:54.3442954Z 2025-08-14T20:50:54.3443137Z # Add more fields as needed 2025-08-14T20:50:54.3443435Z 2025-08-14T20:50:54.3443442Z 2025-08-14T20:50:54.3443634Z class Settings(NamedTuple): 2025-08-14T20:50:54.3444073Z """ 2025-08-14T20:50:54.3444524Z Settings for the experiments that can be opted into. 2025-08-14T20:50:54.3445096Z """ 2025-08-14T20:50:54.3445477Z 2025-08-14T20:50:54.3445697Z experiments: dict[str, Experiment] = {} 2025-08-14T20:50:54.3446066Z 2025-08-14T20:50:54.3446072Z 2025-08-14T20:50:54.3446283Z class ColorFormatter(logging.Formatter): 2025-08-14T20:50:54.3446921Z """Color codes the log messages based on the log level""" 2025-08-14T20:50:54.3447350Z 2025-08-14T20:50:54.3447513Z COLORS = { 2025-08-14T20:50:54.3447914Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:50:54.3448579Z "ERROR": "\033[31m", # Red 2025-08-14T20:50:54.3449064Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:50:54.3449566Z "INFO": "\033[0m", # Reset 2025-08-14T20:50:54.3450047Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:50:54.3450532Z } 2025-08-14T20:50:54.3450726Z 2025-08-14T20:50:54.3450947Z def format(self, record: LogRecord) -> str: 2025-08-14T20:50:54.3451698Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:50:54.3452479Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:50:54.3453056Z return super().format(record) 2025-08-14T20:50:54.3453386Z 2025-08-14T20:50:54.3453392Z 2025-08-14T20:50:54.3453592Z handler = logging.StreamHandler() 2025-08-14T20:50:54.3454292Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:50:54.3454850Z 2025-08-14T20:50:54.3455090Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:50:54.3455835Z log.addHandler(handler) 2025-08-14T20:50:54.3456292Z log.setLevel(logging.INFO) 2025-08-14T20:50:54.3456578Z 2025-08-14T20:50:54.3456584Z 2025-08-14T20:50:54.3456836Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:50:54.3457398Z """ 2025-08-14T20:50:54.3457907Z Defines outputs of the github action that invokes this script 2025-08-14T20:50:54.3458521Z """ 2025-08-14T20:50:54.3458897Z if not GITHUB_OUTPUT: 2025-08-14T20:50:54.3459958Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:50:54.3461058Z log.warning( 2025-08-14T20:50:54.3461911Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:50:54.3462856Z ) 2025-08-14T20:50:54.3472764Z print(f"::set-output name={key}::{value}") 2025-08-14T20:50:54.3473381Z return 2025-08-14T20:50:54.3473621Z 2025-08-14T20:50:54.3474015Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:50:54.3474622Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:50:54.3475488Z f.write(f"{key}={value}\n") 2025-08-14T20:50:54.3475919Z 2025-08-14T20:50:54.3475926Z 2025-08-14T20:50:54.3476251Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:50:54.3476894Z return frozenset( 2025-08-14T20:50:54.3477520Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:50:54.3478199Z ) 2025-08-14T20:50:54.3478399Z 2025-08-14T20:50:54.3478407Z 2025-08-14T20:50:54.3478587Z def parse_args() -> Any: 2025-08-14T20:50:54.3479127Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:50:54.3479988Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:50:54.3480764Z parser.add_argument( 2025-08-14T20:50:54.3481228Z "--github-issue-repo", 2025-08-14T20:50:54.3481729Z type=str, 2025-08-14T20:50:54.3482134Z required=False, 2025-08-14T20:50:54.3482596Z default="pytorch/test-infra", 2025-08-14T20:50:54.3483131Z help="GitHub repo to get the issue", 2025-08-14T20:50:54.3483641Z ) 2025-08-14T20:50:54.3484012Z parser.add_argument( 2025-08-14T20:50:54.3484459Z "--github-repo", 2025-08-14T20:50:54.3484887Z type=str, 2025-08-14T20:50:54.3485404Z required=True, 2025-08-14T20:50:54.3485869Z help="GitHub repo where CI is running", 2025-08-14T20:50:54.3486398Z ) 2025-08-14T20:50:54.3486765Z parser.add_argument( 2025-08-14T20:50:54.3487371Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:50:54.3488033Z ) 2025-08-14T20:50:54.3488390Z parser.add_argument( 2025-08-14T20:50:54.3489004Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:50:54.3489668Z ) 2025-08-14T20:50:54.3490035Z parser.add_argument( 2025-08-14T20:50:54.3490868Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:50:54.3491565Z ) 2025-08-14T20:50:54.3491935Z parser.add_argument( 2025-08-14T20:50:54.3492586Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:50:54.3493309Z ) 2025-08-14T20:50:54.3493680Z parser.add_argument( 2025-08-14T20:50:54.3494137Z "--github-ref-type", 2025-08-14T20:50:54.3494587Z type=str, 2025-08-14T20:50:54.3494985Z required=True, 2025-08-14T20:50:54.3495595Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:50:54.3496172Z ) 2025-08-14T20:50:54.3496538Z parser.add_argument( 2025-08-14T20:50:54.3544939Z "--eligible-experiments", 2025-08-14T20:50:54.3545665Z type=_str_comma_separated_to_set, 2025-08-14T20:50:54.3546238Z required=False, 2025-08-14T20:50:54.3546655Z default="", 2025-08-14T20:50:54.3547514Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:50:54.3548446Z ) 2025-08-14T20:50:54.3548807Z parser.add_argument( 2025-08-14T20:50:54.3549282Z "--opt-out-experiments", 2025-08-14T20:50:54.3549788Z type=_str_comma_separated_to_set, 2025-08-14T20:50:54.3550318Z required=False, 2025-08-14T20:50:54.3550731Z default="", 2025-08-14T20:50:54.3551126Z help=( 2025-08-14T20:50:54.3551788Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:50:54.3552921Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:50:54.3553742Z ), 2025-08-14T20:50:54.3554089Z ) 2025-08-14T20:50:54.3554457Z parser.add_argument( 2025-08-14T20:50:54.3554880Z "--pr-number", 2025-08-14T20:50:54.3555583Z type=str, 2025-08-14T20:50:54.3556015Z required=False, 2025-08-14T20:50:54.3556442Z default="", 2025-08-14T20:50:54.3557086Z help="the optional PR number where this is run", 2025-08-14T20:50:54.3557672Z ) 2025-08-14T20:50:54.3557873Z 2025-08-14T20:50:54.3558071Z return parser.parse_args() 2025-08-14T20:50:54.3558379Z 2025-08-14T20:50:54.3558385Z 2025-08-14T20:50:54.3558811Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:50:54.3559566Z auth = Auth.Token(github_token) 2025-08-14T20:50:54.3560067Z return Github(auth=auth) 2025-08-14T20:50:54.3560376Z 2025-08-14T20:50:54.3560383Z 2025-08-14T20:50:54.3560836Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:50:54.3561627Z repo = gh.get_repo(repo) 2025-08-14T20:50:54.3562125Z return repo.get_issue(number=issue_num) 2025-08-14T20:50:54.3562480Z 2025-08-14T20:50:54.3562487Z 2025-08-14T20:50:54.3562677Z def get_potential_pr_author( 2025-08-14T20:50:54.3563305Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:50:54.3563974Z ) -> str: 2025-08-14T20:50:54.3564476Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:50:54.3565391Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:50:54.3566150Z # embedded in the tag name: ciflow// 2025-08-14T20:50:54.3566559Z 2025-08-14T20:50:54.3566747Z gh = get_gh_client(github_token) 2025-08-14T20:50:54.3567082Z 2025-08-14T20:50:54.3567353Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:50:54.3567966Z split_tag = ref_name.split("/") 2025-08-14T20:50:54.3568468Z if ( 2025-08-14T20:50:54.3568856Z len(split_tag) == 3 2025-08-14T20:50:54.3569350Z and split_tag[0] == "ciflow" 2025-08-14T20:50:54.3569875Z and split_tag[2].isnumeric() 2025-08-14T20:50:54.3570417Z ): 2025-08-14T20:50:54.3570873Z pr_number = split_tag[2] 2025-08-14T20:50:54.3571623Z try: 2025-08-14T20:50:54.3572140Z repository = gh.get_repo(repo) 2025-08-14T20:50:54.3572783Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:50:54.3573373Z except Exception as e: 2025-08-14T20:50:54.3573886Z raise Exception( # noqa: TRY002 2025-08-14T20:50:54.3574550Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:50:54.3575286Z ) from e 2025-08-14T20:50:54.3575826Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:50:54.3576516Z # In all other cases, return the original input username 2025-08-14T20:50:54.3577095Z return username 2025-08-14T20:50:54.3577334Z 2025-08-14T20:50:54.3577341Z 2025-08-14T20:50:54.3577569Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:50:54.3578091Z """ 2025-08-14T20:50:54.3578714Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:50:54.3579472Z """ 2025-08-14T20:50:54.3580006Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:50:54.3580586Z 2025-08-14T20:50:54.3580593Z 2025-08-14T20:50:54.3580835Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:50:54.3581402Z try: 2025-08-14T20:50:54.3581859Z data = yaml.safe_load(yaml_text) 2025-08-14T20:50:54.3582396Z return data 2025-08-14T20:50:54.3582807Z except yaml.YAMLError: 2025-08-14T20:50:54.3583282Z log.exception("Error loading YAML") 2025-08-14T20:50:54.3583784Z raise 2025-08-14T20:50:54.3584002Z 2025-08-14T20:50:54.3584008Z 2025-08-14T20:50:54.3584411Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:50:54.3585147Z """ 2025-08-14T20:50:54.3585902Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:50:54.3586492Z 2025-08-14T20:50:54.3586957Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:54.3587726Z and the text below is the list of opted in users. 2025-08-14T20:50:54.3588131Z 2025-08-14T20:50:54.3588504Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:50:54.3589199Z """ 2025-08-14T20:50:54.3589634Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:50:54.3590243Z if len(rollout_state_parts) >= 2: 2025-08-14T20:50:54.3590850Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:50:54.3591435Z else: 2025-08-14T20:50:54.3591811Z return "", rollout_state 2025-08-14T20:50:54.3592115Z 2025-08-14T20:50:54.3592122Z 2025-08-14T20:50:54.3592324Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:50:54.3592832Z """ 2025-08-14T20:50:54.3593348Z Dictionary of users with a list of features they have opted into 2025-08-14T20:50:54.3593992Z """ 2025-08-14T20:50:54.3594196Z 2025-08-14T20:50:54.3594203Z 2025-08-14T20:50:54.3594548Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:50:54.3595407Z """ 2025-08-14T20:50:54.3596208Z 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:50:54.3596887Z 2025-08-14T20:50:54.3597507Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:50:54.3598492Z - Example line: "@User1,lf,split_build" 2025-08-14T20:50:54.3599167Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:50:54.3599647Z 2025-08-14T20:50:54.3599655Z 2025-08-14T20:50:54.3599810Z """ 2025-08-14T20:50:54.3600187Z optins = UserOptins() 2025-08-14T20:50:54.3600668Z for user in user_optin_text.split("\n"): 2025-08-14T20:50:54.3601250Z user = user.strip("\r\n\t -") 2025-08-14T20:50:54.3601787Z if not user or not user.startswith("@"): 2025-08-14T20:50:54.3602499Z # Not a valid user. Skip 2025-08-14T20:50:54.3602977Z continue 2025-08-14T20:50:54.3603227Z 2025-08-14T20:50:54.3603386Z if user: 2025-08-14T20:50:54.3603827Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:50:54.3604510Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:50:54.3604995Z 2025-08-14T20:50:54.3605296Z return optins 2025-08-14T20:50:54.3605539Z 2025-08-14T20:50:54.3605545Z 2025-08-14T20:50:54.3605826Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:50:54.3606425Z """ 2025-08-14T20:50:54.3606821Z Check if the experiment name is valid. 2025-08-14T20:50:54.3607343Z A valid name: 2025-08-14T20:50:54.3607981Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:50:54.3608921Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:50:54.3609664Z - Cannot contain spaces 2025-08-14T20:50:54.3610127Z """ 2025-08-14T20:50:54.3610330Z 2025-08-14T20:50:54.3610604Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:50:54.3611301Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:50:54.3611758Z 2025-08-14T20:50:54.3611918Z if valid: 2025-08-14T20:50:54.3612300Z return True 2025-08-14T20:50:54.3612546Z 2025-08-14T20:50:54.3612706Z log.error( 2025-08-14T20:50:54.3614161Z 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:50:54.3615863Z ) 2025-08-14T20:50:54.3616223Z return False 2025-08-14T20:50:54.3616456Z 2025-08-14T20:50:54.3616463Z 2025-08-14T20:50:54.3616780Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:50:54.3617390Z """ 2025-08-14T20:50:54.3618112Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:50:54.3618838Z """ 2025-08-14T20:50:54.3619187Z try: 2025-08-14T20:50:54.3619554Z if settings_text: 2025-08-14T20:50:54.3620282Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:50:54.3621078Z # for easy reading 2025-08-14T20:50:54.3621862Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:50:54.3622743Z # the backtick character in shell commands. 2025-08-14T20:50:54.3623346Z backtick = chr(96) # backtick character 2025-08-14T20:50:54.3624011Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:50:54.3624674Z settings = load_yaml(settings_text) 2025-08-14T20:50:54.3625043Z 2025-08-14T20:50:54.3625594Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:50:54.3626371Z experiments = {} 2025-08-14T20:50:54.3626670Z 2025-08-14T20:50:54.3627058Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:50:54.3627829Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:50:54.3628933Z # 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:50:54.3629982Z continue 2025-08-14T20:50:54.3630265Z 2025-08-14T20:50:54.3630452Z valid_settings = {} 2025-08-14T20:50:54.3630979Z for setting in exp_settings: 2025-08-14T20:50:54.3631558Z if setting not in Experiment._fields: 2025-08-14T20:50:54.3632106Z log.warning( 2025-08-14T20:50:54.3632818Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:50:54.3633719Z ) 2025-08-14T20:50:54.3634158Z else: 2025-08-14T20:50:54.3634674Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:50:54.3635107Z 2025-08-14T20:50:54.3635668Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:50:54.3636329Z return Settings(experiments) 2025-08-14T20:50:54.3636683Z 2025-08-14T20:50:54.3636862Z except Exception: 2025-08-14T20:50:54.3637349Z log.exception("Failed to parse settings") 2025-08-14T20:50:54.3637741Z 2025-08-14T20:50:54.3637913Z return Settings() 2025-08-14T20:50:54.3638173Z 2025-08-14T20:50:54.3638179Z 2025-08-14T20:50:54.3638425Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:50:54.3638994Z """ 2025-08-14T20:50:54.3639416Z Parse settings, if any, from the rollout state. 2025-08-14T20:50:54.3639829Z 2025-08-14T20:50:54.3640185Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:54.3640963Z and the text below is the list of opted in users. 2025-08-14T20:50:54.3641370Z 2025-08-14T20:50:54.3641777Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:50:54.3642525Z """ 2025-08-14T20:50:54.3643079Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:54.3643833Z return parse_settings_from_text(settings_text) 2025-08-14T20:50:54.3644231Z 2025-08-14T20:50:54.3644237Z 2025-08-14T20:50:54.3644479Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:50:54.3645041Z """ 2025-08-14T20:50:54.3645534Z Parse users from the rollout state. 2025-08-14T20:50:54.3645894Z 2025-08-14T20:50:54.3646049Z """ 2025-08-14T20:50:54.3646565Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:54.3647302Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:50:54.3647718Z 2025-08-14T20:50:54.3647726Z 2025-08-14T20:50:54.3648274Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:54.3649030Z """ 2025-08-14T20:50:54.3649443Z Check if a user is opted into an experiment 2025-08-14T20:50:54.3649980Z """ 2025-08-14T20:50:54.3650431Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:50:54.3650855Z 2025-08-14T20:50:54.3650861Z 2025-08-14T20:50:54.3651287Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:54.3652034Z """ 2025-08-14T20:50:54.3652492Z Check if a user explicitly opted out of an experiment 2025-08-14T20:50:54.3653066Z """ 2025-08-14T20:50:54.3653578Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:50:54.3654263Z experiment_optout = "-" + experiment_name 2025-08-14T20:50:54.3654918Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:50:54.3655629Z return False 2025-08-14T20:50:54.3655902Z 2025-08-14T20:50:54.3656185Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:50:54.3656793Z log.warning( 2025-08-14T20:50:54.3657595Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:50:54.3658480Z ) 2025-08-14T20:50:54.3658692Z 2025-08-14T20:50:54.3658859Z return True 2025-08-14T20:50:54.3659102Z 2025-08-14T20:50:54.3659109Z 2025-08-14T20:50:54.3659285Z def get_runner_prefix( 2025-08-14T20:50:54.3659722Z rollout_state: str, 2025-08-14T20:50:54.3660190Z workflow_requestors: Iterable[str], 2025-08-14T20:50:54.3660707Z branch: str, 2025-08-14T20:50:54.3661213Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:54.3661881Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:54.3662474Z is_canary: bool = False, 2025-08-14T20:50:54.3662933Z ) -> str: 2025-08-14T20:50:54.3663493Z settings = parse_settings(rollout_state) 2025-08-14T20:50:54.3664095Z user_optins = parse_users(rollout_state) 2025-08-14T20:50:54.3664463Z 2025-08-14T20:50:54.3664635Z fleet_prefix = "" 2025-08-14T20:50:54.3665068Z prefixes = [] 2025-08-14T20:50:54.3665833Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:50:54.3666806Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:50:54.3667528Z log.info( 2025-08-14T20:50:54.3668209Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:50:54.3668983Z ) 2025-08-14T20:50:54.3669367Z continue 2025-08-14T20:50:54.3669622Z 2025-08-14T20:50:54.3669810Z if opt_out_experiments: 2025-08-14T20:50:54.3670344Z if experiment_name in opt_out_experiments: 2025-08-14T20:50:54.3671009Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:50:54.3671607Z log.info( 2025-08-14T20:50:54.3672532Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:50:54.3673518Z ) 2025-08-14T20:50:54.3673914Z continue 2025-08-14T20:50:54.3674192Z 2025-08-14T20:50:54.3674376Z if eligible_experiments: 2025-08-14T20:50:54.3674935Z if experiment_name not in eligible_experiments: 2025-08-14T20:50:54.3675862Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:50:54.3676441Z log.info( 2025-08-14T20:50:54.3677225Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:50:54.3678077Z ) 2025-08-14T20:50:54.3678470Z continue 2025-08-14T20:50:54.3678953Z elif not experiment_settings.default: 2025-08-14T20:50:54.3679491Z log.info( 2025-08-14T20:50:54.3680293Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:50:54.3681060Z ) 2025-08-14T20:50:54.3681434Z continue 2025-08-14T20:50:54.3681442Z 2025-08-14T20:50:54.3681725Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:50:54.3681906Z opted_out_users = [ 2025-08-14T20:50:54.3682071Z requestor 2025-08-14T20:50:54.3682280Z for requestor in workflow_requestors 2025-08-14T20:50:54.3682587Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:50:54.3682746Z ] 2025-08-14T20:50:54.3682753Z 2025-08-14T20:50:54.3682935Z if opted_out_users: 2025-08-14T20:50:54.3683098Z log.info( 2025-08-14T20:50:54.3683475Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:50:54.3683635Z ) 2025-08-14T20:50:54.3683797Z continue 2025-08-14T20:50:54.3683810Z 2025-08-14T20:50:54.3684097Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:50:54.3684275Z opted_in_users = [ 2025-08-14T20:50:54.3684442Z requestor 2025-08-14T20:50:54.3684649Z for requestor in workflow_requestors 2025-08-14T20:50:54.3684945Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:50:54.3685106Z ] 2025-08-14T20:50:54.3685114Z 2025-08-14T20:50:54.3685762Z enabled = False 2025-08-14T20:50:54.3685958Z if opted_in_users: 2025-08-14T20:50:54.3686124Z log.info( 2025-08-14T20:50:54.3686488Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:50:54.3686651Z ) 2025-08-14T20:50:54.3686823Z enabled = True 2025-08-14T20:50:54.3686831Z 2025-08-14T20:50:54.3687047Z elif experiment_settings.rollout_perc: 2025-08-14T20:50:54.3687515Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:50:54.3687970Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:50:54.3688141Z log.info( 2025-08-14T20:50:54.3688739Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:50:54.3688897Z ) 2025-08-14T20:50:54.3689072Z enabled = True 2025-08-14T20:50:54.3689080Z 2025-08-14T20:50:54.3689244Z if enabled: 2025-08-14T20:50:54.3689433Z label = experiment_name 2025-08-14T20:50:54.3689653Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:50:54.3690101Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:50:54.3690377Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:50:54.3690701Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:50:54.3690885Z if is_canary: 2025-08-14T20:50:54.3691088Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:50:54.3691286Z fleet_prefix = label 2025-08-14T20:50:54.3691445Z else: 2025-08-14T20:50:54.3691643Z prefixes.append(label) 2025-08-14T20:50:54.3691651Z 2025-08-14T20:50:54.3691835Z if len(prefixes) > 1: 2025-08-14T20:50:54.3692000Z log.error( 2025-08-14T20:50:54.3692818Z 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:50:54.3692978Z ) 2025-08-14T20:50:54.3693167Z prefixes = prefixes[:1] 2025-08-14T20:50:54.3693177Z 2025-08-14T20:50:54.3693365Z # Fleet always comes first 2025-08-14T20:50:54.3693534Z if fleet_prefix: 2025-08-14T20:50:54.3693739Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:50:54.3693752Z 2025-08-14T20:50:54.3694117Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:50:54.3694126Z 2025-08-14T20:50:54.3694133Z 2025-08-14T20:50:54.3694582Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:50:54.3694743Z """ 2025-08-14T20:50:54.3695138Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:50:54.3695145Z 2025-08-14T20:50:54.3695674Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:50:54.3695837Z """ 2025-08-14T20:50:54.3696031Z gh = get_gh_client(github_token) 2025-08-14T20:50:54.3696241Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:50:54.3696525Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:50:54.3696534Z 2025-08-14T20:50:54.3696540Z 2025-08-14T20:50:54.3696936Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:50:54.3697134Z for _ in range(num_retries): 2025-08-14T20:50:54.3697305Z try: 2025-08-14T20:50:54.3697521Z req = Request(url=url, headers=headers) 2025-08-14T20:50:54.3697811Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:50:54.3698006Z return json.loads(content) 2025-08-14T20:50:54.3698199Z except Exception as e: 2025-08-14T20:50:54.3698436Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:50:54.3698444Z 2025-08-14T20:50:54.3698834Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:50:54.3699004Z return {} 2025-08-14T20:50:54.3699011Z 2025-08-14T20:50:54.3699018Z 2025-08-14T20:50:54.3699175Z @cache 2025-08-14T20:50:54.3699604Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:50:54.3699765Z """ 2025-08-14T20:50:54.3699958Z Dynamically get PR information 2025-08-14T20:50:54.3700118Z """ 2025-08-14T20:50:54.3700552Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:50:54.3700725Z headers = { 2025-08-14T20:50:54.3700952Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:50:54.3701166Z "Authorization": f"token {github_token}", 2025-08-14T20:50:54.3701323Z } 2025-08-14T20:50:54.3701557Z json_response: dict[str, Any] = download_json( 2025-08-14T20:50:54.3701768Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:50:54.3701944Z headers=headers, 2025-08-14T20:50:54.3702108Z ) 2025-08-14T20:50:54.3702115Z 2025-08-14T20:50:54.3702293Z if not json_response: 2025-08-14T20:50:54.3702588Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:50:54.3702758Z return {} 2025-08-14T20:50:54.3702766Z 2025-08-14T20:50:54.3702943Z return json_response 2025-08-14T20:50:54.3702950Z 2025-08-14T20:50:54.3702957Z 2025-08-14T20:50:54.3703359Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:50:54.3703534Z """ 2025-08-14T20:50:54.3703866Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:50:54.3704022Z """ 2025-08-14T20:50:54.3704313Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:50:54.3704478Z return { 2025-08-14T20:50:54.3704846Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:50:54.3705007Z } 2025-08-14T20:50:54.3705013Z 2025-08-14T20:50:54.3705024Z 2025-08-14T20:50:54.3705293Z def main() -> None: 2025-08-14T20:50:54.3705470Z args = parse_args() 2025-08-14T20:50:54.3705477Z 2025-08-14T20:50:54.3705700Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:50:54.3705708Z 2025-08-14T20:50:54.3705904Z # Check if the PR is opt-out 2025-08-14T20:50:54.3706078Z if args.pr_number: 2025-08-14T20:50:54.3706473Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:50:54.3706792Z if OPT_OUT_LABEL in labels: 2025-08-14T20:50:54.3706965Z log.info( 2025-08-14T20:50:54.3707397Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:50:54.3707558Z ) 2025-08-14T20:50:54.3707890Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:54.3708060Z sys.exit() 2025-08-14T20:50:54.3708068Z 2025-08-14T20:50:54.3708225Z try: 2025-08-14T20:50:54.3708464Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:50:54.3708774Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:50:54.3708935Z ) 2025-08-14T20:50:54.3708943Z 2025-08-14T20:50:54.3709155Z username = get_potential_pr_author( 2025-08-14T20:50:54.3709336Z args.github_token, 2025-08-14T20:50:54.3709516Z args.github_repo, 2025-08-14T20:50:54.3709692Z args.github_actor, 2025-08-14T20:50:54.3709889Z args.github_ref_type, 2025-08-14T20:50:54.3710073Z args.github_branch, 2025-08-14T20:50:54.3710230Z ) 2025-08-14T20:50:54.3710237Z 2025-08-14T20:50:54.3710527Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:50:54.3710535Z 2025-08-14T20:50:54.3710752Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:50:54.3710935Z rollout_state, 2025-08-14T20:50:54.3711144Z (args.github_issue_owner, username), 2025-08-14T20:50:54.3711322Z args.github_branch, 2025-08-14T20:50:54.3711519Z args.eligible_experiments, 2025-08-14T20:50:54.3711714Z args.opt_out_experiments, 2025-08-14T20:50:54.3711887Z is_canary, 2025-08-14T20:50:54.3712049Z ) 2025-08-14T20:50:54.3712057Z 2025-08-14T20:50:54.3712242Z except Exception as e: 2025-08-14T20:50:54.3712411Z log.error( 2025-08-14T20:50:54.3712844Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:50:54.3713134Z ) 2025-08-14T20:50:54.3713142Z 2025-08-14T20:50:54.3713482Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:54.3713489Z 2025-08-14T20:50:54.3713496Z 2025-08-14T20:50:54.3713673Z if __name__ == "__main__": 2025-08-14T20:50:54.3713830Z main() 2025-08-14T20:50:54.3713838Z 2025-08-14T20:50:54.3803464Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:50:54.3804497Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:50:54.3843097Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:54.3843564Z env: 2025-08-14T20:50:54.3844168Z GITHUB_TOKEN: *** 2025-08-14T20:50:54.3844570Z ISSUE_NUMBER: 5132 2025-08-14T20:50:54.3845000Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:54.3845677Z ISSUE_OWNER: 2025-08-14T20:50:54.3846071Z CHECK_EXPERIMENTS: 2025-08-14T20:50:54.3846544Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:54.3846984Z PR_NUMBER: 2025-08-14T20:50:54.3847364Z ##[endgroup] 2025-08-14T20:50:55.3112802Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:50:56.3191280Z Collecting urllib3==1.26.18 2025-08-14T20:50:56.3801024Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:50:56.4029894Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-08-14T20:50:56.4278960Z Collecting PyGithub==2.3.0 2025-08-14T20:50:56.4360183Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:50:56.4798558Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:50:56.4882713Z 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:50:56.4924289Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:50:56.4941194Z 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:50:56.4956224Z 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:50:56.5237531Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:50:56.5333134Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:50:56.5553623Z 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:50:56.6778964Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:50:56.6856910Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:50:56.8003420Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:50:56.8132752Z 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:50:56.8341123Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:50:56.8418664Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:50:56.8695411Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:50:56.8791825Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.1 MB/s eta 0:00:00 2025-08-14T20:50:56.8865719Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:50:56.8966826Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 40.9 MB/s eta 0:00:00 2025-08-14T20:50:56.9040836Z 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:50:56.9163287Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 84.4 MB/s eta 0:00:00 2025-08-14T20:50:56.9241405Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:50:56.9353899Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:50:56.9419747Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 101.5 MB/s eta 0:00:00 2025-08-14T20:50:56.9508601Z 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:50:56.9548398Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 32.0 MB/s eta 0:00:00 2025-08-14T20:50:56.9646347Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:50:56.9691973Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 35.9 MB/s eta 0:00:00 2025-08-14T20:50:57.3008177Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:50:57.8443385Z 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:50:57.9191209Z ##[group]Run curr_branch="main" 2025-08-14T20:50:57.9191531Z curr_branch="main" 2025-08-14T20:50:57.9191892Z curr_ref_type="branch" 2025-08-14T20:50:57.9192248Z echo "Current branch is '$curr_branch'" 2025-08-14T20:50:57.9192516Z  2025-08-14T20:50:57.9192708Z python3 runner_determinator.py \ 2025-08-14T20:50:57.9193097Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:50:57.9193394Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:50:57.9193670Z  --github-branch "$curr_branch" \ 2025-08-14T20:50:57.9193947Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:50:57.9194234Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:50:57.9194530Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:50:57.9194805Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:50:57.9195120Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:50:57.9195697Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:50:57.9196011Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:50:57.9237654Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:57.9237886Z env: 2025-08-14T20:50:57.9238439Z GITHUB_TOKEN: *** 2025-08-14T20:50:57.9238630Z ISSUE_NUMBER: 5132 2025-08-14T20:50:57.9238835Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:57.9239073Z ISSUE_OWNER: 2025-08-14T20:50:57.9239243Z CHECK_EXPERIMENTS: 2025-08-14T20:50:57.9239433Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:57.9239614Z PR_NUMBER: 2025-08-14T20:50:57.9239783Z ##[endgroup] 2025-08-14T20:50:57.9297659Z Current branch is 'main' 2025-08-14T20:50:59.3173162Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:50:59.3174367Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:50:59.3176860Z INFO : Setting output: label-type='' 2025-08-14T20:50:59.3473130Z Evaluate and set job outputs 2025-08-14T20:50:59.3479935Z Cleaning up orphan processes