2025-08-26T19:31:43.4149815Z Current runner version: '2.328.0' 2025-08-26T19:31:43.4181749Z ##[group]Runner Image Provisioner 2025-08-26T19:31:43.4182729Z Hosted Compute Agent 2025-08-26T19:31:43.4183268Z Version: 20250818.377 2025-08-26T19:31:43.4183879Z Commit: 3c593e9f75fe0b87e893bca80d6e12ba089c61fc 2025-08-26T19:31:43.4184631Z Build Date: 2025-08-18T14:52:18Z 2025-08-26T19:31:43.4185265Z ##[endgroup] 2025-08-26T19:31:43.4185788Z ##[group]Operating System 2025-08-26T19:31:43.4186439Z Ubuntu 2025-08-26T19:31:43.4186944Z 24.04.2 2025-08-26T19:31:43.4187386Z LTS 2025-08-26T19:31:43.4187913Z ##[endgroup] 2025-08-26T19:31:43.4188394Z ##[group]Runner Image 2025-08-26T19:31:43.4188988Z Image: ubuntu-24.04 2025-08-26T19:31:43.4189918Z Version: 20250818.1.0 2025-08-26T19:31:43.4191066Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:43.4192594Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:43.4193669Z ##[endgroup] 2025-08-26T19:31:43.4194681Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:43.4196874Z Contents: read 2025-08-26T19:31:43.4197449Z Metadata: read 2025-08-26T19:31:43.4197922Z ##[endgroup] 2025-08-26T19:31:43.4200660Z Secret source: Actions 2025-08-26T19:31:43.4201380Z Prepare workflow directory 2025-08-26T19:31:43.4839782Z Prepare all required actions 2025-08-26T19:31:43.4920626Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:43.4927836Z ##[group] Inputs 2025-08-26T19:31:43.4928682Z check_experiments: 2025-08-26T19:31:43.4929996Z opt_out_experiments: lf 2025-08-26T19:31:43.4930979Z triggering_actor: pytorchmergebot 2025-08-26T19:31:43.4931952Z issue_owner: 2025-08-26T19:31:43.4932835Z curr_branch: main 2025-08-26T19:31:43.4933671Z curr_ref_type: branch 2025-08-26T19:31:43.4934701Z issue_number: 5132 2025-08-26T19:31:43.4935456Z ##[endgroup] 2025-08-26T19:31:43.4936639Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:44.0817205Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:44.0819944Z cat < runner_determinator.py 2025-08-26T19:31:44.0820862Z # flake8: noqa: G004 2025-08-26T19:31:44.0821478Z  2025-08-26T19:31:44.0822270Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:44.0823475Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:44.0824482Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:44.0825230Z  2025-08-26T19:31:44.0825650Z """ 2025-08-26T19:31:44.0826511Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:44.0827678Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:44.0828988Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:44.0830136Z of which runners should be used to run which job. 2025-08-26T19:31:44.0830867Z  2025-08-26T19:31:44.0831713Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:44.0832776Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:44.0833875Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:44.0834870Z list, defined. 2025-08-26T19:31:44.0835379Z  2025-08-26T19:31:44.0836087Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:44.0837229Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:44.0838276Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:44.0839034Z  2025-08-26T19:31:44.0840796Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:44.0841922Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:44.0842830Z experiments which the user could be opted in to. 2025-08-26T19:31:44.0843615Z  2025-08-26T19:31:44.0844138Z The user list has the following rules: 2025-08-26T19:31:44.0844802Z  2025-08-26T19:31:44.0845596Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:44.0846635Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:44.0847577Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:44.0848227Z  2025-08-26T19:31:44.0848819Z Example config: 2025-08-26T19:31:44.0849695Z  # A list of experiments that can be opted into. 2025-08-26T19:31:44.0850544Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:44.0851471Z  # Expected syntax is: 2025-08-26T19:31:44.0852284Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:44.0853429Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:44.0854441Z  2025-08-26T19:31:44.0854889Z  experiments: 2025-08-26T19:31:44.0855435Z  lf: 2025-08-26T19:31:44.0940477Z  rollout_percent: 25 2025-08-26T19:31:44.0941074Z  all_branches: false 2025-08-26T19:31:44.0941633Z  default: true 2025-08-26T19:31:44.0942128Z  --- 2025-08-26T19:31:44.0942538Z  2025-08-26T19:31:44.0942914Z  # Opt-ins: 2025-08-26T19:31:44.0943609Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:44.0944838Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:44.0945767Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:44.0946527Z  # Experiments should be from the above list. 2025-08-26T19:31:44.0947114Z  2025-08-26T19:31:44.0947524Z  @User1,-lf,split_build 2025-08-26T19:31:44.0948041Z  @User2,lf 2025-08-26T19:31:44.0948511Z  @User3,split_build 2025-08-26T19:31:44.0949040Z """ 2025-08-26T19:31:44.0949577Z  2025-08-26T19:31:44.0949984Z import json 2025-08-26T19:31:44.0950435Z import logging 2025-08-26T19:31:44.0950888Z import os 2025-08-26T19:31:44.0951333Z import random 2025-08-26T19:31:44.0951781Z import re 2025-08-26T19:31:44.0952195Z import sys 2025-08-26T19:31:44.0952678Z from argparse import ArgumentParser 2025-08-26T19:31:44.0953353Z from collections.abc import Iterable 2025-08-26T19:31:44.0953955Z from functools import cache 2025-08-26T19:31:44.0954510Z from logging import LogRecord 2025-08-26T19:31:44.0955110Z from typing import Any, NamedTuple 2025-08-26T19:31:44.0955749Z from urllib.request import Request, urlopen 2025-08-26T19:31:44.0956343Z  2025-08-26T19:31:44.0956725Z import yaml 2025-08-26T19:31:44.0957188Z from github import Auth, Github 2025-08-26T19:31:44.0957770Z from github.Issue import Issue 2025-08-26T19:31:44.0958295Z  2025-08-26T19:31:44.0958664Z  2025-08-26T19:31:44.0959136Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:44.0960316Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:44.0961326Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:44.0962095Z  2025-08-26T19:31:44.0962773Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:44.0963425Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:44.0964025Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:44.0964693Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:44.0965263Z  2025-08-26T19:31:44.0965695Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:44.0966243Z  2025-08-26T19:31:44.0966654Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:44.0967186Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:44.0967695Z  2025-08-26T19:31:44.0968064Z  2025-08-26T19:31:44.0968473Z class Experiment(NamedTuple): 2025-08-26T19:31:44.0969039Z  rollout_perc: float = ( 2025-08-26T19:31:44.0969942Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:44.0970691Z  ) 2025-08-26T19:31:44.0971121Z  all_branches: bool = ( 2025-08-26T19:31:44.0971874Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:44.0972607Z  ) 2025-08-26T19:31:44.0973066Z  default: bool = ( 2025-08-26T19:31:44.0973737Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:44.0974433Z  ) 2025-08-26T19:31:44.0974823Z  2025-08-26T19:31:44.0975230Z  # Add more fields as needed 2025-08-26T19:31:44.0975755Z  2025-08-26T19:31:44.0976159Z  2025-08-26T19:31:44.0976567Z class Settings(NamedTuple): 2025-08-26T19:31:44.0977078Z  """ 2025-08-26T19:31:44.0977624Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:44.0978259Z  """ 2025-08-26T19:31:44.0978650Z  2025-08-26T19:31:44.0979088Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:44.0979749Z  2025-08-26T19:31:44.0980268Z  2025-08-26T19:31:44.0980716Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:44.0981436Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:44.0982072Z  2025-08-26T19:31:44.0982452Z  COLORS = { 2025-08-26T19:31:44.0982939Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:44.0983520Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:44.0984081Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:44.0984640Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:44.0985197Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:44.0985723Z  } 2025-08-26T19:31:44.0986128Z  2025-08-26T19:31:44.0986582Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:44.0987419Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:44.0988302Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:44.0988952Z  return super().format(record) 2025-08-26T19:31:44.0989644Z  2025-08-26T19:31:44.0990009Z  2025-08-26T19:31:44.0990450Z handler = logging.StreamHandler() 2025-08-26T19:31:44.0991268Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:44.0992047Z  2025-08-26T19:31:44.0992559Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:44.0993209Z log.addHandler(handler) 2025-08-26T19:31:44.0993731Z log.setLevel(logging.INFO) 2025-08-26T19:31:44.0994229Z  2025-08-26T19:31:44.0994604Z  2025-08-26T19:31:44.0995099Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:44.0995769Z  """ 2025-08-26T19:31:44.0996356Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:44.0997205Z  """ 2025-08-26T19:31:44.0997639Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:44.0998812Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:44.1000370Z  log.warning( 2025-08-26T19:31:44.1001342Z  "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:44.1002391Z  ) 2025-08-26T19:31:44.1002896Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:44.1003541Z  return 2025-08-26T19:31:44.1003981Z  2025-08-26T19:31:44.1004408Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:44.1005068Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:44.1005703Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:44.1006247Z  2025-08-26T19:31:44.1006627Z  2025-08-26T19:31:44.1007186Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:44.1007908Z  return frozenset( 2025-08-26T19:31:44.1008622Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:44.1009672Z  ) 2025-08-26T19:31:44.1010081Z  2025-08-26T19:31:44.1010495Z  2025-08-26T19:31:44.1010914Z def parse_args() -> Any: 2025-08-26T19:31:44.1011598Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:44.1012589Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:44.1013424Z  parser.add_argument( 2025-08-26T19:31:44.1013959Z  "--github-issue-repo", 2025-08-26T19:31:44.1014505Z  type=str, 2025-08-26T19:31:44.1014993Z  required=False, 2025-08-26T19:31:44.1015680Z  default="pytorch/test-infra", 2025-08-26T19:31:44.1016322Z  help="GitHub repo to get the issue", 2025-08-26T19:31:44.1016893Z  ) 2025-08-26T19:31:44.1017312Z  parser.add_argument( 2025-08-26T19:31:44.1017830Z  "--github-repo", 2025-08-26T19:31:44.1018338Z  type=str, 2025-08-26T19:31:44.1018821Z  required=True, 2025-08-26T19:31:44.1019625Z  help="GitHub repo where CI is running", 2025-08-26T19:31:44.1020227Z  ) 2025-08-26T19:31:44.1020680Z  parser.add_argument( 2025-08-26T19:31:44.1021404Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:44.1022136Z  ) 2025-08-26T19:31:44.1022562Z  parser.add_argument( 2025-08-26T19:31:44.1023301Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:44.1024059Z  ) 2025-08-26T19:31:44.1024487Z  parser.add_argument( 2025-08-26T19:31:44.1025248Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:44.1026018Z  ) 2025-08-26T19:31:44.1026439Z  parser.add_argument( 2025-08-26T19:31:44.1027210Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:44.1027992Z  ) 2025-08-26T19:31:44.1028429Z  parser.add_argument( 2025-08-26T19:31:44.1028963Z  "--github-ref-type", 2025-08-26T19:31:44.1029717Z  type=str, 2025-08-26T19:31:44.1030204Z  required=True, 2025-08-26T19:31:44.1030800Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:44.1031414Z  ) 2025-08-26T19:31:44.1031836Z  parser.add_argument( 2025-08-26T19:31:44.1032380Z  "--eligible-experiments", 2025-08-26T19:31:44.1033148Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:44.1033732Z  required=False, 2025-08-26T19:31:44.1034229Z  default="", 2025-08-26T19:31:44.1035199Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:44.1036203Z  ) 2025-08-26T19:31:44.1036622Z  parser.add_argument( 2025-08-26T19:31:44.1037158Z  "--opt-out-experiments", 2025-08-26T19:31:44.1037746Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:44.1038345Z  required=False, 2025-08-26T19:31:44.1038844Z  default="", 2025-08-26T19:31:44.1039627Z  help=( 2025-08-26T19:31:44.1040436Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:44.1041683Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:44.1042595Z  ), 2025-08-26T19:31:44.1043007Z  ) 2025-08-26T19:31:44.1043429Z  parser.add_argument( 2025-08-26T19:31:44.1043943Z  "--pr-number", 2025-08-26T19:31:44.1044444Z  type=str, 2025-08-26T19:31:44.1044927Z  required=False, 2025-08-26T19:31:44.1045424Z  default="", 2025-08-26T19:31:44.1045999Z  help="the optional PR number where this is run", 2025-08-26T19:31:44.1046607Z  ) 2025-08-26T19:31:44.1047004Z  2025-08-26T19:31:44.1047410Z  return parser.parse_args() 2025-08-26T19:31:44.1047944Z  2025-08-26T19:31:44.1048307Z  2025-08-26T19:31:44.1048966Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:44.1050096Z  auth = Auth.Token(github_token) 2025-08-26T19:31:44.1050723Z  return Github(auth=auth) 2025-08-26T19:31:44.1051240Z  2025-08-26T19:31:44.1051607Z  2025-08-26T19:31:44.1052327Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:44.1053209Z  repo = gh.get_repo(repo) 2025-08-26T19:31:44.1053808Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:44.1054392Z  2025-08-26T19:31:44.1054760Z  2025-08-26T19:31:44.1055166Z def get_potential_pr_author( 2025-08-26T19:31:44.1055914Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:44.1056656Z ) -> str: 2025-08-26T19:31:44.1057256Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:44.1058161Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:44.1059015Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:44.1059753Z  2025-08-26T19:31:44.1060200Z  gh = get_gh_client(github_token) 2025-08-26T19:31:44.1060749Z  2025-08-26T19:31:44.1061268Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:44.1061971Z  split_tag = ref_name.split("/") 2025-08-26T19:31:44.1062539Z  if ( 2025-08-26T19:31:44.1062999Z  len(split_tag) == 3 2025-08-26T19:31:44.1063571Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:44.1064183Z  and split_tag[2].isnumeric() 2025-08-26T19:31:44.1064734Z  ): 2025-08-26T19:31:44.1065202Z  pr_number = split_tag[2] 2025-08-26T19:31:44.1065756Z  try: 2025-08-26T19:31:44.1066267Z  repository = gh.get_repo(repo) 2025-08-26T19:31:44.1067101Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:44.1067779Z  except Exception as e: 2025-08-26T19:31:44.1068379Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:44.1069130Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:44.1069957Z  ) from e 2025-08-26T19:31:44.1070596Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:44.1071382Z  # In all other cases, return the original input username 2025-08-26T19:31:44.1072051Z  return username 2025-08-26T19:31:44.1072518Z  2025-08-26T19:31:44.1072890Z  2025-08-26T19:31:44.1073352Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:44.1073946Z  """ 2025-08-26T19:31:44.1074692Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:44.1075545Z  """ 2025-08-26T19:31:44.1076168Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:44.1076900Z  2025-08-26T19:31:44.1077273Z  2025-08-26T19:31:44.1077697Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:44.1078256Z  try: 2025-08-26T19:31:44.1078707Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:44.1079546Z  return data 2025-08-26T19:31:44.1080102Z  except yaml.YAMLError: 2025-08-26T19:31:44.1080691Z  log.exception("Error loading YAML") 2025-08-26T19:31:44.1081266Z  raise 2025-08-26T19:31:44.1081696Z  2025-08-26T19:31:44.1082062Z  2025-08-26T19:31:44.1082730Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:44.1083540Z  """ 2025-08-26T19:31:44.1084402Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:44.1085229Z  2025-08-26T19:31:44.1085841Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:44.1086702Z  and the text below is the list of opted in users. 2025-08-26T19:31:44.1087320Z  2025-08-26T19:31:44.1087952Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:44.1088718Z  """ 2025-08-26T19:31:44.1089794Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:44.1090479Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:44.1091180Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:44.1091827Z  else: 2025-08-26T19:31:44.1092278Z  return "", rollout_state 2025-08-26T19:31:44.1093001Z  2025-08-26T19:31:44.1093426Z  2025-08-26T19:31:44.1093870Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:44.1094447Z  """ 2025-08-26T19:31:44.1095045Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:44.1095774Z  """ 2025-08-26T19:31:44.1096165Z  2025-08-26T19:31:44.1096526Z  2025-08-26T19:31:44.1097119Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:44.1097829Z  """ 2025-08-26T19:31:44.1098636Z  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:44.1099639Z  2025-08-26T19:31:44.1100522Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:44.1101597Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:44.1102505Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:44.1103188Z  2025-08-26T19:31:44.1103547Z  2025-08-26T19:31:44.1103913Z  """ 2025-08-26T19:31:44.1104325Z  optins = UserOptins() 2025-08-26T19:31:44.1104905Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:44.1105521Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:44.1106143Z  if not user or not user.startswith("@"): 2025-08-26T19:31:44.1106762Z  # Not a valid user. Skip 2025-08-26T19:31:44.1107301Z  continue 2025-08-26T19:31:44.1107759Z  2025-08-26T19:31:44.1108130Z  if user: 2025-08-26T19:31:44.1108686Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:44.1109565Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:44.1110277Z  2025-08-26T19:31:44.1110666Z  return optins 2025-08-26T19:31:44.1111116Z  2025-08-26T19:31:44.1111486Z  2025-08-26T19:31:44.1112025Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:44.1112703Z  """ 2025-08-26T19:31:44.1113158Z  Check if the experiment name is valid. 2025-08-26T19:31:44.1113733Z  A valid name: 2025-08-26T19:31:44.1114471Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:44.1115498Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:44.1116281Z  - Cannot contain spaces 2025-08-26T19:31:44.1116803Z  """ 2025-08-26T19:31:44.1117195Z  2025-08-26T19:31:44.1117691Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:44.1118492Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:44.1119358Z  2025-08-26T19:31:44.1119752Z  if valid: 2025-08-26T19:31:44.1120203Z  return True 2025-08-26T19:31:44.1120686Z  2025-08-26T19:31:44.1121052Z  log.error( 2025-08-26T19:31:44.1122627Z  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:44.1124258Z  ) 2025-08-26T19:31:44.1124663Z  return False 2025-08-26T19:31:44.1125106Z  2025-08-26T19:31:44.1125469Z  2025-08-26T19:31:44.1126029Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:44.1126728Z  """ 2025-08-26T19:31:44.1127385Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:44.1128169Z  """ 2025-08-26T19:31:44.1128562Z  try: 2025-08-26T19:31:44.1128986Z  if settings_text: 2025-08-26T19:31:44.1129908Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:44.1130757Z  # for easy reading 2025-08-26T19:31:44.1131693Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:44.1132660Z  # the backtick character in shell commands. 2025-08-26T19:31:44.1133333Z  backtick = chr(96) # backtick character 2025-08-26T19:31:44.1134078Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:44.1134807Z  settings = load_yaml(settings_text) 2025-08-26T19:31:44.1135368Z  2025-08-26T19:31:44.1136011Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:44.1136977Z  experiments = {} 2025-08-26T19:31:44.1137482Z  2025-08-26T19:31:44.1138095Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:44.1138940Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:44.1140238Z  # 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:44.1141351Z  continue 2025-08-26T19:31:44.1141841Z  2025-08-26T19:31:44.1142247Z  valid_settings = {} 2025-08-26T19:31:44.1142836Z  for setting in exp_settings: 2025-08-26T19:31:44.1143465Z  if setting not in Experiment._fields: 2025-08-26T19:31:44.1144084Z  log.warning( 2025-08-26T19:31:44.1144885Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:44.1145662Z  ) 2025-08-26T19:31:44.1146166Z  else: 2025-08-26T19:31:44.1146770Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:44.1147397Z  2025-08-26T19:31:44.1147906Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:44.1148606Z  return Settings(experiments) 2025-08-26T19:31:44.1149240Z  2025-08-26T19:31:44.1149636Z  except Exception: 2025-08-26T19:31:44.1150208Z  log.exception("Failed to parse settings") 2025-08-26T19:31:44.1150792Z  2025-08-26T19:31:44.1151184Z  return Settings() 2025-08-26T19:31:44.1151649Z  2025-08-26T19:31:44.1152005Z  2025-08-26T19:31:44.1152615Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:44.1153250Z  """ 2025-08-26T19:31:44.1153752Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:44.1154348Z  2025-08-26T19:31:44.1154934Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:44.1155768Z  and the text below is the list of opted in users. 2025-08-26T19:31:44.1156363Z  2025-08-26T19:31:44.1157015Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:44.1157790Z  """ 2025-08-26T19:31:44.1158420Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.1159371Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:44.1159970Z  2025-08-26T19:31:44.1160322Z  2025-08-26T19:31:44.1160828Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:44.1161446Z  """ 2025-08-26T19:31:44.1161902Z  Parse users from the rollout state. 2025-08-26T19:31:44.1162452Z  2025-08-26T19:31:44.1162819Z  """ 2025-08-26T19:31:44.1163428Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.1164244Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:44.1164832Z  2025-08-26T19:31:44.1165194Z  2025-08-26T19:31:44.1165870Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.1166674Z  """ 2025-08-26T19:31:44.1167162Z  Check if a user is opted into an experiment 2025-08-26T19:31:44.1167747Z  """ 2025-08-26T19:31:44.1168274Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:44.1168897Z  2025-08-26T19:31:44.1169505Z  2025-08-26T19:31:44.1170193Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.1171006Z  """ 2025-08-26T19:31:44.1171538Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:44.1172168Z  """ 2025-08-26T19:31:44.1172750Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:44.1173518Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:44.1174234Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:44.1174892Z  return False 2025-08-26T19:31:44.1175354Z  2025-08-26T19:31:44.1175856Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:44.1176511Z  log.warning( 2025-08-26T19:31:44.1177423Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:44.1178356Z  ) 2025-08-26T19:31:44.1178759Z  2025-08-26T19:31:44.1179136Z  return True 2025-08-26T19:31:44.1179671Z  2025-08-26T19:31:44.1180026Z  2025-08-26T19:31:44.1180414Z def get_runner_prefix( 2025-08-26T19:31:44.1180924Z  rollout_state: str, 2025-08-26T19:31:44.1181465Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:44.1182035Z  branch: str, 2025-08-26T19:31:44.1182616Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.1183370Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.1184021Z  is_canary: bool = False, 2025-08-26T19:31:44.1184529Z ) -> str: 2025-08-26T19:31:44.1185057Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:44.1185702Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:44.1186280Z  2025-08-26T19:31:44.1186793Z  fleet_prefix = "" 2025-08-26T19:31:44.1187305Z  prefixes = [] 2025-08-26T19:31:44.1188031Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:44.1189061Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:44.1189952Z  log.info( 2025-08-26T19:31:44.1190725Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:44.1191532Z  ) 2025-08-26T19:31:44.1191983Z  continue 2025-08-26T19:31:44.1192437Z  2025-08-26T19:31:44.1192840Z  if opt_out_experiments: 2025-08-26T19:31:44.1193460Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:44.1194188Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:44.1194841Z  log.info( 2025-08-26T19:31:44.1195872Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:44.1196905Z  ) 2025-08-26T19:31:44.1197373Z  continue 2025-08-26T19:31:44.1197897Z  2025-08-26T19:31:44.1198299Z  if eligible_experiments: 2025-08-26T19:31:44.1198941Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:44.1199741Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:44.1200351Z  log.info( 2025-08-26T19:31:44.1201216Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:44.1202110Z  ) 2025-08-26T19:31:44.1202578Z  continue 2025-08-26T19:31:44.1203292Z  elif not experiment_settings.default: 2025-08-26T19:31:44.1203873Z  log.info( 2025-08-26T19:31:44.1204623Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:44.1205408Z  ) 2025-08-26T19:31:44.1205838Z  continue 2025-08-26T19:31:44.1206295Z  2025-08-26T19:31:44.1206807Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:44.1207481Z  opted_out_users = [ 2025-08-26T19:31:44.1208007Z  requestor 2025-08-26T19:31:44.1208542Z  for requestor in workflow_requestors 2025-08-26T19:31:44.1209402Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.1210089Z  ] 2025-08-26T19:31:44.1210499Z  2025-08-26T19:31:44.1210896Z  if opted_out_users: 2025-08-26T19:31:44.1211436Z  log.info( 2025-08-26T19:31:44.1212156Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:44.1212902Z  ) 2025-08-26T19:31:44.1213343Z  continue 2025-08-26T19:31:44.1213791Z  2025-08-26T19:31:44.1214316Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:44.1214979Z  opted_in_users = [ 2025-08-26T19:31:44.1215513Z  requestor 2025-08-26T19:31:44.1216067Z  for requestor in workflow_requestors 2025-08-26T19:31:44.1216801Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.1217483Z  ] 2025-08-26T19:31:44.1217886Z  2025-08-26T19:31:44.1218284Z  enabled = False 2025-08-26T19:31:44.1218791Z  if opted_in_users: 2025-08-26T19:31:44.1219535Z  log.info( 2025-08-26T19:31:44.1220281Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:44.1221103Z  ) 2025-08-26T19:31:44.1221562Z  enabled = True 2025-08-26T19:31:44.1222051Z  2025-08-26T19:31:44.1222505Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:44.1223418Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:44.1224454Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:44.1225169Z  log.info( 2025-08-26T19:31:44.1226135Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:44.1227124Z  ) 2025-08-26T19:31:44.1227600Z  enabled = True 2025-08-26T19:31:44.1228115Z  2025-08-26T19:31:44.1228499Z  if enabled: 2025-08-26T19:31:44.1229012Z  label = experiment_name 2025-08-26T19:31:44.1229743Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:44.1230651Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:44.1231608Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:44.1232450Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:44.1233187Z  if is_canary: 2025-08-26T19:31:44.1233761Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:44.1234369Z  fleet_prefix = label 2025-08-26T19:31:44.1234917Z  else: 2025-08-26T19:31:44.1235564Z  prefixes.append(label) 2025-08-26T19:31:44.1236114Z  2025-08-26T19:31:44.1236508Z  if len(prefixes) > 1: 2025-08-26T19:31:44.1237025Z  log.error( 2025-08-26T19:31:44.1238181Z  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:44.1239476Z  ) 2025-08-26T19:31:44.1239935Z  prefixes = prefixes[:1] 2025-08-26T19:31:44.1240462Z  2025-08-26T19:31:44.1240866Z  # Fleet always comes first 2025-08-26T19:31:44.1241406Z  if fleet_prefix: 2025-08-26T19:31:44.1241931Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:44.1242489Z  2025-08-26T19:31:44.1242980Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:44.1243605Z  2025-08-26T19:31:44.1243967Z  2025-08-26T19:31:44.1244661Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:44.1245487Z  """ 2025-08-26T19:31:44.1246153Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:44.1246916Z  2025-08-26T19:31:44.1247538Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:44.1248294Z  """ 2025-08-26T19:31:44.1248739Z  gh = get_gh_client(github_token) 2025-08-26T19:31:44.1249470Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:44.1250194Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:44.1250850Z  2025-08-26T19:31:44.1251213Z  2025-08-26T19:31:44.1251865Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:44.1252808Z  for _ in range(num_retries): 2025-08-26T19:31:44.1253349Z  try: 2025-08-26T19:31:44.1253850Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:44.1254603Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:44.1255399Z  return json.loads(content) 2025-08-26T19:31:44.1255988Z  except Exception as e: 2025-08-26T19:31:44.1256619Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:44.1257218Z  2025-08-26T19:31:44.1257835Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:44.1258612Z  return {} 2025-08-26T19:31:44.1259028Z  2025-08-26T19:31:44.1259501Z  2025-08-26T19:31:44.1259866Z @cache 2025-08-26T19:31:44.1260569Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:44.1261388Z  """ 2025-08-26T19:31:44.1261831Z  Dynamically get PR information 2025-08-26T19:31:44.1262373Z  """ 2025-08-26T19:31:44.1262936Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:44.1263678Z  headers = { 2025-08-26T19:31:44.1264216Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:44.1264885Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:44.1265468Z  } 2025-08-26T19:31:44.1265956Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:44.1266635Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:44.1267224Z  headers=headers, 2025-08-26T19:31:44.1267716Z  ) 2025-08-26T19:31:44.1268102Z  2025-08-26T19:31:44.1268499Z  if not json_response: 2025-08-26T19:31:44.1269255Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:44.1270101Z  return {} 2025-08-26T19:31:44.1270562Z  2025-08-26T19:31:44.1270959Z  return json_response 2025-08-26T19:31:44.1271451Z  2025-08-26T19:31:44.1271806Z  2025-08-26T19:31:44.1272447Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:44.1273227Z  """ 2025-08-26T19:31:44.1273838Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:44.1274534Z  """ 2025-08-26T19:31:44.1275084Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:44.1275749Z  return { 2025-08-26T19:31:44.1276413Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:44.1277153Z  } 2025-08-26T19:31:44.1277539Z  2025-08-26T19:31:44.1277902Z  2025-08-26T19:31:44.1278294Z def main() -> None: 2025-08-26T19:31:44.1278787Z  args = parse_args() 2025-08-26T19:31:44.1279373Z  2025-08-26T19:31:44.1279840Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:44.1280428Z  2025-08-26T19:31:44.1280827Z  # Check if the PR is opt-out 2025-08-26T19:31:44.1281387Z  if args.pr_number: 2025-08-26T19:31:44.1282138Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:44.1282963Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:44.1283518Z  log.info( 2025-08-26T19:31:44.1284298Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:44.1285115Z  ) 2025-08-26T19:31:44.1285746Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.1286485Z  sys.exit() 2025-08-26T19:31:44.1287071Z  2025-08-26T19:31:44.1287448Z  try: 2025-08-26T19:31:44.1287941Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:44.1288733Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:44.1289532Z  ) 2025-08-26T19:31:44.1289932Z  2025-08-26T19:31:44.1290366Z  username = get_potential_pr_author( 2025-08-26T19:31:44.1290958Z  args.github_token, 2025-08-26T19:31:44.1291509Z  args.github_repo, 2025-08-26T19:31:44.1292046Z  args.github_actor, 2025-08-26T19:31:44.1292604Z  args.github_ref_type, 2025-08-26T19:31:44.1293156Z  args.github_branch, 2025-08-26T19:31:44.1293679Z  ) 2025-08-26T19:31:44.1294081Z  2025-08-26T19:31:44.1294608Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:44.1295267Z  2025-08-26T19:31:44.1295728Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:44.1296335Z  rollout_state, 2025-08-26T19:31:44.1296904Z  (args.github_issue_owner, username), 2025-08-26T19:31:44.1297511Z  args.github_branch, 2025-08-26T19:31:44.1298085Z  args.eligible_experiments, 2025-08-26T19:31:44.1298680Z  args.opt_out_experiments, 2025-08-26T19:31:44.1299343Z  is_canary, 2025-08-26T19:31:44.1299825Z  ) 2025-08-26T19:31:44.1300235Z  2025-08-26T19:31:44.1300625Z  except Exception as e: 2025-08-26T19:31:44.1301146Z  log.error( 2025-08-26T19:31:44.1301916Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:44.1302716Z  ) 2025-08-26T19:31:44.1303252Z  2025-08-26T19:31:44.1303823Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.1304526Z  2025-08-26T19:31:44.1304888Z  2025-08-26T19:31:44.1305280Z if __name__ == "__main__": 2025-08-26T19:31:44.1305776Z  main() 2025-08-26T19:31:44.1306192Z  2025-08-26T19:31:44.1306553Z EOF 2025-08-26T19:31:44.1306941Z  2025-08-26T19:31:44.1307347Z cat runner_determinator.py 2025-08-26T19:31:44.2973494Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:44.2974423Z env: 2025-08-26T19:31:44.2975288Z GITHUB_TOKEN: *** 2025-08-26T19:31:44.2975822Z ISSUE_NUMBER: 5132 2025-08-26T19:31:44.2976386Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:44.2976995Z ISSUE_OWNER: 2025-08-26T19:31:44.2977505Z CHECK_EXPERIMENTS: 2025-08-26T19:31:44.2978054Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:44.2978614Z PR_NUMBER: 2025-08-26T19:31:44.2979117Z ##[endgroup] 2025-08-26T19:31:44.3199850Z # flake8: noqa: G004 2025-08-26T19:31:44.3200307Z 2025-08-26T19:31:44.3200910Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:44.3202228Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:44.3203481Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:44.3204158Z 2025-08-26T19:31:44.3204474Z """ 2025-08-26T19:31:44.3205447Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:44.3206987Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:44.3208614Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:44.3210497Z of which runners should be used to run which job. 2025-08-26T19:31:44.3211257Z 2025-08-26T19:31:44.3211969Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:44.3213871Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:44.3215595Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:44.3216955Z list, defined. 2025-08-26T19:31:44.3217398Z 2025-08-26T19:31:44.3218084Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:44.3220218Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:44.3221810Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:44.3222656Z 2025-08-26T19:31:44.3223362Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:44.3225060Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:44.3226549Z experiments which the user could be opted in to. 2025-08-26T19:31:44.3227362Z 2025-08-26T19:31:44.3227769Z The user list has the following rules: 2025-08-26T19:31:44.3228485Z 2025-08-26T19:31:44.3229122Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:44.3231102Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:44.3232792Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:44.3233676Z 2025-08-26T19:31:44.3234034Z Example config: 2025-08-26T19:31:44.3234973Z # A list of experiments that can be opted into. 2025-08-26T19:31:44.3236458Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:44.3237829Z # Expected syntax is: 2025-08-26T19:31:44.3239358Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:44.3241492Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:44.3242845Z 2025-08-26T19:31:44.3243200Z experiments: 2025-08-26T19:31:44.3243968Z lf: 2025-08-26T19:31:44.3244703Z rollout_percent: 25 2025-08-26T19:31:44.3245611Z all_branches: false 2025-08-26T19:31:44.3246744Z default: true 2025-08-26T19:31:44.3247544Z --- 2025-08-26T19:31:44.3247940Z 2025-08-26T19:31:44.3248248Z # Opt-ins: 2025-08-26T19:31:44.3249564Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:44.3251393Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:44.3252988Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:44.3254310Z # Experiments should be from the above list. 2025-08-26T19:31:44.3255084Z 2025-08-26T19:31:44.3255424Z @User1,-lf,split_build 2025-08-26T19:31:44.3256261Z @User2,lf 2025-08-26T19:31:44.3256980Z @User3,split_build 2025-08-26T19:31:44.3257752Z """ 2025-08-26T19:31:44.3258116Z 2025-08-26T19:31:44.3258423Z import json 2025-08-26T19:31:44.3259126Z import logging 2025-08-26T19:31:44.3260034Z import os 2025-08-26T19:31:44.3260724Z import random 2025-08-26T19:31:44.3261439Z import re 2025-08-26T19:31:44.3262128Z import sys 2025-08-26T19:31:44.3262885Z from argparse import ArgumentParser 2025-08-26T19:31:44.3263965Z from collections.abc import Iterable 2025-08-26T19:31:44.3265016Z from functools import cache 2025-08-26T19:31:44.3265964Z from logging import LogRecord 2025-08-26T19:31:44.3266951Z from typing import Any, NamedTuple 2025-08-26T19:31:44.3268040Z from urllib.request import Request, urlopen 2025-08-26T19:31:44.3268829Z 2025-08-26T19:31:44.3269136Z import yaml 2025-08-26T19:31:44.3270109Z from github import Auth, Github 2025-08-26T19:31:44.3271086Z from github.Issue import Issue 2025-08-26T19:31:44.3271711Z 2025-08-26T19:31:44.3271718Z 2025-08-26T19:31:44.3272135Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:44.3273525Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:44.3275307Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:44.3276503Z 2025-08-26T19:31:44.3276940Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:44.3278240Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:44.3279833Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:44.3280997Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:44.3281756Z 2025-08-26T19:31:44.3282130Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:44.3282809Z 2025-08-26T19:31:44.3283162Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:44.3284063Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:44.3284633Z 2025-08-26T19:31:44.3284640Z 2025-08-26T19:31:44.3284996Z class Experiment(NamedTuple): 2025-08-26T19:31:44.3285946Z rollout_perc: float = ( 2025-08-26T19:31:44.3287223Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:44.3288605Z ) 2025-08-26T19:31:44.3289481Z all_branches: bool = ( 2025-08-26T19:31:44.3290729Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:44.3292089Z ) 2025-08-26T19:31:44.3292773Z default: bool = ( 2025-08-26T19:31:44.3293877Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:44.3295192Z ) 2025-08-26T19:31:44.3295559Z 2025-08-26T19:31:44.3295892Z # Add more fields as needed 2025-08-26T19:31:44.3296500Z 2025-08-26T19:31:44.3296507Z 2025-08-26T19:31:44.3296853Z class Settings(NamedTuple): 2025-08-26T19:31:44.3297701Z """ 2025-08-26T19:31:44.3298541Z Settings for the experiments that can be opted into. 2025-08-26T19:31:44.3299867Z """ 2025-08-26T19:31:44.3300225Z 2025-08-26T19:31:44.3300598Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:44.3301324Z 2025-08-26T19:31:44.3301331Z 2025-08-26T19:31:44.3301727Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:44.3302937Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:44.3303809Z 2025-08-26T19:31:44.3304095Z COLORS = { 2025-08-26T19:31:44.3304814Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:44.3305917Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:44.3306840Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:44.3307780Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:44.3308683Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:44.3309767Z } 2025-08-26T19:31:44.3310133Z 2025-08-26T19:31:44.3310520Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:44.3312004Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:44.3313542Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:44.3314655Z return super().format(record) 2025-08-26T19:31:44.3315296Z 2025-08-26T19:31:44.3315303Z 2025-08-26T19:31:44.3315649Z handler = logging.StreamHandler() 2025-08-26T19:31:44.3317052Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:44.3318212Z 2025-08-26T19:31:44.3318669Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:44.3319999Z log.addHandler(handler) 2025-08-26T19:31:44.3320847Z log.setLevel(logging.INFO) 2025-08-26T19:31:44.3321396Z 2025-08-26T19:31:44.3321403Z 2025-08-26T19:31:44.3321854Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:44.3322960Z """ 2025-08-26T19:31:44.3323923Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:44.3325173Z """ 2025-08-26T19:31:44.3325835Z if not GITHUB_OUTPUT: 2025-08-26T19:31:44.3328166Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:44.3330796Z log.warning( 2025-08-26T19:31:44.3332504Z "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:44.3334419Z ) 2025-08-26T19:31:44.3345092Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:44.3346221Z return 2025-08-26T19:31:44.3346628Z 2025-08-26T19:31:44.3347189Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:44.3348326Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:44.3349663Z f.write(f"{key}={value}\n") 2025-08-26T19:31:44.3350316Z 2025-08-26T19:31:44.3350322Z 2025-08-26T19:31:44.3350907Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:44.3352176Z return frozenset( 2025-08-26T19:31:44.3353354Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:44.3354753Z ) 2025-08-26T19:31:44.3355104Z 2025-08-26T19:31:44.3355111Z 2025-08-26T19:31:44.3355421Z def parse_args() -> Any: 2025-08-26T19:31:44.3356475Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:44.3358259Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:44.3360027Z parser.add_argument( 2025-08-26T19:31:44.3360882Z "--github-issue-repo", 2025-08-26T19:31:44.3361730Z type=str, 2025-08-26T19:31:44.3362474Z required=False, 2025-08-26T19:31:44.3363293Z default="pytorch/test-infra", 2025-08-26T19:31:44.3364318Z help="GitHub repo to get the issue", 2025-08-26T19:31:44.3365272Z ) 2025-08-26T19:31:44.3365930Z parser.add_argument( 2025-08-26T19:31:44.3366729Z "--github-repo", 2025-08-26T19:31:44.3367497Z type=str, 2025-08-26T19:31:44.3368196Z required=True, 2025-08-26T19:31:44.3369386Z help="GitHub repo where CI is running", 2025-08-26T19:31:44.3370433Z ) 2025-08-26T19:31:44.3371085Z parser.add_argument( 2025-08-26T19:31:44.3372235Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:44.3373512Z ) 2025-08-26T19:31:44.3374159Z parser.add_argument( 2025-08-26T19:31:44.3375354Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:44.3376679Z ) 2025-08-26T19:31:44.3377322Z parser.add_argument( 2025-08-26T19:31:44.3429436Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:44.3431101Z ) 2025-08-26T19:31:44.3431776Z parser.add_argument( 2025-08-26T19:31:44.3433064Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:44.3434526Z ) 2025-08-26T19:31:44.3435180Z parser.add_argument( 2025-08-26T19:31:44.3436044Z "--github-ref-type", 2025-08-26T19:31:44.3436875Z type=str, 2025-08-26T19:31:44.3437579Z required=True, 2025-08-26T19:31:44.3438453Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:44.3439715Z ) 2025-08-26T19:31:44.3440372Z parser.add_argument( 2025-08-26T19:31:44.3441210Z "--eligible-experiments", 2025-08-26T19:31:44.3442167Z type=_str_comma_separated_to_set, 2025-08-26T19:31:44.3443149Z required=False, 2025-08-26T19:31:44.3443904Z default="", 2025-08-26T19:31:44.3445594Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:44.3447484Z ) 2025-08-26T19:31:44.3448124Z parser.add_argument( 2025-08-26T19:31:44.3448964Z "--opt-out-experiments", 2025-08-26T19:31:44.3450063Z type=_str_comma_separated_to_set, 2025-08-26T19:31:44.3451031Z required=False, 2025-08-26T19:31:44.3451787Z default="", 2025-08-26T19:31:44.3452467Z help=( 2025-08-26T19:31:44.3453736Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:44.3456012Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:44.3457668Z ), 2025-08-26T19:31:44.3458276Z ) 2025-08-26T19:31:44.3458917Z parser.add_argument( 2025-08-26T19:31:44.3459894Z "--pr-number", 2025-08-26T19:31:44.3460624Z type=str, 2025-08-26T19:31:44.3461315Z required=False, 2025-08-26T19:31:44.3462063Z default="", 2025-08-26T19:31:44.3463091Z help="the optional PR number where this is run", 2025-08-26T19:31:44.3464142Z ) 2025-08-26T19:31:44.3464489Z 2025-08-26T19:31:44.3464827Z return parser.parse_args() 2025-08-26T19:31:44.3465409Z 2025-08-26T19:31:44.3465416Z 2025-08-26T19:31:44.3466183Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:44.3467623Z auth = Auth.Token(github_token) 2025-08-26T19:31:44.3468554Z return Github(auth=auth) 2025-08-26T19:31:44.3469115Z 2025-08-26T19:31:44.3469123Z 2025-08-26T19:31:44.3470229Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:44.3471768Z repo = gh.get_repo(repo) 2025-08-26T19:31:44.3472674Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:44.3473357Z 2025-08-26T19:31:44.3473363Z 2025-08-26T19:31:44.3473683Z def get_potential_pr_author( 2025-08-26T19:31:44.3474877Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:44.3476157Z ) -> str: 2025-08-26T19:31:44.3477087Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:44.3478587Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:44.3480188Z # embedded in the tag name: ciflow// 2025-08-26T19:31:44.3480982Z 2025-08-26T19:31:44.3481301Z gh = get_gh_client(github_token) 2025-08-26T19:31:44.3481921Z 2025-08-26T19:31:44.3482385Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:44.3483529Z split_tag = ref_name.split("/") 2025-08-26T19:31:44.3484428Z if ( 2025-08-26T19:31:44.3485090Z len(split_tag) == 3 2025-08-26T19:31:44.3485932Z and split_tag[0] == "ciflow" 2025-08-26T19:31:44.3486874Z and split_tag[2].isnumeric() 2025-08-26T19:31:44.3487751Z ): 2025-08-26T19:31:44.3488408Z pr_number = split_tag[2] 2025-08-26T19:31:44.3489611Z try: 2025-08-26T19:31:44.3490341Z repository = gh.get_repo(repo) 2025-08-26T19:31:44.3491459Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:44.3492584Z except Exception as e: 2025-08-26T19:31:44.3493501Z raise Exception( # noqa: TRY002 2025-08-26T19:31:44.3494722Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:44.3495936Z ) from e 2025-08-26T19:31:44.3496877Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:44.3498164Z # In all other cases, return the original input username 2025-08-26T19:31:44.3499423Z return username 2025-08-26T19:31:44.3499868Z 2025-08-26T19:31:44.3499875Z 2025-08-26T19:31:44.3500261Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:44.3501248Z """ 2025-08-26T19:31:44.3502440Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:44.3503908Z """ 2025-08-26T19:31:44.3504889Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:44.3505887Z 2025-08-26T19:31:44.3505901Z 2025-08-26T19:31:44.3506236Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:44.3507117Z try: 2025-08-26T19:31:44.3507777Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:44.3508676Z return data 2025-08-26T19:31:44.3509625Z except yaml.YAMLError: 2025-08-26T19:31:44.3510497Z log.exception("Error loading YAML") 2025-08-26T19:31:44.3511420Z raise 2025-08-26T19:31:44.3511792Z 2025-08-26T19:31:44.3511799Z 2025-08-26T19:31:44.3512582Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:44.3513951Z """ 2025-08-26T19:31:44.3515101Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:44.3516272Z 2025-08-26T19:31:44.3517048Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:44.3518484Z and the text below is the list of opted in users. 2025-08-26T19:31:44.3519428Z 2025-08-26T19:31:44.3520139Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:44.3521458Z """ 2025-08-26T19:31:44.3522224Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:44.3523295Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:44.3524375Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:44.3525449Z else: 2025-08-26T19:31:44.3526085Z return "", rollout_state 2025-08-26T19:31:44.3526642Z 2025-08-26T19:31:44.3526649Z 2025-08-26T19:31:44.3526995Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:44.3527895Z """ 2025-08-26T19:31:44.3528825Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:44.3530180Z """ 2025-08-26T19:31:44.3530527Z 2025-08-26T19:31:44.3530547Z 2025-08-26T19:31:44.3531160Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:44.3532372Z """ 2025-08-26T19:31:44.3533720Z 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:44.3535093Z 2025-08-26T19:31:44.3536352Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:44.3538279Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:44.3539719Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:44.3540639Z 2025-08-26T19:31:44.3540646Z 2025-08-26T19:31:44.3540908Z """ 2025-08-26T19:31:44.3541530Z optins = UserOptins() 2025-08-26T19:31:44.3542375Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:44.3543373Z user = user.strip("\r\n\t -") 2025-08-26T19:31:44.3544334Z if not user or not user.startswith("@"): 2025-08-26T19:31:44.3545463Z # Not a valid user. Skip 2025-08-26T19:31:44.3546307Z continue 2025-08-26T19:31:44.3546718Z 2025-08-26T19:31:44.3546976Z if user: 2025-08-26T19:31:44.3547714Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:44.3548988Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:44.3550181Z 2025-08-26T19:31:44.3550463Z return optins 2025-08-26T19:31:44.3550875Z 2025-08-26T19:31:44.3550881Z 2025-08-26T19:31:44.3551391Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:44.3552493Z """ 2025-08-26T19:31:44.3553162Z Check if the experiment name is valid. 2025-08-26T19:31:44.3554095Z A valid name: 2025-08-26T19:31:44.3555245Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:44.3557039Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:44.3558396Z - Cannot contain spaces 2025-08-26T19:31:44.3559567Z """ 2025-08-26T19:31:44.3559926Z 2025-08-26T19:31:44.3560378Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:44.3561661Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:44.3562493Z 2025-08-26T19:31:44.3562757Z if valid: 2025-08-26T19:31:44.3563391Z return True 2025-08-26T19:31:44.3563802Z 2025-08-26T19:31:44.3564066Z log.error( 2025-08-26T19:31:44.3566938Z 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:44.3570342Z ) 2025-08-26T19:31:44.3570938Z return False 2025-08-26T19:31:44.3571337Z 2025-08-26T19:31:44.3571344Z 2025-08-26T19:31:44.3571880Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:44.3572982Z """ 2025-08-26T19:31:44.3574175Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:44.3575492Z """ 2025-08-26T19:31:44.3576071Z try: 2025-08-26T19:31:44.3576688Z if settings_text: 2025-08-26T19:31:44.3577997Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:44.3579573Z # for easy reading 2025-08-26T19:31:44.3581005Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:44.3582647Z # the backtick character in shell commands. 2025-08-26T19:31:44.3583698Z backtick = chr(96) # backtick character 2025-08-26T19:31:44.3584866Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:44.3586042Z settings = load_yaml(settings_text) 2025-08-26T19:31:44.3586698Z 2025-08-26T19:31:44.3587437Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:44.3588801Z experiments = {} 2025-08-26T19:31:44.3589404Z 2025-08-26T19:31:44.3590063Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:44.3591423Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:44.3593493Z # 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:44.3595463Z continue 2025-08-26T19:31:44.3595950Z 2025-08-26T19:31:44.3596257Z valid_settings = {} 2025-08-26T19:31:44.3597152Z for setting in exp_settings: 2025-08-26T19:31:44.3598136Z if setting not in Experiment._fields: 2025-08-26T19:31:44.3599104Z log.warning( 2025-08-26T19:31:44.3600455Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:44.3601927Z ) 2025-08-26T19:31:44.3602643Z else: 2025-08-26T19:31:44.3603518Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:44.3604282Z 2025-08-26T19:31:44.3604751Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:44.3605876Z return Settings(experiments) 2025-08-26T19:31:44.3606498Z 2025-08-26T19:31:44.3606781Z except Exception: 2025-08-26T19:31:44.3607589Z log.exception("Failed to parse settings") 2025-08-26T19:31:44.3608289Z 2025-08-26T19:31:44.3608574Z return Settings() 2025-08-26T19:31:44.3608998Z 2025-08-26T19:31:44.3609005Z 2025-08-26T19:31:44.3609521Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:44.3610523Z """ 2025-08-26T19:31:44.3611230Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:44.3611954Z 2025-08-26T19:31:44.3612559Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:44.3613909Z and the text below is the list of opted in users. 2025-08-26T19:31:44.3614641Z 2025-08-26T19:31:44.3615356Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:44.3616681Z """ 2025-08-26T19:31:44.3617625Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.3618969Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:44.3619777Z 2025-08-26T19:31:44.3619785Z 2025-08-26T19:31:44.3620206Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:44.3621198Z """ 2025-08-26T19:31:44.3621849Z Parse users from the rollout state. 2025-08-26T19:31:44.3622451Z 2025-08-26T19:31:44.3622698Z """ 2025-08-26T19:31:44.3623597Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.3624870Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:44.3625577Z 2025-08-26T19:31:44.3625590Z 2025-08-26T19:31:44.3626436Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.3627764Z """ 2025-08-26T19:31:44.3628457Z Check if a user is opted into an experiment 2025-08-26T19:31:44.3629492Z """ 2025-08-26T19:31:44.3630242Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:44.3630976Z 2025-08-26T19:31:44.3630984Z 2025-08-26T19:31:44.3631729Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.3633056Z """ 2025-08-26T19:31:44.3633826Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:44.3634844Z """ 2025-08-26T19:31:44.3635695Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:44.3636929Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:44.3638045Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:44.3639085Z return False 2025-08-26T19:31:44.3639598Z 2025-08-26T19:31:44.3640057Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:44.3641114Z log.warning( 2025-08-26T19:31:44.3642526Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:44.3644111Z ) 2025-08-26T19:31:44.3644448Z 2025-08-26T19:31:44.3644716Z return True 2025-08-26T19:31:44.3645102Z 2025-08-26T19:31:44.3645108Z 2025-08-26T19:31:44.3645395Z def get_runner_prefix( 2025-08-26T19:31:44.3646115Z rollout_state: str, 2025-08-26T19:31:44.3646879Z workflow_requestors: Iterable[str], 2025-08-26T19:31:44.3647745Z branch: str, 2025-08-26T19:31:44.3648562Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.3649815Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.3650832Z is_canary: bool = False, 2025-08-26T19:31:44.3651591Z ) -> str: 2025-08-26T19:31:44.3652283Z settings = parse_settings(rollout_state) 2025-08-26T19:31:44.3653459Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:44.3654105Z 2025-08-26T19:31:44.3654381Z fleet_prefix = "" 2025-08-26T19:31:44.3655071Z prefixes = [] 2025-08-26T19:31:44.3656167Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:44.3657831Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:44.3659078Z log.info( 2025-08-26T19:31:44.3660342Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:44.3661685Z ) 2025-08-26T19:31:44.3662299Z continue 2025-08-26T19:31:44.3662706Z 2025-08-26T19:31:44.3663008Z if opt_out_experiments: 2025-08-26T19:31:44.3663898Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:44.3664991Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:44.3666004Z log.info( 2025-08-26T19:31:44.3667620Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:44.3669494Z ) 2025-08-26T19:31:44.3670159Z continue 2025-08-26T19:31:44.3670605Z 2025-08-26T19:31:44.3670906Z if eligible_experiments: 2025-08-26T19:31:44.3671868Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:44.3672950Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:44.3673904Z log.info( 2025-08-26T19:31:44.3675259Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:44.3676753Z ) 2025-08-26T19:31:44.3677389Z continue 2025-08-26T19:31:44.3678173Z elif not experiment_settings.default: 2025-08-26T19:31:44.3679085Z log.info( 2025-08-26T19:31:44.3680425Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:44.3681732Z ) 2025-08-26T19:31:44.3682348Z continue 2025-08-26T19:31:44.3682753Z 2025-08-26T19:31:44.3683220Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:44.3684284Z opted_out_users = [ 2025-08-26T19:31:44.3685027Z requestor 2025-08-26T19:31:44.3685758Z for requestor in workflow_requestors 2025-08-26T19:31:44.3686913Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.3688007Z ] 2025-08-26T19:31:44.3688338Z 2025-08-26T19:31:44.3688626Z if opted_out_users: 2025-08-26T19:31:44.3689489Z log.info( 2025-08-26T19:31:44.3690521Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:44.3691732Z ) 2025-08-26T19:31:44.3692345Z continue 2025-08-26T19:31:44.3692752Z 2025-08-26T19:31:44.3693215Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:44.3694256Z opted_in_users = [ 2025-08-26T19:31:44.3694985Z requestor 2025-08-26T19:31:44.3695725Z for requestor in workflow_requestors 2025-08-26T19:31:44.3696849Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.3697917Z ] 2025-08-26T19:31:44.3698244Z 2025-08-26T19:31:44.3698513Z enabled = False 2025-08-26T19:31:44.3699319Z if opted_in_users: 2025-08-26T19:31:44.3700058Z log.info( 2025-08-26T19:31:44.3701065Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:44.3702246Z ) 2025-08-26T19:31:44.3702863Z enabled = True 2025-08-26T19:31:44.3703321Z 2025-08-26T19:31:44.3703677Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:44.3705110Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:44.3706886Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:44.3707996Z log.info( 2025-08-26T19:31:44.3709572Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:44.3711198Z ) 2025-08-26T19:31:44.3711846Z enabled = True 2025-08-26T19:31:44.3712342Z 2025-08-26T19:31:44.3712609Z if enabled: 2025-08-26T19:31:44.3713291Z label = experiment_name 2025-08-26T19:31:44.3714208Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:44.3715618Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:44.3717131Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:44.3718441Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:44.3719670Z if is_canary: 2025-08-26T19:31:44.3720458Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:44.3721353Z fleet_prefix = label 2025-08-26T19:31:44.3722153Z else: 2025-08-26T19:31:44.3722834Z prefixes.append(label) 2025-08-26T19:31:44.3723419Z 2025-08-26T19:31:44.3723706Z if len(prefixes) > 1: 2025-08-26T19:31:44.3724424Z log.error( 2025-08-26T19:31:44.3726235Z 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:44.3728214Z ) 2025-08-26T19:31:44.3728829Z prefixes = prefixes[:1] 2025-08-26T19:31:44.3729432Z 2025-08-26T19:31:44.3729739Z # Fleet always comes first 2025-08-26T19:31:44.3730502Z if fleet_prefix: 2025-08-26T19:31:44.3731229Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:44.3731838Z 2025-08-26T19:31:44.3732353Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:44.3733064Z 2025-08-26T19:31:44.3733072Z 2025-08-26T19:31:44.3733804Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:44.3735105Z """ 2025-08-26T19:31:44.3736103Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:44.3737081Z 2025-08-26T19:31:44.3737777Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:44.3738990Z """ 2025-08-26T19:31:44.3739710Z gh = get_gh_client(github_token) 2025-08-26T19:31:44.3740595Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:44.3741647Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:44.3742404Z 2025-08-26T19:31:44.3742411Z 2025-08-26T19:31:44.3743088Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:44.3744375Z for _ in range(num_retries): 2025-08-26T19:31:44.3745153Z try: 2025-08-26T19:31:44.3745829Z req = Request(url=url, headers=headers) 2025-08-26T19:31:44.3746932Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:44.3748009Z return json.loads(content) 2025-08-26T19:31:44.3748877Z except Exception as e: 2025-08-26T19:31:44.3749857Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:44.3750535Z 2025-08-26T19:31:44.3751176Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:44.3752401Z return {} 2025-08-26T19:31:44.3752755Z 2025-08-26T19:31:44.3752762Z 2025-08-26T19:31:44.3753011Z @cache 2025-08-26T19:31:44.3754631Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:44.3756929Z """ 2025-08-26T19:31:44.3758049Z Dynamically get PR information 2025-08-26T19:31:44.3759749Z """ 2025-08-26T19:31:44.3761486Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:44.3763418Z headers = { 2025-08-26T19:31:44.3764702Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:44.3766448Z "Authorization": f"token {github_token}", 2025-08-26T19:31:44.3768002Z } 2025-08-26T19:31:44.3769389Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:44.3771159Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:44.3772717Z headers=headers, 2025-08-26T19:31:44.3773898Z ) 2025-08-26T19:31:44.3774487Z 2025-08-26T19:31:44.3774976Z if not json_response: 2025-08-26T19:31:44.3776612Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:44.3778456Z return {} 2025-08-26T19:31:44.3779397Z 2025-08-26T19:31:44.3779921Z return json_response 2025-08-26T19:31:44.3780763Z 2025-08-26T19:31:44.3780775Z 2025-08-26T19:31:44.3782017Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:44.3784267Z """ 2025-08-26T19:31:44.3785741Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:44.3787607Z """ 2025-08-26T19:31:44.3788978Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:44.3790878Z return { 2025-08-26T19:31:44.3792593Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:44.3794734Z } 2025-08-26T19:31:44.3795334Z 2025-08-26T19:31:44.3795345Z 2025-08-26T19:31:44.3795841Z def main() -> None: 2025-08-26T19:31:44.3797045Z args = parse_args() 2025-08-26T19:31:44.3797832Z 2025-08-26T19:31:44.3798453Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:44.3799890Z 2025-08-26T19:31:44.3800432Z # Check if the PR is opt-out 2025-08-26T19:31:44.3801790Z if args.pr_number: 2025-08-26T19:31:44.3803705Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:44.3806297Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:44.3807738Z log.info( 2025-08-26T19:31:44.3809907Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:44.3812264Z ) 2025-08-26T19:31:44.3813855Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.3815807Z sys.exit() 2025-08-26T19:31:44.3816601Z 2025-08-26T19:31:44.3817040Z try: 2025-08-26T19:31:44.3818251Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:44.3820554Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:44.3822490Z ) 2025-08-26T19:31:44.3823131Z 2025-08-26T19:31:44.3823699Z username = get_potential_pr_author( 2025-08-26T19:31:44.3825263Z args.github_token, 2025-08-26T19:31:44.3826606Z args.github_repo, 2025-08-26T19:31:44.3827937Z args.github_actor, 2025-08-26T19:31:44.3829498Z args.github_ref_type, 2025-08-26T19:31:44.3830920Z args.github_branch, 2025-08-26T19:31:44.3832224Z ) 2025-08-26T19:31:44.3832788Z 2025-08-26T19:31:44.3833500Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:44.3834820Z 2025-08-26T19:31:44.3835390Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:44.3836897Z rollout_state, 2025-08-26T19:31:44.3838067Z (args.github_issue_owner, username), 2025-08-26T19:31:44.3839831Z args.github_branch, 2025-08-26T19:31:44.3841221Z args.eligible_experiments, 2025-08-26T19:31:44.3842757Z args.opt_out_experiments, 2025-08-26T19:31:44.3844110Z is_canary, 2025-08-26T19:31:44.3845192Z ) 2025-08-26T19:31:44.3845766Z 2025-08-26T19:31:44.3846261Z except Exception as e: 2025-08-26T19:31:44.3847355Z log.error( 2025-08-26T19:31:44.3849424Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:44.3852048Z ) 2025-08-26T19:31:44.3852692Z 2025-08-26T19:31:44.3853551Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.3855071Z 2025-08-26T19:31:44.3855086Z 2025-08-26T19:31:44.3855583Z if __name__ == "__main__": 2025-08-26T19:31:44.3856802Z main() 2025-08-26T19:31:44.3857302Z 2025-08-26T19:31:44.3968754Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:44.3970447Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:44.4011834Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:44.4012589Z env: 2025-08-26T19:31:44.4013506Z GITHUB_TOKEN: *** 2025-08-26T19:31:44.4014171Z ISSUE_NUMBER: 5132 2025-08-26T19:31:44.4014883Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:44.4015701Z ISSUE_OWNER: 2025-08-26T19:31:44.4016348Z CHECK_EXPERIMENTS: 2025-08-26T19:31:44.4017043Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:44.4017762Z PR_NUMBER: 2025-08-26T19:31:44.4018378Z ##[endgroup] 2025-08-26T19:31:46.5470251Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:47.5045869Z Collecting urllib3==1.26.18 2025-08-26T19:31:47.6210378Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:47.6640063Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 1.2 MB/s eta 0:00:00 2025-08-26T19:31:47.7031350Z Collecting PyGithub==2.3.0 2025-08-26T19:31:47.7341289Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:47.7916489Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:47.8226464Z 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:47.8274639Z 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:47.8291460Z 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:47.8305847Z 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:47.8692153Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:47.8999964Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:47.9334276Z 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:48.0771411Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:48.1081353Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:48.2380451Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:48.2700673Z 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:48.3009631Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:48.3317549Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:48.3849401Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:48.4234235Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 3.7 MB/s eta 0:00:00 2025-08-26T19:31:48.4545132Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:48.4921390Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 9.6 MB/s eta 0:00:00 2025-08-26T19:31:48.5230389Z 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:48.5671774Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 19.9 MB/s eta 0:00:00 2025-08-26T19:31:48.5979873Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:48.6313505Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:48.6548766Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 21.4 MB/s eta 0:00:00 2025-08-26T19:31:48.6858152Z 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:48.6922332Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 16.4 MB/s eta 0:00:00 2025-08-26T19:31:48.7230350Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:48.7298532Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 20.5 MB/s eta 0:00:00 2025-08-26T19:31:49.0618459Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:49.5912938Z 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:49.6665696Z ##[group]Run curr_branch="main" 2025-08-26T19:31:49.6666001Z curr_branch="main" 2025-08-26T19:31:49.6666219Z curr_ref_type="branch" 2025-08-26T19:31:49.6666490Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:49.6666739Z  2025-08-26T19:31:49.6666925Z python3 runner_determinator.py \ 2025-08-26T19:31:49.6667197Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:49.6667469Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:49.6667724Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:49.6667980Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:49.6668274Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:49.6668552Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:49.6668823Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:49.6669113Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:49.6669717Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:49.6670008Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:49.6713845Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:49.6714075Z env: 2025-08-26T19:31:49.6714503Z GITHUB_TOKEN: *** 2025-08-26T19:31:49.6714691Z ISSUE_NUMBER: 5132 2025-08-26T19:31:49.6714900Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:49.6715133Z ISSUE_OWNER: 2025-08-26T19:31:49.6715315Z CHECK_EXPERIMENTS: 2025-08-26T19:31:49.6715507Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:49.6715702Z PR_NUMBER: 2025-08-26T19:31:49.6715863Z ##[endgroup] 2025-08-26T19:31:49.6772693Z Current branch is 'main' 2025-08-26T19:31:51.3107715Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-08-26T19:31:51.3108390Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:51.3108940Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:51.3109683Z INFO : Setting output: label-type='' 2025-08-26T19:31:51.3414102Z Evaluate and set job outputs 2025-08-26T19:31:51.3421091Z Cleaning up orphan processes