2025-08-14T20:43:46.8895973Z Current runner version: '2.327.1' 2025-08-14T20:43:46.8919603Z ##[group]Runner Image Provisioner 2025-08-14T20:43:46.8920521Z Hosted Compute Agent 2025-08-14T20:43:46.8921060Z Version: 20250812.370 2025-08-14T20:43:46.8921631Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:46.8922345Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:46.8922929Z ##[endgroup] 2025-08-14T20:43:46.8923444Z ##[group]Operating System 2025-08-14T20:43:46.8924051Z Ubuntu 2025-08-14T20:43:46.8924530Z 24.04.2 2025-08-14T20:43:46.8924955Z LTS 2025-08-14T20:43:46.8925456Z ##[endgroup] 2025-08-14T20:43:46.8925900Z ##[group]Runner Image 2025-08-14T20:43:46.8926462Z Image: ubuntu-24.04 2025-08-14T20:43:46.8926950Z Version: 20250810.1.0 2025-08-14T20:43:46.8927951Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250810.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:46.8929877Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250810.1 2025-08-14T20:43:46.8931016Z ##[endgroup] 2025-08-14T20:43:46.8932106Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:46.8934228Z Contents: read 2025-08-14T20:43:46.8934773Z Metadata: read 2025-08-14T20:43:46.8935342Z ##[endgroup] 2025-08-14T20:43:46.8937570Z Secret source: Actions 2025-08-14T20:43:46.8938460Z Prepare workflow directory 2025-08-14T20:43:46.9438449Z Prepare all required actions 2025-08-14T20:43:46.9494534Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:46.9499435Z ##[group] Inputs 2025-08-14T20:43:46.9500443Z check_experiments: 2025-08-14T20:43:46.9501036Z opt_out_experiments: lf 2025-08-14T20:43:46.9501576Z triggering_actor: pytorchmergebot 2025-08-14T20:43:46.9502266Z issue_owner: 2025-08-14T20:43:46.9502851Z curr_branch: main 2025-08-14T20:43:46.9503377Z curr_ref_type: branch 2025-08-14T20:43:46.9504036Z issue_number: 5132 2025-08-14T20:43:46.9504553Z ##[endgroup] 2025-08-14T20:43:46.9505220Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:47.4782255Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.4784708Z cat < runner_determinator.py 2025-08-14T20:43:47.4785408Z # flake8: noqa: G004 2025-08-14T20:43:47.4785980Z  2025-08-14T20:43:47.4786784Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.4787830Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.4788858Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.4789779Z  2025-08-14T20:43:47.4790235Z """ 2025-08-14T20:43:47.4791029Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.4792065Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.4793272Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.4794328Z of which runners should be used to run which job. 2025-08-14T20:43:47.4795029Z  2025-08-14T20:43:47.4795721Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.4796846Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.4798037Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.4798876Z list, defined. 2025-08-14T20:43:47.4799575Z  2025-08-14T20:43:47.4800267Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.4801364Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.4802446Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.4803158Z  2025-08-14T20:43:47.4804153Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.4805207Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.4806133Z experiments which the user could be opted in to. 2025-08-14T20:43:47.4806826Z  2025-08-14T20:43:47.4807351Z The user list has the following rules: 2025-08-14T20:43:47.4808010Z  2025-08-14T20:43:47.4808675Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.4810194Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.4811274Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.4811996Z  2025-08-14T20:43:47.4812529Z Example config: 2025-08-14T20:43:47.4813143Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.4813998Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.4814735Z  # Expected syntax is: 2025-08-14T20:43:47.4815632Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.4816751Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.4901441Z  2025-08-14T20:43:47.4902018Z  experiments: 2025-08-14T20:43:47.4902514Z  lf: 2025-08-14T20:43:47.4902947Z  rollout_percent: 25 2025-08-14T20:43:47.4903471Z  all_branches: false 2025-08-14T20:43:47.4903979Z  default: true 2025-08-14T20:43:47.4904448Z  --- 2025-08-14T20:43:47.4904863Z  2025-08-14T20:43:47.4905240Z  # Opt-ins: 2025-08-14T20:43:47.4905910Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.4907087Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.4907960Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.4908687Z  # Experiments should be from the above list. 2025-08-14T20:43:47.4909276Z  2025-08-14T20:43:47.4909808Z  @User1,-lf,split_build 2025-08-14T20:43:47.4910338Z  @User2,lf 2025-08-14T20:43:47.4910795Z  @User3,split_build 2025-08-14T20:43:47.4911278Z """ 2025-08-14T20:43:47.4911662Z  2025-08-14T20:43:47.4912072Z import json 2025-08-14T20:43:47.4912515Z import logging 2025-08-14T20:43:47.4912960Z import os 2025-08-14T20:43:47.4913374Z import random 2025-08-14T20:43:47.4913801Z import re 2025-08-14T20:43:47.4914217Z import sys 2025-08-14T20:43:47.4914687Z from argparse import ArgumentParser 2025-08-14T20:43:47.4915360Z from collections.abc import Iterable 2025-08-14T20:43:47.4915949Z from functools import cache 2025-08-14T20:43:47.4916474Z from logging import LogRecord 2025-08-14T20:43:47.4917033Z from typing import Any, NamedTuple 2025-08-14T20:43:47.4917641Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.4918229Z  2025-08-14T20:43:47.4918618Z import yaml 2025-08-14T20:43:47.4919073Z from github import Auth, Github 2025-08-14T20:43:47.4919745Z from github.Issue import Issue 2025-08-14T20:43:47.4920257Z  2025-08-14T20:43:47.4920617Z  2025-08-14T20:43:47.4921077Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.4921836Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.4922787Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.4923532Z  2025-08-14T20:43:47.4924182Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.4924812Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.4925405Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.4926047Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.4926613Z  2025-08-14T20:43:47.4927036Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.4927573Z  2025-08-14T20:43:47.4927973Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.4928490Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.4928991Z  2025-08-14T20:43:47.4929358Z  2025-08-14T20:43:47.4930100Z class Experiment(NamedTuple): 2025-08-14T20:43:47.4930662Z  rollout_perc: float = ( 2025-08-14T20:43:47.4931407Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.4932124Z  ) 2025-08-14T20:43:47.4932553Z  all_branches: bool = ( 2025-08-14T20:43:47.4933293Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.4934009Z  ) 2025-08-14T20:43:47.4934423Z  default: bool = ( 2025-08-14T20:43:47.4935070Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.4935757Z  ) 2025-08-14T20:43:47.4936136Z  2025-08-14T20:43:47.4936545Z  # Add more fields as needed 2025-08-14T20:43:47.4937050Z  2025-08-14T20:43:47.4937412Z  2025-08-14T20:43:47.4937823Z class Settings(NamedTuple): 2025-08-14T20:43:47.4938329Z  """ 2025-08-14T20:43:47.4938854Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.4939756Z  """ 2025-08-14T20:43:47.4940151Z  2025-08-14T20:43:47.4940598Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.4941164Z  2025-08-14T20:43:47.4941691Z  2025-08-14T20:43:47.4942152Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.4942860Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.4943495Z  2025-08-14T20:43:47.4943879Z  COLORS = { 2025-08-14T20:43:47.4944353Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.4944913Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.4945461Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.4946022Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.4946571Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.4947099Z  } 2025-08-14T20:43:47.4947489Z  2025-08-14T20:43:47.4947947Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.4948769Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.4949721Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.4950367Z  return super().format(record) 2025-08-14T20:43:47.4950893Z  2025-08-14T20:43:47.4951265Z  2025-08-14T20:43:47.4951684Z handler = logging.StreamHandler() 2025-08-14T20:43:47.4952474Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.4953238Z  2025-08-14T20:43:47.4953733Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.4954380Z log.addHandler(handler) 2025-08-14T20:43:47.4954899Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.4955396Z  2025-08-14T20:43:47.4955758Z  2025-08-14T20:43:47.4956253Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.4956878Z  """ 2025-08-14T20:43:47.4957467Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.4958284Z  """ 2025-08-14T20:43:47.4958709Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.4959978Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.4961170Z  log.warning( 2025-08-14T20:43:47.4962112Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.4963093Z  ) 2025-08-14T20:43:47.4963584Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.4964176Z  return 2025-08-14T20:43:47.4964607Z  2025-08-14T20:43:47.4965035Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.4965669Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.4966285Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.4966828Z  2025-08-14T20:43:47.4967204Z  2025-08-14T20:43:47.4967757Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.4968465Z  return frozenset( 2025-08-14T20:43:47.4969164Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.4970179Z  ) 2025-08-14T20:43:47.4970591Z  2025-08-14T20:43:47.4970956Z  2025-08-14T20:43:47.4971343Z def parse_args() -> Any: 2025-08-14T20:43:47.4972004Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.4972949Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.4973770Z  parser.add_argument( 2025-08-14T20:43:47.4974301Z  "--github-issue-repo", 2025-08-14T20:43:47.4974846Z  type=str, 2025-08-14T20:43:47.4975326Z  required=False, 2025-08-14T20:43:47.4976004Z  default="pytorch/test-infra", 2025-08-14T20:43:47.4976640Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.4977195Z  ) 2025-08-14T20:43:47.4977629Z  parser.add_argument( 2025-08-14T20:43:47.4978137Z  "--github-repo", 2025-08-14T20:43:47.4978638Z  type=str, 2025-08-14T20:43:47.4979112Z  required=True, 2025-08-14T20:43:47.4979786Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.4980355Z  ) 2025-08-14T20:43:47.4980778Z  parser.add_argument( 2025-08-14T20:43:47.4981477Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.4982183Z  ) 2025-08-14T20:43:47.4982602Z  parser.add_argument( 2025-08-14T20:43:47.4983324Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.4984064Z  ) 2025-08-14T20:43:47.4984477Z  parser.add_argument( 2025-08-14T20:43:47.4985200Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.4985929Z  ) 2025-08-14T20:43:47.4986341Z  parser.add_argument( 2025-08-14T20:43:47.4987088Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.4987842Z  ) 2025-08-14T20:43:47.4988281Z  parser.add_argument( 2025-08-14T20:43:47.4988796Z  "--github-ref-type", 2025-08-14T20:43:47.4989315Z  type=str, 2025-08-14T20:43:47.4989925Z  required=True, 2025-08-14T20:43:47.4990521Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.4991115Z  ) 2025-08-14T20:43:47.4991537Z  parser.add_argument( 2025-08-14T20:43:47.4992077Z  "--eligible-experiments", 2025-08-14T20:43:47.4992805Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4993382Z  required=False, 2025-08-14T20:43:47.4993867Z  default="", 2025-08-14T20:43:47.4994808Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.4995781Z  ) 2025-08-14T20:43:47.4996205Z  parser.add_argument( 2025-08-14T20:43:47.4996736Z  "--opt-out-experiments", 2025-08-14T20:43:47.4997322Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4997891Z  required=False, 2025-08-14T20:43:47.4998380Z  default="", 2025-08-14T20:43:47.4998848Z  help=( 2025-08-14T20:43:47.4999704Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.5000925Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.5001806Z  ), 2025-08-14T20:43:47.5002220Z  ) 2025-08-14T20:43:47.5002636Z  parser.add_argument( 2025-08-14T20:43:47.5003140Z  "--pr-number", 2025-08-14T20:43:47.5003629Z  type=str, 2025-08-14T20:43:47.5004096Z  required=False, 2025-08-14T20:43:47.5004588Z  default="", 2025-08-14T20:43:47.5005161Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.5005764Z  ) 2025-08-14T20:43:47.5006148Z  2025-08-14T20:43:47.5006561Z  return parser.parse_args() 2025-08-14T20:43:47.5007083Z  2025-08-14T20:43:47.5007439Z  2025-08-14T20:43:47.5008096Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5009044Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.5009924Z  return Github(auth=auth) 2025-08-14T20:43:47.5010455Z  2025-08-14T20:43:47.5010829Z  2025-08-14T20:43:47.5011546Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5012439Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.5013030Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.5013597Z  2025-08-14T20:43:47.5013968Z  2025-08-14T20:43:47.5014369Z def get_potential_pr_author( 2025-08-14T20:43:47.5015106Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.5015830Z ) -> str: 2025-08-14T20:43:47.5016425Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.5017300Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.5018140Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.5018761Z  2025-08-14T20:43:47.5019184Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.5020293Z  2025-08-14T20:43:47.5020812Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.5021506Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.5022061Z  if ( 2025-08-14T20:43:47.5022512Z  len(split_tag) == 3 2025-08-14T20:43:47.5023079Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.5023668Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.5024213Z  ): 2025-08-14T20:43:47.5024668Z  pr_number = split_tag[2] 2025-08-14T20:43:47.5025215Z  try: 2025-08-14T20:43:47.5025725Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.5026582Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.5027262Z  except Exception as e: 2025-08-14T20:43:47.5027860Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.5028597Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.5029293Z  ) from e 2025-08-14T20:43:47.5030162Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.5030945Z  # In all other cases, return the original input username 2025-08-14T20:43:47.5031588Z  return username 2025-08-14T20:43:47.5032050Z  2025-08-14T20:43:47.5032413Z  2025-08-14T20:43:47.5032879Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.5033449Z  """ 2025-08-14T20:43:47.5034173Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.5035009Z  """ 2025-08-14T20:43:47.5035622Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.5036348Z  2025-08-14T20:43:47.5036709Z  2025-08-14T20:43:47.5037144Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.5037688Z  try: 2025-08-14T20:43:47.5038145Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.5038700Z  return data 2025-08-14T20:43:47.5039196Z  except yaml.YAMLError: 2025-08-14T20:43:47.5039874Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.5040429Z  raise 2025-08-14T20:43:47.5040855Z  2025-08-14T20:43:47.5041217Z  2025-08-14T20:43:47.5041881Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.5042669Z  """ 2025-08-14T20:43:47.5043513Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.5044315Z  2025-08-14T20:43:47.5044899Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5045741Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.5046340Z  2025-08-14T20:43:47.5046965Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.5047704Z  """ 2025-08-14T20:43:47.5048211Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.5048864Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.5049856Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.5050565Z  else: 2025-08-14T20:43:47.5051127Z  return "", rollout_state 2025-08-14T20:43:47.5051762Z  2025-08-14T20:43:47.5052137Z  2025-08-14T20:43:47.5052572Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.5053127Z  """ 2025-08-14T20:43:47.5053717Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.5054401Z  """ 2025-08-14T20:43:47.5054788Z  2025-08-14T20:43:47.5055150Z  2025-08-14T20:43:47.5055717Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.5056414Z  """ 2025-08-14T20:43:47.5057188Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.5058060Z  2025-08-14T20:43:47.5058910Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.5060080Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.5060997Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.5061677Z  2025-08-14T20:43:47.5062037Z  2025-08-14T20:43:47.5062394Z  """ 2025-08-14T20:43:47.5062810Z  optins = UserOptins() 2025-08-14T20:43:47.5063379Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.5063992Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.5064606Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.5065205Z  # Not a valid user. Skip 2025-08-14T20:43:47.5065744Z  continue 2025-08-14T20:43:47.5066194Z  2025-08-14T20:43:47.5066571Z  if user: 2025-08-14T20:43:47.5067108Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.5067865Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.5068548Z  2025-08-14T20:43:47.5068933Z  return optins 2025-08-14T20:43:47.5069379Z  2025-08-14T20:43:47.5069836Z  2025-08-14T20:43:47.5070371Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.5071026Z  """ 2025-08-14T20:43:47.5071485Z  Check if the experiment name is valid. 2025-08-14T20:43:47.5072051Z  A valid name: 2025-08-14T20:43:47.5072771Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.5073771Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.5074528Z  - Cannot contain spaces 2025-08-14T20:43:47.5075040Z  """ 2025-08-14T20:43:47.5075419Z  2025-08-14T20:43:47.5075912Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.5076686Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.5077447Z  2025-08-14T20:43:47.5077828Z  if valid: 2025-08-14T20:43:47.5078263Z  return True 2025-08-14T20:43:47.5078709Z  2025-08-14T20:43:47.5079067Z  log.error( 2025-08-14T20:43:47.5080713Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.5082313Z  ) 2025-08-14T20:43:47.5082707Z  return False 2025-08-14T20:43:47.5083152Z  2025-08-14T20:43:47.5083507Z  2025-08-14T20:43:47.5084059Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.5084729Z  """ 2025-08-14T20:43:47.5085386Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.5086149Z  """ 2025-08-14T20:43:47.5086550Z  try: 2025-08-14T20:43:47.5086961Z  if settings_text: 2025-08-14T20:43:47.5087772Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.5088615Z  # for easy reading 2025-08-14T20:43:47.5089740Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.5090777Z  # the backtick character in shell commands. 2025-08-14T20:43:47.5091448Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.5092186Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.5092906Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.5093459Z  2025-08-14T20:43:47.5094112Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.5095102Z  experiments = {} 2025-08-14T20:43:47.5095608Z  2025-08-14T20:43:47.5096214Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.5097034Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.5098210Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.5099302Z  continue 2025-08-14T20:43:47.5099944Z  2025-08-14T20:43:47.5100352Z  valid_settings = {} 2025-08-14T20:43:47.5100925Z  for setting in exp_settings: 2025-08-14T20:43:47.5101548Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.5102157Z  log.warning( 2025-08-14T20:43:47.5102947Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.5103704Z  ) 2025-08-14T20:43:47.5104191Z  else: 2025-08-14T20:43:47.5104783Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.5105390Z  2025-08-14T20:43:47.5105899Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.5106592Z  return Settings(experiments) 2025-08-14T20:43:47.5107130Z  2025-08-14T20:43:47.5107514Z  except Exception: 2025-08-14T20:43:47.5108072Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.5108647Z  2025-08-14T20:43:47.5109027Z  return Settings() 2025-08-14T20:43:47.5109590Z  2025-08-14T20:43:47.5109945Z  2025-08-14T20:43:47.5110564Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.5111191Z  """ 2025-08-14T20:43:47.5111692Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.5112313Z  2025-08-14T20:43:47.5112900Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5113723Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.5114312Z  2025-08-14T20:43:47.5114949Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.5115714Z  """ 2025-08-14T20:43:47.5116335Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5117165Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.5117747Z  2025-08-14T20:43:47.5118107Z  2025-08-14T20:43:47.5118595Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.5119209Z  """ 2025-08-14T20:43:47.5119748Z  Parse users from the rollout state. 2025-08-14T20:43:47.5120290Z  2025-08-14T20:43:47.5120646Z  """ 2025-08-14T20:43:47.5121249Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5122069Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.5122648Z  2025-08-14T20:43:47.5123010Z  2025-08-14T20:43:47.5123671Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5124464Z  """ 2025-08-14T20:43:47.5124938Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.5125516Z  """ 2025-08-14T20:43:47.5126040Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.5126662Z  2025-08-14T20:43:47.5127160Z  2025-08-14T20:43:47.5127837Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5128639Z  """ 2025-08-14T20:43:47.5129160Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.5129885Z  """ 2025-08-14T20:43:47.5130453Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.5131216Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.5131932Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.5132579Z  return False 2025-08-14T20:43:47.5133040Z  2025-08-14T20:43:47.5133536Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.5134182Z  log.warning( 2025-08-14T20:43:47.5135076Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.5136002Z  ) 2025-08-14T20:43:47.5136397Z  2025-08-14T20:43:47.5136767Z  return True 2025-08-14T20:43:47.5137204Z  2025-08-14T20:43:47.5137562Z  2025-08-14T20:43:47.5137951Z def get_runner_prefix( 2025-08-14T20:43:47.5138445Z  rollout_state: str, 2025-08-14T20:43:47.5138986Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.5139635Z  branch: str, 2025-08-14T20:43:47.5140216Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5140961Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5141604Z  is_canary: bool = False, 2025-08-14T20:43:47.5142117Z ) -> str: 2025-08-14T20:43:47.5142610Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.5143256Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.5143823Z  2025-08-14T20:43:47.5144335Z  fleet_prefix = "" 2025-08-14T20:43:47.5144821Z  prefixes = [] 2025-08-14T20:43:47.5145530Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.5146535Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.5147288Z  log.info( 2025-08-14T20:43:47.5148045Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.5148827Z  ) 2025-08-14T20:43:47.5149279Z  continue 2025-08-14T20:43:47.5149840Z  2025-08-14T20:43:47.5150241Z  if opt_out_experiments: 2025-08-14T20:43:47.5150852Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.5151556Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.5152204Z  log.info( 2025-08-14T20:43:47.5153205Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.5154224Z  ) 2025-08-14T20:43:47.5154687Z  continue 2025-08-14T20:43:47.5155154Z  2025-08-14T20:43:47.5155602Z  if eligible_experiments: 2025-08-14T20:43:47.5156235Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.5156934Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.5157525Z  log.info( 2025-08-14T20:43:47.5158381Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.5159262Z  ) 2025-08-14T20:43:47.5159818Z  continue 2025-08-14T20:43:47.5160516Z  elif not experiment_settings.default: 2025-08-14T20:43:47.5161089Z  log.info( 2025-08-14T20:43:47.5161830Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.5162601Z  ) 2025-08-14T20:43:47.5163035Z  continue 2025-08-14T20:43:47.5163493Z  2025-08-14T20:43:47.5164011Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.5164684Z  opted_out_users = [ 2025-08-14T20:43:47.5165194Z  requestor 2025-08-14T20:43:47.5165732Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5166469Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5167140Z  ] 2025-08-14T20:43:47.5167553Z  2025-08-14T20:43:47.5167942Z  if opted_out_users: 2025-08-14T20:43:47.5168479Z  log.info( 2025-08-14T20:43:47.5169188Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.5170040Z  ) 2025-08-14T20:43:47.5170471Z  continue 2025-08-14T20:43:47.5170925Z  2025-08-14T20:43:47.5171447Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.5172110Z  opted_in_users = [ 2025-08-14T20:43:47.5172640Z  requestor 2025-08-14T20:43:47.5173180Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5173906Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5174570Z  ] 2025-08-14T20:43:47.5174975Z  2025-08-14T20:43:47.5175355Z  enabled = False 2025-08-14T20:43:47.5175860Z  if opted_in_users: 2025-08-14T20:43:47.5176495Z  log.info( 2025-08-14T20:43:47.5177193Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.5177915Z  ) 2025-08-14T20:43:47.5178356Z  enabled = True 2025-08-14T20:43:47.5178839Z  2025-08-14T20:43:47.5179279Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.5180283Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.5181289Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.5181993Z  log.info( 2025-08-14T20:43:47.5182933Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.5183886Z  ) 2025-08-14T20:43:47.5184366Z  enabled = True 2025-08-14T20:43:47.5184868Z  2025-08-14T20:43:47.5185247Z  if enabled: 2025-08-14T20:43:47.5185750Z  label = experiment_name 2025-08-14T20:43:47.5186367Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.5187254Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.5188186Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.5189015Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.5189820Z  if is_canary: 2025-08-14T20:43:47.5190380Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.5190977Z  fleet_prefix = label 2025-08-14T20:43:47.5191515Z  else: 2025-08-14T20:43:47.5192159Z  prefixes.append(label) 2025-08-14T20:43:47.5192695Z  2025-08-14T20:43:47.5193093Z  if len(prefixes) > 1: 2025-08-14T20:43:47.5193604Z  log.error( 2025-08-14T20:43:47.5194714Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.5195872Z  ) 2025-08-14T20:43:47.5196314Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.5196834Z  2025-08-14T20:43:47.5197225Z  # Fleet always comes first 2025-08-14T20:43:47.5197764Z  if fleet_prefix: 2025-08-14T20:43:47.5198285Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.5198826Z  2025-08-14T20:43:47.5199314Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.5200025Z  2025-08-14T20:43:47.5200395Z  2025-08-14T20:43:47.5201081Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.5201895Z  """ 2025-08-14T20:43:47.5202541Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.5203284Z  2025-08-14T20:43:47.5203901Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.5204637Z  """ 2025-08-14T20:43:47.5205095Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.5205704Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.5206409Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.5207045Z  2025-08-14T20:43:47.5207398Z  2025-08-14T20:43:47.5208041Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.5208976Z  for _ in range(num_retries): 2025-08-14T20:43:47.5209611Z  try: 2025-08-14T20:43:47.5210104Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.5210822Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.5211595Z  return json.loads(content) 2025-08-14T20:43:47.5212199Z  except Exception as e: 2025-08-14T20:43:47.5212875Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.5213466Z  2025-08-14T20:43:47.5214084Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.5214838Z  return {} 2025-08-14T20:43:47.5215263Z  2025-08-14T20:43:47.5215618Z  2025-08-14T20:43:47.5215984Z @cache 2025-08-14T20:43:47.5216682Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.5217485Z  """ 2025-08-14T20:43:47.5217930Z  Dynamically get PR information 2025-08-14T20:43:47.5218457Z  """ 2025-08-14T20:43:47.5219019Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.5219803Z  headers = { 2025-08-14T20:43:47.5220351Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.5221021Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.5221601Z  } 2025-08-14T20:43:47.5222099Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.5222762Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.5223351Z  headers=headers, 2025-08-14T20:43:47.5223830Z  ) 2025-08-14T20:43:47.5224216Z  2025-08-14T20:43:47.5224606Z  if not json_response: 2025-08-14T20:43:47.5225257Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.5226073Z  return {} 2025-08-14T20:43:47.5226518Z  2025-08-14T20:43:47.5226913Z  return json_response 2025-08-14T20:43:47.5227389Z  2025-08-14T20:43:47.5227751Z  2025-08-14T20:43:47.5228381Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.5229157Z  """ 2025-08-14T20:43:47.5229881Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.5230574Z  """ 2025-08-14T20:43:47.5231119Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.5231770Z  return { 2025-08-14T20:43:47.5232416Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.5233131Z  } 2025-08-14T20:43:47.5233519Z  2025-08-14T20:43:47.5233873Z  2025-08-14T20:43:47.5234275Z def main() -> None: 2025-08-14T20:43:47.5234764Z  args = parse_args() 2025-08-14T20:43:47.5235240Z  2025-08-14T20:43:47.5235702Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.5236273Z  2025-08-14T20:43:47.5236674Z  # Check if the PR is opt-out 2025-08-14T20:43:47.5237211Z  if args.pr_number: 2025-08-14T20:43:47.5237950Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.5238752Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.5239304Z  log.info( 2025-08-14T20:43:47.5240182Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.5240975Z  ) 2025-08-14T20:43:47.5241606Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5242332Z  sys.exit() 2025-08-14T20:43:47.5242914Z  2025-08-14T20:43:47.5243291Z  try: 2025-08-14T20:43:47.5243785Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.5244559Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.5245234Z  ) 2025-08-14T20:43:47.5245634Z  2025-08-14T20:43:47.5246054Z  username = get_potential_pr_author( 2025-08-14T20:43:47.5246634Z  args.github_token, 2025-08-14T20:43:47.5247170Z  args.github_repo, 2025-08-14T20:43:47.5247717Z  args.github_actor, 2025-08-14T20:43:47.5248263Z  args.github_ref_type, 2025-08-14T20:43:47.5248812Z  args.github_branch, 2025-08-14T20:43:47.5249320Z  ) 2025-08-14T20:43:47.5249828Z  2025-08-14T20:43:47.5250358Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.5251008Z  2025-08-14T20:43:47.5251459Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.5252055Z  rollout_state, 2025-08-14T20:43:47.5252622Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.5253220Z  args.github_branch, 2025-08-14T20:43:47.5253786Z  args.eligible_experiments, 2025-08-14T20:43:47.5254384Z  args.opt_out_experiments, 2025-08-14T20:43:47.5254938Z  is_canary, 2025-08-14T20:43:47.5255413Z  ) 2025-08-14T20:43:47.5255813Z  2025-08-14T20:43:47.5256212Z  except Exception as e: 2025-08-14T20:43:47.5256720Z  log.error( 2025-08-14T20:43:47.5257482Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.5258274Z  ) 2025-08-14T20:43:47.5258809Z  2025-08-14T20:43:47.5259384Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5260185Z  2025-08-14T20:43:47.5260550Z  2025-08-14T20:43:47.5260946Z if __name__ == "__main__": 2025-08-14T20:43:47.5261446Z  main() 2025-08-14T20:43:47.5261862Z  2025-08-14T20:43:47.5262230Z EOF 2025-08-14T20:43:47.5262616Z  2025-08-14T20:43:47.5263018Z cat runner_determinator.py 2025-08-14T20:43:47.5723905Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.5724718Z env: 2025-08-14T20:43:47.5725422Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.5725849Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.5726291Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.5726801Z ISSUE_OWNER: 2025-08-14T20:43:47.5727194Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.5727641Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:47.5728080Z PR_NUMBER: 2025-08-14T20:43:47.5728489Z ##[endgroup] 2025-08-14T20:43:47.5939276Z # flake8: noqa: G004 2025-08-14T20:43:47.5939912Z 2025-08-14T20:43:47.5940362Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.5941327Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.5942107Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.5942547Z 2025-08-14T20:43:47.5942699Z """ 2025-08-14T20:43:47.5943273Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.5944129Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.5945025Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.5945821Z of which runners should be used to run which job. 2025-08-14T20:43:47.5946225Z 2025-08-14T20:43:47.5946601Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.5947684Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.5948565Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.5949261Z list, defined. 2025-08-14T20:43:47.5949613Z 2025-08-14T20:43:47.5949976Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.5950897Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.5951701Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.5952138Z 2025-08-14T20:43:47.5952496Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.5953334Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.5954044Z experiments which the user could be opted in to. 2025-08-14T20:43:47.5954436Z 2025-08-14T20:43:47.5954635Z The user list has the following rules: 2025-08-14T20:43:47.5954969Z 2025-08-14T20:43:47.5955288Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.5956162Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.5956907Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.5957289Z 2025-08-14T20:43:47.5957456Z Example config: 2025-08-14T20:43:47.5957899Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.5958553Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.5959166Z # Expected syntax is: 2025-08-14T20:43:47.5959975Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.5960943Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.5961540Z 2025-08-14T20:43:47.5961709Z experiments: 2025-08-14T20:43:47.5962097Z lf: 2025-08-14T20:43:47.5962474Z rollout_percent: 25 2025-08-14T20:43:47.5962915Z all_branches: false 2025-08-14T20:43:47.5963513Z default: true 2025-08-14T20:43:47.5963911Z --- 2025-08-14T20:43:47.5964115Z 2025-08-14T20:43:47.5964277Z # Opt-ins: 2025-08-14T20:43:47.5964837Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.5965689Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.5966450Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.5967097Z # Experiments should be from the above list. 2025-08-14T20:43:47.5967467Z 2025-08-14T20:43:47.5967648Z @User1,-lf,split_build 2025-08-14T20:43:47.5968075Z @User2,lf 2025-08-14T20:43:47.5968464Z @User3,split_build 2025-08-14T20:43:47.5968860Z """ 2025-08-14T20:43:47.5969058Z 2025-08-14T20:43:47.5969216Z import json 2025-08-14T20:43:47.5969731Z import logging 2025-08-14T20:43:47.5970116Z import os 2025-08-14T20:43:47.5970466Z import random 2025-08-14T20:43:47.5970838Z import re 2025-08-14T20:43:47.5971204Z import sys 2025-08-14T20:43:47.5971608Z from argparse import ArgumentParser 2025-08-14T20:43:47.5972132Z from collections.abc import Iterable 2025-08-14T20:43:47.5972647Z from functools import cache 2025-08-14T20:43:47.5973121Z from logging import LogRecord 2025-08-14T20:43:47.5973594Z from typing import Any, NamedTuple 2025-08-14T20:43:47.5974122Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.5974489Z 2025-08-14T20:43:47.5974648Z import yaml 2025-08-14T20:43:47.5975035Z from github import Auth, Github 2025-08-14T20:43:47.5975512Z from github.Issue import Issue 2025-08-14T20:43:47.5975815Z 2025-08-14T20:43:47.5975823Z 2025-08-14T20:43:47.5976032Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.5976697Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.5977527Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.5978088Z 2025-08-14T20:43:47.5978313Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.5979005Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.5979738Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.5980307Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.5980659Z 2025-08-14T20:43:47.5980852Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.5981180Z 2025-08-14T20:43:47.5981369Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.5981818Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.5982094Z 2025-08-14T20:43:47.5982107Z 2025-08-14T20:43:47.5982293Z class Experiment(NamedTuple): 2025-08-14T20:43:47.5982761Z rollout_perc: float = ( 2025-08-14T20:43:47.5983383Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.5984058Z ) 2025-08-14T20:43:47.5984416Z all_branches: bool = ( 2025-08-14T20:43:47.5985033Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.5985691Z ) 2025-08-14T20:43:47.5986052Z default: bool = ( 2025-08-14T20:43:47.5986635Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.5987260Z ) 2025-08-14T20:43:47.5987447Z 2025-08-14T20:43:47.5987624Z # Add more fields as needed 2025-08-14T20:43:47.5987925Z 2025-08-14T20:43:47.5987931Z 2025-08-14T20:43:47.5988109Z class Settings(NamedTuple): 2025-08-14T20:43:47.5988541Z """ 2025-08-14T20:43:47.5988982Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.5989656Z """ 2025-08-14T20:43:47.5989855Z 2025-08-14T20:43:47.5990057Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.5990420Z 2025-08-14T20:43:47.5990431Z 2025-08-14T20:43:47.5990632Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.5991240Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.5991668Z 2025-08-14T20:43:47.5991823Z COLORS = { 2025-08-14T20:43:47.5992216Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.5992852Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.5993356Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.5993834Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.5994308Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.5994763Z } 2025-08-14T20:43:47.5994959Z 2025-08-14T20:43:47.5995183Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.5995911Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.5996676Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.5997248Z return super().format(record) 2025-08-14T20:43:47.5997574Z 2025-08-14T20:43:47.5997582Z 2025-08-14T20:43:47.5997773Z handler = logging.StreamHandler() 2025-08-14T20:43:47.5998457Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.5998993Z 2025-08-14T20:43:47.5999233Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.5999954Z log.addHandler(handler) 2025-08-14T20:43:47.6000404Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.6000687Z 2025-08-14T20:43:47.6000694Z 2025-08-14T20:43:47.6000938Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.6001492Z """ 2025-08-14T20:43:47.6001979Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.6002588Z """ 2025-08-14T20:43:47.6002945Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.6004002Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.6005090Z log.warning( 2025-08-14T20:43:47.6005929Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.6006838Z ) 2025-08-14T20:43:47.6016784Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.6017396Z return 2025-08-14T20:43:47.6017629Z 2025-08-14T20:43:47.6018020Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.6018635Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.6019196Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.6019796Z 2025-08-14T20:43:47.6019807Z 2025-08-14T20:43:47.6020138Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.6020773Z return frozenset( 2025-08-14T20:43:47.6021387Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.6022074Z ) 2025-08-14T20:43:47.6022270Z 2025-08-14T20:43:47.6022277Z 2025-08-14T20:43:47.6022457Z def parse_args() -> Any: 2025-08-14T20:43:47.6023015Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.6023870Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.6024642Z parser.add_argument( 2025-08-14T20:43:47.6025093Z "--github-issue-repo", 2025-08-14T20:43:47.6025557Z type=str, 2025-08-14T20:43:47.6025970Z required=False, 2025-08-14T20:43:47.6026415Z default="pytorch/test-infra", 2025-08-14T20:43:47.6026948Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.6027455Z ) 2025-08-14T20:43:47.6027817Z parser.add_argument( 2025-08-14T20:43:47.6028255Z "--github-repo", 2025-08-14T20:43:47.6028668Z type=str, 2025-08-14T20:43:47.6029061Z required=True, 2025-08-14T20:43:47.6029788Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.6030341Z ) 2025-08-14T20:43:47.6030703Z parser.add_argument( 2025-08-14T20:43:47.6031313Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.6031967Z ) 2025-08-14T20:43:47.6032331Z parser.add_argument( 2025-08-14T20:43:47.6032946Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.6033629Z ) 2025-08-14T20:43:47.6033986Z parser.add_argument( 2025-08-14T20:43:47.6034801Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.6035483Z ) 2025-08-14T20:43:47.6035842Z parser.add_argument( 2025-08-14T20:43:47.6036481Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.6037189Z ) 2025-08-14T20:43:47.6037559Z parser.add_argument( 2025-08-14T20:43:47.6038002Z "--github-ref-type", 2025-08-14T20:43:47.6038460Z type=str, 2025-08-14T20:43:47.6038848Z required=True, 2025-08-14T20:43:47.6039338Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.6040051Z ) 2025-08-14T20:43:47.6040424Z parser.add_argument( 2025-08-14T20:43:47.6092188Z "--eligible-experiments", 2025-08-14T20:43:47.6092843Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.6093376Z required=False, 2025-08-14T20:43:47.6093800Z default="", 2025-08-14T20:43:47.6094678Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.6095612Z ) 2025-08-14T20:43:47.6095982Z parser.add_argument( 2025-08-14T20:43:47.6096441Z "--opt-out-experiments", 2025-08-14T20:43:47.6096943Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.6097453Z required=False, 2025-08-14T20:43:47.6097866Z default="", 2025-08-14T20:43:47.6098244Z help=( 2025-08-14T20:43:47.6098909Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.6100306Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.6101139Z ), 2025-08-14T20:43:47.6101487Z ) 2025-08-14T20:43:47.6101845Z parser.add_argument( 2025-08-14T20:43:47.6102279Z "--pr-number", 2025-08-14T20:43:47.6102680Z type=str, 2025-08-14T20:43:47.6103075Z required=False, 2025-08-14T20:43:47.6103492Z default="", 2025-08-14T20:43:47.6104134Z help="the optional PR number where this is run", 2025-08-14T20:43:47.6104708Z ) 2025-08-14T20:43:47.6104908Z 2025-08-14T20:43:47.6105096Z return parser.parse_args() 2025-08-14T20:43:47.6105399Z 2025-08-14T20:43:47.6105405Z 2025-08-14T20:43:47.6105810Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.6106551Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.6107051Z return Github(auth=auth) 2025-08-14T20:43:47.6107344Z 2025-08-14T20:43:47.6107351Z 2025-08-14T20:43:47.6107797Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.6108598Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.6109085Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.6109450Z 2025-08-14T20:43:47.6109676Z 2025-08-14T20:43:47.6109917Z def get_potential_pr_author( 2025-08-14T20:43:47.6110571Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.6111238Z ) -> str: 2025-08-14T20:43:47.6111746Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.6112532Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.6113271Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.6113679Z 2025-08-14T20:43:47.6113867Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.6114197Z 2025-08-14T20:43:47.6114456Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.6115074Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.6115559Z if ( 2025-08-14T20:43:47.6115935Z len(split_tag) == 3 2025-08-14T20:43:47.6116402Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.6116919Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.6117402Z ): 2025-08-14T20:43:47.6117775Z pr_number = split_tag[2] 2025-08-14T20:43:47.6118396Z try: 2025-08-14T20:43:47.6118818Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.6119422Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.6120147Z except Exception as e: 2025-08-14T20:43:47.6120660Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.6121313Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.6121962Z ) from e 2025-08-14T20:43:47.6122480Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.6123171Z # In all other cases, return the original input username 2025-08-14T20:43:47.6123755Z return username 2025-08-14T20:43:47.6123992Z 2025-08-14T20:43:47.6123999Z 2025-08-14T20:43:47.6124222Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.6124746Z """ 2025-08-14T20:43:47.6125361Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.6126130Z """ 2025-08-14T20:43:47.6126673Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.6127194Z 2025-08-14T20:43:47.6127201Z 2025-08-14T20:43:47.6127395Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.6127886Z try: 2025-08-14T20:43:47.6128261Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.6128757Z return data 2025-08-14T20:43:47.6129158Z except yaml.YAMLError: 2025-08-14T20:43:47.6129741Z log.exception("Error loading YAML") 2025-08-14T20:43:47.6130244Z raise 2025-08-14T20:43:47.6130461Z 2025-08-14T20:43:47.6130467Z 2025-08-14T20:43:47.6130874Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.6131603Z """ 2025-08-14T20:43:47.6132213Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.6132810Z 2025-08-14T20:43:47.6133304Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.6134065Z and the text below is the list of opted in users. 2025-08-14T20:43:47.6134468Z 2025-08-14T20:43:47.6134837Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.6135725Z """ 2025-08-14T20:43:47.6136414Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.6137068Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.6137716Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.6138324Z else: 2025-08-14T20:43:47.6138700Z return "", rollout_state 2025-08-14T20:43:47.6139010Z 2025-08-14T20:43:47.6139017Z 2025-08-14T20:43:47.6139219Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.6139972Z """ 2025-08-14T20:43:47.6140497Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.6141132Z """ 2025-08-14T20:43:47.6141332Z 2025-08-14T20:43:47.6141355Z 2025-08-14T20:43:47.6141693Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.6142351Z """ 2025-08-14T20:43:47.6143052Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.6143748Z 2025-08-14T20:43:47.6144361Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.6145338Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.6146018Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.6146492Z 2025-08-14T20:43:47.6146498Z 2025-08-14T20:43:47.6146659Z """ 2025-08-14T20:43:47.6147029Z optins = UserOptins() 2025-08-14T20:43:47.6147521Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.6148062Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.6148596Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.6149326Z # Not a valid user. Skip 2025-08-14T20:43:47.6150072Z continue 2025-08-14T20:43:47.6150327Z 2025-08-14T20:43:47.6150484Z if user: 2025-08-14T20:43:47.6150922Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.6151622Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.6152114Z 2025-08-14T20:43:47.6152280Z return optins 2025-08-14T20:43:47.6152522Z 2025-08-14T20:43:47.6152530Z 2025-08-14T20:43:47.6152815Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.6153415Z """ 2025-08-14T20:43:47.6153806Z Check if the experiment name is valid. 2025-08-14T20:43:47.6154322Z A valid name: 2025-08-14T20:43:47.6154953Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.6155892Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.6156672Z - Cannot contain spaces 2025-08-14T20:43:47.6157132Z """ 2025-08-14T20:43:47.6157332Z 2025-08-14T20:43:47.6157593Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.6158288Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.6158866Z 2025-08-14T20:43:47.6159136Z if valid: 2025-08-14T20:43:47.6159747Z return True 2025-08-14T20:43:47.6160097Z 2025-08-14T20:43:47.6160270Z log.error( 2025-08-14T20:43:47.6161730Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.6163271Z ) 2025-08-14T20:43:47.6163622Z return False 2025-08-14T20:43:47.6163858Z 2025-08-14T20:43:47.6163865Z 2025-08-14T20:43:47.6164173Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.6164796Z """ 2025-08-14T20:43:47.6165532Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.6166279Z """ 2025-08-14T20:43:47.6166623Z try: 2025-08-14T20:43:47.6166992Z if settings_text: 2025-08-14T20:43:47.6167708Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.6168488Z # for easy reading 2025-08-14T20:43:47.6169264Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.6170274Z # the backtick character in shell commands. 2025-08-14T20:43:47.6170883Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.6171541Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.6172193Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.6172572Z 2025-08-14T20:43:47.6172977Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.6173745Z experiments = {} 2025-08-14T20:43:47.6174040Z 2025-08-14T20:43:47.6174422Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.6175180Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.6176277Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.6177312Z continue 2025-08-14T20:43:47.6177598Z 2025-08-14T20:43:47.6177779Z valid_settings = {} 2025-08-14T20:43:47.6178290Z for setting in exp_settings: 2025-08-14T20:43:47.6178847Z if setting not in Experiment._fields: 2025-08-14T20:43:47.6179400Z log.warning( 2025-08-14T20:43:47.6180351Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.6181264Z ) 2025-08-14T20:43:47.6181682Z else: 2025-08-14T20:43:47.6182191Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.6182614Z 2025-08-14T20:43:47.6182888Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.6183514Z return Settings(experiments) 2025-08-14T20:43:47.6183855Z 2025-08-14T20:43:47.6184029Z except Exception: 2025-08-14T20:43:47.6184494Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.6184881Z 2025-08-14T20:43:47.6185052Z return Settings() 2025-08-14T20:43:47.6185303Z 2025-08-14T20:43:47.6185309Z 2025-08-14T20:43:47.6185555Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.6186113Z """ 2025-08-14T20:43:47.6186555Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.6186956Z 2025-08-14T20:43:47.6187298Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.6188054Z and the text below is the list of opted in users. 2025-08-14T20:43:47.6188460Z 2025-08-14T20:43:47.6188866Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.6189863Z """ 2025-08-14T20:43:47.6190444Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.6191199Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.6191596Z 2025-08-14T20:43:47.6191602Z 2025-08-14T20:43:47.6191851Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.6192399Z """ 2025-08-14T20:43:47.6192782Z Parse users from the rollout state. 2025-08-14T20:43:47.6193132Z 2025-08-14T20:43:47.6193285Z """ 2025-08-14T20:43:47.6193801Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.6194532Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.6194933Z 2025-08-14T20:43:47.6194949Z 2025-08-14T20:43:47.6195495Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.6196255Z """ 2025-08-14T20:43:47.6196809Z Check if a user is opted into an experiment 2025-08-14T20:43:47.6197537Z """ 2025-08-14T20:43:47.6197985Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.6198404Z 2025-08-14T20:43:47.6198411Z 2025-08-14T20:43:47.6198824Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.6199747Z """ 2025-08-14T20:43:47.6200367Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.6200938Z """ 2025-08-14T20:43:47.6201427Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.6202097Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.6202718Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.6203312Z return False 2025-08-14T20:43:47.6203585Z 2025-08-14T20:43:47.6203858Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.6204455Z log.warning( 2025-08-14T20:43:47.6205252Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.6206118Z ) 2025-08-14T20:43:47.6206319Z 2025-08-14T20:43:47.6206489Z return True 2025-08-14T20:43:47.6206720Z 2025-08-14T20:43:47.6206727Z 2025-08-14T20:43:47.6206899Z def get_runner_prefix( 2025-08-14T20:43:47.6207339Z rollout_state: str, 2025-08-14T20:43:47.6207793Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.6208308Z branch: str, 2025-08-14T20:43:47.6208792Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.6209573Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.6210171Z is_canary: bool = False, 2025-08-14T20:43:47.6210619Z ) -> str: 2025-08-14T20:43:47.6211026Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.6211765Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.6212130Z 2025-08-14T20:43:47.6212302Z fleet_prefix = "" 2025-08-14T20:43:47.6212716Z prefixes = [] 2025-08-14T20:43:47.6213334Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.6214260Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.6214961Z log.info( 2025-08-14T20:43:47.6215637Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.6216380Z ) 2025-08-14T20:43:47.6216751Z continue 2025-08-14T20:43:47.6216998Z 2025-08-14T20:43:47.6217180Z if opt_out_experiments: 2025-08-14T20:43:47.6217705Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.6218334Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.6218918Z log.info( 2025-08-14T20:43:47.6220081Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.6221063Z ) 2025-08-14T20:43:47.6221448Z continue 2025-08-14T20:43:47.6221717Z 2025-08-14T20:43:47.6221902Z if eligible_experiments: 2025-08-14T20:43:47.6222481Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.6223098Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.6223647Z log.info( 2025-08-14T20:43:47.6224413Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.6225238Z ) 2025-08-14T20:43:47.6225621Z continue 2025-08-14T20:43:47.6226081Z elif not experiment_settings.default: 2025-08-14T20:43:47.6226609Z log.info( 2025-08-14T20:43:47.6227389Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.6228125Z ) 2025-08-14T20:43:47.6228487Z continue 2025-08-14T20:43:47.6228728Z 2025-08-14T20:43:47.6228996Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.6229867Z opted_out_users = [ 2025-08-14T20:43:47.6230331Z requestor 2025-08-14T20:43:47.6230769Z for requestor in workflow_requestors 2025-08-14T20:43:47.6231422Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6232045Z ] 2025-08-14T20:43:47.6232247Z 2025-08-14T20:43:47.6232420Z if opted_out_users: 2025-08-14T20:43:47.6232865Z log.info( 2025-08-14T20:43:47.6233476Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.6234163Z ) 2025-08-14T20:43:47.6234529Z continue 2025-08-14T20:43:47.6234785Z 2025-08-14T20:43:47.6235058Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.6235687Z opted_in_users = [ 2025-08-14T20:43:47.6236119Z requestor 2025-08-14T20:43:47.6236567Z for requestor in workflow_requestors 2025-08-14T20:43:47.6237218Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6237831Z ] 2025-08-14T20:43:47.6238032Z 2025-08-14T20:43:47.6238204Z enabled = False 2025-08-14T20:43:47.6238631Z if opted_in_users: 2025-08-14T20:43:47.6239071Z log.info( 2025-08-14T20:43:47.6240158Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.6240852Z ) 2025-08-14T20:43:47.6241233Z enabled = True 2025-08-14T20:43:47.6241509Z 2025-08-14T20:43:47.6241724Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.6242553Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.6243640Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.6244278Z log.info( 2025-08-14T20:43:47.6245133Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.6246047Z ) 2025-08-14T20:43:47.6246445Z enabled = True 2025-08-14T20:43:47.6246740Z 2025-08-14T20:43:47.6246905Z if enabled: 2025-08-14T20:43:47.6247314Z label = experiment_name 2025-08-14T20:43:47.6247857Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.6248675Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.6249779Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.6250688Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.6251354Z if is_canary: 2025-08-14T20:43:47.6251842Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.6252531Z fleet_prefix = label 2025-08-14T20:43:47.6253014Z else: 2025-08-14T20:43:47.6253428Z prefixes.append(label) 2025-08-14T20:43:47.6253776Z 2025-08-14T20:43:47.6253953Z if len(prefixes) > 1: 2025-08-14T20:43:47.6254381Z log.error( 2025-08-14T20:43:47.6255406Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.6256551Z ) 2025-08-14T20:43:47.6256936Z prefixes = prefixes[:1] 2025-08-14T20:43:47.6257248Z 2025-08-14T20:43:47.6257431Z # Fleet always comes first 2025-08-14T20:43:47.6257885Z if fleet_prefix: 2025-08-14T20:43:47.6258329Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.6258692Z 2025-08-14T20:43:47.6259076Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.6259755Z 2025-08-14T20:43:47.6259766Z 2025-08-14T20:43:47.6260233Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.6261008Z """ 2025-08-14T20:43:47.6261575Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.6262132Z 2025-08-14T20:43:47.6262509Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.6263198Z """ 2025-08-14T20:43:47.6263586Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.6264119Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.6264741Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.6265183Z 2025-08-14T20:43:47.6265190Z 2025-08-14T20:43:47.6265594Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.6266348Z for _ in range(num_retries): 2025-08-14T20:43:47.6266822Z try: 2025-08-14T20:43:47.6267234Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.6267894Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.6268524Z return json.loads(content) 2025-08-14T20:43:47.6269040Z except Exception as e: 2025-08-14T20:43:47.6269827Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.6270258Z 2025-08-14T20:43:47.6270634Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.6271339Z return {} 2025-08-14T20:43:47.6271555Z 2025-08-14T20:43:47.6271562Z 2025-08-14T20:43:47.6271713Z @cache 2025-08-14T20:43:47.6272331Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.6273083Z """ 2025-08-14T20:43:47.6273459Z Dynamically get PR information 2025-08-14T20:43:47.6273952Z """ 2025-08-14T20:43:47.6274595Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.6275218Z headers = { 2025-08-14T20:43:47.6275664Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.6276263Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.6276785Z } 2025-08-14T20:43:47.6277206Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.6277798Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.6278337Z headers=headers, 2025-08-14T20:43:47.6278754Z ) 2025-08-14T20:43:47.6278947Z 2025-08-14T20:43:47.6279127Z if not json_response: 2025-08-14T20:43:47.6279813Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.6280419Z return {} 2025-08-14T20:43:47.6280655Z 2025-08-14T20:43:47.6280831Z return json_response 2025-08-14T20:43:47.6281100Z 2025-08-14T20:43:47.6281106Z 2025-08-14T20:43:47.6281503Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.6282227Z """ 2025-08-14T20:43:47.6282749Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.6283406Z """ 2025-08-14T20:43:47.6283882Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.6284479Z return { 2025-08-14T20:43:47.6285062Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.6285751Z } 2025-08-14T20:43:47.6285948Z 2025-08-14T20:43:47.6285955Z 2025-08-14T20:43:47.6286120Z def main() -> None: 2025-08-14T20:43:47.6286529Z args = parse_args() 2025-08-14T20:43:47.6286796Z 2025-08-14T20:43:47.6287015Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.6287397Z 2025-08-14T20:43:47.6287588Z # Check if the PR is opt-out 2025-08-14T20:43:47.6288063Z if args.pr_number: 2025-08-14T20:43:47.6288708Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.6289756Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.6290304Z log.info( 2025-08-14T20:43:47.6290991Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.6291761Z ) 2025-08-14T20:43:47.6292305Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6292961Z sys.exit() 2025-08-14T20:43:47.6293215Z 2025-08-14T20:43:47.6293376Z try: 2025-08-14T20:43:47.6293796Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.6294499Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.6295128Z ) 2025-08-14T20:43:47.6295335Z 2025-08-14T20:43:47.6295534Z username = get_potential_pr_author( 2025-08-14T20:43:47.6296069Z args.github_token, 2025-08-14T20:43:47.6296540Z args.github_repo, 2025-08-14T20:43:47.6297010Z args.github_actor, 2025-08-14T20:43:47.6297487Z args.github_ref_type, 2025-08-14T20:43:47.6297980Z args.github_branch, 2025-08-14T20:43:47.6298428Z ) 2025-08-14T20:43:47.6298634Z 2025-08-14T20:43:47.6298918Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.6299366Z 2025-08-14T20:43:47.6299693Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.6300250Z rollout_state, 2025-08-14T20:43:47.6300718Z (args.github_issue_owner, username), 2025-08-14T20:43:47.6301258Z args.github_branch, 2025-08-14T20:43:47.6301746Z args.eligible_experiments, 2025-08-14T20:43:47.6302269Z args.opt_out_experiments, 2025-08-14T20:43:47.6302768Z is_canary, 2025-08-14T20:43:47.6303169Z ) 2025-08-14T20:43:47.6303373Z 2025-08-14T20:43:47.6303556Z except Exception as e: 2025-08-14T20:43:47.6303988Z log.error( 2025-08-14T20:43:47.6304653Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.6305569Z ) 2025-08-14T20:43:47.6305777Z 2025-08-14T20:43:47.6306100Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6306589Z 2025-08-14T20:43:47.6306595Z 2025-08-14T20:43:47.6306775Z if __name__ == "__main__": 2025-08-14T20:43:47.6307196Z main() 2025-08-14T20:43:47.6307404Z 2025-08-14T20:43:47.6394964Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6395831Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6434850Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.6435329Z env: 2025-08-14T20:43:47.6435926Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.6436336Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.6436766Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.6437265Z ISSUE_OWNER: 2025-08-14T20:43:47.6437655Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.6438088Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:47.6438523Z PR_NUMBER: 2025-08-14T20:43:47.6438906Z ##[endgroup] 2025-08-14T20:43:50.5286903Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:52.5057046Z Collecting urllib3==1.26.18 2025-08-14T20:43:52.5515623Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:52.5750381Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.8 MB/s eta 0:00:00 2025-08-14T20:43:52.6029256Z Collecting PyGithub==2.3.0 2025-08-14T20:43:52.6100586Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:52.6568312Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:52.6637672Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:52.6681663Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:52.6697545Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:52.6712346Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:52.6984745Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:52.7052857Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:52.7275210Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:52.8647354Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:52.8721409Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:52.9880894Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:52.9967167Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:53.0178633Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:53.0255214Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:53.0516329Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:53.0612695Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.3 MB/s eta 0:00:00 2025-08-14T20:43:53.0683159Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:53.0780479Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 43.8 MB/s eta 0:00:00 2025-08-14T20:43:53.0867658Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:53.0972807Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 96.2 MB/s eta 0:00:00 2025-08-14T20:43:53.1043927Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:53.1152990Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:53.1219119Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 100.8 MB/s eta 0:00:00 2025-08-14T20:43:53.1293573Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:53.1334841Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 30.8 MB/s eta 0:00:00 2025-08-14T20:43:53.1403072Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:53.1445107Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.3 MB/s eta 0:00:00 2025-08-14T20:43:53.5824496Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:54.1080347Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:54.1878832Z ##[group]Run curr_branch="main" 2025-08-14T20:43:54.1879137Z curr_branch="main" 2025-08-14T20:43:54.1879363Z curr_ref_type="branch" 2025-08-14T20:43:54.1879891Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:54.1880159Z  2025-08-14T20:43:54.1880346Z python3 runner_determinator.py \ 2025-08-14T20:43:54.1880627Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:54.1880899Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:54.1881158Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:54.1881424Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:54.1881696Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:54.1881976Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:54.1882242Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:54.1882542Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:54.1882903Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:54.1883190Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:54.1925224Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:54.1925448Z env: 2025-08-14T20:43:54.1925988Z GITHUB_TOKEN: *** 2025-08-14T20:43:54.1926174Z ISSUE_NUMBER: 5132 2025-08-14T20:43:54.1926381Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:54.1926608Z ISSUE_OWNER: 2025-08-14T20:43:54.1926790Z CHECK_EXPERIMENTS: 2025-08-14T20:43:54.1926989Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:54.1927180Z PR_NUMBER: 2025-08-14T20:43:54.1927351Z ##[endgroup] 2025-08-14T20:43:54.1986217Z Current branch is 'main' 2025-08-14T20:43:56.0374012Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-08-14T20:43:56.0375404Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:56.0376169Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:56.0376728Z INFO : Setting output: label-type='' 2025-08-14T20:43:56.0688971Z Evaluate and set job outputs 2025-08-14T20:43:56.0695793Z Cleaning up orphan processes