2025-12-04T08:57:37.5182164Z Current runner version: '2.329.0' 2025-12-04T08:57:37.5205094Z ##[group]Runner Image Provisioner 2025-12-04T08:57:37.5205874Z Hosted Compute Agent 2025-12-04T08:57:37.5206378Z Version: 20251124.448 2025-12-04T08:57:37.5206918Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:57:37.5207553Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:57:37.5208089Z ##[endgroup] 2025-12-04T08:57:37.5208527Z ##[group]Operating System 2025-12-04T08:57:37.5209046Z Ubuntu 2025-12-04T08:57:37.5209451Z 24.04.3 2025-12-04T08:57:37.5209866Z LTS 2025-12-04T08:57:37.5210221Z ##[endgroup] 2025-12-04T08:57:37.5210708Z ##[group]Runner Image 2025-12-04T08:57:37.5211191Z Image: ubuntu-24.04 2025-12-04T08:57:37.5211589Z Version: 20251126.144.1 2025-12-04T08:57:37.5212535Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:57:37.5213883Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:57:37.5215081Z ##[endgroup] 2025-12-04T08:57:37.5215970Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:57:37.5218157Z Contents: read 2025-12-04T08:57:37.5218645Z Metadata: read 2025-12-04T08:57:37.5219059Z ##[endgroup] 2025-12-04T08:57:37.5221209Z Secret source: Actions 2025-12-04T08:57:37.5221781Z Prepare workflow directory 2025-12-04T08:57:37.5717928Z Prepare all required actions 2025-12-04T08:57:37.5775941Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:57:37.5780535Z ##[group] Inputs 2025-12-04T08:57:37.5781067Z check_experiments: 2025-12-04T08:57:37.5781699Z opt_out_experiments: 2025-12-04T08:57:37.5782177Z triggering_actor: pytorchmergebot 2025-12-04T08:57:37.5782720Z issue_owner: 2025-12-04T08:57:37.5783216Z curr_branch: main 2025-12-04T08:57:37.5783658Z curr_ref_type: branch 2025-12-04T08:57:37.5784245Z issue_number: 5132 2025-12-04T08:57:37.5784945Z ##[endgroup] 2025-12-04T08:57:37.5785609Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:57:38.2479610Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:57:38.2482213Z cat < runner_determinator.py 2025-12-04T08:57:38.2482889Z # flake8: noqa: G004 2025-12-04T08:57:38.2483499Z  2025-12-04T08:57:38.2484266Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:57:38.2485890Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:57:38.2486898Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:57:38.2487622Z  2025-12-04T08:57:38.2488057Z """ 2025-12-04T08:57:38.2488845Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:57:38.2489874Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:57:38.2491083Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:57:38.2492051Z of which runners should be used to run which job. 2025-12-04T08:57:38.2492753Z  2025-12-04T08:57:38.2493495Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:57:38.2494932Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:57:38.2495971Z settings are considered to be empty with only the second part, the user 2025-12-04T08:57:38.2496845Z list, defined. 2025-12-04T08:57:38.2497351Z  2025-12-04T08:57:38.2498055Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:57:38.2499081Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:57:38.2500123Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:57:38.2500858Z  2025-12-04T08:57:38.2501832Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:57:38.2502923Z The user list is also a comma separated list of additional features or 2025-12-04T08:57:38.2503798Z experiments which the user could be opted in to. 2025-12-04T08:57:38.2504474Z  2025-12-04T08:57:38.2505241Z The user list has the following rules: 2025-12-04T08:57:38.2505846Z  2025-12-04T08:57:38.2506527Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:57:38.2507544Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:57:38.2508465Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:57:38.2509099Z  2025-12-04T08:57:38.2509597Z Example config: 2025-12-04T08:57:38.2510239Z  # A list of experiments that can be opted into. 2025-12-04T08:57:38.2511070Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:57:38.2511871Z  # Expected syntax is: 2025-12-04T08:57:38.2512656Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:57:38.2513786Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:57:38.2514805Z  2025-12-04T08:57:38.2515261Z  experiments: 2025-12-04T08:57:38.2515833Z  lf: 2025-12-04T08:57:38.2516338Z  rollout_percent: 25 2025-12-04T08:57:38.2516967Z  all_branches: false 2025-12-04T08:57:38.2517538Z  default: true 2025-12-04T08:57:38.2518121Z  --- 2025-12-04T08:57:38.2518589Z  2025-12-04T08:57:38.2519094Z  # Opt-ins: 2025-12-04T08:57:38.2519881Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:57:38.2521024Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:57:38.2521972Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:57:38.2522754Z  # Experiments should be from the above list. 2025-12-04T08:57:38.2523510Z  2025-12-04T08:57:38.2524014Z  @User1,-lf,split_build 2025-12-04T08:57:38.2524665Z  @User2,lf 2025-12-04T08:57:38.2525268Z  @User3,split_build 2025-12-04T08:57:38.2525812Z """ 2025-12-04T08:57:38.2526258Z  2025-12-04T08:57:38.2527378Z import json 2025-12-04T08:57:38.2527915Z import logging 2025-12-04T08:57:38.2528418Z import os 2025-12-04T08:57:38.2528970Z import random 2025-12-04T08:57:38.2529499Z import re 2025-12-04T08:57:38.2530001Z import sys 2025-12-04T08:57:38.2530612Z from argparse import ArgumentParser 2025-12-04T08:57:38.2531456Z from collections.abc import Iterable 2025-12-04T08:57:38.2532117Z from functools import cache 2025-12-04T08:57:38.2532778Z from logging import LogRecord 2025-12-04T08:57:38.2533397Z from typing import Any, NamedTuple 2025-12-04T08:57:38.2534138Z from urllib.request import Request, urlopen 2025-12-04T08:57:38.2534998Z  2025-12-04T08:57:38.2535494Z import yaml 2025-12-04T08:57:38.2536044Z from github import Auth, Github 2025-12-04T08:57:38.2536677Z from github.Issue import Issue 2025-12-04T08:57:38.2537296Z  2025-12-04T08:57:38.2537742Z  2025-12-04T08:57:38.2538317Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:57:38.2539145Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:57:38.2540179Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:57:38.2541031Z  2025-12-04T08:57:38.2541833Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:57:38.2542575Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:57:38.2543216Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:57:38.2543991Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:57:38.2544715Z  2025-12-04T08:57:38.2545216Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:57:38.2545914Z  2025-12-04T08:57:38.2546378Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:57:38.2546976Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:57:38.2547595Z  2025-12-04T08:57:38.2548054Z  2025-12-04T08:57:38.2548517Z class Experiment(NamedTuple): 2025-12-04T08:57:38.2549184Z  rollout_perc: float = ( 2025-12-04T08:57:38.2550028Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:57:38.2550804Z  ) 2025-12-04T08:57:38.2551336Z  all_branches: bool = ( 2025-12-04T08:57:38.2552124Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:57:38.2552929Z  ) 2025-12-04T08:57:38.2553415Z  default: bool = ( 2025-12-04T08:57:38.2554193Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:57:38.2555066Z  ) 2025-12-04T08:57:38.2555527Z  2025-12-04T08:57:38.2556037Z  # Add more fields as needed 2025-12-04T08:57:38.2556603Z  2025-12-04T08:57:38.2557082Z  2025-12-04T08:57:38.2557570Z class Settings(NamedTuple): 2025-12-04T08:57:38.2558193Z  """ 2025-12-04T08:57:38.2558774Z  Settings for the experiments that can be opted into. 2025-12-04T08:57:38.2559540Z  """ 2025-12-04T08:57:38.2560022Z  2025-12-04T08:57:38.2560504Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:57:38.2561225Z  2025-12-04T08:57:38.2561759Z  2025-12-04T08:57:38.2562285Z class ColorFormatter(logging.Formatter): 2025-12-04T08:57:38.2563108Z  """Color codes the log messages based on the log level""" 2025-12-04T08:57:38.2563826Z  2025-12-04T08:57:38.2564306Z  COLORS = { 2025-12-04T08:57:38.2564956Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:57:38.2565610Z  "ERROR": "\033[31m", # Red 2025-12-04T08:57:38.2566226Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:57:38.2566907Z  "INFO": "\033[0m", # Reset 2025-12-04T08:57:38.2567518Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:57:38.2568150Z  } 2025-12-04T08:57:38.2568658Z  2025-12-04T08:57:38.2569175Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:57:38.2570080Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:57:38.2570993Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:57:38.2571733Z  return super().format(record) 2025-12-04T08:57:38.2572324Z  2025-12-04T08:57:38.2572824Z  2025-12-04T08:57:38.2573344Z handler = logging.StreamHandler() 2025-12-04T08:57:38.2574189Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:57:38.2575207Z  2025-12-04T08:57:38.2575779Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:57:38.2576540Z log.addHandler(handler) 2025-12-04T08:57:38.2577166Z log.setLevel(logging.INFO) 2025-12-04T08:57:38.2577736Z  2025-12-04T08:57:38.2578198Z  2025-12-04T08:57:38.2578746Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:57:38.2579488Z  """ 2025-12-04T08:57:38.2580121Z  Defines outputs of the github action that invokes this script 2025-12-04T08:57:38.2580982Z  """ 2025-12-04T08:57:38.2581503Z  if not GITHUB_OUTPUT: 2025-12-04T08:57:38.2582754Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:57:38.2583987Z  log.warning( 2025-12-04T08:57:38.2585414Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:57:38.2586480Z  ) 2025-12-04T08:57:38.2587046Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:57:38.2587766Z  return 2025-12-04T08:57:38.2588289Z  2025-12-04T08:57:38.2588771Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:57:38.2589522Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:57:38.2590226Z  f.write(f"{key}={value}\n") 2025-12-04T08:57:38.2590840Z  2025-12-04T08:57:38.2591281Z  2025-12-04T08:57:38.2591925Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:57:38.2592712Z  return frozenset( 2025-12-04T08:57:38.2593491Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:57:38.2594329Z  ) 2025-12-04T08:57:38.2594880Z  2025-12-04T08:57:38.2595358Z  2025-12-04T08:57:38.2595822Z def parse_args() -> Any: 2025-12-04T08:57:38.2596570Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:57:38.2597619Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:57:38.2598512Z  parser.add_argument( 2025-12-04T08:57:38.2599130Z  "--github-issue-repo", 2025-12-04T08:57:38.2599708Z  type=str, 2025-12-04T08:57:38.2600335Z  required=False, 2025-12-04T08:57:38.2601052Z  default="pytorch/test-infra", 2025-12-04T08:57:38.2601705Z  help="GitHub repo to get the issue", 2025-12-04T08:57:38.2602424Z  ) 2025-12-04T08:57:38.2602905Z  parser.add_argument( 2025-12-04T08:57:38.2603493Z  "--github-repo", 2025-12-04T08:57:38.2604110Z  type=str, 2025-12-04T08:57:38.2604756Z  required=True, 2025-12-04T08:57:38.2605373Z  help="GitHub repo where CI is running", 2025-12-04T08:57:38.2606086Z  ) 2025-12-04T08:57:38.2606581Z  parser.add_argument( 2025-12-04T08:57:38.2607328Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:57:38.2608161Z  ) 2025-12-04T08:57:38.2608645Z  parser.add_argument( 2025-12-04T08:57:38.2609459Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:57:38.2610323Z  ) 2025-12-04T08:57:38.2610838Z  parser.add_argument( 2025-12-04T08:57:38.2611653Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:57:38.2612461Z  ) 2025-12-04T08:57:38.2612983Z  parser.add_argument( 2025-12-04T08:57:38.2613780Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:57:38.2614797Z  ) 2025-12-04T08:57:38.2615350Z  parser.add_argument( 2025-12-04T08:57:38.2615922Z  "--github-ref-type", 2025-12-04T08:57:38.2616549Z  type=str, 2025-12-04T08:57:38.2617107Z  required=True, 2025-12-04T08:57:38.2617790Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:57:38.2618514Z  ) 2025-12-04T08:57:38.2619027Z  parser.add_argument( 2025-12-04T08:57:38.2619726Z  "--eligible-experiments", 2025-12-04T08:57:38.2620434Z  type=_str_comma_separated_to_set, 2025-12-04T08:57:38.2621075Z  required=False, 2025-12-04T08:57:38.2621681Z  default="", 2025-12-04T08:57:38.2622657Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:57:38.2623761Z  ) 2025-12-04T08:57:38.2624265Z  parser.add_argument( 2025-12-04T08:57:38.2624931Z  "--opt-out-experiments", 2025-12-04T08:57:38.2625637Z  type=_str_comma_separated_to_set, 2025-12-04T08:57:38.2626287Z  required=False, 2025-12-04T08:57:38.2626859Z  default="", 2025-12-04T08:57:38.2627922Z  help=( 2025-12-04T08:57:38.2628762Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:57:38.2630035Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:57:38.2631019Z  ), 2025-12-04T08:57:38.2631540Z  ) 2025-12-04T08:57:38.2632018Z  parser.add_argument( 2025-12-04T08:57:38.2632657Z  "--pr-number", 2025-12-04T08:57:38.2633235Z  type=str, 2025-12-04T08:57:38.2633771Z  required=False, 2025-12-04T08:57:38.2634376Z  default="", 2025-12-04T08:57:38.2635111Z  help="the optional PR number where this is run", 2025-12-04T08:57:38.2635805Z  ) 2025-12-04T08:57:38.2636265Z  2025-12-04T08:57:38.2636774Z  return parser.parse_args() 2025-12-04T08:57:38.2637347Z  2025-12-04T08:57:38.2637817Z  2025-12-04T08:57:38.2638582Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:57:38.2639562Z  auth = Auth.Token(github_token) 2025-12-04T08:57:38.2640280Z  return Github(auth=auth) 2025-12-04T08:57:38.2640849Z  2025-12-04T08:57:38.2641316Z  2025-12-04T08:57:38.2642065Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:57:38.2643084Z  repo = gh.get_repo(repo) 2025-12-04T08:57:38.2643774Z  return repo.get_issue(number=issue_num) 2025-12-04T08:57:38.2644380Z  2025-12-04T08:57:38.2644993Z  2025-12-04T08:57:38.2645454Z def get_potential_pr_author( 2025-12-04T08:57:38.2646260Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:57:38.2647101Z ) -> str: 2025-12-04T08:57:38.2647785Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:57:38.2648733Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:57:38.2649655Z  # embedded in the tag name: ciflow// 2025-12-04T08:57:38.2650351Z  2025-12-04T08:57:38.2650831Z  gh = get_gh_client(github_token) 2025-12-04T08:57:38.2651495Z  2025-12-04T08:57:38.2652096Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:57:38.2652835Z  split_tag = ref_name.split("/") 2025-12-04T08:57:38.2653511Z  if ( 2025-12-04T08:57:38.2654017Z  len(split_tag) == 3 2025-12-04T08:57:38.2654825Z  and split_tag[0] == "ciflow" 2025-12-04T08:57:38.2655512Z  and split_tag[2].isnumeric() 2025-12-04T08:57:38.2656160Z  ): 2025-12-04T08:57:38.2656721Z  pr_number = split_tag[2] 2025-12-04T08:57:38.2657342Z  try: 2025-12-04T08:57:38.2657959Z  repository = gh.get_repo(repo) 2025-12-04T08:57:38.2658820Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:57:38.2659628Z  except Exception as e: 2025-12-04T08:57:38.2660284Z  raise Exception( # noqa: TRY002 2025-12-04T08:57:38.2661105Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:57:38.2662061Z  ) from e 2025-12-04T08:57:38.2662754Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:57:38.2663867Z  # In all other cases, return the original input username 2025-12-04T08:57:38.2665253Z  return username 2025-12-04T08:57:38.2665787Z  2025-12-04T08:57:38.2666246Z  2025-12-04T08:57:38.2666758Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:57:38.2667452Z  """ 2025-12-04T08:57:38.2668224Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:57:38.2669146Z  """ 2025-12-04T08:57:38.2669853Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:57:38.2670641Z  2025-12-04T08:57:38.2671082Z  2025-12-04T08:57:38.2671606Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:57:38.2672255Z  try: 2025-12-04T08:57:38.2672757Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:57:38.2673430Z  return data 2025-12-04T08:57:38.2673974Z  except yaml.YAMLError: 2025-12-04T08:57:38.2674719Z  log.exception("Error loading YAML") 2025-12-04T08:57:38.2675399Z  raise 2025-12-04T08:57:38.2675886Z  2025-12-04T08:57:38.2676358Z  2025-12-04T08:57:38.2677073Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:57:38.2677944Z  """ 2025-12-04T08:57:38.2678820Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:57:38.2679708Z  2025-12-04T08:57:38.2680409Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:57:38.2681303Z  and the text below is the list of opted in users. 2025-12-04T08:57:38.2682000Z  2025-12-04T08:57:38.2682687Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:57:38.2683525Z  """ 2025-12-04T08:57:38.2684129Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:57:38.2684936Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:57:38.2685692Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:57:38.2686358Z  else: 2025-12-04T08:57:38.2686914Z  return "", rollout_state 2025-12-04T08:57:38.2687481Z  2025-12-04T08:57:38.2687914Z  2025-12-04T08:57:38.2688507Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:57:38.2689111Z  """ 2025-12-04T08:57:38.2689761Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:57:38.2690530Z  """ 2025-12-04T08:57:38.2690993Z  2025-12-04T08:57:38.2691406Z  2025-12-04T08:57:38.2692104Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:57:38.2692885Z  """ 2025-12-04T08:57:38.2693705Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:57:38.2694845Z  2025-12-04T08:57:38.2695753Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:57:38.2696878Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:57:38.2697899Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:57:38.2698621Z  2025-12-04T08:57:38.2699084Z  2025-12-04T08:57:38.2699511Z  """ 2025-12-04T08:57:38.2700026Z  optins = UserOptins() 2025-12-04T08:57:38.2700644Z  for user in user_optin_text.split("\n"): 2025-12-04T08:57:38.2701378Z  user = user.strip("\r\n\t -") 2025-12-04T08:57:38.2702095Z  if not user or not user.startswith("@"): 2025-12-04T08:57:38.2702745Z  # Not a valid user. Skip 2025-12-04T08:57:38.2703376Z  continue 2025-12-04T08:57:38.2703890Z  2025-12-04T08:57:38.2704355Z  if user: 2025-12-04T08:57:38.2705029Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:57:38.2705906Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:57:38.2706662Z  2025-12-04T08:57:38.2707084Z  return optins 2025-12-04T08:57:38.2707660Z  2025-12-04T08:57:38.2708083Z  2025-12-04T08:57:38.2708708Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:57:38.2709444Z  """ 2025-12-04T08:57:38.2709985Z  Check if the experiment name is valid. 2025-12-04T08:57:38.2710625Z  A valid name: 2025-12-04T08:57:38.2711457Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:57:38.2712524Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:57:38.2713349Z  - Cannot contain spaces 2025-12-04T08:57:38.2713971Z  """ 2025-12-04T08:57:38.2714416Z  2025-12-04T08:57:38.2715084Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:57:38.2715978Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:57:38.2716783Z  2025-12-04T08:57:38.2717282Z  if valid: 2025-12-04T08:57:38.2717790Z  return True 2025-12-04T08:57:38.2718347Z  2025-12-04T08:57:38.2718782Z  log.error( 2025-12-04T08:57:38.2720382Z  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-12-04T08:57:38.2722070Z  ) 2025-12-04T08:57:38.2722524Z  return False 2025-12-04T08:57:38.2723055Z  2025-12-04T08:57:38.2723476Z  2025-12-04T08:57:38.2724106Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:57:38.2724952Z  """ 2025-12-04T08:57:38.2725667Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:57:38.2726529Z  """ 2025-12-04T08:57:38.2726961Z  try: 2025-12-04T08:57:38.2727505Z  if settings_text: 2025-12-04T08:57:38.2728364Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:57:38.2729264Z  # for easy reading 2025-12-04T08:57:38.2730277Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:57:38.2731265Z  # the backtick character in shell commands. 2025-12-04T08:57:38.2732020Z  backtick = chr(96) # backtick character 2025-12-04T08:57:38.2732864Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:57:38.2733660Z  settings = load_yaml(settings_text) 2025-12-04T08:57:38.2734276Z  2025-12-04T08:57:38.2735160Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:57:38.2736128Z  experiments = {} 2025-12-04T08:57:38.2736676Z  2025-12-04T08:57:38.2737406Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:57:38.2738297Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:57:38.2739501Z  # 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-12-04T08:57:38.2740721Z  continue 2025-12-04T08:57:38.2741264Z  2025-12-04T08:57:38.2741763Z  valid_settings = {} 2025-12-04T08:57:38.2742456Z  for setting in exp_settings: 2025-12-04T08:57:38.2743121Z  if setting not in Experiment._fields: 2025-12-04T08:57:38.2743833Z  log.warning( 2025-12-04T08:57:38.2745441Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:57:38.2746353Z  ) 2025-12-04T08:57:38.2746901Z  else: 2025-12-04T08:57:38.2747590Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:57:38.2748291Z  2025-12-04T08:57:38.2748852Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:57:38.2749668Z  return Settings(experiments) 2025-12-04T08:57:38.2750273Z  2025-12-04T08:57:38.2750750Z  except Exception: 2025-12-04T08:57:38.2751404Z  log.exception("Failed to parse settings") 2025-12-04T08:57:38.2752039Z  2025-12-04T08:57:38.2752508Z  return Settings() 2025-12-04T08:57:38.2753029Z  2025-12-04T08:57:38.2753530Z  2025-12-04T08:57:38.2754176Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:57:38.2754979Z  """ 2025-12-04T08:57:38.2755591Z  Parse settings, if any, from the rollout state. 2025-12-04T08:57:38.2756263Z  2025-12-04T08:57:38.2756936Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:57:38.2757839Z  and the text below is the list of opted in users. 2025-12-04T08:57:38.2758516Z  2025-12-04T08:57:38.2759205Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:57:38.2760072Z  """ 2025-12-04T08:57:38.2760766Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:57:38.2761661Z  return parse_settings_from_text(settings_text) 2025-12-04T08:57:38.2762348Z  2025-12-04T08:57:38.2762766Z  2025-12-04T08:57:38.2763342Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:57:38.2764001Z  """ 2025-12-04T08:57:38.2764608Z  Parse users from the rollout state. 2025-12-04T08:57:38.2765252Z  2025-12-04T08:57:38.2765695Z  """ 2025-12-04T08:57:38.2766383Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:57:38.2767225Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:57:38.2767904Z  2025-12-04T08:57:38.2768324Z  2025-12-04T08:57:38.2769086Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:57:38.2769971Z  """ 2025-12-04T08:57:38.2770513Z  Check if a user is opted into an experiment 2025-12-04T08:57:38.2771167Z  """ 2025-12-04T08:57:38.2771720Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:57:38.2772576Z  2025-12-04T08:57:38.2772990Z  2025-12-04T08:57:38.2773723Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:57:38.2774773Z  """ 2025-12-04T08:57:38.2775347Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:57:38.2776029Z  """ 2025-12-04T08:57:38.2776702Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:57:38.2777557Z  experiment_optout = "-" + experiment_name 2025-12-04T08:57:38.2778308Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:57:38.2779092Z  return False 2025-12-04T08:57:38.2779628Z  2025-12-04T08:57:38.2780177Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:57:38.2780938Z  log.warning( 2025-12-04T08:57:38.2781881Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:57:38.2782860Z  ) 2025-12-04T08:57:38.2783371Z  2025-12-04T08:57:38.2783798Z  return True 2025-12-04T08:57:38.2784311Z  2025-12-04T08:57:38.2784834Z  2025-12-04T08:57:38.2785342Z def get_runner_prefix( 2025-12-04T08:57:38.2785892Z  rollout_state: str, 2025-12-04T08:57:38.2786541Z  workflow_requestors: Iterable[str], 2025-12-04T08:57:38.2787168Z  branch: str, 2025-12-04T08:57:38.2787834Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:57:38.2788678Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:57:38.2789386Z  is_canary: bool = False, 2025-12-04T08:57:38.2789976Z ) -> str: 2025-12-04T08:57:38.2790511Z  settings = parse_settings(rollout_state) 2025-12-04T08:57:38.2791277Z  user_optins = parse_users(rollout_state) 2025-12-04T08:57:38.2791924Z  2025-12-04T08:57:38.2792453Z  fleet_prefix = "" 2025-12-04T08:57:38.2793063Z  prefixes = [] 2025-12-04T08:57:38.2793811Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:57:38.2794951Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:57:38.2795784Z  log.info( 2025-12-04T08:57:38.2796609Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:57:38.2797472Z  ) 2025-12-04T08:57:38.2798052Z  continue 2025-12-04T08:57:38.2798581Z  2025-12-04T08:57:38.2799020Z  if opt_out_experiments: 2025-12-04T08:57:38.2799745Z  if experiment_name in opt_out_experiments: 2025-12-04T08:57:38.2800532Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:57:38.2801372Z  log.info( 2025-12-04T08:57:38.2912449Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:57:38.2913599Z  ) 2025-12-04T08:57:38.2914067Z  continue 2025-12-04T08:57:38.2914698Z  2025-12-04T08:57:38.2915307Z  if eligible_experiments: 2025-12-04T08:57:38.2915956Z  if experiment_name not in eligible_experiments: 2025-12-04T08:57:38.2916683Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:57:38.2917303Z  log.info( 2025-12-04T08:57:38.2918163Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:57:38.2919031Z  ) 2025-12-04T08:57:38.2919953Z  continue 2025-12-04T08:57:38.2920518Z  elif not experiment_settings.default: 2025-12-04T08:57:38.2921119Z  log.info( 2025-12-04T08:57:38.2921850Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:57:38.2922637Z  ) 2025-12-04T08:57:38.2923107Z  continue 2025-12-04T08:57:38.2923571Z  2025-12-04T08:57:38.2924089Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:57:38.2924897Z  opted_out_users = [ 2025-12-04T08:57:38.2925436Z  requestor 2025-12-04T08:57:38.2925976Z  for requestor in workflow_requestors 2025-12-04T08:57:38.2926722Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:57:38.2927393Z  ] 2025-12-04T08:57:38.2927801Z  2025-12-04T08:57:38.2928215Z  if opted_out_users: 2025-12-04T08:57:38.2928783Z  log.info( 2025-12-04T08:57:38.2929492Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:57:38.2930224Z  ) 2025-12-04T08:57:38.2930669Z  continue 2025-12-04T08:57:38.2931123Z  2025-12-04T08:57:38.2931635Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:57:38.2932320Z  opted_in_users = [ 2025-12-04T08:57:38.2932851Z  requestor 2025-12-04T08:57:38.2933395Z  for requestor in workflow_requestors 2025-12-04T08:57:38.2934108Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:57:38.2934949Z  ] 2025-12-04T08:57:38.2935366Z  2025-12-04T08:57:38.2935770Z  enabled = False 2025-12-04T08:57:38.2936294Z  if opted_in_users: 2025-12-04T08:57:38.2936984Z  log.info( 2025-12-04T08:57:38.2937694Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:57:38.2938417Z  ) 2025-12-04T08:57:38.2938885Z  enabled = True 2025-12-04T08:57:38.2939374Z  2025-12-04T08:57:38.2939839Z  elif experiment_settings.rollout_perc: 2025-12-04T08:57:38.2940755Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:57:38.2941762Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:57:38.2942459Z  log.info( 2025-12-04T08:57:38.2943383Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:57:38.2944328Z  ) 2025-12-04T08:57:38.2944909Z  enabled = True 2025-12-04T08:57:38.2945417Z  2025-12-04T08:57:38.2945807Z  if enabled: 2025-12-04T08:57:38.2946304Z  label = experiment_name 2025-12-04T08:57:38.2946920Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:57:38.2947798Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:57:38.2948729Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:57:38.2949547Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:57:38.2950249Z  if is_canary: 2025-12-04T08:57:38.2950817Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:57:38.2951409Z  fleet_prefix = label 2025-12-04T08:57:38.2951953Z  else: 2025-12-04T08:57:38.2952552Z  prefixes.append(label) 2025-12-04T08:57:38.2953087Z  2025-12-04T08:57:38.2953487Z  if len(prefixes) > 1: 2025-12-04T08:57:38.2953991Z  log.error( 2025-12-04T08:57:38.2955405Z  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-12-04T08:57:38.2956568Z  ) 2025-12-04T08:57:38.2957016Z  prefixes = prefixes[:1] 2025-12-04T08:57:38.2957529Z  2025-12-04T08:57:38.2957944Z  # Fleet always comes first 2025-12-04T08:57:38.2958484Z  if fleet_prefix: 2025-12-04T08:57:38.2958999Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:57:38.2959557Z  2025-12-04T08:57:38.2960041Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:57:38.2960653Z  2025-12-04T08:57:38.2961012Z  2025-12-04T08:57:38.2961693Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:57:38.2962491Z  """ 2025-12-04T08:57:38.2963135Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:57:38.2963881Z  2025-12-04T08:57:38.2964620Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:57:38.2965364Z  """ 2025-12-04T08:57:38.2965811Z  gh = get_gh_client(github_token) 2025-12-04T08:57:38.2966423Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:57:38.2967116Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:57:38.2967755Z  2025-12-04T08:57:38.2968134Z  2025-12-04T08:57:38.2968767Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:57:38.2969697Z  for _ in range(num_retries): 2025-12-04T08:57:38.2970224Z  try: 2025-12-04T08:57:38.2970721Z  req = Request(url=url, headers=headers) 2025-12-04T08:57:38.2971438Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:57:38.2972143Z  return json.loads(content) 2025-12-04T08:57:38.2972739Z  except Exception as e: 2025-12-04T08:57:38.2973355Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:57:38.2973952Z  2025-12-04T08:57:38.2974733Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:57:38.2975504Z  return {} 2025-12-04T08:57:38.2975947Z  2025-12-04T08:57:38.2976322Z  2025-12-04T08:57:38.2976691Z @cache 2025-12-04T08:57:38.2977380Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:57:38.2978186Z  """ 2025-12-04T08:57:38.2978628Z  Dynamically get PR information 2025-12-04T08:57:38.2979181Z  """ 2025-12-04T08:57:38.2979734Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:57:38.2980401Z  headers = { 2025-12-04T08:57:38.2980934Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:57:38.2981607Z  "Authorization": f"token {github_token}", 2025-12-04T08:57:38.2982171Z  } 2025-12-04T08:57:38.2982660Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:57:38.2983319Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:57:38.2983897Z  headers=headers, 2025-12-04T08:57:38.2984378Z  ) 2025-12-04T08:57:38.2985226Z  2025-12-04T08:57:38.2985645Z  if not json_response: 2025-12-04T08:57:38.2986307Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:57:38.2987067Z  return {} 2025-12-04T08:57:38.2987522Z  2025-12-04T08:57:38.2987916Z  return json_response 2025-12-04T08:57:38.2988404Z  2025-12-04T08:57:38.2988766Z  2025-12-04T08:57:38.2989398Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:57:38.2990162Z  """ 2025-12-04T08:57:38.2990751Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:57:38.2991444Z  """ 2025-12-04T08:57:38.2991978Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:57:38.2992635Z  return { 2025-12-04T08:57:38.2993277Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:57:38.2994004Z  } 2025-12-04T08:57:38.2994392Z  2025-12-04T08:57:38.2995015Z  2025-12-04T08:57:38.2995410Z def main() -> None: 2025-12-04T08:57:38.2995907Z  args = parse_args() 2025-12-04T08:57:38.2996395Z  2025-12-04T08:57:38.2996854Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:57:38.2997433Z  2025-12-04T08:57:38.2997841Z  # Check if the PR is opt-out 2025-12-04T08:57:38.2998389Z  if args.pr_number: 2025-12-04T08:57:38.2999116Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:57:38.2999922Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:57:38.3000474Z  log.info( 2025-12-04T08:57:38.3001237Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:57:38.3002033Z  ) 2025-12-04T08:57:38.3002660Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:57:38.3003376Z  sys.exit() 2025-12-04T08:57:38.3003961Z  2025-12-04T08:57:38.3004343Z  try: 2025-12-04T08:57:38.3004956Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:57:38.3005716Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:57:38.3006399Z  ) 2025-12-04T08:57:38.3006801Z  2025-12-04T08:57:38.3007252Z  username = get_potential_pr_author( 2025-12-04T08:57:38.3007823Z  args.github_token, 2025-12-04T08:57:38.3008366Z  args.github_repo, 2025-12-04T08:57:38.3008894Z  args.github_actor, 2025-12-04T08:57:38.3009443Z  args.github_ref_type, 2025-12-04T08:57:38.3010001Z  args.github_branch, 2025-12-04T08:57:38.3010530Z  ) 2025-12-04T08:57:38.3010941Z  2025-12-04T08:57:38.3011451Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:57:38.3012095Z  2025-12-04T08:57:38.3012539Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:57:38.3013132Z  rollout_state, 2025-12-04T08:57:38.3013700Z  (args.github_issue_owner, username), 2025-12-04T08:57:38.3014282Z  args.github_branch, 2025-12-04T08:57:38.3015002Z  args.eligible_experiments, 2025-12-04T08:57:38.3015590Z  args.opt_out_experiments, 2025-12-04T08:57:38.3016148Z  is_canary, 2025-12-04T08:57:38.3016614Z  ) 2025-12-04T08:57:38.3017029Z  2025-12-04T08:57:38.3017424Z  except Exception as e: 2025-12-04T08:57:38.3017945Z  log.error( 2025-12-04T08:57:38.3018715Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:57:38.3019587Z  ) 2025-12-04T08:57:38.3020005Z  2025-12-04T08:57:38.3020561Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:57:38.3021243Z  2025-12-04T08:57:38.3021605Z  2025-12-04T08:57:38.3022000Z if __name__ == "__main__": 2025-12-04T08:57:38.3022491Z  main() 2025-12-04T08:57:38.3022905Z  2025-12-04T08:57:38.3023280Z EOF 2025-12-04T08:57:38.3023661Z  2025-12-04T08:57:38.3024074Z cat runner_determinator.py 2025-12-04T08:57:38.3721240Z shell: /usr/bin/bash -e {0} 2025-12-04T08:57:38.3722197Z env: 2025-12-04T08:57:38.3722997Z GITHUB_TOKEN: *** 2025-12-04T08:57:38.3723429Z ISSUE_NUMBER: 5132 2025-12-04T08:57:38.3723887Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:57:38.3724395Z ISSUE_OWNER: 2025-12-04T08:57:38.3725065Z CHECK_EXPERIMENTS: 2025-12-04T08:57:38.3725501Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:57:38.3725947Z PR_NUMBER: 2025-12-04T08:57:38.3726376Z ##[endgroup] 2025-12-04T08:57:38.3925737Z # flake8: noqa: G004 2025-12-04T08:57:38.3926167Z 2025-12-04T08:57:38.3926610Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:57:38.3927572Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:57:38.3928385Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:57:38.3928836Z 2025-12-04T08:57:38.3929004Z """ 2025-12-04T08:57:38.3929586Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:57:38.3930450Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:57:38.3931364Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:57:38.3932170Z of which runners should be used to run which job. 2025-12-04T08:57:38.3932579Z 2025-12-04T08:57:38.3932959Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:57:38.3934118Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:57:38.3935223Z settings are considered to be empty with only the second part, the user 2025-12-04T08:57:38.3935939Z list, defined. 2025-12-04T08:57:38.3936170Z 2025-12-04T08:57:38.3936536Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:57:38.3937485Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:57:38.3939270Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:57:38.3939742Z 2025-12-04T08:57:38.3940117Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:57:38.3941004Z The user list is also a comma separated list of additional features or 2025-12-04T08:57:38.3941875Z experiments which the user could be opted in to. 2025-12-04T08:57:38.3942405Z 2025-12-04T08:57:38.3942615Z The user list has the following rules: 2025-12-04T08:57:38.3942979Z 2025-12-04T08:57:38.3943296Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:57:38.3944185Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:57:38.3945251Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:57:38.3945653Z 2025-12-04T08:57:38.3945827Z Example config: 2025-12-04T08:57:38.3946306Z # A list of experiments that can be opted into. 2025-12-04T08:57:38.3946985Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:57:38.3947635Z # Expected syntax is: 2025-12-04T08:57:38.3948287Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:57:38.3949285Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:57:38.3949893Z 2025-12-04T08:57:38.3950082Z experiments: 2025-12-04T08:57:38.3950480Z lf: 2025-12-04T08:57:38.3950884Z rollout_percent: 25 2025-12-04T08:57:38.3951559Z all_branches: false 2025-12-04T08:57:38.3952050Z default: true 2025-12-04T08:57:38.3952471Z --- 2025-12-04T08:57:38.3952686Z 2025-12-04T08:57:38.3952858Z # Opt-ins: 2025-12-04T08:57:38.3953453Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:57:38.3954342Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:57:38.3955354Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:57:38.3956066Z # Experiments should be from the above list. 2025-12-04T08:57:38.3956459Z 2025-12-04T08:57:38.3956660Z @User1,-lf,split_build 2025-12-04T08:57:38.3957114Z @User2,lf 2025-12-04T08:57:38.3957536Z @User3,split_build 2025-12-04T08:57:38.3957954Z """ 2025-12-04T08:57:38.3958175Z 2025-12-04T08:57:38.3958344Z import json 2025-12-04T08:57:38.3958732Z import logging 2025-12-04T08:57:38.3959131Z import os 2025-12-04T08:57:38.3959513Z import random 2025-12-04T08:57:38.3959916Z import re 2025-12-04T08:57:38.3960293Z import sys 2025-12-04T08:57:38.3960718Z from argparse import ArgumentParser 2025-12-04T08:57:38.3961287Z from collections.abc import Iterable 2025-12-04T08:57:38.3961830Z from functools import cache 2025-12-04T08:57:38.3962326Z from logging import LogRecord 2025-12-04T08:57:38.3962821Z from typing import Any, NamedTuple 2025-12-04T08:57:38.3963382Z from urllib.request import Request, urlopen 2025-12-04T08:57:38.3963755Z 2025-12-04T08:57:38.3963926Z import yaml 2025-12-04T08:57:38.3964330Z from github import Auth, Github 2025-12-04T08:57:38.3965091Z from github.Issue import Issue 2025-12-04T08:57:38.3965420Z 2025-12-04T08:57:38.3965428Z 2025-12-04T08:57:38.3965660Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:57:38.3966368Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:57:38.3967258Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:57:38.3967822Z 2025-12-04T08:57:38.3968078Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:57:38.3968843Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:57:38.3969391Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:57:38.3969948Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:57:38.3970323Z 2025-12-04T08:57:38.3970523Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:57:38.3970870Z 2025-12-04T08:57:38.3971068Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:57:38.3971538Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:57:38.3971850Z 2025-12-04T08:57:38.3971857Z 2025-12-04T08:57:38.3972058Z class Experiment(NamedTuple): 2025-12-04T08:57:38.3972548Z rollout_perc: float = ( 2025-12-04T08:57:38.3973194Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:57:38.3973864Z ) 2025-12-04T08:57:38.3974243Z all_branches: bool = ( 2025-12-04T08:57:38.3975128Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:57:38.3975805Z ) 2025-12-04T08:57:38.3976193Z default: bool = ( 2025-12-04T08:57:38.3976780Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:57:38.3977441Z ) 2025-12-04T08:57:38.3977648Z 2025-12-04T08:57:38.3977834Z # Add more fields as needed 2025-12-04T08:57:38.3978152Z 2025-12-04T08:57:38.3978158Z 2025-12-04T08:57:38.3978347Z class Settings(NamedTuple): 2025-12-04T08:57:38.3978806Z """ 2025-12-04T08:57:38.3979265Z Settings for the experiments that can be opted into. 2025-12-04T08:57:38.3979849Z """ 2025-12-04T08:57:38.3980052Z 2025-12-04T08:57:38.3980265Z experiments: dict[str, Experiment] = {} 2025-12-04T08:57:38.3980641Z 2025-12-04T08:57:38.3980647Z 2025-12-04T08:57:38.3980860Z class ColorFormatter(logging.Formatter): 2025-12-04T08:57:38.3981487Z """Color codes the log messages based on the log level""" 2025-12-04T08:57:38.3981935Z 2025-12-04T08:57:38.3982108Z COLORS = { 2025-12-04T08:57:38.3982525Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:57:38.3983194Z "ERROR": "\033[31m", # Red 2025-12-04T08:57:38.3983735Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:57:38.3984243Z "INFO": "\033[0m", # Reset 2025-12-04T08:57:38.3984949Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:57:38.3985435Z } 2025-12-04T08:57:38.3985645Z 2025-12-04T08:57:38.3985873Z def format(self, record: LogRecord) -> str: 2025-12-04T08:57:38.3986635Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:57:38.3987430Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:57:38.3988041Z return super().format(record) 2025-12-04T08:57:38.3988387Z 2025-12-04T08:57:38.3988394Z 2025-12-04T08:57:38.3988600Z handler = logging.StreamHandler() 2025-12-04T08:57:38.3989331Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:57:38.3989895Z 2025-12-04T08:57:38.3990146Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:57:38.3990762Z log.addHandler(handler) 2025-12-04T08:57:38.3991215Z log.setLevel(logging.INFO) 2025-12-04T08:57:38.3991512Z 2025-12-04T08:57:38.3991518Z 2025-12-04T08:57:38.3991766Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:57:38.3992333Z """ 2025-12-04T08:57:38.3992828Z Defines outputs of the github action that invokes this script 2025-12-04T08:57:38.3993469Z """ 2025-12-04T08:57:38.3993844Z if not GITHUB_OUTPUT: 2025-12-04T08:57:38.3995013Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:57:38.3996123Z log.warning( 2025-12-04T08:57:38.3996965Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:57:38.3997900Z ) 2025-12-04T08:57:38.4010808Z print(f"::set-output name={key}::{value}") 2025-12-04T08:57:38.4011480Z return 2025-12-04T08:57:38.4011745Z 2025-12-04T08:57:38.4012187Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:57:38.4012775Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:57:38.4013347Z f.write(f"{key}={value}\n") 2025-12-04T08:57:38.4013685Z 2025-12-04T08:57:38.4013693Z 2025-12-04T08:57:38.4013992Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:57:38.4014777Z return frozenset( 2025-12-04T08:57:38.4015393Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:57:38.4016086Z ) 2025-12-04T08:57:38.4016287Z 2025-12-04T08:57:38.4016294Z 2025-12-04T08:57:38.4016513Z def parse_args() -> Any: 2025-12-04T08:57:38.4017137Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:57:38.4017988Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:57:38.4018753Z parser.add_argument( 2025-12-04T08:57:38.4019214Z "--github-issue-repo", 2025-12-04T08:57:38.4019684Z type=str, 2025-12-04T08:57:38.4020091Z required=False, 2025-12-04T08:57:38.4020538Z default="pytorch/test-infra", 2025-12-04T08:57:38.4021078Z help="GitHub repo to get the issue", 2025-12-04T08:57:38.4021580Z ) 2025-12-04T08:57:38.4021952Z parser.add_argument( 2025-12-04T08:57:38.4022404Z "--github-repo", 2025-12-04T08:57:38.4022838Z type=str, 2025-12-04T08:57:38.4023238Z required=True, 2025-12-04T08:57:38.4023707Z help="GitHub repo where CI is running", 2025-12-04T08:57:38.4024239Z ) 2025-12-04T08:57:38.4024849Z parser.add_argument( 2025-12-04T08:57:38.4025490Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:57:38.4026141Z ) 2025-12-04T08:57:38.4026519Z parser.add_argument( 2025-12-04T08:57:38.4027134Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:57:38.4027815Z ) 2025-12-04T08:57:38.4028179Z parser.add_argument( 2025-12-04T08:57:38.4028958Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:57:38.4029646Z ) 2025-12-04T08:57:38.4030020Z parser.add_argument( 2025-12-04T08:57:38.4030689Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:57:38.4031407Z ) 2025-12-04T08:57:38.4031793Z parser.add_argument( 2025-12-04T08:57:38.4032255Z "--github-ref-type", 2025-12-04T08:57:38.4032712Z type=str, 2025-12-04T08:57:38.4033108Z required=True, 2025-12-04T08:57:38.4033602Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:57:38.4034147Z ) 2025-12-04T08:57:38.4034620Z parser.add_argument( 2025-12-04T08:57:38.4035078Z "--eligible-experiments", 2025-12-04T08:57:38.4035596Z type=_str_comma_separated_to_set, 2025-12-04T08:57:38.4036118Z required=False, 2025-12-04T08:57:38.4036536Z default="", 2025-12-04T08:57:38.4037409Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:57:38.4038332Z ) 2025-12-04T08:57:38.4038728Z parser.add_argument( 2025-12-04T08:57:38.4039192Z "--opt-out-experiments", 2025-12-04T08:57:38.4039716Z type=_str_comma_separated_to_set, 2025-12-04T08:57:38.4040240Z required=False, 2025-12-04T08:57:38.4040666Z default="", 2025-12-04T08:57:38.4041064Z help=( 2025-12-04T08:57:38.4041724Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:57:38.4042834Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:57:38.4043655Z ), 2025-12-04T08:57:38.4044014Z ) 2025-12-04T08:57:38.4044383Z parser.add_argument( 2025-12-04T08:57:38.4045051Z "--pr-number", 2025-12-04T08:57:38.4045472Z type=str, 2025-12-04T08:57:38.4045896Z required=False, 2025-12-04T08:57:38.4046334Z default="", 2025-12-04T08:57:38.4046946Z help="the optional PR number where this is run", 2025-12-04T08:57:38.4047521Z ) 2025-12-04T08:57:38.4047723Z 2025-12-04T08:57:38.4047912Z return parser.parse_args() 2025-12-04T08:57:38.4048228Z 2025-12-04T08:57:38.4048234Z 2025-12-04T08:57:38.4048630Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:57:38.4049375Z auth = Auth.Token(github_token) 2025-12-04T08:57:38.4049885Z return Github(auth=auth) 2025-12-04T08:57:38.4050181Z 2025-12-04T08:57:38.4050188Z 2025-12-04T08:57:38.4050650Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:57:38.4051441Z repo = gh.get_repo(repo) 2025-12-04T08:57:38.4051946Z return repo.get_issue(number=issue_num) 2025-12-04T08:57:38.4052303Z 2025-12-04T08:57:38.4052311Z 2025-12-04T08:57:38.4052504Z def get_potential_pr_author( 2025-12-04T08:57:38.4053160Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:57:38.4053831Z ) -> str: 2025-12-04T08:57:38.4054350Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:57:38.4055339Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:57:38.4056105Z # embedded in the tag name: ciflow// 2025-12-04T08:57:38.4056515Z 2025-12-04T08:57:38.4056713Z gh = get_gh_client(github_token) 2025-12-04T08:57:38.4057047Z 2025-12-04T08:57:38.4057313Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:57:38.4057942Z split_tag = ref_name.split("/") 2025-12-04T08:57:38.4058443Z if ( 2025-12-04T08:57:38.4058843Z len(split_tag) == 3 2025-12-04T08:57:38.4059334Z and split_tag[0] == "ciflow" 2025-12-04T08:57:38.4060158Z and split_tag[2].isnumeric() 2025-12-04T08:57:38.4061080Z ): 2025-12-04T08:57:38.4061648Z pr_number = split_tag[2] 2025-12-04T08:57:38.4062294Z try: 2025-12-04T08:57:38.4062737Z repository = gh.get_repo(repo) 2025-12-04T08:57:38.4063359Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:57:38.4063960Z except Exception as e: 2025-12-04T08:57:38.4064604Z raise Exception( # noqa: TRY002 2025-12-04T08:57:38.4065283Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:57:38.4065927Z ) from e 2025-12-04T08:57:38.4066479Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:57:38.4067174Z # In all other cases, return the original input username 2025-12-04T08:57:38.4067786Z return username 2025-12-04T08:57:38.4068033Z 2025-12-04T08:57:38.4068040Z 2025-12-04T08:57:38.4068269Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:57:38.4068829Z """ 2025-12-04T08:57:38.4069471Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:57:38.4070258Z """ 2025-12-04T08:57:38.4070812Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:57:38.4071328Z 2025-12-04T08:57:38.4071335Z 2025-12-04T08:57:38.4071531Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:57:38.4072031Z try: 2025-12-04T08:57:38.4072424Z data = yaml.safe_load(yaml_text) 2025-12-04T08:57:38.4072938Z return data 2025-12-04T08:57:38.4073363Z except yaml.YAMLError: 2025-12-04T08:57:38.4073856Z log.exception("Error loading YAML") 2025-12-04T08:57:38.4074371Z raise 2025-12-04T08:57:38.4074775Z 2025-12-04T08:57:38.4074782Z 2025-12-04T08:57:38.4075212Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:57:38.4075955Z """ 2025-12-04T08:57:38.4076577Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:57:38.4077186Z 2025-12-04T08:57:38.4077649Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:57:38.4078399Z and the text below is the list of opted in users. 2025-12-04T08:57:38.4078814Z 2025-12-04T08:57:38.4079185Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:57:38.4079883Z """ 2025-12-04T08:57:38.4080327Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:57:38.4080974Z if len(rollout_state_parts) >= 2: 2025-12-04T08:57:38.4081581Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:57:38.4082171Z else: 2025-12-04T08:57:38.4082551Z return "", rollout_state 2025-12-04T08:57:38.4082869Z 2025-12-04T08:57:38.4082877Z 2025-12-04T08:57:38.4083077Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:57:38.4083592Z """ 2025-12-04T08:57:38.4084104Z Dictionary of users with a list of features they have opted into 2025-12-04T08:57:38.4084898Z """ 2025-12-04T08:57:38.4085106Z 2025-12-04T08:57:38.4085112Z 2025-12-04T08:57:38.4085451Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:57:38.4086109Z """ 2025-12-04T08:57:38.4086807Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:57:38.4087500Z 2025-12-04T08:57:38.4088109Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:57:38.4089097Z - Example line: "@User1,lf,split_build" 2025-12-04T08:57:38.4089774Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:57:38.4090258Z 2025-12-04T08:57:38.4090265Z 2025-12-04T08:57:38.4090424Z """ 2025-12-04T08:57:38.4090801Z optins = UserOptins() 2025-12-04T08:57:38.4091301Z for user in user_optin_text.split("\n"): 2025-12-04T08:57:38.4091856Z user = user.strip("\r\n\t -") 2025-12-04T08:57:38.4092412Z if not user or not user.startswith("@"): 2025-12-04T08:57:38.4093100Z # Not a valid user. Skip 2025-12-04T08:57:38.4093583Z continue 2025-12-04T08:57:38.4093832Z 2025-12-04T08:57:38.4094005Z if user: 2025-12-04T08:57:38.4094447Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:57:38.4095239Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:57:38.4095734Z 2025-12-04T08:57:38.4095902Z return optins 2025-12-04T08:57:38.4096150Z 2025-12-04T08:57:38.4096157Z 2025-12-04T08:57:38.4096438Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:57:38.4097038Z """ 2025-12-04T08:57:38.4097430Z Check if the experiment name is valid. 2025-12-04T08:57:38.4097955Z A valid name: 2025-12-04T08:57:38.4098586Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:57:38.4099538Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:57:38.4100253Z - Cannot contain spaces 2025-12-04T08:57:38.4100715Z """ 2025-12-04T08:57:38.4100912Z 2025-12-04T08:57:38.4101182Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:57:38.4101870Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:57:38.4102306Z 2025-12-04T08:57:38.4102475Z if valid: 2025-12-04T08:57:38.4102852Z return True 2025-12-04T08:57:38.4103098Z 2025-12-04T08:57:38.4103261Z log.error( 2025-12-04T08:57:38.4105154Z 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-12-04T08:57:38.4106851Z ) 2025-12-04T08:57:38.4107219Z return False 2025-12-04T08:57:38.4107461Z 2025-12-04T08:57:38.4107468Z 2025-12-04T08:57:38.4107769Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:57:38.4108405Z """ 2025-12-04T08:57:38.4109099Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:57:38.4109833Z """ 2025-12-04T08:57:38.4110187Z try: 2025-12-04T08:57:38.4110552Z if settings_text: 2025-12-04T08:57:38.4111274Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:57:38.4112061Z # for easy reading 2025-12-04T08:57:38.4112852Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:57:38.4113729Z # the backtick character in shell commands. 2025-12-04T08:57:38.4114344Z backtick = chr(96) # backtick character 2025-12-04T08:57:38.4115092Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:57:38.4115759Z settings = load_yaml(settings_text) 2025-12-04T08:57:38.4116124Z 2025-12-04T08:57:38.4116538Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:57:38.4117290Z experiments = {} 2025-12-04T08:57:38.4117593Z 2025-12-04T08:57:38.4118004Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:57:38.4118760Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:57:38.4119842Z # 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-12-04T08:57:38.4120868Z continue 2025-12-04T08:57:38.4121152Z 2025-12-04T08:57:38.4121336Z valid_settings = {} 2025-12-04T08:57:38.4121856Z for setting in exp_settings: 2025-12-04T08:57:38.4122420Z if setting not in Experiment._fields: 2025-12-04T08:57:38.4122981Z log.warning( 2025-12-04T08:57:38.4123676Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:57:38.4124482Z ) 2025-12-04T08:57:38.4125001Z else: 2025-12-04T08:57:38.4125515Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:57:38.4125939Z 2025-12-04T08:57:38.4126233Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:57:38.4126868Z return Settings(experiments) 2025-12-04T08:57:38.4127222Z 2025-12-04T08:57:38.4127397Z except Exception: 2025-12-04T08:57:38.4127880Z log.exception("Failed to parse settings") 2025-12-04T08:57:38.4128272Z 2025-12-04T08:57:38.4128443Z return Settings() 2025-12-04T08:57:38.4128698Z 2025-12-04T08:57:38.4128705Z 2025-12-04T08:57:38.4128964Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:57:38.4129524Z """ 2025-12-04T08:57:38.4129971Z Parse settings, if any, from the rollout state. 2025-12-04T08:57:38.4130374Z 2025-12-04T08:57:38.4130725Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:57:38.4131491Z and the text below is the list of opted in users. 2025-12-04T08:57:38.4131890Z 2025-12-04T08:57:38.4132309Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:57:38.4133033Z """ 2025-12-04T08:57:38.4133582Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:57:38.4134319Z return parse_settings_from_text(settings_text) 2025-12-04T08:57:38.4134792Z 2025-12-04T08:57:38.4134799Z 2025-12-04T08:57:38.4135041Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:57:38.4135586Z """ 2025-12-04T08:57:38.4135980Z Parse users from the rollout state. 2025-12-04T08:57:38.4136327Z 2025-12-04T08:57:38.4136492Z """ 2025-12-04T08:57:38.4137009Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:57:38.4137750Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:57:38.4138147Z 2025-12-04T08:57:38.4138153Z 2025-12-04T08:57:38.4138631Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:57:38.4139365Z """ 2025-12-04T08:57:38.4139771Z Check if a user is opted into an experiment 2025-12-04T08:57:38.4140299Z """ 2025-12-04T08:57:38.4140749Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:57:38.4141161Z 2025-12-04T08:57:38.4141167Z 2025-12-04T08:57:38.4141573Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:57:38.4142305Z """ 2025-12-04T08:57:38.4142758Z Check if a user explicitly opted out of an experiment 2025-12-04T08:57:38.4143334Z """ 2025-12-04T08:57:38.4143824Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:57:38.4144568Z experiment_optout = "-" + experiment_name 2025-12-04T08:57:38.4145191Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:57:38.4145795Z return False 2025-12-04T08:57:38.4146048Z 2025-12-04T08:57:38.4146324Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:57:38.4146908Z log.warning( 2025-12-04T08:57:38.4147696Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:57:38.4148546Z ) 2025-12-04T08:57:38.4148758Z 2025-12-04T08:57:38.4148924Z return True 2025-12-04T08:57:38.4149153Z 2025-12-04T08:57:38.4149160Z 2025-12-04T08:57:38.4149341Z def get_runner_prefix( 2025-12-04T08:57:38.4149769Z rollout_state: str, 2025-12-04T08:57:38.4150227Z workflow_requestors: Iterable[str], 2025-12-04T08:57:38.4150733Z branch: str, 2025-12-04T08:57:38.4151223Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:57:38.4151871Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:57:38.4152453Z is_canary: bool = False, 2025-12-04T08:57:38.4152905Z ) -> str: 2025-12-04T08:57:38.4153423Z settings = parse_settings(rollout_state) 2025-12-04T08:57:38.4153995Z user_optins = parse_users(rollout_state) 2025-12-04T08:57:38.4154366Z 2025-12-04T08:57:38.4154607Z fleet_prefix = "" 2025-12-04T08:57:38.4155039Z prefixes = [] 2025-12-04T08:57:38.4155692Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:57:38.4156615Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:57:38.4157301Z log.info( 2025-12-04T08:57:38.4157964Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:57:38.4158701Z ) 2025-12-04T08:57:38.4159085Z continue 2025-12-04T08:57:38.4159329Z 2025-12-04T08:57:38.4159519Z if opt_out_experiments: 2025-12-04T08:57:38.4160054Z if experiment_name in opt_out_experiments: 2025-12-04T08:57:38.4160693Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:57:38.4161279Z log.info( 2025-12-04T08:57:38.4162221Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:57:38.4163173Z ) 2025-12-04T08:57:38.4163572Z continue 2025-12-04T08:57:38.4163835Z 2025-12-04T08:57:38.4164028Z if eligible_experiments: 2025-12-04T08:57:38.4164671Z if experiment_name not in eligible_experiments: 2025-12-04T08:57:38.4165303Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:57:38.4165856Z log.info( 2025-12-04T08:57:38.4166625Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:57:38.4167433Z ) 2025-12-04T08:57:38.4167844Z continue 2025-12-04T08:57:38.4168316Z elif not experiment_settings.default: 2025-12-04T08:57:38.4168844Z log.info( 2025-12-04T08:57:38.4169592Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:57:38.4170324Z ) 2025-12-04T08:57:38.4170703Z continue 2025-12-04T08:57:38.4170948Z 2025-12-04T08:57:38.4171221Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:57:38.4171833Z opted_out_users = [ 2025-12-04T08:57:38.4172276Z requestor 2025-12-04T08:57:38.4172740Z for requestor in workflow_requestors 2025-12-04T08:57:38.4173397Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:57:38.4174018Z ] 2025-12-04T08:57:38.4174226Z 2025-12-04T08:57:38.4174417Z if opted_out_users: 2025-12-04T08:57:38.4174919Z log.info( 2025-12-04T08:57:38.4175540Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:57:38.4176221Z ) 2025-12-04T08:57:38.4176609Z continue 2025-12-04T08:57:38.4176869Z 2025-12-04T08:57:38.4177144Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:57:38.4177776Z opted_in_users = [ 2025-12-04T08:57:38.4178219Z requestor 2025-12-04T08:57:38.4178677Z for requestor in workflow_requestors 2025-12-04T08:57:38.4179339Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:57:38.4179953Z ] 2025-12-04T08:57:38.4180155Z 2025-12-04T08:57:38.4180334Z enabled = False 2025-12-04T08:57:38.4180774Z if opted_in_users: 2025-12-04T08:57:38.4181225Z log.info( 2025-12-04T08:57:38.4181826Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:57:38.4182504Z ) 2025-12-04T08:57:38.4183050Z enabled = True 2025-12-04T08:57:38.4183513Z 2025-12-04T08:57:38.4183740Z elif experiment_settings.rollout_perc: 2025-12-04T08:57:38.4184711Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:57:38.4185738Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:57:38.4186384Z log.info( 2025-12-04T08:57:38.4187225Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:57:38.4188132Z ) 2025-12-04T08:57:38.4188538Z enabled = True 2025-12-04T08:57:38.4188848Z 2025-12-04T08:57:38.4189013Z if enabled: 2025-12-04T08:57:38.4189444Z label = experiment_name 2025-12-04T08:57:38.4189987Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:57:38.4190819Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:57:38.4191671Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:57:38.4192427Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:57:38.4193086Z if is_canary: 2025-12-04T08:57:38.4193580Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:57:38.4194125Z fleet_prefix = label 2025-12-04T08:57:38.4194663Z else: 2025-12-04T08:57:38.4195087Z prefixes.append(label) 2025-12-04T08:57:38.4195427Z 2025-12-04T08:57:38.4195606Z if len(prefixes) > 1: 2025-12-04T08:57:38.4196049Z log.error( 2025-12-04T08:57:38.4197045Z 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-12-04T08:57:38.4198129Z ) 2025-12-04T08:57:38.4198513Z prefixes = prefixes[:1] 2025-12-04T08:57:38.4198815Z 2025-12-04T08:57:38.4199009Z # Fleet always comes first 2025-12-04T08:57:38.4199473Z if fleet_prefix: 2025-12-04T08:57:38.4199916Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:57:38.4200335Z 2025-12-04T08:57:38.4200737Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:57:38.4201146Z 2025-12-04T08:57:38.4201153Z 2025-12-04T08:57:38.4201587Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:57:38.4202341Z """ 2025-12-04T08:57:38.4202911Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:57:38.4203452Z 2025-12-04T08:57:38.4203824Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:57:38.4204570Z """ 2025-12-04T08:57:38.4204948Z gh = get_gh_client(github_token) 2025-12-04T08:57:38.4205483Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:57:38.4206093Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:57:38.4206534Z 2025-12-04T08:57:38.4206542Z 2025-12-04T08:57:38.4206924Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:57:38.4207669Z for _ in range(num_retries): 2025-12-04T08:57:38.4208131Z try: 2025-12-04T08:57:38.4208553Z req = Request(url=url, headers=headers) 2025-12-04T08:57:38.4209201Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:57:38.4209836Z return json.loads(content) 2025-12-04T08:57:38.4210355Z except Exception as e: 2025-12-04T08:57:38.4210888Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:57:38.4211281Z 2025-12-04T08:57:38.4211662Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:57:38.4212348Z return {} 2025-12-04T08:57:38.4212567Z 2025-12-04T08:57:38.4212573Z 2025-12-04T08:57:38.4212740Z @cache 2025-12-04T08:57:38.4213339Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:57:38.4214081Z """ 2025-12-04T08:57:38.4214464Z Dynamically get PR information 2025-12-04T08:57:38.4215102Z """ 2025-12-04T08:57:38.4215584Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:57:38.4216199Z headers = { 2025-12-04T08:57:38.4216652Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:57:38.4217247Z "Authorization": f"token {github_token}", 2025-12-04T08:57:38.4217777Z } 2025-12-04T08:57:38.4218200Z json_response: dict[str, Any] = download_json( 2025-12-04T08:57:38.4218813Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:57:38.4219356Z headers=headers, 2025-12-04T08:57:38.4219792Z ) 2025-12-04T08:57:38.4219992Z 2025-12-04T08:57:38.4220174Z if not json_response: 2025-12-04T08:57:38.4220741Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:57:38.4221354Z return {} 2025-12-04T08:57:38.4221590Z 2025-12-04T08:57:38.4221768Z return json_response 2025-12-04T08:57:38.4222038Z 2025-12-04T08:57:38.4222044Z 2025-12-04T08:57:38.4222440Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:57:38.4223152Z """ 2025-12-04T08:57:38.4223672Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:57:38.4224303Z """ 2025-12-04T08:57:38.4224852Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:57:38.4225441Z return { 2025-12-04T08:57:38.4226048Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:57:38.4226732Z } 2025-12-04T08:57:38.4226928Z 2025-12-04T08:57:38.4226934Z 2025-12-04T08:57:38.4227105Z def main() -> None: 2025-12-04T08:57:38.4227522Z args = parse_args() 2025-12-04T08:57:38.4227787Z 2025-12-04T08:57:38.4228009Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:57:38.4228395Z 2025-12-04T08:57:38.4228585Z # Check if the PR is opt-out 2025-12-04T08:57:38.4229061Z if args.pr_number: 2025-12-04T08:57:38.4229706Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:57:38.4230527Z if OPT_OUT_LABEL in labels: 2025-12-04T08:57:38.4231012Z log.info( 2025-12-04T08:57:38.4231682Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:57:38.4232417Z ) 2025-12-04T08:57:38.4232954Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:57:38.4233605Z sys.exit() 2025-12-04T08:57:38.4233870Z 2025-12-04T08:57:38.4234037Z try: 2025-12-04T08:57:38.4234475Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:57:38.4235216Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:57:38.4235841Z ) 2025-12-04T08:57:38.4236045Z 2025-12-04T08:57:38.4236248Z username = get_potential_pr_author( 2025-12-04T08:57:38.4236779Z args.github_token, 2025-12-04T08:57:38.4237251Z args.github_repo, 2025-12-04T08:57:38.4237721Z args.github_actor, 2025-12-04T08:57:38.4238199Z args.github_ref_type, 2025-12-04T08:57:38.4238699Z args.github_branch, 2025-12-04T08:57:38.4239168Z ) 2025-12-04T08:57:38.4239370Z 2025-12-04T08:57:38.4239644Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:57:38.4240085Z 2025-12-04T08:57:38.4240311Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:57:38.4240858Z rollout_state, 2025-12-04T08:57:38.4241345Z (args.github_issue_owner, username), 2025-12-04T08:57:38.4241879Z args.github_branch, 2025-12-04T08:57:38.4242367Z args.eligible_experiments, 2025-12-04T08:57:38.4242889Z args.opt_out_experiments, 2025-12-04T08:57:38.4243391Z is_canary, 2025-12-04T08:57:38.4243808Z ) 2025-12-04T08:57:38.4244015Z 2025-12-04T08:57:38.4244197Z except Exception as e: 2025-12-04T08:57:38.4244708Z log.error( 2025-12-04T08:57:38.4245358Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:57:38.4246182Z ) 2025-12-04T08:57:38.4246387Z 2025-12-04T08:57:38.4246706Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:57:38.4247199Z 2025-12-04T08:57:38.4247206Z 2025-12-04T08:57:38.4247386Z if __name__ == "__main__": 2025-12-04T08:57:38.4247824Z main() 2025-12-04T08:57:38.4248030Z 2025-12-04T08:57:38.4341991Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:57:38.4342877Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:57:38.4363007Z shell: /usr/bin/bash -e {0} 2025-12-04T08:57:38.4363508Z env: 2025-12-04T08:57:38.4364194Z GITHUB_TOKEN: *** 2025-12-04T08:57:38.4364736Z ISSUE_NUMBER: 5132 2025-12-04T08:57:38.4365188Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:57:38.4365699Z ISSUE_OWNER: 2025-12-04T08:57:38.4366104Z CHECK_EXPERIMENTS: 2025-12-04T08:57:38.4366530Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:57:38.4366977Z PR_NUMBER: 2025-12-04T08:57:38.4367353Z ##[endgroup] 2025-12-04T08:57:38.8504819Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:57:39.3470508Z Collecting urllib3==1.26.18 2025-12-04T08:57:39.4025386Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:57:39.4280605Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.2 MB/s eta 0:00:00 2025-12-04T08:57:39.4571456Z Collecting PyGithub==2.3.0 2025-12-04T08:57:39.4677165Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:57:39.5182278Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:57:39.5285580Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:57:39.5334705Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:57:39.5356552Z 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-12-04T08:57:39.5373754Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:57:39.5685355Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:57:39.5788956Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:57:39.6012038Z 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-12-04T08:57:39.7286121Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:57:39.7391710Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:57:39.8914963Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:57:39.9020114Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:57:39.9292075Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:57:39.9395882Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:57:39.9701385Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:57:39.9825010Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 13.3 MB/s eta 0:00:00 2025-12-04T08:57:39.9946205Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:57:40.0065072Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 34.6 MB/s eta 0:00:00 2025-12-04T08:57:40.0170701Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:57:40.0329413Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 99.7 MB/s eta 0:00:00 2025-12-04T08:57:40.0430626Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:57:40.0561010Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:57:40.0608807Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 73.4 MB/s eta 0:00:00 2025-12-04T08:57:40.0712593Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:57:40.0761930Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 39.2 MB/s eta 0:00:00 2025-12-04T08:57:40.0863998Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:57:40.0916735Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 33.7 MB/s eta 0:00:00 2025-12-04T08:57:40.3803615Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:57:40.9286186Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:57:41.1152066Z ##[group]Run curr_branch="main" 2025-12-04T08:57:41.1152393Z curr_branch="main" 2025-12-04T08:57:41.1152622Z curr_ref_type="branch" 2025-12-04T08:57:41.1152878Z echo "Current branch is '$curr_branch'" 2025-12-04T08:57:41.1153155Z  2025-12-04T08:57:41.1153355Z python3 runner_determinator.py \ 2025-12-04T08:57:41.1153629Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:57:41.1153894Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:57:41.1154176Z  --github-branch "$curr_branch" \ 2025-12-04T08:57:41.1154464Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:57:41.1154889Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:57:41.1155170Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:57:41.1155449Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:57:41.1155743Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:57:41.1156130Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:57:41.1156412Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:57:41.1179078Z shell: /usr/bin/bash -e {0} 2025-12-04T08:57:41.1179359Z env: 2025-12-04T08:57:41.1180102Z GITHUB_TOKEN: *** 2025-12-04T08:57:41.1180299Z ISSUE_NUMBER: 5132 2025-12-04T08:57:41.1180509Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:57:41.1180735Z ISSUE_OWNER: 2025-12-04T08:57:41.1180917Z CHECK_EXPERIMENTS: 2025-12-04T08:57:41.1181113Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:57:41.1181315Z PR_NUMBER: 2025-12-04T08:57:41.1181483Z ##[endgroup] 2025-12-04T08:57:41.1225060Z Current branch is 'main' 2025-12-04T08:57:42.9964038Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:57:42.9965518Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:57:42.9967178Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:57:42.9968843Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:57:42.9970116Z INFO : Setting output: label-type='lf.' 2025-12-04T08:57:43.0426005Z Evaluate and set job outputs 2025-12-04T08:57:43.0433255Z Set output 'label-type' 2025-12-04T08:57:43.0435541Z Cleaning up orphan processes