2025-08-26T19:31:42.9011791Z Current runner version: '2.328.0' 2025-08-26T19:31:42.9037957Z ##[group]Runner Image Provisioner 2025-08-26T19:31:42.9038844Z Hosted Compute Agent 2025-08-26T19:31:42.9039358Z Version: 20250825.382 2025-08-26T19:31:42.9039940Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:31:42.9040665Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:31:42.9041259Z ##[endgroup] 2025-08-26T19:31:42.9041786Z ##[group]Operating System 2025-08-26T19:31:42.9042739Z Ubuntu 2025-08-26T19:31:42.9043242Z 24.04.2 2025-08-26T19:31:42.9043676Z LTS 2025-08-26T19:31:42.9044193Z ##[endgroup] 2025-08-26T19:31:42.9044651Z ##[group]Runner Image 2025-08-26T19:31:42.9045242Z Image: ubuntu-24.04 2025-08-26T19:31:42.9045741Z Version: 20250818.1.0 2025-08-26T19:31:42.9046787Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:42.9048322Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:42.9049361Z ##[endgroup] 2025-08-26T19:31:42.9050415Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:42.9052880Z Contents: read 2025-08-26T19:31:42.9053443Z Metadata: read 2025-08-26T19:31:42.9054009Z Packages: read 2025-08-26T19:31:42.9054483Z ##[endgroup] 2025-08-26T19:31:42.9056713Z Secret source: Actions 2025-08-26T19:31:42.9057762Z Prepare workflow directory 2025-08-26T19:31:42.9585788Z Prepare all required actions 2025-08-26T19:31:42.9644271Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:42.9649226Z ##[group] Inputs 2025-08-26T19:31:42.9649963Z check_experiments: 2025-08-26T19:31:42.9650585Z opt_out_experiments: 2025-08-26T19:31:42.9651123Z triggering_actor: pytorchmergebot 2025-08-26T19:31:42.9651773Z issue_owner: 2025-08-26T19:31:42.9652622Z curr_branch: main 2025-08-26T19:31:42.9653297Z curr_ref_type: branch 2025-08-26T19:31:42.9653955Z issue_number: 5132 2025-08-26T19:31:42.9654506Z ##[endgroup] 2025-08-26T19:31:42.9655127Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:43.0244296Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:43.0246599Z cat < runner_determinator.py 2025-08-26T19:31:43.0247349Z # flake8: noqa: G004 2025-08-26T19:31:43.0247877Z  2025-08-26T19:31:43.0248621Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.0249681Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.0250668Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.0251395Z  2025-08-26T19:31:43.0251847Z """ 2025-08-26T19:31:43.0252913Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.0253893Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.0255083Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.0255991Z of which runners should be used to run which job. 2025-08-26T19:31:43.0256718Z  2025-08-26T19:31:43.0257390Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.0258416Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.0259446Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.0260296Z list, defined. 2025-08-26T19:31:43.0260813Z  2025-08-26T19:31:43.0261438Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.0262852Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.0263836Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.0264751Z  2025-08-26T19:31:43.0265582Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.0266550Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.0267468Z experiments which the user could be opted in to. 2025-08-26T19:31:43.0268152Z  2025-08-26T19:31:43.0268615Z The user list has the following rules: 2025-08-26T19:31:43.0269259Z  2025-08-26T19:31:43.0269907Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.0270905Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.0271745Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.0272682Z  2025-08-26T19:31:43.0273184Z Example config: 2025-08-26T19:31:43.0273756Z  # A list of experiments that can be opted into. 2025-08-26T19:31:43.0274713Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.0275462Z  # Expected syntax is: 2025-08-26T19:31:43.0276305Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.0277397Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.0278216Z  2025-08-26T19:31:43.0278717Z  experiments: 2025-08-26T19:31:43.0279249Z  lf: 2025-08-26T19:31:43.0279746Z  rollout_percent: 25 2025-08-26T19:31:43.0280278Z  all_branches: false 2025-08-26T19:31:43.0280918Z  default: true 2025-08-26T19:31:43.0281458Z  --- 2025-08-26T19:31:43.0281872Z  2025-08-26T19:31:43.0282665Z  # Opt-ins: 2025-08-26T19:31:43.0283381Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.0284634Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.0285551Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.0286339Z  # Experiments should be from the above list. 2025-08-26T19:31:43.0287071Z  2025-08-26T19:31:43.0287529Z  @User1,-lf,split_build 2025-08-26T19:31:43.0288113Z  @User2,lf 2025-08-26T19:31:43.0288610Z  @User3,split_build 2025-08-26T19:31:43.0289255Z """ 2025-08-26T19:31:43.0289693Z  2025-08-26T19:31:43.0290158Z import json 2025-08-26T19:31:43.0290775Z import logging 2025-08-26T19:31:43.0291342Z import os 2025-08-26T19:31:43.0291885Z import random 2025-08-26T19:31:43.0292672Z import re 2025-08-26T19:31:43.0293217Z import sys 2025-08-26T19:31:43.0293877Z from argparse import ArgumentParser 2025-08-26T19:31:43.0294551Z from collections.abc import Iterable 2025-08-26T19:31:43.0295202Z from functools import cache 2025-08-26T19:31:43.0295763Z from logging import LogRecord 2025-08-26T19:31:43.0296464Z from typing import Any, NamedTuple 2025-08-26T19:31:43.0297113Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.0297731Z  2025-08-26T19:31:43.0298290Z import yaml 2025-08-26T19:31:43.0298792Z from github import Auth, Github 2025-08-26T19:31:43.0299404Z from github.Issue import Issue 2025-08-26T19:31:43.0300023Z  2025-08-26T19:31:43.0300479Z  2025-08-26T19:31:43.0300971Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.0301867Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.0303140Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.0304125Z  2025-08-26T19:31:43.0304757Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.0305419Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.0306090Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.0306842Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.0307432Z  2025-08-26T19:31:43.0307903Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.0308544Z  2025-08-26T19:31:43.0309018Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.0309607Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.0310223Z  2025-08-26T19:31:43.0310638Z  2025-08-26T19:31:43.0311121Z class Experiment(NamedTuple): 2025-08-26T19:31:43.0311781Z  rollout_perc: float = ( 2025-08-26T19:31:43.0312739Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.0313542Z  ) 2025-08-26T19:31:43.0314078Z  all_branches: bool = ( 2025-08-26T19:31:43.0314852Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.0315596Z  ) 2025-08-26T19:31:43.0316128Z  default: bool = ( 2025-08-26T19:31:43.0316839Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.0317581Z  ) 2025-08-26T19:31:43.0318089Z  2025-08-26T19:31:43.0318532Z  # Add more fields as needed 2025-08-26T19:31:43.0319115Z  2025-08-26T19:31:43.0319554Z  2025-08-26T19:31:43.0320056Z class Settings(NamedTuple): 2025-08-26T19:31:43.0320648Z  """ 2025-08-26T19:31:43.0321262Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:43.0321951Z  """ 2025-08-26T19:31:43.0322640Z  2025-08-26T19:31:43.0323222Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.0323831Z  2025-08-26T19:31:43.0324442Z  2025-08-26T19:31:43.0324982Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.0325767Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.0326457Z  2025-08-26T19:31:43.0326906Z  COLORS = { 2025-08-26T19:31:43.0327500Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.0328128Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.0328783Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.0329386Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.0329998Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.0330639Z  } 2025-08-26T19:31:43.0331072Z  2025-08-26T19:31:43.0331626Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.0332857Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.0333814Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.0334511Z  return super().format(record) 2025-08-26T19:31:43.0335114Z  2025-08-26T19:31:43.0335578Z  2025-08-26T19:31:43.0336112Z handler = logging.StreamHandler() 2025-08-26T19:31:43.0337002Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.0337837Z  2025-08-26T19:31:43.0338409Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.0339176Z log.addHandler(handler) 2025-08-26T19:31:43.0339732Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.0340331Z  2025-08-26T19:31:43.0422706Z  2025-08-26T19:31:43.0423616Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.0424648Z  """ 2025-08-26T19:31:43.0425636Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.0427089Z  """ 2025-08-26T19:31:43.0427840Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:43.0429913Z  # 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.0431997Z  log.warning( 2025-08-26T19:31:43.0433724Z  "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.0435337Z  ) 2025-08-26T19:31:43.0436100Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.0437046Z  return 2025-08-26T19:31:43.0437771Z  2025-08-26T19:31:43.0438429Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.0439424Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.0440430Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:43.0441279Z  2025-08-26T19:31:43.0441850Z  2025-08-26T19:31:43.0443068Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.0444204Z  return frozenset( 2025-08-26T19:31:43.0445305Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.0446460Z  ) 2025-08-26T19:31:43.0447076Z  2025-08-26T19:31:43.0447644Z  2025-08-26T19:31:43.0448243Z def parse_args() -> Any: 2025-08-26T19:31:43.0449250Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.0450749Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.0452312Z  parser.add_argument( 2025-08-26T19:31:43.0453217Z  "--github-issue-repo", 2025-08-26T19:31:43.0454074Z  type=str, 2025-08-26T19:31:43.0454828Z  required=False, 2025-08-26T19:31:43.0455880Z  default="pytorch/test-infra", 2025-08-26T19:31:43.0456867Z  help="GitHub repo to get the issue", 2025-08-26T19:31:43.0457756Z  ) 2025-08-26T19:31:43.0458408Z  parser.add_argument( 2025-08-26T19:31:43.0459199Z  "--github-repo", 2025-08-26T19:31:43.0459992Z  type=str, 2025-08-26T19:31:43.0460731Z  required=True, 2025-08-26T19:31:43.0461588Z  help="GitHub repo where CI is running", 2025-08-26T19:31:43.0462834Z  ) 2025-08-26T19:31:43.0463495Z  parser.add_argument( 2025-08-26T19:31:43.0464603Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.0465723Z  ) 2025-08-26T19:31:43.0466384Z  parser.add_argument( 2025-08-26T19:31:43.0467516Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.0468706Z  ) 2025-08-26T19:31:43.0469363Z  parser.add_argument( 2025-08-26T19:31:43.0470514Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.0471700Z  ) 2025-08-26T19:31:43.0472534Z  parser.add_argument( 2025-08-26T19:31:43.0473745Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.0474985Z  ) 2025-08-26T19:31:43.0475628Z  parser.add_argument( 2025-08-26T19:31:43.0476460Z  "--github-ref-type", 2025-08-26T19:31:43.0477290Z  type=str, 2025-08-26T19:31:43.0478008Z  required=True, 2025-08-26T19:31:43.0478902Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.0479858Z  ) 2025-08-26T19:31:43.0480510Z  parser.add_argument( 2025-08-26T19:31:43.0481610Z  "--eligible-experiments", 2025-08-26T19:31:43.0482744Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.0483670Z  required=False, 2025-08-26T19:31:43.0484490Z  default="", 2025-08-26T19:31:43.0486019Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.0487626Z  ) 2025-08-26T19:31:43.0488284Z  parser.add_argument( 2025-08-26T19:31:43.0489124Z  "--opt-out-experiments", 2025-08-26T19:31:43.0490054Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:43.0490954Z  required=False, 2025-08-26T19:31:43.0491719Z  default="", 2025-08-26T19:31:43.0493360Z  help=( 2025-08-26T19:31:43.0494576Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.0496586Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.0498037Z  ), 2025-08-26T19:31:43.0498678Z  ) 2025-08-26T19:31:43.0499352Z  parser.add_argument( 2025-08-26T19:31:43.0500152Z  "--pr-number", 2025-08-26T19:31:43.0500914Z  type=str, 2025-08-26T19:31:43.0501649Z  required=False, 2025-08-26T19:31:43.0502657Z  default="", 2025-08-26T19:31:43.0503548Z  help="the optional PR number where this is run", 2025-08-26T19:31:43.0504487Z  ) 2025-08-26T19:31:43.0505098Z  2025-08-26T19:31:43.0505740Z  return parser.parse_args() 2025-08-26T19:31:43.0506556Z  2025-08-26T19:31:43.0507109Z  2025-08-26T19:31:43.0508136Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.0509716Z  auth = Auth.Token(github_token) 2025-08-26T19:31:43.0510615Z  return Github(auth=auth) 2025-08-26T19:31:43.0511408Z  2025-08-26T19:31:43.0511991Z  2025-08-26T19:31:43.0513294Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.0514680Z  repo = gh.get_repo(repo) 2025-08-26T19:31:43.0515602Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.0516482Z  2025-08-26T19:31:43.0517047Z  2025-08-26T19:31:43.0517669Z def get_potential_pr_author( 2025-08-26T19:31:43.0518819Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.0519970Z ) -> str: 2025-08-26T19:31:43.0520905Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.0522490Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.0523840Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:43.0524838Z  2025-08-26T19:31:43.0525480Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.0526316Z  2025-08-26T19:31:43.0527124Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.0528201Z  split_tag = ref_name.split("/") 2025-08-26T19:31:43.0529062Z  if ( 2025-08-26T19:31:43.0529747Z  len(split_tag) == 3 2025-08-26T19:31:43.0530643Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:43.0531562Z  and split_tag[2].isnumeric() 2025-08-26T19:31:43.0532593Z  ): 2025-08-26T19:31:43.0533304Z  pr_number = split_tag[2] 2025-08-26T19:31:43.0534168Z  try: 2025-08-26T19:31:43.0534950Z  repository = gh.get_repo(repo) 2025-08-26T19:31:43.0536247Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.0537320Z  except Exception as e: 2025-08-26T19:31:43.0538239Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:43.0539389Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.0540517Z  ) from e 2025-08-26T19:31:43.0541512Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.0543017Z  # In all other cases, return the original input username 2025-08-26T19:31:43.0544053Z  return username 2025-08-26T19:31:43.0544778Z  2025-08-26T19:31:43.0545332Z  2025-08-26T19:31:43.0546048Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.0546970Z  """ 2025-08-26T19:31:43.0548116Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.0549483Z  """ 2025-08-26T19:31:43.0550428Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.0551568Z  2025-08-26T19:31:43.0552308Z  2025-08-26T19:31:43.0552990Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.0553834Z  try: 2025-08-26T19:31:43.0554528Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.0555411Z  return data 2025-08-26T19:31:43.0556193Z  except yaml.YAMLError: 2025-08-26T19:31:43.0557063Z  log.exception("Error loading YAML") 2025-08-26T19:31:43.0557928Z  raise 2025-08-26T19:31:43.0558600Z  2025-08-26T19:31:43.0559164Z  2025-08-26T19:31:43.0560221Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.0561504Z  """ 2025-08-26T19:31:43.0563034Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.0564332Z  2025-08-26T19:31:43.0565259Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.0566586Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.0567520Z  2025-08-26T19:31:43.0568509Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.0569713Z  """ 2025-08-26T19:31:43.0570498Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.0571555Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.0572822Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.0573837Z  else: 2025-08-26T19:31:43.0574516Z  return "", rollout_state 2025-08-26T19:31:43.0575351Z  2025-08-26T19:31:43.0575902Z  2025-08-26T19:31:43.0576580Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.0577464Z  """ 2025-08-26T19:31:43.0578383Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.0579483Z  """ 2025-08-26T19:31:43.0580070Z  2025-08-26T19:31:43.0580640Z  2025-08-26T19:31:43.0581541Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.0582877Z  """ 2025-08-26T19:31:43.0584116Z  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.0585678Z  2025-08-26T19:31:43.0587058Z  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.0588822Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.0590242Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.0591349Z  2025-08-26T19:31:43.0591926Z  2025-08-26T19:31:43.0592719Z  """ 2025-08-26T19:31:43.0593365Z  optins = UserOptins() 2025-08-26T19:31:43.0594269Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.0595214Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:43.0596170Z  if not user or not user.startswith("@"): 2025-08-26T19:31:43.0597143Z  # Not a valid user. Skip 2025-08-26T19:31:43.0598008Z  continue 2025-08-26T19:31:43.0598711Z  2025-08-26T19:31:43.0599287Z  if user: 2025-08-26T19:31:43.0600092Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.0601294Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.0602617Z  2025-08-26T19:31:43.0603219Z  return optins 2025-08-26T19:31:43.0603954Z  2025-08-26T19:31:43.0604506Z  2025-08-26T19:31:43.0605345Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.0606395Z  """ 2025-08-26T19:31:43.0607154Z  Check if the experiment name is valid. 2025-08-26T19:31:43.0608046Z  A valid name: 2025-08-26T19:31:43.0609194Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.0610841Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.0612255Z  - Cannot contain spaces 2025-08-26T19:31:43.0613091Z  """ 2025-08-26T19:31:43.0613780Z  2025-08-26T19:31:43.0614544Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.0615786Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.0617241Z  2025-08-26T19:31:43.0618150Z  if valid: 2025-08-26T19:31:43.0618835Z  return True 2025-08-26T19:31:43.0619540Z  2025-08-26T19:31:43.0620121Z  log.error( 2025-08-26T19:31:43.0622854Z  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.0625517Z  ) 2025-08-26T19:31:43.0626145Z  return False 2025-08-26T19:31:43.0626847Z  2025-08-26T19:31:43.0627400Z  2025-08-26T19:31:43.0628265Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.0629381Z  """ 2025-08-26T19:31:43.0630404Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.0631638Z  """ 2025-08-26T19:31:43.0632465Z  try: 2025-08-26T19:31:43.0633133Z  if settings_text: 2025-08-26T19:31:43.0634419Z  # 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.0635779Z  # for easy reading 2025-08-26T19:31:43.0637177Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.0638703Z  # the backtick character in shell commands. 2025-08-26T19:31:43.0639759Z  backtick = chr(96) # backtick character 2025-08-26T19:31:43.0640898Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.0642262Z  settings = load_yaml(settings_text) 2025-08-26T19:31:43.0643181Z  2025-08-26T19:31:43.0644439Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.0645732Z  experiments = {} 2025-08-26T19:31:43.0646518Z  2025-08-26T19:31:43.0647458Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.0648776Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.0650657Z  # 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.0652641Z  continue 2025-08-26T19:31:43.0653412Z  2025-08-26T19:31:43.0654052Z  valid_settings = {} 2025-08-26T19:31:43.0654961Z  for setting in exp_settings: 2025-08-26T19:31:43.0655942Z  if setting not in Experiment._fields: 2025-08-26T19:31:43.0656918Z  log.warning( 2025-08-26T19:31:43.0658145Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.0659372Z  ) 2025-08-26T19:31:43.0660138Z  else: 2025-08-26T19:31:43.0661069Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.0662034Z  2025-08-26T19:31:43.0663061Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.0664195Z  return Settings(experiments) 2025-08-26T19:31:43.0665037Z  2025-08-26T19:31:43.0665637Z  except Exception: 2025-08-26T19:31:43.0666500Z  log.exception("Failed to parse settings") 2025-08-26T19:31:43.0667427Z  2025-08-26T19:31:43.0668026Z  return Settings() 2025-08-26T19:31:43.0668747Z  2025-08-26T19:31:43.0669309Z  2025-08-26T19:31:43.0670303Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.0671323Z  """ 2025-08-26T19:31:43.0672270Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.0673242Z  2025-08-26T19:31:43.0674150Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.0675459Z  and the text below is the list of opted in users. 2025-08-26T19:31:43.0676410Z  2025-08-26T19:31:43.0677421Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.0678661Z  """ 2025-08-26T19:31:43.0679653Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.0680979Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.0681897Z  2025-08-26T19:31:43.0682688Z  2025-08-26T19:31:43.0683456Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.0684478Z  """ 2025-08-26T19:31:43.0685170Z  Parse users from the rollout state. 2025-08-26T19:31:43.0686041Z  2025-08-26T19:31:43.0686609Z  """ 2025-08-26T19:31:43.0687546Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.0688861Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.0689781Z  2025-08-26T19:31:43.0690341Z  2025-08-26T19:31:43.0691383Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.0692907Z  """ 2025-08-26T19:31:43.0693654Z  Check if a user is opted into an experiment 2025-08-26T19:31:43.0694559Z  """ 2025-08-26T19:31:43.0695423Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.0696630Z  2025-08-26T19:31:43.0697197Z  2025-08-26T19:31:43.0698280Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.0699565Z  """ 2025-08-26T19:31:43.0700377Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.0701374Z  """ 2025-08-26T19:31:43.0702488Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.0703703Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.0704839Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.0705880Z  return False 2025-08-26T19:31:43.0706590Z  2025-08-26T19:31:43.0707368Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.0708404Z  log.warning( 2025-08-26T19:31:43.0709836Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.0711320Z  ) 2025-08-26T19:31:43.0711959Z  2025-08-26T19:31:43.0712734Z  return True 2025-08-26T19:31:43.0713409Z  2025-08-26T19:31:43.0713961Z  2025-08-26T19:31:43.0714582Z def get_runner_prefix( 2025-08-26T19:31:43.0715364Z  rollout_state: str, 2025-08-26T19:31:43.0716199Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:43.0717084Z  branch: str, 2025-08-26T19:31:43.0717998Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.0719168Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.0720161Z  is_canary: bool = False, 2025-08-26T19:31:43.0720967Z ) -> str: 2025-08-26T19:31:43.0721711Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:43.0722905Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.0723806Z  2025-08-26T19:31:43.0724615Z  fleet_prefix = "" 2025-08-26T19:31:43.0725399Z  prefixes = [] 2025-08-26T19:31:43.0726543Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.0728173Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.0729394Z  log.info( 2025-08-26T19:31:43.0730617Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.0731910Z  ) 2025-08-26T19:31:43.0732758Z  continue 2025-08-26T19:31:43.0733488Z  2025-08-26T19:31:43.0734106Z  if opt_out_experiments: 2025-08-26T19:31:43.0735055Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.0736156Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.0737187Z  log.info( 2025-08-26T19:31:43.0738806Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.0740451Z  ) 2025-08-26T19:31:43.0741173Z  continue 2025-08-26T19:31:43.0741947Z  2025-08-26T19:31:43.0742800Z  if eligible_experiments: 2025-08-26T19:31:43.0743815Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.0744906Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.0745853Z  log.info( 2025-08-26T19:31:43.0747231Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.0748650Z  ) 2025-08-26T19:31:43.0749752Z  continue 2025-08-26T19:31:43.0750621Z  elif not experiment_settings.default: 2025-08-26T19:31:43.0751522Z  log.info( 2025-08-26T19:31:43.0752901Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.0754157Z  ) 2025-08-26T19:31:43.0754823Z  continue 2025-08-26T19:31:43.0755541Z  2025-08-26T19:31:43.0756341Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.0757405Z  opted_out_users = [ 2025-08-26T19:31:43.0758202Z  requestor 2025-08-26T19:31:43.0759020Z  for requestor in workflow_requestors 2025-08-26T19:31:43.0760143Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.0761212Z  ] 2025-08-26T19:31:43.0761847Z  2025-08-26T19:31:43.0762650Z  if opted_out_users: 2025-08-26T19:31:43.0763492Z  log.info( 2025-08-26T19:31:43.0764610Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.0765774Z  ) 2025-08-26T19:31:43.0766455Z  continue 2025-08-26T19:31:43.0767171Z  2025-08-26T19:31:43.0767952Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.0768973Z  opted_in_users = [ 2025-08-26T19:31:43.0769774Z  requestor 2025-08-26T19:31:43.0770617Z  for requestor in workflow_requestors 2025-08-26T19:31:43.0771777Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.0773030Z  ] 2025-08-26T19:31:43.0773642Z  2025-08-26T19:31:43.0774258Z  enabled = False 2025-08-26T19:31:43.0775054Z  if opted_in_users: 2025-08-26T19:31:43.0776048Z  log.info( 2025-08-26T19:31:43.0777129Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.0778312Z  ) 2025-08-26T19:31:43.0779000Z  enabled = True 2025-08-26T19:31:43.0779751Z  2025-08-26T19:31:43.0780436Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.0781874Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.0783713Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.0784894Z  log.info( 2025-08-26T19:31:43.0786418Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.0787994Z  ) 2025-08-26T19:31:43.0788748Z  enabled = True 2025-08-26T19:31:43.0789558Z  2025-08-26T19:31:43.0790139Z  if enabled: 2025-08-26T19:31:43.0790909Z  label = experiment_name 2025-08-26T19:31:43.0791873Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.0793514Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.0795032Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.0796358Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.0797502Z  if is_canary: 2025-08-26T19:31:43.0798388Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.0799328Z  fleet_prefix = label 2025-08-26T19:31:43.0800456Z  else: 2025-08-26T19:31:43.0801237Z  prefixes.append(label) 2025-08-26T19:31:43.0802278Z  2025-08-26T19:31:43.0802908Z  if len(prefixes) > 1: 2025-08-26T19:31:43.0803726Z  log.error( 2025-08-26T19:31:43.0805535Z  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.0807418Z  ) 2025-08-26T19:31:43.0808117Z  prefixes = prefixes[:1] 2025-08-26T19:31:43.0808921Z  2025-08-26T19:31:43.0809522Z  # Fleet always comes first 2025-08-26T19:31:43.0810365Z  if fleet_prefix: 2025-08-26T19:31:43.0811206Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.0812244Z  2025-08-26T19:31:43.0813001Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.0814000Z  2025-08-26T19:31:43.0814585Z  2025-08-26T19:31:43.0815680Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.0816975Z  """ 2025-08-26T19:31:43.0818064Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.0819265Z  2025-08-26T19:31:43.0820233Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.0821458Z  """ 2025-08-26T19:31:43.0822339Z  gh = get_gh_client(github_token) 2025-08-26T19:31:43.0823302Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.0824396Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.0825448Z  2025-08-26T19:31:43.0826019Z  2025-08-26T19:31:43.0827028Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.0828566Z  for _ in range(num_retries): 2025-08-26T19:31:43.0829441Z  try: 2025-08-26T19:31:43.0830202Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:43.0831328Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.0832681Z  return json.loads(content) 2025-08-26T19:31:43.0833578Z  except Exception as e: 2025-08-26T19:31:43.0834540Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.0835478Z  2025-08-26T19:31:43.0836478Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.0837715Z  return {} 2025-08-26T19:31:43.0838366Z  2025-08-26T19:31:43.0838938Z  2025-08-26T19:31:43.0839513Z @cache 2025-08-26T19:31:43.0840589Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.0841882Z  """ 2025-08-26T19:31:43.0842795Z  Dynamically get PR information 2025-08-26T19:31:43.0843672Z  """ 2025-08-26T19:31:43.0844538Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.0845598Z  headers = { 2025-08-26T19:31:43.0846435Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.0847493Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:43.0848392Z  } 2025-08-26T19:31:43.0849144Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.0850203Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.0851132Z  headers=headers, 2025-08-26T19:31:43.0851903Z  ) 2025-08-26T19:31:43.0852680Z  2025-08-26T19:31:43.0853302Z  if not json_response: 2025-08-26T19:31:43.0854618Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.0855704Z  return {} 2025-08-26T19:31:43.0856386Z  2025-08-26T19:31:43.0857018Z  return json_response 2025-08-26T19:31:43.0857794Z  2025-08-26T19:31:43.0858354Z  2025-08-26T19:31:43.0859345Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.0860577Z  """ 2025-08-26T19:31:43.0861506Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.0862830Z  """ 2025-08-26T19:31:43.0863664Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.0864745Z  return { 2025-08-26T19:31:43.0865762Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.0866918Z  } 2025-08-26T19:31:43.0867513Z  2025-08-26T19:31:43.0868101Z  2025-08-26T19:31:43.0868700Z def main() -> None: 2025-08-26T19:31:43.0869454Z  args = parse_args() 2025-08-26T19:31:43.0870188Z  2025-08-26T19:31:43.0870915Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.0871856Z  2025-08-26T19:31:43.0872692Z  # Check if the PR is opt-out 2025-08-26T19:31:43.0873543Z  if args.pr_number: 2025-08-26T19:31:43.0874717Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.0876036Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.0876897Z  log.info( 2025-08-26T19:31:43.0878118Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.0879437Z  ) 2025-08-26T19:31:43.0880417Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0881582Z  sys.exit() 2025-08-26T19:31:43.0882752Z  2025-08-26T19:31:43.0883359Z  try: 2025-08-26T19:31:43.0884123Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.0885404Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.0886515Z  ) 2025-08-26T19:31:43.0887132Z  2025-08-26T19:31:43.0887795Z  username = get_potential_pr_author( 2025-08-26T19:31:43.0888703Z  args.github_token, 2025-08-26T19:31:43.0889574Z  args.github_repo, 2025-08-26T19:31:43.0890416Z  args.github_actor, 2025-08-26T19:31:43.0891280Z  args.github_ref_type, 2025-08-26T19:31:43.0892319Z  args.github_branch, 2025-08-26T19:31:43.0893165Z  ) 2025-08-26T19:31:43.0893790Z  2025-08-26T19:31:43.0894617Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.0895648Z  2025-08-26T19:31:43.0896346Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.0897306Z  rollout_state, 2025-08-26T19:31:43.0898211Z  (args.github_issue_owner, username), 2025-08-26T19:31:43.0899140Z  args.github_branch, 2025-08-26T19:31:43.0900025Z  args.eligible_experiments, 2025-08-26T19:31:43.0901140Z  args.opt_out_experiments, 2025-08-26T19:31:43.0902012Z  is_canary, 2025-08-26T19:31:43.0902906Z  ) 2025-08-26T19:31:43.0903537Z  2025-08-26T19:31:43.0904162Z  except Exception as e: 2025-08-26T19:31:43.0904968Z  log.error( 2025-08-26T19:31:43.0906140Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.0907666Z  ) 2025-08-26T19:31:43.0908323Z  2025-08-26T19:31:43.0909211Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.0910313Z  2025-08-26T19:31:43.0910899Z  2025-08-26T19:31:43.0911506Z if __name__ == "__main__": 2025-08-26T19:31:43.0912473Z  main() 2025-08-26T19:31:43.0913114Z  2025-08-26T19:31:43.0913661Z EOF 2025-08-26T19:31:43.0914258Z  2025-08-26T19:31:43.0914894Z cat runner_determinator.py 2025-08-26T19:31:43.1288957Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.1290261Z env: 2025-08-26T19:31:43.1291292Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.1291989Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.1293003Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.1293871Z ISSUE_OWNER: 2025-08-26T19:31:43.1294545Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.1295249Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.1295978Z PR_NUMBER: 2025-08-26T19:31:43.1296592Z ##[endgroup] 2025-08-26T19:31:43.1624991Z # flake8: noqa: G004 2025-08-26T19:31:43.1625484Z 2025-08-26T19:31:43.1626204Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:43.1627799Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:43.1629159Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:43.1629886Z 2025-08-26T19:31:43.1630140Z """ 2025-08-26T19:31:43.1631073Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:43.1632795Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:43.1634320Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:43.1635718Z of which runners should be used to run which job. 2025-08-26T19:31:43.1636701Z 2025-08-26T19:31:43.1637392Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:43.1639235Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:43.1640993Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:43.1642343Z list, defined. 2025-08-26T19:31:43.1642734Z 2025-08-26T19:31:43.1643345Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:43.1644860Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:43.1646270Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:43.1647025Z 2025-08-26T19:31:43.1647660Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:43.1649179Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:43.1650448Z experiments which the user could be opted in to. 2025-08-26T19:31:43.1651141Z 2025-08-26T19:31:43.1651492Z The user list has the following rules: 2025-08-26T19:31:43.1652602Z 2025-08-26T19:31:43.1653165Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:43.1654676Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:43.1656042Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:43.1656749Z 2025-08-26T19:31:43.1657043Z Example config: 2025-08-26T19:31:43.1657841Z # A list of experiments that can be opted into. 2025-08-26T19:31:43.1659023Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:43.1660095Z # Expected syntax is: 2025-08-26T19:31:43.1661205Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:43.1663123Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:43.1664171Z 2025-08-26T19:31:43.1664462Z experiments: 2025-08-26T19:31:43.1665107Z lf: 2025-08-26T19:31:43.1665706Z rollout_percent: 25 2025-08-26T19:31:43.1666773Z all_branches: false 2025-08-26T19:31:43.1667516Z default: true 2025-08-26T19:31:43.1668177Z --- 2025-08-26T19:31:43.1668498Z 2025-08-26T19:31:43.1668761Z # Opt-ins: 2025-08-26T19:31:43.1669768Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:43.1671302Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:43.1672838Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:43.1674026Z # Experiments should be from the above list. 2025-08-26T19:31:43.1674709Z 2025-08-26T19:31:43.1675028Z @User1,-lf,split_build 2025-08-26T19:31:43.1675800Z @User2,lf 2025-08-26T19:31:43.1676461Z @User3,split_build 2025-08-26T19:31:43.1677216Z """ 2025-08-26T19:31:43.1677534Z 2025-08-26T19:31:43.1677803Z import json 2025-08-26T19:31:43.1678412Z import logging 2025-08-26T19:31:43.1679022Z import os 2025-08-26T19:31:43.1679652Z import random 2025-08-26T19:31:43.1680291Z import re 2025-08-26T19:31:43.1680875Z import sys 2025-08-26T19:31:43.1681555Z from argparse import ArgumentParser 2025-08-26T19:31:43.1682662Z from collections.abc import Iterable 2025-08-26T19:31:43.1683569Z from functools import cache 2025-08-26T19:31:43.1684357Z from logging import LogRecord 2025-08-26T19:31:43.1685152Z from typing import Any, NamedTuple 2025-08-26T19:31:43.1686014Z from urllib.request import Request, urlopen 2025-08-26T19:31:43.1686675Z 2025-08-26T19:31:43.1686946Z import yaml 2025-08-26T19:31:43.1687589Z from github import Auth, Github 2025-08-26T19:31:43.1688395Z from github.Issue import Issue 2025-08-26T19:31:43.1688888Z 2025-08-26T19:31:43.1688897Z 2025-08-26T19:31:43.1689245Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:43.1690372Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:43.1691793Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:43.1693028Z 2025-08-26T19:31:43.1693425Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:43.1694584Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:43.1695469Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:43.1696372Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:43.1696962Z 2025-08-26T19:31:43.1697309Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:43.1697910Z 2025-08-26T19:31:43.1698224Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:43.1699014Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:43.1699498Z 2025-08-26T19:31:43.1699509Z 2025-08-26T19:31:43.1699912Z class Experiment(NamedTuple): 2025-08-26T19:31:43.1700834Z rollout_perc: float = ( 2025-08-26T19:31:43.1701995Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:43.1703351Z ) 2025-08-26T19:31:43.1703975Z all_branches: bool = ( 2025-08-26T19:31:43.1705022Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:43.1706236Z ) 2025-08-26T19:31:43.1706852Z default: bool = ( 2025-08-26T19:31:43.1707864Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:43.1708995Z ) 2025-08-26T19:31:43.1709331Z 2025-08-26T19:31:43.1709628Z # Add more fields as needed 2025-08-26T19:31:43.1710130Z 2025-08-26T19:31:43.1710139Z 2025-08-26T19:31:43.1710447Z class Settings(NamedTuple): 2025-08-26T19:31:43.1711161Z """ 2025-08-26T19:31:43.1711924Z Settings for the experiments that can be opted into. 2025-08-26T19:31:43.1713137Z """ 2025-08-26T19:31:43.1713467Z 2025-08-26T19:31:43.1713807Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:43.1714406Z 2025-08-26T19:31:43.1714417Z 2025-08-26T19:31:43.1714758Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:43.1715799Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:43.1716540Z 2025-08-26T19:31:43.1716807Z COLORS = { 2025-08-26T19:31:43.1717459Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:43.1718567Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:43.1719444Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:43.1720324Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:43.1721174Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:43.1722559Z } 2025-08-26T19:31:43.1722978Z 2025-08-26T19:31:43.1723378Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:43.1724691Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:43.1726011Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:43.1727003Z return super().format(record) 2025-08-26T19:31:43.1727549Z 2025-08-26T19:31:43.1727561Z 2025-08-26T19:31:43.1727889Z handler = logging.StreamHandler() 2025-08-26T19:31:43.1729040Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:43.1729992Z 2025-08-26T19:31:43.1730401Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:43.1731406Z log.addHandler(handler) 2025-08-26T19:31:43.1732404Z log.setLevel(logging.INFO) 2025-08-26T19:31:43.1732897Z 2025-08-26T19:31:43.1732910Z 2025-08-26T19:31:43.1733321Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:43.1734259Z """ 2025-08-26T19:31:43.1735102Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:43.1736183Z """ 2025-08-26T19:31:43.1736822Z if not GITHUB_OUTPUT: 2025-08-26T19:31:43.1738678Z # 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.1740713Z log.warning( 2025-08-26T19:31:43.1742479Z "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.1744163Z ) 2025-08-26T19:31:43.1758725Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:43.1759708Z return 2025-08-26T19:31:43.1760137Z 2025-08-26T19:31:43.1760712Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:43.1761737Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:43.1762972Z f.write(f"{key}={value}\n") 2025-08-26T19:31:43.1763518Z 2025-08-26T19:31:43.1763529Z 2025-08-26T19:31:43.1764032Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:43.1765084Z return frozenset( 2025-08-26T19:31:43.1766079Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:43.1767205Z ) 2025-08-26T19:31:43.1767533Z 2025-08-26T19:31:43.1767543Z 2025-08-26T19:31:43.1767833Z def parse_args() -> Any: 2025-08-26T19:31:43.1768724Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:43.1770165Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:43.1771458Z parser.add_argument( 2025-08-26T19:31:43.1772411Z "--github-issue-repo", 2025-08-26T19:31:43.1773261Z type=str, 2025-08-26T19:31:43.1773978Z required=False, 2025-08-26T19:31:43.1774774Z default="pytorch/test-infra", 2025-08-26T19:31:43.1775730Z help="GitHub repo to get the issue", 2025-08-26T19:31:43.1776639Z ) 2025-08-26T19:31:43.1777250Z parser.add_argument( 2025-08-26T19:31:43.1778132Z "--github-repo", 2025-08-26T19:31:43.1778842Z type=str, 2025-08-26T19:31:43.1779506Z required=True, 2025-08-26T19:31:43.1780305Z help="GitHub repo where CI is running", 2025-08-26T19:31:43.1781208Z ) 2025-08-26T19:31:43.1781858Z parser.add_argument( 2025-08-26T19:31:43.1783196Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:43.1784377Z ) 2025-08-26T19:31:43.1784986Z parser.add_argument( 2025-08-26T19:31:43.1786016Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:43.1787128Z ) 2025-08-26T19:31:43.1787994Z parser.add_argument( 2025-08-26T19:31:43.1789095Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:43.1790349Z ) 2025-08-26T19:31:43.1791012Z parser.add_argument( 2025-08-26T19:31:43.1792375Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:43.1793640Z ) 2025-08-26T19:31:43.1794237Z parser.add_argument( 2025-08-26T19:31:43.1794981Z "--github-ref-type", 2025-08-26T19:31:43.1795721Z type=str, 2025-08-26T19:31:43.1796373Z required=True, 2025-08-26T19:31:43.1797152Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:43.1798085Z ) 2025-08-26T19:31:43.1798731Z parser.add_argument( 2025-08-26T19:31:43.1799556Z "--eligible-experiments", 2025-08-26T19:31:43.1800559Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.1801467Z required=False, 2025-08-26T19:31:43.1802374Z default="", 2025-08-26T19:31:43.1803893Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:43.1805563Z ) 2025-08-26T19:31:43.1806190Z parser.add_argument( 2025-08-26T19:31:43.1806977Z "--opt-out-experiments", 2025-08-26T19:31:43.1807840Z type=_str_comma_separated_to_set, 2025-08-26T19:31:43.1808712Z required=False, 2025-08-26T19:31:43.1809443Z default="", 2025-08-26T19:31:43.1810099Z help=( 2025-08-26T19:31:43.1811200Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:43.1813311Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:43.1814778Z ), 2025-08-26T19:31:43.1815374Z ) 2025-08-26T19:31:43.1815981Z parser.add_argument( 2025-08-26T19:31:43.1816690Z "--pr-number", 2025-08-26T19:31:43.1817393Z type=str, 2025-08-26T19:31:43.1818095Z required=False, 2025-08-26T19:31:43.1818835Z default="", 2025-08-26T19:31:43.1819911Z help="the optional PR number where this is run", 2025-08-26T19:31:43.1820931Z ) 2025-08-26T19:31:43.1821282Z 2025-08-26T19:31:43.1821684Z return parser.parse_args() 2025-08-26T19:31:43.1822503Z 2025-08-26T19:31:43.1822515Z 2025-08-26T19:31:43.1823237Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.1824750Z auth = Auth.Token(github_token) 2025-08-26T19:31:43.1883990Z return Github(auth=auth) 2025-08-26T19:31:43.1884369Z 2025-08-26T19:31:43.1884385Z 2025-08-26T19:31:43.1884892Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:43.1885694Z repo = gh.get_repo(repo) 2025-08-26T19:31:43.1886228Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:43.1886575Z 2025-08-26T19:31:43.1886582Z 2025-08-26T19:31:43.1886775Z def get_potential_pr_author( 2025-08-26T19:31:43.1887412Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:43.1888061Z ) -> str: 2025-08-26T19:31:43.1888548Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:43.1889316Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:43.1890013Z # embedded in the tag name: ciflow// 2025-08-26T19:31:43.1890416Z 2025-08-26T19:31:43.1890602Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.1890913Z 2025-08-26T19:31:43.1891170Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:43.1891762Z split_tag = ref_name.split("/") 2025-08-26T19:31:43.1892402Z if ( 2025-08-26T19:31:43.1892777Z len(split_tag) == 3 2025-08-26T19:31:43.1893257Z and split_tag[0] == "ciflow" 2025-08-26T19:31:43.1893764Z and split_tag[2].isnumeric() 2025-08-26T19:31:43.1894234Z ): 2025-08-26T19:31:43.1894809Z pr_number = split_tag[2] 2025-08-26T19:31:43.1895278Z try: 2025-08-26T19:31:43.1895681Z repository = gh.get_repo(repo) 2025-08-26T19:31:43.1896267Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:43.1896883Z except Exception as e: 2025-08-26T19:31:43.1897389Z raise Exception( # noqa: TRY002 2025-08-26T19:31:43.1898017Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:43.1898615Z ) from e 2025-08-26T19:31:43.1899117Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:43.1899762Z # In all other cases, return the original input username 2025-08-26T19:31:43.1900315Z return username 2025-08-26T19:31:43.1900542Z 2025-08-26T19:31:43.1900548Z 2025-08-26T19:31:43.1900783Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:43.1901299Z """ 2025-08-26T19:31:43.1901908Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:43.1902756Z """ 2025-08-26T19:31:43.1903284Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:43.1903765Z 2025-08-26T19:31:43.1903772Z 2025-08-26T19:31:43.1903959Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:43.1904440Z try: 2025-08-26T19:31:43.1904816Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:43.1905290Z return data 2025-08-26T19:31:43.1905684Z except yaml.YAMLError: 2025-08-26T19:31:43.1906130Z log.exception("Error loading YAML") 2025-08-26T19:31:43.1906661Z raise 2025-08-26T19:31:43.1906881Z 2025-08-26T19:31:43.1906888Z 2025-08-26T19:31:43.1907299Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:43.1908041Z """ 2025-08-26T19:31:43.1908657Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:43.1909250Z 2025-08-26T19:31:43.1909731Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.1910512Z and the text below is the list of opted in users. 2025-08-26T19:31:43.1910916Z 2025-08-26T19:31:43.1911270Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:43.1911950Z """ 2025-08-26T19:31:43.1912495Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:43.1913064Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:43.1913632Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:43.1914185Z else: 2025-08-26T19:31:43.1914547Z return "", rollout_state 2025-08-26T19:31:43.1914830Z 2025-08-26T19:31:43.1914837Z 2025-08-26T19:31:43.1915027Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:43.1915508Z """ 2025-08-26T19:31:43.1915992Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:43.1916594Z """ 2025-08-26T19:31:43.1916781Z 2025-08-26T19:31:43.1916787Z 2025-08-26T19:31:43.1917109Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:43.1917721Z """ 2025-08-26T19:31:43.1918403Z 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.1919055Z 2025-08-26T19:31:43.1919636Z 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.1920579Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:43.1921217Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:43.1921671Z 2025-08-26T19:31:43.1921678Z 2025-08-26T19:31:43.1921829Z """ 2025-08-26T19:31:43.1922390Z optins = UserOptins() 2025-08-26T19:31:43.1922865Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:43.1923398Z user = user.strip("\r\n\t -") 2025-08-26T19:31:43.1924093Z if not user or not user.startswith("@"): 2025-08-26T19:31:43.1924625Z # Not a valid user. Skip 2025-08-26T19:31:43.1925077Z continue 2025-08-26T19:31:43.1925308Z 2025-08-26T19:31:43.1925460Z if user: 2025-08-26T19:31:43.1925869Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:43.1926522Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:43.1926983Z 2025-08-26T19:31:43.1927145Z return optins 2025-08-26T19:31:43.1927364Z 2025-08-26T19:31:43.1927370Z 2025-08-26T19:31:43.1927636Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:43.1928202Z """ 2025-08-26T19:31:43.1928569Z Check if the experiment name is valid. 2025-08-26T19:31:43.1929069Z A valid name: 2025-08-26T19:31:43.1929655Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:43.1930535Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:43.1931217Z - Cannot contain spaces 2025-08-26T19:31:43.1931650Z """ 2025-08-26T19:31:43.1931838Z 2025-08-26T19:31:43.1932215Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:43.1932869Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:43.1933287Z 2025-08-26T19:31:43.1933440Z if valid: 2025-08-26T19:31:43.1933797Z return True 2025-08-26T19:31:43.1934023Z 2025-08-26T19:31:43.1934177Z log.error( 2025-08-26T19:31:43.1935547Z 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.1937053Z ) 2025-08-26T19:31:43.1937389Z return False 2025-08-26T19:31:43.1937606Z 2025-08-26T19:31:43.1937612Z 2025-08-26T19:31:43.1937902Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:43.1938479Z """ 2025-08-26T19:31:43.1939159Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:43.1939847Z """ 2025-08-26T19:31:43.1940185Z try: 2025-08-26T19:31:43.1940531Z if settings_text: 2025-08-26T19:31:43.1941208Z # 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.1941951Z # for easy reading 2025-08-26T19:31:43.1942809Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:43.1943647Z # the backtick character in shell commands. 2025-08-26T19:31:43.1944212Z backtick = chr(96) # backtick character 2025-08-26T19:31:43.1944841Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:43.1945456Z settings = load_yaml(settings_text) 2025-08-26T19:31:43.1945801Z 2025-08-26T19:31:43.1946195Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:43.1946901Z experiments = {} 2025-08-26T19:31:43.1947175Z 2025-08-26T19:31:43.1947537Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:43.1948238Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:43.1949259Z # 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.1950229Z continue 2025-08-26T19:31:43.1950492Z 2025-08-26T19:31:43.1950664Z valid_settings = {} 2025-08-26T19:31:43.1951150Z for setting in exp_settings: 2025-08-26T19:31:43.1951679Z if setting not in Experiment._fields: 2025-08-26T19:31:43.1952281Z log.warning( 2025-08-26T19:31:43.1952935Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:43.1953742Z ) 2025-08-26T19:31:43.1954177Z else: 2025-08-26T19:31:43.1954647Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:43.1955046Z 2025-08-26T19:31:43.1955309Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:43.1955903Z return Settings(experiments) 2025-08-26T19:31:43.1956223Z 2025-08-26T19:31:43.1956383Z except Exception: 2025-08-26T19:31:43.1956829Z log.exception("Failed to parse settings") 2025-08-26T19:31:43.1957191Z 2025-08-26T19:31:43.1957358Z return Settings() 2025-08-26T19:31:43.1957597Z 2025-08-26T19:31:43.1957604Z 2025-08-26T19:31:43.1957836Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:43.1958362Z """ 2025-08-26T19:31:43.1958767Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:43.1959144Z 2025-08-26T19:31:43.1959479Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:43.1960194Z and the text below is the list of opted in users. 2025-08-26T19:31:43.1960567Z 2025-08-26T19:31:43.1960960Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:43.1961646Z """ 2025-08-26T19:31:43.1962673Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.1963408Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:43.1963793Z 2025-08-26T19:31:43.1963799Z 2025-08-26T19:31:43.1964028Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:43.1964554Z """ 2025-08-26T19:31:43.1964913Z Parse users from the rollout state. 2025-08-26T19:31:43.1965241Z 2025-08-26T19:31:43.1965388Z """ 2025-08-26T19:31:43.1965868Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:43.1966551Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:43.1966920Z 2025-08-26T19:31:43.1966926Z 2025-08-26T19:31:43.1967453Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.1968149Z """ 2025-08-26T19:31:43.1968535Z Check if a user is opted into an experiment 2025-08-26T19:31:43.1969072Z """ 2025-08-26T19:31:43.1969498Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:43.1969882Z 2025-08-26T19:31:43.1969888Z 2025-08-26T19:31:43.1970274Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:43.1970977Z """ 2025-08-26T19:31:43.1971429Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:43.1971985Z """ 2025-08-26T19:31:43.1972695Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:43.1973340Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:43.1973944Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:43.1974517Z return False 2025-08-26T19:31:43.1974760Z 2025-08-26T19:31:43.1975018Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:43.1975568Z log.warning( 2025-08-26T19:31:43.1976316Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:43.1977132Z ) 2025-08-26T19:31:43.1977323Z 2025-08-26T19:31:43.1977477Z return True 2025-08-26T19:31:43.1977694Z 2025-08-26T19:31:43.1977706Z 2025-08-26T19:31:43.1977875Z def get_runner_prefix( 2025-08-26T19:31:43.1978275Z rollout_state: str, 2025-08-26T19:31:43.1978707Z workflow_requestors: Iterable[str], 2025-08-26T19:31:43.1979181Z branch: str, 2025-08-26T19:31:43.1979633Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.1980254Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:43.1980792Z is_canary: bool = False, 2025-08-26T19:31:43.1981219Z ) -> str: 2025-08-26T19:31:43.1981746Z settings = parse_settings(rollout_state) 2025-08-26T19:31:43.1982515Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:43.1982862Z 2025-08-26T19:31:43.1983025Z fleet_prefix = "" 2025-08-26T19:31:43.1983431Z prefixes = [] 2025-08-26T19:31:43.1984012Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:43.1984880Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:43.1985557Z log.info( 2025-08-26T19:31:43.1986182Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:43.1986892Z ) 2025-08-26T19:31:43.1987244Z continue 2025-08-26T19:31:43.1987471Z 2025-08-26T19:31:43.1987655Z if opt_out_experiments: 2025-08-26T19:31:43.1988143Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:43.1988734Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:43.1989279Z log.info( 2025-08-26T19:31:43.1990141Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:43.1991044Z ) 2025-08-26T19:31:43.1991440Z continue 2025-08-26T19:31:43.1991689Z 2025-08-26T19:31:43.1991873Z if eligible_experiments: 2025-08-26T19:31:43.1992484Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:43.1993073Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:43.1993590Z log.info( 2025-08-26T19:31:43.1994315Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:43.1995093Z ) 2025-08-26T19:31:43.1995467Z continue 2025-08-26T19:31:43.1995920Z elif not experiment_settings.default: 2025-08-26T19:31:43.1996435Z log.info( 2025-08-26T19:31:43.1997179Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:43.1997876Z ) 2025-08-26T19:31:43.1998231Z continue 2025-08-26T19:31:43.1998462Z 2025-08-26T19:31:43.1998718Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:43.1999323Z opted_out_users = [ 2025-08-26T19:31:43.1999745Z requestor 2025-08-26T19:31:43.2000170Z for requestor in workflow_requestors 2025-08-26T19:31:43.2000792Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.2001380Z ] 2025-08-26T19:31:43.2001577Z 2025-08-26T19:31:43.2001750Z if opted_out_users: 2025-08-26T19:31:43.2002408Z log.info( 2025-08-26T19:31:43.2003007Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:43.2003661Z ) 2025-08-26T19:31:43.2004018Z continue 2025-08-26T19:31:43.2004251Z 2025-08-26T19:31:43.2004516Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:43.2005077Z opted_in_users = [ 2025-08-26T19:31:43.2005494Z requestor 2025-08-26T19:31:43.2005915Z for requestor in workflow_requestors 2025-08-26T19:31:43.2006528Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:43.2007091Z ] 2025-08-26T19:31:43.2007287Z 2025-08-26T19:31:43.2007448Z enabled = False 2025-08-26T19:31:43.2007856Z if opted_in_users: 2025-08-26T19:31:43.2008276Z log.info( 2025-08-26T19:31:43.2008829Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:43.2009453Z ) 2025-08-26T19:31:43.2009820Z enabled = True 2025-08-26T19:31:43.2010078Z 2025-08-26T19:31:43.2010279Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:43.2011057Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:43.2012177Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:43.2012793Z log.info( 2025-08-26T19:31:43.2013590Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:43.2014442Z ) 2025-08-26T19:31:43.2014822Z enabled = True 2025-08-26T19:31:43.2015096Z 2025-08-26T19:31:43.2015253Z if enabled: 2025-08-26T19:31:43.2015652Z label = experiment_name 2025-08-26T19:31:43.2016157Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:43.2016918Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:43.2017735Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:43.2018471Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:43.2019090Z if is_canary: 2025-08-26T19:31:43.2019543Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:43.2020053Z fleet_prefix = label 2025-08-26T19:31:43.2020502Z else: 2025-08-26T19:31:43.2020900Z prefixes.append(label) 2025-08-26T19:31:43.2021221Z 2025-08-26T19:31:43.2021401Z if len(prefixes) > 1: 2025-08-26T19:31:43.2021806Z log.error( 2025-08-26T19:31:43.2022875Z 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.2023913Z ) 2025-08-26T19:31:43.2024280Z prefixes = prefixes[:1] 2025-08-26T19:31:43.2024583Z 2025-08-26T19:31:43.2024781Z # Fleet always comes first 2025-08-26T19:31:43.2025259Z if fleet_prefix: 2025-08-26T19:31:43.2025719Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:43.2026081Z 2025-08-26T19:31:43.2026467Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:43.2026883Z 2025-08-26T19:31:43.2026889Z 2025-08-26T19:31:43.2027330Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:43.2028043Z """ 2025-08-26T19:31:43.2028584Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:43.2029102Z 2025-08-26T19:31:43.2029466Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:43.2030122Z """ 2025-08-26T19:31:43.2030482Z gh = get_gh_client(github_token) 2025-08-26T19:31:43.2030981Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:43.2031576Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:43.2031985Z 2025-08-26T19:31:43.2031991Z 2025-08-26T19:31:43.2032475Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:43.2033196Z for _ in range(num_retries): 2025-08-26T19:31:43.2033637Z try: 2025-08-26T19:31:43.2034035Z req = Request(url=url, headers=headers) 2025-08-26T19:31:43.2034652Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:43.2035248Z return json.loads(content) 2025-08-26T19:31:43.2035740Z except Exception as e: 2025-08-26T19:31:43.2036236Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:43.2036617Z 2025-08-26T19:31:43.2036966Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:43.2037620Z return {} 2025-08-26T19:31:43.2037834Z 2025-08-26T19:31:43.2037840Z 2025-08-26T19:31:43.2037987Z @cache 2025-08-26T19:31:43.2038559Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:43.2039245Z """ 2025-08-26T19:31:43.2039616Z Dynamically get PR information 2025-08-26T19:31:43.2040194Z """ 2025-08-26T19:31:43.2040665Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:43.2041233Z headers = { 2025-08-26T19:31:43.2041667Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:43.2042447Z "Authorization": f"token {github_token}", 2025-08-26T19:31:43.2042960Z } 2025-08-26T19:31:43.2043361Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:43.2043926Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:43.2044438Z headers=headers, 2025-08-26T19:31:43.2044832Z ) 2025-08-26T19:31:43.2045019Z 2025-08-26T19:31:43.2045198Z if not json_response: 2025-08-26T19:31:43.2045715Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:43.2046279Z return {} 2025-08-26T19:31:43.2046493Z 2025-08-26T19:31:43.2046663Z return json_response 2025-08-26T19:31:43.2046923Z 2025-08-26T19:31:43.2046929Z 2025-08-26T19:31:43.2047296Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:43.2047981Z """ 2025-08-26T19:31:43.2048468Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:43.2049070Z """ 2025-08-26T19:31:43.2049510Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:43.2050075Z return { 2025-08-26T19:31:43.2050600Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:43.2051247Z } 2025-08-26T19:31:43.2051465Z 2025-08-26T19:31:43.2051472Z 2025-08-26T19:31:43.2051673Z def main() -> None: 2025-08-26T19:31:43.2052248Z args = parse_args() 2025-08-26T19:31:43.2052520Z 2025-08-26T19:31:43.2052761Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:43.2053134Z 2025-08-26T19:31:43.2053343Z # Check if the PR is opt-out 2025-08-26T19:31:43.2053843Z if args.pr_number: 2025-08-26T19:31:43.2054515Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:43.2055397Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:43.2055923Z log.info( 2025-08-26T19:31:43.2056717Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:43.2057439Z ) 2025-08-26T19:31:43.2057943Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.2058561Z sys.exit() 2025-08-26T19:31:43.2058799Z 2025-08-26T19:31:43.2058955Z try: 2025-08-26T19:31:43.2059358Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:43.2060006Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:43.2060596Z ) 2025-08-26T19:31:43.2060788Z 2025-08-26T19:31:43.2060985Z username = get_potential_pr_author( 2025-08-26T19:31:43.2061492Z args.github_token, 2025-08-26T19:31:43.2061945Z args.github_repo, 2025-08-26T19:31:43.2062503Z args.github_actor, 2025-08-26T19:31:43.2062961Z args.github_ref_type, 2025-08-26T19:31:43.2063422Z args.github_branch, 2025-08-26T19:31:43.2063837Z ) 2025-08-26T19:31:43.2064027Z 2025-08-26T19:31:43.2064291Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:43.2064712Z 2025-08-26T19:31:43.2064916Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:43.2065431Z rollout_state, 2025-08-26T19:31:43.2065879Z (args.github_issue_owner, username), 2025-08-26T19:31:43.2066390Z args.github_branch, 2025-08-26T19:31:43.2066841Z args.eligible_experiments, 2025-08-26T19:31:43.2067342Z args.opt_out_experiments, 2025-08-26T19:31:43.2067805Z is_canary, 2025-08-26T19:31:43.2068187Z ) 2025-08-26T19:31:43.2068376Z 2025-08-26T19:31:43.2068549Z except Exception as e: 2025-08-26T19:31:43.2068974Z log.error( 2025-08-26T19:31:43.2069590Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:43.2070440Z ) 2025-08-26T19:31:43.2070632Z 2025-08-26T19:31:43.2070944Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:43.2071402Z 2025-08-26T19:31:43.2071408Z 2025-08-26T19:31:43.2071573Z if __name__ == "__main__": 2025-08-26T19:31:43.2071982Z main() 2025-08-26T19:31:43.2072279Z 2025-08-26T19:31:43.2159775Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.2160598Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:43.2201439Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:43.2201885Z env: 2025-08-26T19:31:43.2202698Z GITHUB_TOKEN: *** 2025-08-26T19:31:43.2203090Z ISSUE_NUMBER: 5132 2025-08-26T19:31:43.2203512Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:43.2203996Z ISSUE_OWNER: 2025-08-26T19:31:43.2204381Z CHECK_EXPERIMENTS: 2025-08-26T19:31:43.2204802Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:43.2205220Z PR_NUMBER: 2025-08-26T19:31:43.2205589Z ##[endgroup] 2025-08-26T19:31:44.0793350Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:44.6540007Z Collecting urllib3==1.26.18 2025-08-26T19:31:44.7215077Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:44.7476143Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.6 MB/s eta 0:00:00 2025-08-26T19:31:44.7861719Z Collecting PyGithub==2.3.0 2025-08-26T19:31:44.8014068Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:44.8596544Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:44.8744396Z 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.8788855Z 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.8806553Z 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.8821147Z 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.9213056Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:44.9359666Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:44.9587861Z 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.1093783Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.1240727Z 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.2559222Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:45.2708275Z 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.3026618Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:45.3173264Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:45.3511093Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:45.3689204Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.6 MB/s eta 0:00:00 2025-08-26T19:31:45.3835114Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:45.4023337Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 20.6 MB/s eta 0:00:00 2025-08-26T19:31:45.4170036Z 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.4359040Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 50.0 MB/s eta 0:00:00 2025-08-26T19:31:45.4505772Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:45.4677727Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:45.4742966Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 104.8 MB/s eta 0:00:00 2025-08-26T19:31:45.4893453Z 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.4937332Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 29.0 MB/s eta 0:00:00 2025-08-26T19:31:45.5085673Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:45.5131348Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 37.0 MB/s eta 0:00:00 2025-08-26T19:31:45.8105390Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:46.3440570Z 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.4314484Z ##[group]Run curr_branch="main" 2025-08-26T19:31:46.4314813Z curr_branch="main" 2025-08-26T19:31:46.4315069Z curr_ref_type="branch" 2025-08-26T19:31:46.4315323Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:46.4315589Z  2025-08-26T19:31:46.4315779Z python3 runner_determinator.py \ 2025-08-26T19:31:46.4316071Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:46.4316361Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:46.4316620Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:46.4316891Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:46.4317175Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:46.4317459Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:46.4317735Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:46.4318049Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:46.4318415Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:46.4318710Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:46.4359997Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:46.4360231Z env: 2025-08-26T19:31:46.4360847Z GITHUB_TOKEN: *** 2025-08-26T19:31:46.4361063Z ISSUE_NUMBER: 5132 2025-08-26T19:31:46.4361285Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:46.4361529Z ISSUE_OWNER: 2025-08-26T19:31:46.4361713Z CHECK_EXPERIMENTS: 2025-08-26T19:31:46.4361901Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:46.4362242Z PR_NUMBER: 2025-08-26T19:31:46.4362411Z ##[endgroup] 2025-08-26T19:31:46.4421515Z Current branch is 'main' 2025-08-26T19:31:47.9924078Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:47.9925440Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:47.9926448Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:47.9927191Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:48.0251401Z Evaluate and set job outputs 2025-08-26T19:31:48.0258199Z Set output 'label-type' 2025-08-26T19:31:48.0259999Z Cleaning up orphan processes