2025-08-14T20:43:47.7917895Z Current runner version: '2.327.1' 2025-08-14T20:43:47.7940913Z ##[group]Runner Image Provisioner 2025-08-14T20:43:47.7941799Z Hosted Compute Agent 2025-08-14T20:43:47.7942356Z Version: 20250812.370 2025-08-14T20:43:47.7942923Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.7943665Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.7944227Z ##[endgroup] 2025-08-14T20:43:47.7944786Z ##[group]Operating System 2025-08-14T20:43:47.7945347Z Ubuntu 2025-08-14T20:43:47.7945828Z 24.04.2 2025-08-14T20:43:47.7946288Z LTS 2025-08-14T20:43:47.7946769Z ##[endgroup] 2025-08-14T20:43:47.7947275Z ##[group]Runner Image 2025-08-14T20:43:47.7947810Z Image: ubuntu-24.04 2025-08-14T20:43:47.7948571Z Version: 20250804.2.0 2025-08-14T20:43:47.7949569Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.7951096Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:47.7952101Z ##[endgroup] 2025-08-14T20:43:47.7953067Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.7955215Z Contents: read 2025-08-14T20:43:47.7955726Z Metadata: read 2025-08-14T20:43:47.7956208Z ##[endgroup] 2025-08-14T20:43:47.7958816Z Secret source: Actions 2025-08-14T20:43:47.7959566Z Prepare workflow directory 2025-08-14T20:43:47.8464258Z Prepare all required actions 2025-08-14T20:43:47.8521721Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.8526498Z ##[group] Inputs 2025-08-14T20:43:47.8527060Z check_experiments: 2025-08-14T20:43:47.8527598Z opt_out_experiments: 2025-08-14T20:43:47.8528491Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.8529138Z issue_owner: 2025-08-14T20:43:47.8529630Z curr_branch: main 2025-08-14T20:43:47.8530191Z curr_ref_type: branch 2025-08-14T20:43:47.8530819Z issue_number: 5132 2025-08-14T20:43:47.8531308Z ##[endgroup] 2025-08-14T20:43:47.8532085Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:43:48.5765818Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:48.5768447Z cat < runner_determinator.py 2025-08-14T20:43:48.5769182Z # flake8: noqa: G004 2025-08-14T20:43:48.5769724Z  2025-08-14T20:43:48.5770601Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:48.5771703Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:48.5772663Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:48.5773468Z  2025-08-14T20:43:48.5773901Z """ 2025-08-14T20:43:48.5774648Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:48.5775716Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:48.5776980Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:48.5777947Z of which runners should be used to run which job. 2025-08-14T20:43:48.5779127Z  2025-08-14T20:43:48.5779878Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:48.5780913Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:48.5782044Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:48.5782911Z list, defined. 2025-08-14T20:43:48.5783436Z  2025-08-14T20:43:48.5784217Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:48.5785281Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:48.5786284Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:48.5787074Z  2025-08-14T20:43:48.5788122Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:48.5789396Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:48.5790374Z experiments which the user could be opted in to. 2025-08-14T20:43:48.5791082Z  2025-08-14T20:43:48.5791572Z The user list has the following rules: 2025-08-14T20:43:48.5792266Z  2025-08-14T20:43:48.5792944Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:48.5793994Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:48.5794983Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:48.5795636Z  2025-08-14T20:43:48.5796110Z Example config: 2025-08-14T20:43:48.5796749Z  # A list of experiments that can be opted into. 2025-08-14T20:43:48.5797635Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:48.5798583Z  # Expected syntax is: 2025-08-14T20:43:48.5799426Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:48.5800573Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:48.5801425Z  2025-08-14T20:43:48.5801947Z  experiments: 2025-08-14T20:43:48.5802503Z  lf: 2025-08-14T20:43:48.5803029Z  rollout_percent: 25 2025-08-14T20:43:48.5879201Z  all_branches: false 2025-08-14T20:43:48.5880300Z  default: true 2025-08-14T20:43:48.5881159Z  --- 2025-08-14T20:43:48.5881872Z  2025-08-14T20:43:48.5882571Z  # Opt-ins: 2025-08-14T20:43:48.5883787Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:48.5885457Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:48.5886379Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:48.5887127Z  # Experiments should be from the above list. 2025-08-14T20:43:48.5887710Z  2025-08-14T20:43:48.5888116Z  @User1,-lf,split_build 2025-08-14T20:43:48.5888916Z  @User2,lf 2025-08-14T20:43:48.5889391Z  @User3,split_build 2025-08-14T20:43:48.5889881Z """ 2025-08-14T20:43:48.5890264Z  2025-08-14T20:43:48.5890649Z import json 2025-08-14T20:43:48.5891083Z import logging 2025-08-14T20:43:48.5891525Z import os 2025-08-14T20:43:48.5891957Z import random 2025-08-14T20:43:48.5892392Z import re 2025-08-14T20:43:48.5892815Z import sys 2025-08-14T20:43:48.5893291Z from argparse import ArgumentParser 2025-08-14T20:43:48.5893951Z from collections.abc import Iterable 2025-08-14T20:43:48.5894542Z from functools import cache 2025-08-14T20:43:48.5895076Z from logging import LogRecord 2025-08-14T20:43:48.5895642Z from typing import Any, NamedTuple 2025-08-14T20:43:48.5896275Z from urllib.request import Request, urlopen 2025-08-14T20:43:48.5896858Z  2025-08-14T20:43:48.5897240Z import yaml 2025-08-14T20:43:48.5897703Z from github import Auth, Github 2025-08-14T20:43:48.5898467Z from github.Issue import Issue 2025-08-14T20:43:48.5899008Z  2025-08-14T20:43:48.5899381Z  2025-08-14T20:43:48.5899839Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:48.5900625Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:48.5901613Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:48.5902388Z  2025-08-14T20:43:48.5903064Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:48.5903700Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:48.5904296Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:48.5904941Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:48.5905500Z  2025-08-14T20:43:48.5905935Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:48.5906482Z  2025-08-14T20:43:48.5906890Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:48.5907414Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:48.5907909Z  2025-08-14T20:43:48.5908506Z  2025-08-14T20:43:48.5908935Z class Experiment(NamedTuple): 2025-08-14T20:43:48.5909494Z  rollout_perc: float = ( 2025-08-14T20:43:48.5910234Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:48.5910959Z  ) 2025-08-14T20:43:48.5911379Z  all_branches: bool = ( 2025-08-14T20:43:48.5912112Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:48.5912833Z  ) 2025-08-14T20:43:48.5913250Z  default: bool = ( 2025-08-14T20:43:48.5913901Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:48.5914601Z  ) 2025-08-14T20:43:48.5915001Z  2025-08-14T20:43:48.5915399Z  # Add more fields as needed 2025-08-14T20:43:48.5915925Z  2025-08-14T20:43:48.5916288Z  2025-08-14T20:43:48.5916692Z class Settings(NamedTuple): 2025-08-14T20:43:48.5917208Z  """ 2025-08-14T20:43:48.5917741Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:48.5918541Z  """ 2025-08-14T20:43:48.5918944Z  2025-08-14T20:43:48.5919384Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:48.5919952Z  2025-08-14T20:43:48.5920458Z  2025-08-14T20:43:48.5920916Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:48.5921629Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:48.5922263Z  2025-08-14T20:43:48.5922650Z  COLORS = { 2025-08-14T20:43:48.5923123Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:48.5923732Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:48.5924283Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:48.5924848Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:48.5925411Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:48.5925926Z  } 2025-08-14T20:43:48.5926313Z  2025-08-14T20:43:48.5926773Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:48.5927601Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:48.5928651Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:48.5929293Z  return super().format(record) 2025-08-14T20:43:48.5929826Z  2025-08-14T20:43:48.5930187Z  2025-08-14T20:43:48.5930603Z handler = logging.StreamHandler() 2025-08-14T20:43:48.5931436Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:48.5932212Z  2025-08-14T20:43:48.5932711Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:48.5933370Z log.addHandler(handler) 2025-08-14T20:43:48.5933894Z log.setLevel(logging.INFO) 2025-08-14T20:43:48.5934388Z  2025-08-14T20:43:48.5934753Z  2025-08-14T20:43:48.5935258Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:48.5935876Z  """ 2025-08-14T20:43:48.5936459Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:48.5937300Z  """ 2025-08-14T20:43:48.5937719Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:48.5939068Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:48.5940279Z  log.warning( 2025-08-14T20:43:48.5941239Z  "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:48.5942227Z  ) 2025-08-14T20:43:48.5942728Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:48.5943323Z  return 2025-08-14T20:43:48.5943754Z  2025-08-14T20:43:48.5944183Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:48.5944822Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:48.5945453Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:48.5945982Z  2025-08-14T20:43:48.5946355Z  2025-08-14T20:43:48.5946913Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:48.5947617Z  return frozenset( 2025-08-14T20:43:48.5948553Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:48.5949358Z  ) 2025-08-14T20:43:48.5949759Z  2025-08-14T20:43:48.5950136Z  2025-08-14T20:43:48.5950537Z def parse_args() -> Any: 2025-08-14T20:43:48.5951211Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:48.5952164Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:48.5952989Z  parser.add_argument( 2025-08-14T20:43:48.5953516Z  "--github-issue-repo", 2025-08-14T20:43:48.5954054Z  type=str, 2025-08-14T20:43:48.5954539Z  required=False, 2025-08-14T20:43:48.5955207Z  default="pytorch/test-infra", 2025-08-14T20:43:48.5955842Z  help="GitHub repo to get the issue", 2025-08-14T20:43:48.5956402Z  ) 2025-08-14T20:43:48.5956829Z  parser.add_argument( 2025-08-14T20:43:48.5957342Z  "--github-repo", 2025-08-14T20:43:48.5957832Z  type=str, 2025-08-14T20:43:48.5958486Z  required=True, 2025-08-14T20:43:48.5959056Z  help="GitHub repo where CI is running", 2025-08-14T20:43:48.5959620Z  ) 2025-08-14T20:43:48.5960040Z  parser.add_argument( 2025-08-14T20:43:48.5960748Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:48.5961459Z  ) 2025-08-14T20:43:48.5961888Z  parser.add_argument( 2025-08-14T20:43:48.5962622Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:48.5963367Z  ) 2025-08-14T20:43:48.5963786Z  parser.add_argument( 2025-08-14T20:43:48.5964525Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:48.5965265Z  ) 2025-08-14T20:43:48.5965678Z  parser.add_argument( 2025-08-14T20:43:48.5966436Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:48.5967194Z  ) 2025-08-14T20:43:48.5967630Z  parser.add_argument( 2025-08-14T20:43:48.5968162Z  "--github-ref-type", 2025-08-14T20:43:48.5969034Z  type=str, 2025-08-14T20:43:48.5969525Z  required=True, 2025-08-14T20:43:48.5970113Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:48.5970709Z  ) 2025-08-14T20:43:48.5971125Z  parser.add_argument( 2025-08-14T20:43:48.5971826Z  "--eligible-experiments", 2025-08-14T20:43:48.5972431Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:48.5973008Z  required=False, 2025-08-14T20:43:48.5973499Z  default="", 2025-08-14T20:43:48.5974451Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:48.5975434Z  ) 2025-08-14T20:43:48.5975867Z  parser.add_argument( 2025-08-14T20:43:48.5976397Z  "--opt-out-experiments", 2025-08-14T20:43:48.5976984Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:48.5977560Z  required=False, 2025-08-14T20:43:48.5978049Z  default="", 2025-08-14T20:43:48.5978774Z  help=( 2025-08-14T20:43:48.5979565Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:48.5980799Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:48.5981704Z  ), 2025-08-14T20:43:48.5982109Z  ) 2025-08-14T20:43:48.5982535Z  parser.add_argument( 2025-08-14T20:43:48.5983043Z  "--pr-number", 2025-08-14T20:43:48.5983537Z  type=str, 2025-08-14T20:43:48.5984006Z  required=False, 2025-08-14T20:43:48.5984500Z  default="", 2025-08-14T20:43:48.5985093Z  help="the optional PR number where this is run", 2025-08-14T20:43:48.5985696Z  ) 2025-08-14T20:43:48.5986084Z  2025-08-14T20:43:48.5986489Z  return parser.parse_args() 2025-08-14T20:43:48.5987011Z  2025-08-14T20:43:48.5987374Z  2025-08-14T20:43:48.5988031Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.5989232Z  auth = Auth.Token(github_token) 2025-08-14T20:43:48.5989867Z  return Github(auth=auth) 2025-08-14T20:43:48.5990380Z  2025-08-14T20:43:48.5990750Z  2025-08-14T20:43:48.5991467Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.5992341Z  repo = gh.get_repo(repo) 2025-08-14T20:43:48.5992940Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:48.5993514Z  2025-08-14T20:43:48.5993889Z  2025-08-14T20:43:48.5994286Z def get_potential_pr_author( 2025-08-14T20:43:48.5995033Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:48.5995769Z ) -> str: 2025-08-14T20:43:48.5996356Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:48.5997271Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:48.5998106Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:48.5998927Z  2025-08-14T20:43:48.5999344Z  gh = get_gh_client(github_token) 2025-08-14T20:43:48.5999882Z  2025-08-14T20:43:48.6000411Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:48.6001113Z  split_tag = ref_name.split("/") 2025-08-14T20:43:48.6001670Z  if ( 2025-08-14T20:43:48.6002126Z  len(split_tag) == 3 2025-08-14T20:43:48.6002691Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:48.6003294Z  and split_tag[2].isnumeric() 2025-08-14T20:43:48.6003851Z  ): 2025-08-14T20:43:48.6004320Z  pr_number = split_tag[2] 2025-08-14T20:43:48.6004864Z  try: 2025-08-14T20:43:48.6005376Z  repository = gh.get_repo(repo) 2025-08-14T20:43:48.6006212Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:48.6006897Z  except Exception as e: 2025-08-14T20:43:48.6007491Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:48.6008426Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:48.6009177Z  ) from e 2025-08-14T20:43:48.6009821Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:48.6010610Z  # In all other cases, return the original input username 2025-08-14T20:43:48.6011270Z  return username 2025-08-14T20:43:48.6011738Z  2025-08-14T20:43:48.6012103Z  2025-08-14T20:43:48.6012574Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:48.6013164Z  """ 2025-08-14T20:43:48.6013897Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:48.6014753Z  """ 2025-08-14T20:43:48.6015374Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:48.6016102Z  2025-08-14T20:43:48.6016462Z  2025-08-14T20:43:48.6016893Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:48.6017445Z  try: 2025-08-14T20:43:48.6017892Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:48.6018634Z  return data 2025-08-14T20:43:48.6019138Z  except yaml.YAMLError: 2025-08-14T20:43:48.6019714Z  log.exception("Error loading YAML") 2025-08-14T20:43:48.6020281Z  raise 2025-08-14T20:43:48.6020705Z  2025-08-14T20:43:48.6021067Z  2025-08-14T20:43:48.6021747Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:48.6022553Z  """ 2025-08-14T20:43:48.6023389Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:48.6024251Z  2025-08-14T20:43:48.6024845Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.6025710Z  and the text below is the list of opted in users. 2025-08-14T20:43:48.6026315Z  2025-08-14T20:43:48.6026944Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:48.6027700Z  """ 2025-08-14T20:43:48.6028208Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:48.6029170Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:48.6029871Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:48.6030513Z  else: 2025-08-14T20:43:48.6030949Z  return "", rollout_state 2025-08-14T20:43:48.6031685Z  2025-08-14T20:43:48.6032098Z  2025-08-14T20:43:48.6032530Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:48.6033100Z  """ 2025-08-14T20:43:48.6033693Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:48.6034388Z  """ 2025-08-14T20:43:48.6034771Z  2025-08-14T20:43:48.6035131Z  2025-08-14T20:43:48.6035707Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:48.6036417Z  """ 2025-08-14T20:43:48.6037210Z  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:48.6038110Z  2025-08-14T20:43:48.6039428Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:48.6040511Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:48.6041434Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:48.6042119Z  2025-08-14T20:43:48.6042473Z  2025-08-14T20:43:48.6042825Z  """ 2025-08-14T20:43:48.6043237Z  optins = UserOptins() 2025-08-14T20:43:48.6043808Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:48.6044424Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:48.6045033Z  if not user or not user.startswith("@"): 2025-08-14T20:43:48.6045647Z  # Not a valid user. Skip 2025-08-14T20:43:48.6046189Z  continue 2025-08-14T20:43:48.6046639Z  2025-08-14T20:43:48.6047010Z  if user: 2025-08-14T20:43:48.6047564Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:48.6048629Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:48.6049358Z  2025-08-14T20:43:48.6049742Z  return optins 2025-08-14T20:43:48.6050200Z  2025-08-14T20:43:48.6050555Z  2025-08-14T20:43:48.6051083Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:48.6051757Z  """ 2025-08-14T20:43:48.6052222Z  Check if the experiment name is valid. 2025-08-14T20:43:48.6052791Z  A valid name: 2025-08-14T20:43:48.6053515Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:48.6054535Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:48.6055302Z  - Cannot contain spaces 2025-08-14T20:43:48.6055829Z  """ 2025-08-14T20:43:48.6056215Z  2025-08-14T20:43:48.6056705Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:48.6057491Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:48.6058482Z  2025-08-14T20:43:48.6058925Z  if valid: 2025-08-14T20:43:48.6059405Z  return True 2025-08-14T20:43:48.6059862Z  2025-08-14T20:43:48.6060240Z  log.error( 2025-08-14T20:43:48.6061813Z  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:48.6063448Z  ) 2025-08-14T20:43:48.6063854Z  return False 2025-08-14T20:43:48.6064301Z  2025-08-14T20:43:48.6064657Z  2025-08-14T20:43:48.6065225Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:48.6065916Z  """ 2025-08-14T20:43:48.6066573Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:48.6067361Z  """ 2025-08-14T20:43:48.6067753Z  try: 2025-08-14T20:43:48.6068178Z  if settings_text: 2025-08-14T20:43:48.6069119Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:48.6069980Z  # for easy reading 2025-08-14T20:43:48.6070874Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:48.6071839Z  # the backtick character in shell commands. 2025-08-14T20:43:48.6072515Z  backtick = chr(96) # backtick character 2025-08-14T20:43:48.6073275Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:48.6074010Z  settings = load_yaml(settings_text) 2025-08-14T20:43:48.6074577Z  2025-08-14T20:43:48.6075225Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:48.6076160Z  experiments = {} 2025-08-14T20:43:48.6076664Z  2025-08-14T20:43:48.6077278Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:48.6078104Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:48.6079405Z  # 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:48.6080520Z  continue 2025-08-14T20:43:48.6081016Z  2025-08-14T20:43:48.6081428Z  valid_settings = {} 2025-08-14T20:43:48.6082016Z  for setting in exp_settings: 2025-08-14T20:43:48.6082649Z  if setting not in Experiment._fields: 2025-08-14T20:43:48.6083268Z  log.warning( 2025-08-14T20:43:48.6084071Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:48.6084834Z  ) 2025-08-14T20:43:48.6085319Z  else: 2025-08-14T20:43:48.6085922Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:48.6086542Z  2025-08-14T20:43:48.6087068Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:48.6087794Z  return Settings(experiments) 2025-08-14T20:43:48.6088432Z  2025-08-14T20:43:48.6088828Z  except Exception: 2025-08-14T20:43:48.6089388Z  log.exception("Failed to parse settings") 2025-08-14T20:43:48.6089967Z  2025-08-14T20:43:48.6090351Z  return Settings() 2025-08-14T20:43:48.6090816Z  2025-08-14T20:43:48.6091177Z  2025-08-14T20:43:48.6091850Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:48.6092490Z  """ 2025-08-14T20:43:48.6092992Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:48.6093597Z  2025-08-14T20:43:48.6094190Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.6095032Z  and the text below is the list of opted in users. 2025-08-14T20:43:48.6095647Z  2025-08-14T20:43:48.6096304Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:48.6097089Z  """ 2025-08-14T20:43:48.6097719Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.6098678Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:48.6099265Z  2025-08-14T20:43:48.6099632Z  2025-08-14T20:43:48.6100130Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:48.6100754Z  """ 2025-08-14T20:43:48.6101208Z  Parse users from the rollout state. 2025-08-14T20:43:48.6101757Z  2025-08-14T20:43:48.6102124Z  """ 2025-08-14T20:43:48.6102728Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.6103556Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:48.6104138Z  2025-08-14T20:43:48.6104497Z  2025-08-14T20:43:48.6105170Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.6105976Z  """ 2025-08-14T20:43:48.6106458Z  Check if a user is opted into an experiment 2025-08-14T20:43:48.6107037Z  """ 2025-08-14T20:43:48.6107560Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:48.6108179Z  2025-08-14T20:43:48.6108799Z  2025-08-14T20:43:48.6109501Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.6110316Z  """ 2025-08-14T20:43:48.6110846Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:48.6111480Z  """ 2025-08-14T20:43:48.6112062Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:48.6112824Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:48.6113548Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:48.6114200Z  return False 2025-08-14T20:43:48.6114659Z  2025-08-14T20:43:48.6115154Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:48.6115805Z  log.warning( 2025-08-14T20:43:48.6116727Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:48.6117676Z  ) 2025-08-14T20:43:48.6118084Z  2025-08-14T20:43:48.6118566Z  return True 2025-08-14T20:43:48.6119011Z  2025-08-14T20:43:48.6119370Z  2025-08-14T20:43:48.6119762Z def get_runner_prefix( 2025-08-14T20:43:48.6120261Z  rollout_state: str, 2025-08-14T20:43:48.6120803Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:48.6121371Z  branch: str, 2025-08-14T20:43:48.6121952Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.6122696Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.6123339Z  is_canary: bool = False, 2025-08-14T20:43:48.6123888Z ) -> str: 2025-08-14T20:43:48.6124385Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:48.6125043Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:48.6125624Z  2025-08-14T20:43:48.6126131Z  fleet_prefix = "" 2025-08-14T20:43:48.6126634Z  prefixes = [] 2025-08-14T20:43:48.6127355Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:48.6128498Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:48.6129256Z  log.info( 2025-08-14T20:43:48.6130022Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:48.6130818Z  ) 2025-08-14T20:43:48.6131261Z  continue 2025-08-14T20:43:48.6131713Z  2025-08-14T20:43:48.6132110Z  if opt_out_experiments: 2025-08-14T20:43:48.6132717Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:48.6133437Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:48.6134090Z  log.info( 2025-08-14T20:43:48.6135124Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:48.6136149Z  ) 2025-08-14T20:43:48.6136623Z  continue 2025-08-14T20:43:48.6137102Z  2025-08-14T20:43:48.6137509Z  if eligible_experiments: 2025-08-14T20:43:48.6138148Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:48.6138958Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:48.6139560Z  log.info( 2025-08-14T20:43:48.6140423Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:48.6141321Z  ) 2025-08-14T20:43:48.6141912Z  continue 2025-08-14T20:43:48.6142480Z  elif not experiment_settings.default: 2025-08-14T20:43:48.6143067Z  log.info( 2025-08-14T20:43:48.6143814Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:48.6144600Z  ) 2025-08-14T20:43:48.6145027Z  continue 2025-08-14T20:43:48.6145483Z  2025-08-14T20:43:48.6145997Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:48.6146677Z  opted_out_users = [ 2025-08-14T20:43:48.6147196Z  requestor 2025-08-14T20:43:48.6147735Z  for requestor in workflow_requestors 2025-08-14T20:43:48.6148590Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.6149268Z  ] 2025-08-14T20:43:48.6149677Z  2025-08-14T20:43:48.6150075Z  if opted_out_users: 2025-08-14T20:43:48.6150612Z  log.info( 2025-08-14T20:43:48.6151333Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:48.6152090Z  ) 2025-08-14T20:43:48.6152531Z  continue 2025-08-14T20:43:48.6152993Z  2025-08-14T20:43:48.6153500Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:48.6154166Z  opted_in_users = [ 2025-08-14T20:43:48.6154701Z  requestor 2025-08-14T20:43:48.6155245Z  for requestor in workflow_requestors 2025-08-14T20:43:48.6155998Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.6156678Z  ] 2025-08-14T20:43:48.6157082Z  2025-08-14T20:43:48.6157471Z  enabled = False 2025-08-14T20:43:48.6157979Z  if opted_in_users: 2025-08-14T20:43:48.6158728Z  log.info( 2025-08-14T20:43:48.6159441Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:48.6160178Z  ) 2025-08-14T20:43:48.6160628Z  enabled = True 2025-08-14T20:43:48.6161114Z  2025-08-14T20:43:48.6161562Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:48.6162474Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:48.6163505Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:48.6164201Z  log.info( 2025-08-14T20:43:48.6165167Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:48.6166149Z  ) 2025-08-14T20:43:48.6166626Z  enabled = True 2025-08-14T20:43:48.6167138Z  2025-08-14T20:43:48.6167518Z  if enabled: 2025-08-14T20:43:48.6168018Z  label = experiment_name 2025-08-14T20:43:48.6168751Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.6169658Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.6170604Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.6171433Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.6172149Z  if is_canary: 2025-08-14T20:43:48.6172716Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.6173317Z  fleet_prefix = label 2025-08-14T20:43:48.6173857Z  else: 2025-08-14T20:43:48.6174494Z  prefixes.append(label) 2025-08-14T20:43:48.6175036Z  2025-08-14T20:43:48.6175428Z  if len(prefixes) > 1: 2025-08-14T20:43:48.6175935Z  log.error( 2025-08-14T20:43:48.6177081Z  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:48.6178369Z  ) 2025-08-14T20:43:48.6178823Z  prefixes = prefixes[:1] 2025-08-14T20:43:48.6179339Z  2025-08-14T20:43:48.6179738Z  # Fleet always comes first 2025-08-14T20:43:48.6180273Z  if fleet_prefix: 2025-08-14T20:43:48.6180794Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.6181338Z  2025-08-14T20:43:48.6181836Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.6182438Z  2025-08-14T20:43:48.6182813Z  2025-08-14T20:43:48.6183508Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.6184337Z  """ 2025-08-14T20:43:48.6184995Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.6185750Z  2025-08-14T20:43:48.6186369Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.6187114Z  """ 2025-08-14T20:43:48.6187561Z  gh = get_gh_client(github_token) 2025-08-14T20:43:48.6188178Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.6188990Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.6189633Z  2025-08-14T20:43:48.6189987Z  2025-08-14T20:43:48.6190640Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.6191584Z  for _ in range(num_retries): 2025-08-14T20:43:48.6192127Z  try: 2025-08-14T20:43:48.6192625Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:48.6193352Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.6194068Z  return json.loads(content) 2025-08-14T20:43:48.6194641Z  except Exception as e: 2025-08-14T20:43:48.6195261Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.6195853Z  2025-08-14T20:43:48.6196477Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.6197249Z  return {} 2025-08-14T20:43:48.6197666Z  2025-08-14T20:43:48.6198031Z  2025-08-14T20:43:48.6198597Z @cache 2025-08-14T20:43:48.6199300Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.6200112Z  """ 2025-08-14T20:43:48.6200559Z  Dynamically get PR information 2025-08-14T20:43:48.6201089Z  """ 2025-08-14T20:43:48.6201651Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.6202325Z  headers = { 2025-08-14T20:43:48.6202857Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.6203529Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:48.6204096Z  } 2025-08-14T20:43:48.6204590Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.6205257Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.6205847Z  headers=headers, 2025-08-14T20:43:48.6206339Z  ) 2025-08-14T20:43:48.6206716Z  2025-08-14T20:43:48.6207112Z  if not json_response: 2025-08-14T20:43:48.6207775Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.6208700Z  return {} 2025-08-14T20:43:48.6209151Z  2025-08-14T20:43:48.6209545Z  return json_response 2025-08-14T20:43:48.6210028Z  2025-08-14T20:43:48.6210391Z  2025-08-14T20:43:48.6211033Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.6211810Z  """ 2025-08-14T20:43:48.6212412Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.6213109Z  """ 2025-08-14T20:43:48.6213677Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.6214337Z  return { 2025-08-14T20:43:48.6214991Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.6215717Z  } 2025-08-14T20:43:48.6216095Z  2025-08-14T20:43:48.6216467Z  2025-08-14T20:43:48.6216851Z def main() -> None: 2025-08-14T20:43:48.6217342Z  args = parse_args() 2025-08-14T20:43:48.6217820Z  2025-08-14T20:43:48.6218376Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.6218955Z  2025-08-14T20:43:48.6219364Z  # Check if the PR is opt-out 2025-08-14T20:43:48.6219904Z  if args.pr_number: 2025-08-14T20:43:48.6220664Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.6221479Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.6222024Z  log.info( 2025-08-14T20:43:48.6222808Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.6223639Z  ) 2025-08-14T20:43:48.6224287Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.6225036Z  sys.exit() 2025-08-14T20:43:48.6225637Z  2025-08-14T20:43:48.6226017Z  try: 2025-08-14T20:43:48.6226515Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.6227322Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.6228002Z  ) 2025-08-14T20:43:48.6228515Z  2025-08-14T20:43:48.6228946Z  username = get_potential_pr_author( 2025-08-14T20:43:48.6229540Z  args.github_token, 2025-08-14T20:43:48.6230085Z  args.github_repo, 2025-08-14T20:43:48.6230622Z  args.github_actor, 2025-08-14T20:43:48.6231176Z  args.github_ref_type, 2025-08-14T20:43:48.6231732Z  args.github_branch, 2025-08-14T20:43:48.6232249Z  ) 2025-08-14T20:43:48.6232644Z  2025-08-14T20:43:48.6233170Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.6233833Z  2025-08-14T20:43:48.6234282Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.6234884Z  rollout_state, 2025-08-14T20:43:48.6235443Z  (args.github_issue_owner, username), 2025-08-14T20:43:48.6236044Z  args.github_branch, 2025-08-14T20:43:48.6236607Z  args.eligible_experiments, 2025-08-14T20:43:48.6237205Z  args.opt_out_experiments, 2025-08-14T20:43:48.6237764Z  is_canary, 2025-08-14T20:43:48.6238336Z  ) 2025-08-14T20:43:48.6238755Z  2025-08-14T20:43:48.6239152Z  except Exception as e: 2025-08-14T20:43:48.6239676Z  log.error( 2025-08-14T20:43:48.6240441Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.6241383Z  ) 2025-08-14T20:43:48.6241783Z  2025-08-14T20:43:48.6242360Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.6243066Z  2025-08-14T20:43:48.6243424Z  2025-08-14T20:43:48.6243809Z if __name__ == "__main__": 2025-08-14T20:43:48.6244319Z  main() 2025-08-14T20:43:48.6244731Z  2025-08-14T20:43:48.6245088Z EOF 2025-08-14T20:43:48.6245482Z  2025-08-14T20:43:48.6245883Z cat runner_determinator.py 2025-08-14T20:43:48.8861270Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.8862159Z env: 2025-08-14T20:43:48.8862862Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.8863306Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.8863775Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.8864301Z ISSUE_OWNER: 2025-08-14T20:43:48.8864726Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.8865173Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.8865624Z PR_NUMBER: 2025-08-14T20:43:48.8866046Z ##[endgroup] 2025-08-14T20:43:48.9102538Z # flake8: noqa: G004 2025-08-14T20:43:48.9102880Z 2025-08-14T20:43:48.9103307Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:48.9104251Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:48.9105050Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:48.9105495Z 2025-08-14T20:43:48.9105660Z """ 2025-08-14T20:43:48.9106229Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:48.9107153Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:48.9108043Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:48.9109108Z of which runners should be used to run which job. 2025-08-14T20:43:48.9109516Z 2025-08-14T20:43:48.9109899Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:48.9111000Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:48.9111902Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:48.9112603Z list, defined. 2025-08-14T20:43:48.9112836Z 2025-08-14T20:43:48.9113199Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:48.9114168Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:48.9115005Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:48.9115447Z 2025-08-14T20:43:48.9115818Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:48.9116687Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:48.9117426Z experiments which the user could be opted in to. 2025-08-14T20:43:48.9117833Z 2025-08-14T20:43:48.9118040Z The user list has the following rules: 2025-08-14T20:43:48.9118688Z 2025-08-14T20:43:48.9119096Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:48.9119977Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:48.9120751Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:48.9121148Z 2025-08-14T20:43:48.9121326Z Example config: 2025-08-14T20:43:48.9121781Z # A list of experiments that can be opted into. 2025-08-14T20:43:48.9122449Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:48.9123069Z # Expected syntax is: 2025-08-14T20:43:48.9123713Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:48.9124704Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:48.9125321Z 2025-08-14T20:43:48.9125490Z experiments: 2025-08-14T20:43:48.9125885Z lf: 2025-08-14T20:43:48.9126259Z rollout_percent: 25 2025-08-14T20:43:48.9126908Z all_branches: false 2025-08-14T20:43:48.9127375Z default: true 2025-08-14T20:43:48.9127791Z --- 2025-08-14T20:43:48.9127995Z 2025-08-14T20:43:48.9128162Z # Opt-ins: 2025-08-14T20:43:48.9128997Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:48.9129873Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:48.9130655Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:48.9131318Z # Experiments should be from the above list. 2025-08-14T20:43:48.9131694Z 2025-08-14T20:43:48.9131877Z @User1,-lf,split_build 2025-08-14T20:43:48.9132319Z @User2,lf 2025-08-14T20:43:48.9132697Z @User3,split_build 2025-08-14T20:43:48.9133103Z """ 2025-08-14T20:43:48.9133294Z 2025-08-14T20:43:48.9133455Z import json 2025-08-14T20:43:48.9133836Z import logging 2025-08-14T20:43:48.9134214Z import os 2025-08-14T20:43:48.9134582Z import random 2025-08-14T20:43:48.9134947Z import re 2025-08-14T20:43:48.9135326Z import sys 2025-08-14T20:43:48.9135737Z from argparse import ArgumentParser 2025-08-14T20:43:48.9136270Z from collections.abc import Iterable 2025-08-14T20:43:48.9136803Z from functools import cache 2025-08-14T20:43:48.9137272Z from logging import LogRecord 2025-08-14T20:43:48.9137759Z from typing import Any, NamedTuple 2025-08-14T20:43:48.9138551Z from urllib.request import Request, urlopen 2025-08-14T20:43:48.9138965Z 2025-08-14T20:43:48.9139137Z import yaml 2025-08-14T20:43:48.9139528Z from github import Auth, Github 2025-08-14T20:43:48.9140022Z from github.Issue import Issue 2025-08-14T20:43:48.9140329Z 2025-08-14T20:43:48.9140335Z 2025-08-14T20:43:48.9140556Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:48.9141247Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:48.9142116Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:48.9142681Z 2025-08-14T20:43:48.9142909Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:48.9143634Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:48.9144154Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:48.9144706Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:48.9145060Z 2025-08-14T20:43:48.9145262Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:48.9145608Z 2025-08-14T20:43:48.9145793Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:48.9146264Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:48.9146545Z 2025-08-14T20:43:48.9146552Z 2025-08-14T20:43:48.9146741Z class Experiment(NamedTuple): 2025-08-14T20:43:48.9147223Z rollout_perc: float = ( 2025-08-14T20:43:48.9147859Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:48.9148767Z ) 2025-08-14T20:43:48.9149144Z all_branches: bool = ( 2025-08-14T20:43:48.9149768Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:48.9150452Z ) 2025-08-14T20:43:48.9150818Z default: bool = ( 2025-08-14T20:43:48.9151385Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:48.9152016Z ) 2025-08-14T20:43:48.9152214Z 2025-08-14T20:43:48.9152396Z # Add more fields as needed 2025-08-14T20:43:48.9152704Z 2025-08-14T20:43:48.9152710Z 2025-08-14T20:43:48.9152900Z class Settings(NamedTuple): 2025-08-14T20:43:48.9153337Z """ 2025-08-14T20:43:48.9153797Z Settings for the experiments that can be opted into. 2025-08-14T20:43:48.9154368Z """ 2025-08-14T20:43:48.9154563Z 2025-08-14T20:43:48.9154780Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:48.9155143Z 2025-08-14T20:43:48.9155150Z 2025-08-14T20:43:48.9155358Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:48.9155972Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:48.9156410Z 2025-08-14T20:43:48.9156578Z COLORS = { 2025-08-14T20:43:48.9156977Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:48.9157641Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:48.9158144Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:48.9158850Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:48.9159329Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:48.9159803Z } 2025-08-14T20:43:48.9159997Z 2025-08-14T20:43:48.9160214Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:48.9160959Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:48.9161740Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:48.9162315Z return super().format(record) 2025-08-14T20:43:48.9162643Z 2025-08-14T20:43:48.9162650Z 2025-08-14T20:43:48.9162847Z handler = logging.StreamHandler() 2025-08-14T20:43:48.9163542Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:48.9164107Z 2025-08-14T20:43:48.9164352Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:48.9164944Z log.addHandler(handler) 2025-08-14T20:43:48.9165393Z log.setLevel(logging.INFO) 2025-08-14T20:43:48.9165685Z 2025-08-14T20:43:48.9165692Z 2025-08-14T20:43:48.9165963Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:48.9166551Z """ 2025-08-14T20:43:48.9167062Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:48.9167683Z """ 2025-08-14T20:43:48.9168050Z if not GITHUB_OUTPUT: 2025-08-14T20:43:48.9169324Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:48.9170477Z log.warning( 2025-08-14T20:43:48.9171334Z "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:48.9172271Z ) 2025-08-14T20:43:48.9182234Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:48.9182851Z return 2025-08-14T20:43:48.9183088Z 2025-08-14T20:43:48.9183491Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:48.9184091Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:48.9184668Z f.write(f"{key}={value}\n") 2025-08-14T20:43:48.9184989Z 2025-08-14T20:43:48.9184997Z 2025-08-14T20:43:48.9185304Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:48.9185959Z return frozenset( 2025-08-14T20:43:48.9186589Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:48.9187280Z ) 2025-08-14T20:43:48.9187482Z 2025-08-14T20:43:48.9187490Z 2025-08-14T20:43:48.9187669Z def parse_args() -> Any: 2025-08-14T20:43:48.9188460Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:48.9189348Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:48.9240225Z parser.add_argument( 2025-08-14T20:43:48.9240835Z "--github-issue-repo", 2025-08-14T20:43:48.9241387Z type=str, 2025-08-14T20:43:48.9241824Z required=False, 2025-08-14T20:43:48.9242276Z default="pytorch/test-infra", 2025-08-14T20:43:48.9242826Z help="GitHub repo to get the issue", 2025-08-14T20:43:48.9243337Z ) 2025-08-14T20:43:48.9243705Z parser.add_argument( 2025-08-14T20:43:48.9244149Z "--github-repo", 2025-08-14T20:43:48.9244572Z type=str, 2025-08-14T20:43:48.9244977Z required=True, 2025-08-14T20:43:48.9245434Z help="GitHub repo where CI is running", 2025-08-14T20:43:48.9245957Z ) 2025-08-14T20:43:48.9246319Z parser.add_argument( 2025-08-14T20:43:48.9246922Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:48.9247585Z ) 2025-08-14T20:43:48.9247953Z parser.add_argument( 2025-08-14T20:43:48.9248790Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:48.9249484Z ) 2025-08-14T20:43:48.9249857Z parser.add_argument( 2025-08-14T20:43:48.9250725Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:48.9251423Z ) 2025-08-14T20:43:48.9251785Z parser.add_argument( 2025-08-14T20:43:48.9252452Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:48.9253157Z ) 2025-08-14T20:43:48.9253521Z parser.add_argument( 2025-08-14T20:43:48.9253970Z "--github-ref-type", 2025-08-14T20:43:48.9254422Z type=str, 2025-08-14T20:43:48.9254805Z required=True, 2025-08-14T20:43:48.9255280Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:48.9255831Z ) 2025-08-14T20:43:48.9256187Z parser.add_argument( 2025-08-14T20:43:48.9256648Z "--eligible-experiments", 2025-08-14T20:43:48.9257159Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.9257677Z required=False, 2025-08-14T20:43:48.9258086Z default="", 2025-08-14T20:43:48.9259068Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:48.9260000Z ) 2025-08-14T20:43:48.9260368Z parser.add_argument( 2025-08-14T20:43:48.9260827Z "--opt-out-experiments", 2025-08-14T20:43:48.9261326Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.9261848Z required=False, 2025-08-14T20:43:48.9262259Z default="", 2025-08-14T20:43:48.9262659Z help=( 2025-08-14T20:43:48.9263328Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:48.9264468Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:48.9265292Z ), 2025-08-14T20:43:48.9265658Z ) 2025-08-14T20:43:48.9266026Z parser.add_argument( 2025-08-14T20:43:48.9266474Z "--pr-number", 2025-08-14T20:43:48.9266890Z type=str, 2025-08-14T20:43:48.9267281Z required=False, 2025-08-14T20:43:48.9267707Z default="", 2025-08-14T20:43:48.9268410Z help="the optional PR number where this is run", 2025-08-14T20:43:48.9269056Z ) 2025-08-14T20:43:48.9269411Z 2025-08-14T20:43:48.9269663Z return parser.parse_args() 2025-08-14T20:43:48.9269988Z 2025-08-14T20:43:48.9269995Z 2025-08-14T20:43:48.9270403Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.9271157Z auth = Auth.Token(github_token) 2025-08-14T20:43:48.9271656Z return Github(auth=auth) 2025-08-14T20:43:48.9271947Z 2025-08-14T20:43:48.9271955Z 2025-08-14T20:43:48.9272409Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.9273197Z repo = gh.get_repo(repo) 2025-08-14T20:43:48.9273695Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:48.9274059Z 2025-08-14T20:43:48.9274065Z 2025-08-14T20:43:48.9274243Z def get_potential_pr_author( 2025-08-14T20:43:48.9274890Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:48.9275573Z ) -> str: 2025-08-14T20:43:48.9276080Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:48.9276871Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:48.9277617Z # embedded in the tag name: ciflow// 2025-08-14T20:43:48.9278035Z 2025-08-14T20:43:48.9278342Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.9278743Z 2025-08-14T20:43:48.9279024Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:48.9279647Z split_tag = ref_name.split("/") 2025-08-14T20:43:48.9280146Z if ( 2025-08-14T20:43:48.9280527Z len(split_tag) == 3 2025-08-14T20:43:48.9281007Z and split_tag[0] == "ciflow" 2025-08-14T20:43:48.9281525Z and split_tag[2].isnumeric() 2025-08-14T20:43:48.9282019Z ): 2025-08-14T20:43:48.9282393Z pr_number = split_tag[2] 2025-08-14T20:43:48.9283048Z try: 2025-08-14T20:43:48.9283474Z repository = gh.get_repo(repo) 2025-08-14T20:43:48.9284080Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:48.9284681Z except Exception as e: 2025-08-14T20:43:48.9285184Z raise Exception( # noqa: TRY002 2025-08-14T20:43:48.9285846Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:48.9286480Z ) from e 2025-08-14T20:43:48.9287014Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:48.9287710Z # In all other cases, return the original input username 2025-08-14T20:43:48.9288464Z return username 2025-08-14T20:43:48.9288710Z 2025-08-14T20:43:48.9288719Z 2025-08-14T20:43:48.9288942Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:48.9289480Z """ 2025-08-14T20:43:48.9290117Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:48.9290891Z """ 2025-08-14T20:43:48.9291433Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:48.9291951Z 2025-08-14T20:43:48.9291958Z 2025-08-14T20:43:48.9292149Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:48.9292644Z try: 2025-08-14T20:43:48.9293022Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:48.9293530Z return data 2025-08-14T20:43:48.9293962Z except yaml.YAMLError: 2025-08-14T20:43:48.9294446Z log.exception("Error loading YAML") 2025-08-14T20:43:48.9294966Z raise 2025-08-14T20:43:48.9295187Z 2025-08-14T20:43:48.9295194Z 2025-08-14T20:43:48.9295606Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:48.9296350Z """ 2025-08-14T20:43:48.9296962Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:48.9297569Z 2025-08-14T20:43:48.9298047Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.9298959Z and the text below is the list of opted in users. 2025-08-14T20:43:48.9299388Z 2025-08-14T20:43:48.9299757Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:48.9300473Z """ 2025-08-14T20:43:48.9300914Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:48.9301510Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:48.9302110Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:48.9302694Z else: 2025-08-14T20:43:48.9303063Z return "", rollout_state 2025-08-14T20:43:48.9303371Z 2025-08-14T20:43:48.9303379Z 2025-08-14T20:43:48.9303576Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:48.9304092Z """ 2025-08-14T20:43:48.9304602Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:48.9305250Z """ 2025-08-14T20:43:48.9305451Z 2025-08-14T20:43:48.9305458Z 2025-08-14T20:43:48.9305797Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:48.9306451Z """ 2025-08-14T20:43:48.9307188Z 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:48.9307877Z 2025-08-14T20:43:48.9308620Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:48.9309624Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:48.9310304Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:48.9310805Z 2025-08-14T20:43:48.9310812Z 2025-08-14T20:43:48.9310971Z """ 2025-08-14T20:43:48.9311339Z optins = UserOptins() 2025-08-14T20:43:48.9311827Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:48.9312384Z user = user.strip("\r\n\t -") 2025-08-14T20:43:48.9312928Z if not user or not user.startswith("@"): 2025-08-14T20:43:48.9313638Z # Not a valid user. Skip 2025-08-14T20:43:48.9314123Z continue 2025-08-14T20:43:48.9314372Z 2025-08-14T20:43:48.9314533Z if user: 2025-08-14T20:43:48.9314965Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:48.9315663Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:48.9316159Z 2025-08-14T20:43:48.9316331Z return optins 2025-08-14T20:43:48.9316563Z 2025-08-14T20:43:48.9316569Z 2025-08-14T20:43:48.9316852Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:48.9317457Z """ 2025-08-14T20:43:48.9317850Z Check if the experiment name is valid. 2025-08-14T20:43:48.9318490Z A valid name: 2025-08-14T20:43:48.9319118Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:48.9320050Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:48.9320770Z - Cannot contain spaces 2025-08-14T20:43:48.9321228Z """ 2025-08-14T20:43:48.9321423Z 2025-08-14T20:43:48.9321687Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:48.9322385Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:48.9322836Z 2025-08-14T20:43:48.9322996Z if valid: 2025-08-14T20:43:48.9323364Z return True 2025-08-14T20:43:48.9323602Z 2025-08-14T20:43:48.9323760Z log.error( 2025-08-14T20:43:48.9325211Z 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:48.9326833Z ) 2025-08-14T20:43:48.9327188Z return False 2025-08-14T20:43:48.9327417Z 2025-08-14T20:43:48.9327423Z 2025-08-14T20:43:48.9327725Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:48.9328502Z """ 2025-08-14T20:43:48.9329259Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:48.9330011Z """ 2025-08-14T20:43:48.9330367Z try: 2025-08-14T20:43:48.9330733Z if settings_text: 2025-08-14T20:43:48.9331466Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:48.9332252Z # for easy reading 2025-08-14T20:43:48.9333033Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:48.9333926Z # the backtick character in shell commands. 2025-08-14T20:43:48.9334522Z backtick = chr(96) # backtick character 2025-08-14T20:43:48.9335187Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:48.9335848Z settings = load_yaml(settings_text) 2025-08-14T20:43:48.9336219Z 2025-08-14T20:43:48.9336626Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:48.9337376Z experiments = {} 2025-08-14T20:43:48.9337680Z 2025-08-14T20:43:48.9338062Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:48.9338943Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:48.9340054Z # 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:48.9341106Z continue 2025-08-14T20:43:48.9341389Z 2025-08-14T20:43:48.9341569Z valid_settings = {} 2025-08-14T20:43:48.9342087Z for setting in exp_settings: 2025-08-14T20:43:48.9342636Z if setting not in Experiment._fields: 2025-08-14T20:43:48.9343187Z log.warning( 2025-08-14T20:43:48.9343886Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:48.9344756Z ) 2025-08-14T20:43:48.9345184Z else: 2025-08-14T20:43:48.9345685Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:48.9346115Z 2025-08-14T20:43:48.9346387Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:48.9347017Z return Settings(experiments) 2025-08-14T20:43:48.9347377Z 2025-08-14T20:43:48.9347551Z except Exception: 2025-08-14T20:43:48.9348029Z log.exception("Failed to parse settings") 2025-08-14T20:43:48.9348523Z 2025-08-14T20:43:48.9348694Z return Settings() 2025-08-14T20:43:48.9348951Z 2025-08-14T20:43:48.9348957Z 2025-08-14T20:43:48.9349211Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:48.9349777Z """ 2025-08-14T20:43:48.9350203Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:48.9350605Z 2025-08-14T20:43:48.9350946Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.9351716Z and the text below is the list of opted in users. 2025-08-14T20:43:48.9352125Z 2025-08-14T20:43:48.9352540Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:48.9353271Z """ 2025-08-14T20:43:48.9353821Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.9354589Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:48.9354997Z 2025-08-14T20:43:48.9355004Z 2025-08-14T20:43:48.9355248Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:48.9355811Z """ 2025-08-14T20:43:48.9356204Z Parse users from the rollout state. 2025-08-14T20:43:48.9356558Z 2025-08-14T20:43:48.9356721Z """ 2025-08-14T20:43:48.9357238Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.9357980Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:48.9358499Z 2025-08-14T20:43:48.9358505Z 2025-08-14T20:43:48.9359050Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.9359812Z """ 2025-08-14T20:43:48.9360226Z Check if a user is opted into an experiment 2025-08-14T20:43:48.9360765Z """ 2025-08-14T20:43:48.9361220Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:48.9361642Z 2025-08-14T20:43:48.9361650Z 2025-08-14T20:43:48.9362066Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.9362814Z """ 2025-08-14T20:43:48.9363261Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:48.9363846Z """ 2025-08-14T20:43:48.9364357Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:48.9365049Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:48.9365691Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:48.9366293Z return False 2025-08-14T20:43:48.9366551Z 2025-08-14T20:43:48.9366823Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:48.9367421Z log.warning( 2025-08-14T20:43:48.9368376Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:48.9369302Z ) 2025-08-14T20:43:48.9369507Z 2025-08-14T20:43:48.9369670Z return True 2025-08-14T20:43:48.9369905Z 2025-08-14T20:43:48.9369912Z 2025-08-14T20:43:48.9370093Z def get_runner_prefix( 2025-08-14T20:43:48.9370523Z rollout_state: str, 2025-08-14T20:43:48.9370983Z workflow_requestors: Iterable[str], 2025-08-14T20:43:48.9371496Z branch: str, 2025-08-14T20:43:48.9371978Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.9372633Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.9373216Z is_canary: bool = False, 2025-08-14T20:43:48.9373666Z ) -> str: 2025-08-14T20:43:48.9374257Z settings = parse_settings(rollout_state) 2025-08-14T20:43:48.9374849Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:48.9375221Z 2025-08-14T20:43:48.9375389Z fleet_prefix = "" 2025-08-14T20:43:48.9375810Z prefixes = [] 2025-08-14T20:43:48.9376429Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:48.9377371Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:48.9378081Z log.info( 2025-08-14T20:43:48.9379287Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:48.9380052Z ) 2025-08-14T20:43:48.9380426Z continue 2025-08-14T20:43:48.9380675Z 2025-08-14T20:43:48.9380868Z if opt_out_experiments: 2025-08-14T20:43:48.9381389Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:48.9382036Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:48.9382625Z log.info( 2025-08-14T20:43:48.9383558Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:48.9384552Z ) 2025-08-14T20:43:48.9384943Z continue 2025-08-14T20:43:48.9385206Z 2025-08-14T20:43:48.9385397Z if eligible_experiments: 2025-08-14T20:43:48.9385941Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:48.9386582Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:48.9387133Z log.info( 2025-08-14T20:43:48.9387915Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:48.9388882Z ) 2025-08-14T20:43:48.9389267Z continue 2025-08-14T20:43:48.9389757Z elif not experiment_settings.default: 2025-08-14T20:43:48.9390299Z log.info( 2025-08-14T20:43:48.9391114Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:48.9391874Z ) 2025-08-14T20:43:48.9392253Z continue 2025-08-14T20:43:48.9392497Z 2025-08-14T20:43:48.9392775Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:48.9393403Z opted_out_users = [ 2025-08-14T20:43:48.9393852Z requestor 2025-08-14T20:43:48.9394306Z for requestor in workflow_requestors 2025-08-14T20:43:48.9394979Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.9395601Z ] 2025-08-14T20:43:48.9395802Z 2025-08-14T20:43:48.9395981Z if opted_out_users: 2025-08-14T20:43:48.9396415Z log.info( 2025-08-14T20:43:48.9397031Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:48.9397725Z ) 2025-08-14T20:43:48.9398101Z continue 2025-08-14T20:43:48.9398468Z 2025-08-14T20:43:48.9398749Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:48.9399366Z opted_in_users = [ 2025-08-14T20:43:48.9399800Z requestor 2025-08-14T20:43:48.9400242Z for requestor in workflow_requestors 2025-08-14T20:43:48.9400906Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.9401522Z ] 2025-08-14T20:43:48.9401723Z 2025-08-14T20:43:48.9401889Z enabled = False 2025-08-14T20:43:48.9402312Z if opted_in_users: 2025-08-14T20:43:48.9402749Z log.info( 2025-08-14T20:43:48.9403342Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:48.9404021Z ) 2025-08-14T20:43:48.9404414Z enabled = True 2025-08-14T20:43:48.9404695Z 2025-08-14T20:43:48.9404910Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:48.9405772Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:48.9406866Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:48.9407565Z log.info( 2025-08-14T20:43:48.9408541Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:48.9409479Z ) 2025-08-14T20:43:48.9409880Z enabled = True 2025-08-14T20:43:48.9410183Z 2025-08-14T20:43:48.9410346Z if enabled: 2025-08-14T20:43:48.9410768Z label = experiment_name 2025-08-14T20:43:48.9411311Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.9412152Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.9413032Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.9413791Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.9414471Z if is_canary: 2025-08-14T20:43:48.9414952Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.9415496Z fleet_prefix = label 2025-08-14T20:43:48.9415979Z else: 2025-08-14T20:43:48.9416403Z prefixes.append(label) 2025-08-14T20:43:48.9416754Z 2025-08-14T20:43:48.9416938Z if len(prefixes) > 1: 2025-08-14T20:43:48.9417374Z log.error( 2025-08-14T20:43:48.9418511Z 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:48.9419643Z ) 2025-08-14T20:43:48.9420032Z prefixes = prefixes[:1] 2025-08-14T20:43:48.9420343Z 2025-08-14T20:43:48.9420525Z # Fleet always comes first 2025-08-14T20:43:48.9420993Z if fleet_prefix: 2025-08-14T20:43:48.9421439Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.9421807Z 2025-08-14T20:43:48.9422194Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.9422623Z 2025-08-14T20:43:48.9422630Z 2025-08-14T20:43:48.9423078Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.9423860Z """ 2025-08-14T20:43:48.9424443Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.9425006Z 2025-08-14T20:43:48.9425391Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.9426101Z """ 2025-08-14T20:43:48.9426477Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.9427014Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.9427651Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.9428096Z 2025-08-14T20:43:48.9428102Z 2025-08-14T20:43:48.9428609Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.9429383Z for _ in range(num_retries): 2025-08-14T20:43:48.9429857Z try: 2025-08-14T20:43:48.9430293Z req = Request(url=url, headers=headers) 2025-08-14T20:43:48.9430966Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.9431612Z return json.loads(content) 2025-08-14T20:43:48.9432130Z except Exception as e: 2025-08-14T20:43:48.9432654Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.9433058Z 2025-08-14T20:43:48.9433436Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.9434144Z return {} 2025-08-14T20:43:48.9434381Z 2025-08-14T20:43:48.9434387Z 2025-08-14T20:43:48.9434540Z @cache 2025-08-14T20:43:48.9435152Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.9435910Z """ 2025-08-14T20:43:48.9436294Z Dynamically get PR information 2025-08-14T20:43:48.9436771Z """ 2025-08-14T20:43:48.9437408Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.9438064Z headers = { 2025-08-14T20:43:48.9438629Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.9439234Z "Authorization": f"token {github_token}", 2025-08-14T20:43:48.9439769Z } 2025-08-14T20:43:48.9440186Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.9440796Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.9441340Z headers=headers, 2025-08-14T20:43:48.9441764Z ) 2025-08-14T20:43:48.9441956Z 2025-08-14T20:43:48.9442139Z if not json_response: 2025-08-14T20:43:48.9442693Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.9443315Z return {} 2025-08-14T20:43:48.9443547Z 2025-08-14T20:43:48.9443719Z return json_response 2025-08-14T20:43:48.9444005Z 2025-08-14T20:43:48.9444011Z 2025-08-14T20:43:48.9444409Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.9445144Z """ 2025-08-14T20:43:48.9445664Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.9446323Z """ 2025-08-14T20:43:48.9446808Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.9447425Z return { 2025-08-14T20:43:48.9447993Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.9448808Z } 2025-08-14T20:43:48.9449005Z 2025-08-14T20:43:48.9449012Z 2025-08-14T20:43:48.9449182Z def main() -> None: 2025-08-14T20:43:48.9449598Z args = parse_args() 2025-08-14T20:43:48.9449862Z 2025-08-14T20:43:48.9450081Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.9450471Z 2025-08-14T20:43:48.9450661Z # Check if the PR is opt-out 2025-08-14T20:43:48.9451151Z if args.pr_number: 2025-08-14T20:43:48.9451798Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.9452689Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.9453192Z log.info( 2025-08-14T20:43:48.9453910Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.9454690Z ) 2025-08-14T20:43:48.9455233Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.9455913Z sys.exit() 2025-08-14T20:43:48.9456173Z 2025-08-14T20:43:48.9456329Z try: 2025-08-14T20:43:48.9456756Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.9457463Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.9458104Z ) 2025-08-14T20:43:48.9458419Z 2025-08-14T20:43:48.9458622Z username = get_potential_pr_author( 2025-08-14T20:43:48.9459165Z args.github_token, 2025-08-14T20:43:48.9459633Z args.github_repo, 2025-08-14T20:43:48.9460103Z args.github_actor, 2025-08-14T20:43:48.9460584Z args.github_ref_type, 2025-08-14T20:43:48.9461069Z args.github_branch, 2025-08-14T20:43:48.9461525Z ) 2025-08-14T20:43:48.9461726Z 2025-08-14T20:43:48.9462005Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.9462458Z 2025-08-14T20:43:48.9462668Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.9463211Z rollout_state, 2025-08-14T20:43:48.9463687Z (args.github_issue_owner, username), 2025-08-14T20:43:48.9464221Z args.github_branch, 2025-08-14T20:43:48.9464709Z args.eligible_experiments, 2025-08-14T20:43:48.9465242Z args.opt_out_experiments, 2025-08-14T20:43:48.9465735Z is_canary, 2025-08-14T20:43:48.9466141Z ) 2025-08-14T20:43:48.9466346Z 2025-08-14T20:43:48.9466528Z except Exception as e: 2025-08-14T20:43:48.9466977Z log.error( 2025-08-14T20:43:48.9467638Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.9468656Z ) 2025-08-14T20:43:48.9468863Z 2025-08-14T20:43:48.9469198Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.9469697Z 2025-08-14T20:43:48.9469703Z 2025-08-14T20:43:48.9469876Z if __name__ == "__main__": 2025-08-14T20:43:48.9470309Z main() 2025-08-14T20:43:48.9470517Z 2025-08-14T20:43:48.9562435Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.9563347Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.9604478Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.9604955Z env: 2025-08-14T20:43:48.9605594Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.9606004Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.9606472Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.9607087Z ISSUE_OWNER: 2025-08-14T20:43:48.9607483Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.9607897Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.9608450Z PR_NUMBER: 2025-08-14T20:43:48.9608898Z ##[endgroup] 2025-08-14T20:43:49.7425012Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:50.6762626Z Collecting urllib3==1.26.18 2025-08-14T20:43:50.7087528Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:50.7409088Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-08-14T20:43:50.7538808Z Collecting PyGithub==2.3.0 2025-08-14T20:43:50.7575330Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:50.7985453Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:50.8014103Z 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:50.8059925Z 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:50.8076697Z 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:50.8091188Z 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:50.8318604Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:50.8343929Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:50.8571304Z 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:50.9667142Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.9790232Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:51.0922544Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:51.0954818Z 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:51.1167348Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:51.1205824Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:51.1423509Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:51.1501127Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 22.4 MB/s eta 0:00:00 2025-08-14T20:43:51.1593850Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:51.1682694Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 48.9 MB/s eta 0:00:00 2025-08-14T20:43:51.1711923Z 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:51.1820130Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 93.1 MB/s eta 0:00:00 2025-08-14T20:43:51.1865286Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:51.1974708Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:51.2051794Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 78.6 MB/s eta 0:00:00 2025-08-14T20:43:51.2077228Z 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:51.2118567Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 31.2 MB/s eta 0:00:00 2025-08-14T20:43:51.2182252Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:51.2230332Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 33.7 MB/s eta 0:00:00 2025-08-14T20:43:51.5403232Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:52.0810972Z 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:52.1611069Z ##[group]Run curr_branch="main" 2025-08-14T20:43:52.1611376Z curr_branch="main" 2025-08-14T20:43:52.1611594Z curr_ref_type="branch" 2025-08-14T20:43:52.1611872Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:52.1612119Z  2025-08-14T20:43:52.1612304Z python3 runner_determinator.py \ 2025-08-14T20:43:52.1612578Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:52.1612854Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:52.1613126Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:52.1613397Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:52.1613683Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:52.1613957Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:52.1614230Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:52.1614528Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:52.1614890Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:52.1615175Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:52.1658669Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:52.1659098Z env: 2025-08-14T20:43:52.1659968Z GITHUB_TOKEN: *** 2025-08-14T20:43:52.1660292Z ISSUE_NUMBER: 5132 2025-08-14T20:43:52.1660678Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:52.1660919Z ISSUE_OWNER: 2025-08-14T20:43:52.1661109Z CHECK_EXPERIMENTS: 2025-08-14T20:43:52.1661299Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:52.1661489Z PR_NUMBER: 2025-08-14T20:43:52.1661661Z ##[endgroup] 2025-08-14T20:43:52.1720234Z Current branch is 'main' 2025-08-14T20:43:53.7809026Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-08-14T20:43:53.7810252Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:53.7811606Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:53.7812521Z INFO : Setting output: label-type='lf.' 2025-08-14T20:43:53.8122436Z Evaluate and set job outputs 2025-08-14T20:43:53.8129241Z Set output 'label-type' 2025-08-14T20:43:53.8131025Z Cleaning up orphan processes