2025-08-14T20:43:47.2254727Z Current runner version: '2.327.1' 2025-08-14T20:43:47.2281331Z ##[group]Runner Image Provisioner 2025-08-14T20:43:47.2282133Z Hosted Compute Agent 2025-08-14T20:43:47.2282634Z Version: 20250812.370 2025-08-14T20:43:47.2283271Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.2283940Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.2284529Z ##[endgroup] 2025-08-14T20:43:47.2285039Z ##[group]Operating System 2025-08-14T20:43:47.2285982Z Ubuntu 2025-08-14T20:43:47.2286425Z 24.04.2 2025-08-14T20:43:47.2286866Z LTS 2025-08-14T20:43:47.2287378Z ##[endgroup] 2025-08-14T20:43:47.2287847Z ##[group]Runner Image 2025-08-14T20:43:47.2288461Z Image: ubuntu-24.04 2025-08-14T20:43:47.2288950Z Version: 20250804.2.0 2025-08-14T20:43:47.2289947Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.2291510Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:47.2292450Z ##[endgroup] 2025-08-14T20:43:47.2293587Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.2295928Z Contents: read 2025-08-14T20:43:47.2296447Z Metadata: read 2025-08-14T20:43:47.2296995Z Packages: read 2025-08-14T20:43:47.2297522Z ##[endgroup] 2025-08-14T20:43:47.2299622Z Secret source: Actions 2025-08-14T20:43:47.2301029Z Prepare workflow directory 2025-08-14T20:43:47.2816827Z Prepare all required actions 2025-08-14T20:43:47.2876949Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.2882424Z ##[group] Inputs 2025-08-14T20:43:47.2882995Z check_experiments: 2025-08-14T20:43:47.2883551Z opt_out_experiments: 2025-08-14T20:43:47.2884151Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.2884773Z issue_owner: 2025-08-14T20:43:47.2885626Z curr_branch: main 2025-08-14T20:43:47.2886324Z curr_ref_type: branch 2025-08-14T20:43:47.2886969Z issue_number: 5132 2025-08-14T20:43:47.2887473Z ##[endgroup] 2025-08-14T20:43:47.2888110Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:47.3497502Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.3499937Z cat < runner_determinator.py 2025-08-14T20:43:47.3500613Z # flake8: noqa: G004 2025-08-14T20:43:47.3501148Z  2025-08-14T20:43:47.3501889Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.3502939Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.3503835Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.3504567Z  2025-08-14T20:43:47.3504990Z """ 2025-08-14T20:43:47.3506035Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.3507087Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.3508259Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.3509175Z of which runners should be used to run which job. 2025-08-14T20:43:47.3509884Z  2025-08-14T20:43:47.3510594Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.3511551Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.3512607Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.3513429Z list, defined. 2025-08-14T20:43:47.3513884Z  2025-08-14T20:43:47.3514597Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.3515936Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.3516938Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.3517949Z  2025-08-14T20:43:47.3518644Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.3519681Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.3520543Z experiments which the user could be opted in to. 2025-08-14T20:43:47.3521205Z  2025-08-14T20:43:47.3521788Z The user list has the following rules: 2025-08-14T20:43:47.3522359Z  2025-08-14T20:43:47.3523019Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.3523985Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.3524887Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.3525632Z  2025-08-14T20:43:47.3526158Z Example config: 2025-08-14T20:43:47.3526770Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.3527574Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.3528331Z  # Expected syntax is: 2025-08-14T20:43:47.3529097Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.3530178Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.3531107Z  2025-08-14T20:43:47.3531523Z  experiments: 2025-08-14T20:43:47.3532059Z  lf: 2025-08-14T20:43:47.3532542Z  rollout_percent: 25 2025-08-14T20:43:47.3533143Z  all_branches: false 2025-08-14T20:43:47.3533676Z  default: true 2025-08-14T20:43:47.3534241Z  --- 2025-08-14T20:43:47.3534715Z  2025-08-14T20:43:47.3535260Z  # Opt-ins: 2025-08-14T20:43:47.3536019Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.3537174Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.3538091Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.3538817Z  # Experiments should be from the above list. 2025-08-14T20:43:47.3539525Z  2025-08-14T20:43:47.3540017Z  @User1,-lf,split_build 2025-08-14T20:43:47.3540588Z  @User2,lf 2025-08-14T20:43:47.3541130Z  @User3,split_build 2025-08-14T20:43:47.3541638Z """ 2025-08-14T20:43:47.3542122Z  2025-08-14T20:43:47.3542557Z import json 2025-08-14T20:43:47.3543105Z import logging 2025-08-14T20:43:47.3543721Z import os 2025-08-14T20:43:47.3544202Z import random 2025-08-14T20:43:47.3544710Z import re 2025-08-14T20:43:47.3545268Z import sys 2025-08-14T20:43:47.3546079Z from argparse import ArgumentParser 2025-08-14T20:43:47.3546795Z from collections.abc import Iterable 2025-08-14T20:43:47.3547394Z from functools import cache 2025-08-14T20:43:47.3548098Z from logging import LogRecord 2025-08-14T20:43:47.3548694Z from typing import Any, NamedTuple 2025-08-14T20:43:47.3549364Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.3550024Z  2025-08-14T20:43:47.3550498Z import yaml 2025-08-14T20:43:47.3551069Z from github import Auth, Github 2025-08-14T20:43:47.3551679Z from github.Issue import Issue 2025-08-14T20:43:47.3552256Z  2025-08-14T20:43:47.3552637Z  2025-08-14T20:43:47.3553223Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.3554042Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.3555004Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.3556597Z  2025-08-14T20:43:47.3557110Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.3557791Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.3558462Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.3559186Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.3559828Z  2025-08-14T20:43:47.3560395Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.3560992Z  2025-08-14T20:43:47.3561407Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.3562101Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.3562615Z  2025-08-14T20:43:47.3563032Z  2025-08-14T20:43:47.3563532Z class Experiment(NamedTuple): 2025-08-14T20:43:47.3564140Z  rollout_perc: float = ( 2025-08-14T20:43:47.3564913Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.3566105Z  ) 2025-08-14T20:43:47.3566655Z  all_branches: bool = ( 2025-08-14T20:43:47.3567397Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.3568212Z  ) 2025-08-14T20:43:47.3568681Z  default: bool = ( 2025-08-14T20:43:47.3569385Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.3570213Z  ) 2025-08-14T20:43:47.3570628Z  2025-08-14T20:43:47.3571087Z  # Add more fields as needed 2025-08-14T20:43:47.3571694Z  2025-08-14T20:43:47.3572122Z  2025-08-14T20:43:47.3572550Z class Settings(NamedTuple): 2025-08-14T20:43:47.3573201Z  """ 2025-08-14T20:43:47.3573798Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.3574437Z  """ 2025-08-14T20:43:47.3574939Z  2025-08-14T20:43:47.3575539Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.3576156Z  2025-08-14T20:43:47.3576771Z  2025-08-14T20:43:47.3577325Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.3578050Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.3578777Z  2025-08-14T20:43:47.3579261Z  COLORS = { 2025-08-14T20:43:47.3579771Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.3580481Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.3581060Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.3581678Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.3582329Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.3582874Z  } 2025-08-14T20:43:47.3583327Z  2025-08-14T20:43:47.3583886Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.3584777Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.3585915Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.3586704Z  return super().format(record) 2025-08-14T20:43:47.3587300Z  2025-08-14T20:43:47.3587693Z  2025-08-14T20:43:47.3665219Z handler = logging.StreamHandler() 2025-08-14T20:43:47.3666577Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.3667843Z  2025-08-14T20:43:47.3668611Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.3669701Z log.addHandler(handler) 2025-08-14T20:43:47.3670606Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.3671137Z  2025-08-14T20:43:47.3671478Z  2025-08-14T20:43:47.3671947Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.3672532Z  """ 2025-08-14T20:43:47.3673085Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.3674070Z  """ 2025-08-14T20:43:47.3674462Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.3675866Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.3676990Z  log.warning( 2025-08-14T20:43:47.3677883Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.3678780Z  ) 2025-08-14T20:43:47.3679239Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.3679786Z  return 2025-08-14T20:43:47.3680185Z  2025-08-14T20:43:47.3680572Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.3681171Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.3681750Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.3682237Z  2025-08-14T20:43:47.3682584Z  2025-08-14T20:43:47.3683087Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.3683741Z  return frozenset( 2025-08-14T20:43:47.3684386Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.3685801Z  ) 2025-08-14T20:43:47.3686223Z  2025-08-14T20:43:47.3686563Z  2025-08-14T20:43:47.3686926Z def parse_args() -> Any: 2025-08-14T20:43:47.3687529Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.3688411Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.3689160Z  parser.add_argument( 2025-08-14T20:43:47.3689649Z  "--github-issue-repo", 2025-08-14T20:43:47.3690135Z  type=str, 2025-08-14T20:43:47.3690584Z  required=False, 2025-08-14T20:43:47.3691259Z  default="pytorch/test-infra", 2025-08-14T20:43:47.3691828Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.3692347Z  ) 2025-08-14T20:43:47.3692728Z  parser.add_argument( 2025-08-14T20:43:47.3693205Z  "--github-repo", 2025-08-14T20:43:47.3693665Z  type=str, 2025-08-14T20:43:47.3694104Z  required=True, 2025-08-14T20:43:47.3694609Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.3695859Z  ) 2025-08-14T20:43:47.3696261Z  parser.add_argument( 2025-08-14T20:43:47.3696905Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.3697555Z  ) 2025-08-14T20:43:47.3697937Z  parser.add_argument( 2025-08-14T20:43:47.3698606Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.3699301Z  ) 2025-08-14T20:43:47.3699678Z  parser.add_argument( 2025-08-14T20:43:47.3700358Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.3701033Z  ) 2025-08-14T20:43:47.3701414Z  parser.add_argument( 2025-08-14T20:43:47.3702104Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.3702821Z  ) 2025-08-14T20:43:47.3703202Z  parser.add_argument( 2025-08-14T20:43:47.3703669Z  "--github-ref-type", 2025-08-14T20:43:47.3704146Z  type=str, 2025-08-14T20:43:47.3704583Z  required=True, 2025-08-14T20:43:47.3705330Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.3705972Z  ) 2025-08-14T20:43:47.3706353Z  parser.add_argument( 2025-08-14T20:43:47.3707017Z  "--eligible-experiments", 2025-08-14T20:43:47.3707566Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.3708097Z  required=False, 2025-08-14T20:43:47.3708551Z  default="", 2025-08-14T20:43:47.3709432Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.3710340Z  ) 2025-08-14T20:43:47.3710722Z  parser.add_argument( 2025-08-14T20:43:47.3711221Z  "--opt-out-experiments", 2025-08-14T20:43:47.3711751Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.3712278Z  required=False, 2025-08-14T20:43:47.3712743Z  default="", 2025-08-14T20:43:47.3713174Z  help=( 2025-08-14T20:43:47.3713878Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.3715005Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.3715946Z  ), 2025-08-14T20:43:47.3716314Z  ) 2025-08-14T20:43:47.3716696Z  parser.add_argument( 2025-08-14T20:43:47.3717168Z  "--pr-number", 2025-08-14T20:43:47.3717611Z  type=str, 2025-08-14T20:43:47.3718051Z  required=False, 2025-08-14T20:43:47.3718507Z  default="", 2025-08-14T20:43:47.3719036Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.3719590Z  ) 2025-08-14T20:43:47.3719947Z  2025-08-14T20:43:47.3720318Z  return parser.parse_args() 2025-08-14T20:43:47.3720801Z  2025-08-14T20:43:47.3721133Z  2025-08-14T20:43:47.3721732Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.3722637Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.3723157Z  return Github(auth=auth) 2025-08-14T20:43:47.3723630Z  2025-08-14T20:43:47.3723959Z  2025-08-14T20:43:47.3724604Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.3725686Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.3726223Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.3726733Z  2025-08-14T20:43:47.3727058Z  2025-08-14T20:43:47.3727433Z def get_potential_pr_author( 2025-08-14T20:43:47.3728107Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.3728775Z ) -> str: 2025-08-14T20:43:47.3729313Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.3730120Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.3730891Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.3731502Z  2025-08-14T20:43:47.3731890Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.3732385Z  2025-08-14T20:43:47.3732878Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.3733510Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.3734014Z  if ( 2025-08-14T20:43:47.3734425Z  len(split_tag) == 3 2025-08-14T20:43:47.3734940Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.3735658Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.3736146Z  ): 2025-08-14T20:43:47.3736565Z  pr_number = split_tag[2] 2025-08-14T20:43:47.3737057Z  try: 2025-08-14T20:43:47.3737524Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.3738319Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.3738928Z  except Exception as e: 2025-08-14T20:43:47.3739469Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.3740147Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.3740779Z  ) from e 2025-08-14T20:43:47.3741345Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.3742059Z  # In all other cases, return the original input username 2025-08-14T20:43:47.3742652Z  return username 2025-08-14T20:43:47.3743064Z  2025-08-14T20:43:47.3743403Z  2025-08-14T20:43:47.3743826Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.3744356Z  """ 2025-08-14T20:43:47.3745019Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.3745899Z  """ 2025-08-14T20:43:47.3746465Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.3747117Z  2025-08-14T20:43:47.3747451Z  2025-08-14T20:43:47.3747829Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.3748331Z  try: 2025-08-14T20:43:47.3748743Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.3749266Z  return data 2025-08-14T20:43:47.3749713Z  except yaml.YAMLError: 2025-08-14T20:43:47.3750238Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.3750759Z  raise 2025-08-14T20:43:47.3751141Z  2025-08-14T20:43:47.3751473Z  2025-08-14T20:43:47.3752079Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.3752811Z  """ 2025-08-14T20:43:47.3753572Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.3754315Z  2025-08-14T20:43:47.3754854Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.3755715Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.3756261Z  2025-08-14T20:43:47.3756822Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.3757507Z  """ 2025-08-14T20:43:47.3757967Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.3758563Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.3759181Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.3759761Z  else: 2025-08-14T20:43:47.3760162Z  return "", rollout_state 2025-08-14T20:43:47.3760632Z  2025-08-14T20:43:47.3760956Z  2025-08-14T20:43:47.3761350Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.3761860Z  """ 2025-08-14T20:43:47.3762395Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.3763027Z  """ 2025-08-14T20:43:47.3763372Z  2025-08-14T20:43:47.3763693Z  2025-08-14T20:43:47.3764220Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.3764858Z  """ 2025-08-14T20:43:47.3765924Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.3766737Z  2025-08-14T20:43:47.3767530Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.3768509Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.3769352Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.3769969Z  2025-08-14T20:43:47.3770287Z  2025-08-14T20:43:47.3770609Z  """ 2025-08-14T20:43:47.3770986Z  optins = UserOptins() 2025-08-14T20:43:47.3771511Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.3772084Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.3772643Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.3773202Z  # Not a valid user. Skip 2025-08-14T20:43:47.3773687Z  continue 2025-08-14T20:43:47.3774096Z  2025-08-14T20:43:47.3774427Z  if user: 2025-08-14T20:43:47.3774902Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.3775701Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.3776338Z  2025-08-14T20:43:47.3776690Z  return optins 2025-08-14T20:43:47.3777097Z  2025-08-14T20:43:47.3777444Z  2025-08-14T20:43:47.3777929Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.3778535Z  """ 2025-08-14T20:43:47.3778943Z  Check if the experiment name is valid. 2025-08-14T20:43:47.3779466Z  A valid name: 2025-08-14T20:43:47.3780144Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.3781061Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.3781768Z  - Cannot contain spaces 2025-08-14T20:43:47.3782235Z  """ 2025-08-14T20:43:47.3782590Z  2025-08-14T20:43:47.3783038Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.3783763Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.3784530Z  2025-08-14T20:43:47.3784872Z  if valid: 2025-08-14T20:43:47.3785433Z  return True 2025-08-14T20:43:47.3785839Z  2025-08-14T20:43:47.3786465Z  log.error( 2025-08-14T20:43:47.3787972Z  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-08-14T20:43:47.3789443Z  ) 2025-08-14T20:43:47.3789811Z  return False 2025-08-14T20:43:47.3790205Z  2025-08-14T20:43:47.3790526Z  2025-08-14T20:43:47.3791031Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.3791662Z  """ 2025-08-14T20:43:47.3792262Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.3792971Z  """ 2025-08-14T20:43:47.3793334Z  try: 2025-08-14T20:43:47.3793707Z  if settings_text: 2025-08-14T20:43:47.3794455Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.3795323Z  # for easy reading 2025-08-14T20:43:47.3796135Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.3797023Z  # the backtick character in shell commands. 2025-08-14T20:43:47.3797627Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.3798297Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.3798954Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.3799458Z  2025-08-14T20:43:47.3800188Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.3800923Z  experiments = {} 2025-08-14T20:43:47.3801378Z  2025-08-14T20:43:47.3801923Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.3802678Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.3803761Z  # 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-08-14T20:43:47.3804761Z  continue 2025-08-14T20:43:47.3805471Z  2025-08-14T20:43:47.3805869Z  valid_settings = {} 2025-08-14T20:43:47.3806404Z  for setting in exp_settings: 2025-08-14T20:43:47.3806969Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.3807541Z  log.warning( 2025-08-14T20:43:47.3808254Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.3808953Z  ) 2025-08-14T20:43:47.3809397Z  else: 2025-08-14T20:43:47.3809931Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.3810496Z  2025-08-14T20:43:47.3810958Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.3811598Z  return Settings(experiments) 2025-08-14T20:43:47.3812249Z  2025-08-14T20:43:47.3812610Z  except Exception: 2025-08-14T20:43:47.3813122Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.3813639Z  2025-08-14T20:43:47.3813981Z  return Settings() 2025-08-14T20:43:47.3814395Z  2025-08-14T20:43:47.3814724Z  2025-08-14T20:43:47.3815556Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.3816155Z  """ 2025-08-14T20:43:47.3816609Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.3817153Z  2025-08-14T20:43:47.3817688Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.3818438Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.3818981Z  2025-08-14T20:43:47.3819573Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.3820282Z  """ 2025-08-14T20:43:47.3820850Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.3821613Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.3822149Z  2025-08-14T20:43:47.3822474Z  2025-08-14T20:43:47.3822925Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.3823481Z  """ 2025-08-14T20:43:47.3823887Z  Parse users from the rollout state. 2025-08-14T20:43:47.3824377Z  2025-08-14T20:43:47.3824699Z  """ 2025-08-14T20:43:47.3825365Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.3826117Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.3826653Z  2025-08-14T20:43:47.3826970Z  2025-08-14T20:43:47.3827587Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.3828315Z  """ 2025-08-14T20:43:47.3828747Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.3829267Z  """ 2025-08-14T20:43:47.3829741Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.3830426Z  2025-08-14T20:43:47.3830743Z  2025-08-14T20:43:47.3831405Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.3832135Z  """ 2025-08-14T20:43:47.3832616Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.3833169Z  """ 2025-08-14T20:43:47.3833700Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.3834396Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.3835032Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.3835741Z  return False 2025-08-14T20:43:47.3836151Z  2025-08-14T20:43:47.3836605Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.3837189Z  log.warning( 2025-08-14T20:43:47.3838016Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.3838849Z  ) 2025-08-14T20:43:47.3839209Z  2025-08-14T20:43:47.3839546Z  return True 2025-08-14T20:43:47.3839933Z  2025-08-14T20:43:47.3840252Z  2025-08-14T20:43:47.3840601Z def get_runner_prefix( 2025-08-14T20:43:47.3841058Z  rollout_state: str, 2025-08-14T20:43:47.3841549Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.3842061Z  branch: str, 2025-08-14T20:43:47.3842584Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.3843260Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.3843840Z  is_canary: bool = False, 2025-08-14T20:43:47.3844292Z ) -> str: 2025-08-14T20:43:47.3844732Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.3845633Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.3846160Z  2025-08-14T20:43:47.3846639Z  fleet_prefix = "" 2025-08-14T20:43:47.3847092Z  prefixes = [] 2025-08-14T20:43:47.3847783Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.3848710Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.3849411Z  log.info( 2025-08-14T20:43:47.3850110Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.3850833Z  ) 2025-08-14T20:43:47.3851229Z  continue 2025-08-14T20:43:47.3851635Z  2025-08-14T20:43:47.3852002Z  if opt_out_experiments: 2025-08-14T20:43:47.3852550Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.3853192Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.3853767Z  log.info( 2025-08-14T20:43:47.3854693Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.3855837Z  ) 2025-08-14T20:43:47.3856244Z  continue 2025-08-14T20:43:47.3856678Z  2025-08-14T20:43:47.3857039Z  if eligible_experiments: 2025-08-14T20:43:47.3857628Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.3858260Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.3858805Z  log.info( 2025-08-14T20:43:47.3859599Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.3860390Z  ) 2025-08-14T20:43:47.3860985Z  continue 2025-08-14T20:43:47.3861498Z  elif not experiment_settings.default: 2025-08-14T20:43:47.3862024Z  log.info( 2025-08-14T20:43:47.3862711Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.3863416Z  ) 2025-08-14T20:43:47.3863808Z  continue 2025-08-14T20:43:47.3864214Z  2025-08-14T20:43:47.3864675Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.3865397Z  opted_out_users = [ 2025-08-14T20:43:47.3865871Z  requestor 2025-08-14T20:43:47.3866353Z  for requestor in workflow_requestors 2025-08-14T20:43:47.3867023Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.3867633Z  ] 2025-08-14T20:43:47.3867995Z  2025-08-14T20:43:47.3868349Z  if opted_out_users: 2025-08-14T20:43:47.3868825Z  log.info( 2025-08-14T20:43:47.3869460Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.3870124Z  ) 2025-08-14T20:43:47.3870524Z  continue 2025-08-14T20:43:47.3870931Z  2025-08-14T20:43:47.3871381Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.3871980Z  opted_in_users = [ 2025-08-14T20:43:47.3872431Z  requestor 2025-08-14T20:43:47.3872911Z  for requestor in workflow_requestors 2025-08-14T20:43:47.3873569Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.3874170Z  ] 2025-08-14T20:43:47.3874526Z  2025-08-14T20:43:47.3874869Z  enabled = False 2025-08-14T20:43:47.3875430Z  if opted_in_users: 2025-08-14T20:43:47.3876035Z  log.info( 2025-08-14T20:43:47.3876674Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.3877321Z  ) 2025-08-14T20:43:47.3877722Z  enabled = True 2025-08-14T20:43:47.3878157Z  2025-08-14T20:43:47.3878557Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.3879371Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.3880276Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.3880909Z  log.info( 2025-08-14T20:43:47.3881771Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.3882661Z  ) 2025-08-14T20:43:47.3883089Z  enabled = True 2025-08-14T20:43:47.3883542Z  2025-08-14T20:43:47.3883883Z  if enabled: 2025-08-14T20:43:47.3884331Z  label = experiment_name 2025-08-14T20:43:47.3884897Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.3886045Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.3886906Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.3887659Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.3888295Z  if is_canary: 2025-08-14T20:43:47.3888806Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.3889335Z  fleet_prefix = label 2025-08-14T20:43:47.3889991Z  else: 2025-08-14T20:43:47.3890453Z  prefixes.append(label) 2025-08-14T20:43:47.3890939Z  2025-08-14T20:43:47.3891293Z  if len(prefixes) > 1: 2025-08-14T20:43:47.3891744Z  log.error( 2025-08-14T20:43:47.3892783Z  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-08-14T20:43:47.3893823Z  ) 2025-08-14T20:43:47.3894221Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.3894689Z  2025-08-14T20:43:47.3895036Z  # Fleet always comes first 2025-08-14T20:43:47.3895637Z  if fleet_prefix: 2025-08-14T20:43:47.3896104Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.3896600Z  2025-08-14T20:43:47.3897031Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.3897597Z  2025-08-14T20:43:47.3897915Z  2025-08-14T20:43:47.3898539Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.3899281Z  """ 2025-08-14T20:43:47.3899864Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.3900541Z  2025-08-14T20:43:47.3901095Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.3901785Z  """ 2025-08-14T20:43:47.3902184Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.3902734Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.3903377Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.3904006Z  2025-08-14T20:43:47.3904328Z  2025-08-14T20:43:47.3904904Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.3905906Z  for _ in range(num_retries): 2025-08-14T20:43:47.3906385Z  try: 2025-08-14T20:43:47.3906836Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.3907492Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.3908120Z  return json.loads(content) 2025-08-14T20:43:47.3908641Z  except Exception as e: 2025-08-14T20:43:47.3909193Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.3909728Z  2025-08-14T20:43:47.3910293Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.3910989Z  return {} 2025-08-14T20:43:47.3911376Z  2025-08-14T20:43:47.3911694Z  2025-08-14T20:43:47.3912018Z @cache 2025-08-14T20:43:47.3912653Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.3913389Z  """ 2025-08-14T20:43:47.3913792Z  Dynamically get PR information 2025-08-14T20:43:47.3914284Z  """ 2025-08-14T20:43:47.3914785Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.3915515Z  headers = { 2025-08-14T20:43:47.3916004Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.3916604Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.3917123Z  } 2025-08-14T20:43:47.3917558Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.3918166Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.3918697Z  headers=headers, 2025-08-14T20:43:47.3919145Z  ) 2025-08-14T20:43:47.3919490Z  2025-08-14T20:43:47.3919842Z  if not json_response: 2025-08-14T20:43:47.3920576Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.3921188Z  return {} 2025-08-14T20:43:47.3921598Z  2025-08-14T20:43:47.3921945Z  return json_response 2025-08-14T20:43:47.3922381Z  2025-08-14T20:43:47.3922698Z  2025-08-14T20:43:47.3923275Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.3923977Z  """ 2025-08-14T20:43:47.3924513Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.3925375Z  """ 2025-08-14T20:43:47.3925935Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.3926535Z  return { 2025-08-14T20:43:47.3927128Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.3927787Z  } 2025-08-14T20:43:47.3928145Z  2025-08-14T20:43:47.3928480Z  2025-08-14T20:43:47.3928977Z def main() -> None: 2025-08-14T20:43:47.3929477Z  args = parse_args() 2025-08-14T20:43:47.3929974Z  2025-08-14T20:43:47.3930422Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.3930991Z  2025-08-14T20:43:47.3931357Z  # Check if the PR is opt-out 2025-08-14T20:43:47.3931856Z  if args.pr_number: 2025-08-14T20:43:47.3932531Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.3933267Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.3933761Z  log.info( 2025-08-14T20:43:47.3934458Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.3935659Z  ) 2025-08-14T20:43:47.3936261Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.3936936Z  sys.exit() 2025-08-14T20:43:47.3937531Z  2025-08-14T20:43:47.3937867Z  try: 2025-08-14T20:43:47.3938326Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.3939031Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.3939651Z  ) 2025-08-14T20:43:47.3940013Z  2025-08-14T20:43:47.3940402Z  username = get_potential_pr_author( 2025-08-14T20:43:47.3940939Z  args.github_token, 2025-08-14T20:43:47.3941433Z  args.github_repo, 2025-08-14T20:43:47.3941917Z  args.github_actor, 2025-08-14T20:43:47.3942414Z  args.github_ref_type, 2025-08-14T20:43:47.3942919Z  args.github_branch, 2025-08-14T20:43:47.3943373Z  ) 2025-08-14T20:43:47.3943735Z  2025-08-14T20:43:47.3944211Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.3944802Z  2025-08-14T20:43:47.3945370Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.3946020Z  rollout_state, 2025-08-14T20:43:47.3946536Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.3947071Z  args.github_branch, 2025-08-14T20:43:47.3947589Z  args.eligible_experiments, 2025-08-14T20:43:47.3948119Z  args.opt_out_experiments, 2025-08-14T20:43:47.3948627Z  is_canary, 2025-08-14T20:43:47.3949070Z  ) 2025-08-14T20:43:47.3949430Z  2025-08-14T20:43:47.3949788Z  except Exception as e: 2025-08-14T20:43:47.3950250Z  log.error( 2025-08-14T20:43:47.3950939Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.3951800Z  ) 2025-08-14T20:43:47.3952281Z  2025-08-14T20:43:47.3952794Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.3953427Z  2025-08-14T20:43:47.3953746Z  2025-08-14T20:43:47.3954091Z if __name__ == "__main__": 2025-08-14T20:43:47.3954540Z  main() 2025-08-14T20:43:47.3954903Z  2025-08-14T20:43:47.3955350Z EOF 2025-08-14T20:43:47.3955690Z  2025-08-14T20:43:47.3956046Z cat runner_determinator.py 2025-08-14T20:43:47.4222498Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.4223342Z env: 2025-08-14T20:43:47.4224052Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.4224456Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.4224903Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.4225760Z ISSUE_OWNER: 2025-08-14T20:43:47.4226158Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.4226573Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.4227000Z PR_NUMBER: 2025-08-14T20:43:47.4227375Z ##[endgroup] 2025-08-14T20:43:47.4503027Z # flake8: noqa: G004 2025-08-14T20:43:47.4503586Z 2025-08-14T20:43:47.4504369Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.4506267Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.4507670Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.4508453Z 2025-08-14T20:43:47.4508739Z """ 2025-08-14T20:43:47.4509758Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.4511329Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.4512977Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.4514421Z of which runners should be used to run which job. 2025-08-14T20:43:47.4516099Z 2025-08-14T20:43:47.4516511Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.4517681Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.4518555Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.4519223Z list, defined. 2025-08-14T20:43:47.4519442Z 2025-08-14T20:43:47.4519781Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.4520652Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.4521456Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.4521882Z 2025-08-14T20:43:47.4522233Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.4523064Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.4523780Z experiments which the user could be opted in to. 2025-08-14T20:43:47.4524168Z 2025-08-14T20:43:47.4524344Z The user list has the following rules: 2025-08-14T20:43:47.4524693Z 2025-08-14T20:43:47.4524998Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.4526027Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.4526754Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.4527138Z 2025-08-14T20:43:47.4527298Z Example config: 2025-08-14T20:43:47.4527714Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.4528364Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.4528967Z # Expected syntax is: 2025-08-14T20:43:47.4529582Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.4530526Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.4531125Z 2025-08-14T20:43:47.4531276Z experiments: 2025-08-14T20:43:47.4531639Z lf: 2025-08-14T20:43:47.4531982Z rollout_percent: 25 2025-08-14T20:43:47.4532632Z all_branches: false 2025-08-14T20:43:47.4533045Z default: true 2025-08-14T20:43:47.4533426Z --- 2025-08-14T20:43:47.4533618Z 2025-08-14T20:43:47.4533762Z # Opt-ins: 2025-08-14T20:43:47.4534312Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.4535339Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.4536176Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.4536806Z # Experiments should be from the above list. 2025-08-14T20:43:47.4537185Z 2025-08-14T20:43:47.4537349Z @User1,-lf,split_build 2025-08-14T20:43:47.4537765Z @User2,lf 2025-08-14T20:43:47.4538124Z @User3,split_build 2025-08-14T20:43:47.4538508Z """ 2025-08-14T20:43:47.4538685Z 2025-08-14T20:43:47.4538834Z import json 2025-08-14T20:43:47.4539190Z import logging 2025-08-14T20:43:47.4539549Z import os 2025-08-14T20:43:47.4539897Z import random 2025-08-14T20:43:47.4540252Z import re 2025-08-14T20:43:47.4540581Z import sys 2025-08-14T20:43:47.4540960Z from argparse import ArgumentParser 2025-08-14T20:43:47.4541462Z from collections.abc import Iterable 2025-08-14T20:43:47.4541968Z from functools import cache 2025-08-14T20:43:47.4542410Z from logging import LogRecord 2025-08-14T20:43:47.4542870Z from typing import Any, NamedTuple 2025-08-14T20:43:47.4543365Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.4543733Z 2025-08-14T20:43:47.4543877Z import yaml 2025-08-14T20:43:47.4544243Z from github import Auth, Github 2025-08-14T20:43:47.4544700Z from github.Issue import Issue 2025-08-14T20:43:47.4544990Z 2025-08-14T20:43:47.4544996Z 2025-08-14T20:43:47.4545450Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.4546113Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.4546938Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.4547483Z 2025-08-14T20:43:47.4547698Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.4548398Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.4548900Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.4549422Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.4549762Z 2025-08-14T20:43:47.4549947Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.4550269Z 2025-08-14T20:43:47.4550439Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.4550867Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.4551136Z 2025-08-14T20:43:47.4551143Z 2025-08-14T20:43:47.4551314Z class Experiment(NamedTuple): 2025-08-14T20:43:47.4551760Z rollout_perc: float = ( 2025-08-14T20:43:47.4552364Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.4553011Z ) 2025-08-14T20:43:47.4553347Z all_branches: bool = ( 2025-08-14T20:43:47.4553934Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.4554589Z ) 2025-08-14T20:43:47.4554910Z default: bool = ( 2025-08-14T20:43:47.4555647Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.4556255Z ) 2025-08-14T20:43:47.4556439Z 2025-08-14T20:43:47.4556601Z # Add more fields as needed 2025-08-14T20:43:47.4556889Z 2025-08-14T20:43:47.4556895Z 2025-08-14T20:43:47.4557073Z class Settings(NamedTuple): 2025-08-14T20:43:47.4557478Z """ 2025-08-14T20:43:47.4557898Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.4558437Z """ 2025-08-14T20:43:47.4558624Z 2025-08-14T20:43:47.4558811Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.4559158Z 2025-08-14T20:43:47.4559164Z 2025-08-14T20:43:47.4559353Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.4559951Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.4560375Z 2025-08-14T20:43:47.4560524Z COLORS = { 2025-08-14T20:43:47.4560885Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.4561524Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.4561988Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.4562457Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.4562908Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.4563404Z } 2025-08-14T20:43:47.4563586Z 2025-08-14T20:43:47.4563787Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.4564537Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.4565607Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.4566165Z return super().format(record) 2025-08-14T20:43:47.4566485Z 2025-08-14T20:43:47.4566501Z 2025-08-14T20:43:47.4566678Z handler = logging.StreamHandler() 2025-08-14T20:43:47.4567335Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.4567885Z 2025-08-14T20:43:47.4568110Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.4568664Z log.addHandler(handler) 2025-08-14T20:43:47.4569086Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.4569358Z 2025-08-14T20:43:47.4569364Z 2025-08-14T20:43:47.4569600Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.4570125Z """ 2025-08-14T20:43:47.4570594Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.4571184Z """ 2025-08-14T20:43:47.4571523Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.4572534Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.4573629Z log.warning( 2025-08-14T20:43:47.4574414Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.4575522Z ) 2025-08-14T20:43:47.4586413Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.4586996Z return 2025-08-14T20:43:47.4587235Z 2025-08-14T20:43:47.4587598Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.4588178Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.4588751Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.4589064Z 2025-08-14T20:43:47.4589071Z 2025-08-14T20:43:47.4589362Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.4589974Z return frozenset( 2025-08-14T20:43:47.4590553Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.4591206Z ) 2025-08-14T20:43:47.4591393Z 2025-08-14T20:43:47.4591400Z 2025-08-14T20:43:47.4591564Z def parse_args() -> Any: 2025-08-14T20:43:47.4592077Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.4592893Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.4593631Z parser.add_argument( 2025-08-14T20:43:47.4594052Z "--github-issue-repo", 2025-08-14T20:43:47.4594481Z type=str, 2025-08-14T20:43:47.4594853Z required=False, 2025-08-14T20:43:47.4595642Z default="pytorch/test-infra", 2025-08-14T20:43:47.4596154Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.4596627Z ) 2025-08-14T20:43:47.4596961Z parser.add_argument( 2025-08-14T20:43:47.4597383Z "--github-repo", 2025-08-14T20:43:47.4597775Z type=str, 2025-08-14T20:43:47.4598133Z required=True, 2025-08-14T20:43:47.4598561Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.4599045Z ) 2025-08-14T20:43:47.4599377Z parser.add_argument( 2025-08-14T20:43:47.4599935Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.4600572Z ) 2025-08-14T20:43:47.4600936Z parser.add_argument( 2025-08-14T20:43:47.4601511Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.4602155Z ) 2025-08-14T20:43:47.4602669Z parser.add_argument( 2025-08-14T20:43:47.4603282Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.4603957Z ) 2025-08-14T20:43:47.4604298Z parser.add_argument( 2025-08-14T20:43:47.4604909Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.4605885Z ) 2025-08-14T20:43:47.4606220Z parser.add_argument( 2025-08-14T20:43:47.4606637Z "--github-ref-type", 2025-08-14T20:43:47.4607055Z type=str, 2025-08-14T20:43:47.4607422Z required=True, 2025-08-14T20:43:47.4607861Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.4608400Z ) 2025-08-14T20:43:47.4608734Z parser.add_argument( 2025-08-14T20:43:47.4609158Z "--eligible-experiments", 2025-08-14T20:43:47.4609643Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4610124Z required=False, 2025-08-14T20:43:47.4610514Z default="", 2025-08-14T20:43:47.4611328Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.4612226Z ) 2025-08-14T20:43:47.4612553Z parser.add_argument( 2025-08-14T20:43:47.4612981Z "--opt-out-experiments", 2025-08-14T20:43:47.4613449Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4613934Z required=False, 2025-08-14T20:43:47.4614317Z default="", 2025-08-14T20:43:47.4614667Z help=( 2025-08-14T20:43:47.4615394Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.4616479Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.4617279Z ), 2025-08-14T20:43:47.4617590Z ) 2025-08-14T20:43:47.4617926Z parser.add_argument( 2025-08-14T20:43:47.4618319Z "--pr-number", 2025-08-14T20:43:47.4618704Z type=str, 2025-08-14T20:43:47.4619077Z required=False, 2025-08-14T20:43:47.4619460Z default="", 2025-08-14T20:43:47.4620032Z help="the optional PR number where this is run", 2025-08-14T20:43:47.4620557Z ) 2025-08-14T20:43:47.4620733Z 2025-08-14T20:43:47.4620909Z return parser.parse_args() 2025-08-14T20:43:47.4621197Z 2025-08-14T20:43:47.4621204Z 2025-08-14T20:43:47.4621579Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.4622307Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.4622777Z return Github(auth=auth) 2025-08-14T20:43:47.4623064Z 2025-08-14T20:43:47.4623070Z 2025-08-14T20:43:47.4623484Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.4624252Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.4624712Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.4625164Z 2025-08-14T20:43:47.4625171Z 2025-08-14T20:43:47.4625338Z def get_potential_pr_author( 2025-08-14T20:43:47.4625949Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.4626590Z ) -> str: 2025-08-14T20:43:47.4627062Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.4627812Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.4628519Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.4628916Z 2025-08-14T20:43:47.4629087Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.4629412Z 2025-08-14T20:43:47.4629656Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.4630242Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.4630711Z if ( 2025-08-14T20:43:47.4631065Z len(split_tag) == 3 2025-08-14T20:43:47.4631513Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.4632016Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.4632477Z ): 2025-08-14T20:43:47.4632971Z pr_number = split_tag[2] 2025-08-14T20:43:47.4633415Z try: 2025-08-14T20:43:47.4633822Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.4687241Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.4688519Z except Exception as e: 2025-08-14T20:43:47.4689305Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.4689980Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.4690584Z ) from e 2025-08-14T20:43:47.4691099Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.4691765Z # In all other cases, return the original input username 2025-08-14T20:43:47.4692301Z return username 2025-08-14T20:43:47.4692522Z 2025-08-14T20:43:47.4692537Z 2025-08-14T20:43:47.4692743Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.4693229Z """ 2025-08-14T20:43:47.4693834Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.4694576Z """ 2025-08-14T20:43:47.4695328Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.4695892Z 2025-08-14T20:43:47.4695899Z 2025-08-14T20:43:47.4696087Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.4696538Z try: 2025-08-14T20:43:47.4696895Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.4697375Z return data 2025-08-14T20:43:47.4697763Z except yaml.YAMLError: 2025-08-14T20:43:47.4698201Z log.exception("Error loading YAML") 2025-08-14T20:43:47.4698673Z raise 2025-08-14T20:43:47.4698869Z 2025-08-14T20:43:47.4698875Z 2025-08-14T20:43:47.4699262Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.4699962Z """ 2025-08-14T20:43:47.4700554Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.4701157Z 2025-08-14T20:43:47.4701737Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.4702444Z and the text below is the list of opted in users. 2025-08-14T20:43:47.4702821Z 2025-08-14T20:43:47.4703166Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.4703816Z """ 2025-08-14T20:43:47.4704224Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.4704769Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.4705559Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.4706096Z else: 2025-08-14T20:43:47.4706443Z return "", rollout_state 2025-08-14T20:43:47.4706722Z 2025-08-14T20:43:47.4706728Z 2025-08-14T20:43:47.4706909Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.4707373Z """ 2025-08-14T20:43:47.4707854Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.4708435Z """ 2025-08-14T20:43:47.4708620Z 2025-08-14T20:43:47.4708627Z 2025-08-14T20:43:47.4708950Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.4709556Z """ 2025-08-14T20:43:47.4710217Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.4710856Z 2025-08-14T20:43:47.4711438Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.4712362Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.4712998Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.4713452Z 2025-08-14T20:43:47.4713458Z 2025-08-14T20:43:47.4713599Z """ 2025-08-14T20:43:47.4713939Z optins = UserOptins() 2025-08-14T20:43:47.4714382Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.4714891Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.4715808Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.4716337Z # Not a valid user. Skip 2025-08-14T20:43:47.4716784Z continue 2025-08-14T20:43:47.4717009Z 2025-08-14T20:43:47.4717152Z if user: 2025-08-14T20:43:47.4717549Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.4718184Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.4718641Z 2025-08-14T20:43:47.4718787Z return optins 2025-08-14T20:43:47.4719006Z 2025-08-14T20:43:47.4719011Z 2025-08-14T20:43:47.4719287Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.4719843Z """ 2025-08-14T20:43:47.4720199Z Check if the experiment name is valid. 2025-08-14T20:43:47.4720670Z A valid name: 2025-08-14T20:43:47.4721260Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.4722129Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.4722823Z - Cannot contain spaces 2025-08-14T20:43:47.4723241Z """ 2025-08-14T20:43:47.4723428Z 2025-08-14T20:43:47.4723669Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.4724320Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.4724730Z 2025-08-14T20:43:47.4724870Z if valid: 2025-08-14T20:43:47.4725600Z return True 2025-08-14T20:43:47.4725864Z 2025-08-14T20:43:47.4726011Z log.error( 2025-08-14T20:43:47.4727374Z 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-08-14T20:43:47.4728883Z ) 2025-08-14T20:43:47.4729199Z return False 2025-08-14T20:43:47.4729410Z 2025-08-14T20:43:47.4729423Z 2025-08-14T20:43:47.4729709Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.4730310Z """ 2025-08-14T20:43:47.4731010Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.4731675Z """ 2025-08-14T20:43:47.4731996Z try: 2025-08-14T20:43:47.4732337Z if settings_text: 2025-08-14T20:43:47.4733006Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.4733734Z # for easy reading 2025-08-14T20:43:47.4734454Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.4735633Z # the backtick character in shell commands. 2025-08-14T20:43:47.4736196Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.4736812Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.4737425Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.4737771Z 2025-08-14T20:43:47.4738155Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.4738856Z experiments = {} 2025-08-14T20:43:47.4739123Z 2025-08-14T20:43:47.4739507Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.4740252Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.4741263Z # 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-08-14T20:43:47.4742222Z continue 2025-08-14T20:43:47.4742484Z 2025-08-14T20:43:47.4742677Z valid_settings = {} 2025-08-14T20:43:47.4743146Z for setting in exp_settings: 2025-08-14T20:43:47.4743678Z if setting not in Experiment._fields: 2025-08-14T20:43:47.4744185Z log.warning( 2025-08-14T20:43:47.4744844Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.4746415Z ) 2025-08-14T20:43:47.4746818Z else: 2025-08-14T20:43:47.4747298Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.4747688Z 2025-08-14T20:43:47.4747938Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.4748522Z return Settings(experiments) 2025-08-14T20:43:47.4748847Z 2025-08-14T20:43:47.4749002Z except Exception: 2025-08-14T20:43:47.4749470Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.4749825Z 2025-08-14T20:43:47.4749982Z return Settings() 2025-08-14T20:43:47.4750222Z 2025-08-14T20:43:47.4750228Z 2025-08-14T20:43:47.4750449Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.4750969Z """ 2025-08-14T20:43:47.4751353Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.4751724Z 2025-08-14T20:43:47.4752046Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.4752763Z and the text below is the list of opted in users. 2025-08-14T20:43:47.4753144Z 2025-08-14T20:43:47.4753517Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.4754189Z """ 2025-08-14T20:43:47.4754685Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.4755491Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.4755862Z 2025-08-14T20:43:47.4755868Z 2025-08-14T20:43:47.4756085Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.4756599Z """ 2025-08-14T20:43:47.4756942Z Parse users from the rollout state. 2025-08-14T20:43:47.4757270Z 2025-08-14T20:43:47.4757407Z """ 2025-08-14T20:43:47.4757890Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.4758557Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.4758933Z 2025-08-14T20:43:47.4758939Z 2025-08-14T20:43:47.4759463Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.4760148Z """ 2025-08-14T20:43:47.4760526Z Check if a user is opted into an experiment 2025-08-14T20:43:47.4761007Z """ 2025-08-14T20:43:47.4761412Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.4761793Z 2025-08-14T20:43:47.4761799Z 2025-08-14T20:43:47.4762184Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.4762875Z """ 2025-08-14T20:43:47.4763318Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.4763843Z """ 2025-08-14T20:43:47.4764299Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.4764909Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.4765796Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.4766378Z return False 2025-08-14T20:43:47.4766609Z 2025-08-14T20:43:47.4766854Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.4767404Z log.warning( 2025-08-14T20:43:47.4768129Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.4768936Z ) 2025-08-14T20:43:47.4769117Z 2025-08-14T20:43:47.4769264Z return True 2025-08-14T20:43:47.4769483Z 2025-08-14T20:43:47.4769489Z 2025-08-14T20:43:47.4769642Z def get_runner_prefix( 2025-08-14T20:43:47.4770042Z rollout_state: str, 2025-08-14T20:43:47.4770453Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.4770920Z branch: str, 2025-08-14T20:43:47.4771392Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.4772018Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.4772548Z is_canary: bool = False, 2025-08-14T20:43:47.4772964Z ) -> str: 2025-08-14T20:43:47.4773527Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.4774061Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.4774399Z 2025-08-14T20:43:47.4774562Z fleet_prefix = "" 2025-08-14T20:43:47.4774937Z prefixes = [] 2025-08-14T20:43:47.4775811Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.4776676Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.4777338Z log.info( 2025-08-14T20:43:47.4777964Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.4778661Z ) 2025-08-14T20:43:47.4778999Z continue 2025-08-14T20:43:47.4779233Z 2025-08-14T20:43:47.4779398Z if opt_out_experiments: 2025-08-14T20:43:47.4779888Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.4780465Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.4781042Z log.info( 2025-08-14T20:43:47.4781889Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.4782786Z ) 2025-08-14T20:43:47.4783134Z continue 2025-08-14T20:43:47.4783390Z 2025-08-14T20:43:47.4783553Z if eligible_experiments: 2025-08-14T20:43:47.4784055Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.4784631Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.4785356Z log.info( 2025-08-14T20:43:47.4786145Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.4786911Z ) 2025-08-14T20:43:47.4787263Z continue 2025-08-14T20:43:47.4787697Z elif not experiment_settings.default: 2025-08-14T20:43:47.4788187Z log.info( 2025-08-14T20:43:47.4788934Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.4789619Z ) 2025-08-14T20:43:47.4789949Z continue 2025-08-14T20:43:47.4790172Z 2025-08-14T20:43:47.4790433Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.4790993Z opted_out_users = [ 2025-08-14T20:43:47.4791394Z requestor 2025-08-14T20:43:47.4791800Z for requestor in workflow_requestors 2025-08-14T20:43:47.4792413Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.4792980Z ] 2025-08-14T20:43:47.4793168Z 2025-08-14T20:43:47.4793326Z if opted_out_users: 2025-08-14T20:43:47.4793739Z log.info( 2025-08-14T20:43:47.4794300Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.4794971Z ) 2025-08-14T20:43:47.4795495Z continue 2025-08-14T20:43:47.4795870Z 2025-08-14T20:43:47.4796279Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.4797239Z opted_in_users = [ 2025-08-14T20:43:47.4798002Z requestor 2025-08-14T20:43:47.4798731Z for requestor in workflow_requestors 2025-08-14T20:43:47.4799804Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.4800853Z ] 2025-08-14T20:43:47.4801209Z 2025-08-14T20:43:47.4801488Z enabled = False 2025-08-14T20:43:47.4802247Z if opted_in_users: 2025-08-14T20:43:47.4802979Z log.info( 2025-08-14T20:43:47.4804017Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.4805403Z ) 2025-08-14T20:43:47.4806111Z enabled = True 2025-08-14T20:43:47.4806608Z 2025-08-14T20:43:47.4807003Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.4808469Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.4810349Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.4811453Z log.info( 2025-08-14T20:43:47.4812902Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.4814393Z ) 2025-08-14T20:43:47.4815287Z enabled = True 2025-08-14T20:43:47.4815803Z 2025-08-14T20:43:47.4816064Z if enabled: 2025-08-14T20:43:47.4816678Z label = experiment_name 2025-08-14T20:43:47.4817555Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.4818980Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.4820590Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.4821690Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.4822832Z if is_canary: 2025-08-14T20:43:47.4823685Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.4824602Z fleet_prefix = label 2025-08-14T20:43:47.4825721Z else: 2025-08-14T20:43:47.4826459Z prefixes.append(label) 2025-08-14T20:43:47.4827059Z 2025-08-14T20:43:47.4827323Z if len(prefixes) > 1: 2025-08-14T20:43:47.4828013Z log.error( 2025-08-14T20:43:47.4829607Z 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-08-14T20:43:47.4831516Z ) 2025-08-14T20:43:47.4832168Z prefixes = prefixes[:1] 2025-08-14T20:43:47.4832693Z 2025-08-14T20:43:47.4833005Z # Fleet always comes first 2025-08-14T20:43:47.4833797Z if fleet_prefix: 2025-08-14T20:43:47.4834547Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.4835472Z 2025-08-14T20:43:47.4836186Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.4836939Z 2025-08-14T20:43:47.4836951Z 2025-08-14T20:43:47.4837703Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.4839053Z """ 2025-08-14T20:43:47.4840039Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.4840980Z 2025-08-14T20:43:47.4841657Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.4842901Z """ 2025-08-14T20:43:47.4843559Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.4844487Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.4845788Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.4846529Z 2025-08-14T20:43:47.4846540Z 2025-08-14T20:43:47.4847208Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.4848558Z for _ in range(num_retries): 2025-08-14T20:43:47.4849382Z try: 2025-08-14T20:43:47.4850096Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.4851220Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.4852253Z return json.loads(content) 2025-08-14T20:43:47.4852874Z except Exception as e: 2025-08-14T20:43:47.4853375Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.4853766Z 2025-08-14T20:43:47.4854114Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.4854770Z return {} 2025-08-14T20:43:47.4854971Z 2025-08-14T20:43:47.4854977Z 2025-08-14T20:43:47.4855352Z @cache 2025-08-14T20:43:47.4855980Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.4856668Z """ 2025-08-14T20:43:47.4857025Z Dynamically get PR information 2025-08-14T20:43:47.4857705Z """ 2025-08-14T20:43:47.4858169Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.4858751Z headers = { 2025-08-14T20:43:47.4859164Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.4859727Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.4860210Z } 2025-08-14T20:43:47.4860605Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.4861147Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.4861648Z headers=headers, 2025-08-14T20:43:47.4862029Z ) 2025-08-14T20:43:47.4862212Z 2025-08-14T20:43:47.4862374Z if not json_response: 2025-08-14T20:43:47.4862893Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.4863454Z return {} 2025-08-14T20:43:47.4863667Z 2025-08-14T20:43:47.4863832Z return json_response 2025-08-14T20:43:47.4864080Z 2025-08-14T20:43:47.4864086Z 2025-08-14T20:43:47.4864453Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.4865352Z """ 2025-08-14T20:43:47.4865869Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.4866464Z """ 2025-08-14T20:43:47.4866896Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.4867453Z return { 2025-08-14T20:43:47.4868002Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.4868633Z } 2025-08-14T20:43:47.4868813Z 2025-08-14T20:43:47.4868818Z 2025-08-14T20:43:47.4868980Z def main() -> None: 2025-08-14T20:43:47.4869350Z args = parse_args() 2025-08-14T20:43:47.4869603Z 2025-08-14T20:43:47.4869804Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.4870156Z 2025-08-14T20:43:47.4870324Z # Check if the PR is opt-out 2025-08-14T20:43:47.4870777Z if args.pr_number: 2025-08-14T20:43:47.4871376Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.4872195Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.4872655Z log.info( 2025-08-14T20:43:47.4873285Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.4873989Z ) 2025-08-14T20:43:47.4874480Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.4875326Z sys.exit() 2025-08-14T20:43:47.4875636Z 2025-08-14T20:43:47.4875789Z try: 2025-08-14T20:43:47.4876174Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.4876823Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.4877406Z ) 2025-08-14T20:43:47.4877588Z 2025-08-14T20:43:47.4877774Z username = get_potential_pr_author( 2025-08-14T20:43:47.4878263Z args.github_token, 2025-08-14T20:43:47.4878690Z args.github_repo, 2025-08-14T20:43:47.4879113Z args.github_actor, 2025-08-14T20:43:47.4879558Z args.github_ref_type, 2025-08-14T20:43:47.4880009Z args.github_branch, 2025-08-14T20:43:47.4880425Z ) 2025-08-14T20:43:47.4880610Z 2025-08-14T20:43:47.4880873Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.4881286Z 2025-08-14T20:43:47.4881478Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.4881981Z rollout_state, 2025-08-14T20:43:47.4882418Z (args.github_issue_owner, username), 2025-08-14T20:43:47.4882929Z args.github_branch, 2025-08-14T20:43:47.4883389Z args.eligible_experiments, 2025-08-14T20:43:47.4883887Z args.opt_out_experiments, 2025-08-14T20:43:47.4884347Z is_canary, 2025-08-14T20:43:47.4884715Z ) 2025-08-14T20:43:47.4884903Z 2025-08-14T20:43:47.4885288Z except Exception as e: 2025-08-14T20:43:47.4885769Z log.error( 2025-08-14T20:43:47.4886395Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.4887348Z ) 2025-08-14T20:43:47.4887667Z 2025-08-14T20:43:47.4888159Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.4888931Z 2025-08-14T20:43:47.4888940Z 2025-08-14T20:43:47.4889211Z if __name__ == "__main__": 2025-08-14T20:43:47.4889838Z main() 2025-08-14T20:43:47.4890174Z 2025-08-14T20:43:47.5024010Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.5025683Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.5069426Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.5069867Z env: 2025-08-14T20:43:47.5070474Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.5070856Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.5071258Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.5071723Z ISSUE_OWNER: 2025-08-14T20:43:47.5072083Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.5072481Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.5072880Z PR_NUMBER: 2025-08-14T20:43:47.5073234Z ##[endgroup] 2025-08-14T20:43:48.7029946Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.7702472Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.8097196Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.8264513Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 6.9 MB/s eta 0:00:00 2025-08-14T20:43:49.8530149Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.8592468Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.9028818Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:49.9064172Z 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-08-14T20:43:49.9112064Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:49.9131356Z 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-08-14T20:43:49.9146026Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:49.9401159Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:49.9435589Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:49.9667026Z 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-08-14T20:43:50.0914107Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.0959580Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:50.2107122Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:50.2150138Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:50.2391096Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.2426325Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:50.2662747Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.2722276Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 34.6 MB/s eta 0:00:00 2025-08-14T20:43:50.2757808Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.2871861Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 37.8 MB/s eta 0:00:00 2025-08-14T20:43:50.2914955Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.3018699Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 103.1 MB/s eta 0:00:00 2025-08-14T20:43:50.3060915Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.3119034Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.3185484Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 96.6 MB/s eta 0:00:00 2025-08-14T20:43:50.3222473Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:50.3262291Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 34.2 MB/s eta 0:00:00 2025-08-14T20:43:50.3314557Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:50.3356854Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.7 MB/s eta 0:00:00 2025-08-14T20:43:50.6442972Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:51.1910789Z 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.3 2025-08-14T20:43:51.3171676Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.3172026Z curr_branch="main" 2025-08-14T20:43:51.3172298Z curr_ref_type="branch" 2025-08-14T20:43:51.3172558Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.3172830Z  2025-08-14T20:43:51.3173023Z python3 runner_determinator.py \ 2025-08-14T20:43:51.3173328Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.3173613Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.3173881Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.3174171Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.3174466Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.3174767Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.3175236Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.3175613Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.3176017Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.3176328Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.3219365Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.3219626Z env: 2025-08-14T20:43:51.3220341Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.3220578Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.3220817Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.3221127Z ISSUE_OWNER: 2025-08-14T20:43:51.3221331Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.3221540Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:51.3221772Z PR_NUMBER: 2025-08-14T20:43:51.3221958Z ##[endgroup] 2025-08-14T20:43:51.3287460Z Current branch is 'main' 2025-08-14T20:43:52.7244077Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.7246981Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.7247801Z INFO : Setting output: label-type='' 2025-08-14T20:43:52.7628567Z Evaluate and set job outputs 2025-08-14T20:43:52.7635891Z Cleaning up orphan processes