2025-12-04T08:40:03.4567443Z Current runner version: '2.329.0' 2025-12-04T08:40:03.4596516Z ##[group]Runner Image Provisioner 2025-12-04T08:40:03.4597383Z Hosted Compute Agent 2025-12-04T08:40:03.4597892Z Version: 20251124.448 2025-12-04T08:40:03.4598499Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T08:40:03.4599224Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T08:40:03.4600056Z ##[endgroup] 2025-12-04T08:40:03.4600646Z ##[group]Operating System 2025-12-04T08:40:03.4601212Z Ubuntu 2025-12-04T08:40:03.4601697Z 24.04.3 2025-12-04T08:40:03.4602118Z LTS 2025-12-04T08:40:03.4602630Z ##[endgroup] 2025-12-04T08:40:03.4603091Z ##[group]Runner Image 2025-12-04T08:40:03.4603629Z Image: ubuntu-24.04 2025-12-04T08:40:03.4604076Z Version: 20251126.144.1 2025-12-04T08:40:03.4605146Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T08:40:03.4606690Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T08:40:03.4607709Z ##[endgroup] 2025-12-04T08:40:03.4608648Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T08:40:03.4611193Z Contents: read 2025-12-04T08:40:03.4611748Z Metadata: read 2025-12-04T08:40:03.4612223Z ##[endgroup] 2025-12-04T08:40:03.4614258Z Secret source: Actions 2025-12-04T08:40:03.4614941Z Prepare workflow directory 2025-12-04T08:40:03.5339065Z Prepare all required actions 2025-12-04T08:40:03.5420179Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T08:40:03.5427261Z ##[group] Inputs 2025-12-04T08:40:03.5428219Z check_experiments: 2025-12-04T08:40:03.5429149Z opt_out_experiments: 2025-12-04T08:40:03.5430274Z triggering_actor: pytorchmergebot 2025-12-04T08:40:03.5431254Z issue_owner: 2025-12-04T08:40:03.5432093Z curr_branch: main 2025-12-04T08:40:03.5432961Z curr_ref_type: branch 2025-12-04T08:40:03.5433997Z issue_number: 5132 2025-12-04T08:40:03.5434987Z ##[endgroup] 2025-12-04T08:40:03.5436034Z Complete job name: before-test / get-label-type / runner-determinator 2025-12-04T08:40:04.0834465Z ##[group]Run cat < runner_determinator.py 2025-12-04T08:40:04.0836878Z cat < runner_determinator.py 2025-12-04T08:40:04.0837671Z # flake8: noqa: G004 2025-12-04T08:40:04.0838206Z  2025-12-04T08:40:04.0839273Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:40:04.0840620Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:40:04.0841639Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:40:04.0842368Z  2025-12-04T08:40:04.0842891Z """ 2025-12-04T08:40:04.0843646Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:40:04.0844665Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:40:04.0845946Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:40:04.0846937Z of which runners should be used to run which job. 2025-12-04T08:40:04.0847676Z  2025-12-04T08:40:04.0848405Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:40:04.0849498Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:40:04.0850744Z settings are considered to be empty with only the second part, the user 2025-12-04T08:40:04.0851586Z list, defined. 2025-12-04T08:40:04.0852159Z  2025-12-04T08:40:04.0852816Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:40:04.0853978Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:40:04.0854997Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:40:04.0855695Z  2025-12-04T08:40:04.0856771Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:40:04.0857789Z The user list is also a comma separated list of additional features or 2025-12-04T08:40:04.0858687Z experiments which the user could be opted in to. 2025-12-04T08:40:04.0859423Z  2025-12-04T08:40:04.0860256Z The user list has the following rules: 2025-12-04T08:40:04.0860904Z  2025-12-04T08:40:04.0861660Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:40:04.0862700Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:40:04.0863598Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:40:04.0864337Z  2025-12-04T08:40:04.0864815Z Example config: 2025-12-04T08:40:04.0865410Z  # A list of experiments that can be opted into. 2025-12-04T08:40:04.0866335Z  # This defines the behavior they'll induce when opted into. 2025-12-04T08:40:04.0867139Z  # Expected syntax is: 2025-12-04T08:40:04.0867967Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:40:04.0869162Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:40:04.0870214Z  2025-12-04T08:40:04.0870703Z  experiments: 2025-12-04T08:40:04.0871285Z  lf: 2025-12-04T08:40:04.0871841Z  rollout_percent: 25 2025-12-04T08:40:04.0872424Z  all_branches: false 2025-12-04T08:40:04.0873065Z  default: true 2025-12-04T08:40:04.0873617Z  --- 2025-12-04T08:40:04.0874102Z  2025-12-04T08:40:04.0874633Z  # Opt-ins: 2025-12-04T08:40:04.0875386Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:40:04.0876614Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:40:04.0877546Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:40:04.0878467Z  # Experiments should be from the above list. 2025-12-04T08:40:04.0879160Z  2025-12-04T08:40:04.0879647Z  @User1,-lf,split_build 2025-12-04T08:40:04.0880552Z  @User2,lf 2025-12-04T08:40:04.0881113Z  @User3,split_build 2025-12-04T08:40:04.0881676Z """ 2025-12-04T08:40:04.0957562Z  2025-12-04T08:40:04.0958360Z import json 2025-12-04T08:40:04.0959182Z import logging 2025-12-04T08:40:04.0960490Z import os 2025-12-04T08:40:04.0961323Z import random 2025-12-04T08:40:04.0962161Z import re 2025-12-04T08:40:04.0962775Z import sys 2025-12-04T08:40:04.0963270Z from argparse import ArgumentParser 2025-12-04T08:40:04.0963943Z from collections.abc import Iterable 2025-12-04T08:40:04.0964563Z from functools import cache 2025-12-04T08:40:04.0965106Z from logging import LogRecord 2025-12-04T08:40:04.0965673Z from typing import Any, NamedTuple 2025-12-04T08:40:04.0966303Z from urllib.request import Request, urlopen 2025-12-04T08:40:04.0966952Z  2025-12-04T08:40:04.0967344Z import yaml 2025-12-04T08:40:04.0967808Z from github import Auth, Github 2025-12-04T08:40:04.0968376Z from github.Issue import Issue 2025-12-04T08:40:04.0968896Z  2025-12-04T08:40:04.0969265Z  2025-12-04T08:40:04.0969721Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:40:04.0970753Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:40:04.0971742Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:40:04.0972495Z  2025-12-04T08:40:04.0973213Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:40:04.0973855Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:40:04.0974446Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:40:04.0975092Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:40:04.0975650Z  2025-12-04T08:40:04.0976074Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:40:04.0976610Z  2025-12-04T08:40:04.0977017Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:40:04.0977552Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:40:04.0978052Z  2025-12-04T08:40:04.0978413Z  2025-12-04T08:40:04.0978824Z class Experiment(NamedTuple): 2025-12-04T08:40:04.0979378Z  rollout_perc: float = ( 2025-12-04T08:40:04.0980327Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:40:04.0981057Z  ) 2025-12-04T08:40:04.0981468Z  all_branches: bool = ( 2025-12-04T08:40:04.0982215Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:40:04.0982940Z  ) 2025-12-04T08:40:04.0983359Z  default: bool = ( 2025-12-04T08:40:04.0984023Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T08:40:04.0984720Z  ) 2025-12-04T08:40:04.0985103Z  2025-12-04T08:40:04.0985513Z  # Add more fields as needed 2025-12-04T08:40:04.0986040Z  2025-12-04T08:40:04.0986403Z  2025-12-04T08:40:04.0986804Z class Settings(NamedTuple): 2025-12-04T08:40:04.0987312Z  """ 2025-12-04T08:40:04.0987843Z  Settings for the experiments that can be opted into. 2025-12-04T08:40:04.0988466Z  """ 2025-12-04T08:40:04.0988863Z  2025-12-04T08:40:04.0989300Z  experiments: dict[str, Experiment] = {} 2025-12-04T08:40:04.0990104Z  2025-12-04T08:40:04.0990647Z  2025-12-04T08:40:04.0991110Z class ColorFormatter(logging.Formatter): 2025-12-04T08:40:04.0991830Z  """Color codes the log messages based on the log level""" 2025-12-04T08:40:04.0992455Z  2025-12-04T08:40:04.0992829Z  COLORS = { 2025-12-04T08:40:04.0993307Z  "WARNING": "\033[33m", # Yellow 2025-12-04T08:40:04.0993876Z  "ERROR": "\033[31m", # Red 2025-12-04T08:40:04.0994425Z  "CRITICAL": "\033[31m", # Red 2025-12-04T08:40:04.0995016Z  "INFO": "\033[0m", # Reset 2025-12-04T08:40:04.0995569Z  "DEBUG": "\033[0m", # Reset 2025-12-04T08:40:04.0996083Z  } 2025-12-04T08:40:04.0996466Z  2025-12-04T08:40:04.0996924Z  def format(self, record: LogRecord) -> str: 2025-12-04T08:40:04.0997744Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:40:04.0998587Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:40:04.0999233Z  return super().format(record) 2025-12-04T08:40:04.0999769Z  2025-12-04T08:40:04.1000365Z  2025-12-04T08:40:04.1000785Z handler = logging.StreamHandler() 2025-12-04T08:40:04.1001585Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:40:04.1002352Z  2025-12-04T08:40:04.1002840Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:40:04.1003501Z log.addHandler(handler) 2025-12-04T08:40:04.1004028Z log.setLevel(logging.INFO) 2025-12-04T08:40:04.1004524Z  2025-12-04T08:40:04.1004896Z  2025-12-04T08:40:04.1005394Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:40:04.1006020Z  """ 2025-12-04T08:40:04.1006589Z  Defines outputs of the github action that invokes this script 2025-12-04T08:40:04.1007427Z  """ 2025-12-04T08:40:04.1007846Z  if not GITHUB_OUTPUT: 2025-12-04T08:40:04.1009008Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:40:04.1011158Z  log.warning( 2025-12-04T08:40:04.1012826Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:40:04.1014605Z  ) 2025-12-04T08:40:04.1015502Z  print(f"::set-output name={key}::{value}") 2025-12-04T08:40:04.1016644Z  return 2025-12-04T08:40:04.1017472Z  2025-12-04T08:40:04.1018286Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:40:04.1019481Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:40:04.1020858Z  f.write(f"{key}={value}\n") 2025-12-04T08:40:04.1021872Z  2025-12-04T08:40:04.1022566Z  2025-12-04T08:40:04.1023551Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:40:04.1024324Z  return frozenset( 2025-12-04T08:40:04.1025141Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:40:04.1025884Z  ) 2025-12-04T08:40:04.1026302Z  2025-12-04T08:40:04.1026725Z  2025-12-04T08:40:04.1027447Z def parse_args() -> Any: 2025-12-04T08:40:04.1028353Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:40:04.1029300Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:40:04.1030372Z  parser.add_argument( 2025-12-04T08:40:04.1030918Z  "--github-issue-repo", 2025-12-04T08:40:04.1031459Z  type=str, 2025-12-04T08:40:04.1032086Z  required=False, 2025-12-04T08:40:04.1033392Z  default="pytorch/test-infra", 2025-12-04T08:40:04.1034616Z  help="GitHub repo to get the issue", 2025-12-04T08:40:04.1035654Z  ) 2025-12-04T08:40:04.1036502Z  parser.add_argument( 2025-12-04T08:40:04.1037166Z  "--github-repo", 2025-12-04T08:40:04.1037723Z  type=str, 2025-12-04T08:40:04.1038208Z  required=True, 2025-12-04T08:40:04.1038947Z  help="GitHub repo where CI is running", 2025-12-04T08:40:04.1040452Z  ) 2025-12-04T08:40:04.1040938Z  parser.add_argument( 2025-12-04T08:40:04.1041651Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:40:04.1042360Z  ) 2025-12-04T08:40:04.1042785Z  parser.add_argument( 2025-12-04T08:40:04.1043505Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:40:04.1044261Z  ) 2025-12-04T08:40:04.1044693Z  parser.add_argument( 2025-12-04T08:40:04.1045430Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:40:04.1046172Z  ) 2025-12-04T08:40:04.1046598Z  parser.add_argument( 2025-12-04T08:40:04.1047373Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:40:04.1048138Z  ) 2025-12-04T08:40:04.1048579Z  parser.add_argument( 2025-12-04T08:40:04.1049114Z  "--github-ref-type", 2025-12-04T08:40:04.1049640Z  type=str, 2025-12-04T08:40:04.1050353Z  required=True, 2025-12-04T08:40:04.1050963Z  help="Current GitHub ref type, branch or tag", 2025-12-04T08:40:04.1051564Z  ) 2025-12-04T08:40:04.1051986Z  parser.add_argument( 2025-12-04T08:40:04.1052721Z  "--eligible-experiments", 2025-12-04T08:40:04.1053323Z  type=_str_comma_separated_to_set, 2025-12-04T08:40:04.1053900Z  required=False, 2025-12-04T08:40:04.1054394Z  default="", 2025-12-04T08:40:04.1055327Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:40:04.1056290Z  ) 2025-12-04T08:40:04.1056713Z  parser.add_argument( 2025-12-04T08:40:04.1057244Z  "--opt-out-experiments", 2025-12-04T08:40:04.1057835Z  type=_str_comma_separated_to_set, 2025-12-04T08:40:04.1058412Z  required=False, 2025-12-04T08:40:04.1058906Z  default="", 2025-12-04T08:40:04.1059376Z  help=( 2025-12-04T08:40:04.1060325Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:40:04.1061546Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:40:04.1062422Z  ), 2025-12-04T08:40:04.1062834Z  ) 2025-12-04T08:40:04.1063256Z  parser.add_argument( 2025-12-04T08:40:04.1063776Z  "--pr-number", 2025-12-04T08:40:04.1064267Z  type=str, 2025-12-04T08:40:04.1064742Z  required=False, 2025-12-04T08:40:04.1065236Z  default="", 2025-12-04T08:40:04.1065806Z  help="the optional PR number where this is run", 2025-12-04T08:40:04.1066403Z  ) 2025-12-04T08:40:04.1066834Z  2025-12-04T08:40:04.1067245Z  return parser.parse_args() 2025-12-04T08:40:04.1067768Z  2025-12-04T08:40:04.1068128Z  2025-12-04T08:40:04.1068771Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:40:04.1069728Z  auth = Auth.Token(github_token) 2025-12-04T08:40:04.1070615Z  return Github(auth=auth) 2025-12-04T08:40:04.1071132Z  2025-12-04T08:40:04.1071508Z  2025-12-04T08:40:04.1072224Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:40:04.1073090Z  repo = gh.get_repo(repo) 2025-12-04T08:40:04.1073688Z  return repo.get_issue(number=issue_num) 2025-12-04T08:40:04.1074263Z  2025-12-04T08:40:04.1074629Z  2025-12-04T08:40:04.1075030Z def get_potential_pr_author( 2025-12-04T08:40:04.1075769Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:40:04.1076489Z ) -> str: 2025-12-04T08:40:04.1077094Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:40:04.1077984Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:40:04.1078819Z  # embedded in the tag name: ciflow// 2025-12-04T08:40:04.1079442Z  2025-12-04T08:40:04.1080080Z  gh = get_gh_client(github_token) 2025-12-04T08:40:04.1080642Z  2025-12-04T08:40:04.1081151Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:40:04.1081848Z  split_tag = ref_name.split("/") 2025-12-04T08:40:04.1082395Z  if ( 2025-12-04T08:40:04.1082854Z  len(split_tag) == 3 2025-12-04T08:40:04.1083414Z  and split_tag[0] == "ciflow" 2025-12-04T08:40:04.1083998Z  and split_tag[2].isnumeric() 2025-12-04T08:40:04.1084538Z  ): 2025-12-04T08:40:04.1085004Z  pr_number = split_tag[2] 2025-12-04T08:40:04.1085552Z  try: 2025-12-04T08:40:04.1086065Z  repository = gh.get_repo(repo) 2025-12-04T08:40:04.1086912Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:40:04.1087586Z  except Exception as e: 2025-12-04T08:40:04.1088178Z  raise Exception( # noqa: TRY002 2025-12-04T08:40:04.1088921Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:40:04.1089627Z  ) from e 2025-12-04T08:40:04.1090447Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:40:04.1091231Z  # In all other cases, return the original input username 2025-12-04T08:40:04.1091880Z  return username 2025-12-04T08:40:04.1092349Z  2025-12-04T08:40:04.1092716Z  2025-12-04T08:40:04.1093181Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:40:04.1093764Z  """ 2025-12-04T08:40:04.1094486Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:40:04.1095321Z  """ 2025-12-04T08:40:04.1095932Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:40:04.1096658Z  2025-12-04T08:40:04.1097027Z  2025-12-04T08:40:04.1097456Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:40:04.1098004Z  try: 2025-12-04T08:40:04.1098457Z  data = yaml.safe_load(yaml_text) 2025-12-04T08:40:04.1099024Z  return data 2025-12-04T08:40:04.1099514Z  except yaml.YAMLError: 2025-12-04T08:40:04.1100261Z  log.exception("Error loading YAML") 2025-12-04T08:40:04.1100837Z  raise 2025-12-04T08:40:04.1101271Z  2025-12-04T08:40:04.1101633Z  2025-12-04T08:40:04.1102303Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:40:04.1103092Z  """ 2025-12-04T08:40:04.1103926Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:40:04.1104735Z  2025-12-04T08:40:04.1105313Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:04.1106154Z  and the text below is the list of opted in users. 2025-12-04T08:40:04.1106753Z  2025-12-04T08:40:04.1107373Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:40:04.1108117Z  """ 2025-12-04T08:40:04.1108624Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T08:40:04.1109284Z  if len(rollout_state_parts) >= 2: 2025-12-04T08:40:04.1110203Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:40:04.1110876Z  else: 2025-12-04T08:40:04.1111316Z  return "", rollout_state 2025-12-04T08:40:04.1111851Z  2025-12-04T08:40:04.1112214Z  2025-12-04T08:40:04.1112828Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:40:04.1113464Z  """ 2025-12-04T08:40:04.1114048Z  Dictionary of users with a list of features they have opted into 2025-12-04T08:40:04.1114742Z  """ 2025-12-04T08:40:04.1115122Z  2025-12-04T08:40:04.1115484Z  2025-12-04T08:40:04.1116054Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:40:04.1116753Z  """ 2025-12-04T08:40:04.1117540Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:40:04.1118405Z  2025-12-04T08:40:04.1119254Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:40:04.1120991Z  - Example line: "@User1,lf,split_build" 2025-12-04T08:40:04.1121915Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:40:04.1122588Z  2025-12-04T08:40:04.1122946Z  2025-12-04T08:40:04.1123306Z  """ 2025-12-04T08:40:04.1123717Z  optins = UserOptins() 2025-12-04T08:40:04.1124282Z  for user in user_optin_text.split("\n"): 2025-12-04T08:40:04.1124887Z  user = user.strip("\r\n\t -") 2025-12-04T08:40:04.1125496Z  if not user or not user.startswith("@"): 2025-12-04T08:40:04.1126096Z  # Not a valid user. Skip 2025-12-04T08:40:04.1126632Z  continue 2025-12-04T08:40:04.1127074Z  2025-12-04T08:40:04.1127447Z  if user: 2025-12-04T08:40:04.1127958Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T08:40:04.1128709Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:40:04.1129389Z  2025-12-04T08:40:04.1129976Z  return optins 2025-12-04T08:40:04.1130506Z  2025-12-04T08:40:04.1130866Z  2025-12-04T08:40:04.1131407Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:40:04.1132063Z  """ 2025-12-04T08:40:04.1132517Z  Check if the experiment name is valid. 2025-12-04T08:40:04.1133084Z  A valid name: 2025-12-04T08:40:04.1133807Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:40:04.1134805Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:40:04.1135559Z  - Cannot contain spaces 2025-12-04T08:40:04.1136076Z  """ 2025-12-04T08:40:04.1136461Z  2025-12-04T08:40:04.1136958Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:40:04.1138219Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:40:04.1139782Z  2025-12-04T08:40:04.1140824Z  if valid: 2025-12-04T08:40:04.1141649Z  return True 2025-12-04T08:40:04.1142512Z  2025-12-04T08:40:04.1143193Z  log.error( 2025-12-04T08:40:04.1146168Z  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-12-04T08:40:04.1149297Z  ) 2025-12-04T08:40:04.1150279Z  return False 2025-12-04T08:40:04.1150972Z  2025-12-04T08:40:04.1151344Z  2025-12-04T08:40:04.1152133Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:40:04.1152812Z  """ 2025-12-04T08:40:04.1153478Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:40:04.1154258Z  """ 2025-12-04T08:40:04.1154656Z  try: 2025-12-04T08:40:04.1155075Z  if settings_text: 2025-12-04T08:40:04.1155875Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:40:04.1156712Z  # for easy reading 2025-12-04T08:40:04.1157574Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:40:04.1158521Z  # the backtick character in shell commands. 2025-12-04T08:40:04.1159180Z  backtick = chr(96) # backtick character 2025-12-04T08:40:04.1160155Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:40:04.1160922Z  settings = load_yaml(settings_text) 2025-12-04T08:40:04.1161474Z  2025-12-04T08:40:04.1162133Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:40:04.1163115Z  experiments = {} 2025-12-04T08:40:04.1163616Z  2025-12-04T08:40:04.1164226Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:40:04.1165039Z  if not is_valid_experiment_name(exp_name): 2025-12-04T08:40:04.1166216Z  # 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-12-04T08:40:04.1167363Z  continue 2025-12-04T08:40:04.1167854Z  2025-12-04T08:40:04.1168272Z  valid_settings = {} 2025-12-04T08:40:04.1168851Z  for setting in exp_settings: 2025-12-04T08:40:04.1169472Z  if setting not in Experiment._fields: 2025-12-04T08:40:04.1170300Z  log.warning( 2025-12-04T08:40:04.1171104Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:40:04.1171863Z  ) 2025-12-04T08:40:04.1172351Z  else: 2025-12-04T08:40:04.1172940Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T08:40:04.1173548Z  2025-12-04T08:40:04.1174059Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:40:04.1174743Z  return Settings(experiments) 2025-12-04T08:40:04.1175285Z  2025-12-04T08:40:04.1175674Z  except Exception: 2025-12-04T08:40:04.1176226Z  log.exception("Failed to parse settings") 2025-12-04T08:40:04.1176800Z  2025-12-04T08:40:04.1177181Z  return Settings() 2025-12-04T08:40:04.1177643Z  2025-12-04T08:40:04.1178009Z  2025-12-04T08:40:04.1178634Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:40:04.1179266Z  """ 2025-12-04T08:40:04.1179762Z  Parse settings, if any, from the rollout state. 2025-12-04T08:40:04.1180550Z  2025-12-04T08:40:04.1181140Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:04.1181953Z  and the text below is the list of opted in users. 2025-12-04T08:40:04.1182543Z  2025-12-04T08:40:04.1183183Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:40:04.1183938Z  """ 2025-12-04T08:40:04.1184570Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:04.1185397Z  return parse_settings_from_text(settings_text) 2025-12-04T08:40:04.1185974Z  2025-12-04T08:40:04.1186336Z  2025-12-04T08:40:04.1186826Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:40:04.1187438Z  """ 2025-12-04T08:40:04.1187880Z  Parse users from the rollout state. 2025-12-04T08:40:04.1188426Z  2025-12-04T08:40:04.1188791Z  """ 2025-12-04T08:40:04.1189389Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:04.1190428Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T08:40:04.1191019Z  2025-12-04T08:40:04.1191386Z  2025-12-04T08:40:04.1192048Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:04.1192836Z  """ 2025-12-04T08:40:04.1193316Z  Check if a user is opted into an experiment 2025-12-04T08:40:04.1193894Z  """ 2025-12-04T08:40:04.1194415Z  return experiment_name in user_optins.get(user, []) 2025-12-04T08:40:04.1195223Z  2025-12-04T08:40:04.1195588Z  2025-12-04T08:40:04.1196263Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:04.1197073Z  """ 2025-12-04T08:40:04.1197590Z  Check if a user explicitly opted out of an experiment 2025-12-04T08:40:04.1198214Z  """ 2025-12-04T08:40:04.1198783Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:40:04.1199536Z  experiment_optout = "-" + experiment_name 2025-12-04T08:40:04.1200476Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:40:04.1201121Z  return False 2025-12-04T08:40:04.1201583Z  2025-12-04T08:40:04.1202084Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:40:04.1202732Z  log.warning( 2025-12-04T08:40:04.1203634Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:40:04.1204545Z  ) 2025-12-04T08:40:04.1204946Z  2025-12-04T08:40:04.1205320Z  return True 2025-12-04T08:40:04.1205760Z  2025-12-04T08:40:04.1206117Z  2025-12-04T08:40:04.1206515Z def get_runner_prefix( 2025-12-04T08:40:04.1207014Z  rollout_state: str, 2025-12-04T08:40:04.1207559Z  workflow_requestors: Iterable[str], 2025-12-04T08:40:04.1208130Z  branch: str, 2025-12-04T08:40:04.1208701Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:04.1209443Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:04.1210269Z  is_canary: bool = False, 2025-12-04T08:40:04.1210787Z ) -> str: 2025-12-04T08:40:04.1211283Z  settings = parse_settings(rollout_state) 2025-12-04T08:40:04.1211923Z  user_optins = parse_users(rollout_state) 2025-12-04T08:40:04.1212491Z  2025-12-04T08:40:04.1213013Z  fleet_prefix = "" 2025-12-04T08:40:04.1213510Z  prefixes = [] 2025-12-04T08:40:04.1214231Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:40:04.1215238Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:40:04.1215996Z  log.info( 2025-12-04T08:40:04.1216755Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:40:04.1217548Z  ) 2025-12-04T08:40:04.1217997Z  continue 2025-12-04T08:40:04.1218456Z  2025-12-04T08:40:04.1218857Z  if opt_out_experiments: 2025-12-04T08:40:04.1219461Z  if experiment_name in opt_out_experiments: 2025-12-04T08:40:04.1220376Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:40:04.1221046Z  log.info( 2025-12-04T08:40:04.1222054Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:40:04.1223066Z  ) 2025-12-04T08:40:04.1223533Z  continue 2025-12-04T08:40:04.1224001Z  2025-12-04T08:40:04.1224403Z  if eligible_experiments: 2025-12-04T08:40:04.1225072Z  if experiment_name not in eligible_experiments: 2025-12-04T08:40:04.1225771Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T08:40:04.1226362Z  log.info( 2025-12-04T08:40:04.1227207Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:40:04.1228085Z  ) 2025-12-04T08:40:04.1228678Z  continue 2025-12-04T08:40:04.1229241Z  elif not experiment_settings.default: 2025-12-04T08:40:04.1230029Z  log.info( 2025-12-04T08:40:04.1230814Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:40:04.1231594Z  ) 2025-12-04T08:40:04.1232032Z  continue 2025-12-04T08:40:04.1232483Z  2025-12-04T08:40:04.1232988Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:40:04.1233652Z  opted_out_users = [ 2025-12-04T08:40:04.1234162Z  requestor 2025-12-04T08:40:04.1234701Z  for requestor in workflow_requestors 2025-12-04T08:40:04.1235446Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:40:04.1236108Z  ] 2025-12-04T08:40:04.1236515Z  2025-12-04T08:40:04.1236917Z  if opted_out_users: 2025-12-04T08:40:04.1237464Z  log.info( 2025-12-04T08:40:04.1238161Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:40:04.1238899Z  ) 2025-12-04T08:40:04.1239341Z  continue 2025-12-04T08:40:04.1239784Z  2025-12-04T08:40:04.1240541Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:40:04.1241195Z  opted_in_users = [ 2025-12-04T08:40:04.1241732Z  requestor 2025-12-04T08:40:04.1242281Z  for requestor in workflow_requestors 2025-12-04T08:40:04.1243018Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:40:04.1243691Z  ] 2025-12-04T08:40:04.1244091Z  2025-12-04T08:40:04.1244480Z  enabled = False 2025-12-04T08:40:04.1244993Z  if opted_in_users: 2025-12-04T08:40:04.1245639Z  log.info( 2025-12-04T08:40:04.1246332Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:40:04.1247058Z  ) 2025-12-04T08:40:04.1247492Z  enabled = True 2025-12-04T08:40:04.1247979Z  2025-12-04T08:40:04.1248428Z  elif experiment_settings.rollout_perc: 2025-12-04T08:40:04.1249316Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:40:04.1250523Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:40:04.1251223Z  log.info( 2025-12-04T08:40:04.1252169Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:40:04.1253138Z  ) 2025-12-04T08:40:04.1253622Z  enabled = True 2025-12-04T08:40:04.1254129Z  2025-12-04T08:40:04.1254513Z  if enabled: 2025-12-04T08:40:04.1255012Z  label = experiment_name 2025-12-04T08:40:04.1255626Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:40:04.1256512Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:40:04.1257437Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T08:40:04.1258252Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:40:04.1258961Z  if is_canary: 2025-12-04T08:40:04.1259516Z  label += CANARY_FLEET_SUFFIX 2025-12-04T08:40:04.1260298Z  fleet_prefix = label 2025-12-04T08:40:04.1260839Z  else: 2025-12-04T08:40:04.1261485Z  prefixes.append(label) 2025-12-04T08:40:04.1262029Z  2025-12-04T08:40:04.1262415Z  if len(prefixes) > 1: 2025-12-04T08:40:04.1262920Z  log.error( 2025-12-04T08:40:04.1264036Z  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-12-04T08:40:04.1265212Z  ) 2025-12-04T08:40:04.1265657Z  prefixes = prefixes[:1] 2025-12-04T08:40:04.1266174Z  2025-12-04T08:40:04.1266615Z  # Fleet always comes first 2025-12-04T08:40:04.1267327Z  if fleet_prefix: 2025-12-04T08:40:04.1267856Z  prefixes.insert(0, fleet_prefix) 2025-12-04T08:40:04.1268410Z  2025-12-04T08:40:04.1268897Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:40:04.1269517Z  2025-12-04T08:40:04.1270106Z  2025-12-04T08:40:04.1270831Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:40:04.1271643Z  """ 2025-12-04T08:40:04.1272290Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:40:04.1273028Z  2025-12-04T08:40:04.1273648Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:40:04.1274385Z  """ 2025-12-04T08:40:04.1274836Z  gh = get_gh_client(github_token) 2025-12-04T08:40:04.1275446Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T08:40:04.1276138Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:40:04.1276771Z  2025-12-04T08:40:04.1277132Z  2025-12-04T08:40:04.1277767Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:40:04.1278717Z  for _ in range(num_retries): 2025-12-04T08:40:04.1279251Z  try: 2025-12-04T08:40:04.1279733Z  req = Request(url=url, headers=headers) 2025-12-04T08:40:04.1280701Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:40:04.1281404Z  return json.loads(content) 2025-12-04T08:40:04.1281979Z  except Exception as e: 2025-12-04T08:40:04.1282593Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T08:40:04.1283185Z  2025-12-04T08:40:04.1283813Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:40:04.1284571Z  return {} 2025-12-04T08:40:04.1284993Z  2025-12-04T08:40:04.1285358Z  2025-12-04T08:40:04.1285720Z @cache 2025-12-04T08:40:04.1286420Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:40:04.1287226Z  """ 2025-12-04T08:40:04.1287671Z  Dynamically get PR information 2025-12-04T08:40:04.1288205Z  """ 2025-12-04T08:40:04.1288872Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:40:04.1289551Z  headers = { 2025-12-04T08:40:04.1290283Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T08:40:04.1290962Z  "Authorization": f"token {github_token}", 2025-12-04T08:40:04.1291529Z  } 2025-12-04T08:40:04.1292018Z  json_response: dict[str, Any] = download_json( 2025-12-04T08:40:04.1292673Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:40:04.1293262Z  headers=headers, 2025-12-04T08:40:04.1293747Z  ) 2025-12-04T08:40:04.1294127Z  2025-12-04T08:40:04.1294517Z  if not json_response: 2025-12-04T08:40:04.1295165Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:40:04.1295999Z  return {} 2025-12-04T08:40:04.1296438Z  2025-12-04T08:40:04.1296826Z  return json_response 2025-12-04T08:40:04.1297304Z  2025-12-04T08:40:04.1297669Z  2025-12-04T08:40:04.1298303Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:40:04.1299081Z  """ 2025-12-04T08:40:04.1299676Z  Dynamically get the latest list of labels from the pull request 2025-12-04T08:40:04.1300570Z  """ 2025-12-04T08:40:04.1301122Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:40:04.1301777Z  return { 2025-12-04T08:40:04.1302425Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:40:04.1303153Z  } 2025-12-04T08:40:04.1303539Z  2025-12-04T08:40:04.1303909Z  2025-12-04T08:40:04.1304291Z def main() -> None: 2025-12-04T08:40:04.1304777Z  args = parse_args() 2025-12-04T08:40:04.1305247Z  2025-12-04T08:40:04.1305702Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:40:04.1306273Z  2025-12-04T08:40:04.1306671Z  # Check if the PR is opt-out 2025-12-04T08:40:04.1307209Z  if args.pr_number: 2025-12-04T08:40:04.1307949Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:40:04.1308752Z  if OPT_OUT_LABEL in labels: 2025-12-04T08:40:04.1309289Z  log.info( 2025-12-04T08:40:04.1310293Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:40:04.1311115Z  ) 2025-12-04T08:40:04.1311752Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:04.1312483Z  sys.exit() 2025-12-04T08:40:04.1313092Z  2025-12-04T08:40:04.1313476Z  try: 2025-12-04T08:40:04.1313973Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T08:40:04.1314749Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:40:04.1315427Z  ) 2025-12-04T08:40:04.1315831Z  2025-12-04T08:40:04.1316259Z  username = get_potential_pr_author( 2025-12-04T08:40:04.1316841Z  args.github_token, 2025-12-04T08:40:04.1317381Z  args.github_repo, 2025-12-04T08:40:04.1317906Z  args.github_actor, 2025-12-04T08:40:04.1318459Z  args.github_ref_type, 2025-12-04T08:40:04.1319005Z  args.github_branch, 2025-12-04T08:40:04.1319517Z  ) 2025-12-04T08:40:04.1320177Z  2025-12-04T08:40:04.1320738Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:40:04.1321385Z  2025-12-04T08:40:04.1321835Z  runner_label_prefix = get_runner_prefix( 2025-12-04T08:40:04.1322434Z  rollout_state, 2025-12-04T08:40:04.1322985Z  (args.github_issue_owner, username), 2025-12-04T08:40:04.1323575Z  args.github_branch, 2025-12-04T08:40:04.1324131Z  args.eligible_experiments, 2025-12-04T08:40:04.1324717Z  args.opt_out_experiments, 2025-12-04T08:40:04.1325261Z  is_canary, 2025-12-04T08:40:04.1325736Z  ) 2025-12-04T08:40:04.1326131Z  2025-12-04T08:40:04.1326524Z  except Exception as e: 2025-12-04T08:40:04.1327033Z  log.error( 2025-12-04T08:40:04.1327786Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:40:04.1328721Z  ) 2025-12-04T08:40:04.1329123Z  2025-12-04T08:40:04.1329684Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:04.1330612Z  2025-12-04T08:40:04.1330988Z  2025-12-04T08:40:04.1331376Z if __name__ == "__main__": 2025-12-04T08:40:04.1331875Z  main() 2025-12-04T08:40:04.1332281Z  2025-12-04T08:40:04.1332642Z EOF 2025-12-04T08:40:04.1333019Z  2025-12-04T08:40:04.1333415Z cat runner_determinator.py 2025-12-04T08:40:04.1947453Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:04.1948346Z env: 2025-12-04T08:40:04.1949125Z GITHUB_TOKEN: *** 2025-12-04T08:40:04.1949586Z ISSUE_NUMBER: 5132 2025-12-04T08:40:04.1950251Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:04.1950804Z ISSUE_OWNER: 2025-12-04T08:40:04.1951232Z CHECK_EXPERIMENTS: 2025-12-04T08:40:04.1951699Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:40:04.1952160Z PR_NUMBER: 2025-12-04T08:40:04.1952592Z ##[endgroup] 2025-12-04T08:40:04.2162190Z # flake8: noqa: G004 2025-12-04T08:40:04.2162732Z 2025-12-04T08:40:04.2163341Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T08:40:04.2164342Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T08:40:04.2165202Z # python .github/scripts/update_runner_determinator.py 2025-12-04T08:40:04.2165670Z 2025-12-04T08:40:04.2165838Z """ 2025-12-04T08:40:04.2166449Z This runner determinator is used to determine which set of runners to run a 2025-12-04T08:40:04.2167352Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T08:40:04.2168288Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T08:40:04.2169136Z of which runners should be used to run which job. 2025-12-04T08:40:04.2169569Z 2025-12-04T08:40:04.2170293Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T08:40:04.2171510Z separated by a line containing "---". If the line is not present, the 2025-12-04T08:40:04.2172447Z settings are considered to be empty with only the second part, the user 2025-12-04T08:40:04.2173191Z list, defined. 2025-12-04T08:40:04.2173439Z 2025-12-04T08:40:04.2173810Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T08:40:04.2174780Z used to define any settings that are needed to determine which runners to use. 2025-12-04T08:40:04.2175641Z It's fields are defined by the RolloutSettings class below. 2025-12-04T08:40:04.2176123Z 2025-12-04T08:40:04.2176511Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T08:40:04.2177430Z The user list is also a comma separated list of additional features or 2025-12-04T08:40:04.2178211Z experiments which the user could be opted in to. 2025-12-04T08:40:04.2178649Z 2025-12-04T08:40:04.2178861Z The user list has the following rules: 2025-12-04T08:40:04.2179246Z 2025-12-04T08:40:04.2179577Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T08:40:04.2180747Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T08:40:04.2181549Z - A "#" prefix opts the user out of all experiments 2025-12-04T08:40:04.2181973Z 2025-12-04T08:40:04.2182148Z Example config: 2025-12-04T08:40:04.2182636Z # A list of experiments that can be opted into. 2025-12-04T08:40:04.2183330Z # This defines the behavior they'll induce when opted into. 2025-12-04T08:40:04.2183986Z # Expected syntax is: 2025-12-04T08:40:04.2184653Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T08:40:04.2185665Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T08:40:04.2186300Z 2025-12-04T08:40:04.2186495Z experiments: 2025-12-04T08:40:04.2186916Z lf: 2025-12-04T08:40:04.2187335Z rollout_percent: 25 2025-12-04T08:40:04.2188001Z all_branches: false 2025-12-04T08:40:04.2188492Z default: true 2025-12-04T08:40:04.2188932Z --- 2025-12-04T08:40:04.2189199Z 2025-12-04T08:40:04.2189373Z # Opt-ins: 2025-12-04T08:40:04.2190812Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T08:40:04.2191833Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T08:40:04.2192662Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T08:40:04.2193371Z # Experiments should be from the above list. 2025-12-04T08:40:04.2193788Z 2025-12-04T08:40:04.2193989Z @User1,-lf,split_build 2025-12-04T08:40:04.2194463Z @User2,lf 2025-12-04T08:40:04.2194888Z @User3,split_build 2025-12-04T08:40:04.2195330Z """ 2025-12-04T08:40:04.2195550Z 2025-12-04T08:40:04.2195724Z import json 2025-12-04T08:40:04.2196122Z import logging 2025-12-04T08:40:04.2196545Z import os 2025-12-04T08:40:04.2196945Z import random 2025-12-04T08:40:04.2197380Z import re 2025-12-04T08:40:04.2197781Z import sys 2025-12-04T08:40:04.2198220Z from argparse import ArgumentParser 2025-12-04T08:40:04.2198791Z from collections.abc import Iterable 2025-12-04T08:40:04.2199345Z from functools import cache 2025-12-04T08:40:04.2200156Z from logging import LogRecord 2025-12-04T08:40:04.2200716Z from typing import Any, NamedTuple 2025-12-04T08:40:04.2201300Z from urllib.request import Request, urlopen 2025-12-04T08:40:04.2201700Z 2025-12-04T08:40:04.2201871Z import yaml 2025-12-04T08:40:04.2202300Z from github import Auth, Github 2025-12-04T08:40:04.2202829Z from github.Issue import Issue 2025-12-04T08:40:04.2203168Z 2025-12-04T08:40:04.2203176Z 2025-12-04T08:40:04.2203404Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T08:40:04.2204133Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T08:40:04.2205041Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T08:40:04.2205625Z 2025-12-04T08:40:04.2205873Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T08:40:04.2206648Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T08:40:04.2207212Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T08:40:04.2207788Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T08:40:04.2208169Z 2025-12-04T08:40:04.2208373Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T08:40:04.2208733Z 2025-12-04T08:40:04.2208932Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T08:40:04.2209430Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T08:40:04.2209744Z 2025-12-04T08:40:04.2209751Z 2025-12-04T08:40:04.2210136Z class Experiment(NamedTuple): 2025-12-04T08:40:04.2210676Z rollout_perc: float = ( 2025-12-04T08:40:04.2211355Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T08:40:04.2212067Z ) 2025-12-04T08:40:04.2212477Z all_branches: bool = ( 2025-12-04T08:40:04.2213142Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T08:40:04.2213849Z ) 2025-12-04T08:40:04.2214252Z default: bool = ( 2025-12-04T08:40:04.2214858Z True # If True, the experiment is enabled by default for all queries 2025-12-04T08:40:04.2215539Z ) 2025-12-04T08:40:04.2215760Z 2025-12-04T08:40:04.2215951Z # Add more fields as needed 2025-12-04T08:40:04.2216284Z 2025-12-04T08:40:04.2216290Z 2025-12-04T08:40:04.2216483Z class Settings(NamedTuple): 2025-12-04T08:40:04.2216962Z """ 2025-12-04T08:40:04.2217447Z Settings for the experiments that can be opted into. 2025-12-04T08:40:04.2218069Z """ 2025-12-04T08:40:04.2218283Z 2025-12-04T08:40:04.2218503Z experiments: dict[str, Experiment] = {} 2025-12-04T08:40:04.2218897Z 2025-12-04T08:40:04.2218904Z 2025-12-04T08:40:04.2219124Z class ColorFormatter(logging.Formatter): 2025-12-04T08:40:04.2219783Z """Color codes the log messages based on the log level""" 2025-12-04T08:40:04.2220363Z 2025-12-04T08:40:04.2220536Z COLORS = { 2025-12-04T08:40:04.2220969Z "WARNING": "\033[33m", # Yellow 2025-12-04T08:40:04.2221665Z "ERROR": "\033[31m", # Red 2025-12-04T08:40:04.2222218Z "CRITICAL": "\033[31m", # Red 2025-12-04T08:40:04.2222762Z "INFO": "\033[0m", # Reset 2025-12-04T08:40:04.2223285Z "DEBUG": "\033[0m", # Reset 2025-12-04T08:40:04.2223786Z } 2025-12-04T08:40:04.2224002Z 2025-12-04T08:40:04.2224235Z def format(self, record: LogRecord) -> str: 2025-12-04T08:40:04.2225020Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T08:40:04.2225850Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T08:40:04.2226466Z return super().format(record) 2025-12-04T08:40:04.2226825Z 2025-12-04T08:40:04.2226832Z 2025-12-04T08:40:04.2227034Z handler = logging.StreamHandler() 2025-12-04T08:40:04.2227774Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T08:40:04.2228356Z 2025-12-04T08:40:04.2228607Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T08:40:04.2229228Z log.addHandler(handler) 2025-12-04T08:40:04.2229699Z log.setLevel(logging.INFO) 2025-12-04T08:40:04.2230184Z 2025-12-04T08:40:04.2230192Z 2025-12-04T08:40:04.2230452Z def set_github_output(key: str, value: str) -> None: 2025-12-04T08:40:04.2231057Z """ 2025-12-04T08:40:04.2231587Z Defines outputs of the github action that invokes this script 2025-12-04T08:40:04.2232261Z """ 2025-12-04T08:40:04.2232662Z if not GITHUB_OUTPUT: 2025-12-04T08:40:04.2233758Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T08:40:04.2234909Z log.warning( 2025-12-04T08:40:04.2235795Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T08:40:04.2236775Z ) 2025-12-04T08:40:04.2246809Z print(f"::set-output name={key}::{value}") 2025-12-04T08:40:04.2247463Z return 2025-12-04T08:40:04.2247736Z 2025-12-04T08:40:04.2248130Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T08:40:04.2248769Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T08:40:04.2249374Z f.write(f"{key}={value}\n") 2025-12-04T08:40:04.2249735Z 2025-12-04T08:40:04.2249742Z 2025-12-04T08:40:04.2250227Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T08:40:04.2250898Z return frozenset( 2025-12-04T08:40:04.2251536Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T08:40:04.2252258Z ) 2025-12-04T08:40:04.2252484Z 2025-12-04T08:40:04.2252491Z 2025-12-04T08:40:04.2252682Z def parse_args() -> Any: 2025-12-04T08:40:04.2253282Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T08:40:04.2254180Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T08:40:04.2254999Z parser.add_argument( 2025-12-04T08:40:04.2255491Z "--github-issue-repo", 2025-12-04T08:40:04.2255994Z type=str, 2025-12-04T08:40:04.2256437Z required=False, 2025-12-04T08:40:04.2256917Z default="pytorch/test-infra", 2025-12-04T08:40:04.2257495Z help="GitHub repo to get the issue", 2025-12-04T08:40:04.2258033Z ) 2025-12-04T08:40:04.2258431Z parser.add_argument( 2025-12-04T08:40:04.2258916Z "--github-repo", 2025-12-04T08:40:04.2259382Z type=str, 2025-12-04T08:40:04.2259920Z required=True, 2025-12-04T08:40:04.2260437Z help="GitHub repo where CI is running", 2025-12-04T08:40:04.2261006Z ) 2025-12-04T08:40:04.2261402Z parser.add_argument( 2025-12-04T08:40:04.2262049Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T08:40:04.2262753Z ) 2025-12-04T08:40:04.2263157Z parser.add_argument( 2025-12-04T08:40:04.2263806Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T08:40:04.2264536Z ) 2025-12-04T08:40:04.2264933Z parser.add_argument( 2025-12-04T08:40:04.2265750Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T08:40:04.2266483Z ) 2025-12-04T08:40:04.2266882Z parser.add_argument( 2025-12-04T08:40:04.2267579Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T08:40:04.2268340Z ) 2025-12-04T08:40:04.2268747Z parser.add_argument( 2025-12-04T08:40:04.2269230Z "--github-ref-type", 2025-12-04T08:40:04.2269721Z type=str, 2025-12-04T08:40:04.2270271Z required=True, 2025-12-04T08:40:04.2270828Z help="Current GitHub ref type, branch or tag", 2025-12-04T08:40:04.2271416Z ) 2025-12-04T08:40:04.2271824Z parser.add_argument( 2025-12-04T08:40:04.2272314Z "--eligible-experiments", 2025-12-04T08:40:04.2272872Z type=_str_comma_separated_to_set, 2025-12-04T08:40:04.2273426Z required=False, 2025-12-04T08:40:04.2273870Z default="", 2025-12-04T08:40:04.2323146Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T08:40:04.2324375Z ) 2025-12-04T08:40:04.2324793Z parser.add_argument( 2025-12-04T08:40:04.2325308Z "--opt-out-experiments", 2025-12-04T08:40:04.2325855Z type=_str_comma_separated_to_set, 2025-12-04T08:40:04.2326425Z required=False, 2025-12-04T08:40:04.2326881Z default="", 2025-12-04T08:40:04.2327309Z help=( 2025-12-04T08:40:04.2328020Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T08:40:04.2329193Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T08:40:04.2330204Z ), 2025-12-04T08:40:04.2330588Z ) 2025-12-04T08:40:04.2330991Z parser.add_argument( 2025-12-04T08:40:04.2331466Z "--pr-number", 2025-12-04T08:40:04.2331914Z type=str, 2025-12-04T08:40:04.2332342Z required=False, 2025-12-04T08:40:04.2332796Z default="", 2025-12-04T08:40:04.2333473Z help="the optional PR number where this is run", 2025-12-04T08:40:04.2334077Z ) 2025-12-04T08:40:04.2334300Z 2025-12-04T08:40:04.2334505Z return parser.parse_args() 2025-12-04T08:40:04.2334837Z 2025-12-04T08:40:04.2334844Z 2025-12-04T08:40:04.2335256Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T08:40:04.2336053Z auth = Auth.Token(github_token) 2025-12-04T08:40:04.2336589Z return Github(auth=auth) 2025-12-04T08:40:04.2336918Z 2025-12-04T08:40:04.2336925Z 2025-12-04T08:40:04.2337380Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T08:40:04.2338224Z repo = gh.get_repo(repo) 2025-12-04T08:40:04.2338750Z return repo.get_issue(number=issue_num) 2025-12-04T08:40:04.2339149Z 2025-12-04T08:40:04.2339155Z 2025-12-04T08:40:04.2339354Z def get_potential_pr_author( 2025-12-04T08:40:04.2340193Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T08:40:04.2340920Z ) -> str: 2025-12-04T08:40:04.2341462Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T08:40:04.2342293Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T08:40:04.2343073Z # embedded in the tag name: ciflow// 2025-12-04T08:40:04.2343520Z 2025-12-04T08:40:04.2343720Z gh = get_gh_client(github_token) 2025-12-04T08:40:04.2344084Z 2025-12-04T08:40:04.2344359Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T08:40:04.2345015Z split_tag = ref_name.split("/") 2025-12-04T08:40:04.2345552Z if ( 2025-12-04T08:40:04.2345972Z len(split_tag) == 3 2025-12-04T08:40:04.2346481Z and split_tag[0] == "ciflow" 2025-12-04T08:40:04.2347043Z and split_tag[2].isnumeric() 2025-12-04T08:40:04.2347564Z ): 2025-12-04T08:40:04.2347981Z pr_number = split_tag[2] 2025-12-04T08:40:04.2348633Z try: 2025-12-04T08:40:04.2349106Z repository = gh.get_repo(repo) 2025-12-04T08:40:04.2349755Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T08:40:04.2350524Z except Exception as e: 2025-12-04T08:40:04.2351076Z raise Exception( # noqa: TRY002 2025-12-04T08:40:04.2351788Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T08:40:04.2352471Z ) from e 2025-12-04T08:40:04.2353041Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T08:40:04.2353774Z # In all other cases, return the original input username 2025-12-04T08:40:04.2354391Z return username 2025-12-04T08:40:04.2354661Z 2025-12-04T08:40:04.2354667Z 2025-12-04T08:40:04.2354906Z def is_exception_branch(branch: str) -> bool: 2025-12-04T08:40:04.2355475Z """ 2025-12-04T08:40:04.2356154Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T08:40:04.2356971Z """ 2025-12-04T08:40:04.2357545Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T08:40:04.2358093Z 2025-12-04T08:40:04.2358106Z 2025-12-04T08:40:04.2358313Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T08:40:04.2358836Z try: 2025-12-04T08:40:04.2359252Z data = yaml.safe_load(yaml_text) 2025-12-04T08:40:04.2359787Z return data 2025-12-04T08:40:04.2360346Z except yaml.YAMLError: 2025-12-04T08:40:04.2360857Z log.exception("Error loading YAML") 2025-12-04T08:40:04.2361400Z raise 2025-12-04T08:40:04.2361641Z 2025-12-04T08:40:04.2361647Z 2025-12-04T08:40:04.2362084Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T08:40:04.2362852Z """ 2025-12-04T08:40:04.2363504Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T08:40:04.2364122Z 2025-12-04T08:40:04.2364615Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:04.2365412Z and the text below is the list of opted in users. 2025-12-04T08:40:04.2365842Z 2025-12-04T08:40:04.2366231Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T08:40:04.2366958Z """ 2025-12-04T08:40:04.2367427Z rollout_state_parts = rollout_state.split("---") 2025-12-04T08:40:04.2368061Z if len(rollout_state_parts) >= 2: 2025-12-04T08:40:04.2368695Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T08:40:04.2369311Z else: 2025-12-04T08:40:04.2369719Z return "", rollout_state 2025-12-04T08:40:04.2370161Z 2025-12-04T08:40:04.2370170Z 2025-12-04T08:40:04.2370383Z class UserOptins(dict[str, list[str]]): 2025-12-04T08:40:04.2370956Z """ 2025-12-04T08:40:04.2371502Z Dictionary of users with a list of features they have opted into 2025-12-04T08:40:04.2372172Z """ 2025-12-04T08:40:04.2372393Z 2025-12-04T08:40:04.2372405Z 2025-12-04T08:40:04.2372752Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T08:40:04.2373437Z """ 2025-12-04T08:40:04.2374162Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T08:40:04.2374869Z 2025-12-04T08:40:04.2375500Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T08:40:04.2376526Z - Example line: "@User1,lf,split_build" 2025-12-04T08:40:04.2377238Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T08:40:04.2377743Z 2025-12-04T08:40:04.2377750Z 2025-12-04T08:40:04.2377912Z """ 2025-12-04T08:40:04.2378311Z optins = UserOptins() 2025-12-04T08:40:04.2378819Z for user in user_optin_text.split("\n"): 2025-12-04T08:40:04.2379401Z user = user.strip("\r\n\t -") 2025-12-04T08:40:04.2380180Z if not user or not user.startswith("@"): 2025-12-04T08:40:04.2380917Z # Not a valid user. Skip 2025-12-04T08:40:04.2381434Z continue 2025-12-04T08:40:04.2381695Z 2025-12-04T08:40:04.2381863Z if user: 2025-12-04T08:40:04.2382327Z usr_name = user.split(",")[0].strip("@") 2025-12-04T08:40:04.2383054Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T08:40:04.2383579Z 2025-12-04T08:40:04.2383753Z return optins 2025-12-04T08:40:04.2384009Z 2025-12-04T08:40:04.2384017Z 2025-12-04T08:40:04.2384317Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T08:40:04.2384940Z """ 2025-12-04T08:40:04.2385369Z Check if the experiment name is valid. 2025-12-04T08:40:04.2385914Z A valid name: 2025-12-04T08:40:04.2386574Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T08:40:04.2387565Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T08:40:04.2388336Z - Cannot contain spaces 2025-12-04T08:40:04.2388829Z """ 2025-12-04T08:40:04.2389052Z 2025-12-04T08:40:04.2389324Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T08:40:04.2390176Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T08:40:04.2390649Z 2025-12-04T08:40:04.2390816Z if valid: 2025-12-04T08:40:04.2391219Z return True 2025-12-04T08:40:04.2391478Z 2025-12-04T08:40:04.2391645Z log.error( 2025-12-04T08:40:04.2393128Z 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-12-04T08:40:04.2394759Z ) 2025-12-04T08:40:04.2395132Z return False 2025-12-04T08:40:04.2395385Z 2025-12-04T08:40:04.2395393Z 2025-12-04T08:40:04.2395702Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T08:40:04.2396363Z """ 2025-12-04T08:40:04.2397097Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T08:40:04.2397865Z """ 2025-12-04T08:40:04.2398238Z try: 2025-12-04T08:40:04.2398632Z if settings_text: 2025-12-04T08:40:04.2399379Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T08:40:04.2400364Z # for easy reading 2025-12-04T08:40:04.2401184Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T08:40:04.2402111Z # the backtick character in shell commands. 2025-12-04T08:40:04.2402742Z backtick = chr(96) # backtick character 2025-12-04T08:40:04.2403447Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T08:40:04.2404159Z settings = load_yaml(settings_text) 2025-12-04T08:40:04.2404558Z 2025-12-04T08:40:04.2404980Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T08:40:04.2405776Z experiments = {} 2025-12-04T08:40:04.2406098Z 2025-12-04T08:40:04.2406489Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T08:40:04.2407288Z if not is_valid_experiment_name(exp_name): 2025-12-04T08:40:04.2408433Z # 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-12-04T08:40:04.2409512Z continue 2025-12-04T08:40:04.2409965Z 2025-12-04T08:40:04.2410174Z valid_settings = {} 2025-12-04T08:40:04.2410724Z for setting in exp_settings: 2025-12-04T08:40:04.2411329Z if setting not in Experiment._fields: 2025-12-04T08:40:04.2411915Z log.warning( 2025-12-04T08:40:04.2412652Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T08:40:04.2413557Z ) 2025-12-04T08:40:04.2414010Z else: 2025-12-04T08:40:04.2414556Z valid_settings[setting] = exp_settings[setting] 2025-12-04T08:40:04.2415007Z 2025-12-04T08:40:04.2415286Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T08:40:04.2415957Z return Settings(experiments) 2025-12-04T08:40:04.2416329Z 2025-12-04T08:40:04.2416510Z except Exception: 2025-12-04T08:40:04.2417010Z log.exception("Failed to parse settings") 2025-12-04T08:40:04.2417425Z 2025-12-04T08:40:04.2417609Z return Settings() 2025-12-04T08:40:04.2417886Z 2025-12-04T08:40:04.2417893Z 2025-12-04T08:40:04.2418147Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T08:40:04.2418748Z """ 2025-12-04T08:40:04.2419202Z Parse settings, if any, from the rollout state. 2025-12-04T08:40:04.2419639Z 2025-12-04T08:40:04.2420229Z If the issue body contains "---" then the text above that is the settings 2025-12-04T08:40:04.2421032Z and the text below is the list of opted in users. 2025-12-04T08:40:04.2421468Z 2025-12-04T08:40:04.2421881Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T08:40:04.2422653Z """ 2025-12-04T08:40:04.2423227Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:04.2424016Z return parse_settings_from_text(settings_text) 2025-12-04T08:40:04.2424436Z 2025-12-04T08:40:04.2424442Z 2025-12-04T08:40:04.2424696Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T08:40:04.2425292Z """ 2025-12-04T08:40:04.2425705Z Parse users from the rollout state. 2025-12-04T08:40:04.2426087Z 2025-12-04T08:40:04.2426249Z """ 2025-12-04T08:40:04.2426796Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T08:40:04.2427571Z return parse_user_opt_in_from_text(users_text) 2025-12-04T08:40:04.2428009Z 2025-12-04T08:40:04.2428016Z 2025-12-04T08:40:04.2428600Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:04.2429394Z """ 2025-12-04T08:40:04.2429957Z Check if a user is opted into an experiment 2025-12-04T08:40:04.2430544Z """ 2025-12-04T08:40:04.2431020Z return experiment_name in user_optins.get(user, []) 2025-12-04T08:40:04.2431469Z 2025-12-04T08:40:04.2431477Z 2025-12-04T08:40:04.2431908Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T08:40:04.2432683Z """ 2025-12-04T08:40:04.2433169Z Check if a user explicitly opted out of an experiment 2025-12-04T08:40:04.2433773Z """ 2025-12-04T08:40:04.2434304Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T08:40:04.2435009Z experiment_optout = "-" + experiment_name 2025-12-04T08:40:04.2435681Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T08:40:04.2436325Z return False 2025-12-04T08:40:04.2436597Z 2025-12-04T08:40:04.2436883Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T08:40:04.2437535Z log.warning( 2025-12-04T08:40:04.2438368Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T08:40:04.2439279Z ) 2025-12-04T08:40:04.2439507Z 2025-12-04T08:40:04.2439677Z return True 2025-12-04T08:40:04.2440035Z 2025-12-04T08:40:04.2440042Z 2025-12-04T08:40:04.2440232Z def get_runner_prefix( 2025-12-04T08:40:04.2440705Z rollout_state: str, 2025-12-04T08:40:04.2441197Z workflow_requestors: Iterable[str], 2025-12-04T08:40:04.2441743Z branch: str, 2025-12-04T08:40:04.2442257Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:04.2442958Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T08:40:04.2443574Z is_canary: bool = False, 2025-12-04T08:40:04.2444063Z ) -> str: 2025-12-04T08:40:04.2444640Z settings = parse_settings(rollout_state) 2025-12-04T08:40:04.2445261Z user_optins = parse_users(rollout_state) 2025-12-04T08:40:04.2445652Z 2025-12-04T08:40:04.2445840Z fleet_prefix = "" 2025-12-04T08:40:04.2446293Z prefixes = [] 2025-12-04T08:40:04.2446950Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T08:40:04.2447927Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T08:40:04.2448677Z log.info( 2025-12-04T08:40:04.2449377Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T08:40:04.2450278Z ) 2025-12-04T08:40:04.2450679Z continue 2025-12-04T08:40:04.2450958Z 2025-12-04T08:40:04.2451154Z if opt_out_experiments: 2025-12-04T08:40:04.2451724Z if experiment_name in opt_out_experiments: 2025-12-04T08:40:04.2452403Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T08:40:04.2453049Z log.info( 2025-12-04T08:40:04.2454009Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T08:40:04.2455027Z ) 2025-12-04T08:40:04.2455460Z continue 2025-12-04T08:40:04.2455750Z 2025-12-04T08:40:04.2455944Z if eligible_experiments: 2025-12-04T08:40:04.2456547Z if experiment_name not in eligible_experiments: 2025-12-04T08:40:04.2457217Z exp_list = ", ".join(eligible_experiments) 2025-12-04T08:40:04.2457813Z log.info( 2025-12-04T08:40:04.2458615Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T08:40:04.2459491Z ) 2025-12-04T08:40:04.2460016Z continue 2025-12-04T08:40:04.2460529Z elif not experiment_settings.default: 2025-12-04T08:40:04.2461097Z log.info( 2025-12-04T08:40:04.2461910Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T08:40:04.2462691Z ) 2025-12-04T08:40:04.2463092Z continue 2025-12-04T08:40:04.2463363Z 2025-12-04T08:40:04.2463649Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T08:40:04.2464293Z opted_out_users = [ 2025-12-04T08:40:04.2464778Z requestor 2025-12-04T08:40:04.2465258Z for requestor in workflow_requestors 2025-12-04T08:40:04.2465965Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T08:40:04.2466632Z ] 2025-12-04T08:40:04.2466858Z 2025-12-04T08:40:04.2467044Z if opted_out_users: 2025-12-04T08:40:04.2467531Z log.info( 2025-12-04T08:40:04.2468175Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T08:40:04.2468903Z ) 2025-12-04T08:40:04.2469302Z continue 2025-12-04T08:40:04.2469578Z 2025-12-04T08:40:04.2469974Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T08:40:04.2470675Z opted_in_users = [ 2025-12-04T08:40:04.2471154Z requestor 2025-12-04T08:40:04.2471642Z for requestor in workflow_requestors 2025-12-04T08:40:04.2472343Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T08:40:04.2472998Z ] 2025-12-04T08:40:04.2473217Z 2025-12-04T08:40:04.2473395Z enabled = False 2025-12-04T08:40:04.2473859Z if opted_in_users: 2025-12-04T08:40:04.2474317Z log.info( 2025-12-04T08:40:04.2474944Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T08:40:04.2475660Z ) 2025-12-04T08:40:04.2476071Z enabled = True 2025-12-04T08:40:04.2476373Z 2025-12-04T08:40:04.2476602Z elif experiment_settings.rollout_perc: 2025-12-04T08:40:04.2477469Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T08:40:04.2478577Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T08:40:04.2479266Z log.info( 2025-12-04T08:40:04.2480294Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T08:40:04.2481275Z ) 2025-12-04T08:40:04.2481715Z enabled = True 2025-12-04T08:40:04.2482045Z 2025-12-04T08:40:04.2482219Z if enabled: 2025-12-04T08:40:04.2482669Z label = experiment_name 2025-12-04T08:40:04.2483258Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T08:40:04.2484130Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T08:40:04.2485052Z # - If it's enabled, then we always list it's prefix first 2025-12-04T08:40:04.2485858Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T08:40:04.2486559Z if is_canary: 2025-12-04T08:40:04.2487082Z label += CANARY_FLEET_SUFFIX 2025-12-04T08:40:04.2487661Z fleet_prefix = label 2025-12-04T08:40:04.2488184Z else: 2025-12-04T08:40:04.2488637Z prefixes.append(label) 2025-12-04T08:40:04.2489012Z 2025-12-04T08:40:04.2489201Z if len(prefixes) > 1: 2025-12-04T08:40:04.2489668Z log.error( 2025-12-04T08:40:04.2490841Z 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-12-04T08:40:04.2492001Z ) 2025-12-04T08:40:04.2492403Z prefixes = prefixes[:1] 2025-12-04T08:40:04.2492736Z 2025-12-04T08:40:04.2492934Z # Fleet always comes first 2025-12-04T08:40:04.2493426Z if fleet_prefix: 2025-12-04T08:40:04.2493903Z prefixes.insert(0, fleet_prefix) 2025-12-04T08:40:04.2494289Z 2025-12-04T08:40:04.2494665Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T08:40:04.2495123Z 2025-12-04T08:40:04.2495132Z 2025-12-04T08:40:04.2495585Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T08:40:04.2496400Z """ 2025-12-04T08:40:04.2497005Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T08:40:04.2497593Z 2025-12-04T08:40:04.2497988Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T08:40:04.2498729Z """ 2025-12-04T08:40:04.2499148Z gh = get_gh_client(github_token) 2025-12-04T08:40:04.2499714Z issue = get_issue(gh, repo, issue_num) 2025-12-04T08:40:04.2500492Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T08:40:04.2500968Z 2025-12-04T08:40:04.2500976Z 2025-12-04T08:40:04.2501387Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T08:40:04.2502190Z for _ in range(num_retries): 2025-12-04T08:40:04.2502704Z try: 2025-12-04T08:40:04.2503144Z req = Request(url=url, headers=headers) 2025-12-04T08:40:04.2503840Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T08:40:04.2504508Z return json.loads(content) 2025-12-04T08:40:04.2505068Z except Exception as e: 2025-12-04T08:40:04.2505629Z log.warning(f"Could not download {url}: {e}") 2025-12-04T08:40:04.2506055Z 2025-12-04T08:40:04.2506444Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T08:40:04.2507190Z return {} 2025-12-04T08:40:04.2507433Z 2025-12-04T08:40:04.2507440Z 2025-12-04T08:40:04.2507606Z @cache 2025-12-04T08:40:04.2508251Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T08:40:04.2509030Z """ 2025-12-04T08:40:04.2509453Z Dynamically get PR information 2025-12-04T08:40:04.2510217Z """ 2025-12-04T08:40:04.2510742Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T08:40:04.2511411Z headers = { 2025-12-04T08:40:04.2511893Z "Accept": "application/vnd.github.v3+json", 2025-12-04T08:40:04.2512528Z "Authorization": f"token {github_token}", 2025-12-04T08:40:04.2513091Z } 2025-12-04T08:40:04.2513541Z json_response: dict[str, Any] = download_json( 2025-12-04T08:40:04.2514168Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T08:40:04.2514751Z headers=headers, 2025-12-04T08:40:04.2515204Z ) 2025-12-04T08:40:04.2515425Z 2025-12-04T08:40:04.2515613Z if not json_response: 2025-12-04T08:40:04.2516252Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T08:40:04.2516937Z return {} 2025-12-04T08:40:04.2517243Z 2025-12-04T08:40:04.2517450Z return json_response 2025-12-04T08:40:04.2517742Z 2025-12-04T08:40:04.2517749Z 2025-12-04T08:40:04.2518185Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T08:40:04.2518995Z """ 2025-12-04T08:40:04.2519537Z Dynamically get the latest list of labels from the pull request 2025-12-04T08:40:04.2520330Z """ 2025-12-04T08:40:04.2520841Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T08:40:04.2521517Z return { 2025-12-04T08:40:04.2522142Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T08:40:04.2522887Z } 2025-12-04T08:40:04.2523111Z 2025-12-04T08:40:04.2523118Z 2025-12-04T08:40:04.2523298Z def main() -> None: 2025-12-04T08:40:04.2523740Z args = parse_args() 2025-12-04T08:40:04.2524034Z 2025-12-04T08:40:04.2524263Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T08:40:04.2524680Z 2025-12-04T08:40:04.2524884Z # Check if the PR is opt-out 2025-12-04T08:40:04.2525399Z if args.pr_number: 2025-12-04T08:40:04.2526079Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T08:40:04.2527018Z if OPT_OUT_LABEL in labels: 2025-12-04T08:40:04.2527553Z log.info( 2025-12-04T08:40:04.2528261Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T08:40:04.2529060Z ) 2025-12-04T08:40:04.2529631Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:04.2530447Z sys.exit() 2025-12-04T08:40:04.2530736Z 2025-12-04T08:40:04.2530908Z try: 2025-12-04T08:40:04.2531357Z rollout_state = get_rollout_state_from_issue( 2025-12-04T08:40:04.2532095Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T08:40:04.2532754Z ) 2025-12-04T08:40:04.2532982Z 2025-12-04T08:40:04.2533196Z username = get_potential_pr_author( 2025-12-04T08:40:04.2533767Z args.github_token, 2025-12-04T08:40:04.2534278Z args.github_repo, 2025-12-04T08:40:04.2534780Z args.github_actor, 2025-12-04T08:40:04.2535296Z args.github_ref_type, 2025-12-04T08:40:04.2535827Z args.github_branch, 2025-12-04T08:40:04.2536319Z ) 2025-12-04T08:40:04.2536539Z 2025-12-04T08:40:04.2536832Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T08:40:04.2537311Z 2025-12-04T08:40:04.2537535Z runner_label_prefix = get_runner_prefix( 2025-12-04T08:40:04.2538125Z rollout_state, 2025-12-04T08:40:04.2538635Z (args.github_issue_owner, username), 2025-12-04T08:40:04.2539214Z args.github_branch, 2025-12-04T08:40:04.2539733Z args.eligible_experiments, 2025-12-04T08:40:04.2540403Z args.opt_out_experiments, 2025-12-04T08:40:04.2540946Z is_canary, 2025-12-04T08:40:04.2541378Z ) 2025-12-04T08:40:04.2541601Z 2025-12-04T08:40:04.2541798Z except Exception as e: 2025-12-04T08:40:04.2542278Z log.error( 2025-12-04T08:40:04.2542967Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T08:40:04.2543900Z ) 2025-12-04T08:40:04.2544128Z 2025-12-04T08:40:04.2544459Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T08:40:04.2544983Z 2025-12-04T08:40:04.2544990Z 2025-12-04T08:40:04.2545179Z if __name__ == "__main__": 2025-12-04T08:40:04.2545644Z main() 2025-12-04T08:40:04.2545873Z 2025-12-04T08:40:04.2635153Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:40:04.2636049Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T08:40:04.2669123Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:04.2669594Z env: 2025-12-04T08:40:04.2670428Z GITHUB_TOKEN: *** 2025-12-04T08:40:04.2670905Z ISSUE_NUMBER: 5132 2025-12-04T08:40:04.2671354Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:04.2671864Z ISSUE_OWNER: 2025-12-04T08:40:04.2672270Z CHECK_EXPERIMENTS: 2025-12-04T08:40:04.2672699Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:40:04.2673140Z PR_NUMBER: 2025-12-04T08:40:04.2673523Z ##[endgroup] 2025-12-04T08:40:05.3345498Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T08:40:06.0141617Z Collecting urllib3==1.26.18 2025-12-04T08:40:06.0772948Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T08:40:06.1042125Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.8 MB/s eta 0:00:00 2025-12-04T08:40:06.1244212Z Collecting PyGithub==2.3.0 2025-12-04T08:40:06.1378020Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T08:40:06.1844577Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T08:40:06.1977564Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T08:40:06.2020635Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T08:40:06.2036971Z 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-12-04T08:40:06.2052204Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T08:40:06.2296795Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T08:40:06.2429161Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T08:40:06.2653822Z 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-12-04T08:40:06.3890099Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:06.4026561Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T08:40:06.5673316Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T08:40:06.5809072Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T08:40:06.6014807Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T08:40:06.6154098Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T08:40:06.6559301Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T08:40:06.6727942Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.2 MB/s eta 0:00:00 2025-12-04T08:40:06.6866754Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T08:40:06.7077325Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 18.2 MB/s eta 0:00:00 2025-12-04T08:40:06.7216795Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T08:40:06.7437672Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 68.7 MB/s eta 0:00:00 2025-12-04T08:40:06.7569718Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T08:40:06.7752376Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T08:40:06.7808718Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 54.4 MB/s eta 0:00:00 2025-12-04T08:40:06.7943068Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T08:40:06.7985895Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 44.3 MB/s eta 0:00:00 2025-12-04T08:40:06.8117850Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T08:40:06.8158972Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 44.0 MB/s eta 0:00:00 2025-12-04T08:40:07.1115335Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T08:40:07.6542992Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T08:40:07.7414116Z ##[group]Run curr_branch="main" 2025-12-04T08:40:07.7414419Z curr_branch="main" 2025-12-04T08:40:07.7414634Z curr_ref_type="branch" 2025-12-04T08:40:07.7414882Z echo "Current branch is '$curr_branch'" 2025-12-04T08:40:07.7415162Z  2025-12-04T08:40:07.7415339Z python3 runner_determinator.py \ 2025-12-04T08:40:07.7415622Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T08:40:07.7415898Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T08:40:07.7416159Z  --github-branch "$curr_branch" \ 2025-12-04T08:40:07.7416427Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T08:40:07.7416700Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T08:40:07.7416975Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T08:40:07.7417237Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T08:40:07.7417531Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T08:40:07.7417887Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T08:40:07.7418185Z  --pr-number "${PR_NUMBER}" 2025-12-04T08:40:07.7452484Z shell: /usr/bin/bash -e {0} 2025-12-04T08:40:07.7452707Z env: 2025-12-04T08:40:07.7453286Z GITHUB_TOKEN: *** 2025-12-04T08:40:07.7453473Z ISSUE_NUMBER: 5132 2025-12-04T08:40:07.7453677Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T08:40:07.7453905Z ISSUE_OWNER: 2025-12-04T08:40:07.7454087Z CHECK_EXPERIMENTS: 2025-12-04T08:40:07.7454276Z OPT_OUT_EXPERIMENTS: 2025-12-04T08:40:07.7454461Z PR_NUMBER: 2025-12-04T08:40:07.7454620Z ##[endgroup] 2025-12-04T08:40:07.7507455Z Current branch is 'main' 2025-12-04T08:40:09.1722624Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T08:40:09.1723559Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T08:40:09.1724300Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T08:40:09.1725089Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T08:40:09.1725654Z INFO : Setting output: label-type='lf.' 2025-12-04T08:40:09.2055037Z Evaluate and set job outputs 2025-12-04T08:40:09.2061361Z Set output 'label-type' 2025-12-04T08:40:09.2063165Z Cleaning up orphan processes