2025-08-26T19:31:40.3615272Z Current runner version: '2.328.0' 2025-08-26T19:31:40.3638504Z ##[group]Runner Image Provisioner 2025-08-26T19:31:40.3639298Z Hosted Compute Agent 2025-08-26T19:31:40.3639825Z Version: 20250825.382 2025-08-26T19:31:40.3640512Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:31:40.3641166Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:31:40.3641742Z ##[endgroup] 2025-08-26T19:31:40.3642323Z ##[group]Operating System 2025-08-26T19:31:40.3642873Z Ubuntu 2025-08-26T19:31:40.3643306Z 24.04.2 2025-08-26T19:31:40.3643817Z LTS 2025-08-26T19:31:40.3644235Z ##[endgroup] 2025-08-26T19:31:40.3644974Z ##[group]Runner Image 2025-08-26T19:31:40.3645679Z Image: ubuntu-24.04 2025-08-26T19:31:40.3646163Z Version: 20250818.1.0 2025-08-26T19:31:40.3647166Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:40.3648743Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:40.3649689Z ##[endgroup] 2025-08-26T19:31:40.3650646Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:40.3652675Z Metadata: read 2025-08-26T19:31:40.3653276Z ##[endgroup] 2025-08-26T19:31:40.3655715Z Secret source: Actions 2025-08-26T19:31:40.3656411Z Prepare workflow directory 2025-08-26T19:31:40.4165084Z Prepare all required actions 2025-08-26T19:31:40.4221031Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:40.4226290Z ##[group] Inputs 2025-08-26T19:31:40.4226892Z check_experiments: 2025-08-26T19:31:40.4227438Z opt_out_experiments: 2025-08-26T19:31:40.4227957Z triggering_actor: pytorchmergebot 2025-08-26T19:31:40.4228643Z issue_owner: 2025-08-26T19:31:40.4229099Z curr_branch: main 2025-08-26T19:31:40.4229630Z curr_ref_type: branch 2025-08-26T19:31:40.4230226Z issue_number: 5132 2025-08-26T19:31:40.4230817Z ##[endgroup] 2025-08-26T19:31:40.4231419Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:40.9961693Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:40.9964096Z cat < runner_determinator.py 2025-08-26T19:31:40.9965048Z # flake8: noqa: G004 2025-08-26T19:31:40.9965692Z  2025-08-26T19:31:40.9967027Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:40.9968143Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:40.9969193Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:40.9969946Z  2025-08-26T19:31:40.9970385Z """ 2025-08-26T19:31:40.9971192Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:40.9972229Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:40.9973474Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:40.9974539Z of which runners should be used to run which job. 2025-08-26T19:31:40.9975381Z  2025-08-26T19:31:40.9976165Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:40.9977271Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:40.9978345Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:40.9979154Z list, defined. 2025-08-26T19:31:40.9979798Z  2025-08-26T19:31:40.9980512Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:40.9981597Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:40.9982688Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:40.9983410Z  2025-08-26T19:31:40.9984115Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:40.9985881Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:40.9986791Z experiments which the user could be opted in to. 2025-08-26T19:31:40.9987495Z  2025-08-26T19:31:40.9988059Z The user list has the following rules: 2025-08-26T19:31:40.9988710Z  2025-08-26T19:31:40.9989389Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:40.9990490Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:40.9991440Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:40.9992094Z  2025-08-26T19:31:40.9992633Z Example config: 2025-08-26T19:31:40.9993233Z  # A list of experiments that can be opted into. 2025-08-26T19:31:40.9994109Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:40.9995315Z  # Expected syntax is: 2025-08-26T19:31:40.9996164Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:40.9997310Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.0083057Z  2025-08-26T19:31:41.0083560Z  experiments: 2025-08-26T19:31:41.0084065Z  lf: 2025-08-26T19:31:41.0084509Z  rollout_percent: 25 2025-08-26T19:31:41.0085188Z  all_branches: false 2025-08-26T19:31:41.0085696Z  default: true 2025-08-26T19:31:41.0086163Z  --- 2025-08-26T19:31:41.0086551Z  2025-08-26T19:31:41.0086946Z  # Opt-ins: 2025-08-26T19:31:41.0087609Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.0088796Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.0089684Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.0090423Z  # Experiments should be from the above list. 2025-08-26T19:31:41.0091005Z  2025-08-26T19:31:41.0091407Z  @User1,-lf,split_build 2025-08-26T19:31:41.0091936Z  @User2,lf 2025-08-26T19:31:41.0092394Z  @User3,split_build 2025-08-26T19:31:41.0092869Z """ 2025-08-26T19:31:41.0093255Z  2025-08-26T19:31:41.0093631Z import json 2025-08-26T19:31:41.0094067Z import logging 2025-08-26T19:31:41.0094507Z import os 2025-08-26T19:31:41.0095042Z import random 2025-08-26T19:31:41.0095475Z import re 2025-08-26T19:31:41.0095886Z import sys 2025-08-26T19:31:41.0096347Z from argparse import ArgumentParser 2025-08-26T19:31:41.0097007Z from collections.abc import Iterable 2025-08-26T19:31:41.0097592Z from functools import cache 2025-08-26T19:31:41.0098128Z from logging import LogRecord 2025-08-26T19:31:41.0098697Z from typing import Any, NamedTuple 2025-08-26T19:31:41.0099328Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.0099902Z  2025-08-26T19:31:41.0100283Z import yaml 2025-08-26T19:31:41.0100736Z from github import Auth, Github 2025-08-26T19:31:41.0101309Z from github.Issue import Issue 2025-08-26T19:31:41.0101818Z  2025-08-26T19:31:41.0102191Z  2025-08-26T19:31:41.0102646Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.0103420Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.0104388Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.0105256Z  2025-08-26T19:31:41.0105768Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.0106576Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.0107178Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.0107832Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.0108404Z  2025-08-26T19:31:41.0108840Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.0109386Z  2025-08-26T19:31:41.0109793Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.0110324Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.0110822Z  2025-08-26T19:31:41.0111178Z  2025-08-26T19:31:41.0111602Z class Experiment(NamedTuple): 2025-08-26T19:31:41.0112156Z  rollout_perc: float = ( 2025-08-26T19:31:41.0112901Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.0113647Z  ) 2025-08-26T19:31:41.0114067Z  all_branches: bool = ( 2025-08-26T19:31:41.0115117Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.0115884Z  ) 2025-08-26T19:31:41.0116296Z  default: bool = ( 2025-08-26T19:31:41.0116957Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.0117655Z  ) 2025-08-26T19:31:41.0118048Z  2025-08-26T19:31:41.0118456Z  # Add more fields as needed 2025-08-26T19:31:41.0118974Z  2025-08-26T19:31:41.0119346Z  2025-08-26T19:31:41.0119761Z class Settings(NamedTuple): 2025-08-26T19:31:41.0120271Z  """ 2025-08-26T19:31:41.0120809Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:41.0121436Z  """ 2025-08-26T19:31:41.0121832Z  2025-08-26T19:31:41.0122275Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.0122840Z  2025-08-26T19:31:41.0123378Z  2025-08-26T19:31:41.0123855Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.0124582Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.0125510Z  2025-08-26T19:31:41.0125897Z  COLORS = { 2025-08-26T19:31:41.0126372Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.0126943Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.0127493Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.0128091Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.0128650Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.0129171Z  } 2025-08-26T19:31:41.0129567Z  2025-08-26T19:31:41.0130067Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.0130925Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.0131782Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.0132430Z  return super().format(record) 2025-08-26T19:31:41.0132966Z  2025-08-26T19:31:41.0133332Z  2025-08-26T19:31:41.0133761Z handler = logging.StreamHandler() 2025-08-26T19:31:41.0134615Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.0135499Z  2025-08-26T19:31:41.0135996Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.0136653Z log.addHandler(handler) 2025-08-26T19:31:41.0137175Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.0137682Z  2025-08-26T19:31:41.0138045Z  2025-08-26T19:31:41.0138554Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.0139194Z  """ 2025-08-26T19:31:41.0139785Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.0140474Z  """ 2025-08-26T19:31:41.0141034Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:41.0142207Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.0143412Z  log.warning( 2025-08-26T19:31:41.0144374Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.0145481Z  ) 2025-08-26T19:31:41.0145982Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.0146585Z  return 2025-08-26T19:31:41.0147019Z  2025-08-26T19:31:41.0147444Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.0148087Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.0148716Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:41.0149247Z  2025-08-26T19:31:41.0149625Z  2025-08-26T19:31:41.0150185Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.0150902Z  return frozenset( 2025-08-26T19:31:41.0151625Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.0152359Z  ) 2025-08-26T19:31:41.0152757Z  2025-08-26T19:31:41.0153130Z  2025-08-26T19:31:41.0153532Z def parse_args() -> Any: 2025-08-26T19:31:41.0154216Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.0155481Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.0156331Z  parser.add_argument( 2025-08-26T19:31:41.0156880Z  "--github-issue-repo", 2025-08-26T19:31:41.0157431Z  type=str, 2025-08-26T19:31:41.0157914Z  required=False, 2025-08-26T19:31:41.0158597Z  default="pytorch/test-infra", 2025-08-26T19:31:41.0159233Z  help="GitHub repo to get the issue", 2025-08-26T19:31:41.0159800Z  ) 2025-08-26T19:31:41.0160239Z  parser.add_argument( 2025-08-26T19:31:41.0160763Z  "--github-repo", 2025-08-26T19:31:41.0161282Z  type=str, 2025-08-26T19:31:41.0161777Z  required=True, 2025-08-26T19:31:41.0162332Z  help="GitHub repo where CI is running", 2025-08-26T19:31:41.0162915Z  ) 2025-08-26T19:31:41.0163344Z  parser.add_argument( 2025-08-26T19:31:41.0164066Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.0164945Z  ) 2025-08-26T19:31:41.0165404Z  parser.add_argument( 2025-08-26T19:31:41.0166134Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.0166882Z  ) 2025-08-26T19:31:41.0167316Z  parser.add_argument( 2025-08-26T19:31:41.0168054Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.0168809Z  ) 2025-08-26T19:31:41.0169238Z  parser.add_argument( 2025-08-26T19:31:41.0170017Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.0170791Z  ) 2025-08-26T19:31:41.0171238Z  parser.add_argument( 2025-08-26T19:31:41.0171786Z  "--github-ref-type", 2025-08-26T19:31:41.0172313Z  type=str, 2025-08-26T19:31:41.0172798Z  required=True, 2025-08-26T19:31:41.0173404Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.0174007Z  ) 2025-08-26T19:31:41.0174436Z  parser.add_argument( 2025-08-26T19:31:41.0175089Z  "--eligible-experiments", 2025-08-26T19:31:41.0175832Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.0176427Z  required=False, 2025-08-26T19:31:41.0176928Z  default="", 2025-08-26T19:31:41.0177901Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.0178901Z  ) 2025-08-26T19:31:41.0179330Z  parser.add_argument( 2025-08-26T19:31:41.0179875Z  "--opt-out-experiments", 2025-08-26T19:31:41.0180464Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.0181043Z  required=False, 2025-08-26T19:31:41.0181535Z  default="", 2025-08-26T19:31:41.0182011Z  help=( 2025-08-26T19:31:41.0182778Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.0184002Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.0185016Z  ), 2025-08-26T19:31:41.0185439Z  ) 2025-08-26T19:31:41.0185873Z  parser.add_argument( 2025-08-26T19:31:41.0186391Z  "--pr-number", 2025-08-26T19:31:41.0186892Z  type=str, 2025-08-26T19:31:41.0187370Z  required=False, 2025-08-26T19:31:41.0187870Z  default="", 2025-08-26T19:31:41.0188446Z  help="the optional PR number where this is run", 2025-08-26T19:31:41.0189063Z  ) 2025-08-26T19:31:41.0189464Z  2025-08-26T19:31:41.0189886Z  return parser.parse_args() 2025-08-26T19:31:41.0190419Z  2025-08-26T19:31:41.0190790Z  2025-08-26T19:31:41.0191464Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.0192436Z  auth = Auth.Token(github_token) 2025-08-26T19:31:41.0193052Z  return Github(auth=auth) 2025-08-26T19:31:41.0193573Z  2025-08-26T19:31:41.0193950Z  2025-08-26T19:31:41.0194911Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.0195872Z  repo = gh.get_repo(repo) 2025-08-26T19:31:41.0196472Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.0197048Z  2025-08-26T19:31:41.0197425Z  2025-08-26T19:31:41.0197840Z def get_potential_pr_author( 2025-08-26T19:31:41.0198593Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.0199333Z ) -> str: 2025-08-26T19:31:41.0199934Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.0200845Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.0201685Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:41.0202326Z  2025-08-26T19:31:41.0202759Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.0203317Z  2025-08-26T19:31:41.0203851Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.0204553Z  split_tag = ref_name.split("/") 2025-08-26T19:31:41.0205728Z  if ( 2025-08-26T19:31:41.0206199Z  len(split_tag) == 3 2025-08-26T19:31:41.0206774Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:41.0207372Z  and split_tag[2].isnumeric() 2025-08-26T19:31:41.0207927Z  ): 2025-08-26T19:31:41.0208399Z  pr_number = split_tag[2] 2025-08-26T19:31:41.0208945Z  try: 2025-08-26T19:31:41.0209465Z  repository = gh.get_repo(repo) 2025-08-26T19:31:41.0210150Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.0211009Z  except Exception as e: 2025-08-26T19:31:41.0211613Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:41.0212363Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.0213074Z  ) from e 2025-08-26T19:31:41.0213711Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.0214507Z  # In all other cases, return the original input username 2025-08-26T19:31:41.0215304Z  return username 2025-08-26T19:31:41.0215776Z  2025-08-26T19:31:41.0216147Z  2025-08-26T19:31:41.0216621Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.0217214Z  """ 2025-08-26T19:31:41.0217957Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.0218811Z  """ 2025-08-26T19:31:41.0219429Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.0220153Z  2025-08-26T19:31:41.0220534Z  2025-08-26T19:31:41.0220969Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.0221521Z  try: 2025-08-26T19:31:41.0221981Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.0222555Z  return data 2025-08-26T19:31:41.0223050Z  except yaml.YAMLError: 2025-08-26T19:31:41.0223643Z  log.exception("Error loading YAML") 2025-08-26T19:31:41.0224211Z  raise 2025-08-26T19:31:41.0224742Z  2025-08-26T19:31:41.0225112Z  2025-08-26T19:31:41.0225788Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.0226593Z  """ 2025-08-26T19:31:41.0227424Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.0228281Z  2025-08-26T19:31:41.0228874Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.0229739Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.0230351Z  2025-08-26T19:31:41.0230983Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.0231746Z  """ 2025-08-26T19:31:41.0232262Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.0232940Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.0233644Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.0234538Z  else: 2025-08-26T19:31:41.0235305Z  return "", rollout_state 2025-08-26T19:31:41.0235846Z  2025-08-26T19:31:41.0236209Z  2025-08-26T19:31:41.0236673Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.0237244Z  """ 2025-08-26T19:31:41.0237844Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.0238551Z  """ 2025-08-26T19:31:41.0238938Z  2025-08-26T19:31:41.0239304Z  2025-08-26T19:31:41.0239880Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.0240595Z  """ 2025-08-26T19:31:41.0241385Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.0242272Z  2025-08-26T19:31:41.0243147Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.0244222Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.0245108Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.0245967Z  2025-08-26T19:31:41.0246335Z  2025-08-26T19:31:41.0246712Z  """ 2025-08-26T19:31:41.0247132Z  optins = UserOptins() 2025-08-26T19:31:41.0247710Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.0248330Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:41.0248959Z  if not user or not user.startswith("@"): 2025-08-26T19:31:41.0249571Z  # Not a valid user. Skip 2025-08-26T19:31:41.0250123Z  continue 2025-08-26T19:31:41.0250614Z  2025-08-26T19:31:41.0250988Z  if user: 2025-08-26T19:31:41.0251512Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.0252265Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.0252951Z  2025-08-26T19:31:41.0253340Z  return optins 2025-08-26T19:31:41.0253801Z  2025-08-26T19:31:41.0254157Z  2025-08-26T19:31:41.0254811Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.0255483Z  """ 2025-08-26T19:31:41.0255943Z  Check if the experiment name is valid. 2025-08-26T19:31:41.0256523Z  A valid name: 2025-08-26T19:31:41.0257265Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.0258295Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.0259065Z  - Cannot contain spaces 2025-08-26T19:31:41.0259585Z  """ 2025-08-26T19:31:41.0259979Z  2025-08-26T19:31:41.0260477Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.0261273Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.0262227Z  2025-08-26T19:31:41.0262712Z  if valid: 2025-08-26T19:31:41.0263164Z  return True 2025-08-26T19:31:41.0263619Z  2025-08-26T19:31:41.0263993Z  log.error( 2025-08-26T19:31:41.0265677Z  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-26T19:31:41.0267300Z  ) 2025-08-26T19:31:41.0267702Z  return False 2025-08-26T19:31:41.0268159Z  2025-08-26T19:31:41.0268518Z  2025-08-26T19:31:41.0269080Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.0269764Z  """ 2025-08-26T19:31:41.0270429Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.0271209Z  """ 2025-08-26T19:31:41.0271701Z  try: 2025-08-26T19:31:41.0272129Z  if settings_text: 2025-08-26T19:31:41.0272967Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.0273814Z  # for easy reading 2025-08-26T19:31:41.0274913Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.0275960Z  # the backtick character in shell commands. 2025-08-26T19:31:41.0276648Z  backtick = chr(96) # backtick character 2025-08-26T19:31:41.0277397Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.0278132Z  settings = load_yaml(settings_text) 2025-08-26T19:31:41.0278688Z  2025-08-26T19:31:41.0279349Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.0280306Z  experiments = {} 2025-08-26T19:31:41.0280801Z  2025-08-26T19:31:41.0281411Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.0282234Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.0283432Z  # 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-26T19:31:41.0284570Z  continue 2025-08-26T19:31:41.0285232Z  2025-08-26T19:31:41.0285645Z  valid_settings = {} 2025-08-26T19:31:41.0286229Z  for setting in exp_settings: 2025-08-26T19:31:41.0286863Z  if setting not in Experiment._fields: 2025-08-26T19:31:41.0287482Z  log.warning( 2025-08-26T19:31:41.0288286Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.0289054Z  ) 2025-08-26T19:31:41.0289543Z  else: 2025-08-26T19:31:41.0290146Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.0290765Z  2025-08-26T19:31:41.0291288Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.0291999Z  return Settings(experiments) 2025-08-26T19:31:41.0292542Z  2025-08-26T19:31:41.0292937Z  except Exception: 2025-08-26T19:31:41.0293510Z  log.exception("Failed to parse settings") 2025-08-26T19:31:41.0294101Z  2025-08-26T19:31:41.0294489Z  return Settings() 2025-08-26T19:31:41.0295081Z  2025-08-26T19:31:41.0295443Z  2025-08-26T19:31:41.0296061Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.0296711Z  """ 2025-08-26T19:31:41.0297224Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.0297824Z  2025-08-26T19:31:41.0298409Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.0299246Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.0299849Z  2025-08-26T19:31:41.0300507Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.0301297Z  """ 2025-08-26T19:31:41.0301935Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.0302788Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.0303381Z  2025-08-26T19:31:41.0303746Z  2025-08-26T19:31:41.0304245Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.0304979Z  """ 2025-08-26T19:31:41.0305438Z  Parse users from the rollout state. 2025-08-26T19:31:41.0305992Z  2025-08-26T19:31:41.0306363Z  """ 2025-08-26T19:31:41.0306968Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.0307791Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.0308385Z  2025-08-26T19:31:41.0308750Z  2025-08-26T19:31:41.0309420Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.0310234Z  """ 2025-08-26T19:31:41.0310717Z  Check if a user is opted into an experiment 2025-08-26T19:31:41.0311300Z  """ 2025-08-26T19:31:41.0311828Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.0312453Z  2025-08-26T19:31:41.0312819Z  2025-08-26T19:31:41.0313642Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.0314462Z  """ 2025-08-26T19:31:41.0315098Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.0315735Z  """ 2025-08-26T19:31:41.0316314Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.0317078Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.0317800Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.0318456Z  return False 2025-08-26T19:31:41.0318919Z  2025-08-26T19:31:41.0319425Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.0320083Z  log.warning( 2025-08-26T19:31:41.0320996Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.0321944Z  ) 2025-08-26T19:31:41.0322349Z  2025-08-26T19:31:41.0322724Z  return True 2025-08-26T19:31:41.0323172Z  2025-08-26T19:31:41.0323533Z  2025-08-26T19:31:41.0323929Z def get_runner_prefix( 2025-08-26T19:31:41.0324433Z  rollout_state: str, 2025-08-26T19:31:41.0325081Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:41.0325651Z  branch: str, 2025-08-26T19:31:41.0326229Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.0326994Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.0327633Z  is_canary: bool = False, 2025-08-26T19:31:41.0328176Z ) -> str: 2025-08-26T19:31:41.0328670Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:41.0329330Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.0329898Z  2025-08-26T19:31:41.0330413Z  fleet_prefix = "" 2025-08-26T19:31:41.0330913Z  prefixes = [] 2025-08-26T19:31:41.0331637Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.0332659Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.0333427Z  log.info( 2025-08-26T19:31:41.0334191Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.0335105Z  ) 2025-08-26T19:31:41.0335558Z  continue 2025-08-26T19:31:41.0336013Z  2025-08-26T19:31:41.0336420Z  if opt_out_experiments: 2025-08-26T19:31:41.0337035Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.0337749Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.0338399Z  log.info( 2025-08-26T19:31:41.0339434Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.0340500Z  ) 2025-08-26T19:31:41.0340969Z  continue 2025-08-26T19:31:41.0341440Z  2025-08-26T19:31:41.0341856Z  if eligible_experiments: 2025-08-26T19:31:41.0342491Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.0343198Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.0343810Z  log.info( 2025-08-26T19:31:41.0344771Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.0345677Z  ) 2025-08-26T19:31:41.0346137Z  continue 2025-08-26T19:31:41.0346836Z  elif not experiment_settings.default: 2025-08-26T19:31:41.0347424Z  log.info( 2025-08-26T19:31:41.0348166Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.0348961Z  ) 2025-08-26T19:31:41.0349394Z  continue 2025-08-26T19:31:41.0349851Z  2025-08-26T19:31:41.0350361Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.0351046Z  opted_out_users = [ 2025-08-26T19:31:41.0351562Z  requestor 2025-08-26T19:31:41.0352104Z  for requestor in workflow_requestors 2025-08-26T19:31:41.0352857Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.0353539Z  ] 2025-08-26T19:31:41.0353946Z  2025-08-26T19:31:41.0354353Z  if opted_out_users: 2025-08-26T19:31:41.0355007Z  log.info( 2025-08-26T19:31:41.0355720Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.0356476Z  ) 2025-08-26T19:31:41.0356919Z  continue 2025-08-26T19:31:41.0357378Z  2025-08-26T19:31:41.0357884Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.0358547Z  opted_in_users = [ 2025-08-26T19:31:41.0359088Z  requestor 2025-08-26T19:31:41.0359636Z  for requestor in workflow_requestors 2025-08-26T19:31:41.0360391Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.0361071Z  ] 2025-08-26T19:31:41.0361468Z  2025-08-26T19:31:41.0361861Z  enabled = False 2025-08-26T19:31:41.0362370Z  if opted_in_users: 2025-08-26T19:31:41.0363018Z  log.info( 2025-08-26T19:31:41.0363727Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.0364468Z  ) 2025-08-26T19:31:41.0365015Z  enabled = True 2025-08-26T19:31:41.0365516Z  2025-08-26T19:31:41.0365964Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.0367063Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.0368098Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.0368806Z  log.info( 2025-08-26T19:31:41.0369771Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.0370754Z  ) 2025-08-26T19:31:41.0371233Z  enabled = True 2025-08-26T19:31:41.0371751Z  2025-08-26T19:31:41.0372130Z  if enabled: 2025-08-26T19:31:41.0372639Z  label = experiment_name 2025-08-26T19:31:41.0373264Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.0374167Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.0375408Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.0376247Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.0376971Z  if is_canary: 2025-08-26T19:31:41.0377533Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.0378149Z  fleet_prefix = label 2025-08-26T19:31:41.0378697Z  else: 2025-08-26T19:31:41.0379209Z  prefixes.append(label) 2025-08-26T19:31:41.0379914Z  2025-08-26T19:31:41.0380307Z  if len(prefixes) > 1: 2025-08-26T19:31:41.0380814Z  log.error( 2025-08-26T19:31:41.0381953Z  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-26T19:31:41.0383159Z  ) 2025-08-26T19:31:41.0383611Z  prefixes = prefixes[:1] 2025-08-26T19:31:41.0384137Z  2025-08-26T19:31:41.0384550Z  # Fleet always comes first 2025-08-26T19:31:41.0385205Z  if fleet_prefix: 2025-08-26T19:31:41.0385736Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.0386288Z  2025-08-26T19:31:41.0386780Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.0387398Z  2025-08-26T19:31:41.0387768Z  2025-08-26T19:31:41.0388473Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.0389296Z  """ 2025-08-26T19:31:41.0389953Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.0390706Z  2025-08-26T19:31:41.0391344Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.0392113Z  """ 2025-08-26T19:31:41.0392568Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.0393189Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.0393904Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.0394560Z  2025-08-26T19:31:41.0395024Z  2025-08-26T19:31:41.0395765Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.0396713Z  for _ in range(num_retries): 2025-08-26T19:31:41.0397268Z  try: 2025-08-26T19:31:41.0397768Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:41.0398498Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.0399213Z  return json.loads(content) 2025-08-26T19:31:41.0399799Z  except Exception as e: 2025-08-26T19:31:41.0400427Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.0401021Z  2025-08-26T19:31:41.0401655Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.0402426Z  return {} 2025-08-26T19:31:41.0402855Z  2025-08-26T19:31:41.0403230Z  2025-08-26T19:31:41.0403591Z @cache 2025-08-26T19:31:41.0404295Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.0405224Z  """ 2025-08-26T19:31:41.0405686Z  Dynamically get PR information 2025-08-26T19:31:41.0406227Z  """ 2025-08-26T19:31:41.0406790Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.0407468Z  headers = { 2025-08-26T19:31:41.0408001Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.0408676Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:41.0409253Z  } 2025-08-26T19:31:41.0409754Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.0410424Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.0411020Z  headers=headers, 2025-08-26T19:31:41.0411509Z  ) 2025-08-26T19:31:41.0411892Z  2025-08-26T19:31:41.0412295Z  if not json_response: 2025-08-26T19:31:41.0412951Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.0413774Z  return {} 2025-08-26T19:31:41.0414225Z  2025-08-26T19:31:41.0414725Z  return json_response 2025-08-26T19:31:41.0415225Z  2025-08-26T19:31:41.0415596Z  2025-08-26T19:31:41.0416238Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.0417027Z  """ 2025-08-26T19:31:41.0417625Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.0418325Z  """ 2025-08-26T19:31:41.0418871Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.0419602Z  return { 2025-08-26T19:31:41.0420269Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.0421009Z  } 2025-08-26T19:31:41.0421394Z  2025-08-26T19:31:41.0421769Z  2025-08-26T19:31:41.0422158Z def main() -> None: 2025-08-26T19:31:41.0422654Z  args = parse_args() 2025-08-26T19:31:41.0423137Z  2025-08-26T19:31:41.0423599Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.0424179Z  2025-08-26T19:31:41.0424591Z  # Check if the PR is opt-out 2025-08-26T19:31:41.0425237Z  if args.pr_number: 2025-08-26T19:31:41.0425986Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.0426812Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.0427369Z  log.info( 2025-08-26T19:31:41.0428182Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.0428989Z  ) 2025-08-26T19:31:41.0429624Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.0430367Z  sys.exit() 2025-08-26T19:31:41.0430967Z  2025-08-26T19:31:41.0431348Z  try: 2025-08-26T19:31:41.0431846Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.0432631Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.0433315Z  ) 2025-08-26T19:31:41.0433731Z  2025-08-26T19:31:41.0434166Z  username = get_potential_pr_author( 2025-08-26T19:31:41.0434863Z  args.github_token, 2025-08-26T19:31:41.0435414Z  args.github_repo, 2025-08-26T19:31:41.0435956Z  args.github_actor, 2025-08-26T19:31:41.0436510Z  args.github_ref_type, 2025-08-26T19:31:41.0437072Z  args.github_branch, 2025-08-26T19:31:41.0437585Z  ) 2025-08-26T19:31:41.0437987Z  2025-08-26T19:31:41.0438525Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.0439184Z  2025-08-26T19:31:41.0439642Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.0440245Z  rollout_state, 2025-08-26T19:31:41.0440811Z  (args.github_issue_owner, username), 2025-08-26T19:31:41.0441414Z  args.github_branch, 2025-08-26T19:31:41.0441985Z  args.eligible_experiments, 2025-08-26T19:31:41.0442587Z  args.opt_out_experiments, 2025-08-26T19:31:41.0443138Z  is_canary, 2025-08-26T19:31:41.0443620Z  ) 2025-08-26T19:31:41.0444023Z  2025-08-26T19:31:41.0444423Z  except Exception as e: 2025-08-26T19:31:41.0445051Z  log.error( 2025-08-26T19:31:41.0445822Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.0446628Z  ) 2025-08-26T19:31:41.0447034Z  2025-08-26T19:31:41.0447815Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.0448526Z  2025-08-26T19:31:41.0448904Z  2025-08-26T19:31:41.0449298Z if __name__ == "__main__": 2025-08-26T19:31:41.0449793Z  main() 2025-08-26T19:31:41.0450216Z  2025-08-26T19:31:41.0450585Z EOF 2025-08-26T19:31:41.0450967Z  2025-08-26T19:31:41.0451373Z cat runner_determinator.py 2025-08-26T19:31:41.1952834Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.1953742Z env: 2025-08-26T19:31:41.1954470Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.1955066Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.1955519Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.1956027Z ISSUE_OWNER: 2025-08-26T19:31:41.1956424Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.1956849Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:41.1957272Z PR_NUMBER: 2025-08-26T19:31:41.1957649Z ##[endgroup] 2025-08-26T19:31:41.2170867Z # flake8: noqa: G004 2025-08-26T19:31:41.2171217Z 2025-08-26T19:31:41.2171681Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:41.2172642Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:41.2173440Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:41.2173901Z 2025-08-26T19:31:41.2174053Z """ 2025-08-26T19:31:41.2174841Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:41.2175812Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:41.2176736Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:41.2177538Z of which runners should be used to run which job. 2025-08-26T19:31:41.2177948Z 2025-08-26T19:31:41.2178330Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:41.2179417Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:41.2180314Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:41.2181018Z list, defined. 2025-08-26T19:31:41.2181244Z 2025-08-26T19:31:41.2181603Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:41.2182539Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:41.2183364Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:41.2183811Z 2025-08-26T19:31:41.2184179Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:41.2185435Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:41.2186194Z experiments which the user could be opted in to. 2025-08-26T19:31:41.2186608Z 2025-08-26T19:31:41.2186814Z The user list has the following rules: 2025-08-26T19:31:41.2187171Z 2025-08-26T19:31:41.2187482Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:41.2188352Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:41.2189111Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:41.2189498Z 2025-08-26T19:31:41.2189663Z Example config: 2025-08-26T19:31:41.2190124Z # A list of experiments that can be opted into. 2025-08-26T19:31:41.2190803Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:41.2191430Z # Expected syntax is: 2025-08-26T19:31:41.2192060Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:41.2193028Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.2193629Z 2025-08-26T19:31:41.2193804Z experiments: 2025-08-26T19:31:41.2194183Z lf: 2025-08-26T19:31:41.2194575Z rollout_percent: 25 2025-08-26T19:31:41.2195337Z all_branches: false 2025-08-26T19:31:41.2196008Z default: true 2025-08-26T19:31:41.2196414Z --- 2025-08-26T19:31:41.2196621Z 2025-08-26T19:31:41.2196785Z # Opt-ins: 2025-08-26T19:31:41.2197350Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.2198220Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.2198980Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.2199635Z # Experiments should be from the above list. 2025-08-26T19:31:41.2200013Z 2025-08-26T19:31:41.2200222Z @User1,-lf,split_build 2025-08-26T19:31:41.2200654Z @User2,lf 2025-08-26T19:31:41.2201047Z @User3,split_build 2025-08-26T19:31:41.2201445Z """ 2025-08-26T19:31:41.2201643Z 2025-08-26T19:31:41.2201806Z import json 2025-08-26T19:31:41.2202167Z import logging 2025-08-26T19:31:41.2202546Z import os 2025-08-26T19:31:41.2202906Z import random 2025-08-26T19:31:41.2203283Z import re 2025-08-26T19:31:41.2203635Z import sys 2025-08-26T19:31:41.2204051Z from argparse import ArgumentParser 2025-08-26T19:31:41.2204578Z from collections.abc import Iterable 2025-08-26T19:31:41.2205348Z from functools import cache 2025-08-26T19:31:41.2205822Z from logging import LogRecord 2025-08-26T19:31:41.2206307Z from typing import Any, NamedTuple 2025-08-26T19:31:41.2206835Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.2207201Z 2025-08-26T19:31:41.2207363Z import yaml 2025-08-26T19:31:41.2207752Z from github import Auth, Github 2025-08-26T19:31:41.2208226Z from github.Issue import Issue 2025-08-26T19:31:41.2208535Z 2025-08-26T19:31:41.2208542Z 2025-08-26T19:31:41.2208759Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.2209435Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.2210294Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.2210855Z 2025-08-26T19:31:41.2211080Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.2211789Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.2212316Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.2212858Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.2213218Z 2025-08-26T19:31:41.2213409Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.2213736Z 2025-08-26T19:31:41.2213924Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.2214373Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.2214826Z 2025-08-26T19:31:41.2214840Z 2025-08-26T19:31:41.2215033Z class Experiment(NamedTuple): 2025-08-26T19:31:41.2215518Z rollout_perc: float = ( 2025-08-26T19:31:41.2216164Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.2216832Z ) 2025-08-26T19:31:41.2217201Z all_branches: bool = ( 2025-08-26T19:31:41.2217816Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.2218482Z ) 2025-08-26T19:31:41.2218835Z default: bool = ( 2025-08-26T19:31:41.2219403Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.2220037Z ) 2025-08-26T19:31:41.2220228Z 2025-08-26T19:31:41.2220407Z # Add more fields as needed 2025-08-26T19:31:41.2220710Z 2025-08-26T19:31:41.2220718Z 2025-08-26T19:31:41.2220901Z class Settings(NamedTuple): 2025-08-26T19:31:41.2221334Z """ 2025-08-26T19:31:41.2221772Z Settings for the experiments that can be opted into. 2025-08-26T19:31:41.2222334Z """ 2025-08-26T19:31:41.2222526Z 2025-08-26T19:31:41.2222727Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.2223084Z 2025-08-26T19:31:41.2223097Z 2025-08-26T19:31:41.2223300Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.2223909Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.2224346Z 2025-08-26T19:31:41.2224503Z COLORS = { 2025-08-26T19:31:41.2225005Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.2225533Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.2226199Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.2226705Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.2227185Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.2227638Z } 2025-08-26T19:31:41.2227837Z 2025-08-26T19:31:41.2228052Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.2228796Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.2229569Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.2230143Z return super().format(record) 2025-08-26T19:31:41.2230476Z 2025-08-26T19:31:41.2230483Z 2025-08-26T19:31:41.2230677Z handler = logging.StreamHandler() 2025-08-26T19:31:41.2231375Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.2231920Z 2025-08-26T19:31:41.2232159Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.2232732Z log.addHandler(handler) 2025-08-26T19:31:41.2233168Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.2233462Z 2025-08-26T19:31:41.2233469Z 2025-08-26T19:31:41.2233710Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.2234260Z """ 2025-08-26T19:31:41.2234857Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.2235484Z """ 2025-08-26T19:31:41.2235849Z if not GITHUB_OUTPUT: 2025-08-26T19:31:41.2236914Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.2238037Z log.warning( 2025-08-26T19:31:41.2238901Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.2239827Z ) 2025-08-26T19:31:41.2250262Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.2250888Z return 2025-08-26T19:31:41.2251123Z 2025-08-26T19:31:41.2251514Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.2252123Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.2252699Z f.write(f"{key}={value}\n") 2025-08-26T19:31:41.2253041Z 2025-08-26T19:31:41.2253048Z 2025-08-26T19:31:41.2253357Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.2254006Z return frozenset( 2025-08-26T19:31:41.2254823Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.2255532Z ) 2025-08-26T19:31:41.2255733Z 2025-08-26T19:31:41.2255739Z 2025-08-26T19:31:41.2255921Z def parse_args() -> Any: 2025-08-26T19:31:41.2256498Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.2257381Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.2258179Z parser.add_argument( 2025-08-26T19:31:41.2258640Z "--github-issue-repo", 2025-08-26T19:31:41.2259103Z type=str, 2025-08-26T19:31:41.2259516Z required=False, 2025-08-26T19:31:41.2259971Z default="pytorch/test-infra", 2025-08-26T19:31:41.2260514Z help="GitHub repo to get the issue", 2025-08-26T19:31:41.2261013Z ) 2025-08-26T19:31:41.2261384Z parser.add_argument( 2025-08-26T19:31:41.2261831Z "--github-repo", 2025-08-26T19:31:41.2262272Z type=str, 2025-08-26T19:31:41.2262666Z required=True, 2025-08-26T19:31:41.2263132Z help="GitHub repo where CI is running", 2025-08-26T19:31:41.2263655Z ) 2025-08-26T19:31:41.2264031Z parser.add_argument( 2025-08-26T19:31:41.2264770Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.2265435Z ) 2025-08-26T19:31:41.2265807Z parser.add_argument( 2025-08-26T19:31:41.2266444Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.2317258Z ) 2025-08-26T19:31:41.2317760Z parser.add_argument( 2025-08-26T19:31:41.2318513Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.2319442Z ) 2025-08-26T19:31:41.2319821Z parser.add_argument( 2025-08-26T19:31:41.2320501Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.2321230Z ) 2025-08-26T19:31:41.2321609Z parser.add_argument( 2025-08-26T19:31:41.2322062Z "--github-ref-type", 2025-08-26T19:31:41.2322523Z type=str, 2025-08-26T19:31:41.2322925Z required=True, 2025-08-26T19:31:41.2323407Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.2323951Z ) 2025-08-26T19:31:41.2324316Z parser.add_argument( 2025-08-26T19:31:41.2324957Z "--eligible-experiments", 2025-08-26T19:31:41.2325507Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.2326032Z required=False, 2025-08-26T19:31:41.2326448Z default="", 2025-08-26T19:31:41.2327291Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.2328225Z ) 2025-08-26T19:31:41.2328595Z parser.add_argument( 2025-08-26T19:31:41.2329047Z "--opt-out-experiments", 2025-08-26T19:31:41.2329548Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.2330059Z required=False, 2025-08-26T19:31:41.2330472Z default="", 2025-08-26T19:31:41.2330861Z help=( 2025-08-26T19:31:41.2331518Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.2332630Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.2333450Z ), 2025-08-26T19:31:41.2333806Z ) 2025-08-26T19:31:41.2334162Z parser.add_argument( 2025-08-26T19:31:41.2334595Z "--pr-number", 2025-08-26T19:31:41.2335143Z type=str, 2025-08-26T19:31:41.2335535Z required=False, 2025-08-26T19:31:41.2335940Z default="", 2025-08-26T19:31:41.2336540Z help="the optional PR number where this is run", 2025-08-26T19:31:41.2337107Z ) 2025-08-26T19:31:41.2337301Z 2025-08-26T19:31:41.2337488Z return parser.parse_args() 2025-08-26T19:31:41.2337797Z 2025-08-26T19:31:41.2337804Z 2025-08-26T19:31:41.2338205Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.2338946Z auth = Auth.Token(github_token) 2025-08-26T19:31:41.2339446Z return Github(auth=auth) 2025-08-26T19:31:41.2339740Z 2025-08-26T19:31:41.2339747Z 2025-08-26T19:31:41.2340201Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.2340990Z repo = gh.get_repo(repo) 2025-08-26T19:31:41.2341493Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.2341854Z 2025-08-26T19:31:41.2341861Z 2025-08-26T19:31:41.2342044Z def get_potential_pr_author( 2025-08-26T19:31:41.2342683Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.2343363Z ) -> str: 2025-08-26T19:31:41.2343873Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.2344777Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.2345507Z # embedded in the tag name: ciflow// 2025-08-26T19:31:41.2345930Z 2025-08-26T19:31:41.2346114Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.2346440Z 2025-08-26T19:31:41.2346705Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.2347327Z split_tag = ref_name.split("/") 2025-08-26T19:31:41.2347819Z if ( 2025-08-26T19:31:41.2348194Z len(split_tag) == 3 2025-08-26T19:31:41.2348663Z and split_tag[0] == "ciflow" 2025-08-26T19:31:41.2349176Z and split_tag[2].isnumeric() 2025-08-26T19:31:41.2349661Z ): 2025-08-26T19:31:41.2350028Z pr_number = split_tag[2] 2025-08-26T19:31:41.2350502Z try: 2025-08-26T19:31:41.2351091Z repository = gh.get_repo(repo) 2025-08-26T19:31:41.2351691Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.2352272Z except Exception as e: 2025-08-26T19:31:41.2352778Z raise Exception( # noqa: TRY002 2025-08-26T19:31:41.2353433Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.2354069Z ) from e 2025-08-26T19:31:41.2354601Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.2355393Z # In all other cases, return the original input username 2025-08-26T19:31:41.2355969Z return username 2025-08-26T19:31:41.2356207Z 2025-08-26T19:31:41.2356214Z 2025-08-26T19:31:41.2356434Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.2356969Z """ 2025-08-26T19:31:41.2357601Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.2358371Z """ 2025-08-26T19:31:41.2358908Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.2359422Z 2025-08-26T19:31:41.2359429Z 2025-08-26T19:31:41.2359622Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.2360108Z try: 2025-08-26T19:31:41.2360490Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.2360989Z return data 2025-08-26T19:31:41.2361392Z except yaml.YAMLError: 2025-08-26T19:31:41.2361870Z log.exception("Error loading YAML") 2025-08-26T19:31:41.2362376Z raise 2025-08-26T19:31:41.2362589Z 2025-08-26T19:31:41.2362596Z 2025-08-26T19:31:41.2363010Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.2363741Z """ 2025-08-26T19:31:41.2364343Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.2365080Z 2025-08-26T19:31:41.2365553Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.2366334Z and the text below is the list of opted in users. 2025-08-26T19:31:41.2366729Z 2025-08-26T19:31:41.2367101Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.2367849Z """ 2025-08-26T19:31:41.2368474Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.2369095Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.2369682Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.2370271Z else: 2025-08-26T19:31:41.2370638Z return "", rollout_state 2025-08-26T19:31:41.2370942Z 2025-08-26T19:31:41.2370949Z 2025-08-26T19:31:41.2371148Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.2371648Z """ 2025-08-26T19:31:41.2372154Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.2372794Z """ 2025-08-26T19:31:41.2372985Z 2025-08-26T19:31:41.2372991Z 2025-08-26T19:31:41.2373345Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.2373991Z """ 2025-08-26T19:31:41.2374808Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.2375502Z 2025-08-26T19:31:41.2376115Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.2377102Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.2377773Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.2378253Z 2025-08-26T19:31:41.2378260Z 2025-08-26T19:31:41.2378415Z """ 2025-08-26T19:31:41.2378780Z optins = UserOptins() 2025-08-26T19:31:41.2379256Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.2379818Z user = user.strip("\r\n\t -") 2025-08-26T19:31:41.2380346Z if not user or not user.startswith("@"): 2025-08-26T19:31:41.2380898Z # Not a valid user. Skip 2025-08-26T19:31:41.2381524Z continue 2025-08-26T19:31:41.2381764Z 2025-08-26T19:31:41.2381926Z if user: 2025-08-26T19:31:41.2382355Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.2383034Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.2383529Z 2025-08-26T19:31:41.2383694Z return optins 2025-08-26T19:31:41.2383932Z 2025-08-26T19:31:41.2383939Z 2025-08-26T19:31:41.2384216Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.2384921Z """ 2025-08-26T19:31:41.2385312Z Check if the experiment name is valid. 2025-08-26T19:31:41.2385838Z A valid name: 2025-08-26T19:31:41.2386469Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.2387416Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.2388144Z - Cannot contain spaces 2025-08-26T19:31:41.2388616Z """ 2025-08-26T19:31:41.2388810Z 2025-08-26T19:31:41.2389073Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.2389773Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.2390217Z 2025-08-26T19:31:41.2390381Z if valid: 2025-08-26T19:31:41.2390753Z return True 2025-08-26T19:31:41.2390992Z 2025-08-26T19:31:41.2391151Z log.error( 2025-08-26T19:31:41.2392612Z 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-26T19:31:41.2394186Z ) 2025-08-26T19:31:41.2394542Z return False 2025-08-26T19:31:41.2394870Z 2025-08-26T19:31:41.2394877Z 2025-08-26T19:31:41.2395184Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.2395805Z """ 2025-08-26T19:31:41.2396499Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.2397245Z """ 2025-08-26T19:31:41.2397592Z try: 2025-08-26T19:31:41.2397967Z if settings_text: 2025-08-26T19:31:41.2398699Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.2399489Z # for easy reading 2025-08-26T19:31:41.2400286Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.2401176Z # the backtick character in shell commands. 2025-08-26T19:31:41.2401787Z backtick = chr(96) # backtick character 2025-08-26T19:31:41.2402448Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.2403119Z settings = load_yaml(settings_text) 2025-08-26T19:31:41.2403505Z 2025-08-26T19:31:41.2403928Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.2404843Z experiments = {} 2025-08-26T19:31:41.2405149Z 2025-08-26T19:31:41.2405543Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.2406327Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.2407464Z # 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-26T19:31:41.2408516Z continue 2025-08-26T19:31:41.2408799Z 2025-08-26T19:31:41.2408982Z valid_settings = {} 2025-08-26T19:31:41.2409503Z for setting in exp_settings: 2025-08-26T19:31:41.2410067Z if setting not in Experiment._fields: 2025-08-26T19:31:41.2410625Z log.warning( 2025-08-26T19:31:41.2411325Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.2412044Z ) 2025-08-26T19:31:41.2412597Z else: 2025-08-26T19:31:41.2413107Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.2413535Z 2025-08-26T19:31:41.2413814Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.2414440Z return Settings(experiments) 2025-08-26T19:31:41.2415259Z 2025-08-26T19:31:41.2415454Z except Exception: 2025-08-26T19:31:41.2415925Z log.exception("Failed to parse settings") 2025-08-26T19:31:41.2416319Z 2025-08-26T19:31:41.2416487Z return Settings() 2025-08-26T19:31:41.2416743Z 2025-08-26T19:31:41.2416750Z 2025-08-26T19:31:41.2417003Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.2417573Z """ 2025-08-26T19:31:41.2418014Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.2418424Z 2025-08-26T19:31:41.2418793Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.2419571Z and the text below is the list of opted in users. 2025-08-26T19:31:41.2419976Z 2025-08-26T19:31:41.2420383Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.2421115Z """ 2025-08-26T19:31:41.2421666Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.2422428Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.2422826Z 2025-08-26T19:31:41.2422832Z 2025-08-26T19:31:41.2423078Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.2423628Z """ 2025-08-26T19:31:41.2424014Z Parse users from the rollout state. 2025-08-26T19:31:41.2424369Z 2025-08-26T19:31:41.2424527Z """ 2025-08-26T19:31:41.2425159Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.2425957Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.2426361Z 2025-08-26T19:31:41.2426367Z 2025-08-26T19:31:41.2426920Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.2427688Z """ 2025-08-26T19:31:41.2428106Z Check if a user is opted into an experiment 2025-08-26T19:31:41.2428643Z """ 2025-08-26T19:31:41.2429096Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.2429524Z 2025-08-26T19:31:41.2429530Z 2025-08-26T19:31:41.2429946Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.2430700Z """ 2025-08-26T19:31:41.2431152Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.2431745Z """ 2025-08-26T19:31:41.2432238Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.2432922Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.2433569Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.2434181Z return False 2025-08-26T19:31:41.2434436Z 2025-08-26T19:31:41.2434832Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.2435442Z log.warning( 2025-08-26T19:31:41.2436252Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.2437139Z ) 2025-08-26T19:31:41.2437356Z 2025-08-26T19:31:41.2437523Z return True 2025-08-26T19:31:41.2437757Z 2025-08-26T19:31:41.2437764Z 2025-08-26T19:31:41.2437942Z def get_runner_prefix( 2025-08-26T19:31:41.2438389Z rollout_state: str, 2025-08-26T19:31:41.2438851Z workflow_requestors: Iterable[str], 2025-08-26T19:31:41.2439387Z branch: str, 2025-08-26T19:31:41.2439886Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.2440551Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.2441142Z is_canary: bool = False, 2025-08-26T19:31:41.2441593Z ) -> str: 2025-08-26T19:31:41.2442012Z settings = parse_settings(rollout_state) 2025-08-26T19:31:41.2442736Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.2443117Z 2025-08-26T19:31:41.2443289Z fleet_prefix = "" 2025-08-26T19:31:41.2443712Z prefixes = [] 2025-08-26T19:31:41.2444341Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.2445400Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.2446119Z log.info( 2025-08-26T19:31:41.2446810Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.2447573Z ) 2025-08-26T19:31:41.2447953Z continue 2025-08-26T19:31:41.2448200Z 2025-08-26T19:31:41.2448389Z if opt_out_experiments: 2025-08-26T19:31:41.2448930Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.2449571Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.2450148Z log.info( 2025-08-26T19:31:41.2451097Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.2452079Z ) 2025-08-26T19:31:41.2452476Z continue 2025-08-26T19:31:41.2452744Z 2025-08-26T19:31:41.2452930Z if eligible_experiments: 2025-08-26T19:31:41.2453526Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.2454169Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.2454817Z log.info( 2025-08-26T19:31:41.2455616Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.2456469Z ) 2025-08-26T19:31:41.2456868Z continue 2025-08-26T19:31:41.2457340Z elif not experiment_settings.default: 2025-08-26T19:31:41.2457880Z log.info( 2025-08-26T19:31:41.2458660Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.2459426Z ) 2025-08-26T19:31:41.2459803Z continue 2025-08-26T19:31:41.2460050Z 2025-08-26T19:31:41.2460330Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.2460954Z opted_out_users = [ 2025-08-26T19:31:41.2461391Z requestor 2025-08-26T19:31:41.2461850Z for requestor in workflow_requestors 2025-08-26T19:31:41.2462522Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.2463157Z ] 2025-08-26T19:31:41.2463367Z 2025-08-26T19:31:41.2463552Z if opted_out_users: 2025-08-26T19:31:41.2463996Z log.info( 2025-08-26T19:31:41.2464609Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.2465422Z ) 2025-08-26T19:31:41.2465801Z continue 2025-08-26T19:31:41.2466045Z 2025-08-26T19:31:41.2466326Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.2466968Z opted_in_users = [ 2025-08-26T19:31:41.2467418Z requestor 2025-08-26T19:31:41.2467874Z for requestor in workflow_requestors 2025-08-26T19:31:41.2468539Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.2469159Z ] 2025-08-26T19:31:41.2469366Z 2025-08-26T19:31:41.2469541Z enabled = False 2025-08-26T19:31:41.2469966Z if opted_in_users: 2025-08-26T19:31:41.2470402Z log.info( 2025-08-26T19:31:41.2470996Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.2471679Z ) 2025-08-26T19:31:41.2472063Z enabled = True 2025-08-26T19:31:41.2472347Z 2025-08-26T19:31:41.2472565Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.2473412Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.2474488Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.2475261Z log.info( 2025-08-26T19:31:41.2476132Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.2477068Z ) 2025-08-26T19:31:41.2477471Z enabled = True 2025-08-26T19:31:41.2477779Z 2025-08-26T19:31:41.2477944Z if enabled: 2025-08-26T19:31:41.2478383Z label = experiment_name 2025-08-26T19:31:41.2478947Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.2479788Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.2480672Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.2481438Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.2482119Z if is_canary: 2025-08-26T19:31:41.2482609Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.2483163Z fleet_prefix = label 2025-08-26T19:31:41.2483649Z else: 2025-08-26T19:31:41.2484076Z prefixes.append(label) 2025-08-26T19:31:41.2484428Z 2025-08-26T19:31:41.2484608Z if len(prefixes) > 1: 2025-08-26T19:31:41.2485156Z log.error( 2025-08-26T19:31:41.2486212Z 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-26T19:31:41.2487340Z ) 2025-08-26T19:31:41.2487726Z prefixes = prefixes[:1] 2025-08-26T19:31:41.2488314Z 2025-08-26T19:31:41.2488670Z # Fleet always comes first 2025-08-26T19:31:41.2489515Z if fleet_prefix: 2025-08-26T19:31:41.2490031Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.2490396Z 2025-08-26T19:31:41.2490809Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.2491242Z 2025-08-26T19:31:41.2491248Z 2025-08-26T19:31:41.2491701Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.2492489Z """ 2025-08-26T19:31:41.2493075Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.2493650Z 2025-08-26T19:31:41.2494041Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.2494889Z """ 2025-08-26T19:31:41.2495282Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.2495841Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.2496477Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.2496931Z 2025-08-26T19:31:41.2496938Z 2025-08-26T19:31:41.2497343Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.2498124Z for _ in range(num_retries): 2025-08-26T19:31:41.2498634Z try: 2025-08-26T19:31:41.2499064Z req = Request(url=url, headers=headers) 2025-08-26T19:31:41.2499722Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.2500364Z return json.loads(content) 2025-08-26T19:31:41.2500894Z except Exception as e: 2025-08-26T19:31:41.2501435Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.2501839Z 2025-08-26T19:31:41.2502218Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.2502938Z return {} 2025-08-26T19:31:41.2503161Z 2025-08-26T19:31:41.2503168Z 2025-08-26T19:31:41.2503329Z @cache 2025-08-26T19:31:41.2503954Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.2504818Z """ 2025-08-26T19:31:41.2505217Z Dynamically get PR information 2025-08-26T19:31:41.2505704Z """ 2025-08-26T19:31:41.2506215Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.2506990Z headers = { 2025-08-26T19:31:41.2507451Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.2508069Z "Authorization": f"token {github_token}", 2025-08-26T19:31:41.2508609Z } 2025-08-26T19:31:41.2509030Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.2509643Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.2510186Z headers=headers, 2025-08-26T19:31:41.2510607Z ) 2025-08-26T19:31:41.2510806Z 2025-08-26T19:31:41.2510988Z if not json_response: 2025-08-26T19:31:41.2511556Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.2512165Z return {} 2025-08-26T19:31:41.2512406Z 2025-08-26T19:31:41.2512582Z return json_response 2025-08-26T19:31:41.2512856Z 2025-08-26T19:31:41.2512862Z 2025-08-26T19:31:41.2513265Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.2513995Z """ 2025-08-26T19:31:41.2514520Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.2515291Z """ 2025-08-26T19:31:41.2515788Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.2516400Z return { 2025-08-26T19:31:41.2516991Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.2517694Z } 2025-08-26T19:31:41.2517894Z 2025-08-26T19:31:41.2517901Z 2025-08-26T19:31:41.2518069Z def main() -> None: 2025-08-26T19:31:41.2518487Z args = parse_args() 2025-08-26T19:31:41.2518760Z 2025-08-26T19:31:41.2518985Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.2519382Z 2025-08-26T19:31:41.2519572Z # Check if the PR is opt-out 2025-08-26T19:31:41.2520059Z if args.pr_number: 2025-08-26T19:31:41.2520720Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.2521600Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.2522106Z log.info( 2025-08-26T19:31:41.2522792Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.2523559Z ) 2025-08-26T19:31:41.2524112Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.2524888Z sys.exit() 2025-08-26T19:31:41.2525159Z 2025-08-26T19:31:41.2525317Z try: 2025-08-26T19:31:41.2525780Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.2526501Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.2527142Z ) 2025-08-26T19:31:41.2527345Z 2025-08-26T19:31:41.2527549Z username = get_potential_pr_author( 2025-08-26T19:31:41.2528100Z args.github_token, 2025-08-26T19:31:41.2528574Z args.github_repo, 2025-08-26T19:31:41.2529051Z args.github_actor, 2025-08-26T19:31:41.2529527Z args.github_ref_type, 2025-08-26T19:31:41.2530031Z args.github_branch, 2025-08-26T19:31:41.2530486Z ) 2025-08-26T19:31:41.2530699Z 2025-08-26T19:31:41.2530982Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.2531435Z 2025-08-26T19:31:41.2531655Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.2532203Z rollout_state, 2025-08-26T19:31:41.2532692Z (args.github_issue_owner, username), 2025-08-26T19:31:41.2533237Z args.github_branch, 2025-08-26T19:31:41.2533736Z args.eligible_experiments, 2025-08-26T19:31:41.2534270Z args.opt_out_experiments, 2025-08-26T19:31:41.2534893Z is_canary, 2025-08-26T19:31:41.2535306Z ) 2025-08-26T19:31:41.2535520Z 2025-08-26T19:31:41.2535703Z except Exception as e: 2025-08-26T19:31:41.2536158Z log.error( 2025-08-26T19:31:41.2536824Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.2537732Z ) 2025-08-26T19:31:41.2537941Z 2025-08-26T19:31:41.2538272Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.2538783Z 2025-08-26T19:31:41.2538789Z 2025-08-26T19:31:41.2538962Z if __name__ == "__main__": 2025-08-26T19:31:41.2539396Z main() 2025-08-26T19:31:41.2539610Z 2025-08-26T19:31:41.2631471Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.2632382Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.2673131Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.2673608Z env: 2025-08-26T19:31:41.2674221Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.2674769Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.2675217Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.2675727Z ISSUE_OWNER: 2025-08-26T19:31:41.2676134Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.2676553Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:41.2676974Z PR_NUMBER: 2025-08-26T19:31:41.2677343Z ##[endgroup] 2025-08-26T19:31:42.1658949Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:42.8040887Z Collecting urllib3==1.26.18 2025-08-26T19:31:42.8706424Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:42.8986865Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.6 MB/s eta 0:00:00 2025-08-26T19:31:42.9338710Z Collecting PyGithub==2.3.0 2025-08-26T19:31:42.9485581Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:43.0064876Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:43.0216695Z 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-26T19:31:43.0260491Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:43.0276871Z 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-26T19:31:43.0291049Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:43.0679121Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:43.0826594Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:43.1058860Z 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-26T19:31:43.2548975Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.2699924Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:43.4135976Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:43.4284359Z 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-26T19:31:43.4611613Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.4755539Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:43.5094542Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:43.5271859Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.4 MB/s eta 0:00:00 2025-08-26T19:31:43.5421830Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:43.5607077Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 20.8 MB/s eta 0:00:00 2025-08-26T19:31:43.5752545Z 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-26T19:31:43.5943330Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 49.0 MB/s eta 0:00:00 2025-08-26T19:31:43.6092540Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:43.6258538Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:43.6326674Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 100.9 MB/s eta 0:00:00 2025-08-26T19:31:43.6471442Z 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-26T19:31:43.6512278Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.2 MB/s eta 0:00:00 2025-08-26T19:31:43.6660572Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:43.6701077Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 42.5 MB/s eta 0:00:00 2025-08-26T19:31:43.9647200Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:44.4930688Z 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-26T19:31:44.5708205Z ##[group]Run curr_branch="main" 2025-08-26T19:31:44.5708500Z curr_branch="main" 2025-08-26T19:31:44.5708720Z curr_ref_type="branch" 2025-08-26T19:31:44.5708970Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:44.5709244Z  2025-08-26T19:31:44.5709423Z python3 runner_determinator.py \ 2025-08-26T19:31:44.5709692Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:44.5709953Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:44.5710200Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:44.5710461Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:44.5710736Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:44.5710998Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:44.5711262Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:44.5711549Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:44.5711903Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:44.5712186Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:44.5754026Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:44.5754256Z env: 2025-08-26T19:31:44.5754975Z GITHUB_TOKEN: *** 2025-08-26T19:31:44.5755168Z ISSUE_NUMBER: 5132 2025-08-26T19:31:44.5755375Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:44.5755594Z ISSUE_OWNER: 2025-08-26T19:31:44.5755781Z CHECK_EXPERIMENTS: 2025-08-26T19:31:44.5755962Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:44.5756140Z PR_NUMBER: 2025-08-26T19:31:44.5756296Z ##[endgroup] 2025-08-26T19:31:44.5813023Z Current branch is 'main' 2025-08-26T19:31:45.9145550Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:45.9146915Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:45.9148130Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:45.9149054Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:45.9453618Z Evaluate and set job outputs 2025-08-26T19:31:45.9459752Z Set output 'label-type' 2025-08-26T19:31:45.9461530Z Cleaning up orphan processes