2025-08-26T19:31:42.9753258Z Current runner version: '2.328.0' 2025-08-26T19:31:42.9776681Z ##[group]Runner Image Provisioner 2025-08-26T19:31:42.9777609Z Hosted Compute Agent 2025-08-26T19:31:42.9778119Z Version: 20250818.377 2025-08-26T19:31:42.9778696Z Commit: 3c593e9f75fe0b87e893bca80d6e12ba089c61fc 2025-08-26T19:31:42.9779478Z Build Date: 2025-08-18T14:52:18Z 2025-08-26T19:31:42.9780039Z ##[endgroup] 2025-08-26T19:31:42.9780536Z ##[group]Operating System 2025-08-26T19:31:42.9781115Z Ubuntu 2025-08-26T19:31:42.9781592Z 24.04.2 2025-08-26T19:31:42.9782019Z LTS 2025-08-26T19:31:42.9782549Z ##[endgroup] 2025-08-26T19:31:42.9782997Z ##[group]Runner Image 2025-08-26T19:31:42.9783532Z Image: ubuntu-24.04 2025-08-26T19:31:42.9784082Z Version: 20250818.1.0 2025-08-26T19:31:42.9785327Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:42.9786947Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:42.9787850Z ##[endgroup] 2025-08-26T19:31:42.9788877Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:42.9791086Z Contents: read 2025-08-26T19:31:42.9791593Z Metadata: read 2025-08-26T19:31:42.9792516Z ##[endgroup] 2025-08-26T19:31:42.9795177Z Secret source: Actions 2025-08-26T19:31:42.9796113Z Prepare workflow directory 2025-08-26T19:31:43.0289758Z Prepare all required actions 2025-08-26T19:31:43.0345369Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:43.0350793Z ##[group] Inputs 2025-08-26T19:31:43.0351367Z check_experiments: 2025-08-26T19:31:43.0351986Z opt_out_experiments: 2025-08-26T19:31:43.0352549Z triggering_actor: pytorchmergebot 2025-08-26T19:31:43.0353109Z issue_owner: 2025-08-26T19:31:43.0353707Z curr_branch: main 2025-08-26T19:31:43.0354192Z curr_ref_type: branch 2025-08-26T19:31:43.0354818Z issue_number: 5132 2025-08-26T19:31:43.0355571Z ##[endgroup] 2025-08-26T19:31:43.0356223Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-26T19:31:43.5557250Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:43.5559637Z cat < runner_determinator.py 2025-08-26T19:31:43.5560397Z # flake8: noqa: G004 2025-08-26T19:31:43.5560993Z  2025-08-26T19:31:43.5561762Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.5562895Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.5563871Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.5564617Z  2025-08-26T19:31:43.5565196Z """ 2025-08-26T19:31:43.5566039Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.5567092Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.5568338Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.5569318Z of which runners should be used to run which job. 2025-08-26T19:31:43.5570020Z  2025-08-26T19:31:43.5570811Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.5571859Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.5572919Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.5573852Z list, defined. 2025-08-26T19:31:43.5574353Z  2025-08-26T19:31:43.5575174Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.5576273Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.5577303Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.5578051Z  2025-08-26T19:31:43.5579063Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.5580141Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.5581027Z experiments which the user could be opted in to. 2025-08-26T19:31:43.5581761Z  2025-08-26T19:31:43.5582269Z The user list has the following rules: 2025-08-26T19:31:43.5582917Z  2025-08-26T19:31:43.5583669Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.5584696Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.5585966Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.5586605Z  2025-08-26T19:31:43.5587168Z Example config: 2025-08-26T19:31:43.5587804Z  # A list of experiments that can be opted into. 2025-08-26T19:31:43.5588614Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.5589464Z  # Expected syntax is: 2025-08-26T19:31:43.5590252Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.5591352Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.5671735Z  2025-08-26T19:31:43.5672186Z  experiments: 2025-08-26T19:31:43.5672644Z  lf: 2025-08-26T19:31:43.5673075Z  rollout_percent: 25 2025-08-26T19:31:43.5673604Z  all_branches: false 2025-08-26T19:31:43.5674108Z  default: true 2025-08-26T19:31:43.5674589Z  --- 2025-08-26T19:31:43.5675338Z  2025-08-26T19:31:43.5675739Z  # Opt-ins: 2025-08-26T19:31:43.5676421Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.5677632Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.5678497Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.5679229Z  # Experiments should be from the above list. 2025-08-26T19:31:43.5679801Z  2025-08-26T19:31:43.5680208Z  @User1,-lf,split_build 2025-08-26T19:31:43.5680718Z  @User2,lf 2025-08-26T19:31:43.5681177Z  @User3,split_build 2025-08-26T19:31:43.5681655Z """ 2025-08-26T19:31:43.5682034Z  2025-08-26T19:31:43.5682403Z import json 2025-08-26T19:31:43.5682832Z import logging 2025-08-26T19:31:43.5683275Z import os 2025-08-26T19:31:43.5683686Z import random 2025-08-26T19:31:43.5684123Z import re 2025-08-26T19:31:43.5684525Z import sys 2025-08-26T19:31:43.5685126Z from argparse import ArgumentParser 2025-08-26T19:31:43.5685802Z from collections.abc import Iterable 2025-08-26T19:31:43.5686389Z from functools import cache 2025-08-26T19:31:43.5686917Z from logging import LogRecord 2025-08-26T19:31:43.5687475Z from typing import Any, NamedTuple 2025-08-26T19:31:43.5688102Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.5688683Z  2025-08-26T19:31:43.5689061Z import yaml 2025-08-26T19:31:43.5689516Z from github import Auth, Github 2025-08-26T19:31:43.5690070Z from github.Issue import Issue 2025-08-26T19:31:43.5690581Z  2025-08-26T19:31:43.5690942Z  2025-08-26T19:31:43.5691399Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.5692161Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.5693126Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.5693895Z  2025-08-26T19:31:43.5694594Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.5695480Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.5696083Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.5696727Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.5697283Z  2025-08-26T19:31:43.5697720Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.5698257Z  2025-08-26T19:31:43.5698657Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.5699178Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.5699661Z  2025-08-26T19:31:43.5700022Z  2025-08-26T19:31:43.5700421Z class Experiment(NamedTuple): 2025-08-26T19:31:43.5700980Z  rollout_perc: float = ( 2025-08-26T19:31:43.5701718Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.5702443Z  ) 2025-08-26T19:31:43.5702858Z  all_branches: bool = ( 2025-08-26T19:31:43.5703629Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.5704356Z  ) 2025-08-26T19:31:43.5704763Z  default: bool = ( 2025-08-26T19:31:43.5705575Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.5706255Z  ) 2025-08-26T19:31:43.5706642Z  2025-08-26T19:31:43.5707041Z  # Add more fields as needed 2025-08-26T19:31:43.5707551Z  2025-08-26T19:31:43.5707910Z  2025-08-26T19:31:43.5708308Z class Settings(NamedTuple): 2025-08-26T19:31:43.5708811Z  """ 2025-08-26T19:31:43.5709344Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:43.5709966Z  """ 2025-08-26T19:31:43.5710345Z  2025-08-26T19:31:43.5710782Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.5711344Z  2025-08-26T19:31:43.5711859Z  2025-08-26T19:31:43.5712314Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.5713016Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.5713641Z  2025-08-26T19:31:43.5714015Z  COLORS = { 2025-08-26T19:31:43.5714486Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.5715262Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.5715829Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.5716386Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.5716945Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.5717463Z  } 2025-08-26T19:31:43.5717848Z  2025-08-26T19:31:43.5718296Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.5719117Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.5719964Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.5720585Z  return super().format(record) 2025-08-26T19:31:43.5721114Z  2025-08-26T19:31:43.5721472Z  2025-08-26T19:31:43.5721898Z handler = logging.StreamHandler() 2025-08-26T19:31:43.5722701Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.5723453Z  2025-08-26T19:31:43.5723949Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.5724586Z log.addHandler(handler) 2025-08-26T19:31:43.5725201Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.5725694Z  2025-08-26T19:31:43.5726060Z  2025-08-26T19:31:43.5726548Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.5727168Z  """ 2025-08-26T19:31:43.5727750Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.5728566Z  """ 2025-08-26T19:31:43.5728980Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:43.5730128Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:43.5731316Z  log.warning( 2025-08-26T19:31:43.5732249Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:43.5733229Z  ) 2025-08-26T19:31:43.5733725Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.5734303Z  return 2025-08-26T19:31:43.5734738Z  2025-08-26T19:31:43.5735372Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.5736016Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.5736639Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:43.5737178Z  2025-08-26T19:31:43.5737558Z  2025-08-26T19:31:43.5738102Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.5738820Z  return frozenset( 2025-08-26T19:31:43.5739516Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.5740241Z  ) 2025-08-26T19:31:43.5740637Z  2025-08-26T19:31:43.5741006Z  2025-08-26T19:31:43.5741396Z def parse_args() -> Any: 2025-08-26T19:31:43.5742052Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.5742994Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.5743810Z  parser.add_argument( 2025-08-26T19:31:43.5744346Z  "--github-issue-repo", 2025-08-26T19:31:43.5744873Z  type=str, 2025-08-26T19:31:43.5745542Z  required=False, 2025-08-26T19:31:43.5746208Z  default="pytorch/test-infra", 2025-08-26T19:31:43.5746827Z  help="GitHub repo to get the issue", 2025-08-26T19:31:43.5747393Z  ) 2025-08-26T19:31:43.5747812Z  parser.add_argument( 2025-08-26T19:31:43.5748328Z  "--github-repo", 2025-08-26T19:31:43.5748827Z  type=str, 2025-08-26T19:31:43.5749304Z  required=True, 2025-08-26T19:31:43.5749855Z  help="GitHub repo where CI is running", 2025-08-26T19:31:43.5750435Z  ) 2025-08-26T19:31:43.5750853Z  parser.add_argument( 2025-08-26T19:31:43.5751551Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.5752258Z  ) 2025-08-26T19:31:43.5752670Z  parser.add_argument( 2025-08-26T19:31:43.5753379Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.5754110Z  ) 2025-08-26T19:31:43.5754532Z  parser.add_argument( 2025-08-26T19:31:43.5755603Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.5756360Z  ) 2025-08-26T19:31:43.5756785Z  parser.add_argument( 2025-08-26T19:31:43.5757537Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.5758295Z  ) 2025-08-26T19:31:43.5758725Z  parser.add_argument( 2025-08-26T19:31:43.5759241Z  "--github-ref-type", 2025-08-26T19:31:43.5759753Z  type=str, 2025-08-26T19:31:43.5760228Z  required=True, 2025-08-26T19:31:43.5760815Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.5761417Z  ) 2025-08-26T19:31:43.5761834Z  parser.add_argument( 2025-08-26T19:31:43.5762525Z  "--eligible-experiments", 2025-08-26T19:31:43.5763114Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.5763684Z  required=False, 2025-08-26T19:31:43.5764175Z  default="", 2025-08-26T19:31:43.5765243Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.5766221Z  ) 2025-08-26T19:31:43.5766635Z  parser.add_argument( 2025-08-26T19:31:43.5767162Z  "--opt-out-experiments", 2025-08-26T19:31:43.5767736Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.5768309Z  required=False, 2025-08-26T19:31:43.5768795Z  default="", 2025-08-26T19:31:43.5769263Z  help=( 2025-08-26T19:31:43.5770017Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.5771213Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.5772096Z  ), 2025-08-26T19:31:43.5772507Z  ) 2025-08-26T19:31:43.5772927Z  parser.add_argument( 2025-08-26T19:31:43.5773426Z  "--pr-number", 2025-08-26T19:31:43.5773912Z  type=str, 2025-08-26T19:31:43.5774382Z  required=False, 2025-08-26T19:31:43.5774872Z  default="", 2025-08-26T19:31:43.5775660Z  help="the optional PR number where this is run", 2025-08-26T19:31:43.5776266Z  ) 2025-08-26T19:31:43.5776656Z  2025-08-26T19:31:43.5777063Z  return parser.parse_args() 2025-08-26T19:31:43.5777583Z  2025-08-26T19:31:43.5777943Z  2025-08-26T19:31:43.5778589Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.5779558Z  auth = Auth.Token(github_token) 2025-08-26T19:31:43.5780159Z  return Github(auth=auth) 2025-08-26T19:31:43.5780669Z  2025-08-26T19:31:43.5781035Z  2025-08-26T19:31:43.5781750Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.5782607Z  repo = gh.get_repo(repo) 2025-08-26T19:31:43.5783194Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.5783755Z  2025-08-26T19:31:43.5784118Z  2025-08-26T19:31:43.5784522Z def get_potential_pr_author( 2025-08-26T19:31:43.5785417Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.5786147Z ) -> str: 2025-08-26T19:31:43.5786733Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.5787628Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.5788462Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:43.5789075Z  2025-08-26T19:31:43.5789505Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.5790039Z  2025-08-26T19:31:43.5790556Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.5791248Z  split_tag = ref_name.split("/") 2025-08-26T19:31:43.5791806Z  if ( 2025-08-26T19:31:43.5792260Z  len(split_tag) == 3 2025-08-26T19:31:43.5792822Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:43.5793414Z  and split_tag[2].isnumeric() 2025-08-26T19:31:43.5793961Z  ): 2025-08-26T19:31:43.5794418Z  pr_number = split_tag[2] 2025-08-26T19:31:43.5795150Z  try: 2025-08-26T19:31:43.5795678Z  repository = gh.get_repo(repo) 2025-08-26T19:31:43.5796507Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.5797180Z  except Exception as e: 2025-08-26T19:31:43.5797771Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:43.5798503Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.5799211Z  ) from e 2025-08-26T19:31:43.5799839Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.5800615Z  # In all other cases, return the original input username 2025-08-26T19:31:43.5801259Z  return username 2025-08-26T19:31:43.5801717Z  2025-08-26T19:31:43.5802094Z  2025-08-26T19:31:43.5802563Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.5803150Z  """ 2025-08-26T19:31:43.5803907Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.5804745Z  """ 2025-08-26T19:31:43.5805457Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.5806169Z  2025-08-26T19:31:43.5806539Z  2025-08-26T19:31:43.5806965Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.5807515Z  try: 2025-08-26T19:31:43.5807964Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.5808527Z  return data 2025-08-26T19:31:43.5809013Z  except yaml.YAMLError: 2025-08-26T19:31:43.5809581Z  log.exception("Error loading YAML") 2025-08-26T19:31:43.5810143Z  raise 2025-08-26T19:31:43.5810573Z  2025-08-26T19:31:43.5810945Z  2025-08-26T19:31:43.5811602Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.5812398Z  """ 2025-08-26T19:31:43.5813215Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.5814015Z  2025-08-26T19:31:43.5814595Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.5815667Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.5816274Z  2025-08-26T19:31:43.5816890Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.5817639Z  """ 2025-08-26T19:31:43.5818145Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.5818804Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.5819483Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.5820320Z  else: 2025-08-26T19:31:43.5820808Z  return "", rollout_state 2025-08-26T19:31:43.5821324Z  2025-08-26T19:31:43.5821676Z  2025-08-26T19:31:43.5822111Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.5822658Z  """ 2025-08-26T19:31:43.5823244Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.5823929Z  """ 2025-08-26T19:31:43.5824314Z  2025-08-26T19:31:43.5824676Z  2025-08-26T19:31:43.5825393Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.5826095Z  """ 2025-08-26T19:31:43.5826873Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:43.5827741Z  2025-08-26T19:31:43.5828593Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:43.5829654Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.5830545Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.5831215Z  2025-08-26T19:31:43.5831575Z  2025-08-26T19:31:43.5831936Z  """ 2025-08-26T19:31:43.5832348Z  optins = UserOptins() 2025-08-26T19:31:43.5832913Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.5833523Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:43.5834131Z  if not user or not user.startswith("@"): 2025-08-26T19:31:43.5834737Z  # Not a valid user. Skip 2025-08-26T19:31:43.5835879Z  continue 2025-08-26T19:31:43.5836345Z  2025-08-26T19:31:43.5836755Z  if user: 2025-08-26T19:31:43.5837275Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.5838017Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.5838703Z  2025-08-26T19:31:43.5839093Z  return optins 2025-08-26T19:31:43.5839538Z  2025-08-26T19:31:43.5839890Z  2025-08-26T19:31:43.5840419Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.5841079Z  """ 2025-08-26T19:31:43.5841527Z  Check if the experiment name is valid. 2025-08-26T19:31:43.5842099Z  A valid name: 2025-08-26T19:31:43.5842810Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.5843808Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.5844565Z  - Cannot contain spaces 2025-08-26T19:31:43.5845274Z  """ 2025-08-26T19:31:43.5845666Z  2025-08-26T19:31:43.5846159Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.5846942Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.5847716Z  2025-08-26T19:31:43.5848370Z  if valid: 2025-08-26T19:31:43.5848821Z  return True 2025-08-26T19:31:43.5849267Z  2025-08-26T19:31:43.5849643Z  log.error( 2025-08-26T19:31:43.5851179Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:43.5852788Z  ) 2025-08-26T19:31:43.5853182Z  return False 2025-08-26T19:31:43.5853623Z  2025-08-26T19:31:43.5853979Z  2025-08-26T19:31:43.5854526Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.5855319Z  """ 2025-08-26T19:31:43.5855974Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.5856740Z  """ 2025-08-26T19:31:43.5857133Z  try: 2025-08-26T19:31:43.5857544Z  if settings_text: 2025-08-26T19:31:43.5858342Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:43.5859176Z  # for easy reading 2025-08-26T19:31:43.5860053Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.5861008Z  # the backtick character in shell commands. 2025-08-26T19:31:43.5861665Z  backtick = chr(96) # backtick character 2025-08-26T19:31:43.5862403Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.5863119Z  settings = load_yaml(settings_text) 2025-08-26T19:31:43.5863674Z  2025-08-26T19:31:43.5864304Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.5865330Z  experiments = {} 2025-08-26T19:31:43.5865826Z  2025-08-26T19:31:43.5866429Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.5867243Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.5868398Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:43.5869487Z  continue 2025-08-26T19:31:43.5869969Z  2025-08-26T19:31:43.5870373Z  valid_settings = {} 2025-08-26T19:31:43.5870949Z  for setting in exp_settings: 2025-08-26T19:31:43.5871565Z  if setting not in Experiment._fields: 2025-08-26T19:31:43.5872175Z  log.warning( 2025-08-26T19:31:43.5872958Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.5873713Z  ) 2025-08-26T19:31:43.5874194Z  else: 2025-08-26T19:31:43.5874782Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.5875489Z  2025-08-26T19:31:43.5876006Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.5876699Z  return Settings(experiments) 2025-08-26T19:31:43.5877234Z  2025-08-26T19:31:43.5877627Z  except Exception: 2025-08-26T19:31:43.5878180Z  log.exception("Failed to parse settings") 2025-08-26T19:31:43.5878747Z  2025-08-26T19:31:43.5879127Z  return Settings() 2025-08-26T19:31:43.5879583Z  2025-08-26T19:31:43.5879946Z  2025-08-26T19:31:43.5880565Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.5881190Z  """ 2025-08-26T19:31:43.5881682Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.5882272Z  2025-08-26T19:31:43.5882840Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.5883662Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.5884255Z  2025-08-26T19:31:43.5884888Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.5885758Z  """ 2025-08-26T19:31:43.5886364Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.5887189Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.5887766Z  2025-08-26T19:31:43.5888122Z  2025-08-26T19:31:43.5888615Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.5889223Z  """ 2025-08-26T19:31:43.5889683Z  Parse users from the rollout state. 2025-08-26T19:31:43.5890218Z  2025-08-26T19:31:43.5890580Z  """ 2025-08-26T19:31:43.5891170Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.5891986Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.5892566Z  2025-08-26T19:31:43.5892927Z  2025-08-26T19:31:43.5893586Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.5894372Z  """ 2025-08-26T19:31:43.5894852Z  Check if a user is opted into an experiment 2025-08-26T19:31:43.5895524Z  """ 2025-08-26T19:31:43.5896045Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.5896659Z  2025-08-26T19:31:43.5897154Z  2025-08-26T19:31:43.5897833Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.5898637Z  """ 2025-08-26T19:31:43.5899162Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.5899784Z  """ 2025-08-26T19:31:43.5900355Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.5901100Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.5901807Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.5902454Z  return False 2025-08-26T19:31:43.5902906Z  2025-08-26T19:31:43.5903411Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.5904086Z  log.warning( 2025-08-26T19:31:43.5905064Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.5905985Z  ) 2025-08-26T19:31:43.5906393Z  2025-08-26T19:31:43.5906763Z  return True 2025-08-26T19:31:43.5907204Z  2025-08-26T19:31:43.5907570Z  2025-08-26T19:31:43.5907957Z def get_runner_prefix( 2025-08-26T19:31:43.5908449Z  rollout_state: str, 2025-08-26T19:31:43.5908985Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:43.5909536Z  branch: str, 2025-08-26T19:31:43.5910100Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.5910845Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.5911476Z  is_canary: bool = False, 2025-08-26T19:31:43.5911976Z ) -> str: 2025-08-26T19:31:43.5912469Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:43.5913103Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.5913664Z  2025-08-26T19:31:43.5914166Z  fleet_prefix = "" 2025-08-26T19:31:43.5914664Z  prefixes = [] 2025-08-26T19:31:43.5915474Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.5916485Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.5917242Z  log.info( 2025-08-26T19:31:43.5917987Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.5918777Z  ) 2025-08-26T19:31:43.5919220Z  continue 2025-08-26T19:31:43.5919664Z  2025-08-26T19:31:43.5920058Z  if opt_out_experiments: 2025-08-26T19:31:43.5920662Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.5921375Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.5922012Z  log.info( 2025-08-26T19:31:43.5923023Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.5924034Z  ) 2025-08-26T19:31:43.5924763Z  continue 2025-08-26T19:31:43.5925574Z  2025-08-26T19:31:43.5926106Z  if eligible_experiments: 2025-08-26T19:31:43.5926753Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.5927436Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.5928075Z  log.info( 2025-08-26T19:31:43.5928929Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.5929801Z  ) 2025-08-26T19:31:43.5930422Z  continue 2025-08-26T19:31:43.5930970Z  elif not experiment_settings.default: 2025-08-26T19:31:43.5931540Z  log.info( 2025-08-26T19:31:43.5932264Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.5933036Z  ) 2025-08-26T19:31:43.5933466Z  continue 2025-08-26T19:31:43.5933911Z  2025-08-26T19:31:43.5934413Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.5935188Z  opted_out_users = [ 2025-08-26T19:31:43.5935698Z  requestor 2025-08-26T19:31:43.5936227Z  for requestor in workflow_requestors 2025-08-26T19:31:43.5936951Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.5937613Z  ] 2025-08-26T19:31:43.5938014Z  2025-08-26T19:31:43.5938415Z  if opted_out_users: 2025-08-26T19:31:43.5938939Z  log.info( 2025-08-26T19:31:43.5939647Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.5940375Z  ) 2025-08-26T19:31:43.5940805Z  continue 2025-08-26T19:31:43.5941249Z  2025-08-26T19:31:43.5941750Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.5942405Z  opted_in_users = [ 2025-08-26T19:31:43.5942932Z  requestor 2025-08-26T19:31:43.5943477Z  for requestor in workflow_requestors 2025-08-26T19:31:43.5944204Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.5944874Z  ] 2025-08-26T19:31:43.5945373Z  2025-08-26T19:31:43.5945761Z  enabled = False 2025-08-26T19:31:43.5946265Z  if opted_in_users: 2025-08-26T19:31:43.5946899Z  log.info( 2025-08-26T19:31:43.5947590Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.5948312Z  ) 2025-08-26T19:31:43.5948753Z  enabled = True 2025-08-26T19:31:43.5949242Z  2025-08-26T19:31:43.5949688Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.5950587Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.5951594Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.5952289Z  log.info( 2025-08-26T19:31:43.5953229Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.5954197Z  ) 2025-08-26T19:31:43.5954680Z  enabled = True 2025-08-26T19:31:43.5955296Z  2025-08-26T19:31:43.5955674Z  if enabled: 2025-08-26T19:31:43.5956180Z  label = experiment_name 2025-08-26T19:31:43.5956797Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.5957682Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.5958619Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.5959438Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.5960148Z  if is_canary: 2025-08-26T19:31:43.5960712Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.5961306Z  fleet_prefix = label 2025-08-26T19:31:43.5961848Z  else: 2025-08-26T19:31:43.5962475Z  prefixes.append(label) 2025-08-26T19:31:43.5963015Z  2025-08-26T19:31:43.5963402Z  if len(prefixes) > 1: 2025-08-26T19:31:43.5963911Z  log.error( 2025-08-26T19:31:43.5965136Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:43.5966297Z  ) 2025-08-26T19:31:43.5966754Z  prefixes = prefixes[:1] 2025-08-26T19:31:43.5967264Z  2025-08-26T19:31:43.5967665Z  # Fleet always comes first 2025-08-26T19:31:43.5968198Z  if fleet_prefix: 2025-08-26T19:31:43.5968717Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.5969263Z  2025-08-26T19:31:43.5969744Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.5970360Z  2025-08-26T19:31:43.5970726Z  2025-08-26T19:31:43.5971409Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.5972225Z  """ 2025-08-26T19:31:43.5972870Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.5973610Z  2025-08-26T19:31:43.5974224Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.5975066Z  """ 2025-08-26T19:31:43.5975514Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.5976126Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.5976827Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.5977465Z  2025-08-26T19:31:43.5977826Z  2025-08-26T19:31:43.5978468Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.5979407Z  for _ in range(num_retries): 2025-08-26T19:31:43.5979935Z  try: 2025-08-26T19:31:43.5980427Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:43.5981137Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.5981840Z  return json.loads(content) 2025-08-26T19:31:43.5982408Z  except Exception as e: 2025-08-26T19:31:43.5983028Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.5983618Z  2025-08-26T19:31:43.5984225Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.5985138Z  return {} 2025-08-26T19:31:43.5985569Z  2025-08-26T19:31:43.5985936Z  2025-08-26T19:31:43.5986295Z @cache 2025-08-26T19:31:43.5986984Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.5987791Z  """ 2025-08-26T19:31:43.5988232Z  Dynamically get PR information 2025-08-26T19:31:43.5988767Z  """ 2025-08-26T19:31:43.5989325Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.5989991Z  headers = { 2025-08-26T19:31:43.5990517Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.5991183Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:43.5991756Z  } 2025-08-26T19:31:43.5992247Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.5992905Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.5993486Z  headers=headers, 2025-08-26T19:31:43.5993967Z  ) 2025-08-26T19:31:43.5994347Z  2025-08-26T19:31:43.5994743Z  if not json_response: 2025-08-26T19:31:43.5995489Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.5996303Z  return {} 2025-08-26T19:31:43.5996756Z  2025-08-26T19:31:43.5997143Z  return json_response 2025-08-26T19:31:43.5997625Z  2025-08-26T19:31:43.5997981Z  2025-08-26T19:31:43.5998615Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.5999380Z  """ 2025-08-26T19:31:43.5999966Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.6000657Z  """ 2025-08-26T19:31:43.6001199Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.6001856Z  return { 2025-08-26T19:31:43.6002503Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.6003231Z  } 2025-08-26T19:31:43.6003648Z  2025-08-26T19:31:43.6004021Z  2025-08-26T19:31:43.6004402Z def main() -> None: 2025-08-26T19:31:43.6004891Z  args = parse_args() 2025-08-26T19:31:43.6005460Z  2025-08-26T19:31:43.6005918Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.6006491Z  2025-08-26T19:31:43.6006890Z  # Check if the PR is opt-out 2025-08-26T19:31:43.6007434Z  if args.pr_number: 2025-08-26T19:31:43.6008166Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.6008977Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.6009517Z  log.info( 2025-08-26T19:31:43.6010287Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.6011087Z  ) 2025-08-26T19:31:43.6011712Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6012437Z  sys.exit() 2025-08-26T19:31:43.6013018Z  2025-08-26T19:31:43.6013394Z  try: 2025-08-26T19:31:43.6013885Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.6014652Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.6015438Z  ) 2025-08-26T19:31:43.6015835Z  2025-08-26T19:31:43.6016268Z  username = get_potential_pr_author( 2025-08-26T19:31:43.6016848Z  args.github_token, 2025-08-26T19:31:43.6017384Z  args.github_repo, 2025-08-26T19:31:43.6017910Z  args.github_actor, 2025-08-26T19:31:43.6018457Z  args.github_ref_type, 2025-08-26T19:31:43.6019000Z  args.github_branch, 2025-08-26T19:31:43.6019537Z  ) 2025-08-26T19:31:43.6019992Z  2025-08-26T19:31:43.6020525Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.6021175Z  2025-08-26T19:31:43.6021619Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.6022209Z  rollout_state, 2025-08-26T19:31:43.6022759Z  (args.github_issue_owner, username), 2025-08-26T19:31:43.6023348Z  args.github_branch, 2025-08-26T19:31:43.6023919Z  args.eligible_experiments, 2025-08-26T19:31:43.6024504Z  args.opt_out_experiments, 2025-08-26T19:31:43.6025155Z  is_canary, 2025-08-26T19:31:43.6025623Z  ) 2025-08-26T19:31:43.6026026Z  2025-08-26T19:31:43.6026416Z  except Exception as e: 2025-08-26T19:31:43.6026933Z  log.error( 2025-08-26T19:31:43.6027688Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.6028613Z  ) 2025-08-26T19:31:43.6029020Z  2025-08-26T19:31:43.6029587Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6030282Z  2025-08-26T19:31:43.6030644Z  2025-08-26T19:31:43.6031033Z if __name__ == "__main__": 2025-08-26T19:31:43.6031526Z  main() 2025-08-26T19:31:43.6031933Z  2025-08-26T19:31:43.6032294Z EOF 2025-08-26T19:31:43.6032675Z  2025-08-26T19:31:43.6033070Z cat runner_determinator.py 2025-08-26T19:31:43.6344834Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.6346015Z env: 2025-08-26T19:31:43.6346736Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.6347148Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.6347585Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.6348077Z ISSUE_OWNER: 2025-08-26T19:31:43.6348476Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.6348896Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.6349315Z PR_NUMBER: 2025-08-26T19:31:43.6349713Z ##[endgroup] 2025-08-26T19:31:43.6577407Z # flake8: noqa: G004 2025-08-26T19:31:43.6577759Z 2025-08-26T19:31:43.6578195Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.6579168Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.6579983Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.6580425Z 2025-08-26T19:31:43.6580589Z """ 2025-08-26T19:31:43.6581174Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.6582059Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.6582961Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.6583787Z of which runners should be used to run which job. 2025-08-26T19:31:43.6584182Z 2025-08-26T19:31:43.6584576Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.6585910Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.6586817Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.6587522Z list, defined. 2025-08-26T19:31:43.6587754Z 2025-08-26T19:31:43.6588116Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.6589033Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.6589862Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.6590304Z 2025-08-26T19:31:43.6590670Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.6591528Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.6592258Z experiments which the user could be opted in to. 2025-08-26T19:31:43.6592656Z 2025-08-26T19:31:43.6592853Z The user list has the following rules: 2025-08-26T19:31:43.6593200Z 2025-08-26T19:31:43.6593520Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.6594372Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.6595482Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.6595889Z 2025-08-26T19:31:43.6596069Z Example config: 2025-08-26T19:31:43.6596521Z # A list of experiments that can be opted into. 2025-08-26T19:31:43.6597195Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.6597813Z # Expected syntax is: 2025-08-26T19:31:43.6598452Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.6599410Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.6600018Z 2025-08-26T19:31:43.6600191Z experiments: 2025-08-26T19:31:43.6600584Z lf: 2025-08-26T19:31:43.6600952Z rollout_percent: 25 2025-08-26T19:31:43.6601579Z all_branches: false 2025-08-26T19:31:43.6602022Z default: true 2025-08-26T19:31:43.6602428Z --- 2025-08-26T19:31:43.6602634Z 2025-08-26T19:31:43.6602800Z # Opt-ins: 2025-08-26T19:31:43.6603384Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.6604232Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.6605235Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.6605910Z # Experiments should be from the above list. 2025-08-26T19:31:43.6606289Z 2025-08-26T19:31:43.6606472Z @User1,-lf,split_build 2025-08-26T19:31:43.6606909Z @User2,lf 2025-08-26T19:31:43.6607291Z @User3,split_build 2025-08-26T19:31:43.6607699Z """ 2025-08-26T19:31:43.6607890Z 2025-08-26T19:31:43.6608101Z import json 2025-08-26T19:31:43.6608477Z import logging 2025-08-26T19:31:43.6608853Z import os 2025-08-26T19:31:43.6609219Z import random 2025-08-26T19:31:43.6609602Z import re 2025-08-26T19:31:43.6609974Z import sys 2025-08-26T19:31:43.6610387Z from argparse import ArgumentParser 2025-08-26T19:31:43.6610923Z from collections.abc import Iterable 2025-08-26T19:31:43.6611450Z from functools import cache 2025-08-26T19:31:43.6611913Z from logging import LogRecord 2025-08-26T19:31:43.6612404Z from typing import Any, NamedTuple 2025-08-26T19:31:43.6612937Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.6613309Z 2025-08-26T19:31:43.6613471Z import yaml 2025-08-26T19:31:43.6613858Z from github import Auth, Github 2025-08-26T19:31:43.6614349Z from github.Issue import Issue 2025-08-26T19:31:43.6614652Z 2025-08-26T19:31:43.6614659Z 2025-08-26T19:31:43.6614881Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.6616036Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.6616915Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.6617474Z 2025-08-26T19:31:43.6617704Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.6618439Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.6618956Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.6619515Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.6619862Z 2025-08-26T19:31:43.6620060Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.6620393Z 2025-08-26T19:31:43.6620582Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.6621042Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.6621319Z 2025-08-26T19:31:43.6621326Z 2025-08-26T19:31:43.6621514Z class Experiment(NamedTuple): 2025-08-26T19:31:43.6621994Z rollout_perc: float = ( 2025-08-26T19:31:43.6622622Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.6623307Z ) 2025-08-26T19:31:43.6623681Z all_branches: bool = ( 2025-08-26T19:31:43.6624291Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.6625151Z ) 2025-08-26T19:31:43.6625531Z default: bool = ( 2025-08-26T19:31:43.6626098Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.6626729Z ) 2025-08-26T19:31:43.6626929Z 2025-08-26T19:31:43.6627109Z # Add more fields as needed 2025-08-26T19:31:43.6627401Z 2025-08-26T19:31:43.6627408Z 2025-08-26T19:31:43.6627598Z class Settings(NamedTuple): 2025-08-26T19:31:43.6628033Z """ 2025-08-26T19:31:43.6628482Z Settings for the experiments that can be opted into. 2025-08-26T19:31:43.6629146Z """ 2025-08-26T19:31:43.6629343Z 2025-08-26T19:31:43.6629555Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.6629912Z 2025-08-26T19:31:43.6629920Z 2025-08-26T19:31:43.6630131Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.6630756Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.6631185Z 2025-08-26T19:31:43.6631351Z COLORS = { 2025-08-26T19:31:43.6631739Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.6632393Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.6632884Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.6633375Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.6633847Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.6634325Z } 2025-08-26T19:31:43.6634516Z 2025-08-26T19:31:43.6634729Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.6635671Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.6636449Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.6637017Z return super().format(record) 2025-08-26T19:31:43.6637344Z 2025-08-26T19:31:43.6637351Z 2025-08-26T19:31:43.6637553Z handler = logging.StreamHandler() 2025-08-26T19:31:43.6638246Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.6638800Z 2025-08-26T19:31:43.6639042Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.6639623Z log.addHandler(handler) 2025-08-26T19:31:43.6640067Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.6640353Z 2025-08-26T19:31:43.6640360Z 2025-08-26T19:31:43.6640614Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.6641170Z """ 2025-08-26T19:31:43.6641676Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.6642290Z """ 2025-08-26T19:31:43.6642656Z if not GITHUB_OUTPUT: 2025-08-26T19:31:43.6643722Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:43.6644838Z log.warning( 2025-08-26T19:31:43.6645901Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:43.6646818Z ) 2025-08-26T19:31:43.6656952Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.6657581Z return 2025-08-26T19:31:43.6657827Z 2025-08-26T19:31:43.6658217Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.6658837Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.6659416Z f.write(f"{key}={value}\n") 2025-08-26T19:31:43.6659743Z 2025-08-26T19:31:43.6659750Z 2025-08-26T19:31:43.6660066Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.6660700Z return frozenset( 2025-08-26T19:31:43.6661314Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.6662011Z ) 2025-08-26T19:31:43.6662211Z 2025-08-26T19:31:43.6662219Z 2025-08-26T19:31:43.6662398Z def parse_args() -> Any: 2025-08-26T19:31:43.6662950Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.6663834Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.6664644Z parser.add_argument( 2025-08-26T19:31:43.6665298Z "--github-issue-repo", 2025-08-26T19:31:43.6665776Z type=str, 2025-08-26T19:31:43.6666176Z required=False, 2025-08-26T19:31:43.6666630Z default="pytorch/test-infra", 2025-08-26T19:31:43.6667162Z help="GitHub repo to get the issue", 2025-08-26T19:31:43.6667665Z ) 2025-08-26T19:31:43.6668028Z parser.add_argument( 2025-08-26T19:31:43.6668473Z "--github-repo", 2025-08-26T19:31:43.6668892Z type=str, 2025-08-26T19:31:43.6669285Z required=True, 2025-08-26T19:31:43.6669757Z help="GitHub repo where CI is running", 2025-08-26T19:31:43.6670291Z ) 2025-08-26T19:31:43.6670665Z parser.add_argument( 2025-08-26T19:31:43.6671267Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.6671929Z ) 2025-08-26T19:31:43.6672294Z parser.add_argument( 2025-08-26T19:31:43.6672910Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.6673581Z ) 2025-08-26T19:31:43.6673951Z parser.add_argument( 2025-08-26T19:31:43.6674732Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.6675617Z ) 2025-08-26T19:31:43.6675989Z parser.add_argument( 2025-08-26T19:31:43.6676652Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.6677365Z ) 2025-08-26T19:31:43.6677730Z parser.add_argument( 2025-08-26T19:31:43.6678178Z "--github-ref-type", 2025-08-26T19:31:43.6678630Z type=str, 2025-08-26T19:31:43.6679031Z required=True, 2025-08-26T19:31:43.6679522Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.6731530Z ) 2025-08-26T19:31:43.6732026Z parser.add_argument( 2025-08-26T19:31:43.6732568Z "--eligible-experiments", 2025-08-26T19:31:43.6733082Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.6733606Z required=False, 2025-08-26T19:31:43.6734021Z default="", 2025-08-26T19:31:43.6735084Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.6736058Z ) 2025-08-26T19:31:43.6736436Z parser.add_argument( 2025-08-26T19:31:43.6736896Z "--opt-out-experiments", 2025-08-26T19:31:43.6737399Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.6737917Z required=False, 2025-08-26T19:31:43.6738339Z default="", 2025-08-26T19:31:43.6738744Z help=( 2025-08-26T19:31:43.6739423Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.6740554Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.6741390Z ), 2025-08-26T19:31:43.6741738Z ) 2025-08-26T19:31:43.6742108Z parser.add_argument( 2025-08-26T19:31:43.6742543Z "--pr-number", 2025-08-26T19:31:43.6742951Z type=str, 2025-08-26T19:31:43.6743347Z required=False, 2025-08-26T19:31:43.6743776Z default="", 2025-08-26T19:31:43.6744429Z help="the optional PR number where this is run", 2025-08-26T19:31:43.6745209Z ) 2025-08-26T19:31:43.6745421Z 2025-08-26T19:31:43.6745622Z return parser.parse_args() 2025-08-26T19:31:43.6745929Z 2025-08-26T19:31:43.6745935Z 2025-08-26T19:31:43.6746337Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.6747093Z auth = Auth.Token(github_token) 2025-08-26T19:31:43.6747590Z return Github(auth=auth) 2025-08-26T19:31:43.6747891Z 2025-08-26T19:31:43.6747898Z 2025-08-26T19:31:43.6748349Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.6749141Z repo = gh.get_repo(repo) 2025-08-26T19:31:43.6749644Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.6750002Z 2025-08-26T19:31:43.6750008Z 2025-08-26T19:31:43.6750202Z def get_potential_pr_author( 2025-08-26T19:31:43.6750851Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.6751536Z ) -> str: 2025-08-26T19:31:43.6752043Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.6752840Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.6753573Z # embedded in the tag name: ciflow// 2025-08-26T19:31:43.6753993Z 2025-08-26T19:31:43.6754189Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.6754524Z 2025-08-26T19:31:43.6754798Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.6755601Z split_tag = ref_name.split("/") 2025-08-26T19:31:43.6756099Z if ( 2025-08-26T19:31:43.6756486Z len(split_tag) == 3 2025-08-26T19:31:43.6756972Z and split_tag[0] == "ciflow" 2025-08-26T19:31:43.6757497Z and split_tag[2].isnumeric() 2025-08-26T19:31:43.6757990Z ): 2025-08-26T19:31:43.6758372Z pr_number = split_tag[2] 2025-08-26T19:31:43.6759034Z try: 2025-08-26T19:31:43.6759474Z repository = gh.get_repo(repo) 2025-08-26T19:31:43.6760087Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.6760697Z except Exception as e: 2025-08-26T19:31:43.6761214Z raise Exception( # noqa: TRY002 2025-08-26T19:31:43.6761891Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.6762522Z ) from e 2025-08-26T19:31:43.6763066Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.6763764Z # In all other cases, return the original input username 2025-08-26T19:31:43.6764349Z return username 2025-08-26T19:31:43.6764626Z 2025-08-26T19:31:43.6764634Z 2025-08-26T19:31:43.6764869Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.6765632Z """ 2025-08-26T19:31:43.6766286Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.6767056Z """ 2025-08-26T19:31:43.6767610Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.6768126Z 2025-08-26T19:31:43.6768133Z 2025-08-26T19:31:43.6768335Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.6768827Z try: 2025-08-26T19:31:43.6769211Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.6769718Z return data 2025-08-26T19:31:43.6770132Z except yaml.YAMLError: 2025-08-26T19:31:43.6770604Z log.exception("Error loading YAML") 2025-08-26T19:31:43.6771118Z raise 2025-08-26T19:31:43.6771330Z 2025-08-26T19:31:43.6771336Z 2025-08-26T19:31:43.6771752Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.6772498Z """ 2025-08-26T19:31:43.6773121Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.6773714Z 2025-08-26T19:31:43.6774206Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.6775210Z and the text below is the list of opted in users. 2025-08-26T19:31:43.6775634Z 2025-08-26T19:31:43.6776014Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.6776717Z """ 2025-08-26T19:31:43.6777159Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.6777779Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.6778388Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.6778974Z else: 2025-08-26T19:31:43.6779356Z return "", rollout_state 2025-08-26T19:31:43.6779657Z 2025-08-26T19:31:43.6779665Z 2025-08-26T19:31:43.6779868Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.6780371Z """ 2025-08-26T19:31:43.6780892Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.6781533Z """ 2025-08-26T19:31:43.6781739Z 2025-08-26T19:31:43.6781746Z 2025-08-26T19:31:43.6782092Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.6782735Z """ 2025-08-26T19:31:43.6783442Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:43.6784118Z 2025-08-26T19:31:43.6784735Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:43.6785945Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.6786642Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.6787126Z 2025-08-26T19:31:43.6787133Z 2025-08-26T19:31:43.6787297Z """ 2025-08-26T19:31:43.6787675Z optins = UserOptins() 2025-08-26T19:31:43.6788160Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.6788721Z user = user.strip("\r\n\t -") 2025-08-26T19:31:43.6789257Z if not user or not user.startswith("@"): 2025-08-26T19:31:43.6790013Z # Not a valid user. Skip 2025-08-26T19:31:43.6790495Z continue 2025-08-26T19:31:43.6790744Z 2025-08-26T19:31:43.6790903Z if user: 2025-08-26T19:31:43.6791339Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.6792026Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.6792518Z 2025-08-26T19:31:43.6792690Z return optins 2025-08-26T19:31:43.6792927Z 2025-08-26T19:31:43.6792934Z 2025-08-26T19:31:43.6793215Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.6793814Z """ 2025-08-26T19:31:43.6794210Z Check if the experiment name is valid. 2025-08-26T19:31:43.6794730Z A valid name: 2025-08-26T19:31:43.6795542Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.6796486Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.6797224Z - Cannot contain spaces 2025-08-26T19:31:43.6797680Z """ 2025-08-26T19:31:43.6797887Z 2025-08-26T19:31:43.6798153Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.6798847Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.6799297Z 2025-08-26T19:31:43.6799457Z if valid: 2025-08-26T19:31:43.6799835Z return True 2025-08-26T19:31:43.6800072Z 2025-08-26T19:31:43.6800237Z log.error( 2025-08-26T19:31:43.6801697Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:43.6803288Z ) 2025-08-26T19:31:43.6803641Z return False 2025-08-26T19:31:43.6803870Z 2025-08-26T19:31:43.6803876Z 2025-08-26T19:31:43.6804185Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.6804790Z """ 2025-08-26T19:31:43.6805842Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.6806588Z """ 2025-08-26T19:31:43.6806946Z try: 2025-08-26T19:31:43.6807314Z if settings_text: 2025-08-26T19:31:43.6808063Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:43.6808850Z # for easy reading 2025-08-26T19:31:43.6809628Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.6810511Z # the backtick character in shell commands. 2025-08-26T19:31:43.6811111Z backtick = chr(96) # backtick character 2025-08-26T19:31:43.6811783Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.6812447Z settings = load_yaml(settings_text) 2025-08-26T19:31:43.6812829Z 2025-08-26T19:31:43.6813248Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.6814013Z experiments = {} 2025-08-26T19:31:43.6814315Z 2025-08-26T19:31:43.6814705Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.6815689Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.6816818Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:43.6817857Z continue 2025-08-26T19:31:43.6818139Z 2025-08-26T19:31:43.6818327Z valid_settings = {} 2025-08-26T19:31:43.6818842Z for setting in exp_settings: 2025-08-26T19:31:43.6819418Z if setting not in Experiment._fields: 2025-08-26T19:31:43.6819969Z log.warning( 2025-08-26T19:31:43.6820672Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.6821541Z ) 2025-08-26T19:31:43.6821978Z else: 2025-08-26T19:31:43.6822484Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.6822910Z 2025-08-26T19:31:43.6823186Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.6823826Z return Settings(experiments) 2025-08-26T19:31:43.6824177Z 2025-08-26T19:31:43.6824349Z except Exception: 2025-08-26T19:31:43.6824832Z log.exception("Failed to parse settings") 2025-08-26T19:31:43.6825398Z 2025-08-26T19:31:43.6825577Z return Settings() 2025-08-26T19:31:43.6825839Z 2025-08-26T19:31:43.6825846Z 2025-08-26T19:31:43.6826100Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.6826670Z """ 2025-08-26T19:31:43.6827108Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.6827516Z 2025-08-26T19:31:43.6827878Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.6828643Z and the text below is the list of opted in users. 2025-08-26T19:31:43.6829055Z 2025-08-26T19:31:43.6829460Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.6830211Z """ 2025-08-26T19:31:43.6830764Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.6831527Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.6831925Z 2025-08-26T19:31:43.6831932Z 2025-08-26T19:31:43.6832177Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.6832736Z """ 2025-08-26T19:31:43.6833124Z Parse users from the rollout state. 2025-08-26T19:31:43.6833477Z 2025-08-26T19:31:43.6833636Z """ 2025-08-26T19:31:43.6834156Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.6835040Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.6835482Z 2025-08-26T19:31:43.6835489Z 2025-08-26T19:31:43.6836050Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.6836801Z """ 2025-08-26T19:31:43.6837219Z Check if a user is opted into an experiment 2025-08-26T19:31:43.6837754Z """ 2025-08-26T19:31:43.6838205Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.6838620Z 2025-08-26T19:31:43.6838627Z 2025-08-26T19:31:43.6839051Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.6839794Z """ 2025-08-26T19:31:43.6840251Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.6840825Z """ 2025-08-26T19:31:43.6841326Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.6842000Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.6842644Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.6843240Z return False 2025-08-26T19:31:43.6843506Z 2025-08-26T19:31:43.6843783Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.6844393Z log.warning( 2025-08-26T19:31:43.6845418Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.6846323Z ) 2025-08-26T19:31:43.6846532Z 2025-08-26T19:31:43.6846704Z return True 2025-08-26T19:31:43.6846939Z 2025-08-26T19:31:43.6846945Z 2025-08-26T19:31:43.6847125Z def get_runner_prefix( 2025-08-26T19:31:43.6847559Z rollout_state: str, 2025-08-26T19:31:43.6848024Z workflow_requestors: Iterable[str], 2025-08-26T19:31:43.6848535Z branch: str, 2025-08-26T19:31:43.6849027Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.6849694Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.6850275Z is_canary: bool = False, 2025-08-26T19:31:43.6850733Z ) -> str: 2025-08-26T19:31:43.6851294Z settings = parse_settings(rollout_state) 2025-08-26T19:31:43.6851886Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.6852251Z 2025-08-26T19:31:43.6852432Z fleet_prefix = "" 2025-08-26T19:31:43.6852864Z prefixes = [] 2025-08-26T19:31:43.6853489Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.6854434Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.6855533Z log.info( 2025-08-26T19:31:43.6856222Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.6856980Z ) 2025-08-26T19:31:43.6857363Z continue 2025-08-26T19:31:43.6857618Z 2025-08-26T19:31:43.6857807Z if opt_out_experiments: 2025-08-26T19:31:43.6858336Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.6858978Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.6859570Z log.info( 2025-08-26T19:31:43.6860498Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.6861484Z ) 2025-08-26T19:31:43.6861883Z continue 2025-08-26T19:31:43.6862156Z 2025-08-26T19:31:43.6862342Z if eligible_experiments: 2025-08-26T19:31:43.6862886Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.6863516Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.6864076Z log.info( 2025-08-26T19:31:43.6864887Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.6865854Z ) 2025-08-26T19:31:43.6866253Z continue 2025-08-26T19:31:43.6866725Z elif not experiment_settings.default: 2025-08-26T19:31:43.6867259Z log.info( 2025-08-26T19:31:43.6868062Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.6868824Z ) 2025-08-26T19:31:43.6869208Z continue 2025-08-26T19:31:43.6869216Z 2025-08-26T19:31:43.6869498Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.6869684Z opted_out_users = [ 2025-08-26T19:31:43.6869851Z requestor 2025-08-26T19:31:43.6870064Z for requestor in workflow_requestors 2025-08-26T19:31:43.6870377Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.6870539Z ] 2025-08-26T19:31:43.6870547Z 2025-08-26T19:31:43.6870731Z if opted_out_users: 2025-08-26T19:31:43.6870901Z log.info( 2025-08-26T19:31:43.6871290Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.6871456Z ) 2025-08-26T19:31:43.6871621Z continue 2025-08-26T19:31:43.6871633Z 2025-08-26T19:31:43.6871910Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.6872093Z opted_in_users = [ 2025-08-26T19:31:43.6872262Z requestor 2025-08-26T19:31:43.6872474Z for requestor in workflow_requestors 2025-08-26T19:31:43.6872776Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.6872935Z ] 2025-08-26T19:31:43.6872942Z 2025-08-26T19:31:43.6873116Z enabled = False 2025-08-26T19:31:43.6873296Z if opted_in_users: 2025-08-26T19:31:43.6873459Z log.info( 2025-08-26T19:31:43.6873816Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.6873990Z ) 2025-08-26T19:31:43.6874166Z enabled = True 2025-08-26T19:31:43.6874174Z 2025-08-26T19:31:43.6874393Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.6874852Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.6875524Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.6875695Z log.info( 2025-08-26T19:31:43.6876292Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.6876461Z ) 2025-08-26T19:31:43.6876640Z enabled = True 2025-08-26T19:31:43.6876649Z 2025-08-26T19:31:43.6876813Z if enabled: 2025-08-26T19:31:43.6877006Z label = experiment_name 2025-08-26T19:31:43.6877233Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.6877673Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.6877949Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.6878269Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.6878447Z if is_canary: 2025-08-26T19:31:43.6878653Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.6878838Z fleet_prefix = label 2025-08-26T19:31:43.6879000Z else: 2025-08-26T19:31:43.6879198Z prefixes.append(label) 2025-08-26T19:31:43.6879206Z 2025-08-26T19:31:43.6879392Z if len(prefixes) > 1: 2025-08-26T19:31:43.6879556Z log.error( 2025-08-26T19:31:43.6880373Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:43.6880535Z ) 2025-08-26T19:31:43.6880728Z prefixes = prefixes[:1] 2025-08-26T19:31:43.6880735Z 2025-08-26T19:31:43.6880923Z # Fleet always comes first 2025-08-26T19:31:43.6881094Z if fleet_prefix: 2025-08-26T19:31:43.6881305Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.6881318Z 2025-08-26T19:31:43.6881690Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.6881700Z 2025-08-26T19:31:43.6881707Z 2025-08-26T19:31:43.6882164Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.6882332Z """ 2025-08-26T19:31:43.6882718Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.6882726Z 2025-08-26T19:31:43.6883107Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.6883275Z """ 2025-08-26T19:31:43.6883470Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.6883675Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.6883964Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.6883971Z 2025-08-26T19:31:43.6883979Z 2025-08-26T19:31:43.6884383Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.6884578Z for _ in range(num_retries): 2025-08-26T19:31:43.6884749Z try: 2025-08-26T19:31:43.6885072Z req = Request(url=url, headers=headers) 2025-08-26T19:31:43.6885361Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.6885555Z return json.loads(content) 2025-08-26T19:31:43.6885745Z except Exception as e: 2025-08-26T19:31:43.6885980Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.6885987Z 2025-08-26T19:31:43.6886371Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.6886543Z return {} 2025-08-26T19:31:43.6886552Z 2025-08-26T19:31:43.6886559Z 2025-08-26T19:31:43.6886715Z @cache 2025-08-26T19:31:43.6887148Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.6887310Z """ 2025-08-26T19:31:43.6887510Z Dynamically get PR information 2025-08-26T19:31:43.6887669Z """ 2025-08-26T19:31:43.6888097Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.6888268Z headers = { 2025-08-26T19:31:43.6888498Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.6888714Z "Authorization": f"token {github_token}", 2025-08-26T19:31:43.6888878Z } 2025-08-26T19:31:43.6889107Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.6889321Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.6889501Z headers=headers, 2025-08-26T19:31:43.6889666Z ) 2025-08-26T19:31:43.6889674Z 2025-08-26T19:31:43.6889858Z if not json_response: 2025-08-26T19:31:43.6890145Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.6890316Z return {} 2025-08-26T19:31:43.6890324Z 2025-08-26T19:31:43.6890507Z return json_response 2025-08-26T19:31:43.6890514Z 2025-08-26T19:31:43.6890520Z 2025-08-26T19:31:43.6890917Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.6891088Z """ 2025-08-26T19:31:43.6891416Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.6891576Z """ 2025-08-26T19:31:43.6891866Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.6892030Z return { 2025-08-26T19:31:43.6892394Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.6892550Z } 2025-08-26T19:31:43.6892558Z 2025-08-26T19:31:43.6892571Z 2025-08-26T19:31:43.6892750Z def main() -> None: 2025-08-26T19:31:43.6892928Z args = parse_args() 2025-08-26T19:31:43.6892936Z 2025-08-26T19:31:43.6893158Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.6893166Z 2025-08-26T19:31:43.6893363Z # Check if the PR is opt-out 2025-08-26T19:31:43.6893540Z if args.pr_number: 2025-08-26T19:31:43.6893933Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.6894248Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.6894421Z log.info( 2025-08-26T19:31:43.6894861Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.6895124Z ) 2025-08-26T19:31:43.6895470Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6895640Z sys.exit() 2025-08-26T19:31:43.6895648Z 2025-08-26T19:31:43.6895810Z try: 2025-08-26T19:31:43.6896055Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.6896367Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.6896525Z ) 2025-08-26T19:31:43.6896533Z 2025-08-26T19:31:43.6896746Z username = get_potential_pr_author( 2025-08-26T19:31:43.6896933Z args.github_token, 2025-08-26T19:31:43.6897116Z args.github_repo, 2025-08-26T19:31:43.6897299Z args.github_actor, 2025-08-26T19:31:43.6897496Z args.github_ref_type, 2025-08-26T19:31:43.6897681Z args.github_branch, 2025-08-26T19:31:43.6897840Z ) 2025-08-26T19:31:43.6897848Z 2025-08-26T19:31:43.6898134Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.6898143Z 2025-08-26T19:31:43.6898359Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.6898530Z rollout_state, 2025-08-26T19:31:43.6898739Z (args.github_issue_owner, username), 2025-08-26T19:31:43.6898919Z args.github_branch, 2025-08-26T19:31:43.6899118Z args.eligible_experiments, 2025-08-26T19:31:43.6899312Z args.opt_out_experiments, 2025-08-26T19:31:43.6899491Z is_canary, 2025-08-26T19:31:43.6899650Z ) 2025-08-26T19:31:43.6899658Z 2025-08-26T19:31:43.6899843Z except Exception as e: 2025-08-26T19:31:43.6900020Z log.error( 2025-08-26T19:31:43.6900454Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.6900738Z ) 2025-08-26T19:31:43.6900746Z 2025-08-26T19:31:43.6901087Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.6901096Z 2025-08-26T19:31:43.6901103Z 2025-08-26T19:31:43.6901282Z if __name__ == "__main__": 2025-08-26T19:31:43.6901441Z main() 2025-08-26T19:31:43.6901449Z 2025-08-26T19:31:43.6991584Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.6992480Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.7032939Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.7033420Z env: 2025-08-26T19:31:43.7034031Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.7034441Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.7034882Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.7035557Z ISSUE_OWNER: 2025-08-26T19:31:43.7035956Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.7036372Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.7036800Z PR_NUMBER: 2025-08-26T19:31:43.7037177Z ##[endgroup] 2025-08-26T19:31:44.7703659Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:45.9572969Z Collecting urllib3==1.26.18 2025-08-26T19:31:46.0071487Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:46.0294875Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.3 MB/s eta 0:00:00 2025-08-26T19:31:46.0576302Z Collecting PyGithub==2.3.0 2025-08-26T19:31:46.0658682Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:46.1134502Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:46.1262292Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-26T19:31:46.1308580Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:46.1324335Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-26T19:31:46.1338878Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:46.1621468Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:46.1701111Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:46.1922792Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-26T19:31:46.3149630Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:46.3234213Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:46.4468188Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:46.4617635Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-26T19:31:46.4867424Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:46.4947684Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:46.5276640Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:46.5409207Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.6 MB/s eta 0:00:00 2025-08-26T19:31:46.5499511Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:46.5776493Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 13.3 MB/s eta 0:00:00 2025-08-26T19:31:46.5867864Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-26T19:31:46.6530853Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 13.1 MB/s eta 0:00:00 2025-08-26T19:31:46.6612599Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:46.6714807Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:46.6952989Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 21.2 MB/s eta 0:00:00 2025-08-26T19:31:46.7033070Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-26T19:31:46.7086094Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 21.9 MB/s eta 0:00:00 2025-08-26T19:31:46.7166985Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:46.7230530Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 22.5 MB/s eta 0:00:00 2025-08-26T19:31:47.0189486Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:47.5485477Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-26T19:31:47.6278092Z ##[group]Run curr_branch="main" 2025-08-26T19:31:47.6278392Z curr_branch="main" 2025-08-26T19:31:47.6278604Z curr_ref_type="branch" 2025-08-26T19:31:47.6278877Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:47.6279125Z  2025-08-26T19:31:47.6279318Z python3 runner_determinator.py \ 2025-08-26T19:31:47.6279594Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:47.6279869Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:47.6280130Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:47.6280391Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:47.6280676Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:47.6280949Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:47.6281218Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:47.6281514Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:47.6281882Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:47.6282219Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:47.6323935Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:47.6324161Z env: 2025-08-26T19:31:47.6324690Z GITHUB_TOKEN: *** 2025-08-26T19:31:47.6324880Z ISSUE_NUMBER: 5132 2025-08-26T19:31:47.6325326Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:47.6325553Z ISSUE_OWNER: 2025-08-26T19:31:47.6325717Z CHECK_EXPERIMENTS: 2025-08-26T19:31:47.6325904Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:47.6326090Z PR_NUMBER: 2025-08-26T19:31:47.6326247Z ##[endgroup] 2025-08-26T19:31:47.6385276Z Current branch is 'main' 2025-08-26T19:31:49.6557997Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:49.6558830Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:49.6559512Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:49.6560034Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:49.6864719Z Evaluate and set job outputs 2025-08-26T19:31:49.6871355Z Set output 'label-type' 2025-08-26T19:31:49.6873137Z Cleaning up orphan processes