2025-07-17T06:33:20.2031858Z Current runner version: '2.326.0' 2025-07-17T06:33:20.2056881Z ##[group]Runner Image Provisioner 2025-07-17T06:33:20.2057834Z Hosted Compute Agent 2025-07-17T06:33:20.2058346Z Version: 20250711.363 2025-07-17T06:33:20.2058908Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:20.2059660Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:20.2060209Z ##[endgroup] 2025-07-17T06:33:20.2060779Z ##[group]Operating System 2025-07-17T06:33:20.2061370Z Ubuntu 2025-07-17T06:33:20.2061839Z 24.04.2 2025-07-17T06:33:20.2062258Z LTS 2025-07-17T06:33:20.2062756Z ##[endgroup] 2025-07-17T06:33:20.2063208Z ##[group]Runner Image 2025-07-17T06:33:20.2063789Z Image: ubuntu-24.04 2025-07-17T06:33:20.2064334Z Version: 20250710.1.0 2025-07-17T06:33:20.2065452Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:20.2066936Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:20.2067969Z ##[endgroup] 2025-07-17T06:33:20.2069098Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:20.2071088Z Contents: read 2025-07-17T06:33:20.2071589Z Metadata: read 2025-07-17T06:33:20.2072161Z Packages: read 2025-07-17T06:33:20.2072638Z ##[endgroup] 2025-07-17T06:33:20.2075301Z Secret source: Actions 2025-07-17T06:33:20.2076194Z Prepare workflow directory 2025-07-17T06:33:20.2589017Z Prepare all required actions 2025-07-17T06:33:20.2650131Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:20.2655711Z ##[group] Inputs 2025-07-17T06:33:20.2656348Z check_experiments: 2025-07-17T06:33:20.2656987Z opt_out_experiments: 2025-07-17T06:33:20.2657548Z triggering_actor: pytorchmergebot 2025-07-17T06:33:20.2658195Z issue_owner: 2025-07-17T06:33:20.2658648Z curr_branch: main 2025-07-17T06:33:20.2659420Z curr_ref_type: branch 2025-07-17T06:33:20.2659965Z issue_number: 5132 2025-07-17T06:33:20.2660462Z ##[endgroup] 2025-07-17T06:33:20.2661154Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.3243418Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.3246354Z cat < runner_determinator.py 2025-07-17T06:33:20.3247044Z # flake8: noqa: G004 2025-07-17T06:33:20.3247598Z  2025-07-17T06:33:20.3248361Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.3249445Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.3250370Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.3251097Z  2025-07-17T06:33:20.3251507Z """ 2025-07-17T06:33:20.3252237Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.3253219Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.3254425Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.3255559Z of which runners should be used to run which job. 2025-07-17T06:33:20.3256231Z  2025-07-17T06:33:20.3256913Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.3257971Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.3258970Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.3260078Z list, defined. 2025-07-17T06:33:20.3261004Z  2025-07-17T06:33:20.3261872Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.3262879Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.3263925Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.3265030Z  2025-07-17T06:33:20.3265729Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.3266814Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.3267653Z experiments which the user could be opted in to. 2025-07-17T06:33:20.3268314Z  2025-07-17T06:33:20.3268805Z The user list has the following rules: 2025-07-17T06:33:20.3269467Z  2025-07-17T06:33:20.3270054Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.3271047Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.3271958Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.3272577Z  2025-07-17T06:33:20.3273071Z Example config: 2025-07-17T06:33:20.3273694Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.3274498Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.3275588Z  # Expected syntax is: 2025-07-17T06:33:20.3276372Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.3277461Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.3278248Z  2025-07-17T06:33:20.3278802Z  experiments: 2025-07-17T06:33:20.3279280Z  lf: 2025-07-17T06:33:20.3279798Z  rollout_percent: 25 2025-07-17T06:33:20.3280463Z  all_branches: false 2025-07-17T06:33:20.3281012Z  default: true 2025-07-17T06:33:20.3281538Z  --- 2025-07-17T06:33:20.3282058Z  2025-07-17T06:33:20.3282507Z  # Opt-ins: 2025-07-17T06:33:20.3283214Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.3284494Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.3285762Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.3286519Z  # Experiments should be from the above list. 2025-07-17T06:33:20.3287350Z  2025-07-17T06:33:20.3287781Z  @User1,-lf,split_build 2025-07-17T06:33:20.3288367Z  @User2,lf 2025-07-17T06:33:20.3288904Z  @User3,split_build 2025-07-17T06:33:20.3289479Z """ 2025-07-17T06:33:20.3289939Z  2025-07-17T06:33:20.3290432Z import json 2025-07-17T06:33:20.3290967Z import logging 2025-07-17T06:33:20.3291571Z import os 2025-07-17T06:33:20.3292086Z import random 2025-07-17T06:33:20.3292621Z import re 2025-07-17T06:33:20.3293076Z import sys 2025-07-17T06:33:20.3293691Z from argparse import ArgumentParser 2025-07-17T06:33:20.3294363Z from collections.abc import Iterable 2025-07-17T06:33:20.3295154Z from functools import cache 2025-07-17T06:33:20.3295720Z from logging import LogRecord 2025-07-17T06:33:20.3296425Z from typing import Any, NamedTuple 2025-07-17T06:33:20.3297119Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.3297792Z  2025-07-17T06:33:20.3298261Z import yaml 2025-07-17T06:33:20.3298756Z from github import Auth, Github 2025-07-17T06:33:20.3299419Z from github.Issue import Issue 2025-07-17T06:33:20.3299979Z  2025-07-17T06:33:20.3300413Z  2025-07-17T06:33:20.3301013Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.3301816Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.3302796Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.3303734Z  2025-07-17T06:33:20.3304353Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.3305134Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.3305814Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.3306584Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.3307168Z  2025-07-17T06:33:20.3307675Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.3308314Z  2025-07-17T06:33:20.3308810Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.3309400Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.3310013Z  2025-07-17T06:33:20.3310465Z  2025-07-17T06:33:20.3310903Z class Experiment(NamedTuple): 2025-07-17T06:33:20.3311565Z  rollout_perc: float = ( 2025-07-17T06:33:20.3312319Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.3313126Z  ) 2025-07-17T06:33:20.3313709Z  all_branches: bool = ( 2025-07-17T06:33:20.3314534Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.3315637Z  ) 2025-07-17T06:33:20.3316170Z  default: bool = ( 2025-07-17T06:33:20.3316912Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.3317656Z  ) 2025-07-17T06:33:20.3318162Z  2025-07-17T06:33:20.3318619Z  # Add more fields as needed 2025-07-17T06:33:20.3319193Z  2025-07-17T06:33:20.3319657Z  2025-07-17T06:33:20.3320109Z class Settings(NamedTuple): 2025-07-17T06:33:20.3320712Z  """ 2025-07-17T06:33:20.3321258Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.3322008Z  """ 2025-07-17T06:33:20.3322432Z  2025-07-17T06:33:20.3322932Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.3323637Z  2025-07-17T06:33:20.3324230Z  2025-07-17T06:33:20.3325144Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.3326061Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.3326806Z  2025-07-17T06:33:20.3327222Z  COLORS = { 2025-07-17T06:33:20.3327881Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.3328479Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.3329081Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.3329779Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.3330365Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.3330937Z  } 2025-07-17T06:33:20.3331422Z  2025-07-17T06:33:20.3331983Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.3332814Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.3333766Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.3334459Z  return super().format(record) 2025-07-17T06:33:20.3335143Z  2025-07-17T06:33:20.3335662Z  2025-07-17T06:33:20.3336117Z handler = logging.StreamHandler() 2025-07-17T06:33:20.3336948Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.3337944Z  2025-07-17T06:33:20.3338493Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.3339199Z log.addHandler(handler) 2025-07-17T06:33:20.3339819Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.3340440Z  2025-07-17T06:33:20.3340833Z  2025-07-17T06:33:20.3341462Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.3342139Z  """ 2025-07-17T06:33:20.3342740Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.3343733Z  """ 2025-07-17T06:33:20.3344194Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.3345521Z  # 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.3346780Z  log.warning( 2025-07-17T06:33:20.3347835Z  "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.3348887Z  ) 2025-07-17T06:33:20.3349531Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.3350252Z  return 2025-07-17T06:33:20.3350771Z  2025-07-17T06:33:20.3351367Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.3352128Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.3352832Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.3353565Z  2025-07-17T06:33:20.3354062Z  2025-07-17T06:33:20.3354733Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.3355809Z  return frozenset( 2025-07-17T06:33:20.3356591Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.3357370Z  ) 2025-07-17T06:33:20.3357865Z  2025-07-17T06:33:20.3358314Z  2025-07-17T06:33:20.3358738Z def parse_args() -> Any: 2025-07-17T06:33:20.3359500Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.3360437Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.3361303Z  parser.add_argument( 2025-07-17T06:33:20.3361978Z  "--github-issue-repo", 2025-07-17T06:33:20.3362539Z  type=str, 2025-07-17T06:33:20.3363095Z  required=False, 2025-07-17T06:33:20.3363851Z  default="pytorch/test-infra", 2025-07-17T06:33:20.3364562Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.3365399Z  ) 2025-07-17T06:33:20.3365971Z  parser.add_argument( 2025-07-17T06:33:20.3366563Z  "--github-repo", 2025-07-17T06:33:20.3367087Z  type=str, 2025-07-17T06:33:20.3367654Z  required=True, 2025-07-17T06:33:20.3368238Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.3368864Z  ) 2025-07-17T06:33:20.3369376Z  parser.add_argument( 2025-07-17T06:33:20.3370141Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.3370889Z  ) 2025-07-17T06:33:20.3371366Z  parser.add_argument( 2025-07-17T06:33:20.3372149Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.3372911Z  ) 2025-07-17T06:33:20.3373458Z  parser.add_argument( 2025-07-17T06:33:20.3374219Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.3375119Z  ) 2025-07-17T06:33:20.3375643Z  parser.add_argument( 2025-07-17T06:33:20.3376415Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.3377231Z  ) 2025-07-17T06:33:20.3377777Z  parser.add_argument( 2025-07-17T06:33:20.3378340Z  "--github-ref-type", 2025-07-17T06:33:20.3378924Z  type=str, 2025-07-17T06:33:20.3379491Z  required=True, 2025-07-17T06:33:20.3380111Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.3380757Z  ) 2025-07-17T06:33:20.3444459Z  parser.add_argument( 2025-07-17T06:33:20.3446383Z  "--eligible-experiments", 2025-07-17T06:33:20.3447381Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3448268Z  required=False, 2025-07-17T06:33:20.3449022Z  default="", 2025-07-17T06:33:20.3450015Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.3450931Z  ) 2025-07-17T06:33:20.3451326Z  parser.add_argument( 2025-07-17T06:33:20.3451819Z  "--opt-out-experiments", 2025-07-17T06:33:20.3452358Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3452874Z  required=False, 2025-07-17T06:33:20.3453321Z  default="", 2025-07-17T06:33:20.3453756Z  help=( 2025-07-17T06:33:20.3454498Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.3456069Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.3456904Z  ), 2025-07-17T06:33:20.3457292Z  ) 2025-07-17T06:33:20.3457670Z  parser.add_argument( 2025-07-17T06:33:20.3458147Z  "--pr-number", 2025-07-17T06:33:20.3458597Z  type=str, 2025-07-17T06:33:20.3459030Z  required=False, 2025-07-17T06:33:20.3459483Z  default="", 2025-07-17T06:33:20.3460007Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.3460560Z  ) 2025-07-17T06:33:20.3460915Z  2025-07-17T06:33:20.3461305Z  return parser.parse_args() 2025-07-17T06:33:20.3461792Z  2025-07-17T06:33:20.3462122Z  2025-07-17T06:33:20.3462713Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3463979Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.3464534Z  return Github(auth=auth) 2025-07-17T06:33:20.3465235Z  2025-07-17T06:33:20.3465585Z  2025-07-17T06:33:20.3466232Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3467022Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.3467554Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.3468121Z  2025-07-17T06:33:20.3468541Z  2025-07-17T06:33:20.3468939Z def get_potential_pr_author( 2025-07-17T06:33:20.3469717Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.3470494Z ) -> str: 2025-07-17T06:33:20.3471168Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.3472093Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.3473036Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.3473759Z  2025-07-17T06:33:20.3474347Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3475863Z  2025-07-17T06:33:20.3476550Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.3477494Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.3478300Z  if ( 2025-07-17T06:33:20.3478973Z  len(split_tag) == 3 2025-07-17T06:33:20.3479840Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.3480744Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.3481613Z  ): 2025-07-17T06:33:20.3482324Z  pr_number = split_tag[2] 2025-07-17T06:33:20.3483188Z  try: 2025-07-17T06:33:20.3483980Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.3485367Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.3486005Z  except Exception as e: 2025-07-17T06:33:20.3486556Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.3487231Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.3487866Z  ) from e 2025-07-17T06:33:20.3488453Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.3489180Z  # In all other cases, return the original input username 2025-07-17T06:33:20.3489774Z  return username 2025-07-17T06:33:20.3490201Z  2025-07-17T06:33:20.3490533Z  2025-07-17T06:33:20.3490955Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.3491479Z  """ 2025-07-17T06:33:20.3492147Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.3492911Z  """ 2025-07-17T06:33:20.3493480Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.3494128Z  2025-07-17T06:33:20.3494457Z  2025-07-17T06:33:20.3495097Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.3495676Z  try: 2025-07-17T06:33:20.3496088Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.3496595Z  return data 2025-07-17T06:33:20.3497049Z  except yaml.YAMLError: 2025-07-17T06:33:20.3497568Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.3498082Z  raise 2025-07-17T06:33:20.3498467Z  2025-07-17T06:33:20.3498804Z  2025-07-17T06:33:20.3499412Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.3500147Z  """ 2025-07-17T06:33:20.3500957Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.3501697Z  2025-07-17T06:33:20.3502242Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3503001Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3503545Z  2025-07-17T06:33:20.3504108Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.3505068Z  """ 2025-07-17T06:33:20.3505546Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.3506153Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.3506782Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.3507373Z  else: 2025-07-17T06:33:20.3507772Z  return "", rollout_state 2025-07-17T06:33:20.3508249Z  2025-07-17T06:33:20.3508576Z  2025-07-17T06:33:20.3508983Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.3509491Z  """ 2025-07-17T06:33:20.3510042Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.3510670Z  """ 2025-07-17T06:33:20.3511023Z  2025-07-17T06:33:20.3511337Z  2025-07-17T06:33:20.3511863Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.3512505Z  """ 2025-07-17T06:33:20.3513211Z  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.3514022Z  2025-07-17T06:33:20.3514901Z  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.3515886Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.3516710Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.3517323Z  2025-07-17T06:33:20.3517645Z  2025-07-17T06:33:20.3517965Z  """ 2025-07-17T06:33:20.3518340Z  optins = UserOptins() 2025-07-17T06:33:20.3518852Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.3519414Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.3519981Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.3520540Z  # Not a valid user. Skip 2025-07-17T06:33:20.3521036Z  continue 2025-07-17T06:33:20.3521444Z  2025-07-17T06:33:20.3521783Z  if user: 2025-07-17T06:33:20.3522245Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.3522934Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.3523547Z  2025-07-17T06:33:20.3523892Z  return optins 2025-07-17T06:33:20.3524295Z  2025-07-17T06:33:20.3524611Z  2025-07-17T06:33:20.3525223Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.3525827Z  """ 2025-07-17T06:33:20.3526255Z  Check if the experiment name is valid. 2025-07-17T06:33:20.3526766Z  A valid name: 2025-07-17T06:33:20.3527435Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.3528361Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.3529050Z  - Cannot contain spaces 2025-07-17T06:33:20.3529516Z  """ 2025-07-17T06:33:20.3529858Z  2025-07-17T06:33:20.3530306Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.3531012Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.3531706Z  2025-07-17T06:33:20.3532041Z  if valid: 2025-07-17T06:33:20.3532437Z  return True 2025-07-17T06:33:20.3532845Z  2025-07-17T06:33:20.3533179Z  log.error( 2025-07-17T06:33:20.3534591Z  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.3536402Z  ) 2025-07-17T06:33:20.3536770Z  return False 2025-07-17T06:33:20.3537155Z  2025-07-17T06:33:20.3537485Z  2025-07-17T06:33:20.3537991Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.3538608Z  """ 2025-07-17T06:33:20.3539204Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.3539902Z  """ 2025-07-17T06:33:20.3540261Z  try: 2025-07-17T06:33:20.3540639Z  if settings_text: 2025-07-17T06:33:20.3541373Z  # 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.3542140Z  # for easy reading 2025-07-17T06:33:20.3542937Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.3543809Z  # the backtick character in shell commands. 2025-07-17T06:33:20.3544408Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.3545197Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.3545881Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.3546380Z  2025-07-17T06:33:20.3547131Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.3547855Z  experiments = {} 2025-07-17T06:33:20.3548306Z  2025-07-17T06:33:20.3548847Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.3549597Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.3550667Z  # 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.3551656Z  continue 2025-07-17T06:33:20.3552103Z  2025-07-17T06:33:20.3552464Z  valid_settings = {} 2025-07-17T06:33:20.3552999Z  for setting in exp_settings: 2025-07-17T06:33:20.3553567Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.3554158Z  log.warning( 2025-07-17T06:33:20.3554968Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.3555657Z  ) 2025-07-17T06:33:20.3556097Z  else: 2025-07-17T06:33:20.3556628Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.3557186Z  2025-07-17T06:33:20.3557648Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.3558282Z  return Settings(experiments) 2025-07-17T06:33:20.3558778Z  2025-07-17T06:33:20.3559127Z  except Exception: 2025-07-17T06:33:20.3559645Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.3560168Z  2025-07-17T06:33:20.3560527Z  return Settings() 2025-07-17T06:33:20.3560953Z  2025-07-17T06:33:20.3561280Z  2025-07-17T06:33:20.3561843Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.3562408Z  """ 2025-07-17T06:33:20.3562862Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.3563397Z  2025-07-17T06:33:20.3563939Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3564692Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3565331Z  2025-07-17T06:33:20.3565913Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.3566615Z  """ 2025-07-17T06:33:20.3567182Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3567937Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.3568473Z  2025-07-17T06:33:20.3568804Z  2025-07-17T06:33:20.3569249Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.3569808Z  """ 2025-07-17T06:33:20.3570215Z  Parse users from the rollout state. 2025-07-17T06:33:20.3570714Z  2025-07-17T06:33:20.3571038Z  """ 2025-07-17T06:33:20.3571592Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3572323Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.3572857Z  2025-07-17T06:33:20.3573179Z  2025-07-17T06:33:20.3573778Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3574500Z  """ 2025-07-17T06:33:20.3575237Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.3575775Z  """ 2025-07-17T06:33:20.3576240Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.3576966Z  2025-07-17T06:33:20.3577280Z  2025-07-17T06:33:20.3577892Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3578627Z  """ 2025-07-17T06:33:20.3579102Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.3579672Z  """ 2025-07-17T06:33:20.3580191Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.3580878Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.3581530Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.3582115Z  return False 2025-07-17T06:33:20.3582527Z  2025-07-17T06:33:20.3582980Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.3583571Z  log.warning( 2025-07-17T06:33:20.3584376Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.3585357Z  ) 2025-07-17T06:33:20.3585723Z  2025-07-17T06:33:20.3586062Z  return True 2025-07-17T06:33:20.3586458Z  2025-07-17T06:33:20.3586776Z  2025-07-17T06:33:20.3587134Z def get_runner_prefix( 2025-07-17T06:33:20.3587587Z  rollout_state: str, 2025-07-17T06:33:20.3588079Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.3588576Z  branch: str, 2025-07-17T06:33:20.3589108Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3589778Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3590364Z  is_canary: bool = False, 2025-07-17T06:33:20.3590831Z ) -> str: 2025-07-17T06:33:20.3591271Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.3591861Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.3592372Z  2025-07-17T06:33:20.3592839Z  fleet_prefix = "" 2025-07-17T06:33:20.3593291Z  prefixes = [] 2025-07-17T06:33:20.3593969Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.3595003Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.3595698Z  log.info( 2025-07-17T06:33:20.3596389Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.3597111Z  ) 2025-07-17T06:33:20.3597508Z  continue 2025-07-17T06:33:20.3597912Z  2025-07-17T06:33:20.3598273Z  if opt_out_experiments: 2025-07-17T06:33:20.3598830Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.3599456Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.3600034Z  log.info( 2025-07-17T06:33:20.3600958Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.3601886Z  ) 2025-07-17T06:33:20.3602302Z  continue 2025-07-17T06:33:20.3602732Z  2025-07-17T06:33:20.3603096Z  if eligible_experiments: 2025-07-17T06:33:20.3603671Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.3604305Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.3604943Z  log.info( 2025-07-17T06:33:20.3605728Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.3606525Z  ) 2025-07-17T06:33:20.3607099Z  continue 2025-07-17T06:33:20.3607604Z  elif not experiment_settings.default: 2025-07-17T06:33:20.3608125Z  log.info( 2025-07-17T06:33:20.3608805Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.3609503Z  ) 2025-07-17T06:33:20.3609896Z  continue 2025-07-17T06:33:20.3610305Z  2025-07-17T06:33:20.3610767Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.3611372Z  opted_out_users = [ 2025-07-17T06:33:20.3611835Z  requestor 2025-07-17T06:33:20.3612319Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3612981Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3613597Z  ] 2025-07-17T06:33:20.3613967Z  2025-07-17T06:33:20.3614317Z  if opted_out_users: 2025-07-17T06:33:20.3615011Z  log.info( 2025-07-17T06:33:20.3615718Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.3616383Z  ) 2025-07-17T06:33:20.3616769Z  continue 2025-07-17T06:33:20.3617185Z  2025-07-17T06:33:20.3617636Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.3618237Z  opted_in_users = [ 2025-07-17T06:33:20.3618696Z  requestor 2025-07-17T06:33:20.3619183Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3619850Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3620458Z  ] 2025-07-17T06:33:20.3620822Z  2025-07-17T06:33:20.3621159Z  enabled = False 2025-07-17T06:33:20.3621621Z  if opted_in_users: 2025-07-17T06:33:20.3622217Z  log.info( 2025-07-17T06:33:20.3622844Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.3623501Z  ) 2025-07-17T06:33:20.3623902Z  enabled = True 2025-07-17T06:33:20.3624337Z  2025-07-17T06:33:20.3624730Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.3625770Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.3626686Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.3627307Z  log.info( 2025-07-17T06:33:20.3628169Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.3629042Z  ) 2025-07-17T06:33:20.3629479Z  enabled = True 2025-07-17T06:33:20.3629933Z  2025-07-17T06:33:20.3630275Z  if enabled: 2025-07-17T06:33:20.3630738Z  label = experiment_name 2025-07-17T06:33:20.3631298Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.3632103Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.3632951Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.3633701Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.3634350Z  if is_canary: 2025-07-17T06:33:20.3634978Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.3635521Z  fleet_prefix = label 2025-07-17T06:33:20.3636161Z  else: 2025-07-17T06:33:20.3636617Z  prefixes.append(label) 2025-07-17T06:33:20.3637103Z  2025-07-17T06:33:20.3637461Z  if len(prefixes) > 1: 2025-07-17T06:33:20.3637920Z  log.error( 2025-07-17T06:33:20.3638934Z  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.3639988Z  ) 2025-07-17T06:33:20.3640383Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.3640860Z  2025-07-17T06:33:20.3641213Z  # Fleet always comes first 2025-07-17T06:33:20.3641694Z  if fleet_prefix: 2025-07-17T06:33:20.3642167Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.3642654Z  2025-07-17T06:33:20.3643100Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.3643653Z  2025-07-17T06:33:20.3643979Z  2025-07-17T06:33:20.3644597Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.3645452Z  """ 2025-07-17T06:33:20.3646041Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.3646724Z  2025-07-17T06:33:20.3647320Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.3648005Z  """ 2025-07-17T06:33:20.3648409Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3648950Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.3649591Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.3650160Z  2025-07-17T06:33:20.3650483Z  2025-07-17T06:33:20.3651068Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.3651942Z  for _ in range(num_retries): 2025-07-17T06:33:20.3652421Z  try: 2025-07-17T06:33:20.3652865Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.3653518Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.3654176Z  return json.loads(content) 2025-07-17T06:33:20.3654702Z  except Exception as e: 2025-07-17T06:33:20.3655593Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.3656132Z  2025-07-17T06:33:20.3656695Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.3657380Z  return {} 2025-07-17T06:33:20.3657765Z  2025-07-17T06:33:20.3658081Z  2025-07-17T06:33:20.3658408Z @cache 2025-07-17T06:33:20.3659043Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.3659770Z  """ 2025-07-17T06:33:20.3660170Z  Dynamically get PR information 2025-07-17T06:33:20.3660644Z  """ 2025-07-17T06:33:20.3661151Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.3661754Z  headers = { 2025-07-17T06:33:20.3662241Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.3662849Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.3663357Z  } 2025-07-17T06:33:20.3663802Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.3664400Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.3665138Z  headers=headers, 2025-07-17T06:33:20.3665588Z  ) 2025-07-17T06:33:20.3665934Z  2025-07-17T06:33:20.3666285Z  if not json_response: 2025-07-17T06:33:20.3667047Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.3667668Z  return {} 2025-07-17T06:33:20.3668067Z  2025-07-17T06:33:20.3668422Z  return json_response 2025-07-17T06:33:20.3668851Z  2025-07-17T06:33:20.3669173Z  2025-07-17T06:33:20.3669741Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.3670443Z  """ 2025-07-17T06:33:20.3670974Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.3671605Z  """ 2025-07-17T06:33:20.3672115Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.3672698Z  return { 2025-07-17T06:33:20.3673291Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.3673949Z  } 2025-07-17T06:33:20.3674300Z  2025-07-17T06:33:20.3674631Z  2025-07-17T06:33:20.3675122Z def main() -> None: 2025-07-17T06:33:20.3675563Z  args = parse_args() 2025-07-17T06:33:20.3676082Z  2025-07-17T06:33:20.3676497Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.3677009Z  2025-07-17T06:33:20.3677378Z  # Check if the PR is opt-out 2025-07-17T06:33:20.3677866Z  if args.pr_number: 2025-07-17T06:33:20.3678539Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.3679262Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.3679762Z  log.info( 2025-07-17T06:33:20.3680464Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.3681193Z  ) 2025-07-17T06:33:20.3681761Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3682409Z  sys.exit() 2025-07-17T06:33:20.3682974Z  2025-07-17T06:33:20.3683307Z  try: 2025-07-17T06:33:20.3683756Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.3684453Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.3685175Z  ) 2025-07-17T06:33:20.3685541Z  2025-07-17T06:33:20.3685926Z  username = get_potential_pr_author( 2025-07-17T06:33:20.3686451Z  args.github_token, 2025-07-17T06:33:20.3686937Z  args.github_repo, 2025-07-17T06:33:20.3687428Z  args.github_actor, 2025-07-17T06:33:20.3687928Z  args.github_ref_type, 2025-07-17T06:33:20.3688425Z  args.github_branch, 2025-07-17T06:33:20.3688884Z  ) 2025-07-17T06:33:20.3689237Z  2025-07-17T06:33:20.3689721Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.3690305Z  2025-07-17T06:33:20.3690711Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.3691243Z  rollout_state, 2025-07-17T06:33:20.3691755Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.3692284Z  args.github_branch, 2025-07-17T06:33:20.3692792Z  args.eligible_experiments, 2025-07-17T06:33:20.3693326Z  args.opt_out_experiments, 2025-07-17T06:33:20.3693820Z  is_canary, 2025-07-17T06:33:20.3694248Z  ) 2025-07-17T06:33:20.3694605Z  2025-07-17T06:33:20.3695274Z  except Exception as e: 2025-07-17T06:33:20.3695746Z  log.error( 2025-07-17T06:33:20.3696437Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.3697319Z  ) 2025-07-17T06:33:20.3697683Z  2025-07-17T06:33:20.3698200Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3698819Z  2025-07-17T06:33:20.3699144Z  2025-07-17T06:33:20.3699483Z if __name__ == "__main__": 2025-07-17T06:33:20.3699937Z  main() 2025-07-17T06:33:20.3700305Z  2025-07-17T06:33:20.3700632Z EOF 2025-07-17T06:33:20.3700981Z  2025-07-17T06:33:20.3701339Z cat runner_determinator.py 2025-07-17T06:33:20.3903840Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.3905375Z env: 2025-07-17T06:33:20.3906448Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.3907192Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.3907945Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.3908850Z ISSUE_OWNER: 2025-07-17T06:33:20.3909568Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.3910358Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.3911157Z PR_NUMBER: 2025-07-17T06:33:20.3911843Z ##[endgroup] 2025-07-17T06:33:20.4203100Z # flake8: noqa: G004 2025-07-17T06:33:20.4204134Z 2025-07-17T06:33:20.4212215Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.4213787Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.4215331Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.4216089Z 2025-07-17T06:33:20.4216360Z """ 2025-07-17T06:33:20.4217302Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.4218747Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.4220249Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.4221690Z of which runners should be used to run which job. 2025-07-17T06:33:20.4222428Z 2025-07-17T06:33:20.4223090Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.4225133Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.4226643Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.4227836Z list, defined. 2025-07-17T06:33:20.4228260Z 2025-07-17T06:33:20.4228880Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.4230517Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.4231992Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.4232886Z 2025-07-17T06:33:20.4233536Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.4235410Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.4236728Z experiments which the user could be opted in to. 2025-07-17T06:33:20.4237439Z 2025-07-17T06:33:20.4237782Z The user list has the following rules: 2025-07-17T06:33:20.4238381Z 2025-07-17T06:33:20.4238892Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.4240305Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.4241605Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.4242320Z 2025-07-17T06:33:20.4242614Z Example config: 2025-07-17T06:33:20.4243390Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.4244502Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.4246166Z # Expected syntax is: 2025-07-17T06:33:20.4247320Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.4248956Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.4250065Z 2025-07-17T06:33:20.4250402Z experiments: 2025-07-17T06:33:20.4251077Z lf: 2025-07-17T06:33:20.4251709Z rollout_percent: 25 2025-07-17T06:33:20.4252843Z all_branches: false 2025-07-17T06:33:20.4253633Z default: true 2025-07-17T06:33:20.4254391Z --- 2025-07-17T06:33:20.4254988Z 2025-07-17T06:33:20.4255288Z # Opt-ins: 2025-07-17T06:33:20.4256241Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.4257655Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.4258913Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.4260008Z # Experiments should be from the above list. 2025-07-17T06:33:20.4260633Z 2025-07-17T06:33:20.4260929Z @User1,-lf,split_build 2025-07-17T06:33:20.4261609Z @User2,lf 2025-07-17T06:33:20.4262212Z @User3,split_build 2025-07-17T06:33:20.4262845Z """ 2025-07-17T06:33:20.4263156Z 2025-07-17T06:33:20.4263416Z import json 2025-07-17T06:33:20.4264037Z import logging 2025-07-17T06:33:20.4264698Z import os 2025-07-17T06:33:20.4265599Z import random 2025-07-17T06:33:20.4266244Z import re 2025-07-17T06:33:20.4266864Z import sys 2025-07-17T06:33:20.4267583Z from argparse import ArgumentParser 2025-07-17T06:33:20.4268466Z from collections.abc import Iterable 2025-07-17T06:33:20.4269323Z from functools import cache 2025-07-17T06:33:20.4270098Z from logging import LogRecord 2025-07-17T06:33:20.4270909Z from typing import Any, NamedTuple 2025-07-17T06:33:20.4271898Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.4272560Z 2025-07-17T06:33:20.4272852Z import yaml 2025-07-17T06:33:20.4273530Z from github import Auth, Github 2025-07-17T06:33:20.4274379Z from github.Issue import Issue 2025-07-17T06:33:20.4275215Z 2025-07-17T06:33:20.4275227Z 2025-07-17T06:33:20.4275604Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.4276755Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.4278251Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.4279232Z 2025-07-17T06:33:20.4279645Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.4280879Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.4281810Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.4282744Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.4283320Z 2025-07-17T06:33:20.4283640Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.4284187Z 2025-07-17T06:33:20.4284491Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.4285462Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.4285937Z 2025-07-17T06:33:20.4285946Z 2025-07-17T06:33:20.4286259Z class Experiment(NamedTuple): 2025-07-17T06:33:20.4287045Z rollout_perc: float = ( 2025-07-17T06:33:20.4288111Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.4289290Z ) 2025-07-17T06:33:20.4289898Z all_branches: bool = ( 2025-07-17T06:33:20.4290934Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.4292124Z ) 2025-07-17T06:33:20.4292769Z default: bool = ( 2025-07-17T06:33:20.4293756Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.4295133Z ) 2025-07-17T06:33:20.4295509Z 2025-07-17T06:33:20.4295800Z # Add more fields as needed 2025-07-17T06:33:20.4296333Z 2025-07-17T06:33:20.4296345Z 2025-07-17T06:33:20.4296665Z class Settings(NamedTuple): 2025-07-17T06:33:20.4297455Z """ 2025-07-17T06:33:20.4298207Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.4299143Z """ 2025-07-17T06:33:20.4299477Z 2025-07-17T06:33:20.4299812Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.4300413Z 2025-07-17T06:33:20.4300422Z 2025-07-17T06:33:20.4300754Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.4301775Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.4302505Z 2025-07-17T06:33:20.4302774Z COLORS = { 2025-07-17T06:33:20.4303434Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.4304621Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.4305702Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.4306577Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.4307444Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.4308264Z } 2025-07-17T06:33:20.4308616Z 2025-07-17T06:33:20.4308969Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.4310212Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.4311533Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.4312506Z return super().format(record) 2025-07-17T06:33:20.4313070Z 2025-07-17T06:33:20.4313080Z 2025-07-17T06:33:20.4313398Z handler = logging.StreamHandler() 2025-07-17T06:33:20.4314621Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.4315821Z 2025-07-17T06:33:20.4316238Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.4317269Z log.addHandler(handler) 2025-07-17T06:33:20.4318082Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.4318595Z 2025-07-17T06:33:20.4318608Z 2025-07-17T06:33:20.4319023Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.4319972Z """ 2025-07-17T06:33:20.4320791Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.4321819Z """ 2025-07-17T06:33:20.4322412Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.4324196Z # 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.4326391Z log.warning( 2025-07-17T06:33:20.4327883Z "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.4329524Z ) 2025-07-17T06:33:20.4344252Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.4345482Z return 2025-07-17T06:33:20.4345904Z 2025-07-17T06:33:20.4346499Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.4347557Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.4348522Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.4349109Z 2025-07-17T06:33:20.4349120Z 2025-07-17T06:33:20.4349632Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.4350740Z return frozenset( 2025-07-17T06:33:20.4351763Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.4352989Z ) 2025-07-17T06:33:20.4353312Z 2025-07-17T06:33:20.4353324Z 2025-07-17T06:33:20.4353606Z def parse_args() -> Any: 2025-07-17T06:33:20.4354522Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.4356167Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.4357448Z parser.add_argument( 2025-07-17T06:33:20.4358177Z "--github-issue-repo", 2025-07-17T06:33:20.4358931Z type=str, 2025-07-17T06:33:20.4359603Z required=False, 2025-07-17T06:33:20.4360320Z default="pytorch/test-infra", 2025-07-17T06:33:20.4361191Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.4362008Z ) 2025-07-17T06:33:20.4362637Z parser.add_argument( 2025-07-17T06:33:20.4363395Z "--github-repo", 2025-07-17T06:33:20.4364140Z type=str, 2025-07-17T06:33:20.4365017Z required=True, 2025-07-17T06:33:20.4365769Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.4366728Z ) 2025-07-17T06:33:20.4367366Z parser.add_argument( 2025-07-17T06:33:20.4368366Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.4369460Z ) 2025-07-17T06:33:20.4370061Z parser.add_argument( 2025-07-17T06:33:20.4371078Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.4372237Z ) 2025-07-17T06:33:20.4373133Z parser.add_argument( 2025-07-17T06:33:20.4374183Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.4375588Z ) 2025-07-17T06:33:20.4376179Z parser.add_argument( 2025-07-17T06:33:20.4377232Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.4378413Z ) 2025-07-17T06:33:20.4379010Z parser.add_argument( 2025-07-17T06:33:20.4379741Z "--github-ref-type", 2025-07-17T06:33:20.4380498Z type=str, 2025-07-17T06:33:20.4381189Z required=True, 2025-07-17T06:33:20.4382022Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.4382961Z ) 2025-07-17T06:33:20.4383606Z parser.add_argument( 2025-07-17T06:33:20.4384403Z "--eligible-experiments", 2025-07-17T06:33:20.4385552Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4386484Z required=False, 2025-07-17T06:33:20.4387213Z default="", 2025-07-17T06:33:20.4388723Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.4390326Z ) 2025-07-17T06:33:20.4390947Z parser.add_argument( 2025-07-17T06:33:20.4391697Z "--opt-out-experiments", 2025-07-17T06:33:20.4392570Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.4393454Z required=False, 2025-07-17T06:33:20.4394149Z default="", 2025-07-17T06:33:20.4395040Z help=( 2025-07-17T06:33:20.4396223Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.4398150Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.4399552Z ), 2025-07-17T06:33:20.4400126Z ) 2025-07-17T06:33:20.4400739Z parser.add_argument( 2025-07-17T06:33:20.4401506Z "--pr-number", 2025-07-17T06:33:20.4402216Z type=str, 2025-07-17T06:33:20.4402921Z required=False, 2025-07-17T06:33:20.4403635Z default="", 2025-07-17T06:33:20.4404677Z help="the optional PR number where this is run", 2025-07-17T06:33:20.4405840Z ) 2025-07-17T06:33:20.4406163Z 2025-07-17T06:33:20.4406460Z return parser.parse_args() 2025-07-17T06:33:20.4406969Z 2025-07-17T06:33:20.4406988Z 2025-07-17T06:33:20.4407648Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4408952Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.4409821Z return Github(auth=auth) 2025-07-17T06:33:20.4410330Z 2025-07-17T06:33:20.4410343Z 2025-07-17T06:33:20.4411112Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.4412524Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.4413399Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.4414050Z 2025-07-17T06:33:20.4414063Z 2025-07-17T06:33:20.4414379Z def get_potential_pr_author( 2025-07-17T06:33:20.4415791Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.4416985Z ) -> str: 2025-07-17T06:33:20.4417845Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.4419155Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.4420388Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.4421066Z 2025-07-17T06:33:20.4421381Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4421930Z 2025-07-17T06:33:20.4422360Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.4423354Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.4424176Z if ( 2025-07-17T06:33:20.4424991Z len(split_tag) == 3 2025-07-17T06:33:20.4425799Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.4426693Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.4427558Z ): 2025-07-17T06:33:20.4428501Z pr_number = split_tag[2] 2025-07-17T06:33:20.4429333Z try: 2025-07-17T06:33:20.4430074Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.4431134Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.4432201Z except Exception as e: 2025-07-17T06:33:20.4433081Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.4434196Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.4435537Z ) from e 2025-07-17T06:33:20.4436393Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.4437512Z # In all other cases, return the original input username 2025-07-17T06:33:20.4438493Z return username 2025-07-17T06:33:20.4438882Z 2025-07-17T06:33:20.4438892Z 2025-07-17T06:33:20.4439248Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.4440127Z """ 2025-07-17T06:33:20.4441214Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.4442605Z """ 2025-07-17T06:33:20.4443527Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.4444397Z 2025-07-17T06:33:20.4444410Z 2025-07-17T06:33:20.4444733Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.4445794Z try: 2025-07-17T06:33:20.4446455Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.4447358Z return data 2025-07-17T06:33:20.4448072Z except yaml.YAMLError: 2025-07-17T06:33:20.4448921Z log.exception("Error loading YAML") 2025-07-17T06:33:20.4449791Z raise 2025-07-17T06:33:20.4450158Z 2025-07-17T06:33:20.4450168Z 2025-07-17T06:33:20.4450851Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.4452159Z """ 2025-07-17T06:33:20.4453271Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.4454341Z 2025-07-17T06:33:20.4455372Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4456728Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4457452Z 2025-07-17T06:33:20.4458088Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.4459306Z """ 2025-07-17T06:33:20.4460083Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.4461125Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.4462154Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.4463126Z else: 2025-07-17T06:33:20.4463720Z return "", rollout_state 2025-07-17T06:33:20.4464214Z 2025-07-17T06:33:20.4464227Z 2025-07-17T06:33:20.4464547Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.4465611Z """ 2025-07-17T06:33:20.4466434Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.4467495Z """ 2025-07-17T06:33:20.4467837Z 2025-07-17T06:33:20.4467848Z 2025-07-17T06:33:20.4468388Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.4469483Z """ 2025-07-17T06:33:20.4470654Z 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.4471885Z 2025-07-17T06:33:20.4472970Z 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.4475022Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.4476240Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.4477078Z 2025-07-17T06:33:20.4477090Z 2025-07-17T06:33:20.4477343Z """ 2025-07-17T06:33:20.4477942Z optins = UserOptins() 2025-07-17T06:33:20.4478754Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.4548095Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.4549623Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.4550718Z # Not a valid user. Skip 2025-07-17T06:33:20.4551554Z continue 2025-07-17T06:33:20.4552080Z 2025-07-17T06:33:20.4552362Z if user: 2025-07-17T06:33:20.4553140Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.4554273Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.4555321Z 2025-07-17T06:33:20.4555600Z return optins 2025-07-17T06:33:20.4555992Z 2025-07-17T06:33:20.4556002Z 2025-07-17T06:33:20.4556457Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.4557439Z """ 2025-07-17T06:33:20.4558064Z Check if the experiment name is valid. 2025-07-17T06:33:20.4558932Z A valid name: 2025-07-17T06:33:20.4559961Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.4561559Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.4563042Z - Cannot contain spaces 2025-07-17T06:33:20.4563817Z """ 2025-07-17T06:33:20.4564143Z 2025-07-17T06:33:20.4564613Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.4566043Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.4566806Z 2025-07-17T06:33:20.4567087Z if valid: 2025-07-17T06:33:20.4567725Z return True 2025-07-17T06:33:20.4568142Z 2025-07-17T06:33:20.4568419Z log.error( 2025-07-17T06:33:20.4570904Z 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.4573706Z ) 2025-07-17T06:33:20.4574325Z return False 2025-07-17T06:33:20.4574733Z 2025-07-17T06:33:20.4574745Z 2025-07-17T06:33:20.4575506Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.4576626Z """ 2025-07-17T06:33:20.4577908Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.4579203Z """ 2025-07-17T06:33:20.4579840Z try: 2025-07-17T06:33:20.4580470Z if settings_text: 2025-07-17T06:33:20.4581708Z # 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.4583025Z # for easy reading 2025-07-17T06:33:20.4584326Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.4586031Z # the backtick character in shell commands. 2025-07-17T06:33:20.4587045Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.4588185Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.4589328Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.4589975Z 2025-07-17T06:33:20.4590685Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.4591966Z experiments = {} 2025-07-17T06:33:20.4592498Z 2025-07-17T06:33:20.4593092Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.4594485Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.4596609Z # 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.4598409Z continue 2025-07-17T06:33:20.4598927Z 2025-07-17T06:33:20.4599204Z valid_settings = {} 2025-07-17T06:33:20.4600039Z for setting in exp_settings: 2025-07-17T06:33:20.4600940Z if setting not in Experiment._fields: 2025-07-17T06:33:20.4601823Z log.warning( 2025-07-17T06:33:20.4602974Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.4604415Z ) 2025-07-17T06:33:20.4605324Z else: 2025-07-17T06:33:20.4606118Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.4606825Z 2025-07-17T06:33:20.4607286Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.4608363Z return Settings(experiments) 2025-07-17T06:33:20.4608977Z 2025-07-17T06:33:20.4609276Z except Exception: 2025-07-17T06:33:20.4610066Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.4610692Z 2025-07-17T06:33:20.4610953Z return Settings() 2025-07-17T06:33:20.4611361Z 2025-07-17T06:33:20.4611371Z 2025-07-17T06:33:20.4611782Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.4612718Z """ 2025-07-17T06:33:20.4613435Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.4614089Z 2025-07-17T06:33:20.4614654Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.4616137Z and the text below is the list of opted in users. 2025-07-17T06:33:20.4616791Z 2025-07-17T06:33:20.4617430Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.4618611Z """ 2025-07-17T06:33:20.4619485Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4620732Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.4621415Z 2025-07-17T06:33:20.4621426Z 2025-07-17T06:33:20.4621818Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.4622719Z """ 2025-07-17T06:33:20.4623323Z Parse users from the rollout state. 2025-07-17T06:33:20.4623879Z 2025-07-17T06:33:20.4624130Z """ 2025-07-17T06:33:20.4625730Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.4626992Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.4627654Z 2025-07-17T06:33:20.4627669Z 2025-07-17T06:33:20.4628573Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4629889Z """ 2025-07-17T06:33:20.4630565Z Check if a user is opted into an experiment 2025-07-17T06:33:20.4631415Z """ 2025-07-17T06:33:20.4632113Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.4632782Z 2025-07-17T06:33:20.4632791Z 2025-07-17T06:33:20.4633450Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.4634708Z """ 2025-07-17T06:33:20.4635757Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.4636760Z """ 2025-07-17T06:33:20.4637622Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.4638789Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.4639859Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.4640824Z return False 2025-07-17T06:33:20.4641229Z 2025-07-17T06:33:20.4641680Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.4642638Z log.warning( 2025-07-17T06:33:20.4643940Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.4645669Z ) 2025-07-17T06:33:20.4646022Z 2025-07-17T06:33:20.4646287Z return True 2025-07-17T06:33:20.4646725Z 2025-07-17T06:33:20.4646734Z 2025-07-17T06:33:20.4647021Z def get_runner_prefix( 2025-07-17T06:33:20.4647762Z rollout_state: str, 2025-07-17T06:33:20.4648568Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.4649435Z branch: str, 2025-07-17T06:33:20.4650239Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4651391Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.4652428Z is_canary: bool = False, 2025-07-17T06:33:20.4653268Z ) -> str: 2025-07-17T06:33:20.4654331Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.4655673Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.4656303Z 2025-07-17T06:33:20.4656591Z fleet_prefix = "" 2025-07-17T06:33:20.4657272Z prefixes = [] 2025-07-17T06:33:20.4658271Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.4659880Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.4661115Z log.info( 2025-07-17T06:33:20.4662271Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.4663513Z ) 2025-07-17T06:33:20.4664114Z continue 2025-07-17T06:33:20.4664515Z 2025-07-17T06:33:20.4665008Z if opt_out_experiments: 2025-07-17T06:33:20.4665868Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.4666898Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.4667889Z log.info( 2025-07-17T06:33:20.4669457Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.4671162Z ) 2025-07-17T06:33:20.4671810Z continue 2025-07-17T06:33:20.4672260Z 2025-07-17T06:33:20.4672571Z if eligible_experiments: 2025-07-17T06:33:20.4673490Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.4674554Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.4675696Z log.info( 2025-07-17T06:33:20.4677054Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.4678479Z ) 2025-07-17T06:33:20.4679153Z continue 2025-07-17T06:33:20.4679957Z elif not experiment_settings.default: 2025-07-17T06:33:20.4680887Z log.info( 2025-07-17T06:33:20.4682320Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.4683601Z ) 2025-07-17T06:33:20.4684212Z continue 2025-07-17T06:33:20.4684627Z 2025-07-17T06:33:20.4685291Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.4686314Z opted_out_users = [ 2025-07-17T06:33:20.4687007Z requestor 2025-07-17T06:33:20.4687719Z for requestor in workflow_requestors 2025-07-17T06:33:20.4688805Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4689865Z ] 2025-07-17T06:33:20.4690209Z 2025-07-17T06:33:20.4690502Z if opted_out_users: 2025-07-17T06:33:20.4691233Z log.info( 2025-07-17T06:33:20.4692255Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.4693427Z ) 2025-07-17T06:33:20.4694091Z continue 2025-07-17T06:33:20.4694488Z 2025-07-17T06:33:20.4695240Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.4696287Z opted_in_users = [ 2025-07-17T06:33:20.4697082Z requestor 2025-07-17T06:33:20.4697855Z for requestor in workflow_requestors 2025-07-17T06:33:20.4698977Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.4700036Z ] 2025-07-17T06:33:20.4700396Z 2025-07-17T06:33:20.4700681Z enabled = False 2025-07-17T06:33:20.4701407Z if opted_in_users: 2025-07-17T06:33:20.4702182Z log.info( 2025-07-17T06:33:20.4703164Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.4704296Z ) 2025-07-17T06:33:20.4705138Z enabled = True 2025-07-17T06:33:20.4705630Z 2025-07-17T06:33:20.4706002Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.4707422Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.4709295Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.4710441Z log.info( 2025-07-17T06:33:20.4711888Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.4713473Z ) 2025-07-17T06:33:20.4714147Z enabled = True 2025-07-17T06:33:20.4714666Z 2025-07-17T06:33:20.4715175Z if enabled: 2025-07-17T06:33:20.4715922Z label = experiment_name 2025-07-17T06:33:20.4716821Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.4718227Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.4719738Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.4721078Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.4722196Z if is_canary: 2025-07-17T06:33:20.4722980Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.4723899Z fleet_prefix = label 2025-07-17T06:33:20.4724981Z else: 2025-07-17T06:33:20.4725734Z prefixes.append(label) 2025-07-17T06:33:20.4726310Z 2025-07-17T06:33:20.4726601Z if len(prefixes) > 1: 2025-07-17T06:33:20.4727320Z log.error( 2025-07-17T06:33:20.4729025Z 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.4730953Z ) 2025-07-17T06:33:20.4731666Z prefixes = prefixes[:1] 2025-07-17T06:33:20.4732186Z 2025-07-17T06:33:20.4732491Z # Fleet always comes first 2025-07-17T06:33:20.4733304Z if fleet_prefix: 2025-07-17T06:33:20.4734048Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.4734703Z 2025-07-17T06:33:20.4735680Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.4736443Z 2025-07-17T06:33:20.4736454Z 2025-07-17T06:33:20.4737198Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.4738501Z """ 2025-07-17T06:33:20.4739483Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.4740458Z 2025-07-17T06:33:20.4741116Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.4742346Z """ 2025-07-17T06:33:20.4743001Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.4743914Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.4745147Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.4745925Z 2025-07-17T06:33:20.4745937Z 2025-07-17T06:33:20.4746627Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.4747969Z for _ in range(num_retries): 2025-07-17T06:33:20.4748760Z try: 2025-07-17T06:33:20.4749470Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.4750603Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.4751746Z return json.loads(content) 2025-07-17T06:33:20.4753698Z except Exception as e: 2025-07-17T06:33:20.4754593Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.4755481Z 2025-07-17T06:33:20.4756133Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.4757329Z return {} 2025-07-17T06:33:20.4757720Z 2025-07-17T06:33:20.4757735Z 2025-07-17T06:33:20.4757990Z @cache 2025-07-17T06:33:20.4758987Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.4760220Z """ 2025-07-17T06:33:20.4760853Z Dynamically get PR information 2025-07-17T06:33:20.4761913Z """ 2025-07-17T06:33:20.4762758Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.4763823Z headers = { 2025-07-17T06:33:20.4764556Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.4765756Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.4766671Z } 2025-07-17T06:33:20.4767380Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.4768410Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.4769294Z headers=headers, 2025-07-17T06:33:20.4770000Z ) 2025-07-17T06:33:20.4770334Z 2025-07-17T06:33:20.4770641Z if not json_response: 2025-07-17T06:33:20.4771553Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.4772574Z return {} 2025-07-17T06:33:20.4772955Z 2025-07-17T06:33:20.4773240Z return json_response 2025-07-17T06:33:20.4773689Z 2025-07-17T06:33:20.4773699Z 2025-07-17T06:33:20.4774341Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.4775835Z """ 2025-07-17T06:33:20.4776680Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.4777735Z """ 2025-07-17T06:33:20.4778482Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.4779496Z return { 2025-07-17T06:33:20.4780417Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.4781548Z } 2025-07-17T06:33:20.4781859Z 2025-07-17T06:33:20.4781868Z 2025-07-17T06:33:20.4782127Z def main() -> None: 2025-07-17T06:33:20.4782788Z args = parse_args() 2025-07-17T06:33:20.4783251Z 2025-07-17T06:33:20.4783630Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.4784280Z 2025-07-17T06:33:20.4784588Z # Check if the PR is opt-out 2025-07-17T06:33:20.4785596Z if args.pr_number: 2025-07-17T06:33:20.4786672Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.4788208Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.4789074Z log.info( 2025-07-17T06:33:20.4790209Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.4791524Z ) 2025-07-17T06:33:20.4792443Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4793556Z sys.exit() 2025-07-17T06:33:20.4793979Z 2025-07-17T06:33:20.4794234Z try: 2025-07-17T06:33:20.4795136Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.4796329Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.4797467Z ) 2025-07-17T06:33:20.4797832Z 2025-07-17T06:33:20.4798167Z username = get_potential_pr_author( 2025-07-17T06:33:20.4799091Z args.github_token, 2025-07-17T06:33:20.4799888Z args.github_repo, 2025-07-17T06:33:20.4800706Z args.github_actor, 2025-07-17T06:33:20.4801517Z args.github_ref_type, 2025-07-17T06:33:20.4802324Z args.github_branch, 2025-07-17T06:33:20.4803074Z ) 2025-07-17T06:33:20.4803405Z 2025-07-17T06:33:20.4803856Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.4804597Z 2025-07-17T06:33:20.4805157Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.4806072Z rollout_state, 2025-07-17T06:33:20.4806843Z (args.github_issue_owner, username), 2025-07-17T06:33:20.4807725Z args.github_branch, 2025-07-17T06:33:20.4808567Z args.eligible_experiments, 2025-07-17T06:33:20.4809469Z args.opt_out_experiments, 2025-07-17T06:33:20.4810315Z is_canary, 2025-07-17T06:33:20.4810995Z ) 2025-07-17T06:33:20.4811350Z 2025-07-17T06:33:20.4811647Z except Exception as e: 2025-07-17T06:33:20.4812373Z log.error( 2025-07-17T06:33:20.4813446Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.4815236Z ) 2025-07-17T06:33:20.4815585Z 2025-07-17T06:33:20.4816123Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4816941Z 2025-07-17T06:33:20.4816951Z 2025-07-17T06:33:20.4817225Z if __name__ == "__main__": 2025-07-17T06:33:20.4817952Z main() 2025-07-17T06:33:20.4818320Z 2025-07-17T06:33:20.4953300Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4954724Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4996628Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.4997379Z env: 2025-07-17T06:33:20.4998329Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.4999027Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.4999764Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.5000604Z ISSUE_OWNER: 2025-07-17T06:33:20.5001309Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.5002022Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.5002821Z PR_NUMBER: 2025-07-17T06:33:20.5003450Z ##[endgroup] 2025-07-17T06:33:21.5037178Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:22.0580726Z Collecting urllib3==1.26.18 2025-07-17T06:33:22.0934612Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:22.1137036Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-07-17T06:33:22.1376244Z Collecting PyGithub==2.3.0 2025-07-17T06:33:22.1417460Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:22.1840246Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:22.1871004Z 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:22.1913157Z 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:22.1929597Z 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:22.1943747Z 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:22.2192942Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:22.2224346Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:22.2485772Z 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:22.3659153Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:22.3695041Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:22.4783196Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:22.4820942Z 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:22.5001904Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:22.5031226Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:22.5261130Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:22.5346579Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 20.2 MB/s eta 0:00:00 2025-07-17T06:33:22.5390377Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:22.5477540Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 50.6 MB/s eta 0:00:00 2025-07-17T06:33:22.5510767Z 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:22.5750888Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 38.0 MB/s eta 0:00:00 2025-07-17T06:33:22.5781954Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:22.5834281Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:22.5908277Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 87.9 MB/s eta 0:00:00 2025-07-17T06:33:22.5939608Z 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:22.5982479Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 31.3 MB/s eta 0:00:00 2025-07-17T06:33:22.6012755Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:22.6054135Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.9 MB/s eta 0:00:00 2025-07-17T06:33:22.9199670Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:23.4676070Z 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:23.5838510Z ##[group]Run curr_branch="main" 2025-07-17T06:33:23.5838923Z curr_branch="main" 2025-07-17T06:33:23.5839187Z curr_ref_type="branch" 2025-07-17T06:33:23.5839483Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:23.5839783Z  2025-07-17T06:33:23.5840016Z python3 runner_determinator.py \ 2025-07-17T06:33:23.5840332Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:23.5840647Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:23.5840953Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:23.5841265Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:23.5841604Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:23.5841927Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:23.5842269Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:23.5842644Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:23.5843061Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:23.5843399Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:23.5872393Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:23.5872667Z env: 2025-07-17T06:33:23.5873332Z GITHUB_TOKEN: *** 2025-07-17T06:33:23.5873568Z ISSUE_NUMBER: 5132 2025-07-17T06:33:23.5873808Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:23.5874094Z ISSUE_OWNER: 2025-07-17T06:33:23.5874315Z CHECK_EXPERIMENTS: 2025-07-17T06:33:23.5874548Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:23.5874997Z PR_NUMBER: 2025-07-17T06:33:23.5875251Z ##[endgroup] 2025-07-17T06:33:23.5923900Z Current branch is 'main' 2025-07-17T06:33:25.2451828Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:25.2452916Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:25.2732290Z INFO : Setting output: label-type='' 2025-07-17T06:33:25.2791256Z Evaluate and set job outputs 2025-07-17T06:33:25.2798624Z Cleaning up orphan processes