2025-07-24T03:40:56.4805356Z Current runner version: '2.326.0' 2025-07-24T03:40:56.4828530Z ##[group]Runner Image Provisioner 2025-07-24T03:40:56.4829409Z Hosted Compute Agent 2025-07-24T03:40:56.4830093Z Version: 20250711.363 2025-07-24T03:40:56.4830692Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-24T03:40:56.4831394Z Build Date: 2025-07-11T20:04:25Z 2025-07-24T03:40:56.4831985Z ##[endgroup] 2025-07-24T03:40:56.4832567Z ##[group]Operating System 2025-07-24T03:40:56.4833105Z Ubuntu 2025-07-24T03:40:56.4833700Z 24.04.2 2025-07-24T03:40:56.4834333Z LTS 2025-07-24T03:40:56.4834803Z ##[endgroup] 2025-07-24T03:40:56.4835349Z ##[group]Runner Image 2025-07-24T03:40:56.4835923Z Image: ubuntu-24.04 2025-07-24T03:40:56.4836435Z Version: 20250720.1.0 2025-07-24T03:40:56.4837370Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250720.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-24T03:40:56.4838938Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250720.1 2025-07-24T03:40:56.4839902Z ##[endgroup] 2025-07-24T03:40:56.4840919Z ##[group]GITHUB_TOKEN Permissions 2025-07-24T03:40:56.4842907Z Contents: read 2025-07-24T03:40:56.4843603Z Metadata: read 2025-07-24T03:40:56.4844448Z ##[endgroup] 2025-07-24T03:40:56.4846769Z Secret source: Actions 2025-07-24T03:40:56.4847854Z Prepare workflow directory 2025-07-24T03:40:56.5360028Z Prepare all required actions 2025-07-24T03:40:56.5418082Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (07df6ba7f5597488a93b3855d52d2ead55675125) 2025-07-24T03:40:56.5422921Z ##[group] Inputs 2025-07-24T03:40:56.5423523Z check_experiments: 2025-07-24T03:40:56.5424489Z opt_out_experiments: lf 2025-07-24T03:40:56.5425105Z triggering_actor: pytorch-bot[bot] 2025-07-24T03:40:56.5425740Z issue_owner: 2025-07-24T03:40:56.5426320Z curr_branch: ciflow/inductor/149961 2025-07-24T03:40:56.5426934Z curr_ref_type: tag 2025-07-24T03:40:56.5427528Z issue_number: 5132 2025-07-24T03:40:56.5428152Z ##[endgroup] 2025-07-24T03:40:56.5428763Z Complete job name: get-label-type / runner-determinator 2025-07-24T03:40:57.2358213Z ##[group]Run cat < runner_determinator.py 2025-07-24T03:40:57.2360536Z cat < runner_determinator.py 2025-07-24T03:40:57.2361215Z # flake8: noqa: G004 2025-07-24T03:40:57.2361762Z  2025-07-24T03:40:57.2362511Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-24T03:40:57.2363501Z # must be kept in sync. You can do it easily by running the following command: 2025-07-24T03:40:57.2364653Z # python .github/scripts/update_runner_determinator.py 2025-07-24T03:40:57.2365378Z  2025-07-24T03:40:57.2365823Z """ 2025-07-24T03:40:57.2366555Z This runner determinator is used to determine which set of runners to run a 2025-07-24T03:40:57.2367554Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-24T03:40:57.2368682Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-24T03:40:57.2369739Z of which runners should be used to run which job. 2025-07-24T03:40:57.2370445Z  2025-07-24T03:40:57.2371118Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-24T03:40:57.2372162Z separated by a line containing "---". If the line is not present, the 2025-07-24T03:40:57.2373138Z settings are considered to be empty with only the second part, the user 2025-07-24T03:40:57.2373991Z list, defined. 2025-07-24T03:40:57.2374590Z  2025-07-24T03:40:57.2375215Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-24T03:40:57.2376232Z used to define any settings that are needed to determine which runners to use. 2025-07-24T03:40:57.2377227Z It's fields are defined by the RolloutSettings class below. 2025-07-24T03:40:57.2377877Z  2025-07-24T03:40:57.2378832Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-24T03:40:57.2379826Z The user list is also a comma separated list of additional features or 2025-07-24T03:40:57.2380702Z experiments which the user could be opted in to. 2025-07-24T03:40:57.2381356Z  2025-07-24T03:40:57.2381833Z The user list has the following rules: 2025-07-24T03:40:57.2382447Z  2025-07-24T03:40:57.2383055Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-24T03:40:57.2384150Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-24T03:40:57.2385019Z - A "#" prefix opts the user out of all experiments 2025-07-24T03:40:57.2385668Z  2025-07-24T03:40:57.2386155Z Example config: 2025-07-24T03:40:57.2386726Z  # A list of experiments that can be opted into. 2025-07-24T03:40:57.2387532Z  # This defines the behavior they'll induce when opted into. 2025-07-24T03:40:57.2388212Z  # Expected syntax is: 2025-07-24T03:40:57.2389049Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-24T03:40:57.2390112Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-24T03:40:57.2390891Z  2025-07-24T03:40:57.2391397Z  experiments: 2025-07-24T03:40:57.2391898Z  lf: 2025-07-24T03:40:57.2392368Z  rollout_percent: 25 2025-07-24T03:40:57.2392965Z  all_branches: false 2025-07-24T03:40:57.2393534Z  default: true 2025-07-24T03:40:57.2394363Z  --- 2025-07-24T03:40:57.2394908Z  2025-07-24T03:40:57.2395392Z  # Opt-ins: 2025-07-24T03:40:57.2396073Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-24T03:40:57.2397356Z  # and specifying experiments to enable in a comma-separated list. 2025-07-24T03:40:57.2398258Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-24T03:40:57.2399040Z  # Experiments should be from the above list. 2025-07-24T03:40:57.2399731Z  2025-07-24T03:40:57.2400204Z  @User1,-lf,split_build 2025-07-24T03:40:57.2400777Z  @User2,lf 2025-07-24T03:40:57.2401307Z  @User3,split_build 2025-07-24T03:40:57.2401875Z """ 2025-07-24T03:40:57.2402293Z  2025-07-24T03:40:57.2474997Z import json 2025-07-24T03:40:57.2475857Z import logging 2025-07-24T03:40:57.2476553Z import os 2025-07-24T03:40:57.2477215Z import random 2025-07-24T03:40:57.2477938Z import re 2025-07-24T03:40:57.2478599Z import sys 2025-07-24T03:40:57.2479434Z from argparse import ArgumentParser 2025-07-24T03:40:57.2480410Z from collections.abc import Iterable 2025-07-24T03:40:57.2480992Z from functools import cache 2025-07-24T03:40:57.2481495Z from logging import LogRecord 2025-07-24T03:40:57.2482019Z from typing import Any, NamedTuple 2025-07-24T03:40:57.2482600Z from urllib.request import Request, urlopen 2025-07-24T03:40:57.2483122Z  2025-07-24T03:40:57.2483471Z import yaml 2025-07-24T03:40:57.2484237Z from github import Auth, Github 2025-07-24T03:40:57.2484783Z from github.Issue import Issue 2025-07-24T03:40:57.2485252Z  2025-07-24T03:40:57.2485586Z  2025-07-24T03:40:57.2486002Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-24T03:40:57.2486710Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-24T03:40:57.2487576Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-24T03:40:57.2488261Z  2025-07-24T03:40:57.2488968Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-24T03:40:57.2489555Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-24T03:40:57.2490108Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-24T03:40:57.2490684Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-24T03:40:57.2491188Z  2025-07-24T03:40:57.2491571Z SETTING_EXPERIMENTS = "experiments" 2025-07-24T03:40:57.2492054Z  2025-07-24T03:40:57.2492427Z LF_FLEET_EXPERIMENT = "lf" 2025-07-24T03:40:57.2492900Z CANARY_FLEET_SUFFIX = ".c" 2025-07-24T03:40:57.2493353Z  2025-07-24T03:40:57.2493683Z  2025-07-24T03:40:57.2494265Z class Experiment(NamedTuple): 2025-07-24T03:40:57.2494770Z  rollout_perc: float = ( 2025-07-24T03:40:57.2495455Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-24T03:40:57.2496131Z  ) 2025-07-24T03:40:57.2496510Z  all_branches: bool = ( 2025-07-24T03:40:57.2497200Z  False # If True, the experiment is also enabled on the exception branches 2025-07-24T03:40:57.2497863Z  ) 2025-07-24T03:40:57.2498241Z  default: bool = ( 2025-07-24T03:40:57.2498839Z  True # If True, the experiment is enabled by default for all queries 2025-07-24T03:40:57.2499469Z  ) 2025-07-24T03:40:57.2499834Z  2025-07-24T03:40:57.2500198Z  # Add more fields as needed 2025-07-24T03:40:57.2500672Z  2025-07-24T03:40:57.2501010Z  2025-07-24T03:40:57.2501385Z class Settings(NamedTuple): 2025-07-24T03:40:57.2501847Z  """ 2025-07-24T03:40:57.2502330Z  Settings for the experiments that can be opted into. 2025-07-24T03:40:57.2502895Z  """ 2025-07-24T03:40:57.2503251Z  2025-07-24T03:40:57.2503650Z  experiments: dict[str, Experiment] = {} 2025-07-24T03:40:57.2504333Z  2025-07-24T03:40:57.2504817Z  2025-07-24T03:40:57.2505238Z class ColorFormatter(logging.Formatter): 2025-07-24T03:40:57.2505887Z  """Color codes the log messages based on the log level""" 2025-07-24T03:40:57.2506456Z  2025-07-24T03:40:57.2506799Z  COLORS = { 2025-07-24T03:40:57.2507236Z  "WARNING": "\033[33m", # Yellow 2025-07-24T03:40:57.2507753Z  "ERROR": "\033[31m", # Red 2025-07-24T03:40:57.2508260Z  "CRITICAL": "\033[31m", # Red 2025-07-24T03:40:57.2508774Z  "INFO": "\033[0m", # Reset 2025-07-24T03:40:57.2509273Z  "DEBUG": "\033[0m", # Reset 2025-07-24T03:40:57.2509744Z  } 2025-07-24T03:40:57.2510090Z  2025-07-24T03:40:57.2510502Z  def format(self, record: LogRecord) -> str: 2025-07-24T03:40:57.2511258Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-24T03:40:57.2512025Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-24T03:40:57.2512602Z  return super().format(record) 2025-07-24T03:40:57.2513105Z  2025-07-24T03:40:57.2513435Z  2025-07-24T03:40:57.2513825Z handler = logging.StreamHandler() 2025-07-24T03:40:57.2514816Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-24T03:40:57.2515519Z  2025-07-24T03:40:57.2515971Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-24T03:40:57.2516562Z log.addHandler(handler) 2025-07-24T03:40:57.2517028Z log.setLevel(logging.INFO) 2025-07-24T03:40:57.2517475Z  2025-07-24T03:40:57.2517809Z  2025-07-24T03:40:57.2518263Z def set_github_output(key: str, value: str) -> None: 2025-07-24T03:40:57.2518828Z  """ 2025-07-24T03:40:57.2519352Z  Defines outputs of the github action that invokes this script 2025-07-24T03:40:57.2520126Z  """ 2025-07-24T03:40:57.2520502Z  if not GITHUB_OUTPUT: 2025-07-24T03:40:57.2521560Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-24T03:40:57.2522623Z  log.warning( 2025-07-24T03:40:57.2523475Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-24T03:40:57.2524742Z  ) 2025-07-24T03:40:57.2525197Z  print(f"::set-output name={key}::{value}") 2025-07-24T03:40:57.2525739Z  return 2025-07-24T03:40:57.2526127Z  2025-07-24T03:40:57.2526508Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-24T03:40:57.2527084Z  log.info(f"Setting output: {key}='{value}'") 2025-07-24T03:40:57.2527644Z  f.write(f"{key}={value}\n") 2025-07-24T03:40:57.2528128Z  2025-07-24T03:40:57.2528473Z  2025-07-24T03:40:57.2528972Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-24T03:40:57.2529616Z  return frozenset( 2025-07-24T03:40:57.2530252Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-24T03:40:57.2530915Z  ) 2025-07-24T03:40:57.2531275Z  2025-07-24T03:40:57.2531616Z  2025-07-24T03:40:57.2531973Z def parse_args() -> Any: 2025-07-24T03:40:57.2532569Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-24T03:40:57.2533418Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-24T03:40:57.2534336Z  parser.add_argument( 2025-07-24T03:40:57.2534823Z  "--github-issue-repo", 2025-07-24T03:40:57.2535306Z  type=str, 2025-07-24T03:40:57.2535742Z  required=False, 2025-07-24T03:40:57.2536346Z  default="pytorch/test-infra", 2025-07-24T03:40:57.2536913Z  help="GitHub repo to get the issue", 2025-07-24T03:40:57.2537413Z  ) 2025-07-24T03:40:57.2537796Z  parser.add_argument( 2025-07-24T03:40:57.2538259Z  "--github-repo", 2025-07-24T03:40:57.2538705Z  type=str, 2025-07-24T03:40:57.2539131Z  required=True, 2025-07-24T03:40:57.2539624Z  help="GitHub repo where CI is running", 2025-07-24T03:40:57.2540141Z  ) 2025-07-24T03:40:57.2540518Z  parser.add_argument( 2025-07-24T03:40:57.2541175Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-24T03:40:57.2541811Z  ) 2025-07-24T03:40:57.2542192Z  parser.add_argument( 2025-07-24T03:40:57.2542844Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-24T03:40:57.2543516Z  ) 2025-07-24T03:40:57.2544064Z  parser.add_argument( 2025-07-24T03:40:57.2544749Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-24T03:40:57.2545425Z  ) 2025-07-24T03:40:57.2545800Z  parser.add_argument( 2025-07-24T03:40:57.2546478Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-24T03:40:57.2547167Z  ) 2025-07-24T03:40:57.2547538Z  parser.add_argument( 2025-07-24T03:40:57.2548012Z  "--github-ref-type", 2025-07-24T03:40:57.2548481Z  type=str, 2025-07-24T03:40:57.2548905Z  required=True, 2025-07-24T03:40:57.2549437Z  help="Current GitHub ref type, branch or tag", 2025-07-24T03:40:57.2549989Z  ) 2025-07-24T03:40:57.2550376Z  parser.add_argument( 2025-07-24T03:40:57.2550999Z  "--eligible-experiments", 2025-07-24T03:40:57.2551536Z  type=_str_comma_separated_to_set, 2025-07-24T03:40:57.2552055Z  required=False, 2025-07-24T03:40:57.2552505Z  default="", 2025-07-24T03:40:57.2553368Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-24T03:40:57.2554486Z  ) 2025-07-24T03:40:57.2554864Z  parser.add_argument( 2025-07-24T03:40:57.2555348Z  "--opt-out-experiments", 2025-07-24T03:40:57.2555884Z  type=_str_comma_separated_to_set, 2025-07-24T03:40:57.2556415Z  required=False, 2025-07-24T03:40:57.2556874Z  default="", 2025-07-24T03:40:57.2557298Z  help=( 2025-07-24T03:40:57.2557982Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-24T03:40:57.2559078Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-24T03:40:57.2559878Z  ), 2025-07-24T03:40:57.2560248Z  ) 2025-07-24T03:40:57.2560620Z  parser.add_argument( 2025-07-24T03:40:57.2561076Z  "--pr-number", 2025-07-24T03:40:57.2561515Z  type=str, 2025-07-24T03:40:57.2561948Z  required=False, 2025-07-24T03:40:57.2562393Z  default="", 2025-07-24T03:40:57.2562912Z  help="the optional PR number where this is run", 2025-07-24T03:40:57.2563463Z  ) 2025-07-24T03:40:57.2563813Z  2025-07-24T03:40:57.2564749Z  return parser.parse_args() 2025-07-24T03:40:57.2565242Z  2025-07-24T03:40:57.2565609Z  2025-07-24T03:40:57.2566204Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-24T03:40:57.2567098Z  auth = Auth.Token(github_token) 2025-07-24T03:40:57.2567626Z  return Github(auth=auth) 2025-07-24T03:40:57.2568089Z  2025-07-24T03:40:57.2568418Z  2025-07-24T03:40:57.2569062Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-24T03:40:57.2569840Z  repo = gh.get_repo(repo) 2025-07-24T03:40:57.2570366Z  return repo.get_issue(number=issue_num) 2025-07-24T03:40:57.2570867Z  2025-07-24T03:40:57.2571200Z  2025-07-24T03:40:57.2571556Z def get_potential_pr_author( 2025-07-24T03:40:57.2572221Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-24T03:40:57.2572883Z ) -> str: 2025-07-24T03:40:57.2573415Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-24T03:40:57.2574326Z  # Fetch the actual username from the original PR. The PR number is 2025-07-24T03:40:57.2575067Z  # embedded in the tag name: ciflow// 2025-07-24T03:40:57.2575624Z  2025-07-24T03:40:57.2576002Z  gh = get_gh_client(github_token) 2025-07-24T03:40:57.2576478Z  2025-07-24T03:40:57.2576943Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-24T03:40:57.2577569Z  split_tag = ref_name.split("/") 2025-07-24T03:40:57.2578062Z  if ( 2025-07-24T03:40:57.2578467Z  len(split_tag) == 3 2025-07-24T03:40:57.2578973Z  and split_tag[0] == "ciflow" 2025-07-24T03:40:57.2579530Z  and split_tag[2].isnumeric() 2025-07-24T03:40:57.2580021Z  ): 2025-07-24T03:40:57.2580435Z  pr_number = split_tag[2] 2025-07-24T03:40:57.2580926Z  try: 2025-07-24T03:40:57.2581385Z  repository = gh.get_repo(repo) 2025-07-24T03:40:57.2582134Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-24T03:40:57.2582749Z  except Exception as e: 2025-07-24T03:40:57.2583281Z  raise Exception( # noqa: TRY002 2025-07-24T03:40:57.2584043Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-24T03:40:57.2584681Z  ) from e 2025-07-24T03:40:57.2585246Z  return pull.user.login # type: ignore[no-any-return] 2025-07-24T03:40:57.2585946Z  # In all other cases, return the original input username 2025-07-24T03:40:57.2586525Z  return username 2025-07-24T03:40:57.2586945Z  2025-07-24T03:40:57.2587274Z  2025-07-24T03:40:57.2587695Z def is_exception_branch(branch: str) -> bool: 2025-07-24T03:40:57.2588222Z  """ 2025-07-24T03:40:57.2588870Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-24T03:40:57.2589625Z  """ 2025-07-24T03:40:57.2590180Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-24T03:40:57.2590829Z  2025-07-24T03:40:57.2591165Z  2025-07-24T03:40:57.2591553Z def load_yaml(yaml_text: str) -> Any: 2025-07-24T03:40:57.2592047Z  try: 2025-07-24T03:40:57.2592446Z  data = yaml.safe_load(yaml_text) 2025-07-24T03:40:57.2592953Z  return data 2025-07-24T03:40:57.2593392Z  except yaml.YAMLError: 2025-07-24T03:40:57.2594002Z  log.exception("Error loading YAML") 2025-07-24T03:40:57.2594510Z  raise 2025-07-24T03:40:57.2594894Z  2025-07-24T03:40:57.2595217Z  2025-07-24T03:40:57.2595807Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-24T03:40:57.2596521Z  """ 2025-07-24T03:40:57.2597293Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-24T03:40:57.2598027Z  2025-07-24T03:40:57.2598555Z  If the issue body contains "---" then the text above that is the settings 2025-07-24T03:40:57.2599304Z  and the text below is the list of opted in users. 2025-07-24T03:40:57.2599837Z  2025-07-24T03:40:57.2600399Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-24T03:40:57.2601069Z  """ 2025-07-24T03:40:57.2601528Z  rollout_state_parts = rollout_state.split("---") 2025-07-24T03:40:57.2602121Z  if len(rollout_state_parts) >= 2: 2025-07-24T03:40:57.2602731Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-24T03:40:57.2603400Z  else: 2025-07-24T03:40:57.2604055Z  return "", rollout_state 2025-07-24T03:40:57.2604536Z  2025-07-24T03:40:57.2604860Z  2025-07-24T03:40:57.2605258Z class UserOptins(dict[str, list[str]]): 2025-07-24T03:40:57.2605758Z  """ 2025-07-24T03:40:57.2606284Z  Dictionary of users with a list of features they have opted into 2025-07-24T03:40:57.2606906Z  """ 2025-07-24T03:40:57.2607249Z  2025-07-24T03:40:57.2607575Z  2025-07-24T03:40:57.2608082Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-24T03:40:57.2608714Z  """ 2025-07-24T03:40:57.2609425Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-24T03:40:57.2610215Z  2025-07-24T03:40:57.2610988Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-24T03:40:57.2611933Z  - Example line: "@User1,lf,split_build" 2025-07-24T03:40:57.2612737Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-24T03:40:57.2613343Z  2025-07-24T03:40:57.2613661Z  2025-07-24T03:40:57.2614083Z  """ 2025-07-24T03:40:57.2614460Z  optins = UserOptins() 2025-07-24T03:40:57.2614968Z  for user in user_optin_text.split("\n"): 2025-07-24T03:40:57.2615516Z  user = user.strip("\r\n\t -") 2025-07-24T03:40:57.2616075Z  if not user or not user.startswith("@"): 2025-07-24T03:40:57.2616614Z  # Not a valid user. Skip 2025-07-24T03:40:57.2617110Z  continue 2025-07-24T03:40:57.2617521Z  2025-07-24T03:40:57.2617887Z  if user: 2025-07-24T03:40:57.2618357Z  usr_name = user.split(",")[0].strip("@") 2025-07-24T03:40:57.2619046Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-24T03:40:57.2619664Z  2025-07-24T03:40:57.2620014Z  return optins 2025-07-24T03:40:57.2620425Z  2025-07-24T03:40:57.2620737Z  2025-07-24T03:40:57.2621218Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-24T03:40:57.2621811Z  """ 2025-07-24T03:40:57.2622225Z  Check if the experiment name is valid. 2025-07-24T03:40:57.2622731Z  A valid name: 2025-07-24T03:40:57.2623390Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-24T03:40:57.2624393Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-24T03:40:57.2625075Z  - Cannot contain spaces 2025-07-24T03:40:57.2625537Z  """ 2025-07-24T03:40:57.2625887Z  2025-07-24T03:40:57.2626326Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-24T03:40:57.2627016Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-24T03:40:57.2627712Z  2025-07-24T03:40:57.2628060Z  if valid: 2025-07-24T03:40:57.2628455Z  return True 2025-07-24T03:40:57.2628861Z  2025-07-24T03:40:57.2629195Z  log.error( 2025-07-24T03:40:57.2630590Z  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-07-24T03:40:57.2632024Z  ) 2025-07-24T03:40:57.2632384Z  return False 2025-07-24T03:40:57.2632786Z  2025-07-24T03:40:57.2633104Z  2025-07-24T03:40:57.2633609Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-24T03:40:57.2634325Z  """ 2025-07-24T03:40:57.2634919Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-24T03:40:57.2635610Z  """ 2025-07-24T03:40:57.2635964Z  try: 2025-07-24T03:40:57.2636342Z  if settings_text: 2025-07-24T03:40:57.2637071Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-24T03:40:57.2637828Z  # for easy reading 2025-07-24T03:40:57.2638648Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-24T03:40:57.2639499Z  # the backtick character in shell commands. 2025-07-24T03:40:57.2640103Z  backtick = chr(96) # backtick character 2025-07-24T03:40:57.2640760Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-24T03:40:57.2641413Z  settings = load_yaml(settings_text) 2025-07-24T03:40:57.2641912Z  2025-07-24T03:40:57.2642492Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-24T03:40:57.2643335Z  experiments = {} 2025-07-24T03:40:57.2643786Z  2025-07-24T03:40:57.2644431Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-24T03:40:57.2645161Z  if not is_valid_experiment_name(exp_name): 2025-07-24T03:40:57.2646210Z  # 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-07-24T03:40:57.2647189Z  continue 2025-07-24T03:40:57.2647621Z  2025-07-24T03:40:57.2647982Z  valid_settings = {} 2025-07-24T03:40:57.2648499Z  for setting in exp_settings: 2025-07-24T03:40:57.2649062Z  if setting not in Experiment._fields: 2025-07-24T03:40:57.2649618Z  log.warning( 2025-07-24T03:40:57.2650316Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-24T03:40:57.2650997Z  ) 2025-07-24T03:40:57.2651429Z  else: 2025-07-24T03:40:57.2651963Z  valid_settings[setting] = exp_settings[setting] 2025-07-24T03:40:57.2652503Z  2025-07-24T03:40:57.2652962Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-24T03:40:57.2653588Z  return Settings(experiments) 2025-07-24T03:40:57.2654161Z  2025-07-24T03:40:57.2654514Z  except Exception: 2025-07-24T03:40:57.2655018Z  log.exception("Failed to parse settings") 2025-07-24T03:40:57.2655534Z  2025-07-24T03:40:57.2655869Z  return Settings() 2025-07-24T03:40:57.2656287Z  2025-07-24T03:40:57.2656607Z  2025-07-24T03:40:57.2657212Z def parse_settings(rollout_state: str) -> Settings: 2025-07-24T03:40:57.2657774Z  """ 2025-07-24T03:40:57.2658223Z  Parse settings, if any, from the rollout state. 2025-07-24T03:40:57.2658755Z  2025-07-24T03:40:57.2659271Z  If the issue body contains "---" then the text above that is the settings 2025-07-24T03:40:57.2660014Z  and the text below is the list of opted in users. 2025-07-24T03:40:57.2660543Z  2025-07-24T03:40:57.2661118Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-24T03:40:57.2661812Z  """ 2025-07-24T03:40:57.2662367Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-24T03:40:57.2663100Z  return parse_settings_from_text(settings_text) 2025-07-24T03:40:57.2663618Z  2025-07-24T03:40:57.2664038Z  2025-07-24T03:40:57.2664489Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-24T03:40:57.2665033Z  """ 2025-07-24T03:40:57.2665429Z  Parse users from the rollout state. 2025-07-24T03:40:57.2665950Z  2025-07-24T03:40:57.2666276Z  """ 2025-07-24T03:40:57.2666809Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-24T03:40:57.2667536Z  return parse_user_opt_in_from_text(users_text) 2025-07-24T03:40:57.2668204Z  2025-07-24T03:40:57.2668587Z  2025-07-24T03:40:57.2669187Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-24T03:40:57.2669913Z  """ 2025-07-24T03:40:57.2670351Z  Check if a user is opted into an experiment 2025-07-24T03:40:57.2670864Z  """ 2025-07-24T03:40:57.2671336Z  return experiment_name in user_optins.get(user, []) 2025-07-24T03:40:57.2672030Z  2025-07-24T03:40:57.2672354Z  2025-07-24T03:40:57.2672956Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-24T03:40:57.2673674Z  """ 2025-07-24T03:40:57.2674263Z  Check if a user explicitly opted out of an experiment 2025-07-24T03:40:57.2674823Z  """ 2025-07-24T03:40:57.2675340Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-24T03:40:57.2676019Z  experiment_optout = "-" + experiment_name 2025-07-24T03:40:57.2676650Z  if experiment_optout not in user_optins.get(user, []): 2025-07-24T03:40:57.2677227Z  return False 2025-07-24T03:40:57.2677645Z  2025-07-24T03:40:57.2678095Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-24T03:40:57.2678672Z  log.warning( 2025-07-24T03:40:57.2679491Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-24T03:40:57.2680327Z  ) 2025-07-24T03:40:57.2680692Z  2025-07-24T03:40:57.2681025Z  return True 2025-07-24T03:40:57.2681421Z  2025-07-24T03:40:57.2681739Z  2025-07-24T03:40:57.2682091Z def get_runner_prefix( 2025-07-24T03:40:57.2682543Z  rollout_state: str, 2025-07-24T03:40:57.2683021Z  workflow_requestors: Iterable[str], 2025-07-24T03:40:57.2683525Z  branch: str, 2025-07-24T03:40:57.2684134Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-24T03:40:57.2684802Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-24T03:40:57.2685376Z  is_canary: bool = False, 2025-07-24T03:40:57.2685832Z ) -> str: 2025-07-24T03:40:57.2686270Z  settings = parse_settings(rollout_state) 2025-07-24T03:40:57.2686847Z  user_optins = parse_users(rollout_state) 2025-07-24T03:40:57.2687353Z  2025-07-24T03:40:57.2687818Z  fleet_prefix = "" 2025-07-24T03:40:57.2688267Z  prefixes = [] 2025-07-24T03:40:57.2688908Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-24T03:40:57.2689823Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-24T03:40:57.2690499Z  log.info( 2025-07-24T03:40:57.2691183Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-24T03:40:57.2691900Z  ) 2025-07-24T03:40:57.2692296Z  continue 2025-07-24T03:40:57.2692702Z  2025-07-24T03:40:57.2693054Z  if opt_out_experiments: 2025-07-24T03:40:57.2693602Z  if experiment_name in opt_out_experiments: 2025-07-24T03:40:57.2694334Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-24T03:40:57.2694907Z  log.info( 2025-07-24T03:40:57.2695820Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-24T03:40:57.2696731Z  ) 2025-07-24T03:40:57.2697179Z  continue 2025-07-24T03:40:57.2697606Z  2025-07-24T03:40:57.2697968Z  if eligible_experiments: 2025-07-24T03:40:57.2698527Z  if experiment_name not in eligible_experiments: 2025-07-24T03:40:57.2699145Z  exp_list = ", ".join(eligible_experiments) 2025-07-24T03:40:57.2699682Z  log.info( 2025-07-24T03:40:57.2700458Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-24T03:40:57.2701241Z  ) 2025-07-24T03:40:57.2701770Z  continue 2025-07-24T03:40:57.2702265Z  elif not experiment_settings.default: 2025-07-24T03:40:57.2702779Z  log.info( 2025-07-24T03:40:57.2703435Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-24T03:40:57.2704232Z  ) 2025-07-24T03:40:57.2704614Z  continue 2025-07-24T03:40:57.2705024Z  2025-07-24T03:40:57.2705482Z  # Is any workflow_requestor opted out to this experiment? 2025-07-24T03:40:57.2706081Z  opted_out_users = [ 2025-07-24T03:40:57.2706543Z  requestor 2025-07-24T03:40:57.2707022Z  for requestor in workflow_requestors 2025-07-24T03:40:57.2707682Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-24T03:40:57.2708283Z  ] 2025-07-24T03:40:57.2708638Z  2025-07-24T03:40:57.2708988Z  if opted_out_users: 2025-07-24T03:40:57.2709464Z  log.info( 2025-07-24T03:40:57.2710090Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-24T03:40:57.2710750Z  ) 2025-07-24T03:40:57.2711135Z  continue 2025-07-24T03:40:57.2711533Z  2025-07-24T03:40:57.2711985Z  # Is any workflow_requestor opted in to this experiment? 2025-07-24T03:40:57.2712566Z  opted_in_users = [ 2025-07-24T03:40:57.2713027Z  requestor 2025-07-24T03:40:57.2713504Z  for requestor in workflow_requestors 2025-07-24T03:40:57.2714257Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-24T03:40:57.2714854Z  ] 2025-07-24T03:40:57.2715208Z  2025-07-24T03:40:57.2715560Z  enabled = False 2025-07-24T03:40:57.2716004Z  if opted_in_users: 2025-07-24T03:40:57.2716575Z  log.info( 2025-07-24T03:40:57.2717207Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-24T03:40:57.2717865Z  ) 2025-07-24T03:40:57.2718270Z  enabled = True 2025-07-24T03:40:57.2718700Z  2025-07-24T03:40:57.2719107Z  elif experiment_settings.rollout_perc: 2025-07-24T03:40:57.2719912Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-24T03:40:57.2720811Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-24T03:40:57.2721425Z  log.info( 2025-07-24T03:40:57.2722273Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-24T03:40:57.2723137Z  ) 2025-07-24T03:40:57.2723573Z  enabled = True 2025-07-24T03:40:57.2724127Z  2025-07-24T03:40:57.2724463Z  if enabled: 2025-07-24T03:40:57.2724920Z  label = experiment_name 2025-07-24T03:40:57.2725462Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-24T03:40:57.2726261Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-24T03:40:57.2727107Z  # - If it's enabled, then we always list it's prefix first 2025-07-24T03:40:57.2727845Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-24T03:40:57.2728475Z  if is_canary: 2025-07-24T03:40:57.2729053Z  label += CANARY_FLEET_SUFFIX 2025-07-24T03:40:57.2729721Z  fleet_prefix = label 2025-07-24T03:40:57.2730205Z  else: 2025-07-24T03:40:57.2730808Z  prefixes.append(label) 2025-07-24T03:40:57.2731290Z  2025-07-24T03:40:57.2731635Z  if len(prefixes) > 1: 2025-07-24T03:40:57.2732088Z  log.error( 2025-07-24T03:40:57.2733086Z  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-07-24T03:40:57.2734228Z  ) 2025-07-24T03:40:57.2734623Z  prefixes = prefixes[:1] 2025-07-24T03:40:57.2735079Z  2025-07-24T03:40:57.2735433Z  # Fleet always comes first 2025-07-24T03:40:57.2735900Z  if fleet_prefix: 2025-07-24T03:40:57.2736366Z  prefixes.insert(0, fleet_prefix) 2025-07-24T03:40:57.2736846Z  2025-07-24T03:40:57.2737277Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-24T03:40:57.2737824Z  2025-07-24T03:40:57.2738152Z  2025-07-24T03:40:57.2738767Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-24T03:40:57.2739490Z  """ 2025-07-24T03:40:57.2740302Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-24T03:40:57.2740982Z  2025-07-24T03:40:57.2741537Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-24T03:40:57.2742205Z  """ 2025-07-24T03:40:57.2742766Z  gh = get_gh_client(github_token) 2025-07-24T03:40:57.2743318Z  issue = get_issue(gh, repo, issue_num) 2025-07-24T03:40:57.2744046Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-24T03:40:57.2744747Z  2025-07-24T03:40:57.2745072Z  2025-07-24T03:40:57.2745651Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-24T03:40:57.2746534Z  for _ in range(num_retries): 2025-07-24T03:40:57.2747088Z  try: 2025-07-24T03:40:57.2747530Z  req = Request(url=url, headers=headers) 2025-07-24T03:40:57.2748166Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-24T03:40:57.2748794Z  return json.loads(content) 2025-07-24T03:40:57.2749307Z  except Exception as e: 2025-07-24T03:40:57.2749860Z  log.warning(f"Could not download {url}: {e}") 2025-07-24T03:40:57.2750389Z  2025-07-24T03:40:57.2750953Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-24T03:40:57.2751641Z  return {} 2025-07-24T03:40:57.2752024Z  2025-07-24T03:40:57.2752353Z  2025-07-24T03:40:57.2752680Z @cache 2025-07-24T03:40:57.2753308Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-24T03:40:57.2754168Z  """ 2025-07-24T03:40:57.2754575Z  Dynamically get PR information 2025-07-24T03:40:57.2755071Z  """ 2025-07-24T03:40:57.2755583Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-24T03:40:57.2756201Z  headers = { 2025-07-24T03:40:57.2756689Z  "Accept": "application/vnd.github.v3+json", 2025-07-24T03:40:57.2757293Z  "Authorization": f"token {github_token}", 2025-07-24T03:40:57.2757804Z  } 2025-07-24T03:40:57.2758247Z  json_response: dict[str, Any] = download_json( 2025-07-24T03:40:57.2758847Z  url=f"{github_api}/issues/{pr_number}", 2025-07-24T03:40:57.2759368Z  headers=headers, 2025-07-24T03:40:57.2759808Z  ) 2025-07-24T03:40:57.2760155Z  2025-07-24T03:40:57.2760515Z  if not json_response: 2025-07-24T03:40:57.2761101Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-24T03:40:57.2761849Z  return {} 2025-07-24T03:40:57.2762297Z  2025-07-24T03:40:57.2762694Z  return json_response 2025-07-24T03:40:57.2763280Z  2025-07-24T03:40:57.2763610Z  2025-07-24T03:40:57.2764305Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-24T03:40:57.2765006Z  """ 2025-07-24T03:40:57.2765540Z  Dynamically get the latest list of labels from the pull request 2025-07-24T03:40:57.2766204Z  """ 2025-07-24T03:40:57.2766698Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-24T03:40:57.2767292Z  return { 2025-07-24T03:40:57.2767879Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-24T03:40:57.2768541Z  } 2025-07-24T03:40:57.2768904Z  2025-07-24T03:40:57.2769244Z  2025-07-24T03:40:57.2769601Z def main() -> None: 2025-07-24T03:40:57.2770043Z  args = parse_args() 2025-07-24T03:40:57.2770487Z  2025-07-24T03:40:57.2770899Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-24T03:40:57.2771418Z  2025-07-24T03:40:57.2771774Z  # Check if the PR is opt-out 2025-07-24T03:40:57.2772268Z  if args.pr_number: 2025-07-24T03:40:57.2772936Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-24T03:40:57.2773656Z  if OPT_OUT_LABEL in labels: 2025-07-24T03:40:57.2774248Z  log.info( 2025-07-24T03:40:57.2774961Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-24T03:40:57.2775688Z  ) 2025-07-24T03:40:57.2776259Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-24T03:40:57.2776920Z  sys.exit() 2025-07-24T03:40:57.2777484Z  2025-07-24T03:40:57.2777831Z  try: 2025-07-24T03:40:57.2778292Z  rollout_state = get_rollout_state_from_issue( 2025-07-24T03:40:57.2778993Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-24T03:40:57.2779614Z  ) 2025-07-24T03:40:57.2779971Z  2025-07-24T03:40:57.2780371Z  username = get_potential_pr_author( 2025-07-24T03:40:57.2780898Z  args.github_token, 2025-07-24T03:40:57.2781385Z  args.github_repo, 2025-07-24T03:40:57.2781870Z  args.github_actor, 2025-07-24T03:40:57.2782364Z  args.github_ref_type, 2025-07-24T03:40:57.2782864Z  args.github_branch, 2025-07-24T03:40:57.2783323Z  ) 2025-07-24T03:40:57.2783686Z  2025-07-24T03:40:57.2784461Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-24T03:40:57.2785097Z  2025-07-24T03:40:57.2785509Z  runner_label_prefix = get_runner_prefix( 2025-07-24T03:40:57.2786045Z  rollout_state, 2025-07-24T03:40:57.2786562Z  (args.github_issue_owner, username), 2025-07-24T03:40:57.2787094Z  args.github_branch, 2025-07-24T03:40:57.2787640Z  args.eligible_experiments, 2025-07-24T03:40:57.2788174Z  args.opt_out_experiments, 2025-07-24T03:40:57.2788676Z  is_canary, 2025-07-24T03:40:57.2789107Z  ) 2025-07-24T03:40:57.2789474Z  2025-07-24T03:40:57.2789838Z  except Exception as e: 2025-07-24T03:40:57.2790306Z  log.error( 2025-07-24T03:40:57.2790999Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-24T03:40:57.2791857Z  ) 2025-07-24T03:40:57.2792238Z  2025-07-24T03:40:57.2792756Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-24T03:40:57.2793389Z  2025-07-24T03:40:57.2793720Z  2025-07-24T03:40:57.2794192Z if __name__ == "__main__": 2025-07-24T03:40:57.2794646Z  main() 2025-07-24T03:40:57.2795023Z  2025-07-24T03:40:57.2795355Z EOF 2025-07-24T03:40:57.2795702Z  2025-07-24T03:40:57.2796060Z cat runner_determinator.py 2025-07-24T03:40:57.3029907Z shell: /usr/bin/bash -e {0} 2025-07-24T03:40:57.3030670Z env: 2025-07-24T03:40:57.3031318Z GITHUB_TOKEN: *** 2025-07-24T03:40:57.3031717Z ISSUE_NUMBER: 5132 2025-07-24T03:40:57.3032138Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-07-24T03:40:57.3032601Z ISSUE_OWNER: 2025-07-24T03:40:57.3032979Z CHECK_EXPERIMENTS: 2025-07-24T03:40:57.3033378Z OPT_OUT_EXPERIMENTS: lf 2025-07-24T03:40:57.3033786Z PR_NUMBER: 2025-07-24T03:40:57.3034325Z ##[endgroup] 2025-07-24T03:40:57.3228475Z # flake8: noqa: G004 2025-07-24T03:40:57.3228788Z 2025-07-24T03:40:57.3229184Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-24T03:40:57.3230058Z # must be kept in sync. You can do it easily by running the following command: 2025-07-24T03:40:57.3230804Z # python .github/scripts/update_runner_determinator.py 2025-07-24T03:40:57.3231216Z 2025-07-24T03:40:57.3231366Z """ 2025-07-24T03:40:57.3231893Z This runner determinator is used to determine which set of runners to run a 2025-07-24T03:40:57.3232695Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-24T03:40:57.3233517Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-24T03:40:57.3234560Z of which runners should be used to run which job. 2025-07-24T03:40:57.3234928Z 2025-07-24T03:40:57.3235281Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-24T03:40:57.3236279Z separated by a line containing "---". If the line is not present, the 2025-07-24T03:40:57.3237099Z settings are considered to be empty with only the second part, the user 2025-07-24T03:40:57.3237725Z list, defined. 2025-07-24T03:40:57.3237938Z 2025-07-24T03:40:57.3238268Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-24T03:40:57.3239089Z used to define any settings that are needed to determine which runners to use. 2025-07-24T03:40:57.3239841Z It's fields are defined by the RolloutSettings class below. 2025-07-24T03:40:57.3240240Z 2025-07-24T03:40:57.3240580Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-24T03:40:57.3241374Z The user list is also a comma separated list of additional features or 2025-07-24T03:40:57.3242280Z experiments which the user could be opted in to. 2025-07-24T03:40:57.3242648Z 2025-07-24T03:40:57.3242958Z The user list has the following rules: 2025-07-24T03:40:57.3243290Z 2025-07-24T03:40:57.3243691Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-24T03:40:57.3244731Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-24T03:40:57.3245428Z - A "#" prefix opts the user out of all experiments 2025-07-24T03:40:57.3245780Z 2025-07-24T03:40:57.3245939Z Example config: 2025-07-24T03:40:57.3246347Z # A list of experiments that can be opted into. 2025-07-24T03:40:57.3246965Z # This defines the behavior they'll induce when opted into. 2025-07-24T03:40:57.3247524Z # Expected syntax is: 2025-07-24T03:40:57.3248100Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-24T03:40:57.3248997Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-24T03:40:57.3249560Z 2025-07-24T03:40:57.3249711Z experiments: 2025-07-24T03:40:57.3250071Z lf: 2025-07-24T03:40:57.3250408Z rollout_percent: 25 2025-07-24T03:40:57.3250994Z all_branches: false 2025-07-24T03:40:57.3251450Z default: true 2025-07-24T03:40:57.3251825Z --- 2025-07-24T03:40:57.3252011Z 2025-07-24T03:40:57.3252161Z # Opt-ins: 2025-07-24T03:40:57.3252690Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-24T03:40:57.3253468Z # and specifying experiments to enable in a comma-separated list. 2025-07-24T03:40:57.3254667Z # To always opt out of an experiment, prefix it with a "-". 2025-07-24T03:40:57.3255264Z # Experiments should be from the above list. 2025-07-24T03:40:57.3255612Z 2025-07-24T03:40:57.3255776Z @User1,-lf,split_build 2025-07-24T03:40:57.3256169Z @User2,lf 2025-07-24T03:40:57.3256510Z @User3,split_build 2025-07-24T03:40:57.3256879Z """ 2025-07-24T03:40:57.3257053Z 2025-07-24T03:40:57.3257198Z import json 2025-07-24T03:40:57.3257534Z import logging 2025-07-24T03:40:57.3257873Z import os 2025-07-24T03:40:57.3258205Z import random 2025-07-24T03:40:57.3258548Z import re 2025-07-24T03:40:57.3258869Z import sys 2025-07-24T03:40:57.3259229Z from argparse import ArgumentParser 2025-07-24T03:40:57.3259706Z from collections.abc import Iterable 2025-07-24T03:40:57.3260182Z from functools import cache 2025-07-24T03:40:57.3260600Z from logging import LogRecord 2025-07-24T03:40:57.3261042Z from typing import Any, NamedTuple 2025-07-24T03:40:57.3261520Z from urllib.request import Request, urlopen 2025-07-24T03:40:57.3261860Z 2025-07-24T03:40:57.3262004Z import yaml 2025-07-24T03:40:57.3262348Z from github import Auth, Github 2025-07-24T03:40:57.3262787Z from github.Issue import Issue 2025-07-24T03:40:57.3263060Z 2025-07-24T03:40:57.3263066Z 2025-07-24T03:40:57.3263265Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-24T03:40:57.3264194Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-24T03:40:57.3265023Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-24T03:40:57.3265531Z 2025-07-24T03:40:57.3265746Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-24T03:40:57.3266408Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-24T03:40:57.3266875Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-24T03:40:57.3267388Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-24T03:40:57.3267707Z 2025-07-24T03:40:57.3267887Z SETTING_EXPERIMENTS = "experiments" 2025-07-24T03:40:57.3268189Z 2025-07-24T03:40:57.3268360Z LF_FLEET_EXPERIMENT = "lf" 2025-07-24T03:40:57.3268789Z CANARY_FLEET_SUFFIX = ".c" 2025-07-24T03:40:57.3269044Z 2025-07-24T03:40:57.3269050Z 2025-07-24T03:40:57.3269214Z class Experiment(NamedTuple): 2025-07-24T03:40:57.3269651Z rollout_perc: float = ( 2025-07-24T03:40:57.3270223Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-24T03:40:57.3270839Z ) 2025-07-24T03:40:57.3271174Z all_branches: bool = ( 2025-07-24T03:40:57.3271732Z False # If True, the experiment is also enabled on the exception branches 2025-07-24T03:40:57.3272346Z ) 2025-07-24T03:40:57.3272671Z default: bool = ( 2025-07-24T03:40:57.3273190Z True # If True, the experiment is enabled by default for all queries 2025-07-24T03:40:57.3273769Z ) 2025-07-24T03:40:57.3274126Z 2025-07-24T03:40:57.3274302Z # Add more fields as needed 2025-07-24T03:40:57.3274578Z 2025-07-24T03:40:57.3274584Z 2025-07-24T03:40:57.3274760Z class Settings(NamedTuple): 2025-07-24T03:40:57.3275156Z """ 2025-07-24T03:40:57.3275572Z Settings for the experiments that can be opted into. 2025-07-24T03:40:57.3276090Z """ 2025-07-24T03:40:57.3276270Z 2025-07-24T03:40:57.3276466Z experiments: dict[str, Experiment] = {} 2025-07-24T03:40:57.3276795Z 2025-07-24T03:40:57.3276802Z 2025-07-24T03:40:57.3276995Z class ColorFormatter(logging.Formatter): 2025-07-24T03:40:57.3277572Z """Color codes the log messages based on the log level""" 2025-07-24T03:40:57.3277970Z 2025-07-24T03:40:57.3278119Z COLORS = { 2025-07-24T03:40:57.3278476Z "WARNING": "\033[33m", # Yellow 2025-07-24T03:40:57.3279086Z "ERROR": "\033[31m", # Red 2025-07-24T03:40:57.3279549Z "CRITICAL": "\033[31m", # Red 2025-07-24T03:40:57.3280004Z "INFO": "\033[0m", # Reset 2025-07-24T03:40:57.3280433Z "DEBUG": "\033[0m", # Reset 2025-07-24T03:40:57.3280856Z } 2025-07-24T03:40:57.3281033Z 2025-07-24T03:40:57.3281230Z def format(self, record: LogRecord) -> str: 2025-07-24T03:40:57.3281915Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-24T03:40:57.3282620Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-24T03:40:57.3283139Z return super().format(record) 2025-07-24T03:40:57.3283440Z 2025-07-24T03:40:57.3283447Z 2025-07-24T03:40:57.3283626Z handler = logging.StreamHandler() 2025-07-24T03:40:57.3284479Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-24T03:40:57.3284995Z 2025-07-24T03:40:57.3285215Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-24T03:40:57.3285741Z log.addHandler(handler) 2025-07-24T03:40:57.3286150Z log.setLevel(logging.INFO) 2025-07-24T03:40:57.3286416Z 2025-07-24T03:40:57.3286422Z 2025-07-24T03:40:57.3286650Z def set_github_output(key: str, value: str) -> None: 2025-07-24T03:40:57.3287161Z """ 2025-07-24T03:40:57.3287618Z Defines outputs of the github action that invokes this script 2025-07-24T03:40:57.3288178Z """ 2025-07-24T03:40:57.3288502Z if not GITHUB_OUTPUT: 2025-07-24T03:40:57.3289471Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-24T03:40:57.3290491Z log.warning( 2025-07-24T03:40:57.3291263Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-24T03:40:57.3292097Z ) 2025-07-24T03:40:57.3301809Z print(f"::set-output name={key}::{value}") 2025-07-24T03:40:57.3302363Z return 2025-07-24T03:40:57.3302593Z 2025-07-24T03:40:57.3302976Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-24T03:40:57.3303518Z log.info(f"Setting output: {key}='{value}'") 2025-07-24T03:40:57.3304311Z f.write(f"{key}={value}\n") 2025-07-24T03:40:57.3304617Z 2025-07-24T03:40:57.3304624Z 2025-07-24T03:40:57.3304909Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-24T03:40:57.3305487Z return frozenset( 2025-07-24T03:40:57.3306052Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-24T03:40:57.3306675Z ) 2025-07-24T03:40:57.3306857Z 2025-07-24T03:40:57.3306864Z 2025-07-24T03:40:57.3307025Z def parse_args() -> Any: 2025-07-24T03:40:57.3307532Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-24T03:40:57.3308327Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-24T03:40:57.3309037Z parser.add_argument( 2025-07-24T03:40:57.3309447Z "--github-issue-repo", 2025-07-24T03:40:57.3309880Z type=str, 2025-07-24T03:40:57.3310250Z required=False, 2025-07-24T03:40:57.3310657Z default="pytorch/test-infra", 2025-07-24T03:40:57.3311141Z help="GitHub repo to get the issue", 2025-07-24T03:40:57.3311607Z ) 2025-07-24T03:40:57.3311935Z parser.add_argument( 2025-07-24T03:40:57.3312332Z "--github-repo", 2025-07-24T03:40:57.3312710Z type=str, 2025-07-24T03:40:57.3313063Z required=True, 2025-07-24T03:40:57.3313470Z help="GitHub repo where CI is running", 2025-07-24T03:40:57.3314119Z ) 2025-07-24T03:40:57.3314466Z parser.add_argument( 2025-07-24T03:40:57.3315015Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-24T03:40:57.3315620Z ) 2025-07-24T03:40:57.3315947Z parser.add_argument( 2025-07-24T03:40:57.3316510Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-24T03:40:57.3317123Z ) 2025-07-24T03:40:57.3317448Z parser.add_argument( 2025-07-24T03:40:57.3318184Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-24T03:40:57.3318812Z ) 2025-07-24T03:40:57.3319142Z parser.add_argument( 2025-07-24T03:40:57.3319735Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-24T03:40:57.3320389Z ) 2025-07-24T03:40:57.3320715Z parser.add_argument( 2025-07-24T03:40:57.3321118Z "--github-ref-type", 2025-07-24T03:40:57.3321524Z type=str, 2025-07-24T03:40:57.3321879Z required=True, 2025-07-24T03:40:57.3322303Z help="Current GitHub ref type, branch or tag", 2025-07-24T03:40:57.3322798Z ) 2025-07-24T03:40:57.3323124Z parser.add_argument( 2025-07-24T03:40:57.3323535Z "--eligible-experiments", 2025-07-24T03:40:57.3371728Z type=_str_comma_separated_to_set, 2025-07-24T03:40:57.3372322Z required=False, 2025-07-24T03:40:57.3372725Z default="", 2025-07-24T03:40:57.3373569Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-24T03:40:57.3374665Z ) 2025-07-24T03:40:57.3375006Z parser.add_argument( 2025-07-24T03:40:57.3375433Z "--opt-out-experiments", 2025-07-24T03:40:57.3375902Z type=_str_comma_separated_to_set, 2025-07-24T03:40:57.3376383Z required=False, 2025-07-24T03:40:57.3376756Z default="", 2025-07-24T03:40:57.3377117Z help=( 2025-07-24T03:40:57.3377720Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-24T03:40:57.3378739Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-24T03:40:57.3379496Z ), 2025-07-24T03:40:57.3379820Z ) 2025-07-24T03:40:57.3380149Z parser.add_argument( 2025-07-24T03:40:57.3380545Z "--pr-number", 2025-07-24T03:40:57.3380917Z type=str, 2025-07-24T03:40:57.3381273Z required=False, 2025-07-24T03:40:57.3381656Z default="", 2025-07-24T03:40:57.3382301Z help="the optional PR number where this is run", 2025-07-24T03:40:57.3382831Z ) 2025-07-24T03:40:57.3383011Z 2025-07-24T03:40:57.3383181Z return parser.parse_args() 2025-07-24T03:40:57.3383466Z 2025-07-24T03:40:57.3383472Z 2025-07-24T03:40:57.3383836Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-24T03:40:57.3384742Z auth = Auth.Token(github_token) 2025-07-24T03:40:57.3385200Z return Github(auth=auth) 2025-07-24T03:40:57.3385471Z 2025-07-24T03:40:57.3385477Z 2025-07-24T03:40:57.3385897Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-24T03:40:57.3386635Z repo = gh.get_repo(repo) 2025-07-24T03:40:57.3387089Z return repo.get_issue(number=issue_num) 2025-07-24T03:40:57.3387428Z 2025-07-24T03:40:57.3387433Z 2025-07-24T03:40:57.3387605Z def get_potential_pr_author( 2025-07-24T03:40:57.3388201Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-24T03:40:57.3388819Z ) -> str: 2025-07-24T03:40:57.3389282Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-24T03:40:57.3390016Z # Fetch the actual username from the original PR. The PR number is 2025-07-24T03:40:57.3390681Z # embedded in the tag name: ciflow// 2025-07-24T03:40:57.3391064Z 2025-07-24T03:40:57.3391234Z gh = get_gh_client(github_token) 2025-07-24T03:40:57.3391532Z 2025-07-24T03:40:57.3391772Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-24T03:40:57.3392340Z split_tag = ref_name.split("/") 2025-07-24T03:40:57.3392796Z if ( 2025-07-24T03:40:57.3393138Z len(split_tag) == 3 2025-07-24T03:40:57.3393574Z and split_tag[0] == "ciflow" 2025-07-24T03:40:57.3394270Z and split_tag[2].isnumeric() 2025-07-24T03:40:57.3394723Z ): 2025-07-24T03:40:57.3395069Z pr_number = split_tag[2] 2025-07-24T03:40:57.3395670Z try: 2025-07-24T03:40:57.3396053Z repository = gh.get_repo(repo) 2025-07-24T03:40:57.3396614Z pull = repository.get_pull(number=int(pr_number)) 2025-07-24T03:40:57.3397153Z except Exception as e: 2025-07-24T03:40:57.3397627Z raise Exception( # noqa: TRY002 2025-07-24T03:40:57.3398239Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-24T03:40:57.3398817Z ) from e 2025-07-24T03:40:57.3399305Z return pull.user.login # type: ignore[no-any-return] 2025-07-24T03:40:57.3399933Z # In all other cases, return the original input username 2025-07-24T03:40:57.3400466Z return username 2025-07-24T03:40:57.3400684Z 2025-07-24T03:40:57.3400690Z 2025-07-24T03:40:57.3400893Z def is_exception_branch(branch: str) -> bool: 2025-07-24T03:40:57.3401373Z """ 2025-07-24T03:40:57.3401950Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-24T03:40:57.3402657Z """ 2025-07-24T03:40:57.3403155Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-24T03:40:57.3403628Z 2025-07-24T03:40:57.3403634Z 2025-07-24T03:40:57.3403807Z def load_yaml(yaml_text: str) -> Any: 2025-07-24T03:40:57.3404476Z try: 2025-07-24T03:40:57.3404822Z data = yaml.safe_load(yaml_text) 2025-07-24T03:40:57.3405283Z return data 2025-07-24T03:40:57.3405652Z except yaml.YAMLError: 2025-07-24T03:40:57.3406086Z log.exception("Error loading YAML") 2025-07-24T03:40:57.3406550Z raise 2025-07-24T03:40:57.3406745Z 2025-07-24T03:40:57.3406752Z 2025-07-24T03:40:57.3407125Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-24T03:40:57.3407791Z """ 2025-07-24T03:40:57.3408341Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-24T03:40:57.3408891Z 2025-07-24T03:40:57.3409339Z If the issue body contains "---" then the text above that is the settings 2025-07-24T03:40:57.3410037Z and the text below is the list of opted in users. 2025-07-24T03:40:57.3410409Z 2025-07-24T03:40:57.3410749Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-24T03:40:57.3411385Z """ 2025-07-24T03:40:57.3411788Z rollout_state_parts = rollout_state.split("---") 2025-07-24T03:40:57.3412330Z if len(rollout_state_parts) >= 2: 2025-07-24T03:40:57.3412872Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-24T03:40:57.3413401Z else: 2025-07-24T03:40:57.3413741Z return "", rollout_state 2025-07-24T03:40:57.3414143Z 2025-07-24T03:40:57.3414149Z 2025-07-24T03:40:57.3414327Z class UserOptins(dict[str, list[str]]): 2025-07-24T03:40:57.3414786Z """ 2025-07-24T03:40:57.3415238Z Dictionary of users with a list of features they have opted into 2025-07-24T03:40:57.3415826Z """ 2025-07-24T03:40:57.3416011Z 2025-07-24T03:40:57.3416018Z 2025-07-24T03:40:57.3416330Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-24T03:40:57.3416920Z """ 2025-07-24T03:40:57.3417555Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-24T03:40:57.3418181Z 2025-07-24T03:40:57.3418740Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-24T03:40:57.3419640Z - Example line: "@User1,lf,split_build" 2025-07-24T03:40:57.3420258Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-24T03:40:57.3420701Z 2025-07-24T03:40:57.3420706Z 2025-07-24T03:40:57.3420850Z """ 2025-07-24T03:40:57.3421181Z optins = UserOptins() 2025-07-24T03:40:57.3421627Z for user in user_optin_text.split("\n"): 2025-07-24T03:40:57.3422126Z user = user.strip("\r\n\t -") 2025-07-24T03:40:57.3422607Z if not user or not user.startswith("@"): 2025-07-24T03:40:57.3423245Z # Not a valid user. Skip 2025-07-24T03:40:57.3423685Z continue 2025-07-24T03:40:57.3424019Z 2025-07-24T03:40:57.3424162Z if user: 2025-07-24T03:40:57.3424551Z usr_name = user.split(",")[0].strip("@") 2025-07-24T03:40:57.3425182Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-24T03:40:57.3425629Z 2025-07-24T03:40:57.3425778Z return optins 2025-07-24T03:40:57.3426005Z 2025-07-24T03:40:57.3426011Z 2025-07-24T03:40:57.3426266Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-24T03:40:57.3426812Z """ 2025-07-24T03:40:57.3427165Z Check if the experiment name is valid. 2025-07-24T03:40:57.3427644Z A valid name: 2025-07-24T03:40:57.3428219Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-24T03:40:57.3429072Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-24T03:40:57.3429722Z - Cannot contain spaces 2025-07-24T03:40:57.3430138Z """ 2025-07-24T03:40:57.3430314Z 2025-07-24T03:40:57.3430551Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-24T03:40:57.3431172Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-24T03:40:57.3431576Z 2025-07-24T03:40:57.3431725Z if valid: 2025-07-24T03:40:57.3432063Z return True 2025-07-24T03:40:57.3432285Z 2025-07-24T03:40:57.3432429Z log.error( 2025-07-24T03:40:57.3433729Z 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-07-24T03:40:57.3435631Z ) 2025-07-24T03:40:57.3435957Z return False 2025-07-24T03:40:57.3436169Z 2025-07-24T03:40:57.3436175Z 2025-07-24T03:40:57.3436446Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-24T03:40:57.3437013Z """ 2025-07-24T03:40:57.3437674Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-24T03:40:57.3438335Z """ 2025-07-24T03:40:57.3438649Z try: 2025-07-24T03:40:57.3438974Z if settings_text: 2025-07-24T03:40:57.3439627Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-24T03:40:57.3440338Z # for easy reading 2025-07-24T03:40:57.3441053Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-24T03:40:57.3441858Z # the backtick character in shell commands. 2025-07-24T03:40:57.3442410Z backtick = chr(96) # backtick character 2025-07-24T03:40:57.3443013Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-24T03:40:57.3443607Z settings = load_yaml(settings_text) 2025-07-24T03:40:57.3444058Z 2025-07-24T03:40:57.3444435Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-24T03:40:57.3445111Z experiments = {} 2025-07-24T03:40:57.3445383Z 2025-07-24T03:40:57.3445855Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-24T03:40:57.3446543Z if not is_valid_experiment_name(exp_name): 2025-07-24T03:40:57.3447537Z # 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-07-24T03:40:57.3448484Z continue 2025-07-24T03:40:57.3448737Z 2025-07-24T03:40:57.3448899Z valid_settings = {} 2025-07-24T03:40:57.3449364Z for setting in exp_settings: 2025-07-24T03:40:57.3449873Z if setting not in Experiment._fields: 2025-07-24T03:40:57.3450371Z log.warning( 2025-07-24T03:40:57.3451007Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-24T03:40:57.3451838Z ) 2025-07-24T03:40:57.3452234Z else: 2025-07-24T03:40:57.3452697Z valid_settings[setting] = exp_settings[setting] 2025-07-24T03:40:57.3453219Z 2025-07-24T03:40:57.3453468Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-24T03:40:57.3454174Z return Settings(experiments) 2025-07-24T03:40:57.3454506Z 2025-07-24T03:40:57.3454659Z except Exception: 2025-07-24T03:40:57.3455090Z log.exception("Failed to parse settings") 2025-07-24T03:40:57.3455438Z 2025-07-24T03:40:57.3455590Z return Settings() 2025-07-24T03:40:57.3455822Z 2025-07-24T03:40:57.3455828Z 2025-07-24T03:40:57.3456060Z def parse_settings(rollout_state: str) -> Settings: 2025-07-24T03:40:57.3456568Z """ 2025-07-24T03:40:57.3456953Z Parse settings, if any, from the rollout state. 2025-07-24T03:40:57.3457310Z 2025-07-24T03:40:57.3457623Z If the issue body contains "---" then the text above that is the settings 2025-07-24T03:40:57.3458317Z and the text below is the list of opted in users. 2025-07-24T03:40:57.3458681Z 2025-07-24T03:40:57.3459052Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-24T03:40:57.3459709Z """ 2025-07-24T03:40:57.3460203Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-24T03:40:57.3460878Z return parse_settings_from_text(settings_text) 2025-07-24T03:40:57.3461239Z 2025-07-24T03:40:57.3461245Z 2025-07-24T03:40:57.3461468Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-24T03:40:57.3461975Z """ 2025-07-24T03:40:57.3462318Z Parse users from the rollout state. 2025-07-24T03:40:57.3462631Z 2025-07-24T03:40:57.3462775Z """ 2025-07-24T03:40:57.3463240Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-24T03:40:57.3463994Z return parse_user_opt_in_from_text(users_text) 2025-07-24T03:40:57.3464358Z 2025-07-24T03:40:57.3464364Z 2025-07-24T03:40:57.3464851Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-24T03:40:57.3465541Z """ 2025-07-24T03:40:57.3465911Z Check if a user is opted into an experiment 2025-07-24T03:40:57.3466386Z """ 2025-07-24T03:40:57.3466789Z return experiment_name in user_optins.get(user, []) 2025-07-24T03:40:57.3467166Z 2025-07-24T03:40:57.3467172Z 2025-07-24T03:40:57.3467541Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-24T03:40:57.3468211Z """ 2025-07-24T03:40:57.3468611Z Check if a user explicitly opted out of an experiment 2025-07-24T03:40:57.3469128Z """ 2025-07-24T03:40:57.3469563Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-24T03:40:57.3470171Z experiment_optout = "-" + experiment_name 2025-07-24T03:40:57.3470744Z if experiment_optout not in user_optins.get(user, []): 2025-07-24T03:40:57.3471281Z return False 2025-07-24T03:40:57.3471502Z 2025-07-24T03:40:57.3471749Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-24T03:40:57.3472277Z log.warning( 2025-07-24T03:40:57.3472986Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-24T03:40:57.3473768Z ) 2025-07-24T03:40:57.3474061Z 2025-07-24T03:40:57.3474207Z return True 2025-07-24T03:40:57.3474417Z 2025-07-24T03:40:57.3474423Z 2025-07-24T03:40:57.3474583Z def get_runner_prefix( 2025-07-24T03:40:57.3474966Z rollout_state: str, 2025-07-24T03:40:57.3475380Z workflow_requestors: Iterable[str], 2025-07-24T03:40:57.3475837Z branch: str, 2025-07-24T03:40:57.3476271Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-24T03:40:57.3476867Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-24T03:40:57.3477388Z is_canary: bool = False, 2025-07-24T03:40:57.3477785Z ) -> str: 2025-07-24T03:40:57.3478289Z settings = parse_settings(rollout_state) 2025-07-24T03:40:57.3478821Z user_optins = parse_users(rollout_state) 2025-07-24T03:40:57.3479151Z 2025-07-24T03:40:57.3479303Z fleet_prefix = "" 2025-07-24T03:40:57.3479679Z prefixes = [] 2025-07-24T03:40:57.3480238Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-24T03:40:57.3481076Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-24T03:40:57.3481720Z log.info( 2025-07-24T03:40:57.3482324Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-24T03:40:57.3482994Z ) 2025-07-24T03:40:57.3483330Z continue 2025-07-24T03:40:57.3483550Z 2025-07-24T03:40:57.3483729Z if opt_out_experiments: 2025-07-24T03:40:57.3484304Z if experiment_name in opt_out_experiments: 2025-07-24T03:40:57.3484882Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-24T03:40:57.3485405Z log.info( 2025-07-24T03:40:57.3486240Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-24T03:40:57.3487116Z ) 2025-07-24T03:40:57.3487466Z continue 2025-07-24T03:40:57.3487705Z 2025-07-24T03:40:57.3487877Z if eligible_experiments: 2025-07-24T03:40:57.3488391Z if experiment_name not in eligible_experiments: 2025-07-24T03:40:57.3488960Z exp_list = ", ".join(eligible_experiments) 2025-07-24T03:40:57.3489453Z log.info( 2025-07-24T03:40:57.3490145Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-24T03:40:57.3490891Z ) 2025-07-24T03:40:57.3491238Z continue 2025-07-24T03:40:57.3491661Z elif not experiment_settings.default: 2025-07-24T03:40:57.3492132Z log.info( 2025-07-24T03:40:57.3492850Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-24T03:40:57.3493518Z ) 2025-07-24T03:40:57.3493949Z continue 2025-07-24T03:40:57.3494174Z 2025-07-24T03:40:57.3494420Z # Is any workflow_requestor opted out to this experiment? 2025-07-24T03:40:57.3494969Z opted_out_users = [ 2025-07-24T03:40:57.3495359Z requestor 2025-07-24T03:40:57.3495760Z for requestor in workflow_requestors 2025-07-24T03:40:57.3496357Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-24T03:40:57.3496911Z ] 2025-07-24T03:40:57.3497093Z 2025-07-24T03:40:57.3497256Z if opted_out_users: 2025-07-24T03:40:57.3497653Z log.info( 2025-07-24T03:40:57.3498195Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-24T03:40:57.3498813Z ) 2025-07-24T03:40:57.3499152Z continue 2025-07-24T03:40:57.3499374Z 2025-07-24T03:40:57.3499616Z # Is any workflow_requestor opted in to this experiment? 2025-07-24T03:40:57.3500150Z opted_in_users = [ 2025-07-24T03:40:57.3500544Z requestor 2025-07-24T03:40:57.3500941Z for requestor in workflow_requestors 2025-07-24T03:40:57.3501531Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-24T03:40:57.3502090Z ] 2025-07-24T03:40:57.3502274Z 2025-07-24T03:40:57.3502424Z enabled = False 2025-07-24T03:40:57.3502808Z if opted_in_users: 2025-07-24T03:40:57.3503197Z log.info( 2025-07-24T03:40:57.3503719Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-24T03:40:57.3504418Z ) 2025-07-24T03:40:57.3504758Z enabled = True 2025-07-24T03:40:57.3505004Z 2025-07-24T03:40:57.3505194Z elif experiment_settings.rollout_perc: 2025-07-24T03:40:57.3505938Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-24T03:40:57.3506892Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-24T03:40:57.3507476Z log.info( 2025-07-24T03:40:57.3508249Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-24T03:40:57.3509071Z ) 2025-07-24T03:40:57.3509431Z enabled = True 2025-07-24T03:40:57.3509694Z 2025-07-24T03:40:57.3509839Z if enabled: 2025-07-24T03:40:57.3510212Z label = experiment_name 2025-07-24T03:40:57.3510699Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-24T03:40:57.3511440Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-24T03:40:57.3512231Z # - If it's enabled, then we always list it's prefix first 2025-07-24T03:40:57.3512919Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-24T03:40:57.3513520Z if is_canary: 2025-07-24T03:40:57.3514046Z label += CANARY_FLEET_SUFFIX 2025-07-24T03:40:57.3514540Z fleet_prefix = label 2025-07-24T03:40:57.3514970Z else: 2025-07-24T03:40:57.3515350Z prefixes.append(label) 2025-07-24T03:40:57.3515655Z 2025-07-24T03:40:57.3515813Z if len(prefixes) > 1: 2025-07-24T03:40:57.3516210Z log.error( 2025-07-24T03:40:57.3517126Z 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-07-24T03:40:57.3518122Z ) 2025-07-24T03:40:57.3518469Z prefixes = prefixes[:1] 2025-07-24T03:40:57.3518744Z 2025-07-24T03:40:57.3518906Z # Fleet always comes first 2025-07-24T03:40:57.3519322Z if fleet_prefix: 2025-07-24T03:40:57.3519713Z prefixes.insert(0, fleet_prefix) 2025-07-24T03:40:57.3520043Z 2025-07-24T03:40:57.3520372Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-24T03:40:57.3520748Z 2025-07-24T03:40:57.3520755Z 2025-07-24T03:40:57.3521153Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-24T03:40:57.3521845Z """ 2025-07-24T03:40:57.3522360Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-24T03:40:57.3522861Z 2025-07-24T03:40:57.3523205Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-24T03:40:57.3523836Z """ 2025-07-24T03:40:57.3524273Z gh = get_gh_client(github_token) 2025-07-24T03:40:57.3524769Z issue = get_issue(gh, repo, issue_num) 2025-07-24T03:40:57.3525331Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-24T03:40:57.3525725Z 2025-07-24T03:40:57.3525731Z 2025-07-24T03:40:57.3526085Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-24T03:40:57.3526766Z for _ in range(num_retries): 2025-07-24T03:40:57.3527189Z try: 2025-07-24T03:40:57.3527564Z req = Request(url=url, headers=headers) 2025-07-24T03:40:57.3528153Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-24T03:40:57.3528724Z return json.loads(content) 2025-07-24T03:40:57.3529192Z except Exception as e: 2025-07-24T03:40:57.3529661Z log.warning(f"Could not download {url}: {e}") 2025-07-24T03:40:57.3530016Z 2025-07-24T03:40:57.3530357Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-24T03:40:57.3530985Z return {} 2025-07-24T03:40:57.3531183Z 2025-07-24T03:40:57.3531189Z 2025-07-24T03:40:57.3531328Z @cache 2025-07-24T03:40:57.3531869Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-24T03:40:57.3532544Z """ 2025-07-24T03:40:57.3532892Z Dynamically get PR information 2025-07-24T03:40:57.3533449Z """ 2025-07-24T03:40:57.3533984Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-24T03:40:57.3534542Z headers = { 2025-07-24T03:40:57.3534948Z "Accept": "application/vnd.github.v3+json", 2025-07-24T03:40:57.3535482Z "Authorization": f"token {github_token}", 2025-07-24T03:40:57.3535960Z } 2025-07-24T03:40:57.3536349Z json_response: dict[str, Any] = download_json( 2025-07-24T03:40:57.3536889Z url=f"{github_api}/issues/{pr_number}", 2025-07-24T03:40:57.3537367Z headers=headers, 2025-07-24T03:40:57.3537748Z ) 2025-07-24T03:40:57.3537920Z 2025-07-24T03:40:57.3538085Z if not json_response: 2025-07-24T03:40:57.3538585Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-24T03:40:57.3539133Z return {} 2025-07-24T03:40:57.3539341Z 2025-07-24T03:40:57.3539495Z return json_response 2025-07-24T03:40:57.3539743Z 2025-07-24T03:40:57.3539748Z 2025-07-24T03:40:57.3540099Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-24T03:40:57.3540748Z """ 2025-07-24T03:40:57.3541219Z Dynamically get the latest list of labels from the pull request 2025-07-24T03:40:57.3541803Z """ 2025-07-24T03:40:57.3542224Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-24T03:40:57.3542769Z return { 2025-07-24T03:40:57.3543275Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-24T03:40:57.3543994Z } 2025-07-24T03:40:57.3544175Z 2025-07-24T03:40:57.3544181Z 2025-07-24T03:40:57.3544331Z def main() -> None: 2025-07-24T03:40:57.3544702Z args = parse_args() 2025-07-24T03:40:57.3544938Z 2025-07-24T03:40:57.3545134Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-24T03:40:57.3545477Z 2025-07-24T03:40:57.3545639Z # Check if the PR is opt-out 2025-07-24T03:40:57.3546068Z if args.pr_number: 2025-07-24T03:40:57.3546638Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-24T03:40:57.3547435Z if OPT_OUT_LABEL in labels: 2025-07-24T03:40:57.3547879Z log.info( 2025-07-24T03:40:57.3548495Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-24T03:40:57.3549171Z ) 2025-07-24T03:40:57.3549653Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-24T03:40:57.3550250Z sys.exit() 2025-07-24T03:40:57.3550476Z 2025-07-24T03:40:57.3550616Z try: 2025-07-24T03:40:57.3551002Z rollout_state = get_rollout_state_from_issue( 2025-07-24T03:40:57.3551652Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-24T03:40:57.3552227Z ) 2025-07-24T03:40:57.3552406Z 2025-07-24T03:40:57.3552586Z username = get_potential_pr_author( 2025-07-24T03:40:57.3553066Z args.github_token, 2025-07-24T03:40:57.3553480Z args.github_repo, 2025-07-24T03:40:57.3553998Z args.github_actor, 2025-07-24T03:40:57.3554436Z args.github_ref_type, 2025-07-24T03:40:57.3554871Z args.github_branch, 2025-07-24T03:40:57.3555271Z ) 2025-07-24T03:40:57.3555451Z 2025-07-24T03:40:57.3555699Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-24T03:40:57.3556109Z 2025-07-24T03:40:57.3556297Z runner_label_prefix = get_runner_prefix( 2025-07-24T03:40:57.3556774Z rollout_state, 2025-07-24T03:40:57.3557201Z (args.github_issue_owner, username), 2025-07-24T03:40:57.3557681Z args.github_branch, 2025-07-24T03:40:57.3558123Z args.eligible_experiments, 2025-07-24T03:40:57.3558594Z args.opt_out_experiments, 2025-07-24T03:40:57.3559032Z is_canary, 2025-07-24T03:40:57.3559398Z ) 2025-07-24T03:40:57.3559577Z 2025-07-24T03:40:57.3559737Z except Exception as e: 2025-07-24T03:40:57.3560133Z log.error( 2025-07-24T03:40:57.3560716Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-24T03:40:57.3561534Z ) 2025-07-24T03:40:57.3561714Z 2025-07-24T03:40:57.3562017Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-24T03:40:57.3562459Z 2025-07-24T03:40:57.3562465Z 2025-07-24T03:40:57.3562617Z if __name__ == "__main__": 2025-07-24T03:40:57.3563002Z main() 2025-07-24T03:40:57.3563183Z 2025-07-24T03:40:57.3648646Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-24T03:40:57.3649439Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-24T03:40:57.3677011Z shell: /usr/bin/bash -e {0} 2025-07-24T03:40:57.3677433Z env: 2025-07-24T03:40:57.3677991Z GITHUB_TOKEN: *** 2025-07-24T03:40:57.3678358Z ISSUE_NUMBER: 5132 2025-07-24T03:40:57.3678759Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-07-24T03:40:57.3679207Z ISSUE_OWNER: 2025-07-24T03:40:57.3679573Z CHECK_EXPERIMENTS: 2025-07-24T03:40:57.3679972Z OPT_OUT_EXPERIMENTS: lf 2025-07-24T03:40:57.3680379Z PR_NUMBER: 2025-07-24T03:40:57.3680725Z ##[endgroup] 2025-07-24T03:40:58.4142669Z Defaulting to user installation because normal site-packages is not writeable 2025-07-24T03:40:58.9873848Z Collecting urllib3==1.26.18 2025-07-24T03:40:59.0426544Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-24T03:40:59.0681626Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.2 MB/s eta 0:00:00 2025-07-24T03:40:59.0982851Z Collecting PyGithub==2.3.0 2025-07-24T03:40:59.1091293Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-24T03:40:59.1596952Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-24T03:40:59.1768777Z 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-07-24T03:40:59.1813676Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-24T03:40:59.1830890Z 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-07-24T03:40:59.1846177Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-24T03:40:59.2157700Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-24T03:40:59.2264853Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-24T03:40:59.2491925Z 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-07-24T03:40:59.3736243Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-24T03:40:59.3834425Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-24T03:40:59.4917648Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-24T03:40:59.5020293Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-24T03:40:59.5276865Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-24T03:40:59.5437213Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-24T03:40:59.5725059Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-24T03:40:59.5860322Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.5 MB/s eta 0:00:00 2025-07-24T03:40:59.5977207Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-24T03:40:59.6118388Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 27.9 MB/s eta 0:00:00 2025-07-24T03:40:59.6263142Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-24T03:40:59.6396328Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 74.3 MB/s eta 0:00:00 2025-07-24T03:40:59.6495664Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-24T03:40:59.6617134Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-24T03:40:59.6681162Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 106.5 MB/s eta 0:00:00 2025-07-24T03:40:59.6777385Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-24T03:40:59.6817229Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 32.1 MB/s eta 0:00:00 2025-07-24T03:40:59.6913408Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-24T03:40:59.6956516Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.2 MB/s eta 0:00:00 2025-07-24T03:41:00.0003042Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-24T03:41:00.5312746Z 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.2 2025-07-24T03:41:00.6078640Z ##[group]Run curr_branch="ciflow/inductor/149961" 2025-07-24T03:41:00.6079038Z curr_branch="ciflow/inductor/149961" 2025-07-24T03:41:00.6079294Z curr_ref_type="tag" 2025-07-24T03:41:00.6079536Z echo "Current branch is '$curr_branch'" 2025-07-24T03:41:00.6079774Z  2025-07-24T03:41:00.6079962Z python3 runner_determinator.py \ 2025-07-24T03:41:00.6080239Z  --github-token "$GITHUB_TOKEN" \ 2025-07-24T03:41:00.6080521Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-24T03:41:00.6080792Z  --github-branch "$curr_branch" \ 2025-07-24T03:41:00.6081053Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-24T03:41:00.6081333Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-24T03:41:00.6081607Z  --github-ref-type "$curr_ref_type" \ 2025-07-24T03:41:00.6081885Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-24T03:41:00.6082227Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-24T03:41:00.6082551Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-24T03:41:00.6082849Z  --pr-number "${PR_NUMBER}" 2025-07-24T03:41:00.6110942Z shell: /usr/bin/bash -e {0} 2025-07-24T03:41:00.6111173Z env: 2025-07-24T03:41:00.6111647Z GITHUB_TOKEN: *** 2025-07-24T03:41:00.6111846Z ISSUE_NUMBER: 5132 2025-07-24T03:41:00.6112057Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-07-24T03:41:00.6112290Z ISSUE_OWNER: 2025-07-24T03:41:00.6112476Z CHECK_EXPERIMENTS: 2025-07-24T03:41:00.6112668Z OPT_OUT_EXPERIMENTS: lf 2025-07-24T03:41:00.6112870Z PR_NUMBER: 2025-07-24T03:41:00.6113033Z ##[endgroup] 2025-07-24T03:41:00.6158702Z Current branch is 'ciflow/inductor/149961' 2025-07-24T03:41:02.9705952Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-07-24T03:41:02.9707986Z INFO : Setting output: label-type='' 2025-07-24T03:41:03.0018687Z Evaluate and set job outputs 2025-07-24T03:41:03.0026515Z Cleaning up orphan processes