2025-10-10T00:06:36.6903597Z Current runner version: '2.328.0' 2025-10-10T00:06:36.6941431Z ##[group]Runner Image Provisioner 2025-10-10T00:06:36.6942674Z Hosted Compute Agent 2025-10-10T00:06:36.6943569Z Version: 20250912.392 2025-10-10T00:06:36.6944679Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:06:36.6945777Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:06:36.6946878Z ##[endgroup] 2025-10-10T00:06:36.6948035Z ##[group]Operating System 2025-10-10T00:06:36.6948990Z Ubuntu 2025-10-10T00:06:36.6949683Z 24.04.3 2025-10-10T00:06:36.6950586Z LTS 2025-10-10T00:06:36.6951318Z ##[endgroup] 2025-10-10T00:06:36.6952194Z ##[group]Runner Image 2025-10-10T00:06:36.6953271Z Image: ubuntu-24.04 2025-10-10T00:06:36.6954112Z Version: 20250929.60.1 2025-10-10T00:06:36.6956582Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:06:36.6959568Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:06:36.6961223Z ##[endgroup] 2025-10-10T00:06:36.6962865Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:06:36.6965911Z Contents: read 2025-10-10T00:06:36.6966790Z Metadata: read 2025-10-10T00:06:36.6967700Z ##[endgroup] 2025-10-10T00:06:36.6971264Z Secret source: Actions 2025-10-10T00:06:36.6972585Z Prepare workflow directory 2025-10-10T00:06:36.7756607Z Prepare all required actions 2025-10-10T00:06:36.7846462Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:06:36.7854770Z ##[group] Inputs 2025-10-10T00:06:36.7855782Z check_experiments: 2025-10-10T00:06:36.7856681Z opt_out_experiments: 2025-10-10T00:06:36.7858038Z triggering_actor: pytorchmergebot 2025-10-10T00:06:36.7859074Z issue_owner: 2025-10-10T00:06:36.7859955Z curr_branch: main 2025-10-10T00:06:36.7861096Z curr_ref_type: branch 2025-10-10T00:06:36.7862162Z issue_number: 5132 2025-10-10T00:06:36.7863143Z ##[endgroup] 2025-10-10T00:06:36.7864241Z Complete job name: before-test / get-label-type / runner-determinator 2025-10-10T00:06:37.3104899Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:06:37.3107760Z cat < runner_determinator.py 2025-10-10T00:06:37.3108479Z # flake8: noqa: G004 2025-10-10T00:06:37.3109133Z  2025-10-10T00:06:37.3109970Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:06:37.3111063Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:06:37.3112119Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:06:37.3112847Z  2025-10-10T00:06:37.3113341Z """ 2025-10-10T00:06:37.3114157Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:06:37.3115229Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:06:37.3116478Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:06:37.3117711Z of which runners should be used to run which job. 2025-10-10T00:06:37.3118466Z  2025-10-10T00:06:37.3119191Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:06:37.3120365Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:06:37.3121436Z settings are considered to be empty with only the second part, the user 2025-10-10T00:06:37.3122261Z list, defined. 2025-10-10T00:06:37.3122902Z  2025-10-10T00:06:37.3123604Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:06:37.3124710Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:06:37.3125778Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:06:37.3126509Z  2025-10-10T00:06:37.3127671Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:06:37.3128923Z The user list is also a comma separated list of additional features or 2025-10-10T00:06:37.3129886Z experiments which the user could be opted in to. 2025-10-10T00:06:37.3130565Z  2025-10-10T00:06:37.3131145Z The user list has the following rules: 2025-10-10T00:06:37.3131818Z  2025-10-10T00:06:37.3132504Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:06:37.3215562Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:06:37.3216888Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:06:37.3217786Z  2025-10-10T00:06:37.3218306Z Example config: 2025-10-10T00:06:37.3218883Z  # A list of experiments that can be opted into. 2025-10-10T00:06:37.3219686Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:06:37.3220426Z  # Expected syntax is: 2025-10-10T00:06:37.3221206Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:06:37.3222392Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:06:37.3223209Z  2025-10-10T00:06:37.3223619Z  experiments: 2025-10-10T00:06:37.3224076Z  lf: 2025-10-10T00:06:37.3224520Z  rollout_percent: 25 2025-10-10T00:06:37.3225060Z  all_branches: false 2025-10-10T00:06:37.3225588Z  default: true 2025-10-10T00:06:37.3226074Z  --- 2025-10-10T00:06:37.3226468Z  2025-10-10T00:06:37.3226853Z  # Opt-ins: 2025-10-10T00:06:37.3227796Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:06:37.3229256Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:06:37.3230156Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:06:37.3230910Z  # Experiments should be from the above list. 2025-10-10T00:06:37.3231506Z  2025-10-10T00:06:37.3231917Z  @User1,-lf,split_build 2025-10-10T00:06:37.3232453Z  @User2,lf 2025-10-10T00:06:37.3232918Z  @User3,split_build 2025-10-10T00:06:37.3233412Z """ 2025-10-10T00:06:37.3233801Z  2025-10-10T00:06:37.3234186Z import json 2025-10-10T00:06:37.3234630Z import logging 2025-10-10T00:06:37.3235076Z import os 2025-10-10T00:06:37.3235512Z import random 2025-10-10T00:06:37.3235962Z import re 2025-10-10T00:06:37.3236390Z import sys 2025-10-10T00:06:37.3236868Z from argparse import ArgumentParser 2025-10-10T00:06:37.3237692Z from collections.abc import Iterable 2025-10-10T00:06:37.3238313Z from functools import cache 2025-10-10T00:06:37.3238858Z from logging import LogRecord 2025-10-10T00:06:37.3239439Z from typing import Any, NamedTuple 2025-10-10T00:06:37.3240071Z from urllib.request import Request, urlopen 2025-10-10T00:06:37.3240683Z  2025-10-10T00:06:37.3241061Z import yaml 2025-10-10T00:06:37.3241533Z from github import Auth, Github 2025-10-10T00:06:37.3242100Z from github.Issue import Issue 2025-10-10T00:06:37.3242626Z  2025-10-10T00:06:37.3243008Z  2025-10-10T00:06:37.3243480Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:06:37.3244281Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:06:37.3245278Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:06:37.3246052Z  2025-10-10T00:06:37.3246781Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:06:37.3247435Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:06:37.3248160Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:06:37.3248829Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:06:37.3249407Z  2025-10-10T00:06:37.3249842Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:06:37.3250397Z  2025-10-10T00:06:37.3250796Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:06:37.3251342Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:06:37.3252005Z  2025-10-10T00:06:37.3252404Z  2025-10-10T00:06:37.3252819Z class Experiment(NamedTuple): 2025-10-10T00:06:37.3253371Z  rollout_perc: float = ( 2025-10-10T00:06:37.3254142Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:06:37.3254883Z  ) 2025-10-10T00:06:37.3255320Z  all_branches: bool = ( 2025-10-10T00:06:37.3256064Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:06:37.3256793Z  ) 2025-10-10T00:06:37.3257209Z  default: bool = ( 2025-10-10T00:06:37.3258164Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:06:37.3258895Z  ) 2025-10-10T00:06:37.3259287Z  2025-10-10T00:06:37.3259709Z  # Add more fields as needed 2025-10-10T00:06:37.3260237Z  2025-10-10T00:06:37.3260606Z  2025-10-10T00:06:37.3261015Z class Settings(NamedTuple): 2025-10-10T00:06:37.3261540Z  """ 2025-10-10T00:06:37.3262084Z  Settings for the experiments that can be opted into. 2025-10-10T00:06:37.3262723Z  """ 2025-10-10T00:06:37.3263127Z  2025-10-10T00:06:37.3263575Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:06:37.3264165Z  2025-10-10T00:06:37.3264694Z  2025-10-10T00:06:37.3265171Z class ColorFormatter(logging.Formatter): 2025-10-10T00:06:37.3265901Z  """Color codes the log messages based on the log level""" 2025-10-10T00:06:37.3266549Z  2025-10-10T00:06:37.3266932Z  COLORS = { 2025-10-10T00:06:37.3267430Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:06:37.3268392Z  "ERROR": "\033[31m", # Red 2025-10-10T00:06:37.3268967Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:06:37.3269542Z  "INFO": "\033[0m", # Reset 2025-10-10T00:06:37.3270103Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:06:37.3270639Z  } 2025-10-10T00:06:37.3271030Z  2025-10-10T00:06:37.3271503Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:06:37.3272353Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:06:37.3273239Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:06:37.3273884Z  return super().format(record) 2025-10-10T00:06:37.3274423Z  2025-10-10T00:06:37.3274804Z  2025-10-10T00:06:37.3275231Z handler = logging.StreamHandler() 2025-10-10T00:06:37.3276055Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:06:37.3276851Z  2025-10-10T00:06:37.3277360Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:06:37.3278149Z log.addHandler(handler) 2025-10-10T00:06:37.3278681Z log.setLevel(logging.INFO) 2025-10-10T00:06:37.3279193Z  2025-10-10T00:06:37.3279566Z  2025-10-10T00:06:37.3280076Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:06:37.3280706Z  """ 2025-10-10T00:06:37.3281289Z  Defines outputs of the github action that invokes this script 2025-10-10T00:06:37.3282141Z  """ 2025-10-10T00:06:37.3282567Z  if not GITHUB_OUTPUT: 2025-10-10T00:06:37.3283766Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:06:37.3284999Z  log.warning( 2025-10-10T00:06:37.3285981Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:06:37.3286989Z  ) 2025-10-10T00:06:37.3287629Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:06:37.3288252Z  return 2025-10-10T00:06:37.3288688Z  2025-10-10T00:06:37.3289120Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:06:37.3289770Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:06:37.3290413Z  f.write(f"{key}={value}\n") 2025-10-10T00:06:37.3290950Z  2025-10-10T00:06:37.3291323Z  2025-10-10T00:06:37.3291889Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:06:37.3292611Z  return frozenset( 2025-10-10T00:06:37.3293337Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:06:37.3294072Z  ) 2025-10-10T00:06:37.3294488Z  2025-10-10T00:06:37.3294868Z  2025-10-10T00:06:37.3295282Z def parse_args() -> Any: 2025-10-10T00:06:37.3295966Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:06:37.3296947Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:06:37.3298107Z  parser.add_argument( 2025-10-10T00:06:37.3298681Z  "--github-issue-repo", 2025-10-10T00:06:37.3299250Z  type=str, 2025-10-10T00:06:37.3299760Z  required=False, 2025-10-10T00:06:37.3300467Z  default="pytorch/test-infra", 2025-10-10T00:06:37.3301129Z  help="GitHub repo to get the issue", 2025-10-10T00:06:37.3301716Z  ) 2025-10-10T00:06:37.3302150Z  parser.add_argument( 2025-10-10T00:06:37.3302679Z  "--github-repo", 2025-10-10T00:06:37.3303197Z  type=str, 2025-10-10T00:06:37.3303684Z  required=True, 2025-10-10T00:06:37.3304255Z  help="GitHub repo where CI is running", 2025-10-10T00:06:37.3304838Z  ) 2025-10-10T00:06:37.3305273Z  parser.add_argument( 2025-10-10T00:06:37.3306007Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:06:37.3306740Z  ) 2025-10-10T00:06:37.3307188Z  parser.add_argument( 2025-10-10T00:06:37.3308212Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:06:37.3308985Z  ) 2025-10-10T00:06:37.3309416Z  parser.add_argument( 2025-10-10T00:06:37.3310181Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:06:37.3310933Z  ) 2025-10-10T00:06:37.3311372Z  parser.add_argument( 2025-10-10T00:06:37.3312158Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:06:37.3312927Z  ) 2025-10-10T00:06:37.3313377Z  parser.add_argument( 2025-10-10T00:06:37.3313922Z  "--github-ref-type", 2025-10-10T00:06:37.3314464Z  type=str, 2025-10-10T00:06:37.3314954Z  required=True, 2025-10-10T00:06:37.3315580Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:06:37.3316233Z  ) 2025-10-10T00:06:37.3316674Z  parser.add_argument( 2025-10-10T00:06:37.3317418Z  "--eligible-experiments", 2025-10-10T00:06:37.3318176Z  type=_str_comma_separated_to_set, 2025-10-10T00:06:37.3318768Z  required=False, 2025-10-10T00:06:37.3319284Z  default="", 2025-10-10T00:06:37.3320265Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:06:37.3321279Z  ) 2025-10-10T00:06:37.3321716Z  parser.add_argument( 2025-10-10T00:06:37.3322267Z  "--opt-out-experiments", 2025-10-10T00:06:37.3322877Z  type=_str_comma_separated_to_set, 2025-10-10T00:06:37.3323459Z  required=False, 2025-10-10T00:06:37.3323971Z  default="", 2025-10-10T00:06:37.3324452Z  help=( 2025-10-10T00:06:37.3325250Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:06:37.3326509Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:06:37.3327426Z  ), 2025-10-10T00:06:37.3327965Z  ) 2025-10-10T00:06:37.3328406Z  parser.add_argument( 2025-10-10T00:06:37.3328935Z  "--pr-number", 2025-10-10T00:06:37.3329444Z  type=str, 2025-10-10T00:06:37.3329939Z  required=False, 2025-10-10T00:06:37.3330456Z  default="", 2025-10-10T00:06:37.3331050Z  help="the optional PR number where this is run", 2025-10-10T00:06:37.3331677Z  ) 2025-10-10T00:06:37.3332077Z  2025-10-10T00:06:37.3332508Z  return parser.parse_args() 2025-10-10T00:06:37.3333043Z  2025-10-10T00:06:37.3333428Z  2025-10-10T00:06:37.3334106Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:06:37.3335098Z  auth = Auth.Token(github_token) 2025-10-10T00:06:37.3335734Z  return Github(auth=auth) 2025-10-10T00:06:37.3336263Z  2025-10-10T00:06:37.3336650Z  2025-10-10T00:06:37.3337388Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:06:37.3338617Z  repo = gh.get_repo(repo) 2025-10-10T00:06:37.3339255Z  return repo.get_issue(number=issue_num) 2025-10-10T00:06:37.3339852Z  2025-10-10T00:06:37.3340233Z  2025-10-10T00:06:37.3340647Z def get_potential_pr_author( 2025-10-10T00:06:37.3341413Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:06:37.3342168Z ) -> str: 2025-10-10T00:06:37.3342793Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:06:37.3343717Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:06:37.3344605Z  # embedded in the tag name: ciflow// 2025-10-10T00:06:37.3345248Z  2025-10-10T00:06:37.3345682Z  gh = get_gh_client(github_token) 2025-10-10T00:06:37.3346237Z  2025-10-10T00:06:37.3346767Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:06:37.3347975Z  split_tag = ref_name.split("/") 2025-10-10T00:06:37.3348581Z  if ( 2025-10-10T00:06:37.3349054Z  len(split_tag) == 3 2025-10-10T00:06:37.3349643Z  and split_tag[0] == "ciflow" 2025-10-10T00:06:37.3350249Z  and split_tag[2].isnumeric() 2025-10-10T00:06:37.3350812Z  ): 2025-10-10T00:06:37.3351288Z  pr_number = split_tag[2] 2025-10-10T00:06:37.3351851Z  try: 2025-10-10T00:06:37.3352374Z  repository = gh.get_repo(repo) 2025-10-10T00:06:37.3353256Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:06:37.3353954Z  except Exception as e: 2025-10-10T00:06:37.3354569Z  raise Exception( # noqa: TRY002 2025-10-10T00:06:37.3355329Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:06:37.3356046Z  ) from e 2025-10-10T00:06:37.3356704Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:06:37.3357840Z  # In all other cases, return the original input username 2025-10-10T00:06:37.3358537Z  return username 2025-10-10T00:06:37.3359019Z  2025-10-10T00:06:37.3359396Z  2025-10-10T00:06:37.3359882Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:06:37.3360475Z  """ 2025-10-10T00:06:37.3361222Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:06:37.3362073Z  """ 2025-10-10T00:06:37.3362721Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:06:37.3363459Z  2025-10-10T00:06:37.3363834Z  2025-10-10T00:06:37.3364275Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:06:37.3364838Z  try: 2025-10-10T00:06:37.3365296Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:06:37.3365873Z  return data 2025-10-10T00:06:37.3366377Z  except yaml.YAMLError: 2025-10-10T00:06:37.3366956Z  log.exception("Error loading YAML") 2025-10-10T00:06:37.3367737Z  raise 2025-10-10T00:06:37.3368197Z  2025-10-10T00:06:37.3368571Z  2025-10-10T00:06:37.3369264Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:06:37.3370202Z  """ 2025-10-10T00:06:37.3371204Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:06:37.3372041Z  2025-10-10T00:06:37.3372647Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:06:37.3373518Z  and the text below is the list of opted in users. 2025-10-10T00:06:37.3374130Z  2025-10-10T00:06:37.3374764Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:06:37.3375525Z  """ 2025-10-10T00:06:37.3376054Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:06:37.3376723Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:06:37.3377426Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:06:37.3378444Z  else: 2025-10-10T00:06:37.3378911Z  return "", rollout_state 2025-10-10T00:06:37.3379455Z  2025-10-10T00:06:37.3379820Z  2025-10-10T00:06:37.3380267Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:06:37.3380834Z  """ 2025-10-10T00:06:37.3381434Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:06:37.3382135Z  """ 2025-10-10T00:06:37.3382532Z  2025-10-10T00:06:37.3382883Z  2025-10-10T00:06:37.3383476Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:06:37.3384197Z  """ 2025-10-10T00:06:37.3385005Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:06:37.3385902Z  2025-10-10T00:06:37.3386780Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:06:37.3387977Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:06:37.3388963Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:06:37.3389640Z  2025-10-10T00:06:37.3390008Z  2025-10-10T00:06:37.3390363Z  """ 2025-10-10T00:06:37.3390790Z  optins = UserOptins() 2025-10-10T00:06:37.3391368Z  for user in user_optin_text.split("\n"): 2025-10-10T00:06:37.3392001Z  user = user.strip("\r\n\t -") 2025-10-10T00:06:37.3392628Z  if not user or not user.startswith("@"): 2025-10-10T00:06:37.3393257Z  # Not a valid user. Skip 2025-10-10T00:06:37.3393876Z  continue 2025-10-10T00:06:37.3394339Z  2025-10-10T00:06:37.3394722Z  if user: 2025-10-10T00:06:37.3395260Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:06:37.3396053Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:06:37.3396749Z  2025-10-10T00:06:37.3397148Z  return optins 2025-10-10T00:06:37.3397714Z  2025-10-10T00:06:37.3398077Z  2025-10-10T00:06:37.3398639Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:06:37.3399308Z  """ 2025-10-10T00:06:37.3399792Z  Check if the experiment name is valid. 2025-10-10T00:06:37.3400376Z  A valid name: 2025-10-10T00:06:37.3401142Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:06:37.3402170Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:06:37.3402954Z  - Cannot contain spaces 2025-10-10T00:06:37.3403486Z  """ 2025-10-10T00:06:37.3403876Z  2025-10-10T00:06:37.3404399Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:06:37.3405306Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:06:37.3406135Z  2025-10-10T00:06:37.3406515Z  if valid: 2025-10-10T00:06:37.3406979Z  return True 2025-10-10T00:06:37.3407439Z  2025-10-10T00:06:37.3407940Z  log.error( 2025-10-10T00:06:37.3409544Z  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-10-10T00:06:37.3411205Z  ) 2025-10-10T00:06:37.3411612Z  return False 2025-10-10T00:06:37.3412054Z  2025-10-10T00:06:37.3412425Z  2025-10-10T00:06:37.3412984Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:06:37.3413677Z  """ 2025-10-10T00:06:37.3414355Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:06:37.3415127Z  """ 2025-10-10T00:06:37.3415529Z  try: 2025-10-10T00:06:37.3416016Z  if settings_text: 2025-10-10T00:06:37.3416858Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:06:37.3418195Z  # for easy reading 2025-10-10T00:06:37.3419119Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:06:37.3420099Z  # the backtick character in shell commands. 2025-10-10T00:06:37.3420789Z  backtick = chr(96) # backtick character 2025-10-10T00:06:37.3421554Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:06:37.3422298Z  settings = load_yaml(settings_text) 2025-10-10T00:06:37.3422860Z  2025-10-10T00:06:37.3423532Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:06:37.3424499Z  experiments = {} 2025-10-10T00:06:37.3425009Z  2025-10-10T00:06:37.3425623Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:06:37.3426467Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:06:37.3427821Z  # 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-10-10T00:06:37.3428942Z  continue 2025-10-10T00:06:37.3429448Z  2025-10-10T00:06:37.3429858Z  valid_settings = {} 2025-10-10T00:06:37.3430454Z  for setting in exp_settings: 2025-10-10T00:06:37.3431103Z  if setting not in Experiment._fields: 2025-10-10T00:06:37.3431752Z  log.warning( 2025-10-10T00:06:37.3432556Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:06:37.3433318Z  ) 2025-10-10T00:06:37.3433823Z  else: 2025-10-10T00:06:37.3434429Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:06:37.3435057Z  2025-10-10T00:06:37.3435579Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:06:37.3436289Z  return Settings(experiments) 2025-10-10T00:06:37.3436842Z  2025-10-10T00:06:37.3437230Z  except Exception: 2025-10-10T00:06:37.3437906Z  log.exception("Failed to parse settings") 2025-10-10T00:06:37.3438494Z  2025-10-10T00:06:37.3438892Z  return Settings() 2025-10-10T00:06:37.3439365Z  2025-10-10T00:06:37.3439743Z  2025-10-10T00:06:37.3440436Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:06:37.3441079Z  """ 2025-10-10T00:06:37.3441598Z  Parse settings, if any, from the rollout state. 2025-10-10T00:06:37.3442193Z  2025-10-10T00:06:37.3442793Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:06:37.3443631Z  and the text below is the list of opted in users. 2025-10-10T00:06:37.3444243Z  2025-10-10T00:06:37.3444902Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:06:37.3445680Z  """ 2025-10-10T00:06:37.3446322Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:06:37.3447171Z  return parse_settings_from_text(settings_text) 2025-10-10T00:06:37.3447889Z  2025-10-10T00:06:37.3448257Z  2025-10-10T00:06:37.3448771Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:06:37.3449394Z  """ 2025-10-10T00:06:37.3449852Z  Parse users from the rollout state. 2025-10-10T00:06:37.3450413Z  2025-10-10T00:06:37.3450785Z  """ 2025-10-10T00:06:37.3451395Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:06:37.3452215Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:06:37.3452813Z  2025-10-10T00:06:37.3453182Z  2025-10-10T00:06:37.3453871Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:06:37.3454688Z  """ 2025-10-10T00:06:37.3455185Z  Check if a user is opted into an experiment 2025-10-10T00:06:37.3455782Z  """ 2025-10-10T00:06:37.3456320Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:06:37.3456959Z  2025-10-10T00:06:37.3457557Z  2025-10-10T00:06:37.3458267Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:06:37.3459092Z  """ 2025-10-10T00:06:37.3459633Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:06:37.3460275Z  """ 2025-10-10T00:06:37.3460859Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:06:37.3461648Z  experiment_optout = "-" + experiment_name 2025-10-10T00:06:37.3462370Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:06:37.3463041Z  return False 2025-10-10T00:06:37.3463506Z  2025-10-10T00:06:37.3464016Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:06:37.3464672Z  log.warning( 2025-10-10T00:06:37.3465607Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:06:37.3466554Z  ) 2025-10-10T00:06:37.3466965Z  2025-10-10T00:06:37.3467353Z  return True 2025-10-10T00:06:37.3467897Z  2025-10-10T00:06:37.3468279Z  2025-10-10T00:06:37.3468682Z def get_runner_prefix( 2025-10-10T00:06:37.3469199Z  rollout_state: str, 2025-10-10T00:06:37.3469763Z  workflow_requestors: Iterable[str], 2025-10-10T00:06:37.3470336Z  branch: str, 2025-10-10T00:06:37.3470945Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:06:37.3471716Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:06:37.3472379Z  is_canary: bool = False, 2025-10-10T00:06:37.3472899Z ) -> str: 2025-10-10T00:06:37.3473414Z  settings = parse_settings(rollout_state) 2025-10-10T00:06:37.3474081Z  user_optins = parse_users(rollout_state) 2025-10-10T00:06:37.3474657Z  2025-10-10T00:06:37.3475211Z  fleet_prefix = "" 2025-10-10T00:06:37.3475740Z  prefixes = [] 2025-10-10T00:06:37.3476483Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:06:37.3477623Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:06:37.3478408Z  log.info( 2025-10-10T00:06:37.3479199Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:06:37.3480003Z  ) 2025-10-10T00:06:37.3480467Z  continue 2025-10-10T00:06:37.3480920Z  2025-10-10T00:06:37.3481338Z  if opt_out_experiments: 2025-10-10T00:06:37.3481972Z  if experiment_name in opt_out_experiments: 2025-10-10T00:06:37.3482716Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:06:37.3483378Z  log.info( 2025-10-10T00:06:37.3484409Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:06:37.3485448Z  ) 2025-10-10T00:06:37.3485915Z  continue 2025-10-10T00:06:37.3486403Z  2025-10-10T00:06:37.3486822Z  if eligible_experiments: 2025-10-10T00:06:37.3487564Z  if experiment_name not in eligible_experiments: 2025-10-10T00:06:37.3488293Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:06:37.3488904Z  log.info( 2025-10-10T00:06:37.3489794Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:06:37.3490686Z  ) 2025-10-10T00:06:37.3491298Z  continue 2025-10-10T00:06:37.3491881Z  elif not experiment_settings.default: 2025-10-10T00:06:37.3492500Z  log.info( 2025-10-10T00:06:37.3493265Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:06:37.3494060Z  ) 2025-10-10T00:06:37.3494509Z  continue 2025-10-10T00:06:37.3494966Z  2025-10-10T00:06:37.3495495Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:06:37.3496183Z  opted_out_users = [ 2025-10-10T00:06:37.3496702Z  requestor 2025-10-10T00:06:37.3497251Z  for requestor in workflow_requestors 2025-10-10T00:06:37.3498138Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:06:37.3498829Z  ] 2025-10-10T00:06:37.3499244Z  2025-10-10T00:06:37.3499667Z  if opted_out_users: 2025-10-10T00:06:37.3500225Z  log.info( 2025-10-10T00:06:37.3500954Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:06:37.3501714Z  ) 2025-10-10T00:06:37.3502154Z  continue 2025-10-10T00:06:37.3502619Z  2025-10-10T00:06:37.3503135Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:06:37.3503826Z  opted_in_users = [ 2025-10-10T00:06:37.3504366Z  requestor 2025-10-10T00:06:37.3504933Z  for requestor in workflow_requestors 2025-10-10T00:06:37.3505694Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:06:37.3506372Z  ] 2025-10-10T00:06:37.3506781Z  2025-10-10T00:06:37.3507169Z  enabled = False 2025-10-10T00:06:37.3507804Z  if opted_in_users: 2025-10-10T00:06:37.3508449Z  log.info( 2025-10-10T00:06:37.3509179Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:06:37.3509925Z  ) 2025-10-10T00:06:37.3510384Z  enabled = True 2025-10-10T00:06:37.3510882Z  2025-10-10T00:06:37.3511344Z  elif experiment_settings.rollout_perc: 2025-10-10T00:06:37.3512266Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:06:37.3513304Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:06:37.3514030Z  log.info( 2025-10-10T00:06:37.3515009Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:06:37.3516047Z  ) 2025-10-10T00:06:37.3516550Z  enabled = True 2025-10-10T00:06:37.3517069Z  2025-10-10T00:06:37.3517581Z  if enabled: 2025-10-10T00:06:37.3518099Z  label = experiment_name 2025-10-10T00:06:37.3518743Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:06:37.3519671Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:06:37.3520641Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:06:37.3521496Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:06:37.3522217Z  if is_canary: 2025-10-10T00:06:37.3522803Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:06:37.3523423Z  fleet_prefix = label 2025-10-10T00:06:37.3523977Z  else: 2025-10-10T00:06:37.3524674Z  prefixes.append(label) 2025-10-10T00:06:37.3525233Z  2025-10-10T00:06:37.3525641Z  if len(prefixes) > 1: 2025-10-10T00:06:37.3526157Z  log.error( 2025-10-10T00:06:37.3527303Z  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-10-10T00:06:37.3528610Z  ) 2025-10-10T00:06:37.3529067Z  prefixes = prefixes[:1] 2025-10-10T00:06:37.3529596Z  2025-10-10T00:06:37.3530000Z  # Fleet always comes first 2025-10-10T00:06:37.3530557Z  if fleet_prefix: 2025-10-10T00:06:37.3531092Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:06:37.3531662Z  2025-10-10T00:06:37.3532167Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:06:37.3532789Z  2025-10-10T00:06:37.3533167Z  2025-10-10T00:06:37.3533866Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:06:37.3534711Z  """ 2025-10-10T00:06:37.3535378Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:06:37.3536143Z  2025-10-10T00:06:37.3536778Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:06:37.3537625Z  """ 2025-10-10T00:06:37.3538092Z  gh = get_gh_client(github_token) 2025-10-10T00:06:37.3538716Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:06:37.3539452Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:06:37.3540093Z  2025-10-10T00:06:37.3540462Z  2025-10-10T00:06:37.3541126Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:06:37.3542081Z  for _ in range(num_retries): 2025-10-10T00:06:37.3542634Z  try: 2025-10-10T00:06:37.3543142Z  req = Request(url=url, headers=headers) 2025-10-10T00:06:37.3543892Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:06:37.3544614Z  return json.loads(content) 2025-10-10T00:06:37.3545210Z  except Exception as e: 2025-10-10T00:06:37.3545842Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:06:37.3546444Z  2025-10-10T00:06:37.3547089Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:06:37.3547970Z  return {} 2025-10-10T00:06:37.3548406Z  2025-10-10T00:06:37.3548780Z  2025-10-10T00:06:37.3549155Z @cache 2025-10-10T00:06:37.3549869Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:06:37.3550699Z  """ 2025-10-10T00:06:37.3551156Z  Dynamically get PR information 2025-10-10T00:06:37.3551700Z  """ 2025-10-10T00:06:37.3552284Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:06:37.3552965Z  headers = { 2025-10-10T00:06:37.3553520Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:06:37.3554212Z  "Authorization": f"token {github_token}", 2025-10-10T00:06:37.3554801Z  } 2025-10-10T00:06:37.3555310Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:06:37.3555995Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:06:37.3556597Z  headers=headers, 2025-10-10T00:06:37.3557083Z  ) 2025-10-10T00:06:37.3557564Z  2025-10-10T00:06:37.3557967Z  if not json_response: 2025-10-10T00:06:37.3558649Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:06:37.3559478Z  return {} 2025-10-10T00:06:37.3559943Z  2025-10-10T00:06:37.3560347Z  return json_response 2025-10-10T00:06:37.3560845Z  2025-10-10T00:06:37.3561211Z  2025-10-10T00:06:37.3561867Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:06:37.3562663Z  """ 2025-10-10T00:06:37.3563284Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:06:37.3563997Z  """ 2025-10-10T00:06:37.3564559Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:06:37.3565231Z  return { 2025-10-10T00:06:37.3565905Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:06:37.3566646Z  } 2025-10-10T00:06:37.3567038Z  2025-10-10T00:06:37.3567410Z  2025-10-10T00:06:37.3567918Z def main() -> None: 2025-10-10T00:06:37.3568416Z  args = parse_args() 2025-10-10T00:06:37.3568907Z  2025-10-10T00:06:37.3569373Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:06:37.3569968Z  2025-10-10T00:06:37.3570385Z  # Check if the PR is opt-out 2025-10-10T00:06:37.3570939Z  if args.pr_number: 2025-10-10T00:06:37.3571697Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:06:37.3572525Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:06:37.3573087Z  log.info( 2025-10-10T00:06:37.3573872Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:06:37.3574809Z  ) 2025-10-10T00:06:37.3575475Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:06:37.3576224Z  sys.exit() 2025-10-10T00:06:37.3576836Z  2025-10-10T00:06:37.3577213Z  try: 2025-10-10T00:06:37.3577844Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:06:37.3578643Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:06:37.3579345Z  ) 2025-10-10T00:06:37.3579766Z  2025-10-10T00:06:37.3580209Z  username = get_potential_pr_author( 2025-10-10T00:06:37.3580815Z  args.github_token, 2025-10-10T00:06:37.3581367Z  args.github_repo, 2025-10-10T00:06:37.3581925Z  args.github_actor, 2025-10-10T00:06:37.3582490Z  args.github_ref_type, 2025-10-10T00:06:37.3583061Z  args.github_branch, 2025-10-10T00:06:37.3583579Z  ) 2025-10-10T00:06:37.3583992Z  2025-10-10T00:06:37.3584533Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:06:37.3585195Z  2025-10-10T00:06:37.3585658Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:06:37.3586269Z  rollout_state, 2025-10-10T00:06:37.3586853Z  (args.github_issue_owner, username), 2025-10-10T00:06:37.3587616Z  args.github_branch, 2025-10-10T00:06:37.3588219Z  args.eligible_experiments, 2025-10-10T00:06:37.3588832Z  args.opt_out_experiments, 2025-10-10T00:06:37.3589399Z  is_canary, 2025-10-10T00:06:37.3589896Z  ) 2025-10-10T00:06:37.3590302Z  2025-10-10T00:06:37.3590713Z  except Exception as e: 2025-10-10T00:06:37.3591239Z  log.error( 2025-10-10T00:06:37.3592027Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:06:37.3593006Z  ) 2025-10-10T00:06:37.3593432Z  2025-10-10T00:06:37.3594031Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:06:37.3594741Z  2025-10-10T00:06:37.3595119Z  2025-10-10T00:06:37.3595504Z if __name__ == "__main__": 2025-10-10T00:06:37.3596014Z  main() 2025-10-10T00:06:37.3596427Z  2025-10-10T00:06:37.3596802Z EOF 2025-10-10T00:06:37.3597182Z  2025-10-10T00:06:37.3597692Z cat runner_determinator.py 2025-10-10T00:06:37.4796146Z shell: /usr/bin/bash -e {0} 2025-10-10T00:06:37.4797154Z env: 2025-10-10T00:06:37.4798201Z GITHUB_TOKEN: *** 2025-10-10T00:06:37.4798692Z ISSUE_NUMBER: 5132 2025-10-10T00:06:37.4799216Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:06:37.4799795Z ISSUE_OWNER: 2025-10-10T00:06:37.4800248Z CHECK_EXPERIMENTS: 2025-10-10T00:06:37.4800744Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:06:37.4801223Z PR_NUMBER: 2025-10-10T00:06:37.4801689Z ##[endgroup] 2025-10-10T00:06:37.5025431Z # flake8: noqa: G004 2025-10-10T00:06:37.5025860Z 2025-10-10T00:06:37.5026366Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:06:37.5027366Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:06:37.5028544Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:06:37.5029024Z 2025-10-10T00:06:37.5029190Z """ 2025-10-10T00:06:37.5029847Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:06:37.5030747Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:06:37.5031682Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:06:37.5032536Z of which runners should be used to run which job. 2025-10-10T00:06:37.5032961Z 2025-10-10T00:06:37.5033356Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:06:37.5034514Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:06:37.5035441Z settings are considered to be empty with only the second part, the user 2025-10-10T00:06:37.5036165Z list, defined. 2025-10-10T00:06:37.5036400Z 2025-10-10T00:06:37.5036773Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:06:37.5038032Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:06:37.5038903Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:06:37.5039357Z 2025-10-10T00:06:37.5039739Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:06:37.5040642Z The user list is also a comma separated list of additional features or 2025-10-10T00:06:37.5041407Z experiments which the user could be opted in to. 2025-10-10T00:06:37.5041824Z 2025-10-10T00:06:37.5042038Z The user list has the following rules: 2025-10-10T00:06:37.5042397Z 2025-10-10T00:06:37.5042740Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:06:37.5043645Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:06:37.5044435Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:06:37.5044839Z 2025-10-10T00:06:37.5045012Z Example config: 2025-10-10T00:06:37.5045483Z # A list of experiments that can be opted into. 2025-10-10T00:06:37.5046172Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:06:37.5046818Z # Expected syntax is: 2025-10-10T00:06:37.5047707Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:06:37.5048751Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:06:37.5049384Z 2025-10-10T00:06:37.5049567Z experiments: 2025-10-10T00:06:37.5050027Z lf: 2025-10-10T00:06:37.5050419Z rollout_percent: 25 2025-10-10T00:06:37.5051065Z all_branches: false 2025-10-10T00:06:37.5051541Z default: true 2025-10-10T00:06:37.5051959Z --- 2025-10-10T00:06:37.5052172Z 2025-10-10T00:06:37.5052345Z # Opt-ins: 2025-10-10T00:06:37.5052943Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:06:37.5053854Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:06:37.5054653Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:06:37.5055334Z # Experiments should be from the above list. 2025-10-10T00:06:37.5055728Z 2025-10-10T00:06:37.5055920Z @User1,-lf,split_build 2025-10-10T00:06:37.5056365Z @User2,lf 2025-10-10T00:06:37.5056771Z @User3,split_build 2025-10-10T00:06:37.5057195Z """ 2025-10-10T00:06:37.5057399Z 2025-10-10T00:06:37.5057791Z import json 2025-10-10T00:06:37.5058188Z import logging 2025-10-10T00:06:37.5058599Z import os 2025-10-10T00:06:37.5058984Z import random 2025-10-10T00:06:37.5059373Z import re 2025-10-10T00:06:37.5059743Z import sys 2025-10-10T00:06:37.5060171Z from argparse import ArgumentParser 2025-10-10T00:06:37.5060732Z from collections.abc import Iterable 2025-10-10T00:06:37.5061277Z from functools import cache 2025-10-10T00:06:37.5061776Z from logging import LogRecord 2025-10-10T00:06:37.5062286Z from typing import Any, NamedTuple 2025-10-10T00:06:37.5062833Z from urllib.request import Request, urlopen 2025-10-10T00:06:37.5063220Z 2025-10-10T00:06:37.5063386Z import yaml 2025-10-10T00:06:37.5063791Z from github import Auth, Github 2025-10-10T00:06:37.5064291Z from github.Issue import Issue 2025-10-10T00:06:37.5064611Z 2025-10-10T00:06:37.5064619Z 2025-10-10T00:06:37.5064842Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:06:37.5065549Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:06:37.5066444Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:06:37.5067023Z 2025-10-10T00:06:37.5067271Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:06:37.5068230Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:06:37.5068793Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:06:37.5069358Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:06:37.5069735Z 2025-10-10T00:06:37.5069940Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:06:37.5070284Z 2025-10-10T00:06:37.5070488Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:06:37.5070964Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:06:37.5071259Z 2025-10-10T00:06:37.5071272Z 2025-10-10T00:06:37.5071467Z class Experiment(NamedTuple): 2025-10-10T00:06:37.5071966Z rollout_perc: float = ( 2025-10-10T00:06:37.5072639Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:06:37.5073326Z ) 2025-10-10T00:06:37.5073708Z all_branches: bool = ( 2025-10-10T00:06:37.5074354Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:06:37.5075041Z ) 2025-10-10T00:06:37.5075424Z default: bool = ( 2025-10-10T00:06:37.5076008Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:06:37.5076667Z ) 2025-10-10T00:06:37.5076863Z 2025-10-10T00:06:37.5077053Z # Add more fields as needed 2025-10-10T00:06:37.5077369Z 2025-10-10T00:06:37.5077376Z 2025-10-10T00:06:37.5077751Z class Settings(NamedTuple): 2025-10-10T00:06:37.5078219Z """ 2025-10-10T00:06:37.5078676Z Settings for the experiments that can be opted into. 2025-10-10T00:06:37.5079273Z """ 2025-10-10T00:06:37.5079471Z 2025-10-10T00:06:37.5079679Z experiments: dict[str, Experiment] = {} 2025-10-10T00:06:37.5080065Z 2025-10-10T00:06:37.5080079Z 2025-10-10T00:06:37.5080292Z class ColorFormatter(logging.Formatter): 2025-10-10T00:06:37.5080935Z """Color codes the log messages based on the log level""" 2025-10-10T00:06:37.5081389Z 2025-10-10T00:06:37.5081561Z COLORS = { 2025-10-10T00:06:37.5081977Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:06:37.5082652Z "ERROR": "\033[31m", # Red 2025-10-10T00:06:37.5083199Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:06:37.5083725Z "INFO": "\033[0m", # Reset 2025-10-10T00:06:37.5084231Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:06:37.5084722Z } 2025-10-10T00:06:37.5084926Z 2025-10-10T00:06:37.5085154Z def format(self, record: LogRecord) -> str: 2025-10-10T00:06:37.5085926Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:06:37.5086730Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:06:37.5087322Z return super().format(record) 2025-10-10T00:06:37.5087959Z 2025-10-10T00:06:37.5087967Z 2025-10-10T00:06:37.5088325Z handler = logging.StreamHandler() 2025-10-10T00:06:37.5089073Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:06:37.5089643Z 2025-10-10T00:06:37.5089898Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:06:37.5090505Z log.addHandler(handler) 2025-10-10T00:06:37.5090962Z log.setLevel(logging.INFO) 2025-10-10T00:06:37.5091260Z 2025-10-10T00:06:37.5091267Z 2025-10-10T00:06:37.5091524Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:06:37.5092114Z """ 2025-10-10T00:06:37.5092618Z Defines outputs of the github action that invokes this script 2025-10-10T00:06:37.5093266Z """ 2025-10-10T00:06:37.5093647Z if not GITHUB_OUTPUT: 2025-10-10T00:06:37.5094754Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:06:37.5095905Z log.warning( 2025-10-10T00:06:37.5096775Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:06:37.5098096Z ) 2025-10-10T00:06:37.5110315Z print(f"::set-output name={key}::{value}") 2025-10-10T00:06:37.5110985Z return 2025-10-10T00:06:37.5111252Z 2025-10-10T00:06:37.5111674Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:06:37.5112328Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:06:37.5112935Z f.write(f"{key}={value}\n") 2025-10-10T00:06:37.5113287Z 2025-10-10T00:06:37.5113295Z 2025-10-10T00:06:37.5113615Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:06:37.5114282Z return frozenset( 2025-10-10T00:06:37.5114925Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:06:37.5115647Z ) 2025-10-10T00:06:37.5115844Z 2025-10-10T00:06:37.5115852Z 2025-10-10T00:06:37.5116041Z def parse_args() -> Any: 2025-10-10T00:06:37.5116631Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:06:37.5117675Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:06:37.5118486Z parser.add_argument( 2025-10-10T00:06:37.5118968Z "--github-issue-repo", 2025-10-10T00:06:37.5119465Z type=str, 2025-10-10T00:06:37.5119897Z required=False, 2025-10-10T00:06:37.5120369Z default="pytorch/test-infra", 2025-10-10T00:06:37.5120938Z help="GitHub repo to get the issue", 2025-10-10T00:06:37.5121468Z ) 2025-10-10T00:06:37.5121848Z parser.add_argument( 2025-10-10T00:06:37.5122317Z "--github-repo", 2025-10-10T00:06:37.5175137Z type=str, 2025-10-10T00:06:37.5175876Z required=True, 2025-10-10T00:06:37.5176429Z help="GitHub repo where CI is running", 2025-10-10T00:06:37.5176978Z ) 2025-10-10T00:06:37.5177357Z parser.add_argument( 2025-10-10T00:06:37.5178176Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:06:37.5178840Z ) 2025-10-10T00:06:37.5179212Z parser.add_argument( 2025-10-10T00:06:37.5179869Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:06:37.5180577Z ) 2025-10-10T00:06:37.5180950Z parser.add_argument( 2025-10-10T00:06:37.5181981Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:06:37.5182691Z ) 2025-10-10T00:06:37.5183075Z parser.add_argument( 2025-10-10T00:06:37.5183761Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:06:37.5184512Z ) 2025-10-10T00:06:37.5184897Z parser.add_argument( 2025-10-10T00:06:37.5185359Z "--github-ref-type", 2025-10-10T00:06:37.5185822Z type=str, 2025-10-10T00:06:37.5186224Z required=True, 2025-10-10T00:06:37.5186717Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:06:37.5187279Z ) 2025-10-10T00:06:37.5187780Z parser.add_argument( 2025-10-10T00:06:37.5188258Z "--eligible-experiments", 2025-10-10T00:06:37.5188773Z type=_str_comma_separated_to_set, 2025-10-10T00:06:37.5189302Z required=False, 2025-10-10T00:06:37.5189720Z default="", 2025-10-10T00:06:37.5190583Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:06:37.5191545Z ) 2025-10-10T00:06:37.5191923Z parser.add_argument( 2025-10-10T00:06:37.5192401Z "--opt-out-experiments", 2025-10-10T00:06:37.5192919Z type=_str_comma_separated_to_set, 2025-10-10T00:06:37.5193460Z required=False, 2025-10-10T00:06:37.5193887Z default="", 2025-10-10T00:06:37.5194291Z help=( 2025-10-10T00:06:37.5194987Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:06:37.5196153Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:06:37.5197012Z ), 2025-10-10T00:06:37.5197375Z ) 2025-10-10T00:06:37.5197853Z parser.add_argument( 2025-10-10T00:06:37.5198303Z "--pr-number", 2025-10-10T00:06:37.5198736Z type=str, 2025-10-10T00:06:37.5199141Z required=False, 2025-10-10T00:06:37.5199574Z default="", 2025-10-10T00:06:37.5200232Z help="the optional PR number where this is run", 2025-10-10T00:06:37.5200812Z ) 2025-10-10T00:06:37.5201014Z 2025-10-10T00:06:37.5201210Z return parser.parse_args() 2025-10-10T00:06:37.5201527Z 2025-10-10T00:06:37.5201534Z 2025-10-10T00:06:37.5201945Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:06:37.5202732Z auth = Auth.Token(github_token) 2025-10-10T00:06:37.5203250Z return Github(auth=auth) 2025-10-10T00:06:37.5203547Z 2025-10-10T00:06:37.5203560Z 2025-10-10T00:06:37.5204021Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:06:37.5204839Z repo = gh.get_repo(repo) 2025-10-10T00:06:37.5205360Z return repo.get_issue(number=issue_num) 2025-10-10T00:06:37.5205727Z 2025-10-10T00:06:37.5205734Z 2025-10-10T00:06:37.5205934Z def get_potential_pr_author( 2025-10-10T00:06:37.5206598Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:06:37.5207285Z ) -> str: 2025-10-10T00:06:37.5207943Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:06:37.5208765Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:06:37.5209511Z # embedded in the tag name: ciflow// 2025-10-10T00:06:37.5209937Z 2025-10-10T00:06:37.5210134Z gh = get_gh_client(github_token) 2025-10-10T00:06:37.5210470Z 2025-10-10T00:06:37.5210744Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:06:37.5211368Z split_tag = ref_name.split("/") 2025-10-10T00:06:37.5211875Z if ( 2025-10-10T00:06:37.5212269Z len(split_tag) == 3 2025-10-10T00:06:37.5212763Z and split_tag[0] == "ciflow" 2025-10-10T00:06:37.5213290Z and split_tag[2].isnumeric() 2025-10-10T00:06:37.5213798Z ): 2025-10-10T00:06:37.5214180Z pr_number = split_tag[2] 2025-10-10T00:06:37.5214817Z try: 2025-10-10T00:06:37.5215248Z repository = gh.get_repo(repo) 2025-10-10T00:06:37.5215880Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:06:37.5216487Z except Exception as e: 2025-10-10T00:06:37.5217005Z raise Exception( # noqa: TRY002 2025-10-10T00:06:37.5217848Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:06:37.5218513Z ) from e 2025-10-10T00:06:37.5219060Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:06:37.5219757Z # In all other cases, return the original input username 2025-10-10T00:06:37.5220357Z return username 2025-10-10T00:06:37.5220603Z 2025-10-10T00:06:37.5220610Z 2025-10-10T00:06:37.5220846Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:06:37.5221393Z """ 2025-10-10T00:06:37.5222045Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:06:37.5222850Z """ 2025-10-10T00:06:37.5223411Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:06:37.5223945Z 2025-10-10T00:06:37.5223951Z 2025-10-10T00:06:37.5224154Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:06:37.5224657Z try: 2025-10-10T00:06:37.5225045Z data = yaml.safe_load(yaml_text) 2025-10-10T00:06:37.5225558Z return data 2025-10-10T00:06:37.5225984Z except yaml.YAMLError: 2025-10-10T00:06:37.5226466Z log.exception("Error loading YAML") 2025-10-10T00:06:37.5226990Z raise 2025-10-10T00:06:37.5227210Z 2025-10-10T00:06:37.5227217Z 2025-10-10T00:06:37.5227802Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:06:37.5228565Z """ 2025-10-10T00:06:37.5229195Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:06:37.5229884Z 2025-10-10T00:06:37.5230386Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:06:37.5231195Z and the text below is the list of opted in users. 2025-10-10T00:06:37.5231604Z 2025-10-10T00:06:37.5231987Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:06:37.5232701Z """ 2025-10-10T00:06:37.5233152Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:06:37.5233795Z if len(rollout_state_parts) >= 2: 2025-10-10T00:06:37.5234415Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:06:37.5235025Z else: 2025-10-10T00:06:37.5235420Z return "", rollout_state 2025-10-10T00:06:37.5235739Z 2025-10-10T00:06:37.5235746Z 2025-10-10T00:06:37.5235945Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:06:37.5236469Z """ 2025-10-10T00:06:37.5236997Z Dictionary of users with a list of features they have opted into 2025-10-10T00:06:37.5237785Z """ 2025-10-10T00:06:37.5237991Z 2025-10-10T00:06:37.5237998Z 2025-10-10T00:06:37.5238351Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:06:37.5239030Z """ 2025-10-10T00:06:37.5239748Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:06:37.5240440Z 2025-10-10T00:06:37.5241066Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:06:37.5242077Z - Example line: "@User1,lf,split_build" 2025-10-10T00:06:37.5242776Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:06:37.5243274Z 2025-10-10T00:06:37.5243281Z 2025-10-10T00:06:37.5243440Z """ 2025-10-10T00:06:37.5243820Z optins = UserOptins() 2025-10-10T00:06:37.5244313Z for user in user_optin_text.split("\n"): 2025-10-10T00:06:37.5244879Z user = user.strip("\r\n\t -") 2025-10-10T00:06:37.5245432Z if not user or not user.startswith("@"): 2025-10-10T00:06:37.5246141Z # Not a valid user. Skip 2025-10-10T00:06:37.5246643Z continue 2025-10-10T00:06:37.5246902Z 2025-10-10T00:06:37.5247064Z if user: 2025-10-10T00:06:37.5247615Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:06:37.5248337Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:06:37.5248841Z 2025-10-10T00:06:37.5249020Z return optins 2025-10-10T00:06:37.5249257Z 2025-10-10T00:06:37.5249264Z 2025-10-10T00:06:37.5249559Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:06:37.5250175Z """ 2025-10-10T00:06:37.5250574Z Check if the experiment name is valid. 2025-10-10T00:06:37.5251110Z A valid name: 2025-10-10T00:06:37.5251758Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:06:37.5252754Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:06:37.5253515Z - Cannot contain spaces 2025-10-10T00:06:37.5253982Z """ 2025-10-10T00:06:37.5254178Z 2025-10-10T00:06:37.5254456Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:06:37.5255175Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:06:37.5255643Z 2025-10-10T00:06:37.5255809Z if valid: 2025-10-10T00:06:37.5256191Z return True 2025-10-10T00:06:37.5256441Z 2025-10-10T00:06:37.5256606Z log.error( 2025-10-10T00:06:37.5258225Z 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-10-10T00:06:37.5259828Z ) 2025-10-10T00:06:37.5260199Z return False 2025-10-10T00:06:37.5260435Z 2025-10-10T00:06:37.5260443Z 2025-10-10T00:06:37.5260752Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:06:37.5261392Z """ 2025-10-10T00:06:37.5262117Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:06:37.5262875Z """ 2025-10-10T00:06:37.5263236Z try: 2025-10-10T00:06:37.5263604Z if settings_text: 2025-10-10T00:06:37.5264344Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:06:37.5265151Z # for easy reading 2025-10-10T00:06:37.5265959Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:06:37.5266857Z # the backtick character in shell commands. 2025-10-10T00:06:37.5267611Z backtick = chr(96) # backtick character 2025-10-10T00:06:37.5268298Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:06:37.5268980Z settings = load_yaml(settings_text) 2025-10-10T00:06:37.5269364Z 2025-10-10T00:06:37.5269799Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:06:37.5270576Z experiments = {} 2025-10-10T00:06:37.5270882Z 2025-10-10T00:06:37.5271277Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:06:37.5272058Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:06:37.5273194Z # 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-10-10T00:06:37.5274269Z continue 2025-10-10T00:06:37.5274556Z 2025-10-10T00:06:37.5274742Z valid_settings = {} 2025-10-10T00:06:37.5275274Z for setting in exp_settings: 2025-10-10T00:06:37.5275853Z if setting not in Experiment._fields: 2025-10-10T00:06:37.5276424Z log.warning( 2025-10-10T00:06:37.5277138Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:06:37.5278174Z ) 2025-10-10T00:06:37.5278618Z else: 2025-10-10T00:06:37.5279134Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:06:37.5279562Z 2025-10-10T00:06:37.5279851Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:06:37.5280505Z return Settings(experiments) 2025-10-10T00:06:37.5280862Z 2025-10-10T00:06:37.5281047Z except Exception: 2025-10-10T00:06:37.5281532Z log.exception("Failed to parse settings") 2025-10-10T00:06:37.5281933Z 2025-10-10T00:06:37.5282107Z return Settings() 2025-10-10T00:06:37.5282367Z 2025-10-10T00:06:37.5282373Z 2025-10-10T00:06:37.5282631Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:06:37.5283207Z """ 2025-10-10T00:06:37.5283650Z Parse settings, if any, from the rollout state. 2025-10-10T00:06:37.5284062Z 2025-10-10T00:06:37.5284420Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:06:37.5285206Z and the text below is the list of opted in users. 2025-10-10T00:06:37.5285634Z 2025-10-10T00:06:37.5286056Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:06:37.5286801Z """ 2025-10-10T00:06:37.5287372Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:06:37.5288254Z return parse_settings_from_text(settings_text) 2025-10-10T00:06:37.5288672Z 2025-10-10T00:06:37.5288679Z 2025-10-10T00:06:37.5288931Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:06:37.5289496Z """ 2025-10-10T00:06:37.5289893Z Parse users from the rollout state. 2025-10-10T00:06:37.5290252Z 2025-10-10T00:06:37.5290424Z """ 2025-10-10T00:06:37.5290952Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:06:37.5291717Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:06:37.5292138Z 2025-10-10T00:06:37.5292145Z 2025-10-10T00:06:37.5292698Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:06:37.5293470Z """ 2025-10-10T00:06:37.5293893Z Check if a user is opted into an experiment 2025-10-10T00:06:37.5294452Z """ 2025-10-10T00:06:37.5294918Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:06:37.5295347Z 2025-10-10T00:06:37.5295354Z 2025-10-10T00:06:37.5295781Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:06:37.5296551Z """ 2025-10-10T00:06:37.5297012Z Check if a user explicitly opted out of an experiment 2025-10-10T00:06:37.5297773Z """ 2025-10-10T00:06:37.5298300Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:06:37.5299008Z experiment_optout = "-" + experiment_name 2025-10-10T00:06:37.5299664Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:06:37.5300313Z return False 2025-10-10T00:06:37.5300590Z 2025-10-10T00:06:37.5300882Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:06:37.5301496Z log.warning( 2025-10-10T00:06:37.5302327Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:06:37.5303225Z ) 2025-10-10T00:06:37.5303440Z 2025-10-10T00:06:37.5303609Z return True 2025-10-10T00:06:37.5303847Z 2025-10-10T00:06:37.5303854Z 2025-10-10T00:06:37.5304039Z def get_runner_prefix( 2025-10-10T00:06:37.5304487Z rollout_state: str, 2025-10-10T00:06:37.5304958Z workflow_requestors: Iterable[str], 2025-10-10T00:06:37.5305484Z branch: str, 2025-10-10T00:06:37.5305983Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:06:37.5306659Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:06:37.5307273Z is_canary: bool = False, 2025-10-10T00:06:37.5308422Z ) -> str: 2025-10-10T00:06:37.5309074Z settings = parse_settings(rollout_state) 2025-10-10T00:06:37.5309690Z user_optins = parse_users(rollout_state) 2025-10-10T00:06:37.5310078Z 2025-10-10T00:06:37.5310257Z fleet_prefix = "" 2025-10-10T00:06:37.5310693Z prefixes = [] 2025-10-10T00:06:37.5311322Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:06:37.5312279Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:06:37.5313015Z log.info( 2025-10-10T00:06:37.5313705Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:06:37.5314487Z ) 2025-10-10T00:06:37.5314868Z continue 2025-10-10T00:06:37.5315119Z 2025-10-10T00:06:37.5315314Z if opt_out_experiments: 2025-10-10T00:06:37.5315861Z if experiment_name in opt_out_experiments: 2025-10-10T00:06:37.5316526Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:06:37.5317134Z log.info( 2025-10-10T00:06:37.5318205Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:06:37.5319202Z ) 2025-10-10T00:06:37.5319614Z continue 2025-10-10T00:06:37.5319888Z 2025-10-10T00:06:37.5320090Z if eligible_experiments: 2025-10-10T00:06:37.5320699Z if experiment_name not in eligible_experiments: 2025-10-10T00:06:37.5321359Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:06:37.5321928Z log.info( 2025-10-10T00:06:37.5322725Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:06:37.5323576Z ) 2025-10-10T00:06:37.5323983Z continue 2025-10-10T00:06:37.5324470Z elif not experiment_settings.default: 2025-10-10T00:06:37.5325014Z log.info( 2025-10-10T00:06:37.5325826Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:06:37.5326593Z ) 2025-10-10T00:06:37.5326981Z continue 2025-10-10T00:06:37.5327234Z 2025-10-10T00:06:37.5327663Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:06:37.5328320Z opted_out_users = [ 2025-10-10T00:06:37.5328772Z requestor 2025-10-10T00:06:37.5329239Z for requestor in workflow_requestors 2025-10-10T00:06:37.5329971Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:06:37.5330610Z ] 2025-10-10T00:06:37.5330821Z 2025-10-10T00:06:37.5331007Z if opted_out_users: 2025-10-10T00:06:37.5331457Z log.info( 2025-10-10T00:06:37.5332097Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:06:37.5332815Z ) 2025-10-10T00:06:37.5333200Z continue 2025-10-10T00:06:37.5333481Z 2025-10-10T00:06:37.5333776Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:06:37.5334424Z opted_in_users = [ 2025-10-10T00:06:37.5334889Z requestor 2025-10-10T00:06:37.5335350Z for requestor in workflow_requestors 2025-10-10T00:06:37.5336040Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:06:37.5336678Z ] 2025-10-10T00:06:37.5336893Z 2025-10-10T00:06:37.5337068Z enabled = False 2025-10-10T00:06:37.5337605Z if opted_in_users: 2025-10-10T00:06:37.5338069Z log.info( 2025-10-10T00:06:37.5338691Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:06:37.5339396Z ) 2025-10-10T00:06:37.5339793Z enabled = True 2025-10-10T00:06:37.5340080Z 2025-10-10T00:06:37.5340306Z elif experiment_settings.rollout_perc: 2025-10-10T00:06:37.5341166Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:06:37.5342273Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:06:37.5342958Z log.info( 2025-10-10T00:06:37.5343835Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:06:37.5344783Z ) 2025-10-10T00:06:37.5345194Z enabled = True 2025-10-10T00:06:37.5345499Z 2025-10-10T00:06:37.5345669Z if enabled: 2025-10-10T00:06:37.5346097Z label = experiment_name 2025-10-10T00:06:37.5346658Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:06:37.5347616Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:06:37.5348531Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:06:37.5349320Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:06:37.5350012Z if is_canary: 2025-10-10T00:06:37.5350508Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:06:37.5351077Z fleet_prefix = label 2025-10-10T00:06:37.5351568Z else: 2025-10-10T00:06:37.5352004Z prefixes.append(label) 2025-10-10T00:06:37.5352361Z 2025-10-10T00:06:37.5352557Z if len(prefixes) > 1: 2025-10-10T00:06:37.5353011Z log.error( 2025-10-10T00:06:37.5354057Z 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-10-10T00:06:37.5355206Z ) 2025-10-10T00:06:37.5355595Z prefixes = prefixes[:1] 2025-10-10T00:06:37.5355908Z 2025-10-10T00:06:37.5356103Z # Fleet always comes first 2025-10-10T00:06:37.5356595Z if fleet_prefix: 2025-10-10T00:06:37.5357050Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:06:37.5357429Z 2025-10-10T00:06:37.5357916Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:06:37.5358362Z 2025-10-10T00:06:37.5358370Z 2025-10-10T00:06:37.5358841Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:06:37.5359626Z """ 2025-10-10T00:06:37.5360221Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:06:37.5360805Z 2025-10-10T00:06:37.5361198Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:06:37.5361926Z """ 2025-10-10T00:06:37.5362311Z gh = get_gh_client(github_token) 2025-10-10T00:06:37.5362864Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:06:37.5363511Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:06:37.5363982Z 2025-10-10T00:06:37.5363989Z 2025-10-10T00:06:37.5364395Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:06:37.5365180Z for _ in range(num_retries): 2025-10-10T00:06:37.5365660Z try: 2025-10-10T00:06:37.5366101Z req = Request(url=url, headers=headers) 2025-10-10T00:06:37.5366781Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:06:37.5367448Z return json.loads(content) 2025-10-10T00:06:37.5368098Z except Exception as e: 2025-10-10T00:06:37.5368654Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:06:37.5369070Z 2025-10-10T00:06:37.5369465Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:06:37.5370191Z return {} 2025-10-10T00:06:37.5370420Z 2025-10-10T00:06:37.5370433Z 2025-10-10T00:06:37.5370594Z @cache 2025-10-10T00:06:37.5371223Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:06:37.5371994Z """ 2025-10-10T00:06:37.5372393Z Dynamically get PR information 2025-10-10T00:06:37.5373029Z """ 2025-10-10T00:06:37.5373539Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:06:37.5374177Z headers = { 2025-10-10T00:06:37.5374642Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:06:37.5375264Z "Authorization": f"token {github_token}", 2025-10-10T00:06:37.5375813Z } 2025-10-10T00:06:37.5376245Z json_response: dict[str, Any] = download_json( 2025-10-10T00:06:37.5376865Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:06:37.5377421Z headers=headers, 2025-10-10T00:06:37.5377973Z ) 2025-10-10T00:06:37.5378180Z 2025-10-10T00:06:37.5378367Z if not json_response: 2025-10-10T00:06:37.5378950Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:06:37.5379576Z return {} 2025-10-10T00:06:37.5379812Z 2025-10-10T00:06:37.5379994Z return json_response 2025-10-10T00:06:37.5380274Z 2025-10-10T00:06:37.5380286Z 2025-10-10T00:06:37.5380696Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:06:37.5381459Z """ 2025-10-10T00:06:37.5381994Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:06:37.5382667Z """ 2025-10-10T00:06:37.5383154Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:06:37.5383779Z return { 2025-10-10T00:06:37.5384387Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:06:37.5385108Z } 2025-10-10T00:06:37.5385310Z 2025-10-10T00:06:37.5385316Z 2025-10-10T00:06:37.5385491Z def main() -> None: 2025-10-10T00:06:37.5385918Z args = parse_args() 2025-10-10T00:06:37.5386198Z 2025-10-10T00:06:37.5386436Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:06:37.5386843Z 2025-10-10T00:06:37.5387039Z # Check if the PR is opt-out 2025-10-10T00:06:37.5387645Z if args.pr_number: 2025-10-10T00:06:37.5388318Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:06:37.5389235Z if OPT_OUT_LABEL in labels: 2025-10-10T00:06:37.5389748Z log.info( 2025-10-10T00:06:37.5390467Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:06:37.5391255Z ) 2025-10-10T00:06:37.5391823Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:06:37.5392506Z sys.exit() 2025-10-10T00:06:37.5392779Z 2025-10-10T00:06:37.5392943Z try: 2025-10-10T00:06:37.5393392Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:06:37.5394123Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:06:37.5394784Z ) 2025-10-10T00:06:37.5394997Z 2025-10-10T00:06:37.5395208Z username = get_potential_pr_author( 2025-10-10T00:06:37.5395772Z args.github_token, 2025-10-10T00:06:37.5396257Z args.github_repo, 2025-10-10T00:06:37.5396754Z args.github_actor, 2025-10-10T00:06:37.5397247Z args.github_ref_type, 2025-10-10T00:06:37.5397877Z args.github_branch, 2025-10-10T00:06:37.5398364Z ) 2025-10-10T00:06:37.5398576Z 2025-10-10T00:06:37.5398861Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:06:37.5399334Z 2025-10-10T00:06:37.5399574Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:06:37.5400143Z rollout_state, 2025-10-10T00:06:37.5400649Z (args.github_issue_owner, username), 2025-10-10T00:06:37.5401219Z args.github_branch, 2025-10-10T00:06:37.5401724Z args.eligible_experiments, 2025-10-10T00:06:37.5402284Z args.opt_out_experiments, 2025-10-10T00:06:37.5402795Z is_canary, 2025-10-10T00:06:37.5403210Z ) 2025-10-10T00:06:37.5403420Z 2025-10-10T00:06:37.5403609Z except Exception as e: 2025-10-10T00:06:37.5404068Z log.error( 2025-10-10T00:06:37.5404751Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:06:37.5405683Z ) 2025-10-10T00:06:37.5405903Z 2025-10-10T00:06:37.5406243Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:06:37.5406766Z 2025-10-10T00:06:37.5406773Z 2025-10-10T00:06:37.5406957Z if __name__ == "__main__": 2025-10-10T00:06:37.5407405Z main() 2025-10-10T00:06:37.5407732Z 2025-10-10T00:06:37.5507694Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:06:37.5508675Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:06:37.5542643Z shell: /usr/bin/bash -e {0} 2025-10-10T00:06:37.5543168Z env: 2025-10-10T00:06:37.5543876Z GITHUB_TOKEN: *** 2025-10-10T00:06:37.5544306Z ISSUE_NUMBER: 5132 2025-10-10T00:06:37.5544767Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:06:37.5545292Z ISSUE_OWNER: 2025-10-10T00:06:37.5545714Z CHECK_EXPERIMENTS: 2025-10-10T00:06:37.5546149Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:06:37.5546613Z PR_NUMBER: 2025-10-10T00:06:37.5547000Z ##[endgroup] 2025-10-10T00:06:40.3426088Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:06:41.6233734Z Collecting urllib3==1.26.18 2025-10-10T00:06:41.6896889Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:06:41.7178102Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.7 MB/s eta 0:00:00 2025-10-10T00:06:41.7501427Z Collecting PyGithub==2.3.0 2025-10-10T00:06:41.7643155Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:06:41.8091858Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:06:41.8231093Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:06:41.8278215Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:06:41.8295732Z 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-10-10T00:06:41.8310891Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:06:41.8584782Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:06:41.8724480Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:06:41.8961424Z 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-10-10T00:06:42.0242292Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:06:42.0385072Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:06:42.1774145Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:06:42.1916251Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-10-10T00:06:42.2129075Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:06:42.2271490Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:06:42.2629001Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:06:42.2817027Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.0 MB/s eta 0:00:00 2025-10-10T00:06:42.2958596Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:06:42.3130465Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 22.5 MB/s eta 0:00:00 2025-10-10T00:06:42.3271257Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:06:42.3497921Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 66.9 MB/s eta 0:00:00 2025-10-10T00:06:42.3635717Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:06:42.3797864Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:06:42.3847708Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 66.4 MB/s eta 0:00:00 2025-10-10T00:06:42.3998413Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:06:42.4042488Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 29.6 MB/s eta 0:00:00 2025-10-10T00:06:42.4182122Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:06:42.4226600Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 39.9 MB/s eta 0:00:00 2025-10-10T00:06:42.8196301Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:06:43.3639870Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:06:43.4754686Z ##[group]Run curr_branch="main" 2025-10-10T00:06:43.4755014Z curr_branch="main" 2025-10-10T00:06:43.4755239Z curr_ref_type="branch" 2025-10-10T00:06:43.4755503Z echo "Current branch is '$curr_branch'" 2025-10-10T00:06:43.4755779Z  2025-10-10T00:06:43.4755983Z python3 runner_determinator.py \ 2025-10-10T00:06:43.4756273Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:06:43.4756569Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:06:43.4756845Z  --github-branch "$curr_branch" \ 2025-10-10T00:06:43.4757121Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:06:43.4757419Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:06:43.4757971Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:06:43.4758255Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:06:43.4758566Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:06:43.4758934Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:06:43.4759237Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:06:43.4793049Z shell: /usr/bin/bash -e {0} 2025-10-10T00:06:43.4793294Z env: 2025-10-10T00:06:43.4793913Z GITHUB_TOKEN: *** 2025-10-10T00:06:43.4794119Z ISSUE_NUMBER: 5132 2025-10-10T00:06:43.4794346Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:06:43.4794583Z ISSUE_OWNER: 2025-10-10T00:06:43.4794781Z CHECK_EXPERIMENTS: 2025-10-10T00:06:43.4794990Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:06:43.4795199Z PR_NUMBER: 2025-10-10T00:06:43.4795380Z ##[endgroup] 2025-10-10T00:06:43.4851045Z Current branch is 'main' 2025-10-10T00:06:45.0744202Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-10-10T00:06:45.0745671Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:06:45.0746957Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:06:45.0749166Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:06:45.0750150Z INFO : Setting output: label-type='lf.' 2025-10-10T00:06:45.1117354Z Evaluate and set job outputs 2025-10-10T00:06:45.1124099Z Set output 'label-type' 2025-10-10T00:06:45.1125900Z Cleaning up orphan processes