2025-08-26T19:31:43.7477839Z Current runner version: '2.328.0' 2025-08-26T19:31:43.7502056Z ##[group]Runner Image Provisioner 2025-08-26T19:31:43.7502869Z Hosted Compute Agent 2025-08-26T19:31:43.7503360Z Version: 20250825.382 2025-08-26T19:31:43.7504056Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:31:43.7504726Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:31:43.7505293Z ##[endgroup] 2025-08-26T19:31:43.7505882Z ##[group]Operating System 2025-08-26T19:31:43.7506397Z Ubuntu 2025-08-26T19:31:43.7506857Z 24.04.2 2025-08-26T19:31:43.7507341Z LTS 2025-08-26T19:31:43.7507832Z ##[endgroup] 2025-08-26T19:31:43.7508275Z ##[group]Runner Image 2025-08-26T19:31:43.7508912Z Image: ubuntu-24.04 2025-08-26T19:31:43.7509843Z Version: 20250818.1.0 2025-08-26T19:31:43.7510842Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:43.7512409Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:43.7513415Z ##[endgroup] 2025-08-26T19:31:43.7514533Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:43.7516643Z Contents: read 2025-08-26T19:31:43.7517241Z Metadata: read 2025-08-26T19:31:43.7517758Z Packages: read 2025-08-26T19:31:43.7518206Z ##[endgroup] 2025-08-26T19:31:43.7520594Z Secret source: Actions 2025-08-26T19:31:43.7521284Z Prepare workflow directory 2025-08-26T19:31:43.8038632Z Prepare all required actions 2025-08-26T19:31:43.8098301Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:43.8103448Z ##[group] Inputs 2025-08-26T19:31:43.8104092Z check_experiments: 2025-08-26T19:31:43.8104654Z opt_out_experiments: 2025-08-26T19:31:43.8105268Z triggering_actor: pytorchmergebot 2025-08-26T19:31:43.8105847Z issue_owner: 2025-08-26T19:31:43.8106345Z curr_branch: main 2025-08-26T19:31:43.8107026Z curr_ref_type: branch 2025-08-26T19:31:43.8107539Z issue_number: 5132 2025-08-26T19:31:43.8108158Z ##[endgroup] 2025-08-26T19:31:43.8108701Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:43.8705027Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:43.8707439Z cat < runner_determinator.py 2025-08-26T19:31:43.8708119Z # flake8: noqa: G004 2025-08-26T19:31:43.8708620Z  2025-08-26T19:31:43.8709791Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.8710951Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.8711862Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.8712618Z  2025-08-26T19:31:43.8713046Z """ 2025-08-26T19:31:43.8713734Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.8714750Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.8715907Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.8716813Z of which runners should be used to run which job. 2025-08-26T19:31:43.8717527Z  2025-08-26T19:31:43.8718217Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.8719422Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.8720492Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.8721292Z list, defined. 2025-08-26T19:31:43.8721791Z  2025-08-26T19:31:43.8722504Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.8723490Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.8724431Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.8725423Z  2025-08-26T19:31:43.8726144Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.8727126Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.8727982Z experiments which the user could be opted in to. 2025-08-26T19:31:43.8728650Z  2025-08-26T19:31:43.8729100Z The user list has the following rules: 2025-08-26T19:31:43.8729887Z  2025-08-26T19:31:43.8730519Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.8731469Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.8732374Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.8733000Z  2025-08-26T19:31:43.8733446Z Example config: 2025-08-26T19:31:43.8733985Z  # A list of experiments that can be opted into. 2025-08-26T19:31:43.8734867Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.8735591Z  # Expected syntax is: 2025-08-26T19:31:43.8736304Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.8737433Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.8738229Z  2025-08-26T19:31:43.8738661Z  experiments: 2025-08-26T19:31:43.8739389Z  lf: 2025-08-26T19:31:43.8739901Z  rollout_percent: 25 2025-08-26T19:31:43.8740458Z  all_branches: false 2025-08-26T19:31:43.8741072Z  default: true 2025-08-26T19:31:43.8741596Z  --- 2025-08-26T19:31:43.8742013Z  2025-08-26T19:31:43.8742539Z  # Opt-ins: 2025-08-26T19:31:43.8743216Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.8744372Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.8745339Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.8746087Z  # Experiments should be from the above list. 2025-08-26T19:31:43.8746739Z  2025-08-26T19:31:43.8747197Z  @User1,-lf,split_build 2025-08-26T19:31:43.8747779Z  @User2,lf 2025-08-26T19:31:43.8748271Z  @User3,split_build 2025-08-26T19:31:43.8748860Z """ 2025-08-26T19:31:43.8749659Z  2025-08-26T19:31:43.8750131Z import json 2025-08-26T19:31:43.8750735Z import logging 2025-08-26T19:31:43.8751335Z import os 2025-08-26T19:31:43.8751792Z import random 2025-08-26T19:31:43.8752347Z import re 2025-08-26T19:31:43.8752817Z import sys 2025-08-26T19:31:43.8753388Z from argparse import ArgumentParser 2025-08-26T19:31:43.8754021Z from collections.abc import Iterable 2025-08-26T19:31:43.8754729Z from functools import cache 2025-08-26T19:31:43.8755285Z from logging import LogRecord 2025-08-26T19:31:43.8755895Z from typing import Any, NamedTuple 2025-08-26T19:31:43.8756632Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.8757223Z  2025-08-26T19:31:43.8757687Z import yaml 2025-08-26T19:31:43.8758238Z from github import Auth, Github 2025-08-26T19:31:43.8758852Z from github.Issue import Issue 2025-08-26T19:31:43.8759562Z  2025-08-26T19:31:43.8760060Z  2025-08-26T19:31:43.8760615Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.8761395Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.8762417Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.8763666Z  2025-08-26T19:31:43.8764208Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.8764949Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.8765601Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.8766282Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.8766901Z  2025-08-26T19:31:43.8767405Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.8767964Z  2025-08-26T19:31:43.8768478Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.8769083Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.8769800Z  2025-08-26T19:31:43.8770280Z  2025-08-26T19:31:43.8770736Z class Experiment(NamedTuple): 2025-08-26T19:31:43.8771343Z  rollout_perc: float = ( 2025-08-26T19:31:43.8772083Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.8772960Z  ) 2025-08-26T19:31:43.8773419Z  all_branches: bool = ( 2025-08-26T19:31:43.8774170Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.8775000Z  ) 2025-08-26T19:31:43.8775441Z  default: bool = ( 2025-08-26T19:31:43.8776129Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.8776926Z  ) 2025-08-26T19:31:43.8777382Z  2025-08-26T19:31:43.8777809Z  # Add more fields as needed 2025-08-26T19:31:43.8778430Z  2025-08-26T19:31:43.8778865Z  2025-08-26T19:31:43.8779447Z class Settings(NamedTuple): 2025-08-26T19:31:43.8780123Z  """ 2025-08-26T19:31:43.8780688Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:43.8781369Z  """ 2025-08-26T19:31:43.8781827Z  2025-08-26T19:31:43.8782349Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.8782978Z  2025-08-26T19:31:43.8783581Z  2025-08-26T19:31:43.8784135Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.8784858Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.8785580Z  2025-08-26T19:31:43.8786010Z  COLORS = { 2025-08-26T19:31:43.8786549Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.8787234Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.8787831Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.8788443Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.8789003Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.8790006Z  } 2025-08-26T19:31:43.8790435Z  2025-08-26T19:31:43.8790972Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.8791902Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.8792774Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.8793445Z  return super().format(record) 2025-08-26T19:31:43.8794064Z  2025-08-26T19:31:43.8794506Z  2025-08-26T19:31:43.8794983Z handler = logging.StreamHandler() 2025-08-26T19:31:43.8795874Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.8796684Z  2025-08-26T19:31:43.8797207Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.8797953Z log.addHandler(handler) 2025-08-26T19:31:43.8798493Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.8799079Z  2025-08-26T19:31:43.8799847Z  2025-08-26T19:31:43.8800426Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.8801065Z  """ 2025-08-26T19:31:43.8801730Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.8802653Z  """ 2025-08-26T19:31:43.8803137Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:43.8804364Z  # 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.8805538Z  log.warning( 2025-08-26T19:31:43.8806506Z  "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.8807528Z  ) 2025-08-26T19:31:43.8808063Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.8808738Z  return 2025-08-26T19:31:43.8809311Z  2025-08-26T19:31:43.8809911Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.8810596Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.8811211Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:43.8811876Z  2025-08-26T19:31:43.8812321Z  2025-08-26T19:31:43.8812910Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.8813691Z  return frozenset( 2025-08-26T19:31:43.8814444Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.8815188Z  ) 2025-08-26T19:31:43.8815672Z  2025-08-26T19:31:43.8816135Z  2025-08-26T19:31:43.8816554Z def parse_args() -> Any: 2025-08-26T19:31:43.8817290Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.8818221Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.8819074Z  parser.add_argument( 2025-08-26T19:31:43.8819864Z  "--github-issue-repo", 2025-08-26T19:31:43.8820459Z  type=str, 2025-08-26T19:31:43.8821004Z  required=False, 2025-08-26T19:31:43.8821725Z  default="pytorch/test-infra", 2025-08-26T19:31:43.8822426Z  help="GitHub repo to get the issue", 2025-08-26T19:31:43.8823011Z  ) 2025-08-26T19:31:43.8823536Z  parser.add_argument( 2025-08-26T19:31:43.8824160Z  "--github-repo", 2025-08-26T19:31:43.8824678Z  type=str, 2025-08-26T19:31:43.8825240Z  required=True, 2025-08-26T19:31:43.8825826Z  help="GitHub repo where CI is running", 2025-08-26T19:31:43.8826450Z  ) 2025-08-26T19:31:43.8826874Z  parser.add_argument( 2025-08-26T19:31:43.8827713Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.8828458Z  ) 2025-08-26T19:31:43.8828882Z  parser.add_argument( 2025-08-26T19:31:43.8830067Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.8830849Z  ) 2025-08-26T19:31:43.8831317Z  parser.add_argument( 2025-08-26T19:31:43.8832182Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.8832965Z  ) 2025-08-26T19:31:43.8833411Z  parser.add_argument( 2025-08-26T19:31:43.8900144Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.8900980Z  ) 2025-08-26T19:31:43.8901374Z  parser.add_argument( 2025-08-26T19:31:43.8901868Z  "--github-ref-type", 2025-08-26T19:31:43.8902342Z  type=str, 2025-08-26T19:31:43.8902776Z  required=True, 2025-08-26T19:31:43.8903305Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.8903892Z  ) 2025-08-26T19:31:43.8904275Z  parser.add_argument( 2025-08-26T19:31:43.8905118Z  "--eligible-experiments", 2025-08-26T19:31:43.8905673Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.8906241Z  required=False, 2025-08-26T19:31:43.8906751Z  default="", 2025-08-26T19:31:43.8907668Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.8908625Z  ) 2025-08-26T19:31:43.8909061Z  parser.add_argument( 2025-08-26T19:31:43.8909843Z  "--opt-out-experiments", 2025-08-26T19:31:43.8910424Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.8910948Z  required=False, 2025-08-26T19:31:43.8911413Z  default="", 2025-08-26T19:31:43.8911840Z  help=( 2025-08-26T19:31:43.8912538Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.8913660Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.8914476Z  ), 2025-08-26T19:31:43.8914849Z  ) 2025-08-26T19:31:43.8915229Z  parser.add_argument( 2025-08-26T19:31:43.8915699Z  "--pr-number", 2025-08-26T19:31:43.8916147Z  type=str, 2025-08-26T19:31:43.8916588Z  required=False, 2025-08-26T19:31:43.8917032Z  default="", 2025-08-26T19:31:43.8917559Z  help="the optional PR number where this is run", 2025-08-26T19:31:43.8918119Z  ) 2025-08-26T19:31:43.8918471Z  2025-08-26T19:31:43.8918849Z  return parser.parse_args() 2025-08-26T19:31:43.8919521Z  2025-08-26T19:31:43.8919946Z  2025-08-26T19:31:43.8920555Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.8921493Z  auth = Auth.Token(github_token) 2025-08-26T19:31:43.8922023Z  return Github(auth=auth) 2025-08-26T19:31:43.8922476Z  2025-08-26T19:31:43.8922810Z  2025-08-26T19:31:43.8923452Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.8924262Z  repo = gh.get_repo(repo) 2025-08-26T19:31:43.8924799Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.8925316Z  2025-08-26T19:31:43.8925650Z  2025-08-26T19:31:43.8926025Z def get_potential_pr_author( 2025-08-26T19:31:43.8926694Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.8927358Z ) -> str: 2025-08-26T19:31:43.8927903Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.8928862Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.8930857Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:43.8931830Z  2025-08-26T19:31:43.8932475Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.8933138Z  2025-08-26T19:31:43.8933610Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.8934245Z  split_tag = ref_name.split("/") 2025-08-26T19:31:43.8934752Z  if ( 2025-08-26T19:31:43.8935169Z  len(split_tag) == 3 2025-08-26T19:31:43.8935678Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:43.8936215Z  and split_tag[2].isnumeric() 2025-08-26T19:31:43.8936713Z  ): 2025-08-26T19:31:43.8937126Z  pr_number = split_tag[2] 2025-08-26T19:31:43.8937618Z  try: 2025-08-26T19:31:43.8938075Z  repository = gh.get_repo(repo) 2025-08-26T19:31:43.8938889Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.8939766Z  except Exception as e: 2025-08-26T19:31:43.8940323Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:43.8940995Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.8941656Z  ) from e 2025-08-26T19:31:43.8942233Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.8942940Z  # In all other cases, return the original input username 2025-08-26T19:31:43.8943524Z  return username 2025-08-26T19:31:43.8943942Z  2025-08-26T19:31:43.8944281Z  2025-08-26T19:31:43.8944695Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.8945225Z  """ 2025-08-26T19:31:43.8945890Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.8946658Z  """ 2025-08-26T19:31:43.8947220Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.8947867Z  2025-08-26T19:31:43.8948198Z  2025-08-26T19:31:43.8948577Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.8949082Z  try: 2025-08-26T19:31:43.8949608Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.8950124Z  return data 2025-08-26T19:31:43.8950573Z  except yaml.YAMLError: 2025-08-26T19:31:43.8951087Z  log.exception("Error loading YAML") 2025-08-26T19:31:43.8951600Z  raise 2025-08-26T19:31:43.8951978Z  2025-08-26T19:31:43.8952311Z  2025-08-26T19:31:43.8952935Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.8953687Z  """ 2025-08-26T19:31:43.8954461Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.8955210Z  2025-08-26T19:31:43.8955759Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.8956516Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.8957062Z  2025-08-26T19:31:43.8957624Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.8958309Z  """ 2025-08-26T19:31:43.8958774Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.8959673Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.8960310Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.8960898Z  else: 2025-08-26T19:31:43.8961300Z  return "", rollout_state 2025-08-26T19:31:43.8961775Z  2025-08-26T19:31:43.8962109Z  2025-08-26T19:31:43.8962514Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.8963033Z  """ 2025-08-26T19:31:43.8963588Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.8964228Z  """ 2025-08-26T19:31:43.8964586Z  2025-08-26T19:31:43.8964910Z  2025-08-26T19:31:43.8965441Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.8966088Z  """ 2025-08-26T19:31:43.8966807Z  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.8967617Z  2025-08-26T19:31:43.8968405Z  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.8969518Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.8970353Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.8970971Z  2025-08-26T19:31:43.8971305Z  2025-08-26T19:31:43.8971627Z  """ 2025-08-26T19:31:43.8972011Z  optins = UserOptins() 2025-08-26T19:31:43.8972528Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.8973092Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:43.8973654Z  if not user or not user.startswith("@"): 2025-08-26T19:31:43.8974211Z  # Not a valid user. Skip 2025-08-26T19:31:43.8974709Z  continue 2025-08-26T19:31:43.8975119Z  2025-08-26T19:31:43.8975458Z  if user: 2025-08-26T19:31:43.8975918Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.8976657Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.8977331Z  2025-08-26T19:31:43.8977733Z  return optins 2025-08-26T19:31:43.8978327Z  2025-08-26T19:31:43.8978896Z  2025-08-26T19:31:43.8979844Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.8980478Z  """ 2025-08-26T19:31:43.8980896Z  Check if the experiment name is valid. 2025-08-26T19:31:43.8981411Z  A valid name: 2025-08-26T19:31:43.8982087Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.8983008Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.8983711Z  - Cannot contain spaces 2025-08-26T19:31:43.8984182Z  """ 2025-08-26T19:31:43.8984532Z  2025-08-26T19:31:43.8984984Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.8985707Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.8986445Z  2025-08-26T19:31:43.8986789Z  if valid: 2025-08-26T19:31:43.8987193Z  return True 2025-08-26T19:31:43.8987611Z  2025-08-26T19:31:43.8987951Z  log.error( 2025-08-26T19:31:43.8990095Z  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.8991601Z  ) 2025-08-26T19:31:43.8991964Z  return False 2025-08-26T19:31:43.8992364Z  2025-08-26T19:31:43.8992695Z  2025-08-26T19:31:43.8993207Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.8993839Z  """ 2025-08-26T19:31:43.8994441Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.8995145Z  """ 2025-08-26T19:31:43.8995512Z  try: 2025-08-26T19:31:43.8995883Z  if settings_text: 2025-08-26T19:31:43.8996617Z  # 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.8997379Z  # for easy reading 2025-08-26T19:31:43.8998186Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.8999083Z  # the backtick character in shell commands. 2025-08-26T19:31:43.8999874Z  backtick = chr(96) # backtick character 2025-08-26T19:31:43.9000538Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.9001248Z  settings = load_yaml(settings_text) 2025-08-26T19:31:43.9001752Z  2025-08-26T19:31:43.9002521Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.9003245Z  experiments = {} 2025-08-26T19:31:43.9003694Z  2025-08-26T19:31:43.9004237Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.9004995Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.9006063Z  # 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.9007056Z  continue 2025-08-26T19:31:43.9007499Z  2025-08-26T19:31:43.9007861Z  valid_settings = {} 2025-08-26T19:31:43.9008396Z  for setting in exp_settings: 2025-08-26T19:31:43.9008960Z  if setting not in Experiment._fields: 2025-08-26T19:31:43.9009630Z  log.warning( 2025-08-26T19:31:43.9010377Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.9011072Z  ) 2025-08-26T19:31:43.9011517Z  else: 2025-08-26T19:31:43.9012047Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.9012614Z  2025-08-26T19:31:43.9013070Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.9013719Z  return Settings(experiments) 2025-08-26T19:31:43.9014241Z  2025-08-26T19:31:43.9014585Z  except Exception: 2025-08-26T19:31:43.9015095Z  log.exception("Failed to parse settings") 2025-08-26T19:31:43.9015616Z  2025-08-26T19:31:43.9015963Z  return Settings() 2025-08-26T19:31:43.9016376Z  2025-08-26T19:31:43.9016721Z  2025-08-26T19:31:43.9017298Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.9017870Z  """ 2025-08-26T19:31:43.9018330Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.9018868Z  2025-08-26T19:31:43.9019743Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.9020526Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.9021074Z  2025-08-26T19:31:43.9021668Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.9022380Z  """ 2025-08-26T19:31:43.9022957Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.9023720Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.9024256Z  2025-08-26T19:31:43.9024595Z  2025-08-26T19:31:43.9025038Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.9025588Z  """ 2025-08-26T19:31:43.9026001Z  Parse users from the rollout state. 2025-08-26T19:31:43.9026498Z  2025-08-26T19:31:43.9026825Z  """ 2025-08-26T19:31:43.9027384Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.9028122Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.9028660Z  2025-08-26T19:31:43.9029009Z  2025-08-26T19:31:43.9029825Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.9030564Z  """ 2025-08-26T19:31:43.9031004Z  Check if a user is opted into an experiment 2025-08-26T19:31:43.9031534Z  """ 2025-08-26T19:31:43.9032009Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.9032757Z  2025-08-26T19:31:43.9033101Z  2025-08-26T19:31:43.9033725Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.9034465Z  """ 2025-08-26T19:31:43.9034942Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.9035511Z  """ 2025-08-26T19:31:43.9036027Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.9036725Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.9037366Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.9037958Z  return False 2025-08-26T19:31:43.9038371Z  2025-08-26T19:31:43.9038833Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.9039541Z  log.warning( 2025-08-26T19:31:43.9040350Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.9041197Z  ) 2025-08-26T19:31:43.9041558Z  2025-08-26T19:31:43.9041898Z  return True 2025-08-26T19:31:43.9042284Z  2025-08-26T19:31:43.9042615Z  2025-08-26T19:31:43.9042972Z def get_runner_prefix( 2025-08-26T19:31:43.9043430Z  rollout_state: str, 2025-08-26T19:31:43.9043928Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:43.9044456Z  branch: str, 2025-08-26T19:31:43.9044985Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.9045653Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.9046233Z  is_canary: bool = False, 2025-08-26T19:31:43.9046691Z ) -> str: 2025-08-26T19:31:43.9047134Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:43.9047720Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.9048242Z  2025-08-26T19:31:43.9048724Z  fleet_prefix = "" 2025-08-26T19:31:43.9049308Z  prefixes = [] 2025-08-26T19:31:43.9050007Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.9050931Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.9051635Z  log.info( 2025-08-26T19:31:43.9052329Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.9053059Z  ) 2025-08-26T19:31:43.9053453Z  continue 2025-08-26T19:31:43.9053864Z  2025-08-26T19:31:43.9054231Z  if opt_out_experiments: 2025-08-26T19:31:43.9054782Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.9055414Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.9055992Z  log.info( 2025-08-26T19:31:43.9056935Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.9057892Z  ) 2025-08-26T19:31:43.9058309Z  continue 2025-08-26T19:31:43.9058743Z  2025-08-26T19:31:43.9059103Z  if eligible_experiments: 2025-08-26T19:31:43.9059962Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.9060654Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.9061238Z  log.info( 2025-08-26T19:31:43.9062017Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.9062828Z  ) 2025-08-26T19:31:43.9063395Z  continue 2025-08-26T19:31:43.9063909Z  elif not experiment_settings.default: 2025-08-26T19:31:43.9064436Z  log.info( 2025-08-26T19:31:43.9065108Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.9065811Z  ) 2025-08-26T19:31:43.9066207Z  continue 2025-08-26T19:31:43.9066616Z  2025-08-26T19:31:43.9067078Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.9067687Z  opted_out_users = [ 2025-08-26T19:31:43.9068154Z  requestor 2025-08-26T19:31:43.9068646Z  for requestor in workflow_requestors 2025-08-26T19:31:43.9069540Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.9070173Z  ] 2025-08-26T19:31:43.9070541Z  2025-08-26T19:31:43.9070899Z  if opted_out_users: 2025-08-26T19:31:43.9071368Z  log.info( 2025-08-26T19:31:43.9072013Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.9072699Z  ) 2025-08-26T19:31:43.9073091Z  continue 2025-08-26T19:31:43.9073504Z  2025-08-26T19:31:43.9073956Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.9074554Z  opted_in_users = [ 2025-08-26T19:31:43.9075013Z  requestor 2025-08-26T19:31:43.9075503Z  for requestor in workflow_requestors 2025-08-26T19:31:43.9076171Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.9076775Z  ] 2025-08-26T19:31:43.9077144Z  2025-08-26T19:31:43.9077490Z  enabled = False 2025-08-26T19:31:43.9077960Z  if opted_in_users: 2025-08-26T19:31:43.9078538Z  log.info( 2025-08-26T19:31:43.9079164Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.9079944Z  ) 2025-08-26T19:31:43.9080342Z  enabled = True 2025-08-26T19:31:43.9080787Z  2025-08-26T19:31:43.9081183Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.9081998Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.9082907Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.9083537Z  log.info( 2025-08-26T19:31:43.9084394Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.9085280Z  ) 2025-08-26T19:31:43.9085710Z  enabled = True 2025-08-26T19:31:43.9086162Z  2025-08-26T19:31:43.9086502Z  if enabled: 2025-08-26T19:31:43.9086954Z  label = experiment_name 2025-08-26T19:31:43.9087522Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.9088327Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.9089274Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.9090028Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.9090668Z  if is_canary: 2025-08-26T19:31:43.9091180Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.9091730Z  fleet_prefix = label 2025-08-26T19:31:43.9092349Z  else: 2025-08-26T19:31:43.9092811Z  prefixes.append(label) 2025-08-26T19:31:43.9093312Z  2025-08-26T19:31:43.9093671Z  if len(prefixes) > 1: 2025-08-26T19:31:43.9094125Z  log.error( 2025-08-26T19:31:43.9095141Z  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.9096197Z  ) 2025-08-26T19:31:43.9096597Z  prefixes = prefixes[:1] 2025-08-26T19:31:43.9097072Z  2025-08-26T19:31:43.9097427Z  # Fleet always comes first 2025-08-26T19:31:43.9097912Z  if fleet_prefix: 2025-08-26T19:31:43.9098383Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.9098881Z  2025-08-26T19:31:43.9099620Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.9100213Z  2025-08-26T19:31:43.9100543Z  2025-08-26T19:31:43.9101162Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.9101912Z  """ 2025-08-26T19:31:43.9102498Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.9103193Z  2025-08-26T19:31:43.9103761Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.9104458Z  """ 2025-08-26T19:31:43.9104861Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.9105412Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.9106051Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.9106630Z  2025-08-26T19:31:43.9106959Z  2025-08-26T19:31:43.9107535Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.9108422Z  for _ in range(num_retries): 2025-08-26T19:31:43.9108910Z  try: 2025-08-26T19:31:43.9109582Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:43.9110270Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.9110905Z  return json.loads(content) 2025-08-26T19:31:43.9111425Z  except Exception as e: 2025-08-26T19:31:43.9111974Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.9112514Z  2025-08-26T19:31:43.9113069Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.9113767Z  return {} 2025-08-26T19:31:43.9114152Z  2025-08-26T19:31:43.9114478Z  2025-08-26T19:31:43.9114811Z @cache 2025-08-26T19:31:43.9115431Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.9116183Z  """ 2025-08-26T19:31:43.9116584Z  Dynamically get PR information 2025-08-26T19:31:43.9117084Z  """ 2025-08-26T19:31:43.9117598Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.9118211Z  headers = { 2025-08-26T19:31:43.9118698Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.9119401Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:43.9119928Z  } 2025-08-26T19:31:43.9120369Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.9120977Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.9121516Z  headers=headers, 2025-08-26T19:31:43.9121957Z  ) 2025-08-26T19:31:43.9122307Z  2025-08-26T19:31:43.9122654Z  if not json_response: 2025-08-26T19:31:43.9123397Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.9124009Z  return {} 2025-08-26T19:31:43.9124415Z  2025-08-26T19:31:43.9124763Z  return json_response 2025-08-26T19:31:43.9125377Z  2025-08-26T19:31:43.9125716Z  2025-08-26T19:31:43.9126295Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.9127015Z  """ 2025-08-26T19:31:43.9127548Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.9128179Z  """ 2025-08-26T19:31:43.9128662Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.9129390Z  return { 2025-08-26T19:31:43.9129990Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.9130652Z  } 2025-08-26T19:31:43.9131005Z  2025-08-26T19:31:43.9131335Z  2025-08-26T19:31:43.9131688Z def main() -> None: 2025-08-26T19:31:43.9132130Z  args = parse_args() 2025-08-26T19:31:43.9132574Z  2025-08-26T19:31:43.9132997Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.9133527Z  2025-08-26T19:31:43.9133902Z  # Check if the PR is opt-out 2025-08-26T19:31:43.9134397Z  if args.pr_number: 2025-08-26T19:31:43.9135081Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.9135810Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.9136306Z  log.info( 2025-08-26T19:31:43.9137005Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.9137826Z  ) 2025-08-26T19:31:43.9138395Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.9139054Z  sys.exit() 2025-08-26T19:31:43.9139888Z  2025-08-26T19:31:43.9140236Z  try: 2025-08-26T19:31:43.9140693Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.9141404Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.9142024Z  ) 2025-08-26T19:31:43.9142393Z  2025-08-26T19:31:43.9142783Z  username = get_potential_pr_author( 2025-08-26T19:31:43.9143311Z  args.github_token, 2025-08-26T19:31:43.9143800Z  args.github_repo, 2025-08-26T19:31:43.9144291Z  args.github_actor, 2025-08-26T19:31:43.9144793Z  args.github_ref_type, 2025-08-26T19:31:43.9145298Z  args.github_branch, 2025-08-26T19:31:43.9145756Z  ) 2025-08-26T19:31:43.9146119Z  2025-08-26T19:31:43.9146599Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.9147182Z  2025-08-26T19:31:43.9147586Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.9148118Z  rollout_state, 2025-08-26T19:31:43.9148628Z  (args.github_issue_owner, username), 2025-08-26T19:31:43.9149157Z  args.github_branch, 2025-08-26T19:31:43.9149929Z  args.eligible_experiments, 2025-08-26T19:31:43.9150475Z  args.opt_out_experiments, 2025-08-26T19:31:43.9150970Z  is_canary, 2025-08-26T19:31:43.9151400Z  ) 2025-08-26T19:31:43.9151756Z  2025-08-26T19:31:43.9152119Z  except Exception as e: 2025-08-26T19:31:43.9152601Z  log.error( 2025-08-26T19:31:43.9153291Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.9154243Z  ) 2025-08-26T19:31:43.9154619Z  2025-08-26T19:31:43.9155141Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.9155772Z  2025-08-26T19:31:43.9156238Z  2025-08-26T19:31:43.9156589Z if __name__ == "__main__": 2025-08-26T19:31:43.9157047Z  main() 2025-08-26T19:31:43.9157418Z  2025-08-26T19:31:43.9157751Z EOF 2025-08-26T19:31:43.9158082Z  2025-08-26T19:31:43.9158445Z cat runner_determinator.py 2025-08-26T19:31:43.9474481Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.9475323Z env: 2025-08-26T19:31:43.9476011Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.9476414Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.9476827Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.9477297Z ISSUE_OWNER: 2025-08-26T19:31:43.9477663Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.9478060Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.9478479Z PR_NUMBER: 2025-08-26T19:31:43.9478843Z ##[endgroup] 2025-08-26T19:31:43.9759722Z # flake8: noqa: G004 2025-08-26T19:31:43.9760082Z 2025-08-26T19:31:43.9760508Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.9761407Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.9762171Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.9762578Z 2025-08-26T19:31:43.9762746Z """ 2025-08-26T19:31:43.9763291Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.9764124Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.9764963Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.9765728Z of which runners should be used to run which job. 2025-08-26T19:31:43.9766098Z 2025-08-26T19:31:43.9766465Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.9767537Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.9768381Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.9769040Z list, defined. 2025-08-26T19:31:43.9769710Z 2025-08-26T19:31:43.9770078Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.9770935Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.9771722Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.9772131Z 2025-08-26T19:31:43.9772486Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.9773296Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.9773982Z experiments which the user could be opted in to. 2025-08-26T19:31:43.9774354Z 2025-08-26T19:31:43.9774543Z The user list has the following rules: 2025-08-26T19:31:43.9774881Z 2025-08-26T19:31:43.9775175Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.9776000Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.9776709Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.9777082Z 2025-08-26T19:31:43.9777248Z Example config: 2025-08-26T19:31:43.9777668Z # A list of experiments that can be opted into. 2025-08-26T19:31:43.9778302Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.9778884Z # Expected syntax is: 2025-08-26T19:31:43.9779732Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.9780656Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.9781237Z 2025-08-26T19:31:43.9781402Z experiments: 2025-08-26T19:31:43.9781774Z lf: 2025-08-26T19:31:43.9782127Z rollout_percent: 25 2025-08-26T19:31:43.9782754Z all_branches: false 2025-08-26T19:31:43.9783209Z default: true 2025-08-26T19:31:43.9783594Z --- 2025-08-26T19:31:43.9783786Z 2025-08-26T19:31:43.9784018Z # Opt-ins: 2025-08-26T19:31:43.9784915Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.9786239Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.9787398Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.9788208Z # Experiments should be from the above list. 2025-08-26T19:31:43.9788686Z 2025-08-26T19:31:43.9788922Z @User1,-lf,split_build 2025-08-26T19:31:43.9789603Z @User2,lf 2025-08-26T19:31:43.9789986Z @User3,split_build 2025-08-26T19:31:43.9790371Z """ 2025-08-26T19:31:43.9790547Z 2025-08-26T19:31:43.9790706Z import json 2025-08-26T19:31:43.9791050Z import logging 2025-08-26T19:31:43.9791406Z import os 2025-08-26T19:31:43.9791753Z import random 2025-08-26T19:31:43.9792122Z import re 2025-08-26T19:31:43.9792461Z import sys 2025-08-26T19:31:43.9792842Z from argparse import ArgumentParser 2025-08-26T19:31:43.9793343Z from collections.abc import Iterable 2025-08-26T19:31:43.9793842Z from functools import cache 2025-08-26T19:31:43.9794280Z from logging import LogRecord 2025-08-26T19:31:43.9794731Z from typing import Any, NamedTuple 2025-08-26T19:31:43.9795230Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.9795586Z 2025-08-26T19:31:43.9795743Z import yaml 2025-08-26T19:31:43.9796104Z from github import Auth, Github 2025-08-26T19:31:43.9796567Z from github.Issue import Issue 2025-08-26T19:31:43.9796846Z 2025-08-26T19:31:43.9796853Z 2025-08-26T19:31:43.9797071Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.9797717Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.9798526Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.9799047Z 2025-08-26T19:31:43.9799519Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.9800308Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.9800796Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.9801322Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.9801651Z 2025-08-26T19:31:43.9801843Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.9802153Z 2025-08-26T19:31:43.9802329Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.9802759Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.9803023Z 2025-08-26T19:31:43.9803029Z 2025-08-26T19:31:43.9803207Z class Experiment(NamedTuple): 2025-08-26T19:31:43.9803678Z rollout_perc: float = ( 2025-08-26T19:31:43.9804276Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.9804912Z ) 2025-08-26T19:31:43.9805261Z all_branches: bool = ( 2025-08-26T19:31:43.9805839Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.9806486Z ) 2025-08-26T19:31:43.9806821Z default: bool = ( 2025-08-26T19:31:43.9807358Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.9807957Z ) 2025-08-26T19:31:43.9808145Z 2025-08-26T19:31:43.9808322Z # Add more fields as needed 2025-08-26T19:31:43.9808598Z 2025-08-26T19:31:43.9808604Z 2025-08-26T19:31:43.9808791Z class Settings(NamedTuple): 2025-08-26T19:31:43.9809412Z """ 2025-08-26T19:31:43.9809863Z Settings for the experiments that can be opted into. 2025-08-26T19:31:43.9810389Z """ 2025-08-26T19:31:43.9810575Z 2025-08-26T19:31:43.9810769Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.9811107Z 2025-08-26T19:31:43.9811113Z 2025-08-26T19:31:43.9811309Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.9811889Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.9812293Z 2025-08-26T19:31:43.9812454Z COLORS = { 2025-08-26T19:31:43.9812826Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.9813451Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.9813909Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.9814389Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.9814832Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.9815272Z } 2025-08-26T19:31:43.9815447Z 2025-08-26T19:31:43.9815648Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.9816358Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.9817087Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.9817624Z return super().format(record) 2025-08-26T19:31:43.9817929Z 2025-08-26T19:31:43.9817942Z 2025-08-26T19:31:43.9818125Z handler = logging.StreamHandler() 2025-08-26T19:31:43.9818777Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.9819486Z 2025-08-26T19:31:43.9819735Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.9820290Z log.addHandler(handler) 2025-08-26T19:31:43.9820702Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.9820962Z 2025-08-26T19:31:43.9820970Z 2025-08-26T19:31:43.9821209Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.9821731Z """ 2025-08-26T19:31:43.9822199Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.9822775Z """ 2025-08-26T19:31:43.9823117Z if not GITHUB_OUTPUT: 2025-08-26T19:31:43.9824106Z # 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.9825156Z log.warning( 2025-08-26T19:31:43.9825948Z "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.9826802Z ) 2025-08-26T19:31:43.9837611Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.9838182Z return 2025-08-26T19:31:43.9838414Z 2025-08-26T19:31:43.9838805Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.9839648Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.9840211Z f.write(f"{key}={value}\n") 2025-08-26T19:31:43.9840516Z 2025-08-26T19:31:43.9840523Z 2025-08-26T19:31:43.9840817Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.9841412Z return frozenset( 2025-08-26T19:31:43.9841985Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.9842616Z ) 2025-08-26T19:31:43.9842802Z 2025-08-26T19:31:43.9842808Z 2025-08-26T19:31:43.9842983Z def parse_args() -> Any: 2025-08-26T19:31:43.9843500Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.9844323Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.9845052Z parser.add_argument( 2025-08-26T19:31:43.9845474Z "--github-issue-repo", 2025-08-26T19:31:43.9845913Z type=str, 2025-08-26T19:31:43.9846291Z required=False, 2025-08-26T19:31:43.9846710Z default="pytorch/test-infra", 2025-08-26T19:31:43.9847208Z help="GitHub repo to get the issue", 2025-08-26T19:31:43.9847687Z ) 2025-08-26T19:31:43.9848027Z parser.add_argument( 2025-08-26T19:31:43.9848442Z "--github-repo", 2025-08-26T19:31:43.9848832Z type=str, 2025-08-26T19:31:43.9849392Z required=True, 2025-08-26T19:31:43.9849843Z help="GitHub repo where CI is running", 2025-08-26T19:31:43.9850328Z ) 2025-08-26T19:31:43.9850665Z parser.add_argument( 2025-08-26T19:31:43.9851221Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.9851840Z ) 2025-08-26T19:31:43.9852177Z parser.add_argument( 2025-08-26T19:31:43.9852753Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.9853380Z ) 2025-08-26T19:31:43.9853896Z parser.add_argument( 2025-08-26T19:31:43.9854500Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.9855159Z ) 2025-08-26T19:31:43.9855501Z parser.add_argument( 2025-08-26T19:31:43.9856108Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.9856771Z ) 2025-08-26T19:31:43.9857105Z parser.add_argument( 2025-08-26T19:31:43.9857519Z "--github-ref-type", 2025-08-26T19:31:43.9857935Z type=str, 2025-08-26T19:31:43.9858306Z required=True, 2025-08-26T19:31:43.9858754Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.9859496Z ) 2025-08-26T19:31:43.9859987Z parser.add_argument( 2025-08-26T19:31:43.9860408Z "--eligible-experiments", 2025-08-26T19:31:43.9860883Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.9861362Z required=False, 2025-08-26T19:31:43.9861758Z default="", 2025-08-26T19:31:43.9862547Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.9863415Z ) 2025-08-26T19:31:43.9863746Z parser.add_argument( 2025-08-26T19:31:43.9864173Z "--opt-out-experiments", 2025-08-26T19:31:43.9864649Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.9865132Z required=False, 2025-08-26T19:31:43.9865529Z default="", 2025-08-26T19:31:43.9865886Z help=( 2025-08-26T19:31:43.9866514Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.9867577Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.9868354Z ), 2025-08-26T19:31:43.9868683Z ) 2025-08-26T19:31:43.9869036Z parser.add_argument( 2025-08-26T19:31:43.9869717Z "--pr-number", 2025-08-26T19:31:43.9870125Z type=str, 2025-08-26T19:31:43.9870506Z required=False, 2025-08-26T19:31:43.9870904Z default="", 2025-08-26T19:31:43.9871503Z help="the optional PR number where this is run", 2025-08-26T19:31:43.9872038Z ) 2025-08-26T19:31:43.9872219Z 2025-08-26T19:31:43.9872403Z return parser.parse_args() 2025-08-26T19:31:43.9872688Z 2025-08-26T19:31:43.9872694Z 2025-08-26T19:31:43.9873078Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.9873785Z auth = Auth.Token(github_token) 2025-08-26T19:31:43.9874254Z return Github(auth=auth) 2025-08-26T19:31:43.9874529Z 2025-08-26T19:31:43.9874536Z 2025-08-26T19:31:43.9874961Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.9875703Z repo = gh.get_repo(repo) 2025-08-26T19:31:43.9876153Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.9876496Z 2025-08-26T19:31:43.9876502Z 2025-08-26T19:31:43.9876680Z def get_potential_pr_author( 2025-08-26T19:31:43.9877280Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.9877910Z ) -> str: 2025-08-26T19:31:43.9878392Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.9879138Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.9880111Z # embedded in the tag name: ciflow// 2025-08-26T19:31:43.9880502Z 2025-08-26T19:31:43.9880681Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.9880992Z 2025-08-26T19:31:43.9881244Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.9881824Z split_tag = ref_name.split("/") 2025-08-26T19:31:43.9882298Z if ( 2025-08-26T19:31:43.9882654Z len(split_tag) == 3 2025-08-26T19:31:43.9883108Z and split_tag[0] == "ciflow" 2025-08-26T19:31:43.9883611Z and split_tag[2].isnumeric() 2025-08-26T19:31:43.9884072Z ): 2025-08-26T19:31:43.9884606Z pr_number = split_tag[2] 2025-08-26T19:31:43.9885055Z try: 2025-08-26T19:31:43.9885455Z repository = gh.get_repo(repo) 2025-08-26T19:31:43.9886024Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.9886577Z except Exception as e: 2025-08-26T19:31:43.9887050Z raise Exception( # noqa: TRY002 2025-08-26T19:31:43.9887677Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.9888273Z ) from e 2025-08-26T19:31:43.9888766Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.9889525Z # In all other cases, return the original input username 2025-08-26T19:31:43.9890067Z return username 2025-08-26T19:31:43.9890291Z 2025-08-26T19:31:43.9890298Z 2025-08-26T19:31:43.9890507Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.9890999Z """ 2025-08-26T19:31:43.9891601Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.9892328Z """ 2025-08-26T19:31:43.9892827Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.9893307Z 2025-08-26T19:31:43.9893314Z 2025-08-26T19:31:43.9893501Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.9893949Z try: 2025-08-26T19:31:43.9894311Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.9894784Z return data 2025-08-26T19:31:43.9895171Z except yaml.YAMLError: 2025-08-26T19:31:43.9895615Z log.exception("Error loading YAML") 2025-08-26T19:31:43.9896097Z raise 2025-08-26T19:31:43.9896294Z 2025-08-26T19:31:43.9896301Z 2025-08-26T19:31:43.9896695Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.9897378Z """ 2025-08-26T19:31:43.9897949Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.9898511Z 2025-08-26T19:31:43.9898972Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.9899951Z and the text below is the list of opted in users. 2025-08-26T19:31:43.9900335Z 2025-08-26T19:31:43.9900696Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.9901341Z """ 2025-08-26T19:31:43.9901754Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.9902305Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.9902861Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.9903402Z else: 2025-08-26T19:31:43.9903757Z return "", rollout_state 2025-08-26T19:31:43.9904041Z 2025-08-26T19:31:43.9904048Z 2025-08-26T19:31:43.9904239Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.9904706Z """ 2025-08-26T19:31:43.9905185Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.9905781Z """ 2025-08-26T19:31:43.9905967Z 2025-08-26T19:31:43.9905973Z 2025-08-26T19:31:43.9906298Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.9906894Z """ 2025-08-26T19:31:43.9907548Z 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.9908175Z 2025-08-26T19:31:43.9908757Z 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.9909918Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.9910557Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.9911004Z 2025-08-26T19:31:43.9911011Z 2025-08-26T19:31:43.9911161Z """ 2025-08-26T19:31:43.9911505Z optins = UserOptins() 2025-08-26T19:31:43.9911952Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.9912466Z user = user.strip("\r\n\t -") 2025-08-26T19:31:43.9913122Z if not user or not user.startswith("@"): 2025-08-26T19:31:43.9913640Z # Not a valid user. Skip 2025-08-26T19:31:43.9914091Z continue 2025-08-26T19:31:43.9914313Z 2025-08-26T19:31:43.9914471Z if user: 2025-08-26T19:31:43.9914870Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.9915512Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.9915977Z 2025-08-26T19:31:43.9916133Z return optins 2025-08-26T19:31:43.9916356Z 2025-08-26T19:31:43.9916363Z 2025-08-26T19:31:43.9916637Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.9917199Z """ 2025-08-26T19:31:43.9917570Z Check if the experiment name is valid. 2025-08-26T19:31:43.9918049Z A valid name: 2025-08-26T19:31:43.9918646Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.9919717Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.9920398Z - Cannot contain spaces 2025-08-26T19:31:43.9920826Z """ 2025-08-26T19:31:43.9921018Z 2025-08-26T19:31:43.9973674Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.9975052Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.9975727Z 2025-08-26T19:31:43.9975977Z if valid: 2025-08-26T19:31:43.9976357Z return True 2025-08-26T19:31:43.9976588Z 2025-08-26T19:31:43.9976744Z log.error( 2025-08-26T19:31:43.9978094Z 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.9979993Z ) 2025-08-26T19:31:43.9980330Z return False 2025-08-26T19:31:43.9980550Z 2025-08-26T19:31:43.9980556Z 2025-08-26T19:31:43.9980852Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.9981453Z """ 2025-08-26T19:31:43.9982259Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.9982954Z """ 2025-08-26T19:31:43.9983281Z try: 2025-08-26T19:31:43.9983622Z if settings_text: 2025-08-26T19:31:43.9984303Z # 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.9985040Z # for easy reading 2025-08-26T19:31:43.9985756Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.9986577Z # the backtick character in shell commands. 2025-08-26T19:31:43.9987132Z backtick = chr(96) # backtick character 2025-08-26T19:31:43.9987750Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.9988355Z settings = load_yaml(settings_text) 2025-08-26T19:31:43.9988698Z 2025-08-26T19:31:43.9989077Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.9990065Z experiments = {} 2025-08-26T19:31:43.9990348Z 2025-08-26T19:31:43.9990718Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.9991431Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.9992450Z # 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.9993416Z continue 2025-08-26T19:31:43.9993678Z 2025-08-26T19:31:43.9993857Z valid_settings = {} 2025-08-26T19:31:43.9994322Z for setting in exp_settings: 2025-08-26T19:31:43.9994858Z if setting not in Experiment._fields: 2025-08-26T19:31:43.9995369Z log.warning( 2025-08-26T19:31:43.9996017Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.9996827Z ) 2025-08-26T19:31:43.9997224Z else: 2025-08-26T19:31:43.9997696Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.9998078Z 2025-08-26T19:31:43.9998336Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.9998930Z return Settings(experiments) 2025-08-26T19:31:43.9999445Z 2025-08-26T19:31:43.9999617Z except Exception: 2025-08-26T19:31:44.0000062Z log.exception("Failed to parse settings") 2025-08-26T19:31:44.0000422Z 2025-08-26T19:31:44.0000581Z return Settings() 2025-08-26T19:31:44.0000821Z 2025-08-26T19:31:44.0000827Z 2025-08-26T19:31:44.0001061Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:44.0001592Z """ 2025-08-26T19:31:44.0001982Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:44.0002345Z 2025-08-26T19:31:44.0002680Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:44.0003369Z and the text below is the list of opted in users. 2025-08-26T19:31:44.0003762Z 2025-08-26T19:31:44.0004136Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:44.0004821Z """ 2025-08-26T19:31:44.0005319Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.0006020Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:44.0006381Z 2025-08-26T19:31:44.0006388Z 2025-08-26T19:31:44.0006614Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:44.0007131Z """ 2025-08-26T19:31:44.0007486Z Parse users from the rollout state. 2025-08-26T19:31:44.0007812Z 2025-08-26T19:31:44.0007959Z """ 2025-08-26T19:31:44.0008442Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:44.0009112Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:44.0009775Z 2025-08-26T19:31:44.0009782Z 2025-08-26T19:31:44.0010325Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.0011028Z """ 2025-08-26T19:31:44.0011410Z Check if a user is opted into an experiment 2025-08-26T19:31:44.0011899Z """ 2025-08-26T19:31:44.0012311Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:44.0012692Z 2025-08-26T19:31:44.0012698Z 2025-08-26T19:31:44.0013089Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:44.0013775Z """ 2025-08-26T19:31:44.0014217Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:44.0014751Z """ 2025-08-26T19:31:44.0015214Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:44.0015831Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:44.0016417Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:44.0016970Z return False 2025-08-26T19:31:44.0017203Z 2025-08-26T19:31:44.0017449Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:44.0018004Z log.warning( 2025-08-26T19:31:44.0018731Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:44.0019840Z ) 2025-08-26T19:31:44.0020032Z 2025-08-26T19:31:44.0020184Z return True 2025-08-26T19:31:44.0020399Z 2025-08-26T19:31:44.0020405Z 2025-08-26T19:31:44.0020570Z def get_runner_prefix( 2025-08-26T19:31:44.0020970Z rollout_state: str, 2025-08-26T19:31:44.0021402Z workflow_requestors: Iterable[str], 2025-08-26T19:31:44.0021881Z branch: str, 2025-08-26T19:31:44.0022451Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.0023291Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:44.0023828Z is_canary: bool = False, 2025-08-26T19:31:44.0024247Z ) -> str: 2025-08-26T19:31:44.0024811Z settings = parse_settings(rollout_state) 2025-08-26T19:31:44.0025354Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:44.0025689Z 2025-08-26T19:31:44.0025846Z fleet_prefix = "" 2025-08-26T19:31:44.0026236Z prefixes = [] 2025-08-26T19:31:44.0026818Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:44.0027677Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:44.0028326Z log.info( 2025-08-26T19:31:44.0028939Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:44.0029776Z ) 2025-08-26T19:31:44.0030119Z continue 2025-08-26T19:31:44.0030351Z 2025-08-26T19:31:44.0030524Z if opt_out_experiments: 2025-08-26T19:31:44.0031011Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:44.0031590Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:44.0032131Z log.info( 2025-08-26T19:31:44.0032970Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:44.0033862Z ) 2025-08-26T19:31:44.0034213Z continue 2025-08-26T19:31:44.0034459Z 2025-08-26T19:31:44.0034633Z if eligible_experiments: 2025-08-26T19:31:44.0035124Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:44.0035700Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:44.0036253Z log.info( 2025-08-26T19:31:44.0036964Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:44.0037733Z ) 2025-08-26T19:31:44.0038095Z continue 2025-08-26T19:31:44.0038522Z elif not experiment_settings.default: 2025-08-26T19:31:44.0039009Z log.info( 2025-08-26T19:31:44.0039868Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:44.0040561Z ) 2025-08-26T19:31:44.0040895Z continue 2025-08-26T19:31:44.0041114Z 2025-08-26T19:31:44.0041376Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:44.0041942Z opted_out_users = [ 2025-08-26T19:31:44.0042355Z requestor 2025-08-26T19:31:44.0042766Z for requestor in workflow_requestors 2025-08-26T19:31:44.0043379Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.0043948Z ] 2025-08-26T19:31:44.0044135Z 2025-08-26T19:31:44.0044297Z if opted_out_users: 2025-08-26T19:31:44.0044709Z log.info( 2025-08-26T19:31:44.0045269Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:44.0045915Z ) 2025-08-26T19:31:44.0046255Z continue 2025-08-26T19:31:44.0046485Z 2025-08-26T19:31:44.0046738Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:44.0047296Z opted_in_users = [ 2025-08-26T19:31:44.0047699Z requestor 2025-08-26T19:31:44.0048110Z for requestor in workflow_requestors 2025-08-26T19:31:44.0048721Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:44.0049558Z ] 2025-08-26T19:31:44.0049786Z 2025-08-26T19:31:44.0049951Z enabled = False 2025-08-26T19:31:44.0050354Z if opted_in_users: 2025-08-26T19:31:44.0050754Z log.info( 2025-08-26T19:31:44.0051303Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:44.0051925Z ) 2025-08-26T19:31:44.0052289Z enabled = True 2025-08-26T19:31:44.0052542Z 2025-08-26T19:31:44.0052742Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:44.0053510Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:44.0054567Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:44.0055164Z log.info( 2025-08-26T19:31:44.0055963Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:44.0056796Z ) 2025-08-26T19:31:44.0057171Z enabled = True 2025-08-26T19:31:44.0057437Z 2025-08-26T19:31:44.0057589Z if enabled: 2025-08-26T19:31:44.0057981Z label = experiment_name 2025-08-26T19:31:44.0058486Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:44.0059787Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:44.0060654Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:44.0061370Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:44.0061985Z if is_canary: 2025-08-26T19:31:44.0062431Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:44.0062936Z fleet_prefix = label 2025-08-26T19:31:44.0063387Z else: 2025-08-26T19:31:44.0063770Z prefixes.append(label) 2025-08-26T19:31:44.0064089Z 2025-08-26T19:31:44.0064261Z if len(prefixes) > 1: 2025-08-26T19:31:44.0064667Z log.error( 2025-08-26T19:31:44.0065613Z 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:44.0066627Z ) 2025-08-26T19:31:44.0066984Z prefixes = prefixes[:1] 2025-08-26T19:31:44.0067264Z 2025-08-26T19:31:44.0067445Z # Fleet always comes first 2025-08-26T19:31:44.0067872Z if fleet_prefix: 2025-08-26T19:31:44.0068283Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:44.0068608Z 2025-08-26T19:31:44.0068984Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:44.0069700Z 2025-08-26T19:31:44.0069707Z 2025-08-26T19:31:44.0070126Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:44.0070842Z """ 2025-08-26T19:31:44.0071389Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:44.0071894Z 2025-08-26T19:31:44.0072258Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:44.0072899Z """ 2025-08-26T19:31:44.0073249Z gh = get_gh_client(github_token) 2025-08-26T19:31:44.0073749Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:44.0074326Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:44.0074724Z 2025-08-26T19:31:44.0074730Z 2025-08-26T19:31:44.0075096Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:44.0075799Z for _ in range(num_retries): 2025-08-26T19:31:44.0076239Z try: 2025-08-26T19:31:44.0076625Z req = Request(url=url, headers=headers) 2025-08-26T19:31:44.0077231Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:44.0077828Z return json.loads(content) 2025-08-26T19:31:44.0078310Z except Exception as e: 2025-08-26T19:31:44.0078794Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:44.0079162Z 2025-08-26T19:31:44.0079632Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:44.0080280Z return {} 2025-08-26T19:31:44.0080477Z 2025-08-26T19:31:44.0080483Z 2025-08-26T19:31:44.0080629Z @cache 2025-08-26T19:31:44.0081207Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:44.0081899Z """ 2025-08-26T19:31:44.0082260Z Dynamically get PR information 2025-08-26T19:31:44.0082872Z """ 2025-08-26T19:31:44.0083327Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:44.0083893Z headers = { 2025-08-26T19:31:44.0084313Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:44.0084870Z "Authorization": f"token {github_token}", 2025-08-26T19:31:44.0085356Z } 2025-08-26T19:31:44.0085742Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:44.0086297Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:44.0086816Z headers=headers, 2025-08-26T19:31:44.0087201Z ) 2025-08-26T19:31:44.0087388Z 2025-08-26T19:31:44.0087557Z if not json_response: 2025-08-26T19:31:44.0088092Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:44.0088660Z return {} 2025-08-26T19:31:44.0088870Z 2025-08-26T19:31:44.0089042Z return json_response 2025-08-26T19:31:44.0089508Z 2025-08-26T19:31:44.0089515Z 2025-08-26T19:31:44.0089896Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:44.0090591Z """ 2025-08-26T19:31:44.0091072Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:44.0091673Z """ 2025-08-26T19:31:44.0092102Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:44.0092659Z return { 2025-08-26T19:31:44.0093187Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:44.0093829Z } 2025-08-26T19:31:44.0094010Z 2025-08-26T19:31:44.0094018Z 2025-08-26T19:31:44.0094181Z def main() -> None: 2025-08-26T19:31:44.0094559Z args = parse_args() 2025-08-26T19:31:44.0094802Z 2025-08-26T19:31:44.0095010Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:44.0095355Z 2025-08-26T19:31:44.0095531Z # Check if the PR is opt-out 2025-08-26T19:31:44.0095982Z if args.pr_number: 2025-08-26T19:31:44.0096575Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:44.0097396Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:44.0097860Z log.info( 2025-08-26T19:31:44.0098494Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:44.0099397Z ) 2025-08-26T19:31:44.0100154Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.0100779Z sys.exit() 2025-08-26T19:31:44.0101019Z 2025-08-26T19:31:44.0101169Z try: 2025-08-26T19:31:44.0101568Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:44.0102216Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:44.0102796Z ) 2025-08-26T19:31:44.0102980Z 2025-08-26T19:31:44.0103176Z username = get_potential_pr_author( 2025-08-26T19:31:44.0103666Z args.github_token, 2025-08-26T19:31:44.0104107Z args.github_repo, 2025-08-26T19:31:44.0104534Z args.github_actor, 2025-08-26T19:31:44.0104987Z args.github_ref_type, 2025-08-26T19:31:44.0105439Z args.github_branch, 2025-08-26T19:31:44.0105853Z ) 2025-08-26T19:31:44.0106037Z 2025-08-26T19:31:44.0106305Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:44.0106717Z 2025-08-26T19:31:44.0106916Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:44.0107427Z rollout_state, 2025-08-26T19:31:44.0107863Z (args.github_issue_owner, username), 2025-08-26T19:31:44.0108371Z args.github_branch, 2025-08-26T19:31:44.0108819Z args.eligible_experiments, 2025-08-26T19:31:44.0109558Z args.opt_out_experiments, 2025-08-26T19:31:44.0110032Z is_canary, 2025-08-26T19:31:44.0110402Z ) 2025-08-26T19:31:44.0110585Z 2025-08-26T19:31:44.0110760Z except Exception as e: 2025-08-26T19:31:44.0111174Z log.error( 2025-08-26T19:31:44.0111781Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:44.0112641Z ) 2025-08-26T19:31:44.0112834Z 2025-08-26T19:31:44.0113139Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:44.0113597Z 2025-08-26T19:31:44.0113603Z 2025-08-26T19:31:44.0113778Z if __name__ == "__main__": 2025-08-26T19:31:44.0114178Z main() 2025-08-26T19:31:44.0114368Z 2025-08-26T19:31:44.0206877Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:44.0207706Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:44.0248559Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:44.0249021Z env: 2025-08-26T19:31:44.0249880Z GITHUB_TOKEN: *** 2025-08-26T19:31:44.0250259Z ISSUE_NUMBER: 5132 2025-08-26T19:31:44.0250671Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:44.0251121Z ISSUE_OWNER: 2025-08-26T19:31:44.0251484Z CHECK_EXPERIMENTS: 2025-08-26T19:31:44.0251863Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:44.0252266Z PR_NUMBER: 2025-08-26T19:31:44.0252602Z ##[endgroup] 2025-08-26T19:31:44.4215837Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:44.7960740Z Collecting urllib3==1.26.18 2025-08-26T19:31:44.8291929Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:44.8538289Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-08-26T19:31:44.8757593Z Collecting PyGithub==2.3.0 2025-08-26T19:31:44.8787174Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:44.9210785Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:44.9240292Z 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:44.9286053Z 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:44.9307211Z 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:44.9323416Z 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:44.9583352Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:44.9612415Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:44.9851346Z 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:45.1014145Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.1047787Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:45.2239631Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:45.2271615Z 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:45.2454811Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.2487249Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:45.2729365Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:45.2799679Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.3 MB/s eta 0:00:00 2025-08-26T19:31:45.2829732Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:45.2918098Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 51.6 MB/s eta 0:00:00 2025-08-26T19:31:45.2947845Z 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:45.3045029Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 109.1 MB/s eta 0:00:00 2025-08-26T19:31:45.3072858Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:45.3122983Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:45.3190633Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 95.2 MB/s eta 0:00:00 2025-08-26T19:31:45.3254799Z 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:45.3297405Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 30.7 MB/s eta 0:00:00 2025-08-26T19:31:45.3324908Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:45.3368382Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.0 MB/s eta 0:00:00 2025-08-26T19:31:45.6341336Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:46.1757796Z 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:46.2741519Z ##[group]Run curr_branch="main" 2025-08-26T19:31:46.2741872Z curr_branch="main" 2025-08-26T19:31:46.2742174Z curr_ref_type="branch" 2025-08-26T19:31:46.2742470Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:46.2742760Z  2025-08-26T19:31:46.2742988Z python3 runner_determinator.py \ 2025-08-26T19:31:46.2743303Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:46.2743625Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:46.2743949Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:46.2744261Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:46.2744586Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:46.2744905Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:46.2745269Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:46.2745638Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:46.2746056Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:46.2746391Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:46.2789614Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:46.2789906Z env: 2025-08-26T19:31:46.2790593Z GITHUB_TOKEN: *** 2025-08-26T19:31:46.2790838Z ISSUE_NUMBER: 5132 2025-08-26T19:31:46.2791083Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:46.2791369Z ISSUE_OWNER: 2025-08-26T19:31:46.2791606Z CHECK_EXPERIMENTS: 2025-08-26T19:31:46.2791835Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:46.2792060Z PR_NUMBER: 2025-08-26T19:31:46.2792272Z ##[endgroup] 2025-08-26T19:31:46.2856928Z Current branch is 'main' 2025-08-26T19:31:47.9842478Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:47.9843856Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:47.9845071Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:47.9846048Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:48.0192120Z Evaluate and set job outputs 2025-08-26T19:31:48.0198791Z Set output 'label-type' 2025-08-26T19:31:48.0200929Z Cleaning up orphan processes