2025-07-17T06:33:19.6614639Z Current runner version: '2.326.0' 2025-07-17T06:33:19.6637094Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.6638027Z Hosted Compute Agent 2025-07-17T06:33:19.6638542Z Version: 20250711.363 2025-07-17T06:33:19.6639114Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.6639823Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.6640700Z ##[endgroup] 2025-07-17T06:33:19.6641230Z ##[group]Operating System 2025-07-17T06:33:19.6641855Z Ubuntu 2025-07-17T06:33:19.6642363Z 24.04.2 2025-07-17T06:33:19.6642785Z LTS 2025-07-17T06:33:19.6643281Z ##[endgroup] 2025-07-17T06:33:19.6643722Z ##[group]Runner Image 2025-07-17T06:33:19.6644287Z Image: ubuntu-24.04 2025-07-17T06:33:19.6644771Z Version: 20250710.1.0 2025-07-17T06:33:19.6645765Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.6647199Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.6648207Z ##[endgroup] 2025-07-17T06:33:19.6649076Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.6651097Z Metadata: read 2025-07-17T06:33:19.6651644Z ##[endgroup] 2025-07-17T06:33:19.6653516Z Secret source: Actions 2025-07-17T06:33:19.6654318Z Prepare workflow directory 2025-07-17T06:33:19.7347988Z Prepare all required actions 2025-07-17T06:33:19.7429020Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.7436210Z ##[group] Inputs 2025-07-17T06:33:19.7437082Z check_experiments: 2025-07-17T06:33:19.7438089Z opt_out_experiments: 2025-07-17T06:33:19.7438957Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.7439964Z issue_owner: 2025-07-17T06:33:19.7441114Z curr_branch: main 2025-07-17T06:33:19.7441906Z curr_ref_type: branch 2025-07-17T06:33:19.7442742Z issue_number: 5132 2025-07-17T06:33:19.7443911Z ##[endgroup] 2025-07-17T06:33:19.7444860Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.2808658Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.2811351Z cat < runner_determinator.py 2025-07-17T06:33:20.2812037Z # flake8: noqa: G004 2025-07-17T06:33:20.2812619Z  2025-07-17T06:33:20.2813428Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.2814549Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.2815541Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.2816286Z  2025-07-17T06:33:20.2816776Z """ 2025-07-17T06:33:20.2817474Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.2818552Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.2819765Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.2820922Z of which runners should be used to run which job. 2025-07-17T06:33:20.2821665Z  2025-07-17T06:33:20.2822407Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.2823483Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.2824579Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.2825457Z list, defined. 2025-07-17T06:33:20.2825957Z  2025-07-17T06:33:20.2826996Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.2828081Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.2829046Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.2829842Z  2025-07-17T06:33:20.2830692Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.2831989Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.2832965Z experiments which the user could be opted in to. 2025-07-17T06:33:20.2833630Z  2025-07-17T06:33:20.2834153Z The user list has the following rules: 2025-07-17T06:33:20.2834787Z  2025-07-17T06:33:20.2835521Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.2836507Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.2837482Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.2838182Z  2025-07-17T06:33:20.2838625Z Example config: 2025-07-17T06:33:20.2839282Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.2840468Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.2841346Z  # Expected syntax is: 2025-07-17T06:33:20.2842217Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.2843335Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.2844232Z  2025-07-17T06:33:20.2844732Z  experiments: 2025-07-17T06:33:20.2845385Z  lf: 2025-07-17T06:33:20.2845876Z  rollout_percent: 25 2025-07-17T06:33:20.2846479Z  all_branches: false 2025-07-17T06:33:20.2847143Z  default: true 2025-07-17T06:33:20.2847672Z  --- 2025-07-17T06:33:20.2848152Z  2025-07-17T06:33:20.2848684Z  # Opt-ins: 2025-07-17T06:33:20.2849442Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.2850723Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.2924763Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.2926230Z  # Experiments should be from the above list. 2025-07-17T06:33:20.2927370Z  2025-07-17T06:33:20.2928206Z  @User1,-lf,split_build 2025-07-17T06:33:20.2929228Z  @User2,lf 2025-07-17T06:33:20.2929832Z  @User3,split_build 2025-07-17T06:33:20.2930579Z """ 2025-07-17T06:33:20.2930965Z  2025-07-17T06:33:20.2931343Z import json 2025-07-17T06:33:20.2931779Z import logging 2025-07-17T06:33:20.2932220Z import os 2025-07-17T06:33:20.2932632Z import random 2025-07-17T06:33:20.2933066Z import re 2025-07-17T06:33:20.2933466Z import sys 2025-07-17T06:33:20.2933936Z from argparse import ArgumentParser 2025-07-17T06:33:20.2934599Z from collections.abc import Iterable 2025-07-17T06:33:20.2935194Z from functools import cache 2025-07-17T06:33:20.2935732Z from logging import LogRecord 2025-07-17T06:33:20.2936294Z from typing import Any, NamedTuple 2025-07-17T06:33:20.2936923Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.2937512Z  2025-07-17T06:33:20.2937882Z import yaml 2025-07-17T06:33:20.2938338Z from github import Auth, Github 2025-07-17T06:33:20.2938891Z from github.Issue import Issue 2025-07-17T06:33:20.2939404Z  2025-07-17T06:33:20.2939767Z  2025-07-17T06:33:20.2940442Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.2941212Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.2942166Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.2942915Z  2025-07-17T06:33:20.2943387Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.2944304Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.2944890Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.2945532Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.2946095Z  2025-07-17T06:33:20.2946528Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.2947069Z  2025-07-17T06:33:20.2947464Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.2947989Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.2948471Z  2025-07-17T06:33:20.2948827Z  2025-07-17T06:33:20.2949221Z class Experiment(NamedTuple): 2025-07-17T06:33:20.2949768Z  rollout_perc: float = ( 2025-07-17T06:33:20.2950683Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.2951409Z  ) 2025-07-17T06:33:20.2951826Z  all_branches: bool = ( 2025-07-17T06:33:20.2952556Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.2953288Z  ) 2025-07-17T06:33:20.2953689Z  default: bool = ( 2025-07-17T06:33:20.2954344Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.2955032Z  ) 2025-07-17T06:33:20.2955408Z  2025-07-17T06:33:20.2955804Z  # Add more fields as needed 2025-07-17T06:33:20.2956320Z  2025-07-17T06:33:20.2956693Z  2025-07-17T06:33:20.2957088Z class Settings(NamedTuple): 2025-07-17T06:33:20.2957593Z  """ 2025-07-17T06:33:20.2958125Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.2958752Z  """ 2025-07-17T06:33:20.2959140Z  2025-07-17T06:33:20.2959587Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.2960384Z  2025-07-17T06:33:20.2960914Z  2025-07-17T06:33:20.2961439Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.2962134Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.2962755Z  2025-07-17T06:33:20.2963129Z  COLORS = { 2025-07-17T06:33:20.2963605Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.2964158Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.2964709Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.2965267Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.2965815Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.2966333Z  } 2025-07-17T06:33:20.2966713Z  2025-07-17T06:33:20.2967162Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.2967968Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.2968805Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.2969441Z  return super().format(record) 2025-07-17T06:33:20.2969968Z  2025-07-17T06:33:20.2970607Z  2025-07-17T06:33:20.2971024Z handler = logging.StreamHandler() 2025-07-17T06:33:20.2971820Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.2972583Z  2025-07-17T06:33:20.2973063Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.2973708Z log.addHandler(handler) 2025-07-17T06:33:20.2974214Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.2974707Z  2025-07-17T06:33:20.2975063Z  2025-07-17T06:33:20.2975557Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.2976171Z  """ 2025-07-17T06:33:20.2976740Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.2977424Z  """ 2025-07-17T06:33:20.2977982Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.2979139Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.2980522Z  log.warning( 2025-07-17T06:33:20.2981486Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.2982460Z  ) 2025-07-17T06:33:20.2982964Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.2983559Z  return 2025-07-17T06:33:20.2983987Z  2025-07-17T06:33:20.2984418Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.2985051Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.2985675Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.2986195Z  2025-07-17T06:33:20.2986580Z  2025-07-17T06:33:20.2987130Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.2987852Z  return frozenset( 2025-07-17T06:33:20.2988557Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.2989285Z  ) 2025-07-17T06:33:20.2989683Z  2025-07-17T06:33:20.2990206Z  2025-07-17T06:33:20.2990629Z def parse_args() -> Any: 2025-07-17T06:33:20.2991283Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.2992225Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.2993054Z  parser.add_argument( 2025-07-17T06:33:20.2993582Z  "--github-issue-repo", 2025-07-17T06:33:20.2994122Z  type=str, 2025-07-17T06:33:20.2994596Z  required=False, 2025-07-17T06:33:20.2995262Z  default="pytorch/test-infra", 2025-07-17T06:33:20.2995876Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.2996431Z  ) 2025-07-17T06:33:20.2996842Z  parser.add_argument( 2025-07-17T06:33:20.2997356Z  "--github-repo", 2025-07-17T06:33:20.2997852Z  type=str, 2025-07-17T06:33:20.2998321Z  required=True, 2025-07-17T06:33:20.2998872Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.2999433Z  ) 2025-07-17T06:33:20.2999866Z  parser.add_argument( 2025-07-17T06:33:20.3000789Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.3001498Z  ) 2025-07-17T06:33:20.3001944Z  parser.add_argument( 2025-07-17T06:33:20.3002665Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.3003396Z  ) 2025-07-17T06:33:20.3003809Z  parser.add_argument( 2025-07-17T06:33:20.3004540Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.3005279Z  ) 2025-07-17T06:33:20.3005702Z  parser.add_argument( 2025-07-17T06:33:20.3006455Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.3007212Z  ) 2025-07-17T06:33:20.3007643Z  parser.add_argument( 2025-07-17T06:33:20.3008155Z  "--github-ref-type", 2025-07-17T06:33:20.3008677Z  type=str, 2025-07-17T06:33:20.3009144Z  required=True, 2025-07-17T06:33:20.3009726Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.3010510Z  ) 2025-07-17T06:33:20.3010929Z  parser.add_argument( 2025-07-17T06:33:20.3011473Z  "--eligible-experiments", 2025-07-17T06:33:20.3012223Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3012794Z  required=False, 2025-07-17T06:33:20.3013291Z  default="", 2025-07-17T06:33:20.3014229Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.3015205Z  ) 2025-07-17T06:33:20.3015615Z  parser.add_argument( 2025-07-17T06:33:20.3016144Z  "--opt-out-experiments", 2025-07-17T06:33:20.3016722Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3017280Z  required=False, 2025-07-17T06:33:20.3017772Z  default="", 2025-07-17T06:33:20.3018235Z  help=( 2025-07-17T06:33:20.3018990Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.3020397Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.3021298Z  ), 2025-07-17T06:33:20.3021705Z  ) 2025-07-17T06:33:20.3022114Z  parser.add_argument( 2025-07-17T06:33:20.3022620Z  "--pr-number", 2025-07-17T06:33:20.3023113Z  type=str, 2025-07-17T06:33:20.3023585Z  required=False, 2025-07-17T06:33:20.3024072Z  default="", 2025-07-17T06:33:20.3024630Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.3025237Z  ) 2025-07-17T06:33:20.3025626Z  2025-07-17T06:33:20.3026035Z  return parser.parse_args() 2025-07-17T06:33:20.3026547Z  2025-07-17T06:33:20.3026909Z  2025-07-17T06:33:20.3027558Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3028507Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.3029102Z  return Github(auth=auth) 2025-07-17T06:33:20.3029612Z  2025-07-17T06:33:20.3029974Z  2025-07-17T06:33:20.3030867Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3031733Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.3032305Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.3032886Z  2025-07-17T06:33:20.3033249Z  2025-07-17T06:33:20.3033651Z def get_potential_pr_author( 2025-07-17T06:33:20.3034379Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.3035108Z ) -> str: 2025-07-17T06:33:20.3035701Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.3036569Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.3037392Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.3038011Z  2025-07-17T06:33:20.3038434Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3038979Z  2025-07-17T06:33:20.3039489Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.3040432Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.3040995Z  if ( 2025-07-17T06:33:20.3041455Z  len(split_tag) == 3 2025-07-17T06:33:20.3042013Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.3042604Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.3043155Z  ): 2025-07-17T06:33:20.3043612Z  pr_number = split_tag[2] 2025-07-17T06:33:20.3044153Z  try: 2025-07-17T06:33:20.3044650Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.3045335Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.3046144Z  except Exception as e: 2025-07-17T06:33:20.3046741Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.3047482Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.3048178Z  ) from e 2025-07-17T06:33:20.3048811Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.3049580Z  # In all other cases, return the original input username 2025-07-17T06:33:20.3050476Z  return username 2025-07-17T06:33:20.3050945Z  2025-07-17T06:33:20.3051313Z  2025-07-17T06:33:20.3051781Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.3052358Z  """ 2025-07-17T06:33:20.3053081Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.3053916Z  """ 2025-07-17T06:33:20.3054526Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.3055233Z  2025-07-17T06:33:20.3055598Z  2025-07-17T06:33:20.3056019Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.3056570Z  try: 2025-07-17T06:33:20.3057017Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.3057568Z  return data 2025-07-17T06:33:20.3058053Z  except yaml.YAMLError: 2025-07-17T06:33:20.3058611Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.3059169Z  raise 2025-07-17T06:33:20.3059588Z  2025-07-17T06:33:20.3059954Z  2025-07-17T06:33:20.3061254Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.3062054Z  """ 2025-07-17T06:33:20.3062895Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.3063704Z  2025-07-17T06:33:20.3064292Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3065133Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3065740Z  2025-07-17T06:33:20.3066351Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.3067090Z  """ 2025-07-17T06:33:20.3067599Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.3068241Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.3068908Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.3069621Z  else: 2025-07-17T06:33:20.3070324Z  return "", rollout_state 2025-07-17T06:33:20.3070837Z  2025-07-17T06:33:20.3071192Z  2025-07-17T06:33:20.3071631Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.3072183Z  """ 2025-07-17T06:33:20.3072774Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.3073457Z  """ 2025-07-17T06:33:20.3073847Z  2025-07-17T06:33:20.3074193Z  2025-07-17T06:33:20.3074754Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.3075446Z  """ 2025-07-17T06:33:20.3076222Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.3077101Z  2025-07-17T06:33:20.3077950Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.3079013Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.3079772Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.3080756Z  2025-07-17T06:33:20.3081121Z  2025-07-17T06:33:20.3081487Z  """ 2025-07-17T06:33:20.3081941Z  optins = UserOptins() 2025-07-17T06:33:20.3082507Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.3083119Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.3083721Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.3084324Z  # Not a valid user. Skip 2025-07-17T06:33:20.3084866Z  continue 2025-07-17T06:33:20.3085312Z  2025-07-17T06:33:20.3085707Z  if user: 2025-07-17T06:33:20.3086217Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.3086978Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.3087644Z  2025-07-17T06:33:20.3088029Z  return optins 2025-07-17T06:33:20.3088471Z  2025-07-17T06:33:20.3088824Z  2025-07-17T06:33:20.3089361Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.3090119Z  """ 2025-07-17T06:33:20.3090578Z  Check if the experiment name is valid. 2025-07-17T06:33:20.3091138Z  A valid name: 2025-07-17T06:33:20.3091853Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.3092851Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.3093614Z  - Cannot contain spaces 2025-07-17T06:33:20.3094127Z  """ 2025-07-17T06:33:20.3094501Z  2025-07-17T06:33:20.3094991Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.3095759Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.3096529Z  2025-07-17T06:33:20.3096898Z  if valid: 2025-07-17T06:33:20.3097336Z  return True 2025-07-17T06:33:20.3097780Z  2025-07-17T06:33:20.3098144Z  log.error( 2025-07-17T06:33:20.3099680Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:33:20.3101395Z  ) 2025-07-17T06:33:20.3101788Z  return False 2025-07-17T06:33:20.3102229Z  2025-07-17T06:33:20.3102586Z  2025-07-17T06:33:20.3103136Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.3103812Z  """ 2025-07-17T06:33:20.3104469Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.3105218Z  """ 2025-07-17T06:33:20.3105618Z  try: 2025-07-17T06:33:20.3106017Z  if settings_text: 2025-07-17T06:33:20.3106816Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.3107652Z  # for easy reading 2025-07-17T06:33:20.3108525Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.3109478Z  # the backtick character in shell commands. 2025-07-17T06:33:20.3110230Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.3110966Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.3111687Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.3112235Z  2025-07-17T06:33:20.3112877Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.3113784Z  experiments = {} 2025-07-17T06:33:20.3114281Z  2025-07-17T06:33:20.3114876Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.3115683Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.3116852Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:33:20.3117945Z  continue 2025-07-17T06:33:20.3118424Z  2025-07-17T06:33:20.3118816Z  valid_settings = {} 2025-07-17T06:33:20.3119388Z  for setting in exp_settings: 2025-07-17T06:33:20.3119998Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.3120760Z  log.warning( 2025-07-17T06:33:20.3121550Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.3122297Z  ) 2025-07-17T06:33:20.3122784Z  else: 2025-07-17T06:33:20.3123363Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.3123972Z  2025-07-17T06:33:20.3124477Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.3125175Z  return Settings(experiments) 2025-07-17T06:33:20.3125716Z  2025-07-17T06:33:20.3126097Z  except Exception: 2025-07-17T06:33:20.3126652Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.3127216Z  2025-07-17T06:33:20.3127599Z  return Settings() 2025-07-17T06:33:20.3128052Z  2025-07-17T06:33:20.3128404Z  2025-07-17T06:33:20.3129077Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.3129709Z  """ 2025-07-17T06:33:20.3130330Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.3130925Z  2025-07-17T06:33:20.3131496Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3132310Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3132900Z  2025-07-17T06:33:20.3133534Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.3134301Z  """ 2025-07-17T06:33:20.3134910Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3135727Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.3136306Z  2025-07-17T06:33:20.3136650Z  2025-07-17T06:33:20.3137134Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.3137747Z  """ 2025-07-17T06:33:20.3138203Z  Parse users from the rollout state. 2025-07-17T06:33:20.3138745Z  2025-07-17T06:33:20.3139103Z  """ 2025-07-17T06:33:20.3139698Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3140632Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.3141217Z  2025-07-17T06:33:20.3141571Z  2025-07-17T06:33:20.3142237Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3143025Z  """ 2025-07-17T06:33:20.3143502Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.3144074Z  """ 2025-07-17T06:33:20.3144582Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.3145203Z  2025-07-17T06:33:20.3145557Z  2025-07-17T06:33:20.3146369Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3147181Z  """ 2025-07-17T06:33:20.3147707Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.3148330Z  """ 2025-07-17T06:33:20.3148891Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.3149652Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.3150452Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.3151101Z  return False 2025-07-17T06:33:20.3151552Z  2025-07-17T06:33:20.3152054Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.3152692Z  log.warning( 2025-07-17T06:33:20.3153579Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.3154511Z  ) 2025-07-17T06:33:20.3154911Z  2025-07-17T06:33:20.3155287Z  return True 2025-07-17T06:33:20.3155717Z  2025-07-17T06:33:20.3156077Z  2025-07-17T06:33:20.3156459Z def get_runner_prefix( 2025-07-17T06:33:20.3156966Z  rollout_state: str, 2025-07-17T06:33:20.3157506Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.3158063Z  branch: str, 2025-07-17T06:33:20.3158637Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3159369Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3160099Z  is_canary: bool = False, 2025-07-17T06:33:20.3160607Z ) -> str: 2025-07-17T06:33:20.3161102Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.3161744Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.3162299Z  2025-07-17T06:33:20.3162814Z  fleet_prefix = "" 2025-07-17T06:33:20.3163304Z  prefixes = [] 2025-07-17T06:33:20.3164017Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.3165028Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.3165793Z  log.info( 2025-07-17T06:33:20.3166548Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.3167335Z  ) 2025-07-17T06:33:20.3167785Z  continue 2025-07-17T06:33:20.3168229Z  2025-07-17T06:33:20.3168635Z  if opt_out_experiments: 2025-07-17T06:33:20.3169231Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.3169944Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.3170694Z  log.info( 2025-07-17T06:33:20.3171700Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.3172750Z  ) 2025-07-17T06:33:20.3173204Z  continue 2025-07-17T06:33:20.3173674Z  2025-07-17T06:33:20.3174070Z  if eligible_experiments: 2025-07-17T06:33:20.3174701Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.3175390Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.3175975Z  log.info( 2025-07-17T06:33:20.3176825Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.3177701Z  ) 2025-07-17T06:33:20.3178156Z  continue 2025-07-17T06:33:20.3178826Z  elif not experiment_settings.default: 2025-07-17T06:33:20.3179397Z  log.info( 2025-07-17T06:33:20.3180241Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.3181017Z  ) 2025-07-17T06:33:20.3181445Z  continue 2025-07-17T06:33:20.3181892Z  2025-07-17T06:33:20.3182401Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.3183059Z  opted_out_users = [ 2025-07-17T06:33:20.3183571Z  requestor 2025-07-17T06:33:20.3184103Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3184833Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3185503Z  ] 2025-07-17T06:33:20.3185897Z  2025-07-17T06:33:20.3186287Z  if opted_out_users: 2025-07-17T06:33:20.3186810Z  log.info( 2025-07-17T06:33:20.3187515Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.3188256Z  ) 2025-07-17T06:33:20.3188681Z  continue 2025-07-17T06:33:20.3189135Z  2025-07-17T06:33:20.3189629Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.3190387Z  opted_in_users = [ 2025-07-17T06:33:20.3190898Z  requestor 2025-07-17T06:33:20.3191434Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3192157Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3192817Z  ] 2025-07-17T06:33:20.3193221Z  2025-07-17T06:33:20.3193597Z  enabled = False 2025-07-17T06:33:20.3194101Z  if opted_in_users: 2025-07-17T06:33:20.3194725Z  log.info( 2025-07-17T06:33:20.3195419Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.3196129Z  ) 2025-07-17T06:33:20.3196576Z  enabled = True 2025-07-17T06:33:20.3197063Z  2025-07-17T06:33:20.3197495Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.3198390Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.3199393Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.3200196Z  log.info( 2025-07-17T06:33:20.3201145Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.3202104Z  ) 2025-07-17T06:33:20.3202575Z  enabled = True 2025-07-17T06:33:20.3203079Z  2025-07-17T06:33:20.3203457Z  if enabled: 2025-07-17T06:33:20.3203954Z  label = experiment_name 2025-07-17T06:33:20.3204570Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.3205454Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.3206387Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.3207210Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.3207917Z  if is_canary: 2025-07-17T06:33:20.3208557Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.3209150Z  fleet_prefix = label 2025-07-17T06:33:20.3209683Z  else: 2025-07-17T06:33:20.3210282Z  prefixes.append(label) 2025-07-17T06:33:20.3210950Z  2025-07-17T06:33:20.3211340Z  if len(prefixes) > 1: 2025-07-17T06:33:20.3211842Z  log.error( 2025-07-17T06:33:20.3212965Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:33:20.3214133Z  ) 2025-07-17T06:33:20.3214566Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.3215082Z  2025-07-17T06:33:20.3215478Z  # Fleet always comes first 2025-07-17T06:33:20.3216004Z  if fleet_prefix: 2025-07-17T06:33:20.3216518Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.3217065Z  2025-07-17T06:33:20.3217544Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.3218150Z  2025-07-17T06:33:20.3218512Z  2025-07-17T06:33:20.3219197Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.3220109Z  """ 2025-07-17T06:33:20.3220754Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.3221502Z  2025-07-17T06:33:20.3222107Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.3222852Z  """ 2025-07-17T06:33:20.3223292Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3223892Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.3224591Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.3225218Z  2025-07-17T06:33:20.3225579Z  2025-07-17T06:33:20.3226215Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.3227141Z  for _ in range(num_retries): 2025-07-17T06:33:20.3227676Z  try: 2025-07-17T06:33:20.3228164Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.3228884Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.3229571Z  return json.loads(content) 2025-07-17T06:33:20.3230246Z  except Exception as e: 2025-07-17T06:33:20.3230861Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.3231453Z  2025-07-17T06:33:20.3232068Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.3232886Z  return {} 2025-07-17T06:33:20.3233314Z  2025-07-17T06:33:20.3233665Z  2025-07-17T06:33:20.3234025Z @cache 2025-07-17T06:33:20.3234707Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.3235510Z  """ 2025-07-17T06:33:20.3235950Z  Dynamically get PR information 2025-07-17T06:33:20.3236484Z  """ 2025-07-17T06:33:20.3237038Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.3237702Z  headers = { 2025-07-17T06:33:20.3238234Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.3238886Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.3239456Z  } 2025-07-17T06:33:20.3239935Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.3240720Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.3241306Z  headers=headers, 2025-07-17T06:33:20.3241781Z  ) 2025-07-17T06:33:20.3242160Z  2025-07-17T06:33:20.3242545Z  if not json_response: 2025-07-17T06:33:20.3243197Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.3243999Z  return {} 2025-07-17T06:33:20.3244445Z  2025-07-17T06:33:20.3244824Z  return json_response 2025-07-17T06:33:20.3245304Z  2025-07-17T06:33:20.3245656Z  2025-07-17T06:33:20.3246287Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.3247062Z  """ 2025-07-17T06:33:20.3247643Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.3248332Z  """ 2025-07-17T06:33:20.3248865Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.3249522Z  return { 2025-07-17T06:33:20.3250262Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.3250995Z  } 2025-07-17T06:33:20.3251378Z  2025-07-17T06:33:20.3251734Z  2025-07-17T06:33:20.3252118Z def main() -> None: 2025-07-17T06:33:20.3252594Z  args = parse_args() 2025-07-17T06:33:20.3253074Z  2025-07-17T06:33:20.3253518Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.3254091Z  2025-07-17T06:33:20.3254488Z  # Check if the PR is opt-out 2025-07-17T06:33:20.3255030Z  if args.pr_number: 2025-07-17T06:33:20.3255757Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.3256553Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.3257105Z  log.info( 2025-07-17T06:33:20.3257865Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.3258676Z  ) 2025-07-17T06:33:20.3259295Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3260112Z  sys.exit() 2025-07-17T06:33:20.3260712Z  2025-07-17T06:33:20.3261082Z  try: 2025-07-17T06:33:20.3261575Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.3262336Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.3263021Z  ) 2025-07-17T06:33:20.3263418Z  2025-07-17T06:33:20.3263843Z  username = get_potential_pr_author( 2025-07-17T06:33:20.3264425Z  args.github_token, 2025-07-17T06:33:20.3264954Z  args.github_repo, 2025-07-17T06:33:20.3265485Z  args.github_actor, 2025-07-17T06:33:20.3266024Z  args.github_ref_type, 2025-07-17T06:33:20.3266570Z  args.github_branch, 2025-07-17T06:33:20.3267072Z  ) 2025-07-17T06:33:20.3267469Z  2025-07-17T06:33:20.3267974Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.3268624Z  2025-07-17T06:33:20.3269066Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.3269648Z  rollout_state, 2025-07-17T06:33:20.3270302Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.3270888Z  args.github_branch, 2025-07-17T06:33:20.3271454Z  args.eligible_experiments, 2025-07-17T06:33:20.3272035Z  args.opt_out_experiments, 2025-07-17T06:33:20.3272583Z  is_canary, 2025-07-17T06:33:20.3273046Z  ) 2025-07-17T06:33:20.3273434Z  2025-07-17T06:33:20.3273821Z  except Exception as e: 2025-07-17T06:33:20.3274329Z  log.error( 2025-07-17T06:33:20.3275084Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.3275874Z  ) 2025-07-17T06:33:20.3276282Z  2025-07-17T06:33:20.3276973Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3277672Z  2025-07-17T06:33:20.3278038Z  2025-07-17T06:33:20.3278414Z if __name__ == "__main__": 2025-07-17T06:33:20.3278915Z  main() 2025-07-17T06:33:20.3279311Z  2025-07-17T06:33:20.3279676Z EOF 2025-07-17T06:33:20.3280148Z  2025-07-17T06:33:20.3280544Z cat runner_determinator.py 2025-07-17T06:33:20.3657879Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.3658852Z env: 2025-07-17T06:33:20.3659622Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.3660448Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.3660979Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.3661574Z ISSUE_OWNER: 2025-07-17T06:33:20.3662016Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.3662498Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.3662971Z PR_NUMBER: 2025-07-17T06:33:20.3663399Z ##[endgroup] 2025-07-17T06:33:20.3861199Z # flake8: noqa: G004 2025-07-17T06:33:20.3861574Z 2025-07-17T06:33:20.3862001Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.3862950Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.3863729Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.3864167Z 2025-07-17T06:33:20.3864325Z """ 2025-07-17T06:33:20.3864887Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.3865772Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.3866657Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.3867460Z of which runners should be used to run which job. 2025-07-17T06:33:20.3867851Z 2025-07-17T06:33:20.3868230Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.3869304Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.3870478Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.3871183Z list, defined. 2025-07-17T06:33:20.3871414Z 2025-07-17T06:33:20.3871768Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.3872677Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.3873486Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.3873923Z 2025-07-17T06:33:20.3874293Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.3875137Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.3875858Z experiments which the user could be opted in to. 2025-07-17T06:33:20.3876248Z 2025-07-17T06:33:20.3876440Z The user list has the following rules: 2025-07-17T06:33:20.3876788Z 2025-07-17T06:33:20.3877099Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.3877941Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.3878691Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.3879075Z 2025-07-17T06:33:20.3879251Z Example config: 2025-07-17T06:33:20.3879692Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.3880651Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.3881285Z # Expected syntax is: 2025-07-17T06:33:20.3881921Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.3882881Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.3883483Z 2025-07-17T06:33:20.3883650Z experiments: 2025-07-17T06:33:20.3884033Z lf: 2025-07-17T06:33:20.3884404Z rollout_percent: 25 2025-07-17T06:33:20.3884864Z all_branches: false 2025-07-17T06:33:20.3885480Z default: true 2025-07-17T06:33:20.3885884Z --- 2025-07-17T06:33:20.3886087Z 2025-07-17T06:33:20.3886250Z # Opt-ins: 2025-07-17T06:33:20.3886825Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.3887668Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.3888440Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.3889083Z # Experiments should be from the above list. 2025-07-17T06:33:20.3889456Z 2025-07-17T06:33:20.3889631Z @User1,-lf,split_build 2025-07-17T06:33:20.3890252Z @User2,lf 2025-07-17T06:33:20.3890657Z @User3,split_build 2025-07-17T06:33:20.3891058Z """ 2025-07-17T06:33:20.3891247Z 2025-07-17T06:33:20.3891407Z import json 2025-07-17T06:33:20.3891778Z import logging 2025-07-17T06:33:20.3892150Z import os 2025-07-17T06:33:20.3892513Z import random 2025-07-17T06:33:20.3892892Z import re 2025-07-17T06:33:20.3893245Z import sys 2025-07-17T06:33:20.3893657Z from argparse import ArgumentParser 2025-07-17T06:33:20.3894186Z from collections.abc import Iterable 2025-07-17T06:33:20.3894712Z from functools import cache 2025-07-17T06:33:20.3895182Z from logging import LogRecord 2025-07-17T06:33:20.3895670Z from typing import Any, NamedTuple 2025-07-17T06:33:20.3896198Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.3896564Z 2025-07-17T06:33:20.3896725Z import yaml 2025-07-17T06:33:20.3897104Z from github import Auth, Github 2025-07-17T06:33:20.3897591Z from github.Issue import Issue 2025-07-17T06:33:20.3897893Z 2025-07-17T06:33:20.3897899Z 2025-07-17T06:33:20.3898118Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.3898801Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.3899649Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.3900422Z 2025-07-17T06:33:20.3900651Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.3901369Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.3901880Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.3902435Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.3902782Z 2025-07-17T06:33:20.3902979Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.3903308Z 2025-07-17T06:33:20.3903490Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.3903947Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.3904228Z 2025-07-17T06:33:20.3904234Z 2025-07-17T06:33:20.3904417Z class Experiment(NamedTuple): 2025-07-17T06:33:20.3904894Z rollout_perc: float = ( 2025-07-17T06:33:20.3905510Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.3906192Z ) 2025-07-17T06:33:20.3906554Z all_branches: bool = ( 2025-07-17T06:33:20.3907157Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.3907821Z ) 2025-07-17T06:33:20.3908170Z default: bool = ( 2025-07-17T06:33:20.3908749Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.3909380Z ) 2025-07-17T06:33:20.3909576Z 2025-07-17T06:33:20.3909754Z # Add more fields as needed 2025-07-17T06:33:20.3910240Z 2025-07-17T06:33:20.3910251Z 2025-07-17T06:33:20.3910589Z class Settings(NamedTuple): 2025-07-17T06:33:20.3911430Z """ 2025-07-17T06:33:20.3912144Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.3912749Z """ 2025-07-17T06:33:20.3912961Z 2025-07-17T06:33:20.3913168Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.3913523Z 2025-07-17T06:33:20.3913530Z 2025-07-17T06:33:20.3913737Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.3914354Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.3914801Z 2025-07-17T06:33:20.3914965Z COLORS = { 2025-07-17T06:33:20.3915354Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.3915861Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.3916523Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.3917020Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.3917489Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.3917955Z } 2025-07-17T06:33:20.3918147Z 2025-07-17T06:33:20.3918375Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.3919119Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.3919893Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.3920722Z return super().format(record) 2025-07-17T06:33:20.3921063Z 2025-07-17T06:33:20.3921072Z 2025-07-17T06:33:20.3921273Z handler = logging.StreamHandler() 2025-07-17T06:33:20.3921960Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.3922513Z 2025-07-17T06:33:20.3922753Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.3923323Z log.addHandler(handler) 2025-07-17T06:33:20.3923768Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.3924059Z 2025-07-17T06:33:20.3924066Z 2025-07-17T06:33:20.3924322Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.3924875Z """ 2025-07-17T06:33:20.3925369Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.3925987Z """ 2025-07-17T06:33:20.3926351Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.3927407Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.3928517Z log.warning( 2025-07-17T06:33:20.3929359Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.3930410Z ) 2025-07-17T06:33:20.3939928Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.3940859Z return 2025-07-17T06:33:20.3941100Z 2025-07-17T06:33:20.3941480Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.3942077Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.3942657Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.3942988Z 2025-07-17T06:33:20.3942995Z 2025-07-17T06:33:20.3943304Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.3943930Z return frozenset( 2025-07-17T06:33:20.3944531Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.3945203Z ) 2025-07-17T06:33:20.3945402Z 2025-07-17T06:33:20.3945410Z 2025-07-17T06:33:20.3945587Z def parse_args() -> Any: 2025-07-17T06:33:20.3946134Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.3946986Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.3947751Z parser.add_argument( 2025-07-17T06:33:20.3948202Z "--github-issue-repo", 2025-07-17T06:33:20.3948658Z type=str, 2025-07-17T06:33:20.3949054Z required=False, 2025-07-17T06:33:20.3949508Z default="pytorch/test-infra", 2025-07-17T06:33:20.3950157Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.3950671Z ) 2025-07-17T06:33:20.3951031Z parser.add_argument( 2025-07-17T06:33:20.3951479Z "--github-repo", 2025-07-17T06:33:20.3951902Z type=str, 2025-07-17T06:33:20.3952292Z required=True, 2025-07-17T06:33:20.3952748Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.3953265Z ) 2025-07-17T06:33:20.3953635Z parser.add_argument( 2025-07-17T06:33:20.3954226Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.3954880Z ) 2025-07-17T06:33:20.3955238Z parser.add_argument( 2025-07-17T06:33:20.3955852Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.3956516Z ) 2025-07-17T06:33:20.3956885Z parser.add_argument( 2025-07-17T06:33:20.3957543Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.3958371Z ) 2025-07-17T06:33:20.3958742Z parser.add_argument( 2025-07-17T06:33:20.3959375Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.3960221Z ) 2025-07-17T06:33:20.3960590Z parser.add_argument( 2025-07-17T06:33:20.4009681Z "--github-ref-type", 2025-07-17T06:33:20.4010412Z type=str, 2025-07-17T06:33:20.4010852Z required=True, 2025-07-17T06:33:20.4011339Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.4011888Z ) 2025-07-17T06:33:20.4012249Z parser.add_argument( 2025-07-17T06:33:20.4012713Z "--eligible-experiments", 2025-07-17T06:33:20.4013216Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4013728Z required=False, 2025-07-17T06:33:20.4014137Z default="", 2025-07-17T06:33:20.4014994Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.4015909Z ) 2025-07-17T06:33:20.4016273Z parser.add_argument( 2025-07-17T06:33:20.4016720Z "--opt-out-experiments", 2025-07-17T06:33:20.4017225Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4017738Z required=False, 2025-07-17T06:33:20.4018144Z default="", 2025-07-17T06:33:20.4018528Z help=( 2025-07-17T06:33:20.4019188Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.4020429Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.4021245Z ), 2025-07-17T06:33:20.4021591Z ) 2025-07-17T06:33:20.4021949Z parser.add_argument( 2025-07-17T06:33:20.4022389Z "--pr-number", 2025-07-17T06:33:20.4022794Z type=str, 2025-07-17T06:33:20.4023190Z required=False, 2025-07-17T06:33:20.4023605Z default="", 2025-07-17T06:33:20.4024240Z help="the optional PR number where this is run", 2025-07-17T06:33:20.4024811Z ) 2025-07-17T06:33:20.4025002Z 2025-07-17T06:33:20.4025193Z return parser.parse_args() 2025-07-17T06:33:20.4025506Z 2025-07-17T06:33:20.4025513Z 2025-07-17T06:33:20.4025914Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4026655Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.4027157Z return Github(auth=auth) 2025-07-17T06:33:20.4027448Z 2025-07-17T06:33:20.4027454Z 2025-07-17T06:33:20.4027902Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4028678Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.4029165Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.4029528Z 2025-07-17T06:33:20.4029534Z 2025-07-17T06:33:20.4029715Z def get_potential_pr_author( 2025-07-17T06:33:20.4030493Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.4031171Z ) -> str: 2025-07-17T06:33:20.4031671Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.4032455Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.4033180Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.4033592Z 2025-07-17T06:33:20.4033780Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4034102Z 2025-07-17T06:33:20.4034362Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.4034975Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.4035469Z if ( 2025-07-17T06:33:20.4035848Z len(split_tag) == 3 2025-07-17T06:33:20.4036317Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.4036836Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.4037325Z ): 2025-07-17T06:33:20.4037695Z pr_number = split_tag[2] 2025-07-17T06:33:20.4038165Z try: 2025-07-17T06:33:20.4038723Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.4039330Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.4039919Z except Exception as e: 2025-07-17T06:33:20.4040544Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.4041197Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.4041823Z ) from e 2025-07-17T06:33:20.4042349Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.4043028Z # In all other cases, return the original input username 2025-07-17T06:33:20.4043601Z return username 2025-07-17T06:33:20.4043835Z 2025-07-17T06:33:20.4043841Z 2025-07-17T06:33:20.4044064Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.4044588Z """ 2025-07-17T06:33:20.4045215Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.4045982Z """ 2025-07-17T06:33:20.4046534Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.4047049Z 2025-07-17T06:33:20.4047056Z 2025-07-17T06:33:20.4047248Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.4047733Z try: 2025-07-17T06:33:20.4048106Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.4048608Z return data 2025-07-17T06:33:20.4049007Z except yaml.YAMLError: 2025-07-17T06:33:20.4049481Z log.exception("Error loading YAML") 2025-07-17T06:33:20.4049986Z raise 2025-07-17T06:33:20.4050639Z 2025-07-17T06:33:20.4050646Z 2025-07-17T06:33:20.4051068Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.4051807Z """ 2025-07-17T06:33:20.4052409Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.4053007Z 2025-07-17T06:33:20.4053486Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4054239Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4054651Z 2025-07-17T06:33:20.4055017Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.4055707Z """ 2025-07-17T06:33:20.4056137Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.4056738Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.4057327Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.4057946Z else: 2025-07-17T06:33:20.4058318Z return "", rollout_state 2025-07-17T06:33:20.4058629Z 2025-07-17T06:33:20.4058636Z 2025-07-17T06:33:20.4058833Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.4059339Z """ 2025-07-17T06:33:20.4059841Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.4060621Z """ 2025-07-17T06:33:20.4060818Z 2025-07-17T06:33:20.4060826Z 2025-07-17T06:33:20.4061174Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.4061819Z """ 2025-07-17T06:33:20.4062510Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.4063186Z 2025-07-17T06:33:20.4063795Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.4064778Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.4065446Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.4065926Z 2025-07-17T06:33:20.4065932Z 2025-07-17T06:33:20.4066091Z """ 2025-07-17T06:33:20.4066459Z optins = UserOptins() 2025-07-17T06:33:20.4066944Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.4067498Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.4068028Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.4068584Z # Not a valid user. Skip 2025-07-17T06:33:20.4069203Z continue 2025-07-17T06:33:20.4069448Z 2025-07-17T06:33:20.4069620Z if user: 2025-07-17T06:33:20.4070180Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.4070867Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.4071352Z 2025-07-17T06:33:20.4071518Z return optins 2025-07-17T06:33:20.4071760Z 2025-07-17T06:33:20.4071767Z 2025-07-17T06:33:20.4072043Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.4072634Z """ 2025-07-17T06:33:20.4073018Z Check if the experiment name is valid. 2025-07-17T06:33:20.4073531Z A valid name: 2025-07-17T06:33:20.4074143Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.4075083Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.4075794Z - Cannot contain spaces 2025-07-17T06:33:20.4076263Z """ 2025-07-17T06:33:20.4076459Z 2025-07-17T06:33:20.4076721Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.4077407Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.4077845Z 2025-07-17T06:33:20.4078011Z if valid: 2025-07-17T06:33:20.4078382Z return True 2025-07-17T06:33:20.4078623Z 2025-07-17T06:33:20.4078782Z log.error( 2025-07-17T06:33:20.4080329Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:33:20.4081876Z ) 2025-07-17T06:33:20.4082233Z return False 2025-07-17T06:33:20.4082468Z 2025-07-17T06:33:20.4082474Z 2025-07-17T06:33:20.4082772Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.4083387Z """ 2025-07-17T06:33:20.4084090Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.4084834Z """ 2025-07-17T06:33:20.4085183Z try: 2025-07-17T06:33:20.4085542Z if settings_text: 2025-07-17T06:33:20.4086261Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.4087040Z # for easy reading 2025-07-17T06:33:20.4087821Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.4088693Z # the backtick character in shell commands. 2025-07-17T06:33:20.4089290Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.4089942Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.4090718Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.4091094Z 2025-07-17T06:33:20.4091513Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.4092264Z experiments = {} 2025-07-17T06:33:20.4092568Z 2025-07-17T06:33:20.4092941Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.4093700Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.4094806Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:33:20.4095848Z continue 2025-07-17T06:33:20.4096139Z 2025-07-17T06:33:20.4096324Z valid_settings = {} 2025-07-17T06:33:20.4096838Z for setting in exp_settings: 2025-07-17T06:33:20.4097396Z if setting not in Experiment._fields: 2025-07-17T06:33:20.4097951Z log.warning( 2025-07-17T06:33:20.4098646Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.4099366Z ) 2025-07-17T06:33:20.4099994Z else: 2025-07-17T06:33:20.4101075Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.4101505Z 2025-07-17T06:33:20.4101787Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.4102408Z return Settings(experiments) 2025-07-17T06:33:20.4102762Z 2025-07-17T06:33:20.4102931Z except Exception: 2025-07-17T06:33:20.4103401Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.4103791Z 2025-07-17T06:33:20.4103958Z return Settings() 2025-07-17T06:33:20.4104207Z 2025-07-17T06:33:20.4104213Z 2025-07-17T06:33:20.4104469Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.4105027Z """ 2025-07-17T06:33:20.4105468Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.4105873Z 2025-07-17T06:33:20.4106223Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4107002Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4107403Z 2025-07-17T06:33:20.4107816Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.4108539Z """ 2025-07-17T06:33:20.4109097Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4109842Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.4110784Z 2025-07-17T06:33:20.4110795Z 2025-07-17T06:33:20.4111069Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.4111637Z """ 2025-07-17T06:33:20.4112029Z Parse users from the rollout state. 2025-07-17T06:33:20.4112370Z 2025-07-17T06:33:20.4112528Z """ 2025-07-17T06:33:20.4113041Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4113876Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.4114274Z 2025-07-17T06:33:20.4114280Z 2025-07-17T06:33:20.4114932Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4115701Z """ 2025-07-17T06:33:20.4116103Z Check if a user is opted into an experiment 2025-07-17T06:33:20.4116623Z """ 2025-07-17T06:33:20.4117062Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.4117475Z 2025-07-17T06:33:20.4117482Z 2025-07-17T06:33:20.4117894Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4118630Z """ 2025-07-17T06:33:20.4119072Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.4119745Z """ 2025-07-17T06:33:20.4120368Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.4121045Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.4121666Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.4122260Z return False 2025-07-17T06:33:20.4122503Z 2025-07-17T06:33:20.4122788Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.4123371Z log.warning( 2025-07-17T06:33:20.4124152Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.4125116Z ) 2025-07-17T06:33:20.4125323Z 2025-07-17T06:33:20.4125483Z return True 2025-07-17T06:33:20.4125711Z 2025-07-17T06:33:20.4125718Z 2025-07-17T06:33:20.4125894Z def get_runner_prefix( 2025-07-17T06:33:20.4126320Z rollout_state: str, 2025-07-17T06:33:20.4126774Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.4127280Z branch: str, 2025-07-17T06:33:20.4127754Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4128402Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4128975Z is_canary: bool = False, 2025-07-17T06:33:20.4129417Z ) -> str: 2025-07-17T06:33:20.4129826Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.4130787Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.4131159Z 2025-07-17T06:33:20.4131330Z fleet_prefix = "" 2025-07-17T06:33:20.4131750Z prefixes = [] 2025-07-17T06:33:20.4132358Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.4133280Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.4133967Z log.info( 2025-07-17T06:33:20.4134628Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.4135359Z ) 2025-07-17T06:33:20.4135819Z continue 2025-07-17T06:33:20.4136064Z 2025-07-17T06:33:20.4136251Z if opt_out_experiments: 2025-07-17T06:33:20.4136765Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.4137387Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.4137951Z log.info( 2025-07-17T06:33:20.4138863Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.4139804Z ) 2025-07-17T06:33:20.4140337Z continue 2025-07-17T06:33:20.4140597Z 2025-07-17T06:33:20.4140782Z if eligible_experiments: 2025-07-17T06:33:20.4141337Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.4141949Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.4142485Z log.info( 2025-07-17T06:33:20.4143235Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.4144036Z ) 2025-07-17T06:33:20.4144414Z continue 2025-07-17T06:33:20.4144862Z elif not experiment_settings.default: 2025-07-17T06:33:20.4145373Z log.info( 2025-07-17T06:33:20.4146134Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.4146868Z ) 2025-07-17T06:33:20.4147229Z continue 2025-07-17T06:33:20.4147466Z 2025-07-17T06:33:20.4147732Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.4148334Z opted_out_users = [ 2025-07-17T06:33:20.4148755Z requestor 2025-07-17T06:33:20.4149195Z for requestor in workflow_requestors 2025-07-17T06:33:20.4149843Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4150558Z ] 2025-07-17T06:33:20.4150759Z 2025-07-17T06:33:20.4150937Z if opted_out_users: 2025-07-17T06:33:20.4151367Z log.info( 2025-07-17T06:33:20.4151966Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.4152639Z ) 2025-07-17T06:33:20.4153000Z continue 2025-07-17T06:33:20.4153241Z 2025-07-17T06:33:20.4153512Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.4154130Z opted_in_users = [ 2025-07-17T06:33:20.4154565Z requestor 2025-07-17T06:33:20.4155004Z for requestor in workflow_requestors 2025-07-17T06:33:20.4155647Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4156243Z ] 2025-07-17T06:33:20.4156446Z 2025-07-17T06:33:20.4156617Z enabled = False 2025-07-17T06:33:20.4157039Z if opted_in_users: 2025-07-17T06:33:20.4157498Z log.info( 2025-07-17T06:33:20.4158077Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.4158745Z ) 2025-07-17T06:33:20.4159126Z enabled = True 2025-07-17T06:33:20.4159395Z 2025-07-17T06:33:20.4159605Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.4160520Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.4161568Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.4162212Z log.info( 2025-07-17T06:33:20.4163056Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.4163961Z ) 2025-07-17T06:33:20.4164354Z enabled = True 2025-07-17T06:33:20.4164640Z 2025-07-17T06:33:20.4164801Z if enabled: 2025-07-17T06:33:20.4165210Z label = experiment_name 2025-07-17T06:33:20.4165740Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.4166556Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.4167420Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.4168169Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.4168824Z if is_canary: 2025-07-17T06:33:20.4169314Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.4169851Z fleet_prefix = label 2025-07-17T06:33:20.4170443Z else: 2025-07-17T06:33:20.4170858Z prefixes.append(label) 2025-07-17T06:33:20.4171196Z 2025-07-17T06:33:20.4171369Z if len(prefixes) > 1: 2025-07-17T06:33:20.4171805Z log.error( 2025-07-17T06:33:20.4172813Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:33:20.4173913Z ) 2025-07-17T06:33:20.4174290Z prefixes = prefixes[:1] 2025-07-17T06:33:20.4174590Z 2025-07-17T06:33:20.4174769Z # Fleet always comes first 2025-07-17T06:33:20.4175228Z if fleet_prefix: 2025-07-17T06:33:20.4175658Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.4176013Z 2025-07-17T06:33:20.4176386Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.4176802Z 2025-07-17T06:33:20.4176809Z 2025-07-17T06:33:20.4177251Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.4178012Z """ 2025-07-17T06:33:20.4178589Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.4179137Z 2025-07-17T06:33:20.4179518Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.4180318Z """ 2025-07-17T06:33:20.4180687Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4181214Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.4181821Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.4182268Z 2025-07-17T06:33:20.4182274Z 2025-07-17T06:33:20.4182665Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.4183421Z for _ in range(num_retries): 2025-07-17T06:33:20.4183936Z try: 2025-07-17T06:33:20.4184350Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.4184989Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.4185621Z return json.loads(content) 2025-07-17T06:33:20.4186130Z except Exception as e: 2025-07-17T06:33:20.4186653Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.4187047Z 2025-07-17T06:33:20.4187417Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.4188110Z return {} 2025-07-17T06:33:20.4188322Z 2025-07-17T06:33:20.4188329Z 2025-07-17T06:33:20.4188489Z @cache 2025-07-17T06:33:20.4189087Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.4189829Z """ 2025-07-17T06:33:20.4190302Z Dynamically get PR information 2025-07-17T06:33:20.4190778Z """ 2025-07-17T06:33:20.4191277Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.4192125Z headers = { 2025-07-17T06:33:20.4192565Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.4193157Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.4193683Z } 2025-07-17T06:33:20.4194091Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.4194683Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.4195213Z headers=headers, 2025-07-17T06:33:20.4195626Z ) 2025-07-17T06:33:20.4195813Z 2025-07-17T06:33:20.4195986Z if not json_response: 2025-07-17T06:33:20.4196539Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.4197139Z return {} 2025-07-17T06:33:20.4197367Z 2025-07-17T06:33:20.4197541Z return json_response 2025-07-17T06:33:20.4197810Z 2025-07-17T06:33:20.4197816Z 2025-07-17T06:33:20.4198212Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.4198930Z """ 2025-07-17T06:33:20.4199450Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.4200193Z """ 2025-07-17T06:33:20.4200669Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.4201264Z return { 2025-07-17T06:33:20.4201832Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.4202526Z } 2025-07-17T06:33:20.4202720Z 2025-07-17T06:33:20.4202726Z 2025-07-17T06:33:20.4202894Z def main() -> None: 2025-07-17T06:33:20.4203303Z args = parse_args() 2025-07-17T06:33:20.4203566Z 2025-07-17T06:33:20.4203783Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.4204167Z 2025-07-17T06:33:20.4204350Z # Check if the PR is opt-out 2025-07-17T06:33:20.4204828Z if args.pr_number: 2025-07-17T06:33:20.4205455Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.4206319Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.4206817Z log.info( 2025-07-17T06:33:20.4207485Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.4208235Z ) 2025-07-17T06:33:20.4208767Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4209426Z sys.exit() 2025-07-17T06:33:20.4209684Z 2025-07-17T06:33:20.4209843Z try: 2025-07-17T06:33:20.4210368Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.4211050Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.4211678Z ) 2025-07-17T06:33:20.4211876Z 2025-07-17T06:33:20.4212069Z username = get_potential_pr_author( 2025-07-17T06:33:20.4212598Z args.github_token, 2025-07-17T06:33:20.4213060Z args.github_repo, 2025-07-17T06:33:20.4213526Z args.github_actor, 2025-07-17T06:33:20.4213984Z args.github_ref_type, 2025-07-17T06:33:20.4214480Z args.github_branch, 2025-07-17T06:33:20.4214930Z ) 2025-07-17T06:33:20.4215131Z 2025-07-17T06:33:20.4215406Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.4215855Z 2025-07-17T06:33:20.4216074Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.4216615Z rollout_state, 2025-07-17T06:33:20.4217086Z (args.github_issue_owner, username), 2025-07-17T06:33:20.4217616Z args.github_branch, 2025-07-17T06:33:20.4218098Z args.eligible_experiments, 2025-07-17T06:33:20.4218614Z args.opt_out_experiments, 2025-07-17T06:33:20.4219108Z is_canary, 2025-07-17T06:33:20.4219511Z ) 2025-07-17T06:33:20.4219711Z 2025-07-17T06:33:20.4219890Z except Exception as e: 2025-07-17T06:33:20.4220432Z log.error( 2025-07-17T06:33:20.4221075Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.4221966Z ) 2025-07-17T06:33:20.4222164Z 2025-07-17T06:33:20.4222486Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4222979Z 2025-07-17T06:33:20.4222985Z 2025-07-17T06:33:20.4223153Z if __name__ == "__main__": 2025-07-17T06:33:20.4223576Z main() 2025-07-17T06:33:20.4223777Z 2025-07-17T06:33:20.4313023Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4313906Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4342618Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.4343095Z env: 2025-07-17T06:33:20.4343709Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.4344121Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.4344558Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.4345057Z ISSUE_OWNER: 2025-07-17T06:33:20.4345451Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.4345867Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.4346287Z PR_NUMBER: 2025-07-17T06:33:20.4346659Z ##[endgroup] 2025-07-17T06:33:20.8401537Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.2217639Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.2625606Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.2836020Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-07-17T06:33:21.3058229Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.3093560Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.3570641Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.3608602Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-07-17T06:33:21.3655729Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.3675472Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-07-17T06:33:21.3692100Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.3952090Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.3992154Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.4242449Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-07-17T06:33:21.5344628Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.5383059Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.6409782Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.6450618Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:21.6651763Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.6689759Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.6930900Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.6999286Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.7 MB/s eta 0:00:00 2025-07-17T06:33:21.7036541Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.7098566Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 78.2 MB/s eta 0:00:00 2025-07-17T06:33:21.7135966Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:21.7216827Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 132.5 MB/s eta 0:00:00 2025-07-17T06:33:21.7255716Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.7317497Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.7384662Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 92.6 MB/s eta 0:00:00 2025-07-17T06:33:21.7421882Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:21.7464754Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 28.6 MB/s eta 0:00:00 2025-07-17T06:33:21.7499560Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.7544800Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 37.0 MB/s eta 0:00:00 2025-07-17T06:33:22.0384012Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.5709304Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-07-17T06:33:22.6477300Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.6477671Z curr_branch="main" 2025-07-17T06:33:22.6477929Z curr_ref_type="branch" 2025-07-17T06:33:22.6478258Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.6478550Z  2025-07-17T06:33:22.6478790Z python3 runner_determinator.py \ 2025-07-17T06:33:22.6479114Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.6479445Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.6479753Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.6480229Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.6480561Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.6480878Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.6481219Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.6481586Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.6481994Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.6482324Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.6512370Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.6512650Z env: 2025-07-17T06:33:22.6513286Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.6513522Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.6513777Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.6514045Z ISSUE_OWNER: 2025-07-17T06:33:22.6514281Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.6514509Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.6514748Z PR_NUMBER: 2025-07-17T06:33:22.6514959Z ##[endgroup] 2025-07-17T06:33:22.6562220Z Current branch is 'main' 2025-07-17T06:33:23.9752281Z INFO : Based on rollout percentage of 25%, enabling experiment lf. 2025-07-17T06:33:23.9753544Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:23.9754757Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:23.9755831Z INFO : Setting output: label-type='lf.' 2025-07-17T06:33:24.0090719Z Evaluate and set job outputs 2025-07-17T06:33:24.0096915Z Set output 'label-type' 2025-07-17T06:33:24.0099132Z Cleaning up orphan processes