2025-07-17T06:33:19.1621599Z Current runner version: '2.326.0' 2025-07-17T06:33:19.1644294Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.1645100Z Hosted Compute Agent 2025-07-17T06:33:19.1645753Z Version: 20250711.363 2025-07-17T06:33:19.1646301Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.1646998Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.1647662Z ##[endgroup] 2025-07-17T06:33:19.1648236Z ##[group]Operating System 2025-07-17T06:33:19.1648782Z Ubuntu 2025-07-17T06:33:19.1649612Z 24.04.2 2025-07-17T06:33:19.1650065Z LTS 2025-07-17T06:33:19.1650559Z ##[endgroup] 2025-07-17T06:33:19.1651080Z ##[group]Runner Image 2025-07-17T06:33:19.1651643Z Image: ubuntu-24.04 2025-07-17T06:33:19.1652144Z Version: 20250710.1.0 2025-07-17T06:33:19.1653143Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.1654777Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.1655802Z ##[endgroup] 2025-07-17T06:33:19.1658089Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.1660361Z Actions: read 2025-07-17T06:33:19.1660890Z Attestations: read 2025-07-17T06:33:19.1661427Z Checks: read 2025-07-17T06:33:19.1661929Z Contents: read 2025-07-17T06:33:19.1662397Z Deployments: read 2025-07-17T06:33:19.1662890Z Discussions: read 2025-07-17T06:33:19.1663327Z Issues: read 2025-07-17T06:33:19.1663861Z Metadata: read 2025-07-17T06:33:19.1664347Z Models: read 2025-07-17T06:33:19.1664809Z Packages: read 2025-07-17T06:33:19.1665322Z Pages: read 2025-07-17T06:33:19.1665816Z PullRequests: read 2025-07-17T06:33:19.1666301Z RepositoryProjects: read 2025-07-17T06:33:19.1666902Z SecurityEvents: read 2025-07-17T06:33:19.1667534Z Statuses: read 2025-07-17T06:33:19.1667988Z ##[endgroup] 2025-07-17T06:33:19.1670672Z Secret source: Actions 2025-07-17T06:33:19.1671333Z Prepare workflow directory 2025-07-17T06:33:19.2183062Z Prepare all required actions 2025-07-17T06:33:19.2237933Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.2243303Z ##[group] Inputs 2025-07-17T06:33:19.2243858Z check_experiments: 2025-07-17T06:33:19.2244396Z opt_out_experiments: 2025-07-17T06:33:19.2245032Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.2245642Z issue_owner: 2025-07-17T06:33:19.2246107Z curr_branch: main 2025-07-17T06:33:19.2246715Z curr_ref_type: branch 2025-07-17T06:33:19.2247214Z issue_number: 5132 2025-07-17T06:33:19.2247726Z ##[endgroup] 2025-07-17T06:33:19.2248364Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:19.2832247Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:19.2834573Z cat < runner_determinator.py 2025-07-17T06:33:19.2835267Z # flake8: noqa: G004 2025-07-17T06:33:19.2835795Z  2025-07-17T06:33:19.2836531Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.2837554Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.2838573Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.2839450Z  2025-07-17T06:33:19.2839834Z """ 2025-07-17T06:33:19.2840622Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.2841600Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.2842798Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.2843770Z of which runners should be used to run which job. 2025-07-17T06:33:19.2844424Z  2025-07-17T06:33:19.2845178Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.2846173Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.2847455Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.2848282Z list, defined. 2025-07-17T06:33:19.2848855Z  2025-07-17T06:33:19.2849942Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.2851000Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.2851973Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.2852631Z  2025-07-17T06:33:19.2853409Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.2854383Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.2855284Z experiments which the user could be opted in to. 2025-07-17T06:33:19.2856021Z  2025-07-17T06:33:19.2856480Z The user list has the following rules: 2025-07-17T06:33:19.2857149Z  2025-07-17T06:33:19.2857781Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.2858750Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.2859940Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.2860582Z  2025-07-17T06:33:19.2861037Z Example config: 2025-07-17T06:33:19.2861589Z  # A list of experiments that can be opted into. 2025-07-17T06:33:19.2862484Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.2863186Z  # Expected syntax is: 2025-07-17T06:33:19.2863967Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.2865132Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.2865948Z  2025-07-17T06:33:19.2866448Z  experiments: 2025-07-17T06:33:19.2866981Z  lf: 2025-07-17T06:33:19.2867483Z  rollout_percent: 25 2025-07-17T06:33:19.2868110Z  all_branches: false 2025-07-17T06:33:19.2868684Z  default: true 2025-07-17T06:33:19.2869366Z  --- 2025-07-17T06:33:19.2869799Z  2025-07-17T06:33:19.2870368Z  # Opt-ins: 2025-07-17T06:33:19.2871174Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.2872321Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.2873326Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.2874114Z  # Experiments should be from the above list. 2025-07-17T06:33:19.2874848Z  2025-07-17T06:33:19.2875425Z  @User1,-lf,split_build 2025-07-17T06:33:19.2875965Z  @User2,lf 2025-07-17T06:33:19.2876524Z  @User3,split_build 2025-07-17T06:33:19.2877110Z """ 2025-07-17T06:33:19.2877602Z  2025-07-17T06:33:19.2878000Z import json 2025-07-17T06:33:19.2878599Z import logging 2025-07-17T06:33:19.2879245Z import os 2025-07-17T06:33:19.2879816Z import random 2025-07-17T06:33:19.2880398Z import re 2025-07-17T06:33:19.2880849Z import sys 2025-07-17T06:33:19.2881372Z from argparse import ArgumentParser 2025-07-17T06:33:19.2882119Z from collections.abc import Iterable 2025-07-17T06:33:19.2882810Z from functools import cache 2025-07-17T06:33:19.2883363Z from logging import LogRecord 2025-07-17T06:33:19.2884070Z from typing import Any, NamedTuple 2025-07-17T06:33:19.2884757Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.2885351Z  2025-07-17T06:33:19.2885895Z import yaml 2025-07-17T06:33:19.2886556Z from github import Auth, Github 2025-07-17T06:33:19.2887169Z from github.Issue import Issue 2025-07-17T06:33:19.2887787Z  2025-07-17T06:33:19.2888227Z  2025-07-17T06:33:19.2888773Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.2889947Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.2890983Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.2891740Z  2025-07-17T06:33:19.2892352Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.2893047Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.2893683Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.2894440Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.2895026Z  2025-07-17T06:33:19.2895504Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.2896150Z  2025-07-17T06:33:19.2896611Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.2897205Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.2897814Z  2025-07-17T06:33:19.2898322Z  2025-07-17T06:33:19.2898760Z class Experiment(NamedTuple): 2025-07-17T06:33:19.2899809Z  rollout_perc: float = ( 2025-07-17T06:33:19.2900597Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.2901425Z  ) 2025-07-17T06:33:19.2901952Z  all_branches: bool = ( 2025-07-17T06:33:19.2902738Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.2903500Z  ) 2025-07-17T06:33:19.2904019Z  default: bool = ( 2025-07-17T06:33:19.2904793Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.2905536Z  ) 2025-07-17T06:33:19.2906052Z  2025-07-17T06:33:19.2906496Z  # Add more fields as needed 2025-07-17T06:33:19.2907074Z  2025-07-17T06:33:19.2907628Z  2025-07-17T06:33:19.2908063Z class Settings(NamedTuple): 2025-07-17T06:33:19.2908655Z  """ 2025-07-17T06:33:19.2909416Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:19.2910176Z  """ 2025-07-17T06:33:19.2910655Z  2025-07-17T06:33:19.2911272Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.2911862Z  2025-07-17T06:33:19.2912481Z  2025-07-17T06:33:19.2913071Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.2913802Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.2914489Z  2025-07-17T06:33:19.2914942Z  COLORS = { 2025-07-17T06:33:19.2915551Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.2916153Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.2916825Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.2917448Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.2918020Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.2918659Z  } 2025-07-17T06:33:19.2919196Z  2025-07-17T06:33:19.2919762Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.2920647Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.2921566Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.2922266Z  return super().format(record) 2025-07-17T06:33:19.2922869Z  2025-07-17T06:33:19.2923353Z  2025-07-17T06:33:19.2923806Z handler = logging.StreamHandler() 2025-07-17T06:33:19.2924710Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.2925685Z  2025-07-17T06:33:19.2926218Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.2926960Z log.addHandler(handler) 2025-07-17T06:33:19.2927566Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.2928132Z  2025-07-17T06:33:19.2996592Z  2025-07-17T06:33:19.2997519Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.2998557Z  """ 2025-07-17T06:33:19.2999732Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.3000912Z  """ 2025-07-17T06:33:19.3001531Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:19.3002693Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.3003819Z  log.warning( 2025-07-17T06:33:19.3004702Z  "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:19.3005631Z  ) 2025-07-17T06:33:19.3006085Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.3006637Z  return 2025-07-17T06:33:19.3007044Z  2025-07-17T06:33:19.3007433Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.3008049Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.3008680Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:19.3009415Z  2025-07-17T06:33:19.3009774Z  2025-07-17T06:33:19.3010292Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.3010957Z  return frozenset( 2025-07-17T06:33:19.3011614Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.3012292Z  ) 2025-07-17T06:33:19.3012648Z  2025-07-17T06:33:19.3012986Z  2025-07-17T06:33:19.3013346Z def parse_args() -> Any: 2025-07-17T06:33:19.3013964Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.3014846Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.3015618Z  parser.add_argument( 2025-07-17T06:33:19.3016108Z  "--github-issue-repo", 2025-07-17T06:33:19.3016601Z  type=str, 2025-07-17T06:33:19.3017046Z  required=False, 2025-07-17T06:33:19.3017726Z  default="pytorch/test-infra", 2025-07-17T06:33:19.3018310Z  help="GitHub repo to get the issue", 2025-07-17T06:33:19.3018828Z  ) 2025-07-17T06:33:19.3019765Z  parser.add_argument( 2025-07-17T06:33:19.3020262Z  "--github-repo", 2025-07-17T06:33:19.3020717Z  type=str, 2025-07-17T06:33:19.3021167Z  required=True, 2025-07-17T06:33:19.3021668Z  help="GitHub repo where CI is running", 2025-07-17T06:33:19.3022219Z  ) 2025-07-17T06:33:19.3022609Z  parser.add_argument( 2025-07-17T06:33:19.3023257Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.3023917Z  ) 2025-07-17T06:33:19.3024301Z  parser.add_argument( 2025-07-17T06:33:19.3024977Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.3025668Z  ) 2025-07-17T06:33:19.3026044Z  parser.add_argument( 2025-07-17T06:33:19.3026719Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.3027417Z  ) 2025-07-17T06:33:19.3027790Z  parser.add_argument( 2025-07-17T06:33:19.3028489Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.3029634Z  ) 2025-07-17T06:33:19.3030036Z  parser.add_argument( 2025-07-17T06:33:19.3030524Z  "--github-ref-type", 2025-07-17T06:33:19.3031003Z  type=str, 2025-07-17T06:33:19.3031428Z  required=True, 2025-07-17T06:33:19.3031993Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.3032545Z  ) 2025-07-17T06:33:19.3032935Z  parser.add_argument( 2025-07-17T06:33:19.3033439Z  "--eligible-experiments", 2025-07-17T06:33:19.3033986Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.3034525Z  required=False, 2025-07-17T06:33:19.3034983Z  default="", 2025-07-17T06:33:19.3035863Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.3037280Z  ) 2025-07-17T06:33:19.3037907Z  parser.add_argument( 2025-07-17T06:33:19.3038759Z  "--opt-out-experiments", 2025-07-17T06:33:19.3040372Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.3040951Z  required=False, 2025-07-17T06:33:19.3041418Z  default="", 2025-07-17T06:33:19.3041855Z  help=( 2025-07-17T06:33:19.3042574Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.3043735Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.3044582Z  ), 2025-07-17T06:33:19.3044953Z  ) 2025-07-17T06:33:19.3045335Z  parser.add_argument( 2025-07-17T06:33:19.3045808Z  "--pr-number", 2025-07-17T06:33:19.3046256Z  type=str, 2025-07-17T06:33:19.3046697Z  required=False, 2025-07-17T06:33:19.3047151Z  default="", 2025-07-17T06:33:19.3047674Z  help="the optional PR number where this is run", 2025-07-17T06:33:19.3048227Z  ) 2025-07-17T06:33:19.3048580Z  2025-07-17T06:33:19.3048951Z  return parser.parse_args() 2025-07-17T06:33:19.3049690Z  2025-07-17T06:33:19.3050024Z  2025-07-17T06:33:19.3050685Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.3051743Z  auth = Auth.Token(github_token) 2025-07-17T06:33:19.3052292Z  return Github(auth=auth) 2025-07-17T06:33:19.3052760Z  2025-07-17T06:33:19.3053089Z  2025-07-17T06:33:19.3053743Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.3054548Z  repo = gh.get_repo(repo) 2025-07-17T06:33:19.3055093Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.3055709Z  2025-07-17T06:33:19.3056102Z  2025-07-17T06:33:19.3056505Z def get_potential_pr_author( 2025-07-17T06:33:19.3057194Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.3057877Z ) -> str: 2025-07-17T06:33:19.3058423Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.3059508Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.3060290Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:19.3060872Z  2025-07-17T06:33:19.3061254Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.3061978Z  2025-07-17T06:33:19.3062462Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.3063106Z  split_tag = ref_name.split("/") 2025-07-17T06:33:19.3063775Z  if ( 2025-07-17T06:33:19.3064179Z  len(split_tag) == 3 2025-07-17T06:33:19.3064704Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:19.3065244Z  and split_tag[2].isnumeric() 2025-07-17T06:33:19.3065738Z  ): 2025-07-17T06:33:19.3066162Z  pr_number = split_tag[2] 2025-07-17T06:33:19.3066661Z  try: 2025-07-17T06:33:19.3067126Z  repository = gh.get_repo(repo) 2025-07-17T06:33:19.3067770Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.3068405Z  except Exception as e: 2025-07-17T06:33:19.3068944Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:19.3069796Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.3070457Z  ) from e 2025-07-17T06:33:19.3071043Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.3071768Z  # In all other cases, return the original input username 2025-07-17T06:33:19.3072362Z  return username 2025-07-17T06:33:19.3072790Z  2025-07-17T06:33:19.3073120Z  2025-07-17T06:33:19.3073546Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.3074093Z  """ 2025-07-17T06:33:19.3074765Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.3075542Z  """ 2025-07-17T06:33:19.3076102Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.3076762Z  2025-07-17T06:33:19.3077089Z  2025-07-17T06:33:19.3077480Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.3077980Z  try: 2025-07-17T06:33:19.3078393Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.3078916Z  return data 2025-07-17T06:33:19.3079477Z  except yaml.YAMLError: 2025-07-17T06:33:19.3080000Z  log.exception("Error loading YAML") 2025-07-17T06:33:19.3080515Z  raise 2025-07-17T06:33:19.3080908Z  2025-07-17T06:33:19.3081233Z  2025-07-17T06:33:19.3081851Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.3082587Z  """ 2025-07-17T06:33:19.3083352Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.3084108Z  2025-07-17T06:33:19.3084641Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.3085405Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.3085953Z  2025-07-17T06:33:19.3086530Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.3087227Z  """ 2025-07-17T06:33:19.3087686Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.3088294Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.3088909Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.3089604Z  else: 2025-07-17T06:33:19.3089997Z  return "", rollout_state 2025-07-17T06:33:19.3090466Z  2025-07-17T06:33:19.3090788Z  2025-07-17T06:33:19.3091186Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.3091697Z  """ 2025-07-17T06:33:19.3092239Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.3092875Z  """ 2025-07-17T06:33:19.3093220Z  2025-07-17T06:33:19.3093552Z  2025-07-17T06:33:19.3094233Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.3094893Z  """ 2025-07-17T06:33:19.3095619Z  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:19.3096450Z  2025-07-17T06:33:19.3097263Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.3098263Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.3098970Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.3099936Z  2025-07-17T06:33:19.3100271Z  2025-07-17T06:33:19.3100605Z  """ 2025-07-17T06:33:19.3100986Z  optins = UserOptins() 2025-07-17T06:33:19.3101517Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.3102078Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:19.3102646Z  if not user or not user.startswith("@"): 2025-07-17T06:33:19.3103208Z  # Not a valid user. Skip 2025-07-17T06:33:19.3103707Z  continue 2025-07-17T06:33:19.3104115Z  2025-07-17T06:33:19.3104444Z  if user: 2025-07-17T06:33:19.3104913Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.3105607Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.3106239Z  2025-07-17T06:33:19.3106588Z  return optins 2025-07-17T06:33:19.3107007Z  2025-07-17T06:33:19.3107331Z  2025-07-17T06:33:19.3107838Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.3108453Z  """ 2025-07-17T06:33:19.3108869Z  Check if the experiment name is valid. 2025-07-17T06:33:19.3109514Z  A valid name: 2025-07-17T06:33:19.3110199Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.3111147Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.3111859Z  - Cannot contain spaces 2025-07-17T06:33:19.3112334Z  """ 2025-07-17T06:33:19.3112692Z  2025-07-17T06:33:19.3113147Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.3113872Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.3114605Z  2025-07-17T06:33:19.3114957Z  if valid: 2025-07-17T06:33:19.3115367Z  return True 2025-07-17T06:33:19.3115777Z  2025-07-17T06:33:19.3116287Z  log.error( 2025-07-17T06:33:19.3117911Z  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:19.3119533Z  ) 2025-07-17T06:33:19.3119899Z  return False 2025-07-17T06:33:19.3120311Z  2025-07-17T06:33:19.3120638Z  2025-07-17T06:33:19.3121151Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.3121787Z  """ 2025-07-17T06:33:19.3122395Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.3123107Z  """ 2025-07-17T06:33:19.3123463Z  try: 2025-07-17T06:33:19.3123846Z  if settings_text: 2025-07-17T06:33:19.3124597Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.3125380Z  # for easy reading 2025-07-17T06:33:19.3126206Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.3127243Z  # the backtick character in shell commands. 2025-07-17T06:33:19.3127860Z  backtick = chr(96) # backtick character 2025-07-17T06:33:19.3128541Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.3129435Z  settings = load_yaml(settings_text) 2025-07-17T06:33:19.3129954Z  2025-07-17T06:33:19.3130545Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.3131292Z  experiments = {} 2025-07-17T06:33:19.3131752Z  2025-07-17T06:33:19.3132319Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.3133098Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.3134200Z  # 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:19.3135218Z  continue 2025-07-17T06:33:19.3135667Z  2025-07-17T06:33:19.3136044Z  valid_settings = {} 2025-07-17T06:33:19.3136582Z  for setting in exp_settings: 2025-07-17T06:33:19.3137314Z  if setting not in Experiment._fields: 2025-07-17T06:33:19.3137887Z  log.warning( 2025-07-17T06:33:19.3138618Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.3139578Z  ) 2025-07-17T06:33:19.3140032Z  else: 2025-07-17T06:33:19.3140588Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.3141159Z  2025-07-17T06:33:19.3141629Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.3142270Z  return Settings(experiments) 2025-07-17T06:33:19.3142759Z  2025-07-17T06:33:19.3143121Z  except Exception: 2025-07-17T06:33:19.3143638Z  log.exception("Failed to parse settings") 2025-07-17T06:33:19.3144167Z  2025-07-17T06:33:19.3144515Z  return Settings() 2025-07-17T06:33:19.3144946Z  2025-07-17T06:33:19.3145269Z  2025-07-17T06:33:19.3145888Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.3146481Z  """ 2025-07-17T06:33:19.3146942Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.3147498Z  2025-07-17T06:33:19.3148029Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.3148799Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.3149633Z  2025-07-17T06:33:19.3150242Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.3150964Z  """ 2025-07-17T06:33:19.3151531Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.3152308Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.3152851Z  2025-07-17T06:33:19.3153181Z  2025-07-17T06:33:19.3153631Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.3154198Z  """ 2025-07-17T06:33:19.3154616Z  Parse users from the rollout state. 2025-07-17T06:33:19.3155118Z  2025-07-17T06:33:19.3155487Z  """ 2025-07-17T06:33:19.3156040Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.3156792Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.3157476Z  2025-07-17T06:33:19.3157812Z  2025-07-17T06:33:19.3158438Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.3159298Z  """ 2025-07-17T06:33:19.3159744Z  Check if a user is opted into an experiment 2025-07-17T06:33:19.3160273Z  """ 2025-07-17T06:33:19.3160754Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.3161323Z  2025-07-17T06:33:19.3161663Z  2025-07-17T06:33:19.3162290Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.3163042Z  """ 2025-07-17T06:33:19.3163531Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.3164113Z  """ 2025-07-17T06:33:19.3164650Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.3165367Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.3166020Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.3166620Z  return False 2025-07-17T06:33:19.3167039Z  2025-07-17T06:33:19.3167507Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.3168097Z  log.warning( 2025-07-17T06:33:19.3168927Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.3169892Z  ) 2025-07-17T06:33:19.3170270Z  2025-07-17T06:33:19.3170617Z  return True 2025-07-17T06:33:19.3171027Z  2025-07-17T06:33:19.3171361Z  2025-07-17T06:33:19.3171711Z def get_runner_prefix( 2025-07-17T06:33:19.3172202Z  rollout_state: str, 2025-07-17T06:33:19.3172702Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:19.3173225Z  branch: str, 2025-07-17T06:33:19.3173756Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.3174443Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.3175033Z  is_canary: bool = False, 2025-07-17T06:33:19.3175500Z ) -> str: 2025-07-17T06:33:19.3175949Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:19.3176540Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.3177054Z  2025-07-17T06:33:19.3177527Z  fleet_prefix = "" 2025-07-17T06:33:19.3177984Z  prefixes = [] 2025-07-17T06:33:19.3178651Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.3179714Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.3180434Z  log.info( 2025-07-17T06:33:19.3181148Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.3181885Z  ) 2025-07-17T06:33:19.3182282Z  continue 2025-07-17T06:33:19.3182703Z  2025-07-17T06:33:19.3183068Z  if opt_out_experiments: 2025-07-17T06:33:19.3183625Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.3184276Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.3184857Z  log.info( 2025-07-17T06:33:19.3185792Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.3186743Z  ) 2025-07-17T06:33:19.3187166Z  continue 2025-07-17T06:33:19.3187604Z  2025-07-17T06:33:19.3188093Z  if eligible_experiments: 2025-07-17T06:33:19.3188684Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.3189599Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.3190159Z  log.info( 2025-07-17T06:33:19.3190970Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.3191796Z  ) 2025-07-17T06:33:19.3192223Z  continue 2025-07-17T06:33:19.3192742Z  elif not experiment_settings.default: 2025-07-17T06:33:19.3193283Z  log.info( 2025-07-17T06:33:19.3193976Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.3194704Z  ) 2025-07-17T06:33:19.3195097Z  continue 2025-07-17T06:33:19.3195521Z  2025-07-17T06:33:19.3195987Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.3196602Z  opted_out_users = [ 2025-07-17T06:33:19.3197078Z  requestor 2025-07-17T06:33:19.3197568Z  for requestor in workflow_requestors 2025-07-17T06:33:19.3198255Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.3198875Z  ] 2025-07-17T06:33:19.3199445Z  2025-07-17T06:33:19.3199810Z  if opted_out_users: 2025-07-17T06:33:19.3200296Z  log.info( 2025-07-17T06:33:19.3200950Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.3201640Z  ) 2025-07-17T06:33:19.3202045Z  continue 2025-07-17T06:33:19.3202458Z  2025-07-17T06:33:19.3202925Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.3203536Z  opted_in_users = [ 2025-07-17T06:33:19.3204004Z  requestor 2025-07-17T06:33:19.3204492Z  for requestor in workflow_requestors 2025-07-17T06:33:19.3205155Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.3205777Z  ] 2025-07-17T06:33:19.3206134Z  2025-07-17T06:33:19.3206489Z  enabled = False 2025-07-17T06:33:19.3206941Z  if opted_in_users: 2025-07-17T06:33:19.3207579Z  log.info( 2025-07-17T06:33:19.3208230Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.3208892Z  ) 2025-07-17T06:33:19.3209513Z  enabled = True 2025-07-17T06:33:19.3209955Z  2025-07-17T06:33:19.3210362Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.3211194Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.3212130Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.3212782Z  log.info( 2025-07-17T06:33:19.3213664Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.3214556Z  ) 2025-07-17T06:33:19.3214990Z  enabled = True 2025-07-17T06:33:19.3215455Z  2025-07-17T06:33:19.3215801Z  if enabled: 2025-07-17T06:33:19.3216266Z  label = experiment_name 2025-07-17T06:33:19.3216836Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.3217658Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.3218696Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.3219576Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.3220233Z  if is_canary: 2025-07-17T06:33:19.3220753Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.3221295Z  fleet_prefix = label 2025-07-17T06:33:19.3221800Z  else: 2025-07-17T06:33:19.3222255Z  prefixes.append(label) 2025-07-17T06:33:19.3222754Z  2025-07-17T06:33:19.3223108Z  if len(prefixes) > 1: 2025-07-17T06:33:19.3223570Z  log.error( 2025-07-17T06:33:19.3224623Z  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:19.3225702Z  ) 2025-07-17T06:33:19.3226118Z  prefixes = prefixes[:1] 2025-07-17T06:33:19.3226587Z  2025-07-17T06:33:19.3226956Z  # Fleet always comes first 2025-07-17T06:33:19.3227434Z  if fleet_prefix: 2025-07-17T06:33:19.3227913Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.3228417Z  2025-07-17T06:33:19.3228858Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.3229701Z  2025-07-17T06:33:19.3230031Z  2025-07-17T06:33:19.3230673Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.3231430Z  """ 2025-07-17T06:33:19.3232031Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.3232724Z  2025-07-17T06:33:19.3233304Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.3234003Z  """ 2025-07-17T06:33:19.3234406Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.3234974Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.3235618Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.3236216Z  2025-07-17T06:33:19.3236545Z  2025-07-17T06:33:19.3237150Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.3238042Z  for _ in range(num_retries): 2025-07-17T06:33:19.3238564Z  try: 2025-07-17T06:33:19.3239017Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:19.3239917Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.3240565Z  return json.loads(content) 2025-07-17T06:33:19.3241090Z  except Exception as e: 2025-07-17T06:33:19.3241662Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.3242206Z  2025-07-17T06:33:19.3242773Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.3243477Z  return {} 2025-07-17T06:33:19.3243857Z  2025-07-17T06:33:19.3244184Z  2025-07-17T06:33:19.3244506Z @cache 2025-07-17T06:33:19.3245148Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.3245886Z  """ 2025-07-17T06:33:19.3246291Z  Dynamically get PR information 2025-07-17T06:33:19.3246785Z  """ 2025-07-17T06:33:19.3247298Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.3247926Z  headers = { 2025-07-17T06:33:19.3248414Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.3249291Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:19.3249830Z  } 2025-07-17T06:33:19.3250277Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.3250883Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.3251424Z  headers=headers, 2025-07-17T06:33:19.3251876Z  ) 2025-07-17T06:33:19.3252228Z  2025-07-17T06:33:19.3252588Z  if not json_response: 2025-07-17T06:33:19.3253188Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.3253811Z  return {} 2025-07-17T06:33:19.3254224Z  2025-07-17T06:33:19.3254574Z  return json_response 2025-07-17T06:33:19.3255023Z  2025-07-17T06:33:19.3255384Z  2025-07-17T06:33:19.3255975Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.3256691Z  """ 2025-07-17T06:33:19.3257240Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.3257880Z  """ 2025-07-17T06:33:19.3258382Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.3258991Z  return { 2025-07-17T06:33:19.3259695Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.3260366Z  } 2025-07-17T06:33:19.3260717Z  2025-07-17T06:33:19.3261048Z  2025-07-17T06:33:19.3261397Z def main() -> None: 2025-07-17T06:33:19.3261846Z  args = parse_args() 2025-07-17T06:33:19.3262282Z  2025-07-17T06:33:19.3262698Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.3263225Z  2025-07-17T06:33:19.3263589Z  # Check if the PR is opt-out 2025-07-17T06:33:19.3264090Z  if args.pr_number: 2025-07-17T06:33:19.3264775Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.3265522Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.3266018Z  log.info( 2025-07-17T06:33:19.3266729Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.3267479Z  ) 2025-07-17T06:33:19.3268058Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.3268724Z  sys.exit() 2025-07-17T06:33:19.3269528Z  2025-07-17T06:33:19.3269907Z  try: 2025-07-17T06:33:19.3270365Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.3271100Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.3271737Z  ) 2025-07-17T06:33:19.3272103Z  2025-07-17T06:33:19.3272503Z  username = get_potential_pr_author( 2025-07-17T06:33:19.3273042Z  args.github_token, 2025-07-17T06:33:19.3273549Z  args.github_repo, 2025-07-17T06:33:19.3274042Z  args.github_actor, 2025-07-17T06:33:19.3274558Z  args.github_ref_type, 2025-07-17T06:33:19.3275074Z  args.github_branch, 2025-07-17T06:33:19.3275538Z  ) 2025-07-17T06:33:19.3275905Z  2025-07-17T06:33:19.3276384Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.3276987Z  2025-07-17T06:33:19.3277393Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.3277946Z  rollout_state, 2025-07-17T06:33:19.3278452Z  (args.github_issue_owner, username), 2025-07-17T06:33:19.3279007Z  args.github_branch, 2025-07-17T06:33:19.3279908Z  args.eligible_experiments, 2025-07-17T06:33:19.3280464Z  args.opt_out_experiments, 2025-07-17T06:33:19.3280983Z  is_canary, 2025-07-17T06:33:19.3281423Z  ) 2025-07-17T06:33:19.3281795Z  2025-07-17T06:33:19.3282164Z  except Exception as e: 2025-07-17T06:33:19.3282638Z  log.error( 2025-07-17T06:33:19.3283340Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.3284086Z  ) 2025-07-17T06:33:19.3284467Z  2025-07-17T06:33:19.3285091Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.3285744Z  2025-07-17T06:33:19.3286070Z  2025-07-17T06:33:19.3286424Z if __name__ == "__main__": 2025-07-17T06:33:19.3286877Z  main() 2025-07-17T06:33:19.3287257Z  2025-07-17T06:33:19.3287580Z EOF 2025-07-17T06:33:19.3287923Z  2025-07-17T06:33:19.3288293Z cat runner_determinator.py 2025-07-17T06:33:19.3709350Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.3710653Z env: 2025-07-17T06:33:19.3711690Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.3712368Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.3713101Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.3713954Z ISSUE_OWNER: 2025-07-17T06:33:19.3714646Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.3715356Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.3716107Z PR_NUMBER: 2025-07-17T06:33:19.3716750Z ##[endgroup] 2025-07-17T06:33:19.4074185Z # flake8: noqa: G004 2025-07-17T06:33:19.4074697Z 2025-07-17T06:33:19.4075382Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.4076981Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.4078390Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.4079422Z 2025-07-17T06:33:19.4079704Z """ 2025-07-17T06:33:19.4080672Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.4082160Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.4083766Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.4085228Z of which runners should be used to run which job. 2025-07-17T06:33:19.4085937Z 2025-07-17T06:33:19.4086622Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.4088419Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.4090234Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.4091467Z list, defined. 2025-07-17T06:33:19.4091873Z 2025-07-17T06:33:19.4092477Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.4094008Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.4095460Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.4096240Z 2025-07-17T06:33:19.4096887Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.4098472Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.4100354Z experiments which the user could be opted in to. 2025-07-17T06:33:19.4101089Z 2025-07-17T06:33:19.4101435Z The user list has the following rules: 2025-07-17T06:33:19.4102067Z 2025-07-17T06:33:19.4102611Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.4104106Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.4105434Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.4106137Z 2025-07-17T06:33:19.4106428Z Example config: 2025-07-17T06:33:19.4107227Z # A list of experiments that can be opted into. 2025-07-17T06:33:19.4108738Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.4110042Z # Expected syntax is: 2025-07-17T06:33:19.4111189Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.4112911Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.4113974Z 2025-07-17T06:33:19.4114258Z experiments: 2025-07-17T06:33:19.4114927Z lf: 2025-07-17T06:33:19.4115568Z rollout_percent: 25 2025-07-17T06:33:19.4116363Z all_branches: false 2025-07-17T06:33:19.4117158Z default: true 2025-07-17T06:33:19.4117869Z --- 2025-07-17T06:33:19.4118229Z 2025-07-17T06:33:19.4118506Z # Opt-ins: 2025-07-17T06:33:19.4119723Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.4121674Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.4123045Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.4124212Z # Experiments should be from the above list. 2025-07-17T06:33:19.4124861Z 2025-07-17T06:33:19.4125159Z @User1,-lf,split_build 2025-07-17T06:33:19.4125894Z @User2,lf 2025-07-17T06:33:19.4126521Z @User3,split_build 2025-07-17T06:33:19.4127189Z """ 2025-07-17T06:33:19.4127516Z 2025-07-17T06:33:19.4127791Z import json 2025-07-17T06:33:19.4128392Z import logging 2025-07-17T06:33:19.4129025Z import os 2025-07-17T06:33:19.4129948Z import random 2025-07-17T06:33:19.4130642Z import re 2025-07-17T06:33:19.4131294Z import sys 2025-07-17T06:33:19.4132012Z from argparse import ArgumentParser 2025-07-17T06:33:19.4132911Z from collections.abc import Iterable 2025-07-17T06:33:19.4133770Z from functools import cache 2025-07-17T06:33:19.4134544Z from logging import LogRecord 2025-07-17T06:33:19.4135362Z from typing import Any, NamedTuple 2025-07-17T06:33:19.4136240Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.4136875Z 2025-07-17T06:33:19.4137141Z import yaml 2025-07-17T06:33:19.4137815Z from github import Auth, Github 2025-07-17T06:33:19.4138640Z from github.Issue import Issue 2025-07-17T06:33:19.4139368Z 2025-07-17T06:33:19.4139380Z 2025-07-17T06:33:19.4139753Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.4140893Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.4142302Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.4143243Z 2025-07-17T06:33:19.4143620Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.4144789Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.4145655Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.4146582Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.4147193Z 2025-07-17T06:33:19.4147529Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.4148085Z 2025-07-17T06:33:19.4148381Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.4149345Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.4149841Z 2025-07-17T06:33:19.4149851Z 2025-07-17T06:33:19.4150159Z class Experiment(NamedTuple): 2025-07-17T06:33:19.4150936Z rollout_perc: float = ( 2025-07-17T06:33:19.4151996Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.4153108Z ) 2025-07-17T06:33:19.4153767Z all_branches: bool = ( 2025-07-17T06:33:19.4154836Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.4155989Z ) 2025-07-17T06:33:19.4156603Z default: bool = ( 2025-07-17T06:33:19.4157581Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.4158667Z ) 2025-07-17T06:33:19.4159038Z 2025-07-17T06:33:19.4159562Z # Add more fields as needed 2025-07-17T06:33:19.4160099Z 2025-07-17T06:33:19.4160109Z 2025-07-17T06:33:19.4160444Z class Settings(NamedTuple): 2025-07-17T06:33:19.4161195Z """ 2025-07-17T06:33:19.4162322Z Settings for the experiments that can be opted into. 2025-07-17T06:33:19.4163293Z """ 2025-07-17T06:33:19.4163640Z 2025-07-17T06:33:19.4163990Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.4164657Z 2025-07-17T06:33:19.4164671Z 2025-07-17T06:33:19.4165040Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.4166093Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.4166846Z 2025-07-17T06:33:19.4167145Z COLORS = { 2025-07-17T06:33:19.4167832Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.4168685Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.4169715Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.4170539Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.4171318Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.4172089Z } 2025-07-17T06:33:19.4172415Z 2025-07-17T06:33:19.4172775Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.4174033Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.4175445Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.4176460Z return super().format(record) 2025-07-17T06:33:19.4177036Z 2025-07-17T06:33:19.4177049Z 2025-07-17T06:33:19.4177374Z handler = logging.StreamHandler() 2025-07-17T06:33:19.4178597Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.4179791Z 2025-07-17T06:33:19.4180206Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.4181203Z log.addHandler(handler) 2025-07-17T06:33:19.4181942Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.4182430Z 2025-07-17T06:33:19.4182442Z 2025-07-17T06:33:19.4182860Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.4183833Z """ 2025-07-17T06:33:19.4184734Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.4185840Z """ 2025-07-17T06:33:19.4186463Z if not GITHUB_OUTPUT: 2025-07-17T06:33:19.4188330Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.4190521Z log.warning( 2025-07-17T06:33:19.4191935Z "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:19.4193474Z ) 2025-07-17T06:33:19.4207815Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.4208766Z return 2025-07-17T06:33:19.4209396Z 2025-07-17T06:33:19.4209954Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.4210909Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.4211855Z f.write(f"{key}={value}\n") 2025-07-17T06:33:19.4212400Z 2025-07-17T06:33:19.4212410Z 2025-07-17T06:33:19.4212905Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.4214024Z return frozenset( 2025-07-17T06:33:19.4215098Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.4216325Z ) 2025-07-17T06:33:19.4216701Z 2025-07-17T06:33:19.4216712Z 2025-07-17T06:33:19.4217025Z def parse_args() -> Any: 2025-07-17T06:33:19.4217959Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.4219614Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.4221011Z parser.add_argument( 2025-07-17T06:33:19.4221811Z "--github-issue-repo", 2025-07-17T06:33:19.4222618Z type=str, 2025-07-17T06:33:19.4223329Z required=False, 2025-07-17T06:33:19.4224124Z default="pytorch/test-infra", 2025-07-17T06:33:19.4225049Z help="GitHub repo to get the issue", 2025-07-17T06:33:19.4225905Z ) 2025-07-17T06:33:19.4226509Z parser.add_argument( 2025-07-17T06:33:19.4227264Z "--github-repo", 2025-07-17T06:33:19.4227962Z type=str, 2025-07-17T06:33:19.4228604Z required=True, 2025-07-17T06:33:19.4229850Z help="GitHub repo where CI is running", 2025-07-17T06:33:19.4230741Z ) 2025-07-17T06:33:19.4231394Z parser.add_argument( 2025-07-17T06:33:19.4232397Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.4233497Z ) 2025-07-17T06:33:19.4234094Z parser.add_argument( 2025-07-17T06:33:19.4235131Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.4236267Z ) 2025-07-17T06:33:19.4236902Z parser.add_argument( 2025-07-17T06:33:19.4238020Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.4239480Z ) 2025-07-17T06:33:19.4240316Z parser.add_argument( 2025-07-17T06:33:19.4241457Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.4242708Z ) 2025-07-17T06:33:19.4243320Z parser.add_argument( 2025-07-17T06:33:19.4244077Z "--github-ref-type", 2025-07-17T06:33:19.4244864Z type=str, 2025-07-17T06:33:19.4245519Z required=True, 2025-07-17T06:33:19.4246326Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.4247229Z ) 2025-07-17T06:33:19.4247825Z parser.add_argument( 2025-07-17T06:33:19.4248620Z "--eligible-experiments", 2025-07-17T06:33:19.4249733Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.4250634Z required=False, 2025-07-17T06:33:19.4251367Z default="", 2025-07-17T06:33:19.4252808Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.4254458Z ) 2025-07-17T06:33:19.4255108Z parser.add_argument( 2025-07-17T06:33:19.4255919Z "--opt-out-experiments", 2025-07-17T06:33:19.4256816Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.4257733Z required=False, 2025-07-17T06:33:19.4258445Z default="", 2025-07-17T06:33:19.4259352Z help=( 2025-07-17T06:33:19.4260462Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.4262365Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.4263854Z ), 2025-07-17T06:33:19.4264485Z ) 2025-07-17T06:33:19.4265152Z parser.add_argument( 2025-07-17T06:33:19.4265883Z "--pr-number", 2025-07-17T06:33:19.4266593Z type=str, 2025-07-17T06:33:19.4267274Z required=False, 2025-07-17T06:33:19.4267962Z default="", 2025-07-17T06:33:19.4269000Z help="the optional PR number where this is run", 2025-07-17T06:33:19.4270208Z ) 2025-07-17T06:33:19.4270570Z 2025-07-17T06:33:19.4270885Z return parser.parse_args() 2025-07-17T06:33:19.4271418Z 2025-07-17T06:33:19.4271428Z 2025-07-17T06:33:19.4272090Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.4273425Z auth = Auth.Token(github_token) 2025-07-17T06:33:19.4274278Z return Github(auth=auth) 2025-07-17T06:33:19.4274822Z 2025-07-17T06:33:19.4274834Z 2025-07-17T06:33:19.4275596Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.4276983Z repo = gh.get_repo(repo) 2025-07-17T06:33:19.4277834Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.4278481Z 2025-07-17T06:33:19.4278493Z 2025-07-17T06:33:19.4278815Z def get_potential_pr_author( 2025-07-17T06:33:19.4280120Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.4281256Z ) -> str: 2025-07-17T06:33:19.4282092Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.4283423Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.4284669Z # embedded in the tag name: ciflow// 2025-07-17T06:33:19.4285363Z 2025-07-17T06:33:19.4285924Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.4286495Z 2025-07-17T06:33:19.4286944Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.4289351Z split_tag = ref_name.split("/") 2025-07-17T06:33:19.4290269Z if ( 2025-07-17T06:33:19.4290968Z len(split_tag) == 3 2025-07-17T06:33:19.4291814Z and split_tag[0] == "ciflow" 2025-07-17T06:33:19.4310794Z and split_tag[2].isnumeric() 2025-07-17T06:33:19.4384048Z ): 2025-07-17T06:33:19.4384803Z pr_number = split_tag[2] 2025-07-17T06:33:19.4385662Z try: 2025-07-17T06:33:19.4386449Z repository = gh.get_repo(repo) 2025-07-17T06:33:19.4387525Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.4388583Z except Exception as e: 2025-07-17T06:33:19.4389685Z raise Exception( # noqa: TRY002 2025-07-17T06:33:19.4390821Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.4391907Z ) from e 2025-07-17T06:33:19.4392809Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.4394034Z # In all other cases, return the original input username 2025-07-17T06:33:19.4395101Z return username 2025-07-17T06:33:19.4395625Z 2025-07-17T06:33:19.4395636Z 2025-07-17T06:33:19.4396016Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.4396913Z """ 2025-07-17T06:33:19.4397966Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.4399476Z """ 2025-07-17T06:33:19.4400430Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.4401346Z 2025-07-17T06:33:19.4401362Z 2025-07-17T06:33:19.4401706Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.4402560Z try: 2025-07-17T06:33:19.4403197Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.4403993Z return data 2025-07-17T06:33:19.4404629Z except yaml.YAMLError: 2025-07-17T06:33:19.4405354Z log.exception("Error loading YAML") 2025-07-17T06:33:19.4406138Z raise 2025-07-17T06:33:19.4406468Z 2025-07-17T06:33:19.4406477Z 2025-07-17T06:33:19.4407124Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.4408268Z """ 2025-07-17T06:33:19.4409437Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.4410427Z 2025-07-17T06:33:19.4411196Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.4412371Z and the text below is the list of opted in users. 2025-07-17T06:33:19.4412987Z 2025-07-17T06:33:19.4413559Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.4414638Z """ 2025-07-17T06:33:19.4415304Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.4416225Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.4417172Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.4418100Z else: 2025-07-17T06:33:19.4418718Z return "", rollout_state 2025-07-17T06:33:19.4419390Z 2025-07-17T06:33:19.4419401Z 2025-07-17T06:33:19.4419727Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.4420562Z """ 2025-07-17T06:33:19.4421401Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.4422462Z """ 2025-07-17T06:33:19.4422785Z 2025-07-17T06:33:19.4422796Z 2025-07-17T06:33:19.4423346Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.4424472Z """ 2025-07-17T06:33:19.4425608Z 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:19.4426755Z 2025-07-17T06:33:19.4427781Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.4430209Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.4431294Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.4432131Z 2025-07-17T06:33:19.4432143Z 2025-07-17T06:33:19.4432411Z """ 2025-07-17T06:33:19.4433060Z optins = UserOptins() 2025-07-17T06:33:19.4433891Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.4435699Z user = user.strip("\r\n\t -") 2025-07-17T06:33:19.4436644Z if not user or not user.startswith("@"): 2025-07-17T06:33:19.4437803Z # Not a valid user. Skip 2025-07-17T06:33:19.4438678Z continue 2025-07-17T06:33:19.4439315Z 2025-07-17T06:33:19.4439594Z if user: 2025-07-17T06:33:19.4440359Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.4441543Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.4442423Z 2025-07-17T06:33:19.4442735Z return optins 2025-07-17T06:33:19.4443157Z 2025-07-17T06:33:19.4443167Z 2025-07-17T06:33:19.4443649Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.4444632Z """ 2025-07-17T06:33:19.4445069Z Check if the experiment name is valid. 2025-07-17T06:33:19.4445875Z A valid name: 2025-07-17T06:33:19.4446950Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.4448532Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.4449956Z - Cannot contain spaces 2025-07-17T06:33:19.4450709Z """ 2025-07-17T06:33:19.4451034Z 2025-07-17T06:33:19.4451433Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.4452547Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.4453266Z 2025-07-17T06:33:19.4453525Z if valid: 2025-07-17T06:33:19.4454173Z return True 2025-07-17T06:33:19.4454598Z 2025-07-17T06:33:19.4454878Z log.error( 2025-07-17T06:33:19.4457282Z 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:19.4460268Z ) 2025-07-17T06:33:19.4460880Z return False 2025-07-17T06:33:19.4461271Z 2025-07-17T06:33:19.4461290Z 2025-07-17T06:33:19.4461782Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.4462823Z """ 2025-07-17T06:33:19.4464039Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.4465265Z """ 2025-07-17T06:33:19.4465838Z try: 2025-07-17T06:33:19.4466429Z if settings_text: 2025-07-17T06:33:19.4467591Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.4468936Z # for easy reading 2025-07-17T06:33:19.4470485Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.4472047Z # the backtick character in shell commands. 2025-07-17T06:33:19.4473082Z backtick = chr(96) # backtick character 2025-07-17T06:33:19.4474225Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.4475374Z settings = load_yaml(settings_text) 2025-07-17T06:33:19.4475976Z 2025-07-17T06:33:19.4476588Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.4477887Z experiments = {} 2025-07-17T06:33:19.4478401Z 2025-07-17T06:33:19.4479036Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.4480568Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.4482468Z # 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:19.4484598Z continue 2025-07-17T06:33:19.4485110Z 2025-07-17T06:33:19.4485423Z valid_settings = {} 2025-07-17T06:33:19.4486295Z for setting in exp_settings: 2025-07-17T06:33:19.4487382Z if setting not in Experiment._fields: 2025-07-17T06:33:19.4488327Z log.warning( 2025-07-17T06:33:19.4489764Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.4491043Z ) 2025-07-17T06:33:19.4491743Z else: 2025-07-17T06:33:19.4492558Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.4493240Z 2025-07-17T06:33:19.4493705Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.4494814Z return Settings(experiments) 2025-07-17T06:33:19.4495431Z 2025-07-17T06:33:19.4495709Z except Exception: 2025-07-17T06:33:19.4496480Z log.exception("Failed to parse settings") 2025-07-17T06:33:19.4497116Z 2025-07-17T06:33:19.4497397Z return Settings() 2025-07-17T06:33:19.4497812Z 2025-07-17T06:33:19.4497822Z 2025-07-17T06:33:19.4498213Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.4499317Z """ 2025-07-17T06:33:19.4500017Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.4500718Z 2025-07-17T06:33:19.4501316Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.4502598Z and the text below is the list of opted in users. 2025-07-17T06:33:19.4503267Z 2025-07-17T06:33:19.4503908Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.4505115Z """ 2025-07-17T06:33:19.4505997Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.4507297Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.4507973Z 2025-07-17T06:33:19.4507985Z 2025-07-17T06:33:19.4508393Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.4509685Z """ 2025-07-17T06:33:19.4510360Z Parse users from the rollout state. 2025-07-17T06:33:19.4510975Z 2025-07-17T06:33:19.4511220Z """ 2025-07-17T06:33:19.4512074Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.4513317Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.4513978Z 2025-07-17T06:33:19.4513998Z 2025-07-17T06:33:19.4514911Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.4516216Z """ 2025-07-17T06:33:19.4516913Z Check if a user is opted into an experiment 2025-07-17T06:33:19.4517818Z """ 2025-07-17T06:33:19.4518577Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.4520698Z 2025-07-17T06:33:19.4520727Z 2025-07-17T06:33:19.4521490Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.4522767Z """ 2025-07-17T06:33:19.4523523Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.4524473Z """ 2025-07-17T06:33:19.4525325Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.4526498Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.4527603Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.4528578Z return False 2025-07-17T06:33:19.4528977Z 2025-07-17T06:33:19.4529622Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.4530611Z log.warning( 2025-07-17T06:33:19.4531884Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.4533300Z ) 2025-07-17T06:33:19.4533660Z 2025-07-17T06:33:19.4533927Z return True 2025-07-17T06:33:19.4534612Z 2025-07-17T06:33:19.4534624Z 2025-07-17T06:33:19.4534917Z def get_runner_prefix( 2025-07-17T06:33:19.4535649Z rollout_state: str, 2025-07-17T06:33:19.4536410Z workflow_requestors: Iterable[str], 2025-07-17T06:33:19.4537269Z branch: str, 2025-07-17T06:33:19.4538069Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.4539363Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.4540366Z is_canary: bool = False, 2025-07-17T06:33:19.4541128Z ) -> str: 2025-07-17T06:33:19.4541799Z settings = parse_settings(rollout_state) 2025-07-17T06:33:19.4542798Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.4543490Z 2025-07-17T06:33:19.4543793Z fleet_prefix = "" 2025-07-17T06:33:19.4544494Z prefixes = [] 2025-07-17T06:33:19.4545544Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.4547158Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.4548419Z log.info( 2025-07-17T06:33:19.4549777Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.4551146Z ) 2025-07-17T06:33:19.4551881Z continue 2025-07-17T06:33:19.4552287Z 2025-07-17T06:33:19.4552581Z if opt_out_experiments: 2025-07-17T06:33:19.4553412Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.4554415Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.4555354Z log.info( 2025-07-17T06:33:19.4556835Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.4558439Z ) 2025-07-17T06:33:19.4559303Z continue 2025-07-17T06:33:19.4559795Z 2025-07-17T06:33:19.4560088Z if eligible_experiments: 2025-07-17T06:33:19.4560882Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.4561811Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.4562616Z log.info( 2025-07-17T06:33:19.4563798Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.4565133Z ) 2025-07-17T06:33:19.4565756Z continue 2025-07-17T06:33:19.4566498Z elif not experiment_settings.default: 2025-07-17T06:33:19.4567348Z log.info( 2025-07-17T06:33:19.4568605Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.4569996Z ) 2025-07-17T06:33:19.4570655Z continue 2025-07-17T06:33:19.4571088Z 2025-07-17T06:33:19.4571557Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.4572595Z opted_out_users = [ 2025-07-17T06:33:19.4573370Z requestor 2025-07-17T06:33:19.4574155Z for requestor in workflow_requestors 2025-07-17T06:33:19.4575321Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.4576404Z ] 2025-07-17T06:33:19.4576763Z 2025-07-17T06:33:19.4577046Z if opted_out_users: 2025-07-17T06:33:19.4577760Z log.info( 2025-07-17T06:33:19.4578749Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.4580208Z ) 2025-07-17T06:33:19.4580867Z continue 2025-07-17T06:33:19.4581321Z 2025-07-17T06:33:19.4581773Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.4582811Z opted_in_users = [ 2025-07-17T06:33:19.4583600Z requestor 2025-07-17T06:33:19.4584311Z for requestor in workflow_requestors 2025-07-17T06:33:19.4585384Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.4586360Z ] 2025-07-17T06:33:19.4586913Z 2025-07-17T06:33:19.4587182Z enabled = False 2025-07-17T06:33:19.4587828Z if opted_in_users: 2025-07-17T06:33:19.4588456Z log.info( 2025-07-17T06:33:19.4589578Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.4590683Z ) 2025-07-17T06:33:19.4591280Z enabled = True 2025-07-17T06:33:19.4591707Z 2025-07-17T06:33:19.4592031Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.4593357Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.4595221Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.4596259Z log.info( 2025-07-17T06:33:19.4597620Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.4599244Z ) 2025-07-17T06:33:19.4599881Z enabled = True 2025-07-17T06:33:19.4600347Z 2025-07-17T06:33:19.4600604Z if enabled: 2025-07-17T06:33:19.4601243Z label = experiment_name 2025-07-17T06:33:19.4602087Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.4603392Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.4604872Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.4606185Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.4607331Z if is_canary: 2025-07-17T06:33:19.4608127Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.4608997Z fleet_prefix = label 2025-07-17T06:33:19.4609993Z else: 2025-07-17T06:33:19.4610663Z prefixes.append(label) 2025-07-17T06:33:19.4611220Z 2025-07-17T06:33:19.4611499Z if len(prefixes) > 1: 2025-07-17T06:33:19.4612247Z log.error( 2025-07-17T06:33:19.4613978Z 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:19.4615924Z ) 2025-07-17T06:33:19.4616582Z prefixes = prefixes[:1] 2025-07-17T06:33:19.4617101Z 2025-07-17T06:33:19.4617423Z # Fleet always comes first 2025-07-17T06:33:19.4618215Z if fleet_prefix: 2025-07-17T06:33:19.4618995Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.4619831Z 2025-07-17T06:33:19.4620460Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.4621175Z 2025-07-17T06:33:19.4621185Z 2025-07-17T06:33:19.4621891Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.4623133Z """ 2025-07-17T06:33:19.4624061Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.4625032Z 2025-07-17T06:33:19.4625694Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.4626868Z """ 2025-07-17T06:33:19.4627512Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.4628390Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.4629671Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.4630423Z 2025-07-17T06:33:19.4630435Z 2025-07-17T06:33:19.4631108Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.4632808Z for _ in range(num_retries): 2025-07-17T06:33:19.4633705Z try: 2025-07-17T06:33:19.4634432Z req = Request(url=url, headers=headers) 2025-07-17T06:33:19.4635499Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.4636531Z return json.loads(content) 2025-07-17T06:33:19.4637409Z except Exception as e: 2025-07-17T06:33:19.4638305Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.4639488Z 2025-07-17T06:33:19.4640124Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.4641353Z return {} 2025-07-17T06:33:19.4641757Z 2025-07-17T06:33:19.4641767Z 2025-07-17T06:33:19.4642026Z @cache 2025-07-17T06:33:19.4643072Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.4644459Z """ 2025-07-17T06:33:19.4645106Z Dynamically get PR information 2025-07-17T06:33:19.4645881Z """ 2025-07-17T06:33:19.4646669Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.4647711Z headers = { 2025-07-17T06:33:19.4648482Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.4649690Z "Authorization": f"token {github_token}", 2025-07-17T06:33:19.4650541Z } 2025-07-17T06:33:19.4651228Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.4652271Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.4653183Z headers=headers, 2025-07-17T06:33:19.4653902Z ) 2025-07-17T06:33:19.4654260Z 2025-07-17T06:33:19.4654563Z if not json_response: 2025-07-17T06:33:19.4655572Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.4656658Z return {} 2025-07-17T06:33:19.4657069Z 2025-07-17T06:33:19.4657361Z return json_response 2025-07-17T06:33:19.4657814Z 2025-07-17T06:33:19.4657824Z 2025-07-17T06:33:19.4658456Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.4660012Z """ 2025-07-17T06:33:19.4660838Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.4661869Z """ 2025-07-17T06:33:19.4662599Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.4663550Z return { 2025-07-17T06:33:19.4664443Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.4665545Z } 2025-07-17T06:33:19.4665852Z 2025-07-17T06:33:19.4665861Z 2025-07-17T06:33:19.4666129Z def main() -> None: 2025-07-17T06:33:19.4666757Z args = parse_args() 2025-07-17T06:33:19.4667172Z 2025-07-17T06:33:19.4667504Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.4668102Z 2025-07-17T06:33:19.4668419Z # Check if the PR is opt-out 2025-07-17T06:33:19.4669325Z if args.pr_number: 2025-07-17T06:33:19.4670346Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.4671734Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.4672518Z log.info( 2025-07-17T06:33:19.4673573Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.4674792Z ) 2025-07-17T06:33:19.4675626Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.4676679Z sys.exit() 2025-07-17T06:33:19.4677078Z 2025-07-17T06:33:19.4677330Z try: 2025-07-17T06:33:19.4677987Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.4679307Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.4680318Z ) 2025-07-17T06:33:19.4680635Z 2025-07-17T06:33:19.4680953Z username = get_potential_pr_author( 2025-07-17T06:33:19.4681785Z args.github_token, 2025-07-17T06:33:19.4682519Z args.github_repo, 2025-07-17T06:33:19.4683289Z args.github_actor, 2025-07-17T06:33:19.4684029Z args.github_ref_type, 2025-07-17T06:33:19.4684821Z args.github_branch, 2025-07-17T06:33:19.4685525Z ) 2025-07-17T06:33:19.4685838Z 2025-07-17T06:33:19.4686288Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.4687007Z 2025-07-17T06:33:19.4687329Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.4688189Z rollout_state, 2025-07-17T06:33:19.4689236Z (args.github_issue_owner, username), 2025-07-17T06:33:19.4690105Z args.github_branch, 2025-07-17T06:33:19.4690855Z args.eligible_experiments, 2025-07-17T06:33:19.4691712Z args.opt_out_experiments, 2025-07-17T06:33:19.4692502Z is_canary, 2025-07-17T06:33:19.4693128Z ) 2025-07-17T06:33:19.4693439Z 2025-07-17T06:33:19.4693723Z except Exception as e: 2025-07-17T06:33:19.4694435Z log.error( 2025-07-17T06:33:19.4695467Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.4696710Z ) 2025-07-17T06:33:19.4697056Z 2025-07-17T06:33:19.4697583Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.4698402Z 2025-07-17T06:33:19.4698412Z 2025-07-17T06:33:19.4698695Z if __name__ == "__main__": 2025-07-17T06:33:19.4699540Z main() 2025-07-17T06:33:19.4699865Z 2025-07-17T06:33:19.4828269Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.4829954Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.4871741Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.4872481Z env: 2025-07-17T06:33:19.4873359Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.4873992Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.4874687Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.4875526Z ISSUE_OWNER: 2025-07-17T06:33:19.4876172Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.4876863Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.4877527Z PR_NUMBER: 2025-07-17T06:33:19.4878087Z ##[endgroup] 2025-07-17T06:33:20.5933615Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.2421652Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.2788871Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.2998930Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-07-17T06:33:21.3228389Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.3289652Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.3708145Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.3756228Z 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.3805292Z 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.3822495Z 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.3837849Z 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.4095014Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.4131087Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.4388485Z 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.5533507Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.5568947Z 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.6586949Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.6624983Z 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.6807276Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.6844196Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.7073739Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.7151204Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 22.9 MB/s eta 0:00:00 2025-07-17T06:33:21.7186527Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.7255676Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 67.0 MB/s eta 0:00:00 2025-07-17T06:33:21.7293177Z 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.7379765Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 120.6 MB/s eta 0:00:00 2025-07-17T06:33:21.7415096Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.7472812Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.7539882Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 97.9 MB/s eta 0:00:00 2025-07-17T06:33:21.7576115Z 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.7616879Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 32.2 MB/s eta 0:00:00 2025-07-17T06:33:21.7651828Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.7699572Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 34.1 MB/s eta 0:00:00 2025-07-17T06:33:22.0841485Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.6202503Z 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.7010535Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.7010854Z curr_branch="main" 2025-07-17T06:33:22.7011086Z curr_ref_type="branch" 2025-07-17T06:33:22.7011340Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.7011602Z  2025-07-17T06:33:22.7011789Z python3 runner_determinator.py \ 2025-07-17T06:33:22.7012073Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.7012348Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.7012600Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.7012908Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.7013188Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.7013472Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.7013762Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.7014080Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.7014459Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.7014761Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.7043714Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.7043951Z env: 2025-07-17T06:33:22.7044442Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.7044634Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.7044845Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.7045082Z ISSUE_OWNER: 2025-07-17T06:33:22.7045276Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.7045468Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.7045677Z PR_NUMBER: 2025-07-17T06:33:22.7045842Z ##[endgroup] 2025-07-17T06:33:22.7092838Z Current branch is 'main' 2025-07-17T06:33:24.0191297Z INFO : Based on rollout percentage of 25%, enabling experiment lf. 2025-07-17T06:33:24.0192613Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.0193599Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.0194276Z INFO : Setting output: label-type='lf.' 2025-07-17T06:33:24.0503929Z Evaluate and set job outputs 2025-07-17T06:33:24.0510849Z Set output 'label-type' 2025-07-17T06:33:24.0512613Z Cleaning up orphan processes