2025-12-04T08:53:35.5243250Z Current runner version: '2.329.0' 2025-12-04T08:53:35.5265864Z ##[group]Runner Image Provisioner 2025-12-04T08:53:35.5266631Z Hosted Compute Agent 2025-12-04T08:53:35.5267336Z Version: 20251124.448 2025-12-04T08:53:35.5267918Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:53:35.5268643Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:53:35.5269599Z ##[endgroup] 2025-12-04T08:53:35.5270153Z ##[group]Operating System 2025-12-04T08:53:35.5270733Z Ubuntu 2025-12-04T08:53:35.5271268Z 24.04.3 2025-12-04T08:53:35.5271765Z LTS 2025-12-04T08:53:35.5272231Z ##[endgroup] 2025-12-04T08:53:35.5272802Z ##[group]Runner Image 2025-12-04T08:53:35.5273374Z Image: ubuntu-24.04 2025-12-04T08:53:35.5273888Z Version: 20251126.144.1 2025-12-04T08:53:35.5274966Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:53:35.5276533Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:53:35.5277599Z ##[endgroup] 2025-12-04T08:53:35.5278601Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:53:35.5280927Z Contents: read 2025-12-04T08:53:35.5281649Z Metadata: read 2025-12-04T08:53:35.5282121Z ##[endgroup] 2025-12-04T08:53:35.5284069Z Secret source: Actions 2025-12-04T08:53:35.5285002Z Prepare workflow directory 2025-12-04T08:53:35.5867948Z Prepare all required actions 2025-12-04T08:53:35.5922060Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:53:35.5926907Z ##[group] Inputs 2025-12-04T08:53:35.5927523Z check_experiments: 2025-12-04T08:53:35.5928227Z opt_out_experiments: 2025-12-04T08:53:35.5928817Z triggering_actor: pytorchmergebot 2025-12-04T08:53:35.5929616Z issue_owner: 2025-12-04T08:53:35.5930275Z curr_branch: main 2025-12-04T08:53:35.5930812Z curr_ref_type: branch 2025-12-04T08:53:35.5931437Z issue_number: 5132 2025-12-04T08:53:35.5932084Z ##[endgroup] 2025-12-04T08:53:35.5932761Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:53:36.2560181Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:53:36.2562768Z cat < runner_determinator.py 2025-12-04T08:53:36.2563421Z # flake8: noqa: G004 2025-12-04T08:53:36.2564130Z  2025-12-04T08:53:36.2564898Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:53:36.2565917Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:53:36.2566978Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:53:36.2567683Z  2025-12-04T08:53:36.2568148Z """ 2025-12-04T08:53:36.2568976Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:53:36.2570270Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:53:36.2571557Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:53:36.2572525Z of which runners should be used to run which job. 2025-12-04T08:53:36.2573207Z  2025-12-04T08:53:36.2573957Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:53:36.2575004Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:53:36.2576021Z settings are considered to be empty with only the second part, the user 2025-12-04T08:53:36.2576871Z list, defined. 2025-12-04T08:53:36.2577463Z  2025-12-04T08:53:36.2578116Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:53:36.2579224Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:53:36.2580365Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:53:36.2581104Z  2025-12-04T08:53:36.2582163Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:53:36.2583171Z The user list is also a comma separated list of additional features or 2025-12-04T08:53:36.2584053Z experiments which the user could be opted in to. 2025-12-04T08:53:36.2584679Z  2025-12-04T08:53:36.2585294Z The user list has the following rules: 2025-12-04T08:53:36.2585911Z  2025-12-04T08:53:36.2586522Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:53:36.2587594Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:53:36.2588461Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:53:36.2589113Z  2025-12-04T08:53:36.2589960Z Example config: 2025-12-04T08:53:36.2590669Z  # A list of experiments that can be opted into. 2025-12-04T08:53:36.2591495Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:53:36.2592344Z  # Expected syntax is: 2025-12-04T08:53:36.2593153Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:53:36.2594204Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:53:36.2595138Z  2025-12-04T08:53:36.2595605Z  experiments: 2025-12-04T08:53:36.2596144Z  lf: 2025-12-04T08:53:36.2596745Z  rollout_percent: 25 2025-12-04T08:53:36.2597323Z  all_branches: false 2025-12-04T08:53:36.2597918Z  default: true 2025-12-04T08:53:36.2598492Z  --- 2025-12-04T08:53:36.2598998Z  2025-12-04T08:53:36.2599657Z  # Opt-ins: 2025-12-04T08:53:36.2600486Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:53:36.2601696Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:53:36.2602607Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:53:36.2603494Z  # Experiments should be from the above list. 2025-12-04T08:53:36.2604138Z  2025-12-04T08:53:36.2604658Z  @User1,-lf,split_build 2025-12-04T08:53:36.2605309Z  @User2,lf 2025-12-04T08:53:36.2605836Z  @User3,split_build 2025-12-04T08:53:36.2606408Z """ 2025-12-04T08:53:36.2681001Z  2025-12-04T08:53:36.2681732Z import json 2025-12-04T08:53:36.2682604Z import logging 2025-12-04T08:53:36.2683354Z import os 2025-12-04T08:53:36.2684057Z import random 2025-12-04T08:53:36.2684790Z import re 2025-12-04T08:53:36.2685526Z import sys 2025-12-04T08:53:36.2686304Z from argparse import ArgumentParser 2025-12-04T08:53:36.2687102Z from collections.abc import Iterable 2025-12-04T08:53:36.2687719Z from functools import cache 2025-12-04T08:53:36.2688259Z from logging import LogRecord 2025-12-04T08:53:36.2688826Z from typing import Any, NamedTuple 2025-12-04T08:53:36.2689738Z from urllib.request import Request, urlopen 2025-12-04T08:53:36.2690326Z  2025-12-04T08:53:36.2690713Z import yaml 2025-12-04T08:53:36.2691206Z from github import Auth, Github 2025-12-04T08:53:36.2691775Z from github.Issue import Issue 2025-12-04T08:53:36.2692282Z  2025-12-04T08:53:36.2692646Z  2025-12-04T08:53:36.2693123Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:53:36.2693878Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:53:36.2694786Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:53:36.2695517Z  2025-12-04T08:53:36.2696216Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:53:36.2696843Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:53:36.2697431Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:53:36.2698042Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:53:36.2698582Z  2025-12-04T08:53:36.2699002Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:53:36.2700048Z  2025-12-04T08:53:36.2700455Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:53:36.2700979Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:53:36.2701473Z  2025-12-04T08:53:36.2701835Z  2025-12-04T08:53:36.2702240Z class Experiment(NamedTuple): 2025-12-04T08:53:36.2702784Z  rollout_perc: float = ( 2025-12-04T08:53:36.2703493Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:53:36.2704198Z  ) 2025-12-04T08:53:36.2704611Z  all_branches: bool = ( 2025-12-04T08:53:36.2705329Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:53:36.2706024Z  ) 2025-12-04T08:53:36.2706438Z  default: bool = ( 2025-12-04T08:53:36.2707126Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:53:36.2707816Z  ) 2025-12-04T08:53:36.2708204Z  2025-12-04T08:53:36.2708614Z  # Add more fields as needed 2025-12-04T08:53:36.2709127Z  2025-12-04T08:53:36.2709664Z  2025-12-04T08:53:36.2710075Z class Settings(NamedTuple): 2025-12-04T08:53:36.2710578Z  """ 2025-12-04T08:53:36.2711108Z  Settings for the experiments that can be opted into. 2025-12-04T08:53:36.2711712Z  """ 2025-12-04T08:53:36.2712112Z  2025-12-04T08:53:36.2712544Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:53:36.2713093Z  2025-12-04T08:53:36.2713598Z  2025-12-04T08:53:36.2714048Z class ColorFormatter(logging.Formatter): 2025-12-04T08:53:36.2714738Z  """Color codes the log messages based on the log level""" 2025-12-04T08:53:36.2715345Z  2025-12-04T08:53:36.2715720Z  COLORS = { 2025-12-04T08:53:36.2716203Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:53:36.2716751Z  "ERROR": "\033[31m", # Red 2025-12-04T08:53:36.2717288Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:53:36.2717853Z  "INFO": "\033[0m", # Reset 2025-12-04T08:53:36.2718404Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:53:36.2718920Z  } 2025-12-04T08:53:36.2719472Z  2025-12-04T08:53:36.2719932Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:53:36.2720716Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:53:36.2721517Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:53:36.2722143Z  return super().format(record) 2025-12-04T08:53:36.2722666Z  2025-12-04T08:53:36.2723042Z  2025-12-04T08:53:36.2723454Z handler = logging.StreamHandler() 2025-12-04T08:53:36.2724226Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:53:36.2724957Z  2025-12-04T08:53:36.2725453Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:53:36.2726081Z log.addHandler(handler) 2025-12-04T08:53:36.2726585Z log.setLevel(logging.INFO) 2025-12-04T08:53:36.2727075Z  2025-12-04T08:53:36.2727437Z  2025-12-04T08:53:36.2727926Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:53:36.2728518Z  """ 2025-12-04T08:53:36.2729094Z  Defines outputs of the github action that invokes this script 2025-12-04T08:53:36.2730121Z  """ 2025-12-04T08:53:36.2730539Z  if not GITHUB_OUTPUT: 2025-12-04T08:53:36.2731667Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:53:36.2732778Z  log.warning( 2025-12-04T08:53:36.2733678Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:53:36.2734605Z  ) 2025-12-04T08:53:36.2735089Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:53:36.2735663Z  return 2025-12-04T08:53:36.2736083Z  2025-12-04T08:53:36.2736504Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:53:36.2737115Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:53:36.2737710Z  f.write(f"{key}={value}\n") 2025-12-04T08:53:36.2738234Z  2025-12-04T08:53:36.2738587Z  2025-12-04T08:53:36.2739126Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:53:36.2739980Z  return frozenset( 2025-12-04T08:53:36.2740672Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:53:36.2741364Z  ) 2025-12-04T08:53:36.2741742Z  2025-12-04T08:53:36.2742101Z  2025-12-04T08:53:36.2742482Z def parse_args() -> Any: 2025-12-04T08:53:36.2743110Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:53:36.2744000Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:53:36.2744783Z  parser.add_argument( 2025-12-04T08:53:36.2745290Z  "--github-issue-repo", 2025-12-04T08:53:36.2745822Z  type=str, 2025-12-04T08:53:36.2746296Z  required=False, 2025-12-04T08:53:36.2746952Z  default="pytorch/test-infra", 2025-12-04T08:53:36.2747562Z  help="GitHub repo to get the issue", 2025-12-04T08:53:36.2748100Z  ) 2025-12-04T08:53:36.2748520Z  parser.add_argument( 2025-12-04T08:53:36.2749021Z  "--github-repo", 2025-12-04T08:53:36.2749686Z  type=str, 2025-12-04T08:53:36.2750152Z  required=True, 2025-12-04T08:53:36.2750689Z  help="GitHub repo where CI is running", 2025-12-04T08:53:36.2751237Z  ) 2025-12-04T08:53:36.2751650Z  parser.add_argument( 2025-12-04T08:53:36.2752327Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:53:36.2753007Z  ) 2025-12-04T08:53:36.2753428Z  parser.add_argument( 2025-12-04T08:53:36.2754118Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:53:36.2754833Z  ) 2025-12-04T08:53:36.2755244Z  parser.add_argument( 2025-12-04T08:53:36.2755941Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:53:36.2756650Z  ) 2025-12-04T08:53:36.2757057Z  parser.add_argument( 2025-12-04T08:53:36.2757790Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:53:36.2758542Z  ) 2025-12-04T08:53:36.2758963Z  parser.add_argument( 2025-12-04T08:53:36.2759634Z  "--github-ref-type", 2025-12-04T08:53:36.2760142Z  type=str, 2025-12-04T08:53:36.2760616Z  required=True, 2025-12-04T08:53:36.2761196Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:53:36.2761769Z  ) 2025-12-04T08:53:36.2762176Z  parser.add_argument( 2025-12-04T08:53:36.2762839Z  "--eligible-experiments", 2025-12-04T08:53:36.2763427Z  type=_str_comma_separated_to_set, 2025-12-04T08:53:36.2763985Z  required=False, 2025-12-04T08:53:36.2764476Z  default="", 2025-12-04T08:53:36.2765386Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:53:36.2766312Z  ) 2025-12-04T08:53:36.2766739Z  parser.add_argument( 2025-12-04T08:53:36.2767252Z  "--opt-out-experiments", 2025-12-04T08:53:36.2767826Z  type=_str_comma_separated_to_set, 2025-12-04T08:53:36.2768391Z  required=False, 2025-12-04T08:53:36.2768874Z  default="", 2025-12-04T08:53:36.2769544Z  help=( 2025-12-04T08:53:36.2770286Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:53:36.2771431Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:53:36.2772267Z  ), 2025-12-04T08:53:36.2772678Z  ) 2025-12-04T08:53:36.2773094Z  parser.add_argument( 2025-12-04T08:53:36.2773588Z  "--pr-number", 2025-12-04T08:53:36.2774075Z  type=str, 2025-12-04T08:53:36.2774536Z  required=False, 2025-12-04T08:53:36.2775018Z  default="", 2025-12-04T08:53:36.2775571Z  help="the optional PR number where this is run", 2025-12-04T08:53:36.2776150Z  ) 2025-12-04T08:53:36.2776540Z  2025-12-04T08:53:36.2776945Z  return parser.parse_args() 2025-12-04T08:53:36.2777453Z  2025-12-04T08:53:36.2777807Z  2025-12-04T08:53:36.2778430Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:53:36.2779676Z  auth = Auth.Token(github_token) 2025-12-04T08:53:36.2780284Z  return Github(auth=auth) 2025-12-04T08:53:36.2780779Z  2025-12-04T08:53:36.2781145Z  2025-12-04T08:53:36.2781818Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:53:36.2782651Z  repo = gh.get_repo(repo) 2025-12-04T08:53:36.2783208Z  return repo.get_issue(number=issue_num) 2025-12-04T08:53:36.2783753Z  2025-12-04T08:53:36.2784120Z  2025-12-04T08:53:36.2784510Z def get_potential_pr_author( 2025-12-04T08:53:36.2785213Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:53:36.2785913Z ) -> str: 2025-12-04T08:53:36.2786495Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:53:36.2787333Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:53:36.2788126Z  # embedded in the tag name: ciflow// 2025-12-04T08:53:36.2788720Z  2025-12-04T08:53:36.2789127Z  gh = get_gh_client(github_token) 2025-12-04T08:53:36.2789759Z  2025-12-04T08:53:36.2790259Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:53:36.2790927Z  split_tag = ref_name.split("/") 2025-12-04T08:53:36.2791466Z  if ( 2025-12-04T08:53:36.2791897Z  len(split_tag) == 3 2025-12-04T08:53:36.2792434Z  and split_tag[0] == "ciflow" 2025-12-04T08:53:36.2792999Z  and split_tag[2].isnumeric() 2025-12-04T08:53:36.2793529Z  ): 2025-12-04T08:53:36.2793967Z  pr_number = split_tag[2] 2025-12-04T08:53:36.2794497Z  try: 2025-12-04T08:53:36.2794986Z  repository = gh.get_repo(repo) 2025-12-04T08:53:36.2795780Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:53:36.2796437Z  except Exception as e: 2025-12-04T08:53:36.2797012Z  raise Exception( # noqa: TRY002 2025-12-04T08:53:36.2797719Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:53:36.2798389Z  ) from e 2025-12-04T08:53:36.2798998Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:53:36.2799843Z  # In all other cases, return the original input username 2025-12-04T08:53:36.2800460Z  return username 2025-12-04T08:53:36.2800919Z  2025-12-04T08:53:36.2801283Z  2025-12-04T08:53:36.2801745Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:53:36.2802304Z  """ 2025-12-04T08:53:36.2803005Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:53:36.2803793Z  """ 2025-12-04T08:53:36.2804382Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:53:36.2805069Z  2025-12-04T08:53:36.2805423Z  2025-12-04T08:53:36.2805839Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:53:36.2806369Z  try: 2025-12-04T08:53:36.2806832Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:53:36.2807375Z  return data 2025-12-04T08:53:36.2807864Z  except yaml.YAMLError: 2025-12-04T08:53:36.2808415Z  log.exception("Error loading YAML") 2025-12-04T08:53:36.2808958Z  raise 2025-12-04T08:53:36.2809516Z  2025-12-04T08:53:36.2809880Z  2025-12-04T08:53:36.2810527Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:53:36.2811285Z  """ 2025-12-04T08:53:36.2812081Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:53:36.2812840Z  2025-12-04T08:53:36.2813398Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:53:36.2814189Z  and the text below is the list of opted in users. 2025-12-04T08:53:36.2814765Z  2025-12-04T08:53:36.2815355Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:53:36.2816062Z  """ 2025-12-04T08:53:36.2816557Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:53:36.2817189Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:53:36.2817840Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:53:36.2818462Z  else: 2025-12-04T08:53:36.2818974Z  return "", rollout_state 2025-12-04T08:53:36.2820142Z  2025-12-04T08:53:36.2820491Z  2025-12-04T08:53:36.2820922Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:53:36.2821458Z  """ 2025-12-04T08:53:36.2822022Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:53:36.2822687Z  """ 2025-12-04T08:53:36.2823055Z  2025-12-04T08:53:36.2823415Z  2025-12-04T08:53:36.2823963Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:53:36.2824631Z  """ 2025-12-04T08:53:36.2825368Z  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:53:36.2826195Z  2025-12-04T08:53:36.2826994Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:53:36.2827986Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:53:36.2828837Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:53:36.2829600Z  2025-12-04T08:53:36.2829964Z  2025-12-04T08:53:36.2830310Z  """ 2025-12-04T08:53:36.2830724Z  optins = UserOptins() 2025-12-04T08:53:36.2831277Z  for user in user_optin_text.split("\n"): 2025-12-04T08:53:36.2831859Z  user = user.strip("\r\n\t -") 2025-12-04T08:53:36.2832454Z  if not user or not user.startswith("@"): 2025-12-04T08:53:36.2833040Z  # Not a valid user. Skip 2025-12-04T08:53:36.2833553Z  continue 2025-12-04T08:53:36.2833996Z  2025-12-04T08:53:36.2834360Z  if user: 2025-12-04T08:53:36.2834896Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:53:36.2835611Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:53:36.2836266Z  2025-12-04T08:53:36.2836641Z  return optins 2025-12-04T08:53:36.2837077Z  2025-12-04T08:53:36.2837414Z  2025-12-04T08:53:36.2837926Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:53:36.2838555Z  """ 2025-12-04T08:53:36.2839005Z  Check if the experiment name is valid. 2025-12-04T08:53:36.2839645Z  A valid name: 2025-12-04T08:53:36.2840343Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:53:36.2841290Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:53:36.2842016Z  - Cannot contain spaces 2025-12-04T08:53:36.2842515Z  """ 2025-12-04T08:53:36.2842891Z  2025-12-04T08:53:36.2843361Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:53:36.2844089Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:53:36.2844818Z  2025-12-04T08:53:36.2845187Z  if valid: 2025-12-04T08:53:36.2845708Z  return True 2025-12-04T08:53:36.2846304Z  2025-12-04T08:53:36.2846684Z  log.error( 2025-12-04T08:53:36.2848113Z  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:53:36.2849720Z  ) 2025-12-04T08:53:36.2850108Z  return False 2025-12-04T08:53:36.2850536Z  2025-12-04T08:53:36.2850886Z  2025-12-04T08:53:36.2851431Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:53:36.2852077Z  """ 2025-12-04T08:53:36.2852718Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:53:36.2853449Z  """ 2025-12-04T08:53:36.2853837Z  try: 2025-12-04T08:53:36.2854343Z  if settings_text: 2025-12-04T08:53:36.2855126Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:53:36.2855937Z  # for easy reading 2025-12-04T08:53:36.2856768Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:53:36.2857688Z  # the backtick character in shell commands. 2025-12-04T08:53:36.2858333Z  backtick = chr(96) # backtick character 2025-12-04T08:53:36.2859038Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:53:36.2860026Z  settings = load_yaml(settings_text) 2025-12-04T08:53:36.2860559Z  2025-12-04T08:53:36.2861178Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:53:36.2862083Z  experiments = {} 2025-12-04T08:53:36.2862565Z  2025-12-04T08:53:36.2863147Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:53:36.2863924Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:53:36.2865026Z  # 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:53:36.2866054Z  continue 2025-12-04T08:53:36.2866519Z  2025-12-04T08:53:36.2866905Z  valid_settings = {} 2025-12-04T08:53:36.2867462Z  for setting in exp_settings: 2025-12-04T08:53:36.2868063Z  if setting not in Experiment._fields: 2025-12-04T08:53:36.2868657Z  log.warning( 2025-12-04T08:53:36.2869513Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:53:36.2870244Z  ) 2025-12-04T08:53:36.2870713Z  else: 2025-12-04T08:53:36.2871279Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:53:36.2871859Z  2025-12-04T08:53:36.2872367Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:53:36.2873017Z  return Settings(experiments) 2025-12-04T08:53:36.2873535Z  2025-12-04T08:53:36.2873918Z  except Exception: 2025-12-04T08:53:36.2874462Z  log.exception("Failed to parse settings") 2025-12-04T08:53:36.2875007Z  2025-12-04T08:53:36.2875371Z  return Settings() 2025-12-04T08:53:36.2875815Z  2025-12-04T08:53:36.2876166Z  2025-12-04T08:53:36.2876757Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:53:36.2877355Z  """ 2025-12-04T08:53:36.2877862Z  Parse settings, if any, from the rollout state. 2025-12-04T08:53:36.2878425Z  2025-12-04T08:53:36.2878988Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:53:36.2879869Z  and the text below is the list of opted in users. 2025-12-04T08:53:36.2880432Z  2025-12-04T08:53:36.2881041Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:53:36.2881766Z  """ 2025-12-04T08:53:36.2882357Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:53:36.2883135Z  return parse_settings_from_text(settings_text) 2025-12-04T08:53:36.2883703Z  2025-12-04T08:53:36.2884059Z  2025-12-04T08:53:36.2884542Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:53:36.2885139Z  """ 2025-12-04T08:53:36.2885567Z  Parse users from the rollout state. 2025-12-04T08:53:36.2886104Z  2025-12-04T08:53:36.2886459Z  """ 2025-12-04T08:53:36.2887044Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:53:36.2887816Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:53:36.2888378Z  2025-12-04T08:53:36.2888729Z  2025-12-04T08:53:36.2889455Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:53:36.2890214Z  """ 2025-12-04T08:53:36.2890675Z  Check if a user is opted into an experiment 2025-12-04T08:53:36.2891226Z  """ 2025-12-04T08:53:36.2891746Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:53:36.2892471Z  2025-12-04T08:53:36.2892827Z  2025-12-04T08:53:36.2893483Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:53:36.2894241Z  """ 2025-12-04T08:53:36.2894755Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:53:36.2895359Z  """ 2025-12-04T08:53:36.2895912Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:53:36.2896634Z  experiment_optout = "-" + experiment_name 2025-12-04T08:53:36.2897327Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:53:36.2897942Z  return False 2025-12-04T08:53:36.2898380Z  2025-12-04T08:53:36.2898865Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:53:36.2899588Z  log.warning( 2025-12-04T08:53:36.2900428Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:53:36.2901301Z  ) 2025-12-04T08:53:36.2901695Z  2025-12-04T08:53:36.2902055Z  return True 2025-12-04T08:53:36.2902485Z  2025-12-04T08:53:36.2902840Z  2025-12-04T08:53:36.2903219Z def get_runner_prefix( 2025-12-04T08:53:36.2903697Z  rollout_state: str, 2025-12-04T08:53:36.2904214Z  workflow_requestors: Iterable[str], 2025-12-04T08:53:36.2904749Z  branch: str, 2025-12-04T08:53:36.2905302Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:53:36.2906013Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:53:36.2906609Z  is_canary: bool = False, 2025-12-04T08:53:36.2907125Z ) -> str: 2025-12-04T08:53:36.2907593Z  settings = parse_settings(rollout_state) 2025-12-04T08:53:36.2908216Z  user_optins = parse_users(rollout_state) 2025-12-04T08:53:36.2908758Z  2025-12-04T08:53:36.2909355Z  fleet_prefix = "" 2025-12-04T08:53:36.2909854Z  prefixes = [] 2025-12-04T08:53:36.2910529Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:53:36.2911486Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:53:36.2912200Z  log.info( 2025-12-04T08:53:36.2912920Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:53:36.2913667Z  ) 2025-12-04T08:53:36.2914118Z  continue 2025-12-04T08:53:36.2914550Z  2025-12-04T08:53:36.2914942Z  if opt_out_experiments: 2025-12-04T08:53:36.2915539Z  if experiment_name in opt_out_experiments: 2025-12-04T08:53:36.2916195Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:53:36.2916807Z  log.info( 2025-12-04T08:53:36.2917749Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:53:36.2918702Z  ) 2025-12-04T08:53:36.2919190Z  continue 2025-12-04T08:53:36.2919755Z  2025-12-04T08:53:36.2920158Z  if eligible_experiments: 2025-12-04T08:53:36.2920777Z  if experiment_name not in eligible_experiments: 2025-12-04T08:53:36.2921450Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:53:36.2922034Z  log.info( 2025-12-04T08:53:36.2922846Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:53:36.2923687Z  ) 2025-12-04T08:53:36.2924270Z  continue 2025-12-04T08:53:36.2924812Z  elif not experiment_settings.default: 2025-12-04T08:53:36.2925374Z  log.info( 2025-12-04T08:53:36.2926088Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:53:36.2926829Z  ) 2025-12-04T08:53:36.2927249Z  continue 2025-12-04T08:53:36.2927698Z  2025-12-04T08:53:36.2928196Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:53:36.2928845Z  opted_out_users = [ 2025-12-04T08:53:36.2929441Z  requestor 2025-12-04T08:53:36.2929975Z  for requestor in workflow_requestors 2025-12-04T08:53:36.2930681Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:53:36.2931317Z  ] 2025-12-04T08:53:36.2931720Z  2025-12-04T08:53:36.2932117Z  if opted_out_users: 2025-12-04T08:53:36.2932636Z  log.info( 2025-12-04T08:53:36.2933310Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:53:36.2934021Z  ) 2025-12-04T08:53:36.2934437Z  continue 2025-12-04T08:53:36.2934880Z  2025-12-04T08:53:36.2935388Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:53:36.2936025Z  opted_in_users = [ 2025-12-04T08:53:36.2936525Z  requestor 2025-12-04T08:53:36.2937040Z  for requestor in workflow_requestors 2025-12-04T08:53:36.2937761Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:53:36.2938393Z  ] 2025-12-04T08:53:36.2938803Z  2025-12-04T08:53:36.2939190Z  enabled = False 2025-12-04T08:53:36.2939828Z  if opted_in_users: 2025-12-04T08:53:36.2940454Z  log.info( 2025-12-04T08:53:36.2941125Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:53:36.2941829Z  ) 2025-12-04T08:53:36.2942273Z  enabled = True 2025-12-04T08:53:36.2942755Z  2025-12-04T08:53:36.2943197Z  elif experiment_settings.rollout_perc: 2025-12-04T08:53:36.2944073Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:53:36.2945039Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:53:36.2945714Z  log.info( 2025-12-04T08:53:36.2946627Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:53:36.2947536Z  ) 2025-12-04T08:53:36.2948013Z  enabled = True 2025-12-04T08:53:36.2948516Z  2025-12-04T08:53:36.2948895Z  if enabled: 2025-12-04T08:53:36.2949488Z  label = experiment_name 2025-12-04T08:53:36.2950093Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:53:36.2950958Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:53:36.2951863Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:53:36.2952644Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:53:36.2953315Z  if is_canary: 2025-12-04T08:53:36.2953869Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:53:36.2954453Z  fleet_prefix = label 2025-12-04T08:53:36.2954974Z  else: 2025-12-04T08:53:36.2955603Z  prefixes.append(label) 2025-12-04T08:53:36.2956133Z  2025-12-04T08:53:36.2956511Z  if len(prefixes) > 1: 2025-12-04T08:53:36.2957010Z  log.error( 2025-12-04T08:53:36.2958077Z  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:53:36.2959195Z  ) 2025-12-04T08:53:36.2959735Z  prefixes = prefixes[:1] 2025-12-04T08:53:36.2960239Z  2025-12-04T08:53:36.2960640Z  # Fleet always comes first 2025-12-04T08:53:36.2961158Z  if fleet_prefix: 2025-12-04T08:53:36.2961667Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:53:36.2962187Z  2025-12-04T08:53:36.2962675Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:53:36.2963268Z  2025-12-04T08:53:36.2963630Z  2025-12-04T08:53:36.2964319Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:53:36.2965090Z  """ 2025-12-04T08:53:36.2965709Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:53:36.2966421Z  2025-12-04T08:53:36.2967036Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:53:36.2967742Z  """ 2025-12-04T08:53:36.2968207Z  gh = get_gh_client(github_token) 2025-12-04T08:53:36.2968784Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:53:36.2969559Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:53:36.2970174Z  2025-12-04T08:53:36.2970527Z  2025-12-04T08:53:36.2971142Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:53:36.2972045Z  for _ in range(num_retries): 2025-12-04T08:53:36.2972581Z  try: 2025-12-04T08:53:36.2973077Z  req = Request(url=url, headers=headers) 2025-12-04T08:53:36.2973776Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:53:36.2974456Z  return json.loads(content) 2025-12-04T08:53:36.2975022Z  except Exception as e: 2025-12-04T08:53:36.2975623Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:53:36.2976183Z  2025-12-04T08:53:36.2976792Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:53:36.2977515Z  return {} 2025-12-04T08:53:36.2977928Z  2025-12-04T08:53:36.2978297Z  2025-12-04T08:53:36.2978658Z @cache 2025-12-04T08:53:36.2979443Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:53:36.2980219Z  """ 2025-12-04T08:53:36.2980665Z  Dynamically get PR information 2025-12-04T08:53:36.2981180Z  """ 2025-12-04T08:53:36.2981727Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:53:36.2982364Z  headers = { 2025-12-04T08:53:36.2982886Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:53:36.2983529Z  "Authorization": f"token {github_token}", 2025-12-04T08:53:36.2984082Z  } 2025-12-04T08:53:36.2984569Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:53:36.2985211Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:53:36.2985778Z  headers=headers, 2025-12-04T08:53:36.2986258Z  ) 2025-12-04T08:53:36.2986635Z  2025-12-04T08:53:36.2987013Z  if not json_response: 2025-12-04T08:53:36.2987654Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:53:36.2988451Z  return {} 2025-12-04T08:53:36.2988884Z  2025-12-04T08:53:36.2989373Z  return json_response 2025-12-04T08:53:36.2989847Z  2025-12-04T08:53:36.2990207Z  2025-12-04T08:53:36.2990822Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:53:36.2991560Z  """ 2025-12-04T08:53:36.2992127Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:53:36.2992774Z  """ 2025-12-04T08:53:36.2993302Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:53:36.2993920Z  return { 2025-12-04T08:53:36.2994562Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:53:36.2995252Z  } 2025-12-04T08:53:36.2995642Z  2025-12-04T08:53:36.2996012Z  2025-12-04T08:53:36.2996408Z def main() -> None: 2025-12-04T08:53:36.2996889Z  args = parse_args() 2025-12-04T08:53:36.2997348Z  2025-12-04T08:53:36.2997803Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:53:36.2998380Z  2025-12-04T08:53:36.2998785Z  # Check if the PR is opt-out 2025-12-04T08:53:36.2999395Z  if args.pr_number: 2025-12-04T08:53:36.3000108Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:53:36.3000884Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:53:36.3001417Z  log.info( 2025-12-04T08:53:36.3002170Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:53:36.3002934Z  ) 2025-12-04T08:53:36.3003545Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:53:36.3004233Z  sys.exit() 2025-12-04T08:53:36.3004815Z  2025-12-04T08:53:36.3005176Z  try: 2025-12-04T08:53:36.3005672Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:53:36.3006420Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:53:36.3007097Z  ) 2025-12-04T08:53:36.3007491Z  2025-12-04T08:53:36.3007909Z  username = get_potential_pr_author( 2025-12-04T08:53:36.3008487Z  args.github_token, 2025-12-04T08:53:36.3009014Z  args.github_repo, 2025-12-04T08:53:36.3009636Z  args.github_actor, 2025-12-04T08:53:36.3010175Z  args.github_ref_type, 2025-12-04T08:53:36.3010714Z  args.github_branch, 2025-12-04T08:53:36.3011219Z  ) 2025-12-04T08:53:36.3011615Z  2025-12-04T08:53:36.3012120Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:53:36.3012737Z  2025-12-04T08:53:36.3013172Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:53:36.3013746Z  rollout_state, 2025-12-04T08:53:36.3014296Z  (args.github_issue_owner, username), 2025-12-04T08:53:36.3014873Z  args.github_branch, 2025-12-04T08:53:36.3015416Z  args.eligible_experiments, 2025-12-04T08:53:36.3015997Z  args.opt_out_experiments, 2025-12-04T08:53:36.3016530Z  is_canary, 2025-12-04T08:53:36.3017006Z  ) 2025-12-04T08:53:36.3017391Z  2025-12-04T08:53:36.3017789Z  except Exception as e: 2025-12-04T08:53:36.3018288Z  log.error( 2025-12-04T08:53:36.3019011Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:53:36.3019995Z  ) 2025-12-04T08:53:36.3020403Z  2025-12-04T08:53:36.3020981Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:53:36.3021636Z  2025-12-04T08:53:36.3022000Z  2025-12-04T08:53:36.3022380Z if __name__ == "__main__": 2025-12-04T08:53:36.3022869Z  main() 2025-12-04T08:53:36.3023293Z  2025-12-04T08:53:36.3023649Z EOF 2025-12-04T08:53:36.3024032Z  2025-12-04T08:53:36.3024416Z cat runner_determinator.py 2025-12-04T08:53:36.3724915Z shell: /usr/bin/bash -e {0} 2025-12-04T08:53:36.3725701Z env: 2025-12-04T08:53:36.3726345Z GITHUB_TOKEN: *** 2025-12-04T08:53:36.3726749Z ISSUE_NUMBER: 5132 2025-12-04T08:53:36.3727184Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:53:36.3727667Z ISSUE_OWNER: 2025-12-04T08:53:36.3728057Z CHECK_EXPERIMENTS: 2025-12-04T08:53:36.3728477Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:53:36.3728893Z PR_NUMBER: 2025-12-04T08:53:36.3729445Z ##[endgroup] 2025-12-04T08:53:36.3931942Z # flake8: noqa: G004 2025-12-04T08:53:36.3932262Z 2025-12-04T08:53:36.3932687Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:53:36.3933610Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:53:36.3934396Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:53:36.3934818Z 2025-12-04T08:53:36.3934999Z """ 2025-12-04T08:53:36.3935566Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:53:36.3936405Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:53:36.3937270Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:53:36.3938067Z of which runners should be used to run which job. 2025-12-04T08:53:36.3938456Z 2025-12-04T08:53:36.3938867Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:53:36.3940242Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:53:36.3941101Z settings are considered to be empty with only the second part, the user 2025-12-04T08:53:36.3941778Z list, defined. 2025-12-04T08:53:36.3941996Z 2025-12-04T08:53:36.3942353Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:53:36.3943230Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:53:36.3944031Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:53:36.3944464Z 2025-12-04T08:53:36.3944818Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:53:36.3945646Z The user list is also a comma separated list of additional features or 2025-12-04T08:53:36.3946355Z experiments which the user could be opted in to. 2025-12-04T08:53:36.3946748Z 2025-12-04T08:53:36.3946957Z The user list has the following rules: 2025-12-04T08:53:36.3947292Z 2025-12-04T08:53:36.3947598Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:53:36.3948419Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:53:36.3949148Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:53:36.3949804Z 2025-12-04T08:53:36.3950005Z Example config: 2025-12-04T08:53:36.3950469Z # A list of experiments that can be opted into. 2025-12-04T08:53:36.3951112Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:53:36.3951727Z # Expected syntax is: 2025-12-04T08:53:36.3952351Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:53:36.3953283Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:53:36.3953861Z 2025-12-04T08:53:36.3954037Z experiments: 2025-12-04T08:53:36.3954421Z lf: 2025-12-04T08:53:36.3954798Z rollout_percent: 25 2025-12-04T08:53:36.3955402Z all_branches: false 2025-12-04T08:53:36.3955854Z default: true 2025-12-04T08:53:36.3956251Z --- 2025-12-04T08:53:36.3956513Z 2025-12-04T08:53:36.3956676Z # Opt-ins: 2025-12-04T08:53:36.3957237Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:53:36.3958065Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:53:36.3958807Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:53:36.3959666Z # Experiments should be from the above list. 2025-12-04T08:53:36.3960039Z 2025-12-04T08:53:36.3960228Z @User1,-lf,split_build 2025-12-04T08:53:36.3960658Z @User2,lf 2025-12-04T08:53:36.3961049Z @User3,split_build 2025-12-04T08:53:36.3961451Z """ 2025-12-04T08:53:36.3961646Z 2025-12-04T08:53:36.3961808Z import json 2025-12-04T08:53:36.3962179Z import logging 2025-12-04T08:53:36.3962552Z import os 2025-12-04T08:53:36.3962915Z import random 2025-12-04T08:53:36.3963297Z import re 2025-12-04T08:53:36.3963655Z import sys 2025-12-04T08:53:36.3964046Z from argparse import ArgumentParser 2025-12-04T08:53:36.3964574Z from collections.abc import Iterable 2025-12-04T08:53:36.3965080Z from functools import cache 2025-12-04T08:53:36.3965540Z from logging import LogRecord 2025-12-04T08:53:36.3966017Z from typing import Any, NamedTuple 2025-12-04T08:53:36.3966537Z from urllib.request import Request, urlopen 2025-12-04T08:53:36.3966893Z 2025-12-04T08:53:36.3967066Z import yaml 2025-12-04T08:53:36.3967461Z from github import Auth, Github 2025-12-04T08:53:36.3967943Z from github.Issue import Issue 2025-12-04T08:53:36.3968239Z 2025-12-04T08:53:36.3968246Z 2025-12-04T08:53:36.3968463Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:53:36.3969138Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:53:36.3970630Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:53:36.3971170Z 2025-12-04T08:53:36.3971407Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:53:36.3972108Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:53:36.3972619Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:53:36.3973156Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:53:36.3973504Z 2025-12-04T08:53:36.3973692Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:53:36.3974029Z 2025-12-04T08:53:36.3974225Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:53:36.3974684Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:53:36.3974963Z 2025-12-04T08:53:36.3974970Z 2025-12-04T08:53:36.3975166Z class Experiment(NamedTuple): 2025-12-04T08:53:36.3975640Z rollout_perc: float = ( 2025-12-04T08:53:36.3976263Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:53:36.3976915Z ) 2025-12-04T08:53:36.3977291Z all_branches: bool = ( 2025-12-04T08:53:36.3977900Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:53:36.3978552Z ) 2025-12-04T08:53:36.3978921Z default: bool = ( 2025-12-04T08:53:36.3979690Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:53:36.3980331Z ) 2025-12-04T08:53:36.3980523Z 2025-12-04T08:53:36.3980706Z # Add more fields as needed 2025-12-04T08:53:36.3981005Z 2025-12-04T08:53:36.3981011Z 2025-12-04T08:53:36.3981196Z class Settings(NamedTuple): 2025-12-04T08:53:36.3981632Z """ 2025-12-04T08:53:36.3982083Z Settings for the experiments that can be opted into. 2025-12-04T08:53:36.3982643Z """ 2025-12-04T08:53:36.3982833Z 2025-12-04T08:53:36.3983043Z experiments: dict[str, Experiment] = {} 2025-12-04T08:53:36.3983405Z 2025-12-04T08:53:36.3983411Z 2025-12-04T08:53:36.3983623Z class ColorFormatter(logging.Formatter): 2025-12-04T08:53:36.3984222Z """Color codes the log messages based on the log level""" 2025-12-04T08:53:36.3984648Z 2025-12-04T08:53:36.3984816Z COLORS = { 2025-12-04T08:53:36.3985211Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:53:36.3985842Z "ERROR": "\033[31m", # Red 2025-12-04T08:53:36.3986337Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:53:36.3986819Z "INFO": "\033[0m", # Reset 2025-12-04T08:53:36.3987295Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:53:36.3987755Z } 2025-12-04T08:53:36.3987944Z 2025-12-04T08:53:36.3988156Z def format(self, record: LogRecord) -> str: 2025-12-04T08:53:36.3988863Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:53:36.3989792Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:53:36.3990361Z return super().format(record) 2025-12-04T08:53:36.3990687Z 2025-12-04T08:53:36.3990694Z 2025-12-04T08:53:36.3990893Z handler = logging.StreamHandler() 2025-12-04T08:53:36.3991570Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:53:36.3992097Z 2025-12-04T08:53:36.3992336Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:53:36.3992910Z log.addHandler(handler) 2025-12-04T08:53:36.3993342Z log.setLevel(logging.INFO) 2025-12-04T08:53:36.3993620Z 2025-12-04T08:53:36.3993626Z 2025-12-04T08:53:36.3993876Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:53:36.3994442Z """ 2025-12-04T08:53:36.3994924Z Defines outputs of the github action that invokes this script 2025-12-04T08:53:36.3995535Z """ 2025-12-04T08:53:36.3995893Z if not GITHUB_OUTPUT: 2025-12-04T08:53:36.3996909Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:53:36.3997957Z log.warning( 2025-12-04T08:53:36.3998760Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:53:36.3999853Z ) 2025-12-04T08:53:36.4009880Z print(f"::set-output name={key}::{value}") 2025-12-04T08:53:36.4010467Z return 2025-12-04T08:53:36.4010700Z 2025-12-04T08:53:36.4011185Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:53:36.4011757Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:53:36.4012304Z f.write(f"{key}={value}\n") 2025-12-04T08:53:36.4012623Z 2025-12-04T08:53:36.4012630Z 2025-12-04T08:53:36.4012921Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:53:36.4013528Z return frozenset( 2025-12-04T08:53:36.4014112Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:53:36.4014765Z ) 2025-12-04T08:53:36.4014950Z 2025-12-04T08:53:36.4014957Z 2025-12-04T08:53:36.4015136Z def parse_args() -> Any: 2025-12-04T08:53:36.4015672Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:53:36.4016503Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:53:36.4017241Z parser.add_argument( 2025-12-04T08:53:36.4017680Z "--github-issue-repo", 2025-12-04T08:53:36.4018140Z type=str, 2025-12-04T08:53:36.4018552Z required=False, 2025-12-04T08:53:36.4018990Z default="pytorch/test-infra", 2025-12-04T08:53:36.4019717Z help="GitHub repo to get the issue", 2025-12-04T08:53:36.4020212Z ) 2025-12-04T08:53:36.4020569Z parser.add_argument( 2025-12-04T08:53:36.4021001Z "--github-repo", 2025-12-04T08:53:36.4021415Z type=str, 2025-12-04T08:53:36.4021804Z required=True, 2025-12-04T08:53:36.4022253Z help="GitHub repo where CI is running", 2025-12-04T08:53:36.4022767Z ) 2025-12-04T08:53:36.4023128Z parser.add_argument( 2025-12-04T08:53:36.4023709Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:53:36.4024334Z ) 2025-12-04T08:53:36.4024687Z parser.add_argument( 2025-12-04T08:53:36.4025279Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:53:36.4025921Z ) 2025-12-04T08:53:36.4026288Z parser.add_argument( 2025-12-04T08:53:36.4027059Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:53:36.4027722Z ) 2025-12-04T08:53:36.4028087Z parser.add_argument( 2025-12-04T08:53:36.4028722Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:53:36.4029621Z ) 2025-12-04T08:53:36.4029990Z parser.add_argument( 2025-12-04T08:53:36.4030428Z "--github-ref-type", 2025-12-04T08:53:36.4030881Z type=str, 2025-12-04T08:53:36.4031267Z required=True, 2025-12-04T08:53:36.4031744Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:53:36.4032277Z ) 2025-12-04T08:53:36.4032643Z parser.add_argument( 2025-12-04T08:53:36.4033081Z "--eligible-experiments", 2025-12-04T08:53:36.4033581Z type=_str_comma_separated_to_set, 2025-12-04T08:53:36.4034083Z required=False, 2025-12-04T08:53:36.4034488Z default="", 2025-12-04T08:53:36.4084822Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:53:36.4085804Z ) 2025-12-04T08:53:36.4086163Z parser.add_argument( 2025-12-04T08:53:36.4086633Z "--opt-out-experiments", 2025-12-04T08:53:36.4087128Z type=_str_comma_separated_to_set, 2025-12-04T08:53:36.4087643Z required=False, 2025-12-04T08:53:36.4088053Z default="", 2025-12-04T08:53:36.4088444Z help=( 2025-12-04T08:53:36.4089084Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:53:36.4090318Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:53:36.4091108Z ), 2025-12-04T08:53:36.4091466Z ) 2025-12-04T08:53:36.4091830Z parser.add_argument( 2025-12-04T08:53:36.4092258Z "--pr-number", 2025-12-04T08:53:36.4092672Z type=str, 2025-12-04T08:53:36.4093059Z required=False, 2025-12-04T08:53:36.4093489Z default="", 2025-12-04T08:53:36.4094213Z help="the optional PR number where this is run", 2025-12-04T08:53:36.4094777Z ) 2025-12-04T08:53:36.4094974Z 2025-12-04T08:53:36.4095164Z return parser.parse_args() 2025-12-04T08:53:36.4095470Z 2025-12-04T08:53:36.4095476Z 2025-12-04T08:53:36.4095865Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:53:36.4096596Z auth = Auth.Token(github_token) 2025-12-04T08:53:36.4097087Z return Github(auth=auth) 2025-12-04T08:53:36.4097372Z 2025-12-04T08:53:36.4097378Z 2025-12-04T08:53:36.4097816Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:53:36.4098579Z repo = gh.get_repo(repo) 2025-12-04T08:53:36.4099080Z return repo.get_issue(number=issue_num) 2025-12-04T08:53:36.4099549Z 2025-12-04T08:53:36.4099556Z 2025-12-04T08:53:36.4099754Z def get_potential_pr_author( 2025-12-04T08:53:36.4100396Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:53:36.4101062Z ) -> str: 2025-12-04T08:53:36.4101556Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:53:36.4102329Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:53:36.4103032Z # embedded in the tag name: ciflow// 2025-12-04T08:53:36.4103432Z 2025-12-04T08:53:36.4103623Z gh = get_gh_client(github_token) 2025-12-04T08:53:36.4103943Z 2025-12-04T08:53:36.4104212Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:53:36.4104812Z split_tag = ref_name.split("/") 2025-12-04T08:53:36.4105301Z if ( 2025-12-04T08:53:36.4105678Z len(split_tag) == 3 2025-12-04T08:53:36.4106151Z and split_tag[0] == "ciflow" 2025-12-04T08:53:36.4106657Z and split_tag[2].isnumeric() 2025-12-04T08:53:36.4107150Z ): 2025-12-04T08:53:36.4107520Z pr_number = split_tag[2] 2025-12-04T08:53:36.4108139Z try: 2025-12-04T08:53:36.4108563Z repository = gh.get_repo(repo) 2025-12-04T08:53:36.4109154Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:53:36.4109845Z except Exception as e: 2025-12-04T08:53:36.4110349Z raise Exception( # noqa: TRY002 2025-12-04T08:53:36.4111001Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:53:36.4111627Z ) from e 2025-12-04T08:53:36.4112152Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:53:36.4112830Z # In all other cases, return the original input username 2025-12-04T08:53:36.4113407Z return username 2025-12-04T08:53:36.4113637Z 2025-12-04T08:53:36.4113644Z 2025-12-04T08:53:36.4113873Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:53:36.4114393Z """ 2025-12-04T08:53:36.4115013Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:53:36.4115761Z """ 2025-12-04T08:53:36.4116290Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:53:36.4116789Z 2025-12-04T08:53:36.4116797Z 2025-12-04T08:53:36.4116992Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:53:36.4117470Z try: 2025-12-04T08:53:36.4117851Z data = yaml.safe_load(yaml_text) 2025-12-04T08:53:36.4118352Z return data 2025-12-04T08:53:36.4118757Z except yaml.YAMLError: 2025-12-04T08:53:36.4119226Z log.exception("Error loading YAML") 2025-12-04T08:53:36.4120003Z raise 2025-12-04T08:53:36.4120219Z 2025-12-04T08:53:36.4120225Z 2025-12-04T08:53:36.4120659Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:53:36.4121749Z """ 2025-12-04T08:53:36.4122349Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:53:36.4122916Z 2025-12-04T08:53:36.4123410Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:53:36.4124146Z and the text below is the list of opted in users. 2025-12-04T08:53:36.4124539Z 2025-12-04T08:53:36.4124905Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:53:36.4125579Z """ 2025-12-04T08:53:36.4126019Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:53:36.4126605Z if len(rollout_state_parts) >= 2: 2025-12-04T08:53:36.4127186Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:53:36.4127752Z else: 2025-12-04T08:53:36.4128124Z return "", rollout_state 2025-12-04T08:53:36.4128421Z 2025-12-04T08:53:36.4128429Z 2025-12-04T08:53:36.4128632Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:53:36.4129122Z """ 2025-12-04T08:53:36.4129746Z Dictionary of users with a list of features they have opted into 2025-12-04T08:53:36.4130375Z """ 2025-12-04T08:53:36.4130570Z 2025-12-04T08:53:36.4130575Z 2025-12-04T08:53:36.4130908Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:53:36.4131540Z """ 2025-12-04T08:53:36.4132208Z 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:53:36.4132850Z 2025-12-04T08:53:36.4133432Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:53:36.4134381Z - Example line: "@User1,lf,split_build" 2025-12-04T08:53:36.4135030Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:53:36.4135500Z 2025-12-04T08:53:36.4135506Z 2025-12-04T08:53:36.4135663Z """ 2025-12-04T08:53:36.4136030Z optins = UserOptins() 2025-12-04T08:53:36.4136498Z for user in user_optin_text.split("\n"): 2025-12-04T08:53:36.4137032Z user = user.strip("\r\n\t -") 2025-12-04T08:53:36.4137548Z if not user or not user.startswith("@"): 2025-12-04T08:53:36.4138238Z # Not a valid user. Skip 2025-12-04T08:53:36.4138743Z continue 2025-12-04T08:53:36.4138982Z 2025-12-04T08:53:36.4139146Z if user: 2025-12-04T08:53:36.4139821Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:53:36.4140512Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:53:36.4140994Z 2025-12-04T08:53:36.4141169Z return optins 2025-12-04T08:53:36.4141397Z 2025-12-04T08:53:36.4141405Z 2025-12-04T08:53:36.4141684Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:53:36.4142273Z """ 2025-12-04T08:53:36.4142658Z Check if the experiment name is valid. 2025-12-04T08:53:36.4143165Z A valid name: 2025-12-04T08:53:36.4143766Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:53:36.4144670Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:53:36.4145373Z - Cannot contain spaces 2025-12-04T08:53:36.4145828Z """ 2025-12-04T08:53:36.4146018Z 2025-12-04T08:53:36.4146281Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:53:36.4146950Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:53:36.4147373Z 2025-12-04T08:53:36.4147532Z if valid: 2025-12-04T08:53:36.4147904Z return True 2025-12-04T08:53:36.4148141Z 2025-12-04T08:53:36.4148304Z log.error( 2025-12-04T08:53:36.4149773Z 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:53:36.4151261Z ) 2025-12-04T08:53:36.4151608Z return False 2025-12-04T08:53:36.4151837Z 2025-12-04T08:53:36.4151845Z 2025-12-04T08:53:36.4152144Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:53:36.4152749Z """ 2025-12-04T08:53:36.4153486Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:53:36.4154190Z """ 2025-12-04T08:53:36.4154550Z try: 2025-12-04T08:53:36.4154921Z if settings_text: 2025-12-04T08:53:36.4155619Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:53:36.4156367Z # for easy reading 2025-12-04T08:53:36.4157121Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:53:36.4157962Z # the backtick character in shell commands. 2025-12-04T08:53:36.4158542Z backtick = chr(96) # backtick character 2025-12-04T08:53:36.4159182Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:53:36.4160128Z settings = load_yaml(settings_text) 2025-12-04T08:53:36.4160495Z 2025-12-04T08:53:36.4160888Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:53:36.4161603Z experiments = {} 2025-12-04T08:53:36.4161893Z 2025-12-04T08:53:36.4162263Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:53:36.4162990Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:53:36.4164028Z # 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:53:36.4165010Z continue 2025-12-04T08:53:36.4165285Z 2025-12-04T08:53:36.4165465Z valid_settings = {} 2025-12-04T08:53:36.4165979Z for setting in exp_settings: 2025-12-04T08:53:36.4166531Z if setting not in Experiment._fields: 2025-12-04T08:53:36.4167065Z log.warning( 2025-12-04T08:53:36.4167745Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:53:36.4168604Z ) 2025-12-04T08:53:36.4169024Z else: 2025-12-04T08:53:36.4169709Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:53:36.4170116Z 2025-12-04T08:53:36.4170380Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:53:36.4170980Z return Settings(experiments) 2025-12-04T08:53:36.4171319Z 2025-12-04T08:53:36.4171494Z except Exception: 2025-12-04T08:53:36.4171957Z log.exception("Failed to parse settings") 2025-12-04T08:53:36.4172319Z 2025-12-04T08:53:36.4172487Z return Settings() 2025-12-04T08:53:36.4172732Z 2025-12-04T08:53:36.4172739Z 2025-12-04T08:53:36.4172984Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:53:36.4173524Z """ 2025-12-04T08:53:36.4173951Z Parse settings, if any, from the rollout state. 2025-12-04T08:53:36.4174335Z 2025-12-04T08:53:36.4174674Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:53:36.4175404Z and the text below is the list of opted in users. 2025-12-04T08:53:36.4175789Z 2025-12-04T08:53:36.4176188Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:53:36.4176885Z """ 2025-12-04T08:53:36.4177415Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:53:36.4178136Z return parse_settings_from_text(settings_text) 2025-12-04T08:53:36.4178520Z 2025-12-04T08:53:36.4178527Z 2025-12-04T08:53:36.4178766Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:53:36.4179399Z """ 2025-12-04T08:53:36.4179782Z Parse users from the rollout state. 2025-12-04T08:53:36.4180121Z 2025-12-04T08:53:36.4180288Z """ 2025-12-04T08:53:36.4180784Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:53:36.4181479Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:53:36.4181856Z 2025-12-04T08:53:36.4181862Z 2025-12-04T08:53:36.4182385Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:53:36.4183100Z """ 2025-12-04T08:53:36.4183505Z Check if a user is opted into an experiment 2025-12-04T08:53:36.4184020Z """ 2025-12-04T08:53:36.4184457Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:53:36.4184847Z 2025-12-04T08:53:36.4184854Z 2025-12-04T08:53:36.4185251Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:53:36.4185955Z """ 2025-12-04T08:53:36.4186383Z Check if a user explicitly opted out of an experiment 2025-12-04T08:53:36.4186963Z """ 2025-12-04T08:53:36.4187436Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:53:36.4188077Z experiment_optout = "-" + experiment_name 2025-12-04T08:53:36.4188690Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:53:36.4189363Z return False 2025-12-04T08:53:36.4189609Z 2025-12-04T08:53:36.4189877Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:53:36.4190438Z log.warning( 2025-12-04T08:53:36.4191192Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:53:36.4192025Z ) 2025-12-04T08:53:36.4192218Z 2025-12-04T08:53:36.4192381Z return True 2025-12-04T08:53:36.4192605Z 2025-12-04T08:53:36.4192612Z 2025-12-04T08:53:36.4192792Z def get_runner_prefix( 2025-12-04T08:53:36.4193214Z rollout_state: str, 2025-12-04T08:53:36.4193658Z workflow_requestors: Iterable[str], 2025-12-04T08:53:36.4194150Z branch: str, 2025-12-04T08:53:36.4194624Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:53:36.4195255Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:53:36.4195822Z is_canary: bool = False, 2025-12-04T08:53:36.4196261Z ) -> str: 2025-12-04T08:53:36.4196800Z settings = parse_settings(rollout_state) 2025-12-04T08:53:36.4197367Z user_optins = parse_users(rollout_state) 2025-12-04T08:53:36.4197714Z 2025-12-04T08:53:36.4197892Z fleet_prefix = "" 2025-12-04T08:53:36.4198301Z prefixes = [] 2025-12-04T08:53:36.4198897Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:53:36.4200036Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:53:36.4200720Z log.info( 2025-12-04T08:53:36.4201364Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:53:36.4202080Z ) 2025-12-04T08:53:36.4202440Z continue 2025-12-04T08:53:36.4202676Z 2025-12-04T08:53:36.4202865Z if opt_out_experiments: 2025-12-04T08:53:36.4203370Z if experiment_name in opt_out_experiments: 2025-12-04T08:53:36.4203980Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:53:36.4204560Z log.info( 2025-12-04T08:53:36.4205440Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:53:36.4206363Z ) 2025-12-04T08:53:36.4206743Z continue 2025-12-04T08:53:36.4206996Z 2025-12-04T08:53:36.4207188Z if eligible_experiments: 2025-12-04T08:53:36.4207732Z if experiment_name not in eligible_experiments: 2025-12-04T08:53:36.4208339Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:53:36.4208880Z log.info( 2025-12-04T08:53:36.4209727Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:53:36.4210534Z ) 2025-12-04T08:53:36.4210917Z continue 2025-12-04T08:53:36.4211380Z elif not experiment_settings.default: 2025-12-04T08:53:36.4211896Z log.info( 2025-12-04T08:53:36.4212659Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:53:36.4213369Z ) 2025-12-04T08:53:36.4213740Z continue 2025-12-04T08:53:36.4213972Z 2025-12-04T08:53:36.4214235Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:53:36.4214832Z opted_out_users = [ 2025-12-04T08:53:36.4215283Z requestor 2025-12-04T08:53:36.4215720Z for requestor in workflow_requestors 2025-12-04T08:53:36.4216358Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:53:36.4216963Z ] 2025-12-04T08:53:36.4217163Z 2025-12-04T08:53:36.4217336Z if opted_out_users: 2025-12-04T08:53:36.4217766Z log.info( 2025-12-04T08:53:36.4218350Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:53:36.4219007Z ) 2025-12-04T08:53:36.4219476Z continue 2025-12-04T08:53:36.4219714Z 2025-12-04T08:53:36.4219984Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:53:36.4220567Z opted_in_users = [ 2025-12-04T08:53:36.4220992Z requestor 2025-12-04T08:53:36.4221418Z for requestor in workflow_requestors 2025-12-04T08:53:36.4222045Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:53:36.4222628Z ] 2025-12-04T08:53:36.4222824Z 2025-12-04T08:53:36.4222993Z enabled = False 2025-12-04T08:53:36.4223421Z if opted_in_users: 2025-12-04T08:53:36.4223846Z log.info( 2025-12-04T08:53:36.4224417Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:53:36.4225054Z ) 2025-12-04T08:53:36.4225424Z enabled = True 2025-12-04T08:53:36.4225691Z 2025-12-04T08:53:36.4225907Z elif experiment_settings.rollout_perc: 2025-12-04T08:53:36.4226692Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:53:36.4227714Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:53:36.4228339Z log.info( 2025-12-04T08:53:36.4229154Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:53:36.4230128Z ) 2025-12-04T08:53:36.4230534Z enabled = True 2025-12-04T08:53:36.4230815Z 2025-12-04T08:53:36.4230990Z if enabled: 2025-12-04T08:53:36.4231408Z label = experiment_name 2025-12-04T08:53:36.4231931Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:53:36.4232717Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:53:36.4233547Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:53:36.4234270Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:53:36.4234906Z if is_canary: 2025-12-04T08:53:36.4235380Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:53:36.4235909Z fleet_prefix = label 2025-12-04T08:53:36.4236377Z else: 2025-12-04T08:53:36.4236790Z prefixes.append(label) 2025-12-04T08:53:36.4237119Z 2025-12-04T08:53:36.4237302Z if len(prefixes) > 1: 2025-12-04T08:53:36.4237729Z log.error( 2025-12-04T08:53:36.4238724Z 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:53:36.4240029Z ) 2025-12-04T08:53:36.4240402Z prefixes = prefixes[:1] 2025-12-04T08:53:36.4240691Z 2025-12-04T08:53:36.4240870Z # Fleet always comes first 2025-12-04T08:53:36.4241323Z if fleet_prefix: 2025-12-04T08:53:36.4241754Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:53:36.4242102Z 2025-12-04T08:53:36.4242474Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:53:36.4242869Z 2025-12-04T08:53:36.4242877Z 2025-12-04T08:53:36.4243306Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:53:36.4244052Z """ 2025-12-04T08:53:36.4244608Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:53:36.4245138Z 2025-12-04T08:53:36.4245522Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:53:36.4246191Z """ 2025-12-04T08:53:36.4246566Z gh = get_gh_client(github_token) 2025-12-04T08:53:36.4247079Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:53:36.4247685Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:53:36.4248097Z 2025-12-04T08:53:36.4248104Z 2025-12-04T08:53:36.4248487Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:53:36.4249207Z for _ in range(num_retries): 2025-12-04T08:53:36.4249940Z try: 2025-12-04T08:53:36.4250356Z req = Request(url=url, headers=headers) 2025-12-04T08:53:36.4250985Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:53:36.4251597Z return json.loads(content) 2025-12-04T08:53:36.4252109Z except Exception as e: 2025-12-04T08:53:36.4252628Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:53:36.4253006Z 2025-12-04T08:53:36.4253379Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:53:36.4254043Z return {} 2025-12-04T08:53:36.4254258Z 2025-12-04T08:53:36.4254264Z 2025-12-04T08:53:36.4254423Z @cache 2025-12-04T08:53:36.4255005Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:53:36.4255715Z """ 2025-12-04T08:53:36.4256101Z Dynamically get PR information 2025-12-04T08:53:36.4256703Z """ 2025-12-04T08:53:36.4257178Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:53:36.4257768Z headers = { 2025-12-04T08:53:36.4258212Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:53:36.4258787Z "Authorization": f"token {github_token}", 2025-12-04T08:53:36.4259409Z } 2025-12-04T08:53:36.4259815Z json_response: dict[str, Any] = download_json( 2025-12-04T08:53:36.4260393Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:53:36.4260921Z headers=headers, 2025-12-04T08:53:36.4261324Z ) 2025-12-04T08:53:36.4261514Z 2025-12-04T08:53:36.4261702Z if not json_response: 2025-12-04T08:53:36.4262225Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:53:36.4262807Z return {} 2025-12-04T08:53:36.4263030Z 2025-12-04T08:53:36.4263207Z return json_response 2025-12-04T08:53:36.4263478Z 2025-12-04T08:53:36.4263485Z 2025-12-04T08:53:36.4263862Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:53:36.4264565Z """ 2025-12-04T08:53:36.4265065Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:53:36.4265697Z """ 2025-12-04T08:53:36.4266148Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:53:36.4266745Z return { 2025-12-04T08:53:36.4267289Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:53:36.4267952Z } 2025-12-04T08:53:36.4268138Z 2025-12-04T08:53:36.4268144Z 2025-12-04T08:53:36.4268316Z def main() -> None: 2025-12-04T08:53:36.4268719Z args = parse_args() 2025-12-04T08:53:36.4268968Z 2025-12-04T08:53:36.4269192Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:53:36.4269649Z 2025-12-04T08:53:36.4269839Z # Check if the PR is opt-out 2025-12-04T08:53:36.4270312Z if args.pr_number: 2025-12-04T08:53:36.4270930Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:53:36.4271765Z if OPT_OUT_LABEL in labels: 2025-12-04T08:53:36.4272309Z log.info( 2025-12-04T08:53:36.4272982Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:53:36.4273713Z ) 2025-12-04T08:53:36.4274227Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:53:36.4274856Z sys.exit() 2025-12-04T08:53:36.4275096Z 2025-12-04T08:53:36.4275258Z try: 2025-12-04T08:53:36.4275683Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:53:36.4276346Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:53:36.4276955Z ) 2025-12-04T08:53:36.4277148Z 2025-12-04T08:53:36.4277356Z username = get_potential_pr_author( 2025-12-04T08:53:36.4277875Z args.github_token, 2025-12-04T08:53:36.4278334Z args.github_repo, 2025-12-04T08:53:36.4278787Z args.github_actor, 2025-12-04T08:53:36.4279351Z args.github_ref_type, 2025-12-04T08:53:36.4279836Z args.github_branch, 2025-12-04T08:53:36.4280289Z ) 2025-12-04T08:53:36.4280479Z 2025-12-04T08:53:36.4280746Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:53:36.4281165Z 2025-12-04T08:53:36.4281380Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:53:36.4281913Z rollout_state, 2025-12-04T08:53:36.4282385Z (args.github_issue_owner, username), 2025-12-04T08:53:36.4282921Z args.github_branch, 2025-12-04T08:53:36.4283395Z args.eligible_experiments, 2025-12-04T08:53:36.4283912Z args.opt_out_experiments, 2025-12-04T08:53:36.4284396Z is_canary, 2025-12-04T08:53:36.4284795Z ) 2025-12-04T08:53:36.4284990Z 2025-12-04T08:53:36.4285175Z except Exception as e: 2025-12-04T08:53:36.4285611Z log.error( 2025-12-04T08:53:36.4286234Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:53:36.4287098Z ) 2025-12-04T08:53:36.4287295Z 2025-12-04T08:53:36.4287610Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:53:36.4288072Z 2025-12-04T08:53:36.4288078Z 2025-12-04T08:53:36.4288251Z if __name__ == "__main__": 2025-12-04T08:53:36.4288678Z main() 2025-12-04T08:53:36.4288872Z 2025-12-04T08:53:36.4375310Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:53:36.4376143Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:53:36.4407807Z shell: /usr/bin/bash -e {0} 2025-12-04T08:53:36.4408264Z env: 2025-12-04T08:53:36.4408828Z GITHUB_TOKEN: *** 2025-12-04T08:53:36.4409226Z ISSUE_NUMBER: 5132 2025-12-04T08:53:36.4409791Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:53:36.4410273Z ISSUE_OWNER: 2025-12-04T08:53:36.4410653Z CHECK_EXPERIMENTS: 2025-12-04T08:53:36.4411059Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:53:36.4411480Z PR_NUMBER: 2025-12-04T08:53:36.4411838Z ##[endgroup] 2025-12-04T08:53:36.8527908Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:53:37.3121272Z Collecting urllib3==1.26.18 2025-12-04T08:53:37.3644994Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:53:37.3901605Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.2 MB/s eta 0:00:00 2025-12-04T08:53:37.4199776Z Collecting PyGithub==2.3.0 2025-12-04T08:53:37.4304883Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:53:37.4822345Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:53:37.4922605Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:53:37.4971445Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:53:37.4990815Z 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:53:37.5007180Z 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:53:37.5328712Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:53:37.5427840Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:53:37.5652595Z 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:53:37.7028309Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:53:37.7130180Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:53:37.8810580Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:53:37.8912363Z 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:53:37.9207147Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:53:37.9307881Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:53:37.9610620Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:53:37.9776034Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.3 MB/s eta 0:00:00 2025-12-04T08:53:37.9887053Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:53:38.0213419Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 11.1 MB/s eta 0:00:00 2025-12-04T08:53:38.0311668Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:53:38.1252170Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 15.1 MB/s eta 0:00:00 2025-12-04T08:53:38.1349798Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:53:38.1471610Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:53:38.1610028Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 17.5 MB/s eta 0:00:00 2025-12-04T08:53:38.1710534Z 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:53:38.1781949Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 20.8 MB/s eta 0:00:00 2025-12-04T08:53:38.1880093Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:53:38.1944729Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 23.0 MB/s eta 0:00:00 2025-12-04T08:53:38.4897110Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:53:39.0326472Z 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:53:39.1251986Z ##[group]Run curr_branch="main" 2025-12-04T08:53:39.1252303Z curr_branch="main" 2025-12-04T08:53:39.1252532Z curr_ref_type="branch" 2025-12-04T08:53:39.1252779Z echo "Current branch is '$curr_branch'" 2025-12-04T08:53:39.1253072Z  2025-12-04T08:53:39.1253250Z python3 runner_determinator.py \ 2025-12-04T08:53:39.1253530Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:53:39.1253802Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:53:39.1254054Z  --github-branch "$curr_branch" \ 2025-12-04T08:53:39.1254313Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:53:39.1254583Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:53:39.1254855Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:53:39.1255128Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:53:39.1255423Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:53:39.1255775Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:53:39.1256056Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:53:39.1288727Z shell: /usr/bin/bash -e {0} 2025-12-04T08:53:39.1288947Z env: 2025-12-04T08:53:39.1289725Z GITHUB_TOKEN: *** 2025-12-04T08:53:39.1289927Z ISSUE_NUMBER: 5132 2025-12-04T08:53:39.1290132Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:53:39.1290371Z ISSUE_OWNER: 2025-12-04T08:53:39.1290540Z CHECK_EXPERIMENTS: 2025-12-04T08:53:39.1290722Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:53:39.1290908Z PR_NUMBER: 2025-12-04T08:53:39.1291068Z ##[endgroup] 2025-12-04T08:53:39.1339877Z Current branch is 'main' 2025-12-04T08:53:41.2809553Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:53:41.2810793Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:53:41.2811770Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:53:41.2812648Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:53:41.2813323Z INFO : Setting output: label-type='lf.' 2025-12-04T08:53:41.3123345Z Evaluate and set job outputs 2025-12-04T08:53:41.3130140Z Set output 'label-type' 2025-12-04T08:53:41.3131867Z Cleaning up orphan processes