2025-11-03T15:49:27.7728671Z Current runner version: '2.329.0' 2025-11-03T15:49:27.7759395Z ##[group]Runner Image Provisioner 2025-11-03T15:49:27.7761164Z Hosted Compute Agent 2025-11-03T15:49:27.7761947Z Version: 20251016.436 2025-11-03T15:49:27.7762892Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:49:27.7764113Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:49:27.7765009Z ##[endgroup] 2025-11-03T15:49:27.7765764Z ##[group]Operating System 2025-11-03T15:49:27.7766869Z Ubuntu 2025-11-03T15:49:27.7767539Z 24.04.3 2025-11-03T15:49:27.7768207Z LTS 2025-11-03T15:49:27.7769065Z ##[endgroup] 2025-11-03T15:49:27.7769860Z ##[group]Runner Image 2025-11-03T15:49:27.7770905Z Image: ubuntu-24.04 2025-11-03T15:49:27.7771823Z Version: 20251030.96.2 2025-11-03T15:49:27.7773522Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:49:27.7776208Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:49:27.7777764Z ##[endgroup] 2025-11-03T15:49:27.7780066Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:49:27.7783023Z Contents: read 2025-11-03T15:49:27.7783992Z Metadata: read 2025-11-03T15:49:27.7784723Z ##[endgroup] 2025-11-03T15:49:27.7787893Z Secret source: Actions 2025-11-03T15:49:27.7789138Z Prepare workflow directory 2025-11-03T15:49:27.8503511Z Prepare all required actions 2025-11-03T15:49:27.8584126Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:49:27.8591432Z ##[group] Inputs 2025-11-03T15:49:27.8592561Z check_experiments: 2025-11-03T15:49:27.8593424Z opt_out_experiments: 2025-11-03T15:49:27.8594306Z triggering_actor: pytorchmergebot 2025-11-03T15:49:27.8595348Z issue_owner: 2025-11-03T15:49:27.8596296Z curr_branch: main 2025-11-03T15:49:27.8597096Z curr_ref_type: branch 2025-11-03T15:49:27.8598208Z issue_number: 5132 2025-11-03T15:49:27.8599057Z ##[endgroup] 2025-11-03T15:49:27.8600316Z Complete job name: before-test / get-label-type / runner-determinator 2025-11-03T15:49:28.3591230Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:49:28.3593664Z cat < runner_determinator.py 2025-11-03T15:49:28.3594382Z # flake8: noqa: G004 2025-11-03T15:49:28.3595003Z  2025-11-03T15:49:28.3595908Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:49:28.3596988Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:49:28.3598058Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:49:28.3598831Z  2025-11-03T15:49:28.3599263Z """ 2025-11-03T15:49:28.3600234Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:49:28.3601305Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:49:28.3602503Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:49:28.3603661Z of which runners should be used to run which job. 2025-11-03T15:49:28.3604377Z  2025-11-03T15:49:28.3605094Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:49:28.3606282Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:49:28.3607334Z settings are considered to be empty with only the second part, the user 2025-11-03T15:49:28.3608146Z list, defined. 2025-11-03T15:49:28.3608791Z  2025-11-03T15:49:28.3609461Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:49:28.3610751Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:49:28.3611883Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:49:28.3612604Z  2025-11-03T15:49:28.3613610Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:49:28.3614699Z The user list is also a comma separated list of additional features or 2025-11-03T15:49:28.3615646Z experiments which the user could be opted in to. 2025-11-03T15:49:28.3616313Z  2025-11-03T15:49:28.3616917Z The user list has the following rules: 2025-11-03T15:49:28.3617581Z  2025-11-03T15:49:28.3618261Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:49:28.3619359Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:49:28.3620714Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:49:28.3621464Z  2025-11-03T15:49:28.3622081Z Example config: 2025-11-03T15:49:28.3622709Z  # A list of experiments that can be opted into. 2025-11-03T15:49:28.3623579Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:49:28.3624319Z  # Expected syntax is: 2025-11-03T15:49:28.3625255Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:49:28.3626394Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:49:28.3627618Z  2025-11-03T15:49:28.3698437Z  experiments: 2025-11-03T15:49:28.3698935Z  lf: 2025-11-03T15:49:28.3699408Z  rollout_percent: 25 2025-11-03T15:49:28.3699946Z  all_branches: false 2025-11-03T15:49:28.3700805Z  default: true 2025-11-03T15:49:28.3701291Z  --- 2025-11-03T15:49:28.3701707Z  2025-11-03T15:49:28.3702086Z  # Opt-ins: 2025-11-03T15:49:28.3702773Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:49:28.3704020Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:49:28.3704909Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:49:28.3705666Z  # Experiments should be from the above list. 2025-11-03T15:49:28.3706258Z  2025-11-03T15:49:28.3706662Z  @User1,-lf,split_build 2025-11-03T15:49:28.3707184Z  @User2,lf 2025-11-03T15:49:28.3707652Z  @User3,split_build 2025-11-03T15:49:28.3708135Z """ 2025-11-03T15:49:28.3708520Z  2025-11-03T15:49:28.3708907Z import json 2025-11-03T15:49:28.3709348Z import logging 2025-11-03T15:49:28.3709785Z import os 2025-11-03T15:49:28.3710468Z import random 2025-11-03T15:49:28.3710942Z import re 2025-11-03T15:49:28.3711362Z import sys 2025-11-03T15:49:28.3711835Z from argparse import ArgumentParser 2025-11-03T15:49:28.3712501Z from collections.abc import Iterable 2025-11-03T15:49:28.3713100Z from functools import cache 2025-11-03T15:49:28.3713634Z from logging import LogRecord 2025-11-03T15:49:28.3714199Z from typing import Any, NamedTuple 2025-11-03T15:49:28.3714818Z from urllib.request import Request, urlopen 2025-11-03T15:49:28.3715408Z  2025-11-03T15:49:28.3715788Z import yaml 2025-11-03T15:49:28.3716253Z from github import Auth, Github 2025-11-03T15:49:28.3716821Z from github.Issue import Issue 2025-11-03T15:49:28.3717343Z  2025-11-03T15:49:28.3717711Z  2025-11-03T15:49:28.3718174Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:49:28.3718941Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:49:28.3719910Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:49:28.3720792Z  2025-11-03T15:49:28.3721438Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:49:28.3722080Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:49:28.3722686Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:49:28.3723334Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:49:28.3723901Z  2025-11-03T15:49:28.3724337Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:49:28.3724879Z  2025-11-03T15:49:28.3725283Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:49:28.3725816Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:49:28.3726316Z  2025-11-03T15:49:28.3726677Z  2025-11-03T15:49:28.3727082Z class Experiment(NamedTuple): 2025-11-03T15:49:28.3727622Z  rollout_perc: float = ( 2025-11-03T15:49:28.3728367Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:49:28.3729087Z  ) 2025-11-03T15:49:28.3729507Z  all_branches: bool = ( 2025-11-03T15:49:28.3730354Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:49:28.3731093Z  ) 2025-11-03T15:49:28.3731502Z  default: bool = ( 2025-11-03T15:49:28.3732193Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:49:28.3732886Z  ) 2025-11-03T15:49:28.3733275Z  2025-11-03T15:49:28.3733690Z  # Add more fields as needed 2025-11-03T15:49:28.3734207Z  2025-11-03T15:49:28.3734570Z  2025-11-03T15:49:28.3734971Z class Settings(NamedTuple): 2025-11-03T15:49:28.3735476Z  """ 2025-11-03T15:49:28.3735996Z  Settings for the experiments that can be opted into. 2025-11-03T15:49:28.3736610Z  """ 2025-11-03T15:49:28.3737005Z  2025-11-03T15:49:28.3737444Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:49:28.3738020Z  2025-11-03T15:49:28.3738517Z  2025-11-03T15:49:28.3738977Z class ColorFormatter(logging.Formatter): 2025-11-03T15:49:28.3739676Z  """Color codes the log messages based on the log level""" 2025-11-03T15:49:28.3740603Z  2025-11-03T15:49:28.3740989Z  COLORS = { 2025-11-03T15:49:28.3741485Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:49:28.3742065Z  "ERROR": "\033[31m", # Red 2025-11-03T15:49:28.3742618Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:49:28.3743187Z  "INFO": "\033[0m", # Reset 2025-11-03T15:49:28.3743736Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:49:28.3744256Z  } 2025-11-03T15:49:28.3744648Z  2025-11-03T15:49:28.3745106Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:49:28.3745933Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:49:28.3746793Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:49:28.3747436Z  return super().format(record) 2025-11-03T15:49:28.3747969Z  2025-11-03T15:49:28.3748339Z  2025-11-03T15:49:28.3748761Z handler = logging.StreamHandler() 2025-11-03T15:49:28.3749571Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:49:28.3750451Z  2025-11-03T15:49:28.3750940Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:49:28.3751580Z log.addHandler(handler) 2025-11-03T15:49:28.3752092Z log.setLevel(logging.INFO) 2025-11-03T15:49:28.3752590Z  2025-11-03T15:49:28.3752946Z  2025-11-03T15:49:28.3753445Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:49:28.3754065Z  """ 2025-11-03T15:49:28.3754647Z  Defines outputs of the github action that invokes this script 2025-11-03T15:49:28.3755488Z  """ 2025-11-03T15:49:28.3755911Z  if not GITHUB_OUTPUT: 2025-11-03T15:49:28.3757074Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:49:28.3758262Z  log.warning( 2025-11-03T15:49:28.3759223Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:49:28.3760299Z  ) 2025-11-03T15:49:28.3760798Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:49:28.3761395Z  return 2025-11-03T15:49:28.3761828Z  2025-11-03T15:49:28.3762259Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:49:28.3762901Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:49:28.3763534Z  f.write(f"{key}={value}\n") 2025-11-03T15:49:28.3764074Z  2025-11-03T15:49:28.3764440Z  2025-11-03T15:49:28.3765009Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:49:28.3765723Z  return frozenset( 2025-11-03T15:49:28.3766440Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:49:28.3767170Z  ) 2025-11-03T15:49:28.3767582Z  2025-11-03T15:49:28.3767954Z  2025-11-03T15:49:28.3768361Z def parse_args() -> Any: 2025-11-03T15:49:28.3769041Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:49:28.3769991Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:49:28.3770945Z  parser.add_argument( 2025-11-03T15:49:28.3771476Z  "--github-issue-repo", 2025-11-03T15:49:28.3772025Z  type=str, 2025-11-03T15:49:28.3772519Z  required=False, 2025-11-03T15:49:28.3773178Z  default="pytorch/test-infra", 2025-11-03T15:49:28.3773807Z  help="GitHub repo to get the issue", 2025-11-03T15:49:28.3774366Z  ) 2025-11-03T15:49:28.3774802Z  parser.add_argument( 2025-11-03T15:49:28.3775313Z  "--github-repo", 2025-11-03T15:49:28.3775816Z  type=str, 2025-11-03T15:49:28.3776290Z  required=True, 2025-11-03T15:49:28.3776852Z  help="GitHub repo where CI is running", 2025-11-03T15:49:28.3777439Z  ) 2025-11-03T15:49:28.3777864Z  parser.add_argument( 2025-11-03T15:49:28.3778573Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:49:28.3779286Z  ) 2025-11-03T15:49:28.3779705Z  parser.add_argument( 2025-11-03T15:49:28.3780736Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:49:28.3781514Z  ) 2025-11-03T15:49:28.3781937Z  parser.add_argument( 2025-11-03T15:49:28.3782686Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:49:28.3783432Z  ) 2025-11-03T15:49:28.3783851Z  parser.add_argument( 2025-11-03T15:49:28.3784630Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:49:28.3785409Z  ) 2025-11-03T15:49:28.3785859Z  parser.add_argument( 2025-11-03T15:49:28.3786391Z  "--github-ref-type", 2025-11-03T15:49:28.3786922Z  type=str, 2025-11-03T15:49:28.3787403Z  required=True, 2025-11-03T15:49:28.3787999Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:49:28.3788605Z  ) 2025-11-03T15:49:28.3789033Z  parser.add_argument( 2025-11-03T15:49:28.3789720Z  "--eligible-experiments", 2025-11-03T15:49:28.3790713Z  type=_str_comma_separated_to_set, 2025-11-03T15:49:28.3791348Z  required=False, 2025-11-03T15:49:28.3791856Z  default="", 2025-11-03T15:49:28.3792815Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:49:28.3793800Z  ) 2025-11-03T15:49:28.3794228Z  parser.add_argument( 2025-11-03T15:49:28.3794765Z  "--opt-out-experiments", 2025-11-03T15:49:28.3795356Z  type=_str_comma_separated_to_set, 2025-11-03T15:49:28.3795922Z  required=False, 2025-11-03T15:49:28.3796420Z  default="", 2025-11-03T15:49:28.3796895Z  help=( 2025-11-03T15:49:28.3797649Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:49:28.3798879Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:49:28.3799770Z  ), 2025-11-03T15:49:28.3800352Z  ) 2025-11-03T15:49:28.3800778Z  parser.add_argument( 2025-11-03T15:49:28.3801301Z  "--pr-number", 2025-11-03T15:49:28.3801795Z  type=str, 2025-11-03T15:49:28.3802274Z  required=False, 2025-11-03T15:49:28.3802775Z  default="", 2025-11-03T15:49:28.3803346Z  help="the optional PR number where this is run", 2025-11-03T15:49:28.3803957Z  ) 2025-11-03T15:49:28.3804358Z  2025-11-03T15:49:28.3804780Z  return parser.parse_args() 2025-11-03T15:49:28.3805303Z  2025-11-03T15:49:28.3805686Z  2025-11-03T15:49:28.3806353Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:49:28.3807320Z  auth = Auth.Token(github_token) 2025-11-03T15:49:28.3807932Z  return Github(auth=auth) 2025-11-03T15:49:28.3808445Z  2025-11-03T15:49:28.3808831Z  2025-11-03T15:49:28.3809548Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:49:28.3810624Z  repo = gh.get_repo(repo) 2025-11-03T15:49:28.3811233Z  return repo.get_issue(number=issue_num) 2025-11-03T15:49:28.3811811Z  2025-11-03T15:49:28.3812190Z  2025-11-03T15:49:28.3812598Z def get_potential_pr_author( 2025-11-03T15:49:28.3813343Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:49:28.3814083Z ) -> str: 2025-11-03T15:49:28.3814692Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:49:28.3815593Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:49:28.3816444Z  # embedded in the tag name: ciflow// 2025-11-03T15:49:28.3817075Z  2025-11-03T15:49:28.3817507Z  gh = get_gh_client(github_token) 2025-11-03T15:49:28.3818058Z  2025-11-03T15:49:28.3818574Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:49:28.3819276Z  split_tag = ref_name.split("/") 2025-11-03T15:49:28.3819842Z  if ( 2025-11-03T15:49:28.3820600Z  len(split_tag) == 3 2025-11-03T15:49:28.3821194Z  and split_tag[0] == "ciflow" 2025-11-03T15:49:28.3821793Z  and split_tag[2].isnumeric() 2025-11-03T15:49:28.3822354Z  ): 2025-11-03T15:49:28.3822820Z  pr_number = split_tag[2] 2025-11-03T15:49:28.3823372Z  try: 2025-11-03T15:49:28.3823880Z  repository = gh.get_repo(repo) 2025-11-03T15:49:28.3824737Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:49:28.3825430Z  except Exception as e: 2025-11-03T15:49:28.3826024Z  raise Exception( # noqa: TRY002 2025-11-03T15:49:28.3826764Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:49:28.3827472Z  ) from e 2025-11-03T15:49:28.3828111Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:49:28.3828887Z  # In all other cases, return the original input username 2025-11-03T15:49:28.3829538Z  return username 2025-11-03T15:49:28.3830012Z  2025-11-03T15:49:28.3830506Z  2025-11-03T15:49:28.3830982Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:49:28.3831576Z  """ 2025-11-03T15:49:28.3832342Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:49:28.3833180Z  """ 2025-11-03T15:49:28.3833802Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:49:28.3834521Z  2025-11-03T15:49:28.3834892Z  2025-11-03T15:49:28.3835329Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:49:28.3835875Z  try: 2025-11-03T15:49:28.3836337Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:49:28.3836903Z  return data 2025-11-03T15:49:28.3837406Z  except yaml.YAMLError: 2025-11-03T15:49:28.3837991Z  log.exception("Error loading YAML") 2025-11-03T15:49:28.3838564Z  raise 2025-11-03T15:49:28.3839001Z  2025-11-03T15:49:28.3839370Z  2025-11-03T15:49:28.3840040Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:49:28.3840957Z  """ 2025-11-03T15:49:28.3841788Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:49:28.3842600Z  2025-11-03T15:49:28.3843203Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:49:28.3844058Z  and the text below is the list of opted in users. 2025-11-03T15:49:28.3844668Z  2025-11-03T15:49:28.3845298Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:49:28.3846053Z  """ 2025-11-03T15:49:28.3846579Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:49:28.3847237Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:49:28.3847932Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:49:28.3848574Z  else: 2025-11-03T15:49:28.3849017Z  return "", rollout_state 2025-11-03T15:49:28.3849790Z  2025-11-03T15:49:28.3850269Z  2025-11-03T15:49:28.3850727Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:49:28.3851297Z  """ 2025-11-03T15:49:28.3851891Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:49:28.3852589Z  """ 2025-11-03T15:49:28.3852978Z  2025-11-03T15:49:28.3853345Z  2025-11-03T15:49:28.3853918Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:49:28.3854632Z  """ 2025-11-03T15:49:28.3855418Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:49:28.3856308Z  2025-11-03T15:49:28.3857175Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:49:28.3858244Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:49:28.3859135Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:49:28.3859806Z  2025-11-03T15:49:28.3860437Z  2025-11-03T15:49:28.3860836Z  """ 2025-11-03T15:49:28.3861264Z  optins = UserOptins() 2025-11-03T15:49:28.3861839Z  for user in user_optin_text.split("\n"): 2025-11-03T15:49:28.3862460Z  user = user.strip("\r\n\t -") 2025-11-03T15:49:28.3863074Z  if not user or not user.startswith("@"): 2025-11-03T15:49:28.3863683Z  # Not a valid user. Skip 2025-11-03T15:49:28.3864225Z  continue 2025-11-03T15:49:28.3864682Z  2025-11-03T15:49:28.3865068Z  if user: 2025-11-03T15:49:28.3865589Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:49:28.3866391Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:49:28.3867093Z  2025-11-03T15:49:28.3867488Z  return optins 2025-11-03T15:49:28.3867948Z  2025-11-03T15:49:28.3868312Z  2025-11-03T15:49:28.3868850Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:49:28.3869513Z  """ 2025-11-03T15:49:28.3869981Z  Check if the experiment name is valid. 2025-11-03T15:49:28.3871052Z  A valid name: 2025-11-03T15:49:28.3871784Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:49:28.3872790Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:49:28.3873551Z  - Cannot contain spaces 2025-11-03T15:49:28.3874072Z  """ 2025-11-03T15:49:28.3874455Z  2025-11-03T15:49:28.3874964Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:49:28.3875747Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:49:28.3876542Z  2025-11-03T15:49:28.3876935Z  if valid: 2025-11-03T15:49:28.3877390Z  return True 2025-11-03T15:49:28.3877846Z  2025-11-03T15:49:28.3878216Z  log.error( 2025-11-03T15:49:28.3879773Z  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-11-03T15:49:28.3881529Z  ) 2025-11-03T15:49:28.3881936Z  return False 2025-11-03T15:49:28.3882383Z  2025-11-03T15:49:28.3882746Z  2025-11-03T15:49:28.3883310Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:49:28.3884002Z  """ 2025-11-03T15:49:28.3884662Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:49:28.3885433Z  """ 2025-11-03T15:49:28.3885841Z  try: 2025-11-03T15:49:28.3886268Z  if settings_text: 2025-11-03T15:49:28.3887082Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:49:28.3887931Z  # for easy reading 2025-11-03T15:49:28.3888808Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:49:28.3889774Z  # the backtick character in shell commands. 2025-11-03T15:49:28.3890536Z  backtick = chr(96) # backtick character 2025-11-03T15:49:28.3891279Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:49:28.3892014Z  settings = load_yaml(settings_text) 2025-11-03T15:49:28.3892571Z  2025-11-03T15:49:28.3893226Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:49:28.3894151Z  experiments = {} 2025-11-03T15:49:28.3894665Z  2025-11-03T15:49:28.3895283Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:49:28.3896108Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:49:28.3897296Z  # 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-11-03T15:49:28.3898395Z  continue 2025-11-03T15:49:28.3898894Z  2025-11-03T15:49:28.3899306Z  valid_settings = {} 2025-11-03T15:49:28.3899899Z  for setting in exp_settings: 2025-11-03T15:49:28.3900636Z  if setting not in Experiment._fields: 2025-11-03T15:49:28.3901259Z  log.warning( 2025-11-03T15:49:28.3902052Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:49:28.3902810Z  ) 2025-11-03T15:49:28.3903309Z  else: 2025-11-03T15:49:28.3903904Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:49:28.3904513Z  2025-11-03T15:49:28.3905037Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:49:28.3905734Z  return Settings(experiments) 2025-11-03T15:49:28.3906282Z  2025-11-03T15:49:28.3906681Z  except Exception: 2025-11-03T15:49:28.3907248Z  log.exception("Failed to parse settings") 2025-11-03T15:49:28.3907826Z  2025-11-03T15:49:28.3908214Z  return Settings() 2025-11-03T15:49:28.3908690Z  2025-11-03T15:49:28.3909057Z  2025-11-03T15:49:28.3909720Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:49:28.3910456Z  """ 2025-11-03T15:49:28.3910964Z  Parse settings, if any, from the rollout state. 2025-11-03T15:49:28.3911562Z  2025-11-03T15:49:28.3912150Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:49:28.3912976Z  and the text below is the list of opted in users. 2025-11-03T15:49:28.3913575Z  2025-11-03T15:49:28.3914227Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:49:28.3915005Z  """ 2025-11-03T15:49:28.3915632Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:49:28.3916464Z  return parse_settings_from_text(settings_text) 2025-11-03T15:49:28.3917060Z  2025-11-03T15:49:28.3917431Z  2025-11-03T15:49:28.3917942Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:49:28.3918557Z  """ 2025-11-03T15:49:28.3919007Z  Parse users from the rollout state. 2025-11-03T15:49:28.3919558Z  2025-11-03T15:49:28.3919922Z  """ 2025-11-03T15:49:28.3920634Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:49:28.3921446Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:49:28.3922045Z  2025-11-03T15:49:28.3922413Z  2025-11-03T15:49:28.3923087Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:49:28.3923889Z  """ 2025-11-03T15:49:28.3924371Z  Check if a user is opted into an experiment 2025-11-03T15:49:28.3924959Z  """ 2025-11-03T15:49:28.3925484Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:49:28.3926110Z  2025-11-03T15:49:28.3926608Z  2025-11-03T15:49:28.3927300Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:49:28.3928120Z  """ 2025-11-03T15:49:28.3928649Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:49:28.3929276Z  """ 2025-11-03T15:49:28.3929848Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:49:28.3930719Z  experiment_optout = "-" + experiment_name 2025-11-03T15:49:28.3931436Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:49:28.3932115Z  return False 2025-11-03T15:49:28.3932581Z  2025-11-03T15:49:28.3933089Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:49:28.3933735Z  log.warning( 2025-11-03T15:49:28.3934641Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:49:28.3935575Z  ) 2025-11-03T15:49:28.3935983Z  2025-11-03T15:49:28.3936360Z  return True 2025-11-03T15:49:28.3936803Z  2025-11-03T15:49:28.3937163Z  2025-11-03T15:49:28.3937572Z def get_runner_prefix( 2025-11-03T15:49:28.3938071Z  rollout_state: str, 2025-11-03T15:49:28.3938615Z  workflow_requestors: Iterable[str], 2025-11-03T15:49:28.3939175Z  branch: str, 2025-11-03T15:49:28.3939758Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:49:28.3940603Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:49:28.3941245Z  is_canary: bool = False, 2025-11-03T15:49:28.3941763Z ) -> str: 2025-11-03T15:49:28.3942260Z  settings = parse_settings(rollout_state) 2025-11-03T15:49:28.3942909Z  user_optins = parse_users(rollout_state) 2025-11-03T15:49:28.3943475Z  2025-11-03T15:49:28.3943992Z  fleet_prefix = "" 2025-11-03T15:49:28.3944496Z  prefixes = [] 2025-11-03T15:49:28.3945221Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:49:28.3946236Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:49:28.3947006Z  log.info( 2025-11-03T15:49:28.3947788Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:49:28.3948586Z  ) 2025-11-03T15:49:28.3949050Z  continue 2025-11-03T15:49:28.3949513Z  2025-11-03T15:49:28.3949913Z  if opt_out_experiments: 2025-11-03T15:49:28.3950628Z  if experiment_name in opt_out_experiments: 2025-11-03T15:49:28.3951348Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:49:28.3951995Z  log.info( 2025-11-03T15:49:28.3953001Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:49:28.3954027Z  ) 2025-11-03T15:49:28.3954492Z  continue 2025-11-03T15:49:28.3954965Z  2025-11-03T15:49:28.3955382Z  if eligible_experiments: 2025-11-03T15:49:28.3956008Z  if experiment_name not in eligible_experiments: 2025-11-03T15:49:28.3956710Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:49:28.3957313Z  log.info( 2025-11-03T15:49:28.3958178Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:49:28.3959066Z  ) 2025-11-03T15:49:28.3959644Z  continue 2025-11-03T15:49:28.3960312Z  elif not experiment_settings.default: 2025-11-03T15:49:28.3960923Z  log.info( 2025-11-03T15:49:28.3961672Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:49:28.3962452Z  ) 2025-11-03T15:49:28.3962887Z  continue 2025-11-03T15:49:28.3963347Z  2025-11-03T15:49:28.3963868Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:49:28.3964540Z  opted_out_users = [ 2025-11-03T15:49:28.3965057Z  requestor 2025-11-03T15:49:28.3965601Z  for requestor in workflow_requestors 2025-11-03T15:49:28.3966341Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:49:28.3967019Z  ] 2025-11-03T15:49:28.3967429Z  2025-11-03T15:49:28.3967830Z  if opted_out_users: 2025-11-03T15:49:28.3968363Z  log.info( 2025-11-03T15:49:28.3969070Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:49:28.3969823Z  ) 2025-11-03T15:49:28.3970357Z  continue 2025-11-03T15:49:28.3970820Z  2025-11-03T15:49:28.3971335Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:49:28.3972011Z  opted_in_users = [ 2025-11-03T15:49:28.3972549Z  requestor 2025-11-03T15:49:28.3973093Z  for requestor in workflow_requestors 2025-11-03T15:49:28.3973838Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:49:28.3974509Z  ] 2025-11-03T15:49:28.3974923Z  2025-11-03T15:49:28.3975315Z  enabled = False 2025-11-03T15:49:28.3975838Z  if opted_in_users: 2025-11-03T15:49:28.3976473Z  log.info( 2025-11-03T15:49:28.3977174Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:49:28.3977905Z  ) 2025-11-03T15:49:28.3978351Z  enabled = True 2025-11-03T15:49:28.3978843Z  2025-11-03T15:49:28.3979293Z  elif experiment_settings.rollout_perc: 2025-11-03T15:49:28.3980299Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:49:28.3981317Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:49:28.3982010Z  log.info( 2025-11-03T15:49:28.3982963Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:49:28.3983926Z  ) 2025-11-03T15:49:28.3984414Z  enabled = True 2025-11-03T15:49:28.3984928Z  2025-11-03T15:49:28.3985314Z  if enabled: 2025-11-03T15:49:28.3985900Z  label = experiment_name 2025-11-03T15:49:28.3986522Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:49:28.3987422Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:49:28.3988355Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:49:28.3989190Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:49:28.3989905Z  if is_canary: 2025-11-03T15:49:28.3990571Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:49:28.3991173Z  fleet_prefix = label 2025-11-03T15:49:28.3991716Z  else: 2025-11-03T15:49:28.3992362Z  prefixes.append(label) 2025-11-03T15:49:28.3992908Z  2025-11-03T15:49:28.3993310Z  if len(prefixes) > 1: 2025-11-03T15:49:28.3993828Z  log.error( 2025-11-03T15:49:28.3994950Z  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-11-03T15:49:28.3996127Z  ) 2025-11-03T15:49:28.3996576Z  prefixes = prefixes[:1] 2025-11-03T15:49:28.3997100Z  2025-11-03T15:49:28.3997509Z  # Fleet always comes first 2025-11-03T15:49:28.3998051Z  if fleet_prefix: 2025-11-03T15:49:28.3998574Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:49:28.3999126Z  2025-11-03T15:49:28.3999626Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:49:28.4000337Z  2025-11-03T15:49:28.4000718Z  2025-11-03T15:49:28.4001416Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:49:28.4002240Z  """ 2025-11-03T15:49:28.4002889Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:49:28.4003644Z  2025-11-03T15:49:28.4004277Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:49:28.4005023Z  """ 2025-11-03T15:49:28.4005476Z  gh = get_gh_client(github_token) 2025-11-03T15:49:28.4006097Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:49:28.4006814Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:49:28.4007458Z  2025-11-03T15:49:28.4007837Z  2025-11-03T15:49:28.4008485Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:49:28.4009417Z  for _ in range(num_retries): 2025-11-03T15:49:28.4009969Z  try: 2025-11-03T15:49:28.4010567Z  req = Request(url=url, headers=headers) 2025-11-03T15:49:28.4011295Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:49:28.4011993Z  return json.loads(content) 2025-11-03T15:49:28.4012576Z  except Exception as e: 2025-11-03T15:49:28.4013208Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:49:28.4013801Z  2025-11-03T15:49:28.4014427Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:49:28.4015195Z  return {} 2025-11-03T15:49:28.4015625Z  2025-11-03T15:49:28.4015985Z  2025-11-03T15:49:28.4016362Z @cache 2025-11-03T15:49:28.4017060Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:49:28.4017880Z  """ 2025-11-03T15:49:28.4018333Z  Dynamically get PR information 2025-11-03T15:49:28.4018869Z  """ 2025-11-03T15:49:28.4019437Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:49:28.4020205Z  headers = { 2025-11-03T15:49:28.4020745Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:49:28.4021419Z  "Authorization": f"token {github_token}", 2025-11-03T15:49:28.4021988Z  } 2025-11-03T15:49:28.4022482Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:49:28.4023149Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:49:28.4023740Z  headers=headers, 2025-11-03T15:49:28.4024287Z  ) 2025-11-03T15:49:28.4024686Z  2025-11-03T15:49:28.4025084Z  if not json_response: 2025-11-03T15:49:28.4025745Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:49:28.4026554Z  return {} 2025-11-03T15:49:28.4027000Z  2025-11-03T15:49:28.4027398Z  return json_response 2025-11-03T15:49:28.4027884Z  2025-11-03T15:49:28.4028257Z  2025-11-03T15:49:28.4028894Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:49:28.4029674Z  """ 2025-11-03T15:49:28.4030375Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:49:28.4031081Z  """ 2025-11-03T15:49:28.4031631Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:49:28.4032319Z  return { 2025-11-03T15:49:28.4032982Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:49:28.4033712Z  } 2025-11-03T15:49:28.4034111Z  2025-11-03T15:49:28.4034483Z  2025-11-03T15:49:28.4034888Z def main() -> None: 2025-11-03T15:49:28.4035380Z  args = parse_args() 2025-11-03T15:49:28.4035867Z  2025-11-03T15:49:28.4036330Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:49:28.4036915Z  2025-11-03T15:49:28.4037334Z  # Check if the PR is opt-out 2025-11-03T15:49:28.4037885Z  if args.pr_number: 2025-11-03T15:49:28.4038639Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:49:28.4039447Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:49:28.4039996Z  log.info( 2025-11-03T15:49:28.4040867Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:49:28.4041673Z  ) 2025-11-03T15:49:28.4042315Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:49:28.4043041Z  sys.exit() 2025-11-03T15:49:28.4043631Z  2025-11-03T15:49:28.4044022Z  try: 2025-11-03T15:49:28.4044530Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:49:28.4045318Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:49:28.4046005Z  ) 2025-11-03T15:49:28.4046415Z  2025-11-03T15:49:28.4046853Z  username = get_potential_pr_author( 2025-11-03T15:49:28.4047451Z  args.github_token, 2025-11-03T15:49:28.4048008Z  args.github_repo, 2025-11-03T15:49:28.4048553Z  args.github_actor, 2025-11-03T15:49:28.4049103Z  args.github_ref_type, 2025-11-03T15:49:28.4049667Z  args.github_branch, 2025-11-03T15:49:28.4050289Z  ) 2025-11-03T15:49:28.4050699Z  2025-11-03T15:49:28.4051231Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:49:28.4051882Z  2025-11-03T15:49:28.4052334Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:49:28.4052932Z  rollout_state, 2025-11-03T15:49:28.4053504Z  (args.github_issue_owner, username), 2025-11-03T15:49:28.4054104Z  args.github_branch, 2025-11-03T15:49:28.4054673Z  args.eligible_experiments, 2025-11-03T15:49:28.4055275Z  args.opt_out_experiments, 2025-11-03T15:49:28.4055832Z  is_canary, 2025-11-03T15:49:28.4056305Z  ) 2025-11-03T15:49:28.4056709Z  2025-11-03T15:49:28.4057113Z  except Exception as e: 2025-11-03T15:49:28.4057651Z  log.error( 2025-11-03T15:49:28.4058431Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:49:28.4059346Z  ) 2025-11-03T15:49:28.4059755Z  2025-11-03T15:49:28.4060423Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:49:28.4061114Z  2025-11-03T15:49:28.4061482Z  2025-11-03T15:49:28.4061875Z if __name__ == "__main__": 2025-11-03T15:49:28.4062381Z  main() 2025-11-03T15:49:28.4062792Z  2025-11-03T15:49:28.4063173Z EOF 2025-11-03T15:49:28.4063563Z  2025-11-03T15:49:28.4063974Z cat runner_determinator.py 2025-11-03T15:49:28.5136838Z shell: /usr/bin/bash -e {0} 2025-11-03T15:49:28.5137667Z env: 2025-11-03T15:49:28.5138366Z GITHUB_TOKEN: *** 2025-11-03T15:49:28.5138797Z ISSUE_NUMBER: 5132 2025-11-03T15:49:28.5139251Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:49:28.5139756Z ISSUE_OWNER: 2025-11-03T15:49:28.5140330Z CHECK_EXPERIMENTS: 2025-11-03T15:49:28.5140809Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:49:28.5141231Z PR_NUMBER: 2025-11-03T15:49:28.5141657Z ##[endgroup] 2025-11-03T15:49:28.5344456Z # flake8: noqa: G004 2025-11-03T15:49:28.5344798Z 2025-11-03T15:49:28.5345261Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:49:28.5346208Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:49:28.5347014Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:49:28.5347465Z 2025-11-03T15:49:28.5347631Z """ 2025-11-03T15:49:28.5348214Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:49:28.5349087Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:49:28.5350008Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:49:28.5351131Z of which runners should be used to run which job. 2025-11-03T15:49:28.5351542Z 2025-11-03T15:49:28.5351931Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:49:28.5353017Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:49:28.5353907Z settings are considered to be empty with only the second part, the user 2025-11-03T15:49:28.5354602Z list, defined. 2025-11-03T15:49:28.5354827Z 2025-11-03T15:49:28.5355194Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:49:28.5356139Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:49:28.5356961Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:49:28.5357409Z 2025-11-03T15:49:28.5357777Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:49:28.5358639Z The user list is also a comma separated list of additional features or 2025-11-03T15:49:28.5359358Z experiments which the user could be opted in to. 2025-11-03T15:49:28.5359764Z 2025-11-03T15:49:28.5359965Z The user list has the following rules: 2025-11-03T15:49:28.5360951Z 2025-11-03T15:49:28.5361300Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:49:28.5362189Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:49:28.5362972Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:49:28.5363380Z 2025-11-03T15:49:28.5363550Z Example config: 2025-11-03T15:49:28.5364020Z # A list of experiments that can be opted into. 2025-11-03T15:49:28.5364684Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:49:28.5365306Z # Expected syntax is: 2025-11-03T15:49:28.5365948Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:49:28.5366934Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:49:28.5367543Z 2025-11-03T15:49:28.5367724Z experiments: 2025-11-03T15:49:28.5368117Z lf: 2025-11-03T15:49:28.5368495Z rollout_percent: 25 2025-11-03T15:49:28.5369122Z all_branches: false 2025-11-03T15:49:28.5369584Z default: true 2025-11-03T15:49:28.5370033Z --- 2025-11-03T15:49:28.5370503Z 2025-11-03T15:49:28.5370682Z # Opt-ins: 2025-11-03T15:49:28.5371269Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:49:28.5372144Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:49:28.5372923Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:49:28.5373584Z # Experiments should be from the above list. 2025-11-03T15:49:28.5373966Z 2025-11-03T15:49:28.5374152Z @User1,-lf,split_build 2025-11-03T15:49:28.5374589Z @User2,lf 2025-11-03T15:49:28.5374974Z @User3,split_build 2025-11-03T15:49:28.5375380Z """ 2025-11-03T15:49:28.5375580Z 2025-11-03T15:49:28.5375742Z import json 2025-11-03T15:49:28.5376112Z import logging 2025-11-03T15:49:28.5376496Z import os 2025-11-03T15:49:28.5376860Z import random 2025-11-03T15:49:28.5377237Z import re 2025-11-03T15:49:28.5377606Z import sys 2025-11-03T15:49:28.5378013Z from argparse import ArgumentParser 2025-11-03T15:49:28.5378549Z from collections.abc import Iterable 2025-11-03T15:49:28.5379064Z from functools import cache 2025-11-03T15:49:28.5379542Z from logging import LogRecord 2025-11-03T15:49:28.5380028Z from typing import Any, NamedTuple 2025-11-03T15:49:28.5380865Z from urllib.request import Request, urlopen 2025-11-03T15:49:28.5381238Z 2025-11-03T15:49:28.5381402Z import yaml 2025-11-03T15:49:28.5381799Z from github import Auth, Github 2025-11-03T15:49:28.5382290Z from github.Issue import Issue 2025-11-03T15:49:28.5382606Z 2025-11-03T15:49:28.5382614Z 2025-11-03T15:49:28.5382832Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:49:28.5383530Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:49:28.5384464Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:49:28.5385116Z 2025-11-03T15:49:28.5385357Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:49:28.5386070Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:49:28.5386595Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:49:28.5387140Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:49:28.5387497Z 2025-11-03T15:49:28.5387694Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:49:28.5388029Z 2025-11-03T15:49:28.5388220Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:49:28.5388684Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:49:28.5388985Z 2025-11-03T15:49:28.5388993Z 2025-11-03T15:49:28.5389187Z class Experiment(NamedTuple): 2025-11-03T15:49:28.5389667Z rollout_perc: float = ( 2025-11-03T15:49:28.5390528Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:49:28.5391218Z ) 2025-11-03T15:49:28.5391601Z all_branches: bool = ( 2025-11-03T15:49:28.5392231Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:49:28.5392903Z ) 2025-11-03T15:49:28.5393276Z default: bool = ( 2025-11-03T15:49:28.5393843Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:49:28.5394485Z ) 2025-11-03T15:49:28.5394684Z 2025-11-03T15:49:28.5394867Z # Add more fields as needed 2025-11-03T15:49:28.5395174Z 2025-11-03T15:49:28.5395181Z 2025-11-03T15:49:28.5395361Z class Settings(NamedTuple): 2025-11-03T15:49:28.5395797Z """ 2025-11-03T15:49:28.5396246Z Settings for the experiments that can be opted into. 2025-11-03T15:49:28.5396820Z """ 2025-11-03T15:49:28.5397017Z 2025-11-03T15:49:28.5397226Z experiments: dict[str, Experiment] = {} 2025-11-03T15:49:28.5397597Z 2025-11-03T15:49:28.5397603Z 2025-11-03T15:49:28.5397819Z class ColorFormatter(logging.Formatter): 2025-11-03T15:49:28.5398440Z """Color codes the log messages based on the log level""" 2025-11-03T15:49:28.5398888Z 2025-11-03T15:49:28.5399050Z COLORS = { 2025-11-03T15:49:28.5399464Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:49:28.5400294Z "ERROR": "\033[31m", # Red 2025-11-03T15:49:28.5400843Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:49:28.5401342Z "INFO": "\033[0m", # Reset 2025-11-03T15:49:28.5401832Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:49:28.5402301Z } 2025-11-03T15:49:28.5402504Z 2025-11-03T15:49:28.5402726Z def format(self, record: LogRecord) -> str: 2025-11-03T15:49:28.5403472Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:49:28.5404252Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:49:28.5404924Z return super().format(record) 2025-11-03T15:49:28.5405262Z 2025-11-03T15:49:28.5405268Z 2025-11-03T15:49:28.5405469Z handler = logging.StreamHandler() 2025-11-03T15:49:28.5406180Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:49:28.5406733Z 2025-11-03T15:49:28.5406974Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:49:28.5407565Z log.addHandler(handler) 2025-11-03T15:49:28.5408014Z log.setLevel(logging.INFO) 2025-11-03T15:49:28.5408307Z 2025-11-03T15:49:28.5408313Z 2025-11-03T15:49:28.5408560Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:49:28.5409121Z """ 2025-11-03T15:49:28.5409617Z Defines outputs of the github action that invokes this script 2025-11-03T15:49:28.5410472Z """ 2025-11-03T15:49:28.5410851Z if not GITHUB_OUTPUT: 2025-11-03T15:49:28.5411920Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:49:28.5413035Z log.warning( 2025-11-03T15:49:28.5413894Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:49:28.5414829Z ) 2025-11-03T15:49:28.5425042Z print(f"::set-output name={key}::{value}") 2025-11-03T15:49:28.5425666Z return 2025-11-03T15:49:28.5425917Z 2025-11-03T15:49:28.5426296Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:49:28.5426904Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:49:28.5427469Z f.write(f"{key}={value}\n") 2025-11-03T15:49:28.5427796Z 2025-11-03T15:49:28.5427803Z 2025-11-03T15:49:28.5428112Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:49:28.5428744Z return frozenset( 2025-11-03T15:49:28.5429349Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:49:28.5430029Z ) 2025-11-03T15:49:28.5430455Z 2025-11-03T15:49:28.5430463Z 2025-11-03T15:49:28.5430650Z def parse_args() -> Any: 2025-11-03T15:49:28.5431218Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:49:28.5432076Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:49:28.5432858Z parser.add_argument( 2025-11-03T15:49:28.5433320Z "--github-issue-repo", 2025-11-03T15:49:28.5433789Z type=str, 2025-11-03T15:49:28.5434199Z required=False, 2025-11-03T15:49:28.5434647Z default="pytorch/test-infra", 2025-11-03T15:49:28.5435186Z help="GitHub repo to get the issue", 2025-11-03T15:49:28.5435689Z ) 2025-11-03T15:49:28.5436060Z parser.add_argument( 2025-11-03T15:49:28.5436503Z "--github-repo", 2025-11-03T15:49:28.5436936Z type=str, 2025-11-03T15:49:28.5437329Z required=True, 2025-11-03T15:49:28.5437806Z help="GitHub repo where CI is running", 2025-11-03T15:49:28.5438353Z ) 2025-11-03T15:49:28.5438721Z parser.add_argument( 2025-11-03T15:49:28.5439327Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:49:28.5439981Z ) 2025-11-03T15:49:28.5440622Z parser.add_argument( 2025-11-03T15:49:28.5441252Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:49:28.5441928Z ) 2025-11-03T15:49:28.5491458Z parser.add_argument( 2025-11-03T15:49:28.5493092Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:49:28.5493901Z ) 2025-11-03T15:49:28.5494290Z parser.add_argument( 2025-11-03T15:49:28.5494961Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:49:28.5495696Z ) 2025-11-03T15:49:28.5496067Z parser.add_argument( 2025-11-03T15:49:28.5496538Z "--github-ref-type", 2025-11-03T15:49:28.5496995Z type=str, 2025-11-03T15:49:28.5497405Z required=True, 2025-11-03T15:49:28.5497893Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:49:28.5498439Z ) 2025-11-03T15:49:28.5498810Z parser.add_argument( 2025-11-03T15:49:28.5499263Z "--eligible-experiments", 2025-11-03T15:49:28.5499788Z type=_str_comma_separated_to_set, 2025-11-03T15:49:28.5500558Z required=False, 2025-11-03T15:49:28.5500982Z default="", 2025-11-03T15:49:28.5501836Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:49:28.5502761Z ) 2025-11-03T15:49:28.5503125Z parser.add_argument( 2025-11-03T15:49:28.5503580Z "--opt-out-experiments", 2025-11-03T15:49:28.5504075Z type=_str_comma_separated_to_set, 2025-11-03T15:49:28.5504589Z required=False, 2025-11-03T15:49:28.5505012Z default="", 2025-11-03T15:49:28.5505395Z help=( 2025-11-03T15:49:28.5506060Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:49:28.5507179Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:49:28.5508005Z ), 2025-11-03T15:49:28.5508356Z ) 2025-11-03T15:49:28.5508725Z parser.add_argument( 2025-11-03T15:49:28.5509154Z "--pr-number", 2025-11-03T15:49:28.5509572Z type=str, 2025-11-03T15:49:28.5509970Z required=False, 2025-11-03T15:49:28.5510619Z default="", 2025-11-03T15:49:28.5511274Z help="the optional PR number where this is run", 2025-11-03T15:49:28.5511836Z ) 2025-11-03T15:49:28.5512039Z 2025-11-03T15:49:28.5512238Z return parser.parse_args() 2025-11-03T15:49:28.5512553Z 2025-11-03T15:49:28.5512560Z 2025-11-03T15:49:28.5512963Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:49:28.5513727Z auth = Auth.Token(github_token) 2025-11-03T15:49:28.5514240Z return Github(auth=auth) 2025-11-03T15:49:28.5514546Z 2025-11-03T15:49:28.5514553Z 2025-11-03T15:49:28.5515002Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:49:28.5515793Z repo = gh.get_repo(repo) 2025-11-03T15:49:28.5516327Z return repo.get_issue(number=issue_num) 2025-11-03T15:49:28.5516700Z 2025-11-03T15:49:28.5516706Z 2025-11-03T15:49:28.5516898Z def get_potential_pr_author( 2025-11-03T15:49:28.5517545Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:49:28.5518230Z ) -> str: 2025-11-03T15:49:28.5518754Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:49:28.5519551Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:49:28.5520478Z # embedded in the tag name: ciflow// 2025-11-03T15:49:28.5520902Z 2025-11-03T15:49:28.5521095Z gh = get_gh_client(github_token) 2025-11-03T15:49:28.5521433Z 2025-11-03T15:49:28.5521699Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:49:28.5522314Z split_tag = ref_name.split("/") 2025-11-03T15:49:28.5522817Z if ( 2025-11-03T15:49:28.5523211Z len(split_tag) == 3 2025-11-03T15:49:28.5523686Z and split_tag[0] == "ciflow" 2025-11-03T15:49:28.5524216Z and split_tag[2].isnumeric() 2025-11-03T15:49:28.5524708Z ): 2025-11-03T15:49:28.5525092Z pr_number = split_tag[2] 2025-11-03T15:49:28.5525713Z try: 2025-11-03T15:49:28.5526149Z repository = gh.get_repo(repo) 2025-11-03T15:49:28.5526747Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:49:28.5527345Z except Exception as e: 2025-11-03T15:49:28.5527856Z raise Exception( # noqa: TRY002 2025-11-03T15:49:28.5528528Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:49:28.5529165Z ) from e 2025-11-03T15:49:28.5529697Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:49:28.5530586Z # In all other cases, return the original input username 2025-11-03T15:49:28.5531165Z return username 2025-11-03T15:49:28.5531411Z 2025-11-03T15:49:28.5531418Z 2025-11-03T15:49:28.5531644Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:49:28.5532176Z """ 2025-11-03T15:49:28.5532816Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:49:28.5533592Z """ 2025-11-03T15:49:28.5534132Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:49:28.5534648Z 2025-11-03T15:49:28.5534656Z 2025-11-03T15:49:28.5534863Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:49:28.5535347Z try: 2025-11-03T15:49:28.5535735Z data = yaml.safe_load(yaml_text) 2025-11-03T15:49:28.5536234Z return data 2025-11-03T15:49:28.5536648Z except yaml.YAMLError: 2025-11-03T15:49:28.5537125Z log.exception("Error loading YAML") 2025-11-03T15:49:28.5537639Z raise 2025-11-03T15:49:28.5537854Z 2025-11-03T15:49:28.5537861Z 2025-11-03T15:49:28.5538290Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:49:28.5539019Z """ 2025-11-03T15:49:28.5539635Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:49:28.5540430Z 2025-11-03T15:49:28.5540932Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:49:28.5541702Z and the text below is the list of opted in users. 2025-11-03T15:49:28.5542102Z 2025-11-03T15:49:28.5542477Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:49:28.5543173Z """ 2025-11-03T15:49:28.5543614Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:49:28.5544225Z if len(rollout_state_parts) >= 2: 2025-11-03T15:49:28.5544835Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:49:28.5545420Z else: 2025-11-03T15:49:28.5545804Z return "", rollout_state 2025-11-03T15:49:28.5546115Z 2025-11-03T15:49:28.5546123Z 2025-11-03T15:49:28.5546331Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:49:28.5546834Z """ 2025-11-03T15:49:28.5547359Z Dictionary of users with a list of features they have opted into 2025-11-03T15:49:28.5547995Z """ 2025-11-03T15:49:28.5548198Z 2025-11-03T15:49:28.5548211Z 2025-11-03T15:49:28.5548553Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:49:28.5549197Z """ 2025-11-03T15:49:28.5549906Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:49:28.5550810Z 2025-11-03T15:49:28.5551439Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:49:28.5552423Z - Example line: "@User1,lf,split_build" 2025-11-03T15:49:28.5553103Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:49:28.5553580Z 2025-11-03T15:49:28.5553588Z 2025-11-03T15:49:28.5553743Z """ 2025-11-03T15:49:28.5554118Z optins = UserOptins() 2025-11-03T15:49:28.5554599Z for user in user_optin_text.split("\n"): 2025-11-03T15:49:28.5555155Z user = user.strip("\r\n\t -") 2025-11-03T15:49:28.5555705Z if not user or not user.startswith("@"): 2025-11-03T15:49:28.5556412Z # Not a valid user. Skip 2025-11-03T15:49:28.5556897Z continue 2025-11-03T15:49:28.5557141Z 2025-11-03T15:49:28.5557303Z if user: 2025-11-03T15:49:28.5557750Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:49:28.5558449Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:49:28.5558945Z 2025-11-03T15:49:28.5559112Z return optins 2025-11-03T15:49:28.5559346Z 2025-11-03T15:49:28.5559353Z 2025-11-03T15:49:28.5559640Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:49:28.5560410Z """ 2025-11-03T15:49:28.5560821Z Check if the experiment name is valid. 2025-11-03T15:49:28.5561341Z A valid name: 2025-11-03T15:49:28.5561980Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:49:28.5562937Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:49:28.5563674Z - Cannot contain spaces 2025-11-03T15:49:28.5564133Z """ 2025-11-03T15:49:28.5564341Z 2025-11-03T15:49:28.5564603Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:49:28.5565310Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:49:28.5565754Z 2025-11-03T15:49:28.5565913Z if valid: 2025-11-03T15:49:28.5566298Z return True 2025-11-03T15:49:28.5566542Z 2025-11-03T15:49:28.5566702Z log.error( 2025-11-03T15:49:28.5568158Z 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-11-03T15:49:28.5569737Z ) 2025-11-03T15:49:28.5570243Z return False 2025-11-03T15:49:28.5570515Z 2025-11-03T15:49:28.5570521Z 2025-11-03T15:49:28.5570826Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:49:28.5571442Z """ 2025-11-03T15:49:28.5572204Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:49:28.5572936Z """ 2025-11-03T15:49:28.5573283Z try: 2025-11-03T15:49:28.5573658Z if settings_text: 2025-11-03T15:49:28.5574382Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:49:28.5575172Z # for easy reading 2025-11-03T15:49:28.5575952Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:49:28.5576847Z # the backtick character in shell commands. 2025-11-03T15:49:28.5577450Z backtick = chr(96) # backtick character 2025-11-03T15:49:28.5578119Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:49:28.5578792Z settings = load_yaml(settings_text) 2025-11-03T15:49:28.5579166Z 2025-11-03T15:49:28.5579585Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:49:28.5580550Z experiments = {} 2025-11-03T15:49:28.5580850Z 2025-11-03T15:49:28.5581227Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:49:28.5582003Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:49:28.5583126Z # 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-11-03T15:49:28.5584164Z continue 2025-11-03T15:49:28.5584448Z 2025-11-03T15:49:28.5584638Z valid_settings = {} 2025-11-03T15:49:28.5585160Z for setting in exp_settings: 2025-11-03T15:49:28.5585731Z if setting not in Experiment._fields: 2025-11-03T15:49:28.5586288Z log.warning( 2025-11-03T15:49:28.5587005Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:49:28.5587878Z ) 2025-11-03T15:49:28.5588299Z else: 2025-11-03T15:49:28.5588816Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:49:28.5589241Z 2025-11-03T15:49:28.5589517Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:49:28.5590370Z return Settings(experiments) 2025-11-03T15:49:28.5590739Z 2025-11-03T15:49:28.5590926Z except Exception: 2025-11-03T15:49:28.5591406Z log.exception("Failed to parse settings") 2025-11-03T15:49:28.5591798Z 2025-11-03T15:49:28.5591976Z return Settings() 2025-11-03T15:49:28.5592228Z 2025-11-03T15:49:28.5592236Z 2025-11-03T15:49:28.5592485Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:49:28.5593057Z """ 2025-11-03T15:49:28.5593490Z Parse settings, if any, from the rollout state. 2025-11-03T15:49:28.5593901Z 2025-11-03T15:49:28.5594247Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:49:28.5595009Z and the text below is the list of opted in users. 2025-11-03T15:49:28.5595422Z 2025-11-03T15:49:28.5595827Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:49:28.5596565Z """ 2025-11-03T15:49:28.5597114Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:49:28.5597869Z return parse_settings_from_text(settings_text) 2025-11-03T15:49:28.5598269Z 2025-11-03T15:49:28.5598275Z 2025-11-03T15:49:28.5598521Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:49:28.5599080Z """ 2025-11-03T15:49:28.5599461Z Parse users from the rollout state. 2025-11-03T15:49:28.5599814Z 2025-11-03T15:49:28.5599968Z """ 2025-11-03T15:49:28.5600699Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:49:28.5601442Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:49:28.5601854Z 2025-11-03T15:49:28.5601861Z 2025-11-03T15:49:28.5602409Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:49:28.5603157Z """ 2025-11-03T15:49:28.5603572Z Check if a user is opted into an experiment 2025-11-03T15:49:28.5604100Z """ 2025-11-03T15:49:28.5604551Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:49:28.5604969Z 2025-11-03T15:49:28.5604976Z 2025-11-03T15:49:28.5605403Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:49:28.5606146Z """ 2025-11-03T15:49:28.5606596Z Check if a user explicitly opted out of an experiment 2025-11-03T15:49:28.5607171Z """ 2025-11-03T15:49:28.5607674Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:49:28.5608350Z experiment_optout = "-" + experiment_name 2025-11-03T15:49:28.5608982Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:49:28.5609590Z return False 2025-11-03T15:49:28.5609841Z 2025-11-03T15:49:28.5610287Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:49:28.5610919Z log.warning( 2025-11-03T15:49:28.5611724Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:49:28.5612605Z ) 2025-11-03T15:49:28.5612813Z 2025-11-03T15:49:28.5612979Z return True 2025-11-03T15:49:28.5613220Z 2025-11-03T15:49:28.5613227Z 2025-11-03T15:49:28.5613406Z def get_runner_prefix( 2025-11-03T15:49:28.5613853Z rollout_state: str, 2025-11-03T15:49:28.5614317Z workflow_requestors: Iterable[str], 2025-11-03T15:49:28.5614839Z branch: str, 2025-11-03T15:49:28.5615331Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:49:28.5616004Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:49:28.5616627Z is_canary: bool = False, 2025-11-03T15:49:28.5617091Z ) -> str: 2025-11-03T15:49:28.5617659Z settings = parse_settings(rollout_state) 2025-11-03T15:49:28.5618248Z user_optins = parse_users(rollout_state) 2025-11-03T15:49:28.5618617Z 2025-11-03T15:49:28.5618796Z fleet_prefix = "" 2025-11-03T15:49:28.5619210Z prefixes = [] 2025-11-03T15:49:28.5619832Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:49:28.5620977Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:49:28.5621695Z log.info( 2025-11-03T15:49:28.5622371Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:49:28.5623130Z ) 2025-11-03T15:49:28.5623506Z continue 2025-11-03T15:49:28.5623752Z 2025-11-03T15:49:28.5623939Z if opt_out_experiments: 2025-11-03T15:49:28.5624473Z if experiment_name in opt_out_experiments: 2025-11-03T15:49:28.5625116Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:49:28.5625719Z log.info( 2025-11-03T15:49:28.5626640Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:49:28.5627610Z ) 2025-11-03T15:49:28.5628000Z continue 2025-11-03T15:49:28.5628267Z 2025-11-03T15:49:28.5628456Z if eligible_experiments: 2025-11-03T15:49:28.5629041Z if experiment_name not in eligible_experiments: 2025-11-03T15:49:28.5629672Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:49:28.5630445Z log.info( 2025-11-03T15:49:28.5631246Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:49:28.5632083Z ) 2025-11-03T15:49:28.5632485Z continue 2025-11-03T15:49:28.5632970Z elif not experiment_settings.default: 2025-11-03T15:49:28.5633508Z log.info( 2025-11-03T15:49:28.5634299Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:49:28.5635051Z ) 2025-11-03T15:49:28.5635422Z continue 2025-11-03T15:49:28.5635673Z 2025-11-03T15:49:28.5635953Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:49:28.5636562Z opted_out_users = [ 2025-11-03T15:49:28.5637009Z requestor 2025-11-03T15:49:28.5637461Z for requestor in workflow_requestors 2025-11-03T15:49:28.5638134Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:49:28.5638761Z ] 2025-11-03T15:49:28.5638969Z 2025-11-03T15:49:28.5639154Z if opted_out_users: 2025-11-03T15:49:28.5639605Z log.info( 2025-11-03T15:49:28.5640401Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:49:28.5641112Z ) 2025-11-03T15:49:28.5641486Z continue 2025-11-03T15:49:28.5641750Z 2025-11-03T15:49:28.5642031Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:49:28.5642653Z opted_in_users = [ 2025-11-03T15:49:28.5643090Z requestor 2025-11-03T15:49:28.5643545Z for requestor in workflow_requestors 2025-11-03T15:49:28.5644211Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:49:28.5644835Z ] 2025-11-03T15:49:28.5645042Z 2025-11-03T15:49:28.5645211Z enabled = False 2025-11-03T15:49:28.5645644Z if opted_in_users: 2025-11-03T15:49:28.5646079Z log.info( 2025-11-03T15:49:28.5646679Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:49:28.5647367Z ) 2025-11-03T15:49:28.5647751Z enabled = True 2025-11-03T15:49:28.5648032Z 2025-11-03T15:49:28.5648260Z elif experiment_settings.rollout_perc: 2025-11-03T15:49:28.5649090Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:49:28.5650336Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:49:28.5651001Z log.info( 2025-11-03T15:49:28.5651866Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:49:28.5652784Z ) 2025-11-03T15:49:28.5653190Z enabled = True 2025-11-03T15:49:28.5653487Z 2025-11-03T15:49:28.5653659Z if enabled: 2025-11-03T15:49:28.5654076Z label = experiment_name 2025-11-03T15:49:28.5654635Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:49:28.5655476Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:49:28.5656364Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:49:28.5657139Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:49:28.5657807Z if is_canary: 2025-11-03T15:49:28.5658303Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:49:28.5658845Z fleet_prefix = label 2025-11-03T15:49:28.5659336Z else: 2025-11-03T15:49:28.5659760Z prefixes.append(label) 2025-11-03T15:49:28.5660285Z 2025-11-03T15:49:28.5660483Z if len(prefixes) > 1: 2025-11-03T15:49:28.5660929Z log.error( 2025-11-03T15:49:28.5661962Z 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-11-03T15:49:28.5663069Z ) 2025-11-03T15:49:28.5663449Z prefixes = prefixes[:1] 2025-11-03T15:49:28.5663756Z 2025-11-03T15:49:28.5663946Z # Fleet always comes first 2025-11-03T15:49:28.5664411Z if fleet_prefix: 2025-11-03T15:49:28.5664859Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:49:28.5665232Z 2025-11-03T15:49:28.5665602Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:49:28.5666026Z 2025-11-03T15:49:28.5666034Z 2025-11-03T15:49:28.5666479Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:49:28.5667252Z """ 2025-11-03T15:49:28.5667829Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:49:28.5668390Z 2025-11-03T15:49:28.5668775Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:49:28.5669476Z """ 2025-11-03T15:49:28.5669860Z gh = get_gh_client(github_token) 2025-11-03T15:49:28.5670617Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:49:28.5671258Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:49:28.5671706Z 2025-11-03T15:49:28.5671714Z 2025-11-03T15:49:28.5672121Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:49:28.5672888Z for _ in range(num_retries): 2025-11-03T15:49:28.5673373Z try: 2025-11-03T15:49:28.5673796Z req = Request(url=url, headers=headers) 2025-11-03T15:49:28.5674469Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:49:28.5675109Z return json.loads(content) 2025-11-03T15:49:28.5675637Z except Exception as e: 2025-11-03T15:49:28.5676177Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:49:28.5676581Z 2025-11-03T15:49:28.5676957Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:49:28.5677677Z return {} 2025-11-03T15:49:28.5677900Z 2025-11-03T15:49:28.5677906Z 2025-11-03T15:49:28.5678067Z @cache 2025-11-03T15:49:28.5678690Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:49:28.5679442Z """ 2025-11-03T15:49:28.5679832Z Dynamically get PR information 2025-11-03T15:49:28.5680697Z """ 2025-11-03T15:49:28.5681205Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:49:28.5681826Z headers = { 2025-11-03T15:49:28.5682274Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:49:28.5682888Z "Authorization": f"token {github_token}", 2025-11-03T15:49:28.5683418Z } 2025-11-03T15:49:28.5683841Z json_response: dict[str, Any] = download_json( 2025-11-03T15:49:28.5684438Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:49:28.5684980Z headers=headers, 2025-11-03T15:49:28.5685402Z ) 2025-11-03T15:49:28.5685602Z 2025-11-03T15:49:28.5685780Z if not json_response: 2025-11-03T15:49:28.5686348Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:49:28.5686954Z return {} 2025-11-03T15:49:28.5687195Z 2025-11-03T15:49:28.5687376Z return json_response 2025-11-03T15:49:28.5687652Z 2025-11-03T15:49:28.5687659Z 2025-11-03T15:49:28.5688059Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:49:28.5688803Z """ 2025-11-03T15:49:28.5689331Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:49:28.5689993Z """ 2025-11-03T15:49:28.5690941Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:49:28.5691570Z return { 2025-11-03T15:49:28.5692165Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:49:28.5692865Z } 2025-11-03T15:49:28.5693063Z 2025-11-03T15:49:28.5693077Z 2025-11-03T15:49:28.5693248Z def main() -> None: 2025-11-03T15:49:28.5693666Z args = parse_args() 2025-11-03T15:49:28.5693939Z 2025-11-03T15:49:28.5694158Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:49:28.5694545Z 2025-11-03T15:49:28.5694739Z # Check if the PR is opt-out 2025-11-03T15:49:28.5695218Z if args.pr_number: 2025-11-03T15:49:28.5695875Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:49:28.5696775Z if OPT_OUT_LABEL in labels: 2025-11-03T15:49:28.5697279Z log.info( 2025-11-03T15:49:28.5697957Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:49:28.5698722Z ) 2025-11-03T15:49:28.5699260Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:49:28.5699932Z sys.exit() 2025-11-03T15:49:28.5700301Z 2025-11-03T15:49:28.5700468Z try: 2025-11-03T15:49:28.5700905Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:49:28.5701614Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:49:28.5702254Z ) 2025-11-03T15:49:28.5702464Z 2025-11-03T15:49:28.5702667Z username = get_potential_pr_author( 2025-11-03T15:49:28.5703209Z args.github_token, 2025-11-03T15:49:28.5703692Z args.github_repo, 2025-11-03T15:49:28.5704161Z args.github_actor, 2025-11-03T15:49:28.5704653Z args.github_ref_type, 2025-11-03T15:49:28.5705157Z args.github_branch, 2025-11-03T15:49:28.5705620Z ) 2025-11-03T15:49:28.5705826Z 2025-11-03T15:49:28.5706113Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:49:28.5706565Z 2025-11-03T15:49:28.5706780Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:49:28.5707343Z rollout_state, 2025-11-03T15:49:28.5707821Z (args.github_issue_owner, username), 2025-11-03T15:49:28.5708372Z args.github_branch, 2025-11-03T15:49:28.5708863Z args.eligible_experiments, 2025-11-03T15:49:28.5709399Z args.opt_out_experiments, 2025-11-03T15:49:28.5709910Z is_canary, 2025-11-03T15:49:28.5710421Z ) 2025-11-03T15:49:28.5710631Z 2025-11-03T15:49:28.5710819Z except Exception as e: 2025-11-03T15:49:28.5711261Z log.error( 2025-11-03T15:49:28.5711929Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:49:28.5712822Z ) 2025-11-03T15:49:28.5713037Z 2025-11-03T15:49:28.5713364Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:49:28.5713863Z 2025-11-03T15:49:28.5713870Z 2025-11-03T15:49:28.5714049Z if __name__ == "__main__": 2025-11-03T15:49:28.5714485Z main() 2025-11-03T15:49:28.5714696Z 2025-11-03T15:49:28.5803962Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:49:28.5804844Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:49:28.5836740Z shell: /usr/bin/bash -e {0} 2025-11-03T15:49:28.5837218Z env: 2025-11-03T15:49:28.5837829Z GITHUB_TOKEN: *** 2025-11-03T15:49:28.5838234Z ISSUE_NUMBER: 5132 2025-11-03T15:49:28.5838686Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:49:28.5839199Z ISSUE_OWNER: 2025-11-03T15:49:28.5839605Z CHECK_EXPERIMENTS: 2025-11-03T15:49:28.5840048Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:49:28.5840687Z PR_NUMBER: 2025-11-03T15:49:28.5841068Z ##[endgroup] 2025-11-03T15:49:30.5946501Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:49:31.5225551Z Collecting urllib3==1.26.18 2025-11-03T15:49:31.5670574Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:49:31.5899518Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-11-03T15:49:31.6170231Z Collecting PyGithub==2.3.0 2025-11-03T15:49:31.6241309Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:49:31.6706242Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:49:31.6776827Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:49:31.6819523Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:49:31.6836541Z 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-11-03T15:49:31.6851888Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:49:31.7135266Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:49:31.7206699Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:49:31.7431532Z 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-11-03T15:49:31.8736343Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:49:31.8809929Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:49:32.0346887Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:49:32.0422343Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:49:32.0648952Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:49:32.0719056Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:49:32.0988813Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:49:32.1131126Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.9 MB/s eta 0:00:00 2025-11-03T15:49:32.1214702Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:49:32.1463599Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 14.8 MB/s eta 0:00:00 2025-11-03T15:49:32.1535598Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:49:32.2203538Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 21.4 MB/s eta 0:00:00 2025-11-03T15:49:32.2276628Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:49:32.2366385Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:49:32.2465062Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 26.0 MB/s eta 0:00:00 2025-11-03T15:49:32.2536885Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:49:32.2591409Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 30.3 MB/s eta 0:00:00 2025-11-03T15:49:32.2659868Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:49:32.2711414Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 30.6 MB/s eta 0:00:00 2025-11-03T15:49:32.6210472Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:49:33.1544959Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:49:33.2343485Z ##[group]Run curr_branch="main" 2025-11-03T15:49:33.2343770Z curr_branch="main" 2025-11-03T15:49:33.2343978Z curr_ref_type="branch" 2025-11-03T15:49:33.2344224Z echo "Current branch is '$curr_branch'" 2025-11-03T15:49:33.2344496Z  2025-11-03T15:49:33.2344679Z python3 runner_determinator.py \ 2025-11-03T15:49:33.2344946Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:49:33.2345215Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:49:33.2345482Z  --github-branch "$curr_branch" \ 2025-11-03T15:49:33.2345740Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:49:33.2346015Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:49:33.2346285Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:49:33.2346550Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:49:33.2346835Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:49:33.2347200Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:49:33.2347482Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:49:33.2380966Z shell: /usr/bin/bash -e {0} 2025-11-03T15:49:33.2381187Z env: 2025-11-03T15:49:33.2381725Z GITHUB_TOKEN: *** 2025-11-03T15:49:33.2381911Z ISSUE_NUMBER: 5132 2025-11-03T15:49:33.2382108Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:49:33.2382355Z ISSUE_OWNER: 2025-11-03T15:49:33.2382523Z CHECK_EXPERIMENTS: 2025-11-03T15:49:33.2382717Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:49:33.2382906Z PR_NUMBER: 2025-11-03T15:49:33.2383068Z ##[endgroup] 2025-11-03T15:49:33.2432446Z Current branch is 'main' 2025-11-03T15:49:34.8676365Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-11-03T15:49:34.8677428Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:49:34.8678412Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:49:34.8679270Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:49:34.8679947Z INFO : Setting output: label-type='lf.' 2025-11-03T15:49:34.8994017Z Evaluate and set job outputs 2025-11-03T15:49:34.9000006Z Set output 'label-type' 2025-11-03T15:49:34.9002050Z Cleaning up orphan processes