2025-07-17T06:33:20.1632598Z Current runner version: '2.326.0' 2025-07-17T06:33:20.1656611Z ##[group]Runner Image Provisioner 2025-07-17T06:33:20.1657452Z Hosted Compute Agent 2025-07-17T06:33:20.1658009Z Version: 20250711.363 2025-07-17T06:33:20.1658890Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:20.1659706Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:20.1660320Z ##[endgroup] 2025-07-17T06:33:20.1660842Z ##[group]Operating System 2025-07-17T06:33:20.1661496Z Ubuntu 2025-07-17T06:33:20.1661950Z 24.04.2 2025-07-17T06:33:20.1662414Z LTS 2025-07-17T06:33:20.1662928Z ##[endgroup] 2025-07-17T06:33:20.1663438Z ##[group]Runner Image 2025-07-17T06:33:20.1663996Z Image: ubuntu-24.04 2025-07-17T06:33:20.1664567Z Version: 20250710.1.0 2025-07-17T06:33:20.1665581Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:20.1667151Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:20.1668265Z ##[endgroup] 2025-07-17T06:33:20.1670652Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:20.1672888Z Actions: read 2025-07-17T06:33:20.1673460Z Attestations: read 2025-07-17T06:33:20.1674034Z Checks: read 2025-07-17T06:33:20.1674566Z Contents: read 2025-07-17T06:33:20.1675042Z Deployments: read 2025-07-17T06:33:20.1675614Z Discussions: read 2025-07-17T06:33:20.1676180Z Issues: read 2025-07-17T06:33:20.1676638Z Metadata: read 2025-07-17T06:33:20.1677167Z Models: read 2025-07-17T06:33:20.1677659Z Packages: read 2025-07-17T06:33:20.1678439Z Pages: read 2025-07-17T06:33:20.1679014Z PullRequests: read 2025-07-17T06:33:20.1679686Z RepositoryProjects: read 2025-07-17T06:33:20.1680228Z SecurityEvents: read 2025-07-17T06:33:20.1680853Z Statuses: read 2025-07-17T06:33:20.1681441Z ##[endgroup] 2025-07-17T06:33:20.1683790Z Secret source: Actions 2025-07-17T06:33:20.1684672Z Prepare workflow directory 2025-07-17T06:33:20.2253255Z Prepare all required actions 2025-07-17T06:33:20.2307820Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:20.2312903Z ##[group] Inputs 2025-07-17T06:33:20.2313512Z check_experiments: 2025-07-17T06:33:20.2314018Z opt_out_experiments: 2025-07-17T06:33:20.2314726Z triggering_actor: pytorchmergebot 2025-07-17T06:33:20.2315300Z issue_owner: 2025-07-17T06:33:20.2315823Z curr_branch: main 2025-07-17T06:33:20.2316385Z curr_ref_type: branch 2025-07-17T06:33:20.2316925Z issue_number: 5132 2025-07-17T06:33:20.2317427Z ##[endgroup] 2025-07-17T06:33:20.2318065Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.2911421Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.2914675Z cat < runner_determinator.py 2025-07-17T06:33:20.2915863Z # flake8: noqa: G004 2025-07-17T06:33:20.2916901Z  2025-07-17T06:33:20.2918318Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.2920327Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.2922073Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.2923211Z  2025-07-17T06:33:20.2923984Z """ 2025-07-17T06:33:20.2925163Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.2926950Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.2929416Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.2931100Z of which runners should be used to run which job. 2025-07-17T06:33:20.2932309Z  2025-07-17T06:33:20.2933630Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.2935470Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.2937540Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.2939369Z list, defined. 2025-07-17T06:33:20.2940225Z  2025-07-17T06:33:20.2941501Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.2943406Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.2945020Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.2946444Z  2025-07-17T06:33:20.2947642Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.2949651Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.2951382Z experiments which the user could be opted in to. 2025-07-17T06:33:20.2952735Z  2025-07-17T06:33:20.2953728Z The user list has the following rules: 2025-07-17T06:33:20.2954931Z  2025-07-17T06:33:20.2956189Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.2957763Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.2959565Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.2960805Z  2025-07-17T06:33:20.2961479Z Example config: 2025-07-17T06:33:20.2962492Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.2963937Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.2965190Z  # Expected syntax is: 2025-07-17T06:33:20.2966573Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.2968657Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.2970106Z  2025-07-17T06:33:20.2971014Z  experiments: 2025-07-17T06:33:20.2971917Z  lf: 2025-07-17T06:33:20.2972671Z  rollout_percent: 25 2025-07-17T06:33:20.2973763Z  all_branches: false 2025-07-17T06:33:20.2974813Z  default: true 2025-07-17T06:33:20.2975637Z  --- 2025-07-17T06:33:20.2976530Z  2025-07-17T06:33:20.2977299Z  # Opt-ins: 2025-07-17T06:33:20.2978799Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.2980901Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.2982434Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.2983864Z  # Experiments should be from the above list. 2025-07-17T06:33:20.2984972Z  2025-07-17T06:33:20.2985727Z  @User1,-lf,split_build 2025-07-17T06:33:20.2986714Z  @User2,lf 2025-07-17T06:33:20.2987626Z  @User3,split_build 2025-07-17T06:33:20.2988787Z """ 2025-07-17T06:33:20.2989562Z  2025-07-17T06:33:20.2990433Z import json 2025-07-17T06:33:20.2991200Z import logging 2025-07-17T06:33:20.2992019Z import os 2025-07-17T06:33:20.2992914Z import random 2025-07-17T06:33:20.2993792Z import re 2025-07-17T06:33:20.2994516Z import sys 2025-07-17T06:33:20.2995533Z from argparse import ArgumentParser 2025-07-17T06:33:20.2996732Z from collections.abc import Iterable 2025-07-17T06:33:20.2997754Z from functools import cache 2025-07-17T06:33:20.2999089Z from logging import LogRecord 2025-07-17T06:33:20.3000144Z from typing import Any, NamedTuple 2025-07-17T06:33:20.3001301Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.3002500Z  2025-07-17T06:33:20.3003215Z import yaml 2025-07-17T06:33:20.3004293Z from github import Auth, Github 2025-07-17T06:33:20.3005399Z from github.Issue import Issue 2025-07-17T06:33:20.3006416Z  2025-07-17T06:33:20.3007103Z  2025-07-17T06:33:20.3008086Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.3009794Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.3011458Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.3012954Z  2025-07-17T06:33:20.3013792Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.3015547Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.3016654Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.3017827Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.3019162Z  2025-07-17T06:33:20.3020049Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.3021064Z  2025-07-17T06:33:20.3021858Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.3022935Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.3023787Z  2025-07-17T06:33:20.3024521Z  2025-07-17T06:33:20.3025361Z class Experiment(NamedTuple): 2025-07-17T06:33:20.3026391Z  rollout_perc: float = ( 2025-07-17T06:33:20.3027733Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.3029349Z  ) 2025-07-17T06:33:20.3030120Z  all_branches: bool = ( 2025-07-17T06:33:20.3031396Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.3032792Z  ) 2025-07-17T06:33:20.3033550Z  default: bool = ( 2025-07-17T06:33:20.3034781Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.3036114Z  ) 2025-07-17T06:33:20.3036828Z  2025-07-17T06:33:20.3037604Z  # Add more fields as needed 2025-07-17T06:33:20.3038869Z  2025-07-17T06:33:20.3039582Z  2025-07-17T06:33:20.3040320Z class Settings(NamedTuple): 2025-07-17T06:33:20.3041420Z  """ 2025-07-17T06:33:20.3042405Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.3043481Z  """ 2025-07-17T06:33:20.3044368Z  2025-07-17T06:33:20.3045164Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.3046206Z  2025-07-17T06:33:20.3047213Z  2025-07-17T06:33:20.3048356Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.3049625Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.3050896Z  2025-07-17T06:33:20.3051651Z  COLORS = { 2025-07-17T06:33:20.3052536Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.3053651Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.3054650Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.3055645Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.3056745Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.3057718Z  } 2025-07-17T06:33:20.3058873Z  2025-07-17T06:33:20.3059789Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.3061262Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.3062802Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.3063947Z  return super().format(record) 2025-07-17T06:33:20.3064976Z  2025-07-17T06:33:20.3065670Z  2025-07-17T06:33:20.3066564Z handler = logging.StreamHandler() 2025-07-17T06:33:20.3067999Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.3069827Z  2025-07-17T06:33:20.3070917Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.3072040Z log.addHandler(handler) 2025-07-17T06:33:20.3073127Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.3074103Z  2025-07-17T06:33:20.3074816Z  2025-07-17T06:33:20.3075639Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.3076959Z  """ 2025-07-17T06:33:20.3077979Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.3079570Z  """ 2025-07-17T06:33:20.3080445Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.3082436Z  # 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.3084622Z  log.warning( 2025-07-17T06:33:20.3086241Z  "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.3088026Z  ) 2025-07-17T06:33:20.3089317Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.3090408Z  return 2025-07-17T06:33:20.3091231Z  2025-07-17T06:33:20.3092032Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.3093235Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.3094371Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.3095434Z  2025-07-17T06:33:20.3096174Z  2025-07-17T06:33:20.3097170Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.3098768Z  return frozenset( 2025-07-17T06:33:20.3100006Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.3101311Z  ) 2025-07-17T06:33:20.3102198Z  2025-07-17T06:33:20.3102923Z  2025-07-17T06:33:20.3103663Z def parse_args() -> Any: 2025-07-17T06:33:20.3104867Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.3106567Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.3108056Z  parser.add_argument( 2025-07-17T06:33:20.3109422Z  "--github-issue-repo", 2025-07-17T06:33:20.3110422Z  type=str, 2025-07-17T06:33:20.3111225Z  required=False, 2025-07-17T06:33:20.3112506Z  default="pytorch/test-infra", 2025-07-17T06:33:20.3113609Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.3114585Z  ) 2025-07-17T06:33:20.3115557Z  parser.add_argument( 2025-07-17T06:33:20.3116541Z  "--github-repo", 2025-07-17T06:33:20.3117426Z  type=str, 2025-07-17T06:33:20.3118568Z  required=True, 2025-07-17T06:33:20.3119629Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.3120791Z  ) 2025-07-17T06:33:20.3121568Z  parser.add_argument( 2025-07-17T06:33:20.3122896Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.3187385Z  ) 2025-07-17T06:33:20.3188319Z  parser.add_argument( 2025-07-17T06:33:20.3189535Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.3190721Z  ) 2025-07-17T06:33:20.3191365Z  parser.add_argument( 2025-07-17T06:33:20.3192605Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.3193782Z  ) 2025-07-17T06:33:20.3194416Z  parser.add_argument( 2025-07-17T06:33:20.3195615Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.3197132Z  ) 2025-07-17T06:33:20.3197799Z  parser.add_argument( 2025-07-17T06:33:20.3198832Z  "--github-ref-type", 2025-07-17T06:33:20.3199638Z  type=str, 2025-07-17T06:33:20.3200355Z  required=True, 2025-07-17T06:33:20.3201294Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.3202275Z  ) 2025-07-17T06:33:20.3202926Z  parser.add_argument( 2025-07-17T06:33:20.3203767Z  "--eligible-experiments", 2025-07-17T06:33:20.3204687Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3205618Z  required=False, 2025-07-17T06:33:20.3206445Z  default="", 2025-07-17T06:33:20.3208025Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.3209907Z  ) 2025-07-17T06:33:20.3210588Z  parser.add_argument( 2025-07-17T06:33:20.3211422Z  "--opt-out-experiments", 2025-07-17T06:33:20.3212314Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3213197Z  required=False, 2025-07-17T06:33:20.3213984Z  default="", 2025-07-17T06:33:20.3214714Z  help=( 2025-07-17T06:33:20.3215893Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.3217848Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.3219503Z  ), 2025-07-17T06:33:20.3220145Z  ) 2025-07-17T06:33:20.3220805Z  parser.add_argument( 2025-07-17T06:33:20.3221601Z  "--pr-number", 2025-07-17T06:33:20.3222349Z  type=str, 2025-07-17T06:33:20.3223089Z  required=False, 2025-07-17T06:33:20.3223886Z  default="", 2025-07-17T06:33:20.3224752Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.3225686Z  ) 2025-07-17T06:33:20.3226299Z  2025-07-17T06:33:20.3226927Z  return parser.parse_args() 2025-07-17T06:33:20.3227737Z  2025-07-17T06:33:20.3228549Z  2025-07-17T06:33:20.3229595Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3231131Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.3232025Z  return Github(auth=auth) 2025-07-17T06:33:20.3232832Z  2025-07-17T06:33:20.3233407Z  2025-07-17T06:33:20.3234505Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3235896Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.3236825Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.3237696Z  2025-07-17T06:33:20.3238452Z  2025-07-17T06:33:20.3239106Z def get_potential_pr_author( 2025-07-17T06:33:20.3240264Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.3241405Z ) -> str: 2025-07-17T06:33:20.3242342Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.3243734Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.3245045Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.3246046Z  2025-07-17T06:33:20.3246700Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3247531Z  2025-07-17T06:33:20.3248538Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.3249642Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.3250703Z  if ( 2025-07-17T06:33:20.3251402Z  len(split_tag) == 3 2025-07-17T06:33:20.3252292Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.3253198Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.3254032Z  ): 2025-07-17T06:33:20.3254746Z  pr_number = split_tag[2] 2025-07-17T06:33:20.3255608Z  try: 2025-07-17T06:33:20.3256381Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.3257445Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.3258730Z  except Exception as e: 2025-07-17T06:33:20.3259649Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.3260796Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.3261919Z  ) from e 2025-07-17T06:33:20.3262903Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.3264127Z  # In all other cases, return the original input username 2025-07-17T06:33:20.3265181Z  return username 2025-07-17T06:33:20.3265898Z  2025-07-17T06:33:20.3266446Z  2025-07-17T06:33:20.3267160Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.3268091Z  """ 2025-07-17T06:33:20.3269891Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.3271257Z  """ 2025-07-17T06:33:20.3272200Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.3273319Z  2025-07-17T06:33:20.3273885Z  2025-07-17T06:33:20.3274552Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.3275386Z  try: 2025-07-17T06:33:20.3276080Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.3276959Z  return data 2025-07-17T06:33:20.3277727Z  except yaml.YAMLError: 2025-07-17T06:33:20.3278824Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.3279694Z  raise 2025-07-17T06:33:20.3280367Z  2025-07-17T06:33:20.3280945Z  2025-07-17T06:33:20.3281979Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.3283235Z  """ 2025-07-17T06:33:20.3284554Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.3285857Z  2025-07-17T06:33:20.3286783Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3288119Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3289254Z  2025-07-17T06:33:20.3290240Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.3291427Z  """ 2025-07-17T06:33:20.3292192Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.3293240Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.3294312Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.3295322Z  else: 2025-07-17T06:33:20.3295994Z  return "", rollout_state 2025-07-17T06:33:20.3296824Z  2025-07-17T06:33:20.3297371Z  2025-07-17T06:33:20.3298049Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.3299163Z  """ 2025-07-17T06:33:20.3300110Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.3301200Z  """ 2025-07-17T06:33:20.3301780Z  2025-07-17T06:33:20.3302347Z  2025-07-17T06:33:20.3303518Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.3304635Z  """ 2025-07-17T06:33:20.3305864Z  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.3307357Z  2025-07-17T06:33:20.3308886Z  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.3310600Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.3311786Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.3312869Z  2025-07-17T06:33:20.3313433Z  2025-07-17T06:33:20.3313994Z  """ 2025-07-17T06:33:20.3314623Z  optins = UserOptins() 2025-07-17T06:33:20.3315518Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.3316495Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.3317451Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.3318589Z  # Not a valid user. Skip 2025-07-17T06:33:20.3319480Z  continue 2025-07-17T06:33:20.3320161Z  2025-07-17T06:33:20.3320727Z  if user: 2025-07-17T06:33:20.3321518Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.3322708Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.3323793Z  2025-07-17T06:33:20.3324378Z  return optins 2025-07-17T06:33:20.3325093Z  2025-07-17T06:33:20.3325662Z  2025-07-17T06:33:20.3326495Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.3327524Z  """ 2025-07-17T06:33:20.3328445Z  Check if the experiment name is valid. 2025-07-17T06:33:20.3329382Z  A valid name: 2025-07-17T06:33:20.3330536Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.3332155Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.3333357Z  - Cannot contain spaces 2025-07-17T06:33:20.3334153Z  """ 2025-07-17T06:33:20.3334761Z  2025-07-17T06:33:20.3335532Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.3336746Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.3338006Z  2025-07-17T06:33:20.3338868Z  if valid: 2025-07-17T06:33:20.3339551Z  return True 2025-07-17T06:33:20.3340247Z  2025-07-17T06:33:20.3340811Z  log.error( 2025-07-17T06:33:20.3343322Z  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.3345999Z  ) 2025-07-17T06:33:20.3346619Z  return False 2025-07-17T06:33:20.3347291Z  2025-07-17T06:33:20.3347845Z  2025-07-17T06:33:20.3348953Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.3350050Z  """ 2025-07-17T06:33:20.3351072Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.3352327Z  """ 2025-07-17T06:33:20.3352958Z  try: 2025-07-17T06:33:20.3353588Z  if settings_text: 2025-07-17T06:33:20.3354856Z  # 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.3356192Z  # for easy reading 2025-07-17T06:33:20.3357566Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.3359544Z  # the backtick character in shell commands. 2025-07-17T06:33:20.3360594Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.3361760Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.3362908Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.3363764Z  2025-07-17T06:33:20.3364800Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.3366059Z  experiments = {} 2025-07-17T06:33:20.3366835Z  2025-07-17T06:33:20.3367786Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.3369287Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.3371190Z  # 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.3372973Z  continue 2025-07-17T06:33:20.3373746Z  2025-07-17T06:33:20.3374370Z  valid_settings = {} 2025-07-17T06:33:20.3375251Z  for setting in exp_settings: 2025-07-17T06:33:20.3376277Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.3377243Z  log.warning( 2025-07-17T06:33:20.3378658Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.3379898Z  ) 2025-07-17T06:33:20.3380644Z  else: 2025-07-17T06:33:20.3381556Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.3382528Z  2025-07-17T06:33:20.3383328Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.3384415Z  return Settings(experiments) 2025-07-17T06:33:20.3385253Z  2025-07-17T06:33:20.3385853Z  except Exception: 2025-07-17T06:33:20.3386715Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.3387607Z  2025-07-17T06:33:20.3388403Z  return Settings() 2025-07-17T06:33:20.3389184Z  2025-07-17T06:33:20.3389739Z  2025-07-17T06:33:20.3390694Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.3391696Z  """ 2025-07-17T06:33:20.3392480Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.3393405Z  2025-07-17T06:33:20.3394286Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3395596Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3396551Z  2025-07-17T06:33:20.3397552Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.3399007Z  """ 2025-07-17T06:33:20.3399985Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3401319Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.3402269Z  2025-07-17T06:33:20.3402825Z  2025-07-17T06:33:20.3403572Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.3404556Z  """ 2025-07-17T06:33:20.3405260Z  Parse users from the rollout state. 2025-07-17T06:33:20.3406105Z  2025-07-17T06:33:20.3406656Z  """ 2025-07-17T06:33:20.3407649Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3409193Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.3410315Z  2025-07-17T06:33:20.3410887Z  2025-07-17T06:33:20.3411927Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3413199Z  """ 2025-07-17T06:33:20.3413942Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.3414867Z  """ 2025-07-17T06:33:20.3415675Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.3416633Z  2025-07-17T06:33:20.3417204Z  2025-07-17T06:33:20.3418447Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3419760Z  """ 2025-07-17T06:33:20.3420598Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.3421570Z  """ 2025-07-17T06:33:20.3422452Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.3423688Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.3424795Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.3425796Z  return False 2025-07-17T06:33:20.3426521Z  2025-07-17T06:33:20.3427303Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.3428497Z  log.warning( 2025-07-17T06:33:20.3429970Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.3431452Z  ) 2025-07-17T06:33:20.3432064Z  2025-07-17T06:33:20.3432642Z  return True 2025-07-17T06:33:20.3433347Z  2025-07-17T06:33:20.3433894Z  2025-07-17T06:33:20.3434489Z def get_runner_prefix( 2025-07-17T06:33:20.3435282Z  rollout_state: str, 2025-07-17T06:33:20.3436153Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.3437058Z  branch: str, 2025-07-17T06:33:20.3437945Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3439318Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3440354Z  is_canary: bool = False, 2025-07-17T06:33:20.3441151Z ) -> str: 2025-07-17T06:33:20.3441885Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.3442887Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.3443782Z  2025-07-17T06:33:20.3444573Z  fleet_prefix = "" 2025-07-17T06:33:20.3445331Z  prefixes = [] 2025-07-17T06:33:20.3446484Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.3448097Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.3449560Z  log.info( 2025-07-17T06:33:20.3450762Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.3452051Z  ) 2025-07-17T06:33:20.3452747Z  continue 2025-07-17T06:33:20.3453456Z  2025-07-17T06:33:20.3454222Z  if opt_out_experiments: 2025-07-17T06:33:20.3455167Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.3456281Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.3457278Z  log.info( 2025-07-17T06:33:20.3459116Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.3460792Z  ) 2025-07-17T06:33:20.3461498Z  continue 2025-07-17T06:33:20.3462242Z  2025-07-17T06:33:20.3463124Z  if eligible_experiments: 2025-07-17T06:33:20.3464117Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.3465212Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.3466176Z  log.info( 2025-07-17T06:33:20.3467545Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.3469288Z  ) 2025-07-17T06:33:20.3470004Z  continue 2025-07-17T06:33:20.3470867Z  elif not experiment_settings.default: 2025-07-17T06:33:20.3471780Z  log.info( 2025-07-17T06:33:20.3472964Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.3474207Z  ) 2025-07-17T06:33:20.3474882Z  continue 2025-07-17T06:33:20.3475621Z  2025-07-17T06:33:20.3476421Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.3477441Z  opted_out_users = [ 2025-07-17T06:33:20.3478460Z  requestor 2025-07-17T06:33:20.3479329Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3480488Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3481551Z  ] 2025-07-17T06:33:20.3482172Z  2025-07-17T06:33:20.3482766Z  if opted_out_users: 2025-07-17T06:33:20.3483571Z  log.info( 2025-07-17T06:33:20.3484687Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.3485873Z  ) 2025-07-17T06:33:20.3486533Z  continue 2025-07-17T06:33:20.3487243Z  2025-07-17T06:33:20.3488061Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.3489316Z  opted_in_users = [ 2025-07-17T06:33:20.3490099Z  requestor 2025-07-17T06:33:20.3490942Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3492047Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3493095Z  ] 2025-07-17T06:33:20.3493696Z  2025-07-17T06:33:20.3494267Z  enabled = False 2025-07-17T06:33:20.3495005Z  if opted_in_users: 2025-07-17T06:33:20.3496037Z  log.info( 2025-07-17T06:33:20.3497144Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.3498466Z  ) 2025-07-17T06:33:20.3499189Z  enabled = True 2025-07-17T06:33:20.3499995Z  2025-07-17T06:33:20.3500686Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.3502211Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.3503964Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.3505190Z  log.info( 2025-07-17T06:33:20.3506752Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.3508642Z  ) 2025-07-17T06:33:20.3509414Z  enabled = True 2025-07-17T06:33:20.3510208Z  2025-07-17T06:33:20.3510777Z  if enabled: 2025-07-17T06:33:20.3511565Z  label = experiment_name 2025-07-17T06:33:20.3512575Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.3513972Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.3515749Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.3517074Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.3518405Z  if is_canary: 2025-07-17T06:33:20.3519290Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.3520249Z  fleet_prefix = label 2025-07-17T06:33:20.3521096Z  else: 2025-07-17T06:33:20.3521870Z  prefixes.append(label) 2025-07-17T06:33:20.3522716Z  2025-07-17T06:33:20.3523337Z  if len(prefixes) > 1: 2025-07-17T06:33:20.3524143Z  log.error( 2025-07-17T06:33:20.3525933Z  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.3527823Z  ) 2025-07-17T06:33:20.3528736Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.3529535Z  2025-07-17T06:33:20.3530166Z  # Fleet always comes first 2025-07-17T06:33:20.3531018Z  if fleet_prefix: 2025-07-17T06:33:20.3531815Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.3532654Z  2025-07-17T06:33:20.3533393Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.3534377Z  2025-07-17T06:33:20.3534936Z  2025-07-17T06:33:20.3536014Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.3537331Z  """ 2025-07-17T06:33:20.3538561Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.3539750Z  2025-07-17T06:33:20.3540720Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.3541978Z  """ 2025-07-17T06:33:20.3542656Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3543585Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.3544699Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.3545738Z  2025-07-17T06:33:20.3546292Z  2025-07-17T06:33:20.3547288Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.3549029Z  for _ in range(num_retries): 2025-07-17T06:33:20.3549873Z  try: 2025-07-17T06:33:20.3550635Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.3551780Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.3552907Z  return json.loads(content) 2025-07-17T06:33:20.3553795Z  except Exception as e: 2025-07-17T06:33:20.3554770Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.3555745Z  2025-07-17T06:33:20.3556710Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.3557915Z  return {} 2025-07-17T06:33:20.3558806Z  2025-07-17T06:33:20.3559396Z  2025-07-17T06:33:20.3559954Z @cache 2025-07-17T06:33:20.3561026Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.3562321Z  """ 2025-07-17T06:33:20.3563034Z  Dynamically get PR information 2025-07-17T06:33:20.3563860Z  """ 2025-07-17T06:33:20.3564708Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.3565793Z  headers = { 2025-07-17T06:33:20.3566632Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.3567916Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.3569078Z  } 2025-07-17T06:33:20.3569872Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.3570918Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.3571815Z  headers=headers, 2025-07-17T06:33:20.3572572Z  ) 2025-07-17T06:33:20.3573178Z  2025-07-17T06:33:20.3573812Z  if not json_response: 2025-07-17T06:33:20.3574806Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.3575866Z  return {} 2025-07-17T06:33:20.3576586Z  2025-07-17T06:33:20.3577207Z  return json_response 2025-07-17T06:33:20.3577943Z  2025-07-17T06:33:20.3578675Z  2025-07-17T06:33:20.3579767Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.3581033Z  """ 2025-07-17T06:33:20.3581957Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.3583050Z  """ 2025-07-17T06:33:20.3583912Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.3584955Z  return { 2025-07-17T06:33:20.3585952Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.3587101Z  } 2025-07-17T06:33:20.3587717Z  2025-07-17T06:33:20.3588466Z  2025-07-17T06:33:20.3589066Z def main() -> None: 2025-07-17T06:33:20.3589814Z  args = parse_args() 2025-07-17T06:33:20.3590559Z  2025-07-17T06:33:20.3591299Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.3592186Z  2025-07-17T06:33:20.3592798Z  # Check if the PR is opt-out 2025-07-17T06:33:20.3593643Z  if args.pr_number: 2025-07-17T06:33:20.3594843Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.3596120Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.3596952Z  log.info( 2025-07-17T06:33:20.3598366Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.3599673Z  ) 2025-07-17T06:33:20.3600648Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3601829Z  sys.exit() 2025-07-17T06:33:20.3602768Z  2025-07-17T06:33:20.3603356Z  try: 2025-07-17T06:33:20.3604111Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.3605345Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.3606425Z  ) 2025-07-17T06:33:20.3607034Z  2025-07-17T06:33:20.3607776Z  username = get_potential_pr_author( 2025-07-17T06:33:20.3608975Z  args.github_token, 2025-07-17T06:33:20.3609842Z  args.github_repo, 2025-07-17T06:33:20.3610660Z  args.github_actor, 2025-07-17T06:33:20.3611503Z  args.github_ref_type, 2025-07-17T06:33:20.3612374Z  args.github_branch, 2025-07-17T06:33:20.3613207Z  ) 2025-07-17T06:33:20.3613820Z  2025-07-17T06:33:20.3614622Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.3615639Z  2025-07-17T06:33:20.3616348Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.3617316Z  rollout_state, 2025-07-17T06:33:20.3618374Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.3619301Z  args.github_branch, 2025-07-17T06:33:20.3620475Z  args.eligible_experiments, 2025-07-17T06:33:20.3621400Z  args.opt_out_experiments, 2025-07-17T06:33:20.3622260Z  is_canary, 2025-07-17T06:33:20.3622971Z  ) 2025-07-17T06:33:20.3623604Z  2025-07-17T06:33:20.3624235Z  except Exception as e: 2025-07-17T06:33:20.3625026Z  log.error( 2025-07-17T06:33:20.3626193Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.3627494Z  ) 2025-07-17T06:33:20.3628335Z  2025-07-17T06:33:20.3629246Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3630351Z  2025-07-17T06:33:20.3630917Z  2025-07-17T06:33:20.3631535Z if __name__ == "__main__": 2025-07-17T06:33:20.3632305Z  main() 2025-07-17T06:33:20.3632932Z  2025-07-17T06:33:20.3633473Z EOF 2025-07-17T06:33:20.3634065Z  2025-07-17T06:33:20.3634685Z cat runner_determinator.py 2025-07-17T06:33:20.3897577Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.3899096Z env: 2025-07-17T06:33:20.3900081Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.3900722Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.3901436Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.3902250Z ISSUE_OWNER: 2025-07-17T06:33:20.3902875Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.3903539Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.3904192Z PR_NUMBER: 2025-07-17T06:33:20.3904775Z ##[endgroup] 2025-07-17T06:33:20.4194471Z # flake8: noqa: G004 2025-07-17T06:33:20.4194980Z 2025-07-17T06:33:20.4195661Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.4197238Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.4199371Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.4200163Z 2025-07-17T06:33:20.4200418Z """ 2025-07-17T06:33:20.4201345Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.4202779Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.4204274Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.4205621Z of which runners should be used to run which job. 2025-07-17T06:33:20.4206291Z 2025-07-17T06:33:20.4206922Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.4208913Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.4210474Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.4211667Z list, defined. 2025-07-17T06:33:20.4212223Z 2025-07-17T06:33:20.4213039Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.4214861Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.4216340Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.4217123Z 2025-07-17T06:33:20.4217769Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.4219497Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.4220735Z experiments which the user could be opted in to. 2025-07-17T06:33:20.4221412Z 2025-07-17T06:33:20.4221727Z The user list has the following rules: 2025-07-17T06:33:20.4222301Z 2025-07-17T06:33:20.4222813Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.4224212Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.4225466Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.4226128Z 2025-07-17T06:33:20.4226403Z Example config: 2025-07-17T06:33:20.4227131Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.4229191Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.4230278Z # Expected syntax is: 2025-07-17T06:33:20.4231336Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.4233026Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.4234126Z 2025-07-17T06:33:20.4234432Z experiments: 2025-07-17T06:33:20.4235103Z lf: 2025-07-17T06:33:20.4235735Z rollout_percent: 25 2025-07-17T06:33:20.4236524Z all_branches: false 2025-07-17T06:33:20.4237290Z default: true 2025-07-17T06:33:20.4237984Z --- 2025-07-17T06:33:20.4238568Z 2025-07-17T06:33:20.4238857Z # Opt-ins: 2025-07-17T06:33:20.4239842Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.4241404Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.4242735Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.4243924Z # Experiments should be from the above list. 2025-07-17T06:33:20.4244589Z 2025-07-17T06:33:20.4244904Z @User1,-lf,split_build 2025-07-17T06:33:20.4245665Z @User2,lf 2025-07-17T06:33:20.4246288Z @User3,split_build 2025-07-17T06:33:20.4246981Z """ 2025-07-17T06:33:20.4247298Z 2025-07-17T06:33:20.4247592Z import json 2025-07-17T06:33:20.4248456Z import logging 2025-07-17T06:33:20.4249142Z import os 2025-07-17T06:33:20.4249735Z import random 2025-07-17T06:33:20.4250366Z import re 2025-07-17T06:33:20.4250937Z import sys 2025-07-17T06:33:20.4251667Z from argparse import ArgumentParser 2025-07-17T06:33:20.4252542Z from collections.abc import Iterable 2025-07-17T06:33:20.4253431Z from functools import cache 2025-07-17T06:33:20.4254246Z from logging import LogRecord 2025-07-17T06:33:20.4255116Z from typing import Any, NamedTuple 2025-07-17T06:33:20.4256041Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.4256702Z 2025-07-17T06:33:20.4256978Z import yaml 2025-07-17T06:33:20.4257670Z from github import Auth, Github 2025-07-17T06:33:20.4258735Z from github.Issue import Issue 2025-07-17T06:33:20.4259272Z 2025-07-17T06:33:20.4259283Z 2025-07-17T06:33:20.4259668Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.4260832Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.4262355Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.4263330Z 2025-07-17T06:33:20.4263709Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.4264914Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.4265803Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.4266727Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.4267332Z 2025-07-17T06:33:20.4267684Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.4268516Z 2025-07-17T06:33:20.4268855Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.4269710Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.4270206Z 2025-07-17T06:33:20.4270216Z 2025-07-17T06:33:20.4270518Z class Experiment(NamedTuple): 2025-07-17T06:33:20.4271315Z rollout_perc: float = ( 2025-07-17T06:33:20.4272362Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.4273497Z ) 2025-07-17T06:33:20.4274154Z all_branches: bool = ( 2025-07-17T06:33:20.4275229Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.4276414Z ) 2025-07-17T06:33:20.4277036Z default: bool = ( 2025-07-17T06:33:20.4278019Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.4279376Z ) 2025-07-17T06:33:20.4279724Z 2025-07-17T06:33:20.4280016Z # Add more fields as needed 2025-07-17T06:33:20.4280521Z 2025-07-17T06:33:20.4280532Z 2025-07-17T06:33:20.4280840Z class Settings(NamedTuple): 2025-07-17T06:33:20.4281543Z """ 2025-07-17T06:33:20.4282557Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.4283512Z """ 2025-07-17T06:33:20.4283862Z 2025-07-17T06:33:20.4284222Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.4284853Z 2025-07-17T06:33:20.4284863Z 2025-07-17T06:33:20.4285225Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.4286289Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.4287031Z 2025-07-17T06:33:20.4287319Z COLORS = { 2025-07-17T06:33:20.4288000Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.4289129Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.4289969Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.4290808Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.4291624Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.4292406Z } 2025-07-17T06:33:20.4292747Z 2025-07-17T06:33:20.4293136Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.4294357Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.4295177Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.4295728Z return super().format(record) 2025-07-17T06:33:20.4296053Z 2025-07-17T06:33:20.4296059Z 2025-07-17T06:33:20.4296238Z handler = logging.StreamHandler() 2025-07-17T06:33:20.4296920Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.4297461Z 2025-07-17T06:33:20.4297685Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.4298508Z log.addHandler(handler) 2025-07-17T06:33:20.4298968Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.4299240Z 2025-07-17T06:33:20.4299246Z 2025-07-17T06:33:20.4299482Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.4300007Z """ 2025-07-17T06:33:20.4300480Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.4301058Z """ 2025-07-17T06:33:20.4301397Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.4302418Z # 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.4303476Z log.warning( 2025-07-17T06:33:20.4304265Z "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.4305128Z ) 2025-07-17T06:33:20.4315415Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.4315986Z return 2025-07-17T06:33:20.4316258Z 2025-07-17T06:33:20.4316630Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.4317192Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.4317739Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.4318047Z 2025-07-17T06:33:20.4318054Z 2025-07-17T06:33:20.4318579Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.4319189Z return frozenset( 2025-07-17T06:33:20.4319781Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.4320422Z ) 2025-07-17T06:33:20.4320613Z 2025-07-17T06:33:20.4320620Z 2025-07-17T06:33:20.4320802Z def parse_args() -> Any: 2025-07-17T06:33:20.4321321Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.4322114Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.4322844Z parser.add_argument( 2025-07-17T06:33:20.4323266Z "--github-issue-repo", 2025-07-17T06:33:20.4323699Z type=str, 2025-07-17T06:33:20.4324070Z required=False, 2025-07-17T06:33:20.4324495Z default="pytorch/test-infra", 2025-07-17T06:33:20.4324994Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.4325466Z ) 2025-07-17T06:33:20.4325799Z parser.add_argument( 2025-07-17T06:33:20.4326217Z "--github-repo", 2025-07-17T06:33:20.4326617Z type=str, 2025-07-17T06:33:20.4326982Z required=True, 2025-07-17T06:33:20.4327555Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.4328041Z ) 2025-07-17T06:33:20.4328607Z parser.add_argument( 2025-07-17T06:33:20.4329184Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.4329811Z ) 2025-07-17T06:33:20.4330140Z parser.add_argument( 2025-07-17T06:33:20.4330717Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.4331347Z ) 2025-07-17T06:33:20.4331683Z parser.add_argument( 2025-07-17T06:33:20.4332279Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.4332920Z ) 2025-07-17T06:33:20.4333255Z parser.add_argument( 2025-07-17T06:33:20.4333857Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.4334521Z ) 2025-07-17T06:33:20.4334845Z parser.add_argument( 2025-07-17T06:33:20.4335258Z "--github-ref-type", 2025-07-17T06:33:20.4335679Z type=str, 2025-07-17T06:33:20.4336043Z required=True, 2025-07-17T06:33:20.4336492Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.4337001Z ) 2025-07-17T06:33:20.4337339Z parser.add_argument( 2025-07-17T06:33:20.4337751Z "--eligible-experiments", 2025-07-17T06:33:20.4338445Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4338941Z required=False, 2025-07-17T06:33:20.4339328Z default="", 2025-07-17T06:33:20.4340127Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.4341003Z ) 2025-07-17T06:33:20.4341334Z parser.add_argument( 2025-07-17T06:33:20.4341761Z "--opt-out-experiments", 2025-07-17T06:33:20.4342268Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4342746Z required=False, 2025-07-17T06:33:20.4343132Z default="", 2025-07-17T06:33:20.4343494Z help=( 2025-07-17T06:33:20.4344116Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.4345174Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.4345958Z ), 2025-07-17T06:33:20.4346280Z ) 2025-07-17T06:33:20.4346619Z parser.add_argument( 2025-07-17T06:33:20.4347020Z "--pr-number", 2025-07-17T06:33:20.4347401Z type=str, 2025-07-17T06:33:20.4347769Z required=False, 2025-07-17T06:33:20.4348350Z default="", 2025-07-17T06:33:20.4348975Z help="the optional PR number where this is run", 2025-07-17T06:33:20.4349504Z ) 2025-07-17T06:33:20.4349699Z 2025-07-17T06:33:20.4349877Z return parser.parse_args() 2025-07-17T06:33:20.4350168Z 2025-07-17T06:33:20.4350175Z 2025-07-17T06:33:20.4350551Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4351311Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.4351790Z return Github(auth=auth) 2025-07-17T06:33:20.4352072Z 2025-07-17T06:33:20.4352079Z 2025-07-17T06:33:20.4352501Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4353262Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.4353723Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.4354072Z 2025-07-17T06:33:20.4354078Z 2025-07-17T06:33:20.4354247Z def get_potential_pr_author( 2025-07-17T06:33:20.4354854Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.4355476Z ) -> str: 2025-07-17T06:33:20.4355949Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.4356696Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.4357383Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.4357775Z 2025-07-17T06:33:20.4358086Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4358562Z 2025-07-17T06:33:20.4358807Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.4359397Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.4359856Z if ( 2025-07-17T06:33:20.4360213Z len(split_tag) == 3 2025-07-17T06:33:20.4360658Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.4361145Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.4361598Z ): 2025-07-17T06:33:20.4361951Z pr_number = split_tag[2] 2025-07-17T06:33:20.4362389Z try: 2025-07-17T06:33:20.4362788Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.4363352Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.4363912Z except Exception as e: 2025-07-17T06:33:20.4364394Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.4365023Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.4365639Z ) from e 2025-07-17T06:33:20.4366127Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.4366769Z # In all other cases, return the original input username 2025-07-17T06:33:20.4367309Z return username 2025-07-17T06:33:20.4367543Z 2025-07-17T06:33:20.4367549Z 2025-07-17T06:33:20.4367754Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.4368386Z """ 2025-07-17T06:33:20.4368978Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.4369707Z """ 2025-07-17T06:33:20.4370208Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.4370706Z 2025-07-17T06:33:20.4370713Z 2025-07-17T06:33:20.4370899Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.4371352Z try: 2025-07-17T06:33:20.4371706Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.4372182Z return data 2025-07-17T06:33:20.4372563Z except yaml.YAMLError: 2025-07-17T06:33:20.4373011Z log.exception("Error loading YAML") 2025-07-17T06:33:20.4373484Z raise 2025-07-17T06:33:20.4373687Z 2025-07-17T06:33:20.4373693Z 2025-07-17T06:33:20.4374080Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.4374755Z """ 2025-07-17T06:33:20.4375324Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.4375886Z 2025-07-17T06:33:20.4376335Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4377059Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4377444Z 2025-07-17T06:33:20.4377793Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.4378580Z """ 2025-07-17T06:33:20.4378987Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.4427979Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.4429260Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.4430256Z else: 2025-07-17T06:33:20.4430641Z return "", rollout_state 2025-07-17T06:33:20.4430943Z 2025-07-17T06:33:20.4430952Z 2025-07-17T06:33:20.4431152Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.4431633Z """ 2025-07-17T06:33:20.4432128Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.4432730Z """ 2025-07-17T06:33:20.4432919Z 2025-07-17T06:33:20.4432932Z 2025-07-17T06:33:20.4433270Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.4433888Z """ 2025-07-17T06:33:20.4434551Z 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.4435195Z 2025-07-17T06:33:20.4435782Z 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.4436910Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.4437545Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.4437996Z 2025-07-17T06:33:20.4438003Z 2025-07-17T06:33:20.4438346Z """ 2025-07-17T06:33:20.4438723Z optins = UserOptins() 2025-07-17T06:33:20.4439169Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.4439686Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.4440187Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.4440707Z # Not a valid user. Skip 2025-07-17T06:33:20.4441161Z continue 2025-07-17T06:33:20.4441387Z 2025-07-17T06:33:20.4441534Z if user: 2025-07-17T06:33:20.4441939Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.4442590Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.4443052Z 2025-07-17T06:33:20.4443212Z return optins 2025-07-17T06:33:20.4443429Z 2025-07-17T06:33:20.4443436Z 2025-07-17T06:33:20.4443707Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.4444256Z """ 2025-07-17T06:33:20.4444618Z Check if the experiment name is valid. 2025-07-17T06:33:20.4445098Z A valid name: 2025-07-17T06:33:20.4445689Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.4446556Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.4447218Z - Cannot contain spaces 2025-07-17T06:33:20.4447642Z """ 2025-07-17T06:33:20.4447829Z 2025-07-17T06:33:20.4448067Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.4448910Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.4449324Z 2025-07-17T06:33:20.4449473Z if valid: 2025-07-17T06:33:20.4449825Z return True 2025-07-17T06:33:20.4450045Z 2025-07-17T06:33:20.4450193Z log.error( 2025-07-17T06:33:20.4451592Z 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.4453113Z ) 2025-07-17T06:33:20.4453436Z return False 2025-07-17T06:33:20.4453656Z 2025-07-17T06:33:20.4453662Z 2025-07-17T06:33:20.4453943Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.4454513Z """ 2025-07-17T06:33:20.4455197Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.4455878Z """ 2025-07-17T06:33:20.4456192Z try: 2025-07-17T06:33:20.4456538Z if settings_text: 2025-07-17T06:33:20.4457200Z # 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.4457937Z # for easy reading 2025-07-17T06:33:20.4458859Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.4459682Z # the backtick character in shell commands. 2025-07-17T06:33:20.4460245Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.4460851Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.4461457Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.4461794Z 2025-07-17T06:33:20.4462175Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.4462872Z experiments = {} 2025-07-17T06:33:20.4463139Z 2025-07-17T06:33:20.4463469Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.4464173Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.4465202Z # 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.4466297Z continue 2025-07-17T06:33:20.4466564Z 2025-07-17T06:33:20.4466729Z valid_settings = {} 2025-07-17T06:33:20.4467209Z for setting in exp_settings: 2025-07-17T06:33:20.4467732Z if setting not in Experiment._fields: 2025-07-17T06:33:20.4468474Z log.warning( 2025-07-17T06:33:20.4469130Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.4469803Z ) 2025-07-17T06:33:20.4470192Z else: 2025-07-17T06:33:20.4470662Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.4471055Z 2025-07-17T06:33:20.4471304Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.4471883Z return Settings(experiments) 2025-07-17T06:33:20.4472210Z 2025-07-17T06:33:20.4472536Z except Exception: 2025-07-17T06:33:20.4472968Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.4473328Z 2025-07-17T06:33:20.4473486Z return Settings() 2025-07-17T06:33:20.4473717Z 2025-07-17T06:33:20.4473723Z 2025-07-17T06:33:20.4473952Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.4474474Z """ 2025-07-17T06:33:20.4474867Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.4475245Z 2025-07-17T06:33:20.4475566Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4476273Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4476648Z 2025-07-17T06:33:20.4477019Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.4477696Z """ 2025-07-17T06:33:20.4478404Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4479126Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.4479492Z 2025-07-17T06:33:20.4479498Z 2025-07-17T06:33:20.4479729Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.4480265Z """ 2025-07-17T06:33:20.4480623Z Parse users from the rollout state. 2025-07-17T06:33:20.4480947Z 2025-07-17T06:33:20.4481088Z """ 2025-07-17T06:33:20.4481577Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4482244Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.4482616Z 2025-07-17T06:33:20.4482623Z 2025-07-17T06:33:20.4483145Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4483839Z """ 2025-07-17T06:33:20.4484209Z Check if a user is opted into an experiment 2025-07-17T06:33:20.4484700Z """ 2025-07-17T06:33:20.4485100Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.4485483Z 2025-07-17T06:33:20.4485506Z 2025-07-17T06:33:20.4485888Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4486569Z """ 2025-07-17T06:33:20.4486987Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.4487514Z """ 2025-07-17T06:33:20.4487978Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.4488795Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.4489376Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.4489925Z return False 2025-07-17T06:33:20.4490152Z 2025-07-17T06:33:20.4490406Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.4490959Z log.warning( 2025-07-17T06:33:20.4491678Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.4492474Z ) 2025-07-17T06:33:20.4492657Z 2025-07-17T06:33:20.4492813Z return True 2025-07-17T06:33:20.4493167Z 2025-07-17T06:33:20.4493174Z 2025-07-17T06:33:20.4493334Z def get_runner_prefix( 2025-07-17T06:33:20.4493731Z rollout_state: str, 2025-07-17T06:33:20.4494141Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.4494611Z branch: str, 2025-07-17T06:33:20.4495045Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4495651Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4496185Z is_canary: bool = False, 2025-07-17T06:33:20.4496600Z ) -> str: 2025-07-17T06:33:20.4496978Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.4497513Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.4497841Z 2025-07-17T06:33:20.4498005Z fleet_prefix = "" 2025-07-17T06:33:20.4498557Z prefixes = [] 2025-07-17T06:33:20.4499208Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.4500067Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.4500722Z log.info( 2025-07-17T06:33:20.4501346Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.4502035Z ) 2025-07-17T06:33:20.4502380Z continue 2025-07-17T06:33:20.4502606Z 2025-07-17T06:33:20.4502772Z if opt_out_experiments: 2025-07-17T06:33:20.4503261Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.4503840Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.4504375Z log.info( 2025-07-17T06:33:20.4505219Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.4506118Z ) 2025-07-17T06:33:20.4506476Z continue 2025-07-17T06:33:20.4506719Z 2025-07-17T06:33:20.4506888Z if eligible_experiments: 2025-07-17T06:33:20.4507389Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.4507984Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.4508717Z log.info( 2025-07-17T06:33:20.4509430Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.4510201Z ) 2025-07-17T06:33:20.4510558Z continue 2025-07-17T06:33:20.4510981Z elif not experiment_settings.default: 2025-07-17T06:33:20.4511468Z log.info( 2025-07-17T06:33:20.4512192Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.4512878Z ) 2025-07-17T06:33:20.4513215Z continue 2025-07-17T06:33:20.4513445Z 2025-07-17T06:33:20.4513696Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.4514264Z opted_out_users = [ 2025-07-17T06:33:20.4514670Z requestor 2025-07-17T06:33:20.4515084Z for requestor in workflow_requestors 2025-07-17T06:33:20.4515692Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4516267Z ] 2025-07-17T06:33:20.4516449Z 2025-07-17T06:33:20.4516607Z if opted_out_users: 2025-07-17T06:33:20.4517009Z log.info( 2025-07-17T06:33:20.4517564Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.4518781Z ) 2025-07-17T06:33:20.4519176Z continue 2025-07-17T06:33:20.4519405Z 2025-07-17T06:33:20.4519661Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.4520225Z opted_in_users = [ 2025-07-17T06:33:20.4520624Z requestor 2025-07-17T06:33:20.4521035Z for requestor in workflow_requestors 2025-07-17T06:33:20.4521628Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4522195Z ] 2025-07-17T06:33:20.4522538Z 2025-07-17T06:33:20.4522695Z enabled = False 2025-07-17T06:33:20.4523093Z if opted_in_users: 2025-07-17T06:33:20.4523484Z log.info( 2025-07-17T06:33:20.4524034Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.4524654Z ) 2025-07-17T06:33:20.4525003Z enabled = True 2025-07-17T06:33:20.4525254Z 2025-07-17T06:33:20.4525452Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.4526215Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.4527079Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.4527671Z log.info( 2025-07-17T06:33:20.4528667Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.4529518Z ) 2025-07-17T06:33:20.4529891Z enabled = True 2025-07-17T06:33:20.4530164Z 2025-07-17T06:33:20.4530320Z if enabled: 2025-07-17T06:33:20.4530699Z label = experiment_name 2025-07-17T06:33:20.4531204Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.4531959Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.4532757Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.4533446Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.4534041Z if is_canary: 2025-07-17T06:33:20.4534489Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.4534976Z fleet_prefix = label 2025-07-17T06:33:20.4535427Z else: 2025-07-17T06:33:20.4535806Z prefixes.append(label) 2025-07-17T06:33:20.4536127Z 2025-07-17T06:33:20.4536289Z if len(prefixes) > 1: 2025-07-17T06:33:20.4536692Z log.error( 2025-07-17T06:33:20.4537637Z 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.4538862Z ) 2025-07-17T06:33:20.4539211Z prefixes = prefixes[:1] 2025-07-17T06:33:20.4539507Z 2025-07-17T06:33:20.4539679Z # Fleet always comes first 2025-07-17T06:33:20.4540098Z if fleet_prefix: 2025-07-17T06:33:20.4540504Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.4540829Z 2025-07-17T06:33:20.4541192Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.4541575Z 2025-07-17T06:33:20.4541580Z 2025-07-17T06:33:20.4541987Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.4542698Z """ 2025-07-17T06:33:20.4543232Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.4543753Z 2025-07-17T06:33:20.4544103Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.4544763Z """ 2025-07-17T06:33:20.4545114Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4545603Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.4546179Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.4546582Z 2025-07-17T06:33:20.4546597Z 2025-07-17T06:33:20.4546961Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.4547645Z for _ in range(num_retries): 2025-07-17T06:33:20.4548081Z try: 2025-07-17T06:33:20.4548688Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.4549293Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.4549872Z return json.loads(content) 2025-07-17T06:33:20.4550343Z except Exception as e: 2025-07-17T06:33:20.4550841Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.4551424Z 2025-07-17T06:33:20.4551765Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.4552415Z return {} 2025-07-17T06:33:20.4552609Z 2025-07-17T06:33:20.4552617Z 2025-07-17T06:33:20.4552762Z @cache 2025-07-17T06:33:20.4553320Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.4554005Z """ 2025-07-17T06:33:20.4554354Z Dynamically get PR information 2025-07-17T06:33:20.4554794Z """ 2025-07-17T06:33:20.4555240Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.4555810Z headers = { 2025-07-17T06:33:20.4556213Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.4556762Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.4557238Z } 2025-07-17T06:33:20.4557623Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.4558360Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.4558877Z headers=headers, 2025-07-17T06:33:20.4559269Z ) 2025-07-17T06:33:20.4559446Z 2025-07-17T06:33:20.4559607Z if not json_response: 2025-07-17T06:33:20.4560123Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.4560676Z return {} 2025-07-17T06:33:20.4560892Z 2025-07-17T06:33:20.4561055Z return json_response 2025-07-17T06:33:20.4561302Z 2025-07-17T06:33:20.4561307Z 2025-07-17T06:33:20.4561677Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.4562346Z """ 2025-07-17T06:33:20.4562819Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.4563404Z """ 2025-07-17T06:33:20.4563833Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.4564382Z return { 2025-07-17T06:33:20.4564901Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.4565542Z } 2025-07-17T06:33:20.4565726Z 2025-07-17T06:33:20.4565732Z 2025-07-17T06:33:20.4565889Z def main() -> None: 2025-07-17T06:33:20.4566266Z args = parse_args() 2025-07-17T06:33:20.4566510Z 2025-07-17T06:33:20.4566706Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.4567054Z 2025-07-17T06:33:20.4567234Z # Check if the PR is opt-out 2025-07-17T06:33:20.4567673Z if args.pr_number: 2025-07-17T06:33:20.4568423Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.4569248Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.4569714Z log.info( 2025-07-17T06:33:20.4570345Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.4571037Z ) 2025-07-17T06:33:20.4571529Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4572141Z sys.exit() 2025-07-17T06:33:20.4572393Z 2025-07-17T06:33:20.4572536Z try: 2025-07-17T06:33:20.4572919Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.4573557Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.4574134Z ) 2025-07-17T06:33:20.4574324Z 2025-07-17T06:33:20.4574506Z username = get_potential_pr_author( 2025-07-17T06:33:20.4574999Z args.github_token, 2025-07-17T06:33:20.4575424Z args.github_repo, 2025-07-17T06:33:20.4575854Z args.github_actor, 2025-07-17T06:33:20.4576280Z args.github_ref_type, 2025-07-17T06:33:20.4576730Z args.github_branch, 2025-07-17T06:33:20.4577134Z ) 2025-07-17T06:33:20.4577320Z 2025-07-17T06:33:20.4577573Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.4577978Z 2025-07-17T06:33:20.4578387Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.4578914Z rollout_state, 2025-07-17T06:33:20.4579498Z (args.github_issue_owner, username), 2025-07-17T06:33:20.4579985Z args.github_branch, 2025-07-17T06:33:20.4580432Z args.eligible_experiments, 2025-07-17T06:33:20.4580914Z args.opt_out_experiments, 2025-07-17T06:33:20.4581367Z is_canary, 2025-07-17T06:33:20.4581730Z ) 2025-07-17T06:33:20.4581915Z 2025-07-17T06:33:20.4582082Z except Exception as e: 2025-07-17T06:33:20.4582483Z log.error( 2025-07-17T06:33:20.4583090Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.4583794Z ) 2025-07-17T06:33:20.4583976Z 2025-07-17T06:33:20.4584269Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4584722Z 2025-07-17T06:33:20.4584735Z 2025-07-17T06:33:20.4584899Z if __name__ == "__main__": 2025-07-17T06:33:20.4585280Z main() 2025-07-17T06:33:20.4585471Z 2025-07-17T06:33:20.4675417Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4676244Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4704369Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.4704800Z env: 2025-07-17T06:33:20.4705377Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.4705755Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.4706158Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.4706610Z ISSUE_OWNER: 2025-07-17T06:33:20.4706973Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.4707357Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.4707741Z PR_NUMBER: 2025-07-17T06:33:20.4708079Z ##[endgroup] 2025-07-17T06:33:20.8369646Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.2442494Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.2768432Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.2970190Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-07-17T06:33:21.3359377Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.3453732Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.3874068Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.3899957Z 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.3945130Z 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.3961939Z 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.3976573Z 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.4216025Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.4246933Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.4473431Z 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.5540564Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.5569700Z 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.6582475Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.6613835Z 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.6785297Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.6811219Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.7043196Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.7100878Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 34.5 MB/s eta 0:00:00 2025-07-17T06:33:21.7128904Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.7191245Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 79.5 MB/s eta 0:00:00 2025-07-17T06:33:21.7224074Z 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.7313398Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 125.9 MB/s eta 0:00:00 2025-07-17T06:33:21.7339540Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.7384678Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.7471923Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 66.5 MB/s eta 0:00:00 2025-07-17T06:33:21.7502659Z 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.7543065Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 32.0 MB/s eta 0:00:00 2025-07-17T06:33:21.7570945Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.7623216Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.8 MB/s eta 0:00:00 2025-07-17T06:33:22.0626726Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.5944027Z 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.6709536Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.6709907Z curr_branch="main" 2025-07-17T06:33:22.6710226Z curr_ref_type="branch" 2025-07-17T06:33:22.6710537Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.6710832Z  2025-07-17T06:33:22.6711074Z python3 runner_determinator.py \ 2025-07-17T06:33:22.6711397Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.6711713Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.6712016Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.6712357Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.6712684Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.6713001Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.6713329Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.6713681Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.6714118Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.6714445Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.6743517Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.6743790Z env: 2025-07-17T06:33:22.6744349Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.6744578Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.6744823Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.6745095Z ISSUE_OWNER: 2025-07-17T06:33:22.6745327Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.6745555Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.6745796Z PR_NUMBER: 2025-07-17T06:33:22.6746001Z ##[endgroup] 2025-07-17T06:33:22.6793301Z Current branch is 'main' 2025-07-17T06:33:24.2625297Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.2626891Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.2628821Z INFO : Setting output: label-type='' 2025-07-17T06:33:24.2940755Z Evaluate and set job outputs 2025-07-17T06:33:24.2947790Z Cleaning up orphan processes