2025-10-10T00:01:08.8423500Z Current runner version: '2.328.0' 2025-10-10T00:01:08.8445616Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.8446432Z Hosted Compute Agent 2025-10-10T00:01:08.8446952Z Version: 20250912.392 2025-10-10T00:01:08.8447602Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.8448321Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.8448888Z ##[endgroup] 2025-10-10T00:01:08.8449491Z ##[group]Operating System 2025-10-10T00:01:08.8450041Z Ubuntu 2025-10-10T00:01:08.8450529Z 24.04.3 2025-10-10T00:01:08.8450943Z LTS 2025-10-10T00:01:08.8451471Z ##[endgroup] 2025-10-10T00:01:08.8451936Z ##[group]Runner Image 2025-10-10T00:01:08.8452506Z Image: ubuntu-24.04 2025-10-10T00:01:08.8453079Z Version: 20250929.60.1 2025-10-10T00:01:08.8454488Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.8456160Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.8457167Z ##[endgroup] 2025-10-10T00:01:08.8458588Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.8460701Z Contents: read 2025-10-10T00:01:08.8461217Z Metadata: read 2025-10-10T00:01:08.8461791Z ##[endgroup] 2025-10-10T00:01:08.8464456Z Secret source: Actions 2025-10-10T00:01:08.8465366Z Prepare workflow directory 2025-10-10T00:01:08.8971261Z Prepare all required actions 2025-10-10T00:01:08.9026564Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.9031333Z ##[group] Inputs 2025-10-10T00:01:08.9031921Z check_experiments: 2025-10-10T00:01:08.9032584Z opt_out_experiments: 2025-10-10T00:01:08.9033150Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.9033967Z issue_owner: 2025-10-10T00:01:08.9034502Z curr_branch: main 2025-10-10T00:01:08.9035065Z curr_ref_type: branch 2025-10-10T00:01:08.9035762Z issue_number: 5132 2025-10-10T00:01:08.9036311Z ##[endgroup] 2025-10-10T00:01:08.9037041Z Complete job name: before-test / get-label-type / runner-determinator 2025-10-10T00:01:09.5799215Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:09.5801588Z cat < runner_determinator.py 2025-10-10T00:01:09.5802297Z # flake8: noqa: G004 2025-10-10T00:01:09.5802877Z  2025-10-10T00:01:09.5803895Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.5805010Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.5806069Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.5806917Z  2025-10-10T00:01:09.5807367Z """ 2025-10-10T00:01:09.5808149Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.5809201Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.5810444Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.5811548Z of which runners should be used to run which job. 2025-10-10T00:01:09.5812264Z  2025-10-10T00:01:09.5812972Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.5814456Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.5815571Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.5816407Z list, defined. 2025-10-10T00:01:09.5817047Z  2025-10-10T00:01:09.5817738Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.5818850Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.5819920Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.5820641Z  2025-10-10T00:01:09.5821651Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.5822724Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.5823815Z experiments which the user could be opted in to. 2025-10-10T00:01:09.5824559Z  2025-10-10T00:01:09.5825116Z The user list has the following rules: 2025-10-10T00:01:09.5825791Z  2025-10-10T00:01:09.5826482Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.5903176Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.5904379Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.5905024Z  2025-10-10T00:01:09.5905436Z Example config: 2025-10-10T00:01:09.5905998Z  # A list of experiments that can be opted into. 2025-10-10T00:01:09.5906762Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.5907498Z  # Expected syntax is: 2025-10-10T00:01:09.5908260Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.5909397Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.5910243Z  2025-10-10T00:01:09.5910649Z  experiments: 2025-10-10T00:01:09.5911110Z  lf: 2025-10-10T00:01:09.5911554Z  rollout_percent: 25 2025-10-10T00:01:09.5912098Z  all_branches: false 2025-10-10T00:01:09.5912622Z  default: true 2025-10-10T00:01:09.5913108Z  --- 2025-10-10T00:01:09.5913514Z  2025-10-10T00:01:09.5914168Z  # Opt-ins: 2025-10-10T00:01:09.5914887Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.5916100Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.5917006Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.5917767Z  # Experiments should be from the above list. 2025-10-10T00:01:09.5918371Z  2025-10-10T00:01:09.5918789Z  @User1,-lf,split_build 2025-10-10T00:01:09.5919322Z  @User2,lf 2025-10-10T00:01:09.5919790Z  @User3,split_build 2025-10-10T00:01:09.5920288Z """ 2025-10-10T00:01:09.5920681Z  2025-10-10T00:01:09.5921080Z import json 2025-10-10T00:01:09.5921522Z import logging 2025-10-10T00:01:09.5921987Z import os 2025-10-10T00:01:09.5922424Z import random 2025-10-10T00:01:09.5922876Z import re 2025-10-10T00:01:09.5923304Z import sys 2025-10-10T00:01:09.5923914Z from argparse import ArgumentParser 2025-10-10T00:01:09.5924605Z from collections.abc import Iterable 2025-10-10T00:01:09.5925221Z from functools import cache 2025-10-10T00:01:09.5925776Z from logging import LogRecord 2025-10-10T00:01:09.5926360Z from typing import Any, NamedTuple 2025-10-10T00:01:09.5926994Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.5927602Z  2025-10-10T00:01:09.5928001Z import yaml 2025-10-10T00:01:09.5928488Z from github import Auth, Github 2025-10-10T00:01:09.5929075Z from github.Issue import Issue 2025-10-10T00:01:09.5929617Z  2025-10-10T00:01:09.5930009Z  2025-10-10T00:01:09.5930485Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.5931289Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.5932285Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.5933076Z  2025-10-10T00:01:09.5933847Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.5934522Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.5935137Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.5935819Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.5936407Z  2025-10-10T00:01:09.5936858Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.5937421Z  2025-10-10T00:01:09.5937839Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.5938387Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.5938900Z  2025-10-10T00:01:09.5939275Z  2025-10-10T00:01:09.5939702Z class Experiment(NamedTuple): 2025-10-10T00:01:09.5940274Z  rollout_perc: float = ( 2025-10-10T00:01:09.5941039Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.5941809Z  ) 2025-10-10T00:01:09.5942254Z  all_branches: bool = ( 2025-10-10T00:01:09.5943003Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.5943866Z  ) 2025-10-10T00:01:09.5944293Z  default: bool = ( 2025-10-10T00:01:09.5944984Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.5945709Z  ) 2025-10-10T00:01:09.5946117Z  2025-10-10T00:01:09.5946534Z  # Add more fields as needed 2025-10-10T00:01:09.5947068Z  2025-10-10T00:01:09.5947448Z  2025-10-10T00:01:09.5947861Z class Settings(NamedTuple): 2025-10-10T00:01:09.5948394Z  """ 2025-10-10T00:01:09.5948947Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:09.5949602Z  """ 2025-10-10T00:01:09.5950005Z  2025-10-10T00:01:09.5950455Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.5951049Z  2025-10-10T00:01:09.5951552Z  2025-10-10T00:01:09.5952028Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.5952755Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.5953406Z  2025-10-10T00:01:09.5954063Z  COLORS = { 2025-10-10T00:01:09.5954567Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.5955158Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.5955731Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.5956315Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.5956884Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.5957421Z  } 2025-10-10T00:01:09.5957819Z  2025-10-10T00:01:09.5958289Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.5959132Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.5960015Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.5960678Z  return super().format(record) 2025-10-10T00:01:09.5961233Z  2025-10-10T00:01:09.5961620Z  2025-10-10T00:01:09.5962054Z handler = logging.StreamHandler() 2025-10-10T00:01:09.5962882Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.5963778Z  2025-10-10T00:01:09.5964297Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.5964955Z log.addHandler(handler) 2025-10-10T00:01:09.5965482Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.5966004Z  2025-10-10T00:01:09.5966385Z  2025-10-10T00:01:09.5966906Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.5967545Z  """ 2025-10-10T00:01:09.5968155Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.5969007Z  """ 2025-10-10T00:01:09.5969451Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:09.5970661Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.5971895Z  log.warning( 2025-10-10T00:01:09.5972889Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.5974016Z  ) 2025-10-10T00:01:09.5974528Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.5975149Z  return 2025-10-10T00:01:09.5975593Z  2025-10-10T00:01:09.5976033Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.5976699Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.5977350Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:09.5977901Z  2025-10-10T00:01:09.5978287Z  2025-10-10T00:01:09.5978861Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.5979600Z  return frozenset( 2025-10-10T00:01:09.5980336Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.5981094Z  ) 2025-10-10T00:01:09.5981513Z  2025-10-10T00:01:09.5981895Z  2025-10-10T00:01:09.5982314Z def parse_args() -> Any: 2025-10-10T00:01:09.5983002Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.5984128Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.5985003Z  parser.add_argument( 2025-10-10T00:01:09.5985562Z  "--github-issue-repo", 2025-10-10T00:01:09.5986134Z  type=str, 2025-10-10T00:01:09.5986640Z  required=False, 2025-10-10T00:01:09.5987331Z  default="pytorch/test-infra", 2025-10-10T00:01:09.5987975Z  help="GitHub repo to get the issue", 2025-10-10T00:01:09.5988558Z  ) 2025-10-10T00:01:09.5988999Z  parser.add_argument( 2025-10-10T00:01:09.5989534Z  "--github-repo", 2025-10-10T00:01:09.5990058Z  type=str, 2025-10-10T00:01:09.5990550Z  required=True, 2025-10-10T00:01:09.5991123Z  help="GitHub repo where CI is running", 2025-10-10T00:01:09.5991713Z  ) 2025-10-10T00:01:09.5992161Z  parser.add_argument( 2025-10-10T00:01:09.5992899Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.5993800Z  ) 2025-10-10T00:01:09.5994249Z  parser.add_argument( 2025-10-10T00:01:09.5994995Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.5995777Z  ) 2025-10-10T00:01:09.5996211Z  parser.add_argument( 2025-10-10T00:01:09.5996979Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.5997762Z  ) 2025-10-10T00:01:09.5998205Z  parser.add_argument( 2025-10-10T00:01:09.5998989Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.5999787Z  ) 2025-10-10T00:01:09.6000252Z  parser.add_argument( 2025-10-10T00:01:09.6000794Z  "--github-ref-type", 2025-10-10T00:01:09.6001343Z  type=str, 2025-10-10T00:01:09.6001846Z  required=True, 2025-10-10T00:01:09.6002465Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.6003091Z  ) 2025-10-10T00:01:09.6003626Z  parser.add_argument( 2025-10-10T00:01:09.6004340Z  "--eligible-experiments", 2025-10-10T00:01:09.6004962Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.6005551Z  required=False, 2025-10-10T00:01:09.6006073Z  default="", 2025-10-10T00:01:09.6007055Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.6008085Z  ) 2025-10-10T00:01:09.6008523Z  parser.add_argument( 2025-10-10T00:01:09.6009085Z  "--opt-out-experiments", 2025-10-10T00:01:09.6009724Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.6010315Z  required=False, 2025-10-10T00:01:09.6010834Z  default="", 2025-10-10T00:01:09.6011319Z  help=( 2025-10-10T00:01:09.6012109Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.6013379Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.6014410Z  ), 2025-10-10T00:01:09.6014853Z  ) 2025-10-10T00:01:09.6015290Z  parser.add_argument( 2025-10-10T00:01:09.6015841Z  "--pr-number", 2025-10-10T00:01:09.6016360Z  type=str, 2025-10-10T00:01:09.6016862Z  required=False, 2025-10-10T00:01:09.6017392Z  default="", 2025-10-10T00:01:09.6017983Z  help="the optional PR number where this is run", 2025-10-10T00:01:09.6018613Z  ) 2025-10-10T00:01:09.6019038Z  2025-10-10T00:01:09.6019473Z  return parser.parse_args() 2025-10-10T00:01:09.6020017Z  2025-10-10T00:01:09.6020404Z  2025-10-10T00:01:09.6021075Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.6022059Z  auth = Auth.Token(github_token) 2025-10-10T00:01:09.6022688Z  return Github(auth=auth) 2025-10-10T00:01:09.6023228Z  2025-10-10T00:01:09.6023760Z  2025-10-10T00:01:09.6024507Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.6025422Z  repo = gh.get_repo(repo) 2025-10-10T00:01:09.6026035Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.6026636Z  2025-10-10T00:01:09.6027033Z  2025-10-10T00:01:09.6027453Z def get_potential_pr_author( 2025-10-10T00:01:09.6028227Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.6029008Z ) -> str: 2025-10-10T00:01:09.6029638Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.6030568Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.6031455Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:09.6032116Z  2025-10-10T00:01:09.6032557Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.6033124Z  2025-10-10T00:01:09.6034117Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.6034868Z  split_tag = ref_name.split("/") 2025-10-10T00:01:09.6035446Z  if ( 2025-10-10T00:01:09.6035917Z  len(split_tag) == 3 2025-10-10T00:01:09.6036508Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:09.6037125Z  and split_tag[2].isnumeric() 2025-10-10T00:01:09.6037708Z  ): 2025-10-10T00:01:09.6038178Z  pr_number = split_tag[2] 2025-10-10T00:01:09.6038750Z  try: 2025-10-10T00:01:09.6039272Z  repository = gh.get_repo(repo) 2025-10-10T00:01:09.6040150Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.6040857Z  except Exception as e: 2025-10-10T00:01:09.6041492Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:09.6042266Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.6042997Z  ) from e 2025-10-10T00:01:09.6043804Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.6044618Z  # In all other cases, return the original input username 2025-10-10T00:01:09.6045297Z  return username 2025-10-10T00:01:09.6045790Z  2025-10-10T00:01:09.6046178Z  2025-10-10T00:01:09.6046663Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.6047277Z  """ 2025-10-10T00:01:09.6048038Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.6048916Z  """ 2025-10-10T00:01:09.6049558Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.6050318Z  2025-10-10T00:01:09.6050707Z  2025-10-10T00:01:09.6051150Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.6051730Z  try: 2025-10-10T00:01:09.6052201Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.6052779Z  return data 2025-10-10T00:01:09.6053299Z  except yaml.YAMLError: 2025-10-10T00:01:09.6053984Z  log.exception("Error loading YAML") 2025-10-10T00:01:09.6054575Z  raise 2025-10-10T00:01:09.6055018Z  2025-10-10T00:01:09.6055399Z  2025-10-10T00:01:09.6056090Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.6056922Z  """ 2025-10-10T00:01:09.6057779Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.6058628Z  2025-10-10T00:01:09.6059246Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.6060131Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.6060763Z  2025-10-10T00:01:09.6061410Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.6062202Z  """ 2025-10-10T00:01:09.6062733Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.6063409Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.6064478Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.6065160Z  else: 2025-10-10T00:01:09.6065621Z  return "", rollout_state 2025-10-10T00:01:09.6066171Z  2025-10-10T00:01:09.6066553Z  2025-10-10T00:01:09.6067011Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.6067597Z  """ 2025-10-10T00:01:09.6068218Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.6068942Z  """ 2025-10-10T00:01:09.6069352Z  2025-10-10T00:01:09.6069727Z  2025-10-10T00:01:09.6070329Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.6071081Z  """ 2025-10-10T00:01:09.6071900Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.6072825Z  2025-10-10T00:01:09.6073835Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.6074964Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.6075891Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.6076604Z  2025-10-10T00:01:09.6076990Z  2025-10-10T00:01:09.6077371Z  """ 2025-10-10T00:01:09.6077811Z  optins = UserOptins() 2025-10-10T00:01:09.6078408Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.6079052Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:09.6079707Z  if not user or not user.startswith("@"): 2025-10-10T00:01:09.6080345Z  # Not a valid user. Skip 2025-10-10T00:01:09.6080949Z  continue 2025-10-10T00:01:09.6081424Z  2025-10-10T00:01:09.6081826Z  if user: 2025-10-10T00:01:09.6082356Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.6083143Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.6083978Z  2025-10-10T00:01:09.6084379Z  return optins 2025-10-10T00:01:09.6084856Z  2025-10-10T00:01:09.6085238Z  2025-10-10T00:01:09.6085800Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.6086487Z  """ 2025-10-10T00:01:09.6086969Z  Check if the experiment name is valid. 2025-10-10T00:01:09.6087564Z  A valid name: 2025-10-10T00:01:09.6088320Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.6089379Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.6090171Z  - Cannot contain spaces 2025-10-10T00:01:09.6090719Z  """ 2025-10-10T00:01:09.6091121Z  2025-10-10T00:01:09.6091634Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.6092583Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.6093515Z  2025-10-10T00:01:09.6094027Z  if valid: 2025-10-10T00:01:09.6094484Z  return True 2025-10-10T00:01:09.6094956Z  2025-10-10T00:01:09.6095349Z  log.error( 2025-10-10T00:01:09.6096979Z  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-10-10T00:01:09.6098683Z  ) 2025-10-10T00:01:09.6099112Z  return False 2025-10-10T00:01:09.6099569Z  2025-10-10T00:01:09.6099942Z  2025-10-10T00:01:09.6100516Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.6101238Z  """ 2025-10-10T00:01:09.6101921Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.6102725Z  """ 2025-10-10T00:01:09.6103140Z  try: 2025-10-10T00:01:09.6103662Z  if settings_text: 2025-10-10T00:01:09.6104507Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.6105420Z  # for easy reading 2025-10-10T00:01:09.6106334Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.6107326Z  # the backtick character in shell commands. 2025-10-10T00:01:09.6108022Z  backtick = chr(96) # backtick character 2025-10-10T00:01:09.6108794Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.6109574Z  settings = load_yaml(settings_text) 2025-10-10T00:01:09.6110159Z  2025-10-10T00:01:09.6110827Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.6111791Z  experiments = {} 2025-10-10T00:01:09.6112311Z  2025-10-10T00:01:09.6112939Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.6113897Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.6115128Z  # 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-10-10T00:01:09.6116285Z  continue 2025-10-10T00:01:09.6116802Z  2025-10-10T00:01:09.6117215Z  valid_settings = {} 2025-10-10T00:01:09.6117829Z  for setting in exp_settings: 2025-10-10T00:01:09.6118481Z  if setting not in Experiment._fields: 2025-10-10T00:01:09.6119122Z  log.warning( 2025-10-10T00:01:09.6119943Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.6120727Z  ) 2025-10-10T00:01:09.6121242Z  else: 2025-10-10T00:01:09.6121857Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.6122499Z  2025-10-10T00:01:09.6123030Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.6123847Z  return Settings(experiments) 2025-10-10T00:01:09.6124420Z  2025-10-10T00:01:09.6124822Z  except Exception: 2025-10-10T00:01:09.6125405Z  log.exception("Failed to parse settings") 2025-10-10T00:01:09.6126009Z  2025-10-10T00:01:09.6126420Z  return Settings() 2025-10-10T00:01:09.6126908Z  2025-10-10T00:01:09.6127291Z  2025-10-10T00:01:09.6127932Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.6128585Z  """ 2025-10-10T00:01:09.6129095Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.6129717Z  2025-10-10T00:01:09.6130320Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.6131186Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.6131803Z  2025-10-10T00:01:09.6132463Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.6133275Z  """ 2025-10-10T00:01:09.6134029Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.6134888Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.6135502Z  2025-10-10T00:01:09.6135877Z  2025-10-10T00:01:09.6136397Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.6137037Z  """ 2025-10-10T00:01:09.6137506Z  Parse users from the rollout state. 2025-10-10T00:01:09.6138082Z  2025-10-10T00:01:09.6138460Z  """ 2025-10-10T00:01:09.6139093Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.6139933Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.6140548Z  2025-10-10T00:01:09.6140935Z  2025-10-10T00:01:09.6141628Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.6142460Z  """ 2025-10-10T00:01:09.6142960Z  Check if a user is opted into an experiment 2025-10-10T00:01:09.6143656Z  """ 2025-10-10T00:01:09.6144205Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.6144851Z  2025-10-10T00:01:09.6145355Z  2025-10-10T00:01:09.6146067Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.6146917Z  """ 2025-10-10T00:01:09.6147450Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.6148097Z  """ 2025-10-10T00:01:09.6148683Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.6149479Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.6150206Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.6150883Z  return False 2025-10-10T00:01:09.6151358Z  2025-10-10T00:01:09.6151874Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.6152546Z  log.warning( 2025-10-10T00:01:09.6153475Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.6154562Z  ) 2025-10-10T00:01:09.6154986Z  2025-10-10T00:01:09.6155395Z  return True 2025-10-10T00:01:09.6155854Z  2025-10-10T00:01:09.6156233Z  2025-10-10T00:01:09.6156644Z def get_runner_prefix( 2025-10-10T00:01:09.6157155Z  rollout_state: str, 2025-10-10T00:01:09.6157717Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:09.6158293Z  branch: str, 2025-10-10T00:01:09.6158891Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.6159663Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.6160327Z  is_canary: bool = False, 2025-10-10T00:01:09.6160862Z ) -> str: 2025-10-10T00:01:09.6161372Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:09.6162034Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.6162619Z  2025-10-10T00:01:09.6163155Z  fleet_prefix = "" 2025-10-10T00:01:09.6163755Z  prefixes = [] 2025-10-10T00:01:09.6164493Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.6165551Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.6166343Z  log.info( 2025-10-10T00:01:09.6167143Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.6167976Z  ) 2025-10-10T00:01:09.6168442Z  continue 2025-10-10T00:01:09.6168909Z  2025-10-10T00:01:09.6169335Z  if opt_out_experiments: 2025-10-10T00:01:09.6169969Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.6170707Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.6171409Z  log.info( 2025-10-10T00:01:09.6172453Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.6173627Z  ) 2025-10-10T00:01:09.6174104Z  continue 2025-10-10T00:01:09.6174599Z  2025-10-10T00:01:09.6175017Z  if eligible_experiments: 2025-10-10T00:01:09.6175669Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.6176390Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.6176995Z  log.info( 2025-10-10T00:01:09.6177877Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.6178791Z  ) 2025-10-10T00:01:09.6179405Z  continue 2025-10-10T00:01:09.6179994Z  elif not experiment_settings.default: 2025-10-10T00:01:09.6180595Z  log.info( 2025-10-10T00:01:09.6181370Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.6182184Z  ) 2025-10-10T00:01:09.6182653Z  continue 2025-10-10T00:01:09.6183132Z  2025-10-10T00:01:09.6183759Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.6184455Z  opted_out_users = [ 2025-10-10T00:01:09.6184981Z  requestor 2025-10-10T00:01:09.6185539Z  for requestor in workflow_requestors 2025-10-10T00:01:09.6186294Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.6186993Z  ] 2025-10-10T00:01:09.6187405Z  2025-10-10T00:01:09.6187820Z  if opted_out_users: 2025-10-10T00:01:09.6188381Z  log.info( 2025-10-10T00:01:09.6189356Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.6190155Z  ) 2025-10-10T00:01:09.6190611Z  continue 2025-10-10T00:01:09.6191089Z  2025-10-10T00:01:09.6191602Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.6192290Z  opted_in_users = [ 2025-10-10T00:01:09.6192834Z  requestor 2025-10-10T00:01:09.6193386Z  for requestor in workflow_requestors 2025-10-10T00:01:09.6194389Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.6195083Z  ] 2025-10-10T00:01:09.6195505Z  2025-10-10T00:01:09.6195914Z  enabled = False 2025-10-10T00:01:09.6196458Z  if opted_in_users: 2025-10-10T00:01:09.6197128Z  log.info( 2025-10-10T00:01:09.6197863Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.6198620Z  ) 2025-10-10T00:01:09.6199084Z  enabled = True 2025-10-10T00:01:09.6199593Z  2025-10-10T00:01:09.6200060Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.6200985Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.6202032Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.6202763Z  log.info( 2025-10-10T00:01:09.6203859Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.6204874Z  ) 2025-10-10T00:01:09.6205381Z  enabled = True 2025-10-10T00:01:09.6205905Z  2025-10-10T00:01:09.6206300Z  if enabled: 2025-10-10T00:01:09.6206820Z  label = experiment_name 2025-10-10T00:01:09.6207459Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.6208376Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.6209362Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.6210214Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.6210952Z  if is_canary: 2025-10-10T00:01:09.6211532Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.6212166Z  fleet_prefix = label 2025-10-10T00:01:09.6212727Z  else: 2025-10-10T00:01:09.6213385Z  prefixes.append(label) 2025-10-10T00:01:09.6214105Z  2025-10-10T00:01:09.6214518Z  if len(prefixes) > 1: 2025-10-10T00:01:09.6215042Z  log.error( 2025-10-10T00:01:09.6216219Z  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-10-10T00:01:09.6217448Z  ) 2025-10-10T00:01:09.6217905Z  prefixes = prefixes[:1] 2025-10-10T00:01:09.6218452Z  2025-10-10T00:01:09.6218859Z  # Fleet always comes first 2025-10-10T00:01:09.6219414Z  if fleet_prefix: 2025-10-10T00:01:09.6219965Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.6220532Z  2025-10-10T00:01:09.6221040Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.6221670Z  2025-10-10T00:01:09.6222058Z  2025-10-10T00:01:09.6222767Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.6223718Z  """ 2025-10-10T00:01:09.6224393Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.6225176Z  2025-10-10T00:01:09.6225816Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.6226592Z  """ 2025-10-10T00:01:09.6227055Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.6227687Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.6228418Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.6229079Z  2025-10-10T00:01:09.6229457Z  2025-10-10T00:01:09.6230125Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.6231100Z  for _ in range(num_retries): 2025-10-10T00:01:09.6231649Z  try: 2025-10-10T00:01:09.6232159Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:09.6232900Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.6233725Z  return json.loads(content) 2025-10-10T00:01:09.6234337Z  except Exception as e: 2025-10-10T00:01:09.6234980Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.6235594Z  2025-10-10T00:01:09.6236243Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.6237037Z  return {} 2025-10-10T00:01:09.6237481Z  2025-10-10T00:01:09.6237866Z  2025-10-10T00:01:09.6238250Z @cache 2025-10-10T00:01:09.6238971Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.6239827Z  """ 2025-10-10T00:01:09.6240285Z  Dynamically get PR information 2025-10-10T00:01:09.6240840Z  """ 2025-10-10T00:01:09.6241431Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.6242126Z  headers = { 2025-10-10T00:01:09.6242675Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.6243360Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:09.6244059Z  } 2025-10-10T00:01:09.6244566Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.6245247Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.6245855Z  headers=headers, 2025-10-10T00:01:09.6246353Z  ) 2025-10-10T00:01:09.6246759Z  2025-10-10T00:01:09.6247166Z  if not json_response: 2025-10-10T00:01:09.6247848Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.6248691Z  return {} 2025-10-10T00:01:09.6249163Z  2025-10-10T00:01:09.6249574Z  return json_response 2025-10-10T00:01:09.6250071Z  2025-10-10T00:01:09.6250450Z  2025-10-10T00:01:09.6251101Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.6251905Z  """ 2025-10-10T00:01:09.6252516Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.6253233Z  """ 2025-10-10T00:01:09.6253905Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.6254581Z  return { 2025-10-10T00:01:09.6255255Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.6256013Z  } 2025-10-10T00:01:09.6256424Z  2025-10-10T00:01:09.6256815Z  2025-10-10T00:01:09.6257221Z def main() -> None: 2025-10-10T00:01:09.6257720Z  args = parse_args() 2025-10-10T00:01:09.6258224Z  2025-10-10T00:01:09.6258712Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.6259311Z  2025-10-10T00:01:09.6259732Z  # Check if the PR is opt-out 2025-10-10T00:01:09.6260294Z  if args.pr_number: 2025-10-10T00:01:09.6261071Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.6261900Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.6262479Z  log.info( 2025-10-10T00:01:09.6263281Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.6264214Z  ) 2025-10-10T00:01:09.6264870Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.6265639Z  sys.exit() 2025-10-10T00:01:09.6266269Z  2025-10-10T00:01:09.6266669Z  try: 2025-10-10T00:01:09.6267188Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.6268000Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.6268737Z  ) 2025-10-10T00:01:09.6269166Z  2025-10-10T00:01:09.6269608Z  username = get_potential_pr_author( 2025-10-10T00:01:09.6270225Z  args.github_token, 2025-10-10T00:01:09.6270787Z  args.github_repo, 2025-10-10T00:01:09.6271347Z  args.github_actor, 2025-10-10T00:01:09.6271925Z  args.github_ref_type, 2025-10-10T00:01:09.6272507Z  args.github_branch, 2025-10-10T00:01:09.6273055Z  ) 2025-10-10T00:01:09.6273487Z  2025-10-10T00:01:09.6274137Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.6274817Z  2025-10-10T00:01:09.6275281Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.6275898Z  rollout_state, 2025-10-10T00:01:09.6276487Z  (args.github_issue_owner, username), 2025-10-10T00:01:09.6277102Z  args.github_branch, 2025-10-10T00:01:09.6277697Z  args.eligible_experiments, 2025-10-10T00:01:09.6278313Z  args.opt_out_experiments, 2025-10-10T00:01:09.6278890Z  is_canary, 2025-10-10T00:01:09.6279390Z  ) 2025-10-10T00:01:09.6279808Z  2025-10-10T00:01:09.6280225Z  except Exception as e: 2025-10-10T00:01:09.6280764Z  log.error( 2025-10-10T00:01:09.6281558Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.6282528Z  ) 2025-10-10T00:01:09.6282956Z  2025-10-10T00:01:09.6283652Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.6284378Z  2025-10-10T00:01:09.6284763Z  2025-10-10T00:01:09.6285170Z if __name__ == "__main__": 2025-10-10T00:01:09.6285694Z  main() 2025-10-10T00:01:09.6286125Z  2025-10-10T00:01:09.6286506Z EOF 2025-10-10T00:01:09.6286900Z  2025-10-10T00:01:09.6287311Z cat runner_determinator.py 2025-10-10T00:01:10.0889435Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:10.0890633Z env: 2025-10-10T00:01:10.0891559Z GITHUB_TOKEN: *** 2025-10-10T00:01:10.0892033Z ISSUE_NUMBER: 5132 2025-10-10T00:01:10.0892538Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:10.0893128Z ISSUE_OWNER: 2025-10-10T00:01:10.0893881Z CHECK_EXPERIMENTS: 2025-10-10T00:01:10.0894456Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:10.0894947Z PR_NUMBER: 2025-10-10T00:01:10.0895420Z ##[endgroup] 2025-10-10T00:01:10.1100253Z # flake8: noqa: G004 2025-10-10T00:01:10.1100612Z 2025-10-10T00:01:10.1101061Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:10.1102023Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:10.1102852Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:10.1103312Z 2025-10-10T00:01:10.1103491Z """ 2025-10-10T00:01:10.1104421Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:10.1105326Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:10.1106248Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:10.1107106Z of which runners should be used to run which job. 2025-10-10T00:01:10.1107559Z 2025-10-10T00:01:10.1107956Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:10.1109066Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:10.1109988Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:10.1110702Z list, defined. 2025-10-10T00:01:10.1110940Z 2025-10-10T00:01:10.1111318Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:10.1112265Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:10.1113110Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:10.1113743Z 2025-10-10T00:01:10.1114151Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:10.1115021Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:10.1115780Z experiments which the user could be opted in to. 2025-10-10T00:01:10.1116191Z 2025-10-10T00:01:10.1116400Z The user list has the following rules: 2025-10-10T00:01:10.1116760Z 2025-10-10T00:01:10.1117094Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:10.1117964Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:10.1118741Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:10.1119133Z 2025-10-10T00:01:10.1119314Z Example config: 2025-10-10T00:01:10.1119783Z # A list of experiments that can be opted into. 2025-10-10T00:01:10.1120460Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:10.1121096Z # Expected syntax is: 2025-10-10T00:01:10.1121756Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:10.1122753Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:10.1123382Z 2025-10-10T00:01:10.1123716Z experiments: 2025-10-10T00:01:10.1124144Z lf: 2025-10-10T00:01:10.1124535Z rollout_percent: 25 2025-10-10T00:01:10.1125174Z all_branches: false 2025-10-10T00:01:10.1125630Z default: true 2025-10-10T00:01:10.1126052Z --- 2025-10-10T00:01:10.1126260Z 2025-10-10T00:01:10.1126434Z # Opt-ins: 2025-10-10T00:01:10.1127028Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:10.1127913Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:10.1128701Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:10.1129370Z # Experiments should be from the above list. 2025-10-10T00:01:10.1129748Z 2025-10-10T00:01:10.1129938Z @User1,-lf,split_build 2025-10-10T00:01:10.1130394Z @User2,lf 2025-10-10T00:01:10.1130783Z @User3,split_build 2025-10-10T00:01:10.1131210Z """ 2025-10-10T00:01:10.1131408Z 2025-10-10T00:01:10.1131581Z import json 2025-10-10T00:01:10.1131970Z import logging 2025-10-10T00:01:10.1132367Z import os 2025-10-10T00:01:10.1132746Z import random 2025-10-10T00:01:10.1133138Z import re 2025-10-10T00:01:10.1133948Z import sys 2025-10-10T00:01:10.1134410Z from argparse import ArgumentParser 2025-10-10T00:01:10.1134964Z from collections.abc import Iterable 2025-10-10T00:01:10.1135534Z from functools import cache 2025-10-10T00:01:10.1136022Z from logging import LogRecord 2025-10-10T00:01:10.1136537Z from typing import Any, NamedTuple 2025-10-10T00:01:10.1137085Z from urllib.request import Request, urlopen 2025-10-10T00:01:10.1137470Z 2025-10-10T00:01:10.1137642Z import yaml 2025-10-10T00:01:10.1138048Z from github import Auth, Github 2025-10-10T00:01:10.1138550Z from github.Issue import Issue 2025-10-10T00:01:10.1138862Z 2025-10-10T00:01:10.1138870Z 2025-10-10T00:01:10.1139103Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:10.1139805Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:10.1140688Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:10.1141250Z 2025-10-10T00:01:10.1141495Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:10.1142220Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:10.1142749Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:10.1143305Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:10.1143879Z 2025-10-10T00:01:10.1144103Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:10.1144467Z 2025-10-10T00:01:10.1144663Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:10.1145161Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:10.1145448Z 2025-10-10T00:01:10.1145455Z 2025-10-10T00:01:10.1145656Z class Experiment(NamedTuple): 2025-10-10T00:01:10.1146154Z rollout_perc: float = ( 2025-10-10T00:01:10.1146797Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:10.1147491Z ) 2025-10-10T00:01:10.1147877Z all_branches: bool = ( 2025-10-10T00:01:10.1148513Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:10.1149210Z ) 2025-10-10T00:01:10.1149588Z default: bool = ( 2025-10-10T00:01:10.1150174Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:10.1150826Z ) 2025-10-10T00:01:10.1151035Z 2025-10-10T00:01:10.1151229Z # Add more fields as needed 2025-10-10T00:01:10.1151534Z 2025-10-10T00:01:10.1151542Z 2025-10-10T00:01:10.1151740Z class Settings(NamedTuple): 2025-10-10T00:01:10.1152189Z """ 2025-10-10T00:01:10.1152658Z Settings for the experiments that can be opted into. 2025-10-10T00:01:10.1153247Z """ 2025-10-10T00:01:10.1153448Z 2025-10-10T00:01:10.1153983Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:10.1154365Z 2025-10-10T00:01:10.1154373Z 2025-10-10T00:01:10.1154589Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:10.1155231Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:10.1155671Z 2025-10-10T00:01:10.1155851Z COLORS = { 2025-10-10T00:01:10.1156265Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:10.1156935Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:10.1157441Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:10.1157956Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:10.1158448Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:10.1158926Z } 2025-10-10T00:01:10.1159128Z 2025-10-10T00:01:10.1159359Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:10.1160123Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:10.1160934Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:10.1161536Z return super().format(record) 2025-10-10T00:01:10.1161873Z 2025-10-10T00:01:10.1161880Z 2025-10-10T00:01:10.1162090Z handler = logging.StreamHandler() 2025-10-10T00:01:10.1162804Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:10.1163379Z 2025-10-10T00:01:10.1163851Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:10.1164469Z log.addHandler(handler) 2025-10-10T00:01:10.1164934Z log.setLevel(logging.INFO) 2025-10-10T00:01:10.1165233Z 2025-10-10T00:01:10.1165240Z 2025-10-10T00:01:10.1165517Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:10.1166124Z """ 2025-10-10T00:01:10.1166649Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:10.1167308Z """ 2025-10-10T00:01:10.1167696Z if not GITHUB_OUTPUT: 2025-10-10T00:01:10.1168787Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:10.1169965Z log.warning( 2025-10-10T00:01:10.1170846Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:10.1171809Z ) 2025-10-10T00:01:10.1181912Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:10.1233131Z return 2025-10-10T00:01:10.1233781Z 2025-10-10T00:01:10.1234397Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:10.1235423Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:10.1236413Z f.write(f"{key}={value}\n") 2025-10-10T00:01:10.1236989Z 2025-10-10T00:01:10.1237001Z 2025-10-10T00:01:10.1237532Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:10.1238680Z return frozenset( 2025-10-10T00:01:10.1239753Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:10.1240980Z ) 2025-10-10T00:01:10.1241313Z 2025-10-10T00:01:10.1241324Z 2025-10-10T00:01:10.1241636Z def parse_args() -> Any: 2025-10-10T00:01:10.1242580Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:10.1244341Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:10.1245748Z parser.add_argument( 2025-10-10T00:01:10.1246535Z "--github-issue-repo", 2025-10-10T00:01:10.1247356Z type=str, 2025-10-10T00:01:10.1248037Z required=False, 2025-10-10T00:01:10.1248802Z default="pytorch/test-infra", 2025-10-10T00:01:10.1249725Z help="GitHub repo to get the issue", 2025-10-10T00:01:10.1250615Z ) 2025-10-10T00:01:10.1251225Z parser.add_argument( 2025-10-10T00:01:10.1251979Z "--github-repo", 2025-10-10T00:01:10.1252699Z type=str, 2025-10-10T00:01:10.1253368Z required=True, 2025-10-10T00:01:10.1254312Z help="GitHub repo where CI is running", 2025-10-10T00:01:10.1255229Z ) 2025-10-10T00:01:10.1255843Z parser.add_argument( 2025-10-10T00:01:10.1256886Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:10.1258072Z ) 2025-10-10T00:01:10.1258682Z parser.add_argument( 2025-10-10T00:01:10.1259763Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:10.1260953Z ) 2025-10-10T00:01:10.1261540Z parser.add_argument( 2025-10-10T00:01:10.1262911Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:10.1264391Z ) 2025-10-10T00:01:10.1265046Z parser.add_argument( 2025-10-10T00:01:10.1266223Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:10.1267514Z ) 2025-10-10T00:01:10.1268197Z parser.add_argument( 2025-10-10T00:01:10.1269013Z "--github-ref-type", 2025-10-10T00:01:10.1269814Z type=str, 2025-10-10T00:01:10.1270493Z required=True, 2025-10-10T00:01:10.1271316Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:10.1272282Z ) 2025-10-10T00:01:10.1272902Z parser.add_argument( 2025-10-10T00:01:10.1273892Z "--eligible-experiments", 2025-10-10T00:01:10.1274832Z type=_str_comma_separated_to_set, 2025-10-10T00:01:10.1275743Z required=False, 2025-10-10T00:01:10.1276469Z default="", 2025-10-10T00:01:10.1277984Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:10.1279756Z ) 2025-10-10T00:01:10.1280394Z parser.add_argument( 2025-10-10T00:01:10.1281169Z "--opt-out-experiments", 2025-10-10T00:01:10.1282016Z type=_str_comma_separated_to_set, 2025-10-10T00:01:10.1282929Z required=False, 2025-10-10T00:01:10.1284048Z default="", 2025-10-10T00:01:10.1284792Z help=( 2025-10-10T00:01:10.1286160Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:10.1288510Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:10.1290238Z ), 2025-10-10T00:01:10.1290970Z ) 2025-10-10T00:01:10.1291758Z parser.add_argument( 2025-10-10T00:01:10.1292632Z "--pr-number", 2025-10-10T00:01:10.1293442Z type=str, 2025-10-10T00:01:10.1294535Z required=False, 2025-10-10T00:01:10.1295387Z default="", 2025-10-10T00:01:10.1296557Z help="the optional PR number where this is run", 2025-10-10T00:01:10.1297775Z ) 2025-10-10T00:01:10.1298180Z 2025-10-10T00:01:10.1298566Z return parser.parse_args() 2025-10-10T00:01:10.1299191Z 2025-10-10T00:01:10.1299204Z 2025-10-10T00:01:10.1300015Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:10.1301672Z auth = Auth.Token(github_token) 2025-10-10T00:01:10.1302649Z return Github(auth=auth) 2025-10-10T00:01:10.1303245Z 2025-10-10T00:01:10.1303261Z 2025-10-10T00:01:10.1304384Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:10.1306119Z repo = gh.get_repo(repo) 2025-10-10T00:01:10.1307144Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:10.1307854Z 2025-10-10T00:01:10.1307870Z 2025-10-10T00:01:10.1308239Z def get_potential_pr_author( 2025-10-10T00:01:10.1309551Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:10.1310959Z ) -> str: 2025-10-10T00:01:10.1312022Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:10.1313921Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:10.1315513Z # embedded in the tag name: ciflow// 2025-10-10T00:01:10.1316489Z 2025-10-10T00:01:10.1316875Z gh = get_gh_client(github_token) 2025-10-10T00:01:10.1317588Z 2025-10-10T00:01:10.1318097Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:10.1319348Z split_tag = ref_name.split("/") 2025-10-10T00:01:10.1320419Z if ( 2025-10-10T00:01:10.1321207Z len(split_tag) == 3 2025-10-10T00:01:10.1322185Z and split_tag[0] == "ciflow" 2025-10-10T00:01:10.1323228Z and split_tag[2].isnumeric() 2025-10-10T00:01:10.1324448Z ): 2025-10-10T00:01:10.1325116Z pr_number = split_tag[2] 2025-10-10T00:01:10.1325891Z try: 2025-10-10T00:01:10.1326353Z repository = gh.get_repo(repo) 2025-10-10T00:01:10.1327000Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:10.1327635Z except Exception as e: 2025-10-10T00:01:10.1328171Z raise Exception( # noqa: TRY002 2025-10-10T00:01:10.1328860Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:10.1329523Z ) from e 2025-10-10T00:01:10.1330076Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:10.1330802Z # In all other cases, return the original input username 2025-10-10T00:01:10.1331411Z return username 2025-10-10T00:01:10.1331665Z 2025-10-10T00:01:10.1331674Z 2025-10-10T00:01:10.1331912Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:10.1332468Z """ 2025-10-10T00:01:10.1333137Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:10.1334216Z """ 2025-10-10T00:01:10.1334795Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:10.1335328Z 2025-10-10T00:01:10.1335334Z 2025-10-10T00:01:10.1335543Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:10.1336053Z try: 2025-10-10T00:01:10.1336452Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:10.1336970Z return data 2025-10-10T00:01:10.1337423Z except yaml.YAMLError: 2025-10-10T00:01:10.1337942Z log.exception("Error loading YAML") 2025-10-10T00:01:10.1338490Z raise 2025-10-10T00:01:10.1338720Z 2025-10-10T00:01:10.1338729Z 2025-10-10T00:01:10.1339166Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:10.1339940Z """ 2025-10-10T00:01:10.1340591Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:10.1341206Z 2025-10-10T00:01:10.1341718Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:10.1342521Z and the text below is the list of opted in users. 2025-10-10T00:01:10.1342956Z 2025-10-10T00:01:10.1343354Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:10.1344306Z """ 2025-10-10T00:01:10.1344776Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:10.1345391Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:10.1346010Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:10.1346627Z else: 2025-10-10T00:01:10.1347034Z return "", rollout_state 2025-10-10T00:01:10.1347360Z 2025-10-10T00:01:10.1347367Z 2025-10-10T00:01:10.1347579Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:10.1348112Z """ 2025-10-10T00:01:10.1348642Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:10.1349322Z """ 2025-10-10T00:01:10.1349531Z 2025-10-10T00:01:10.1349538Z 2025-10-10T00:01:10.1349902Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:10.1350575Z """ 2025-10-10T00:01:10.1351316Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:10.1352028Z 2025-10-10T00:01:10.1352687Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:10.1353928Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:10.1354651Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:10.1355160Z 2025-10-10T00:01:10.1355167Z 2025-10-10T00:01:10.1355338Z """ 2025-10-10T00:01:10.1355746Z optins = UserOptins() 2025-10-10T00:01:10.1356247Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:10.1356829Z user = user.strip("\r\n\t -") 2025-10-10T00:01:10.1357392Z if not user or not user.startswith("@"): 2025-10-10T00:01:10.1358133Z # Not a valid user. Skip 2025-10-10T00:01:10.1358645Z continue 2025-10-10T00:01:10.1358905Z 2025-10-10T00:01:10.1359082Z if user: 2025-10-10T00:01:10.1359535Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:10.1360245Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:10.1360759Z 2025-10-10T00:01:10.1360944Z return optins 2025-10-10T00:01:10.1361186Z 2025-10-10T00:01:10.1361194Z 2025-10-10T00:01:10.1361491Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:10.1362130Z """ 2025-10-10T00:01:10.1362540Z Check if the experiment name is valid. 2025-10-10T00:01:10.1363085Z A valid name: 2025-10-10T00:01:10.1363935Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:10.1364918Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:10.1365686Z - Cannot contain spaces 2025-10-10T00:01:10.1366169Z """ 2025-10-10T00:01:10.1366387Z 2025-10-10T00:01:10.1366661Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:10.1367386Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:10.1367859Z 2025-10-10T00:01:10.1368030Z if valid: 2025-10-10T00:01:10.1368427Z return True 2025-10-10T00:01:10.1368671Z 2025-10-10T00:01:10.1368842Z log.error( 2025-10-10T00:01:10.1370379Z 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-10-10T00:01:10.1371995Z ) 2025-10-10T00:01:10.1372378Z return False 2025-10-10T00:01:10.1372618Z 2025-10-10T00:01:10.1372626Z 2025-10-10T00:01:10.1372951Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:10.1373791Z """ 2025-10-10T00:01:10.1374629Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:10.1375417Z """ 2025-10-10T00:01:10.1375790Z try: 2025-10-10T00:01:10.1376186Z if settings_text: 2025-10-10T00:01:10.1376943Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:10.1377765Z # for easy reading 2025-10-10T00:01:10.1378583Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:10.1379510Z # the backtick character in shell commands. 2025-10-10T00:01:10.1380129Z backtick = chr(96) # backtick character 2025-10-10T00:01:10.1380813Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:10.1381498Z settings = load_yaml(settings_text) 2025-10-10T00:01:10.1381896Z 2025-10-10T00:01:10.1382317Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:10.1383105Z experiments = {} 2025-10-10T00:01:10.1383413Z 2025-10-10T00:01:10.1383993Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:10.1384791Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:10.1385938Z # 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-10-10T00:01:10.1387023Z continue 2025-10-10T00:01:10.1387322Z 2025-10-10T00:01:10.1387514Z valid_settings = {} 2025-10-10T00:01:10.1388060Z for setting in exp_settings: 2025-10-10T00:01:10.1388646Z if setting not in Experiment._fields: 2025-10-10T00:01:10.1389229Z log.warning( 2025-10-10T00:01:10.1389961Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:10.1390870Z ) 2025-10-10T00:01:10.1391329Z else: 2025-10-10T00:01:10.1391853Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:10.1392299Z 2025-10-10T00:01:10.1392586Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:10.1393243Z return Settings(experiments) 2025-10-10T00:01:10.1393804Z 2025-10-10T00:01:10.1394016Z except Exception: 2025-10-10T00:01:10.1394526Z log.exception("Failed to parse settings") 2025-10-10T00:01:10.1394925Z 2025-10-10T00:01:10.1395105Z return Settings() 2025-10-10T00:01:10.1395368Z 2025-10-10T00:01:10.1395381Z 2025-10-10T00:01:10.1395641Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:10.1396234Z """ 2025-10-10T00:01:10.1396683Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:10.1397102Z 2025-10-10T00:01:10.1397475Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:10.1398257Z and the text below is the list of opted in users. 2025-10-10T00:01:10.1398676Z 2025-10-10T00:01:10.1399109Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:10.1399865Z """ 2025-10-10T00:01:10.1400443Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:10.1401237Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:10.1401655Z 2025-10-10T00:01:10.1401662Z 2025-10-10T00:01:10.1401923Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:10.1402510Z """ 2025-10-10T00:01:10.1402921Z Parse users from the rollout state. 2025-10-10T00:01:10.1403289Z 2025-10-10T00:01:10.1403470Z """ 2025-10-10T00:01:10.1404244Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:10.1405015Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:10.1405431Z 2025-10-10T00:01:10.1405437Z 2025-10-10T00:01:10.1406014Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:10.1406808Z """ 2025-10-10T00:01:10.1407239Z Check if a user is opted into an experiment 2025-10-10T00:01:10.1407797Z """ 2025-10-10T00:01:10.1408268Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:10.1408699Z 2025-10-10T00:01:10.1408706Z 2025-10-10T00:01:10.1409135Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:10.1409908Z """ 2025-10-10T00:01:10.1410379Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:10.1410981Z """ 2025-10-10T00:01:10.1411503Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:10.1412213Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:10.1412868Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:10.1413486Z return False 2025-10-10T00:01:10.1413900Z 2025-10-10T00:01:10.1414186Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:10.1414804Z log.warning( 2025-10-10T00:01:10.1415626Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:10.1416531Z ) 2025-10-10T00:01:10.1416742Z 2025-10-10T00:01:10.1416915Z return True 2025-10-10T00:01:10.1417153Z 2025-10-10T00:01:10.1417160Z 2025-10-10T00:01:10.1417353Z def get_runner_prefix( 2025-10-10T00:01:10.1417803Z rollout_state: str, 2025-10-10T00:01:10.1418273Z workflow_requestors: Iterable[str], 2025-10-10T00:01:10.1418826Z branch: str, 2025-10-10T00:01:10.1419327Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:10.1419997Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:10.1420601Z is_canary: bool = False, 2025-10-10T00:01:10.1421064Z ) -> str: 2025-10-10T00:01:10.1421637Z settings = parse_settings(rollout_state) 2025-10-10T00:01:10.1422245Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:10.1422620Z 2025-10-10T00:01:10.1422798Z fleet_prefix = "" 2025-10-10T00:01:10.1423236Z prefixes = [] 2025-10-10T00:01:10.1423986Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:10.1424953Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:10.1425682Z log.info( 2025-10-10T00:01:10.1426375Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:10.1427787Z ) 2025-10-10T00:01:10.1428401Z continue 2025-10-10T00:01:10.1428821Z 2025-10-10T00:01:10.1429159Z if opt_out_experiments: 2025-10-10T00:01:10.1430107Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:10.1431275Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:10.1432463Z log.info( 2025-10-10T00:01:10.1434477Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:10.1436444Z ) 2025-10-10T00:01:10.1437198Z continue 2025-10-10T00:01:10.1437690Z 2025-10-10T00:01:10.1438032Z if eligible_experiments: 2025-10-10T00:01:10.1439062Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:10.1440318Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:10.1441348Z log.info( 2025-10-10T00:01:10.1442887Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:10.1444704Z ) 2025-10-10T00:01:10.1445289Z continue 2025-10-10T00:01:10.1445887Z elif not experiment_settings.default: 2025-10-10T00:01:10.1446449Z log.info( 2025-10-10T00:01:10.1447316Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:10.1448092Z ) 2025-10-10T00:01:10.1448490Z continue 2025-10-10T00:01:10.1448742Z 2025-10-10T00:01:10.1449029Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:10.1449672Z opted_out_users = [ 2025-10-10T00:01:10.1450135Z requestor 2025-10-10T00:01:10.1450594Z for requestor in workflow_requestors 2025-10-10T00:01:10.1451284Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:10.1451924Z ] 2025-10-10T00:01:10.1452163Z 2025-10-10T00:01:10.1452349Z if opted_out_users: 2025-10-10T00:01:10.1452808Z log.info( 2025-10-10T00:01:10.1453439Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:10.1454328Z ) 2025-10-10T00:01:10.1454723Z continue 2025-10-10T00:01:10.1454980Z 2025-10-10T00:01:10.1455271Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:10.1455901Z opted_in_users = [ 2025-10-10T00:01:10.1456359Z requestor 2025-10-10T00:01:10.1456815Z for requestor in workflow_requestors 2025-10-10T00:01:10.1457495Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:10.1458132Z ] 2025-10-10T00:01:10.1458348Z 2025-10-10T00:01:10.1458533Z enabled = False 2025-10-10T00:01:10.1458975Z if opted_in_users: 2025-10-10T00:01:10.1459434Z log.info( 2025-10-10T00:01:10.1460045Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:10.1460746Z ) 2025-10-10T00:01:10.1461150Z enabled = True 2025-10-10T00:01:10.1461435Z 2025-10-10T00:01:10.1461660Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:10.1462528Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:10.1463735Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:10.1464429Z log.info( 2025-10-10T00:01:10.1465322Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:10.1466278Z ) 2025-10-10T00:01:10.1466705Z enabled = True 2025-10-10T00:01:10.1467006Z 2025-10-10T00:01:10.1467178Z if enabled: 2025-10-10T00:01:10.1467617Z label = experiment_name 2025-10-10T00:01:10.1468180Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:10.1469026Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:10.1469934Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:10.1470730Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:10.1471420Z if is_canary: 2025-10-10T00:01:10.1471918Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:10.1472488Z fleet_prefix = label 2025-10-10T00:01:10.1472990Z else: 2025-10-10T00:01:10.1473428Z prefixes.append(label) 2025-10-10T00:01:10.1473881Z 2025-10-10T00:01:10.1474100Z if len(prefixes) > 1: 2025-10-10T00:01:10.1474563Z log.error( 2025-10-10T00:01:10.1475638Z 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-10-10T00:01:10.1476803Z ) 2025-10-10T00:01:10.1477207Z prefixes = prefixes[:1] 2025-10-10T00:01:10.1477524Z 2025-10-10T00:01:10.1477723Z # Fleet always comes first 2025-10-10T00:01:10.1478212Z if fleet_prefix: 2025-10-10T00:01:10.1478672Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:10.1479050Z 2025-10-10T00:01:10.1479431Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:10.1479875Z 2025-10-10T00:01:10.1479882Z 2025-10-10T00:01:10.1480345Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:10.1481148Z """ 2025-10-10T00:01:10.1481757Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:10.1482344Z 2025-10-10T00:01:10.1482737Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:10.1483462Z """ 2025-10-10T00:01:10.1483974Z gh = get_gh_client(github_token) 2025-10-10T00:01:10.1484520Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:10.1485493Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:10.1486240Z 2025-10-10T00:01:10.1486248Z 2025-10-10T00:01:10.1486673Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:10.1487487Z for _ in range(num_retries): 2025-10-10T00:01:10.1487975Z try: 2025-10-10T00:01:10.1488410Z req = Request(url=url, headers=headers) 2025-10-10T00:01:10.1489076Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:10.1489744Z return json.loads(content) 2025-10-10T00:01:10.1490280Z except Exception as e: 2025-10-10T00:01:10.1490826Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:10.1491233Z 2025-10-10T00:01:10.1491624Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:10.1492383Z return {} 2025-10-10T00:01:10.1492613Z 2025-10-10T00:01:10.1492620Z 2025-10-10T00:01:10.1492783Z @cache 2025-10-10T00:01:10.1493414Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:10.1494340Z """ 2025-10-10T00:01:10.1494742Z Dynamically get PR information 2025-10-10T00:01:10.1495408Z """ 2025-10-10T00:01:10.1495914Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:10.1496557Z headers = { 2025-10-10T00:01:10.1497026Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:10.1497639Z "Authorization": f"token {github_token}", 2025-10-10T00:01:10.1498199Z } 2025-10-10T00:01:10.1498647Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:10.1499281Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:10.1499858Z headers=headers, 2025-10-10T00:01:10.1500314Z ) 2025-10-10T00:01:10.1500524Z 2025-10-10T00:01:10.1500721Z if not json_response: 2025-10-10T00:01:10.1501306Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:10.1501948Z return {} 2025-10-10T00:01:10.1502188Z 2025-10-10T00:01:10.1502381Z return json_response 2025-10-10T00:01:10.1502676Z 2025-10-10T00:01:10.1502683Z 2025-10-10T00:01:10.1503102Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:10.1503993Z """ 2025-10-10T00:01:10.1504546Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:10.1505249Z """ 2025-10-10T00:01:10.1505742Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:10.1506385Z return { 2025-10-10T00:01:10.1506975Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:10.1507709Z } 2025-10-10T00:01:10.1507915Z 2025-10-10T00:01:10.1507922Z 2025-10-10T00:01:10.1508107Z def main() -> None: 2025-10-10T00:01:10.1508548Z args = parse_args() 2025-10-10T00:01:10.1508821Z 2025-10-10T00:01:10.1509059Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:10.1509455Z 2025-10-10T00:01:10.1509659Z # Check if the PR is opt-out 2025-10-10T00:01:10.1510172Z if args.pr_number: 2025-10-10T00:01:10.1510843Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:10.1511764Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:10.1512288Z log.info( 2025-10-10T00:01:10.1512994Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:10.1513899Z ) 2025-10-10T00:01:10.1514458Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:10.1515153Z sys.exit() 2025-10-10T00:01:10.1515416Z 2025-10-10T00:01:10.1515593Z try: 2025-10-10T00:01:10.1516048Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:10.1516772Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:10.1517437Z ) 2025-10-10T00:01:10.1517650Z 2025-10-10T00:01:10.1517863Z username = get_potential_pr_author( 2025-10-10T00:01:10.1518432Z args.github_token, 2025-10-10T00:01:10.1518942Z args.github_repo, 2025-10-10T00:01:10.1519439Z args.github_actor, 2025-10-10T00:01:10.1519947Z args.github_ref_type, 2025-10-10T00:01:10.1520469Z args.github_branch, 2025-10-10T00:01:10.1520952Z ) 2025-10-10T00:01:10.1521159Z 2025-10-10T00:01:10.1521447Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:10.1521913Z 2025-10-10T00:01:10.1522141Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:10.1522709Z rollout_state, 2025-10-10T00:01:10.1523209Z (args.github_issue_owner, username), 2025-10-10T00:01:10.1523881Z args.github_branch, 2025-10-10T00:01:10.1524393Z args.eligible_experiments, 2025-10-10T00:01:10.1524944Z args.opt_out_experiments, 2025-10-10T00:01:10.1525477Z is_canary, 2025-10-10T00:01:10.1525906Z ) 2025-10-10T00:01:10.1526118Z 2025-10-10T00:01:10.1526318Z except Exception as e: 2025-10-10T00:01:10.1526789Z log.error( 2025-10-10T00:01:10.1527486Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:10.1528422Z ) 2025-10-10T00:01:10.1528635Z 2025-10-10T00:01:10.1528972Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:10.1529496Z 2025-10-10T00:01:10.1529503Z 2025-10-10T00:01:10.1529694Z if __name__ == "__main__": 2025-10-10T00:01:10.1530157Z main() 2025-10-10T00:01:10.1530376Z 2025-10-10T00:01:10.1619555Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:10.1620472Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:10.1654321Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:10.1654827Z env: 2025-10-10T00:01:10.1655469Z GITHUB_TOKEN: *** 2025-10-10T00:01:10.1655890Z ISSUE_NUMBER: 5132 2025-10-10T00:01:10.1656349Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:10.1656858Z ISSUE_OWNER: 2025-10-10T00:01:10.1657269Z CHECK_EXPERIMENTS: 2025-10-10T00:01:10.1657698Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:10.1658149Z PR_NUMBER: 2025-10-10T00:01:10.1658539Z ##[endgroup] 2025-10-10T00:01:18.0769992Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:20.6444738Z Collecting urllib3==1.26.18 2025-10-10T00:01:20.7080074Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:20.7443946Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.7 MB/s eta 0:00:00 2025-10-10T00:01:20.7657916Z Collecting PyGithub==2.3.0 2025-10-10T00:01:20.7774408Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:20.8314685Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:20.8419456Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:20.8470782Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:20.8487581Z 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-10-10T00:01:20.8502521Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:20.8823434Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:20.8923878Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:20.9158976Z 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-10-10T00:01:21.0605956Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:21.0709873Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:21.2090944Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:21.2199920Z 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-10-10T00:01:21.2489139Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:21.2590864Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:21.2898653Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:21.3033992Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.5 MB/s eta 0:00:00 2025-10-10T00:01:21.3169574Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:21.3301562Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 30.3 MB/s eta 0:00:00 2025-10-10T00:01:21.3410630Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:21.3591032Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 85.3 MB/s eta 0:00:00 2025-10-10T00:01:21.3692203Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:21.3820707Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:21.3868558Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 69.0 MB/s eta 0:00:00 2025-10-10T00:01:21.3991851Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:21.4034115Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.2 MB/s eta 0:00:00 2025-10-10T00:01:21.4140071Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:21.4181278Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 44.0 MB/s eta 0:00:00 2025-10-10T00:01:21.9884642Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:22.5258029Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:22.6092900Z ##[group]Run curr_branch="main" 2025-10-10T00:01:22.6093217Z curr_branch="main" 2025-10-10T00:01:22.6093450Z curr_ref_type="branch" 2025-10-10T00:01:22.6093965Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:22.6094247Z  2025-10-10T00:01:22.6094449Z python3 runner_determinator.py \ 2025-10-10T00:01:22.6094746Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:22.6095029Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:22.6095289Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:22.6095547Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:22.6095837Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:22.6096112Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:22.6096381Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:22.6096678Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:22.6097041Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:22.6097330Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:22.6131365Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:22.6131593Z env: 2025-10-10T00:01:22.6132163Z GITHUB_TOKEN: *** 2025-10-10T00:01:22.6132353Z ISSUE_NUMBER: 5132 2025-10-10T00:01:22.6132559Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:22.6132785Z ISSUE_OWNER: 2025-10-10T00:01:22.6132965Z CHECK_EXPERIMENTS: 2025-10-10T00:01:22.6133152Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:22.6133339Z PR_NUMBER: 2025-10-10T00:01:22.6133503Z ##[endgroup] 2025-10-10T00:01:22.6184309Z Current branch is 'main' 2025-10-10T00:01:25.1214617Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-10-10T00:01:25.1215756Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:25.1216810Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:25.1217741Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:25.1218425Z INFO : Setting output: label-type='lf.' 2025-10-10T00:01:25.1527116Z Evaluate and set job outputs 2025-10-10T00:01:25.1533873Z Set output 'label-type' 2025-10-10T00:01:25.1535755Z Cleaning up orphan processes