2025-07-17T06:33:19.1508326Z Current runner version: '2.326.0' 2025-07-17T06:33:19.1532985Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.1533831Z Hosted Compute Agent 2025-07-17T06:33:19.1534335Z Version: 20250711.363 2025-07-17T06:33:19.1535054Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.1535775Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.1536305Z ##[endgroup] 2025-07-17T06:33:19.1536907Z ##[group]Operating System 2025-07-17T06:33:19.1537438Z Ubuntu 2025-07-17T06:33:19.1538196Z 24.04.2 2025-07-17T06:33:19.1538722Z LTS 2025-07-17T06:33:19.1539222Z ##[endgroup] 2025-07-17T06:33:19.1539683Z ##[group]Runner Image 2025-07-17T06:33:19.1540282Z Image: ubuntu-24.04 2025-07-17T06:33:19.1540781Z Version: 20250710.1.0 2025-07-17T06:33:19.1541739Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.1543286Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.1544269Z ##[endgroup] 2025-07-17T06:33:19.1545327Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.1547190Z Contents: read 2025-07-17T06:33:19.1547997Z Metadata: read 2025-07-17T06:33:19.1548595Z ##[endgroup] 2025-07-17T06:33:19.1550630Z Secret source: Actions 2025-07-17T06:33:19.1551418Z Prepare workflow directory 2025-07-17T06:33:19.2297987Z Prepare all required actions 2025-07-17T06:33:19.2380305Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.2387342Z ##[group] Inputs 2025-07-17T06:33:19.2388570Z check_experiments: 2025-07-17T06:33:19.2389543Z opt_out_experiments: lf 2025-07-17T06:33:19.2390456Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.2391515Z issue_owner: 2025-07-17T06:33:19.2392340Z curr_branch: main 2025-07-17T06:33:19.2393275Z curr_ref_type: branch 2025-07-17T06:33:19.2394350Z issue_number: 5132 2025-07-17T06:33:19.2395202Z ##[endgroup] 2025-07-17T06:33:19.2396316Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:19.7773308Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:19.7775748Z cat < runner_determinator.py 2025-07-17T06:33:19.7776469Z # flake8: noqa: G004 2025-07-17T06:33:19.7776998Z  2025-07-17T06:33:19.7778064Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.7779192Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.7780133Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.7780959Z  2025-07-17T06:33:19.7781404Z """ 2025-07-17T06:33:19.7782143Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.7783225Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.7784468Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.7785486Z of which runners should be used to run which job. 2025-07-17T06:33:19.7786212Z  2025-07-17T06:33:19.7786944Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.7788542Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.7789665Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.7790528Z list, defined. 2025-07-17T06:33:19.7791105Z  2025-07-17T06:33:19.7791840Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.7792898Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.7793941Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.7794664Z  2025-07-17T06:33:19.7795689Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.7796780Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.7797941Z experiments which the user could be opted in to. 2025-07-17T06:33:19.7798670Z  2025-07-17T06:33:19.7799148Z The user list has the following rules: 2025-07-17T06:33:19.7799877Z  2025-07-17T06:33:19.7800572Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.7801628Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.7802639Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.7803289Z  2025-07-17T06:33:19.7803755Z Example config: 2025-07-17T06:33:19.7804414Z  # A list of experiments that can be opted into. 2025-07-17T06:33:19.7805288Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.7806067Z  # Expected syntax is: 2025-07-17T06:33:19.7806931Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.7808339Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.7809208Z  2025-07-17T06:33:19.7809747Z  experiments: 2025-07-17T06:33:19.7810296Z  lf: 2025-07-17T06:33:19.7810821Z  rollout_percent: 25 2025-07-17T06:33:19.7811497Z  all_branches: false 2025-07-17T06:33:19.7812071Z  default: true 2025-07-17T06:33:19.7812635Z  --- 2025-07-17T06:33:19.7898603Z  2025-07-17T06:33:19.7899413Z  # Opt-ins: 2025-07-17T06:33:19.7900685Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.7902898Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.7904573Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.7905365Z  # Experiments should be from the above list. 2025-07-17T06:33:19.7905951Z  2025-07-17T06:33:19.7906356Z  @User1,-lf,split_build 2025-07-17T06:33:19.7906871Z  @User2,lf 2025-07-17T06:33:19.7907333Z  @User3,split_build 2025-07-17T06:33:19.7908053Z """ 2025-07-17T06:33:19.7908440Z  2025-07-17T06:33:19.7908824Z import json 2025-07-17T06:33:19.7909266Z import logging 2025-07-17T06:33:19.7909700Z import os 2025-07-17T06:33:19.7910120Z import random 2025-07-17T06:33:19.7910554Z import re 2025-07-17T06:33:19.7910965Z import sys 2025-07-17T06:33:19.7911436Z from argparse import ArgumentParser 2025-07-17T06:33:19.7912116Z from collections.abc import Iterable 2025-07-17T06:33:19.7912737Z from functools import cache 2025-07-17T06:33:19.7913280Z from logging import LogRecord 2025-07-17T06:33:19.7913838Z from typing import Any, NamedTuple 2025-07-17T06:33:19.7914471Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.7915057Z  2025-07-17T06:33:19.7915437Z import yaml 2025-07-17T06:33:19.7915889Z from github import Auth, Github 2025-07-17T06:33:19.7916446Z from github.Issue import Issue 2025-07-17T06:33:19.7916954Z  2025-07-17T06:33:19.7917313Z  2025-07-17T06:33:19.7918016Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.7918807Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.7919782Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.7920558Z  2025-07-17T06:33:19.7921253Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.7921898Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.7922495Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.7923148Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.7923704Z  2025-07-17T06:33:19.7924123Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.7924661Z  2025-07-17T06:33:19.7925054Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.7925576Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.7926066Z  2025-07-17T06:33:19.7926427Z  2025-07-17T06:33:19.7926835Z class Experiment(NamedTuple): 2025-07-17T06:33:19.7927389Z  rollout_perc: float = ( 2025-07-17T06:33:19.7928315Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.7929057Z  ) 2025-07-17T06:33:19.7929471Z  all_branches: bool = ( 2025-07-17T06:33:19.7930197Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.7930911Z  ) 2025-07-17T06:33:19.7931318Z  default: bool = ( 2025-07-17T06:33:19.7931982Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.7932668Z  ) 2025-07-17T06:33:19.7933058Z  2025-07-17T06:33:19.7933456Z  # Add more fields as needed 2025-07-17T06:33:19.7933970Z  2025-07-17T06:33:19.7934327Z  2025-07-17T06:33:19.7934723Z class Settings(NamedTuple): 2025-07-17T06:33:19.7935226Z  """ 2025-07-17T06:33:19.7935755Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:19.7936383Z  """ 2025-07-17T06:33:19.7936771Z  2025-07-17T06:33:19.7937209Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.7937940Z  2025-07-17T06:33:19.7938462Z  2025-07-17T06:33:19.7938915Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.7939618Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.7940242Z  2025-07-17T06:33:19.7940622Z  COLORS = { 2025-07-17T06:33:19.7941091Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.7941652Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.7942204Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.7942750Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.7943295Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.7943808Z  } 2025-07-17T06:33:19.7944191Z  2025-07-17T06:33:19.7944641Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.7945459Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.7946306Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.7946931Z  return super().format(record) 2025-07-17T06:33:19.7947462Z  2025-07-17T06:33:19.7948013Z  2025-07-17T06:33:19.7948436Z handler = logging.StreamHandler() 2025-07-17T06:33:19.7949233Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.7949998Z  2025-07-17T06:33:19.7950488Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.7951135Z log.addHandler(handler) 2025-07-17T06:33:19.7951652Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.7952150Z  2025-07-17T06:33:19.7952513Z  2025-07-17T06:33:19.7952999Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.7953616Z  """ 2025-07-17T06:33:19.7954180Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.7955006Z  """ 2025-07-17T06:33:19.7955421Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:19.7956589Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.7958040Z  log.warning( 2025-07-17T06:33:19.7959000Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:19.7959993Z  ) 2025-07-17T06:33:19.7960493Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.7961079Z  return 2025-07-17T06:33:19.7961519Z  2025-07-17T06:33:19.7961942Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.7962577Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.7963200Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:19.7963733Z  2025-07-17T06:33:19.7964104Z  2025-07-17T06:33:19.7964660Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.7965371Z  return frozenset( 2025-07-17T06:33:19.7966070Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.7966794Z  ) 2025-07-17T06:33:19.7967186Z  2025-07-17T06:33:19.7967554Z  2025-07-17T06:33:19.7968322Z def parse_args() -> Any: 2025-07-17T06:33:19.7968990Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.7969933Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.7970782Z  parser.add_argument( 2025-07-17T06:33:19.7971311Z  "--github-issue-repo", 2025-07-17T06:33:19.7971837Z  type=str, 2025-07-17T06:33:19.7972310Z  required=False, 2025-07-17T06:33:19.7972986Z  default="pytorch/test-infra", 2025-07-17T06:33:19.7973607Z  help="GitHub repo to get the issue", 2025-07-17T06:33:19.7974159Z  ) 2025-07-17T06:33:19.7974573Z  parser.add_argument( 2025-07-17T06:33:19.7975085Z  "--github-repo", 2025-07-17T06:33:19.7975583Z  type=str, 2025-07-17T06:33:19.7976052Z  required=True, 2025-07-17T06:33:19.7976595Z  help="GitHub repo where CI is running", 2025-07-17T06:33:19.7977163Z  ) 2025-07-17T06:33:19.7977574Z  parser.add_argument( 2025-07-17T06:33:19.7978472Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.7979174Z  ) 2025-07-17T06:33:19.7979583Z  parser.add_argument( 2025-07-17T06:33:19.7980299Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.7981042Z  ) 2025-07-17T06:33:19.7981459Z  parser.add_argument( 2025-07-17T06:33:19.7982180Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.7982917Z  ) 2025-07-17T06:33:19.7983328Z  parser.add_argument( 2025-07-17T06:33:19.7984080Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.7984849Z  ) 2025-07-17T06:33:19.7985290Z  parser.add_argument( 2025-07-17T06:33:19.7985809Z  "--github-ref-type", 2025-07-17T06:33:19.7986322Z  type=str, 2025-07-17T06:33:19.7986798Z  required=True, 2025-07-17T06:33:19.7987388Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.7988185Z  ) 2025-07-17T06:33:19.7988601Z  parser.add_argument( 2025-07-17T06:33:19.7989134Z  "--eligible-experiments", 2025-07-17T06:33:19.7989873Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.7990444Z  required=False, 2025-07-17T06:33:19.7990938Z  default="", 2025-07-17T06:33:19.7991898Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.7992886Z  ) 2025-07-17T06:33:19.7993301Z  parser.add_argument( 2025-07-17T06:33:19.7993829Z  "--opt-out-experiments", 2025-07-17T06:33:19.7994405Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.7994974Z  required=False, 2025-07-17T06:33:19.7995462Z  default="", 2025-07-17T06:33:19.7995932Z  help=( 2025-07-17T06:33:19.7996689Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.7998132Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.7999037Z  ), 2025-07-17T06:33:19.7999441Z  ) 2025-07-17T06:33:19.7999856Z  parser.add_argument( 2025-07-17T06:33:19.8000363Z  "--pr-number", 2025-07-17T06:33:19.8000854Z  type=str, 2025-07-17T06:33:19.8001327Z  required=False, 2025-07-17T06:33:19.8001821Z  default="", 2025-07-17T06:33:19.8002386Z  help="the optional PR number where this is run", 2025-07-17T06:33:19.8002991Z  ) 2025-07-17T06:33:19.8003384Z  2025-07-17T06:33:19.8003786Z  return parser.parse_args() 2025-07-17T06:33:19.8004314Z  2025-07-17T06:33:19.8004672Z  2025-07-17T06:33:19.8005321Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.8006321Z  auth = Auth.Token(github_token) 2025-07-17T06:33:19.8006931Z  return Github(auth=auth) 2025-07-17T06:33:19.8007441Z  2025-07-17T06:33:19.8007982Z  2025-07-17T06:33:19.8008700Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.8009572Z  repo = gh.get_repo(repo) 2025-07-17T06:33:19.8010157Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.8010719Z  2025-07-17T06:33:19.8011093Z  2025-07-17T06:33:19.8011490Z def get_potential_pr_author( 2025-07-17T06:33:19.8012223Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.8012958Z ) -> str: 2025-07-17T06:33:19.8013554Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.8014454Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.8015290Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:19.8015916Z  2025-07-17T06:33:19.8016340Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.8016876Z  2025-07-17T06:33:19.8017397Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.8018264Z  split_tag = ref_name.split("/") 2025-07-17T06:33:19.8018835Z  if ( 2025-07-17T06:33:19.8019282Z  len(split_tag) == 3 2025-07-17T06:33:19.8019849Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:19.8020438Z  and split_tag[2].isnumeric() 2025-07-17T06:33:19.8020983Z  ): 2025-07-17T06:33:19.8021445Z  pr_number = split_tag[2] 2025-07-17T06:33:19.8021982Z  try: 2025-07-17T06:33:19.8022488Z  repository = gh.get_repo(repo) 2025-07-17T06:33:19.8023331Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.8024021Z  except Exception as e: 2025-07-17T06:33:19.8024619Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:19.8025357Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.8026078Z  ) from e 2025-07-17T06:33:19.8026701Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.8027482Z  # In all other cases, return the original input username 2025-07-17T06:33:19.8028319Z  return username 2025-07-17T06:33:19.8028789Z  2025-07-17T06:33:19.8029162Z  2025-07-17T06:33:19.8029618Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.8030198Z  """ 2025-07-17T06:33:19.8030919Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.8031762Z  """ 2025-07-17T06:33:19.8032369Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.8033088Z  2025-07-17T06:33:19.8033448Z  2025-07-17T06:33:19.8033876Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.8034421Z  try: 2025-07-17T06:33:19.8034866Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.8035431Z  return data 2025-07-17T06:33:19.8035914Z  except yaml.YAMLError: 2025-07-17T06:33:19.8036477Z  log.exception("Error loading YAML") 2025-07-17T06:33:19.8037034Z  raise 2025-07-17T06:33:19.8037457Z  2025-07-17T06:33:19.8038026Z  2025-07-17T06:33:19.8038708Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.8039511Z  """ 2025-07-17T06:33:19.8040346Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.8041158Z  2025-07-17T06:33:19.8041740Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.8042584Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.8043187Z  2025-07-17T06:33:19.8043808Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.8044560Z  """ 2025-07-17T06:33:19.8045057Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.8045716Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.8046489Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.8047293Z  else: 2025-07-17T06:33:19.8047971Z  return "", rollout_state 2025-07-17T06:33:19.8048492Z  2025-07-17T06:33:19.8048864Z  2025-07-17T06:33:19.8049295Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.8049855Z  """ 2025-07-17T06:33:19.8050436Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.8051131Z  """ 2025-07-17T06:33:19.8051511Z  2025-07-17T06:33:19.8051865Z  2025-07-17T06:33:19.8052436Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.8053154Z  """ 2025-07-17T06:33:19.8053943Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:19.8054824Z  2025-07-17T06:33:19.8055694Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.8056761Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.8058256Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.8058966Z  2025-07-17T06:33:19.8059323Z  2025-07-17T06:33:19.8059679Z  """ 2025-07-17T06:33:19.8060086Z  optins = UserOptins() 2025-07-17T06:33:19.8060650Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.8061266Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:19.8061875Z  if not user or not user.startswith("@"): 2025-07-17T06:33:19.8062482Z  # Not a valid user. Skip 2025-07-17T06:33:19.8063020Z  continue 2025-07-17T06:33:19.8063504Z  2025-07-17T06:33:19.8063869Z  if user: 2025-07-17T06:33:19.8064385Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.8065137Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.8065828Z  2025-07-17T06:33:19.8066201Z  return optins 2025-07-17T06:33:19.8066644Z  2025-07-17T06:33:19.8066993Z  2025-07-17T06:33:19.8067527Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.8068296Z  """ 2025-07-17T06:33:19.8068751Z  Check if the experiment name is valid. 2025-07-17T06:33:19.8069326Z  A valid name: 2025-07-17T06:33:19.8070052Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.8071091Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.8071860Z  - Cannot contain spaces 2025-07-17T06:33:19.8072369Z  """ 2025-07-17T06:33:19.8072751Z  2025-07-17T06:33:19.8073239Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.8074021Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.8074901Z  2025-07-17T06:33:19.8075463Z  if valid: 2025-07-17T06:33:19.8075907Z  return True 2025-07-17T06:33:19.8076361Z  2025-07-17T06:33:19.8076738Z  log.error( 2025-07-17T06:33:19.8078462Z  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-07-17T06:33:19.8080108Z  ) 2025-07-17T06:33:19.8080500Z  return False 2025-07-17T06:33:19.8080951Z  2025-07-17T06:33:19.8081304Z  2025-07-17T06:33:19.8081864Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.8082544Z  """ 2025-07-17T06:33:19.8083200Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.8083979Z  """ 2025-07-17T06:33:19.8084370Z  try: 2025-07-17T06:33:19.8084781Z  if settings_text: 2025-07-17T06:33:19.8085596Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.8086454Z  # for easy reading 2025-07-17T06:33:19.8087344Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.8088413Z  # the backtick character in shell commands. 2025-07-17T06:33:19.8089085Z  backtick = chr(96) # backtick character 2025-07-17T06:33:19.8089823Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.8090549Z  settings = load_yaml(settings_text) 2025-07-17T06:33:19.8091100Z  2025-07-17T06:33:19.8091737Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.8092684Z  experiments = {} 2025-07-17T06:33:19.8093178Z  2025-07-17T06:33:19.8093781Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.8094605Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.8095796Z  # 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-07-17T06:33:19.8096909Z  continue 2025-07-17T06:33:19.8097400Z  2025-07-17T06:33:19.8097903Z  valid_settings = {} 2025-07-17T06:33:19.8098480Z  for setting in exp_settings: 2025-07-17T06:33:19.8099103Z  if setting not in Experiment._fields: 2025-07-17T06:33:19.8099717Z  log.warning( 2025-07-17T06:33:19.8100508Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.8101263Z  ) 2025-07-17T06:33:19.8101747Z  else: 2025-07-17T06:33:19.8102339Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.8102941Z  2025-07-17T06:33:19.8103450Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.8104147Z  return Settings(experiments) 2025-07-17T06:33:19.8104679Z  2025-07-17T06:33:19.8105068Z  except Exception: 2025-07-17T06:33:19.8105622Z  log.exception("Failed to parse settings") 2025-07-17T06:33:19.8106200Z  2025-07-17T06:33:19.8106580Z  return Settings() 2025-07-17T06:33:19.8107041Z  2025-07-17T06:33:19.8107389Z  2025-07-17T06:33:19.8108125Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.8108757Z  """ 2025-07-17T06:33:19.8109251Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.8109844Z  2025-07-17T06:33:19.8110418Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.8111252Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.8111843Z  2025-07-17T06:33:19.8112482Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.8113258Z  """ 2025-07-17T06:33:19.8113879Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.8114710Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.8115293Z  2025-07-17T06:33:19.8115652Z  2025-07-17T06:33:19.8116143Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.8116761Z  """ 2025-07-17T06:33:19.8117208Z  Parse users from the rollout state. 2025-07-17T06:33:19.8118037Z  2025-07-17T06:33:19.8118411Z  """ 2025-07-17T06:33:19.8119019Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.8119841Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.8120421Z  2025-07-17T06:33:19.8120778Z  2025-07-17T06:33:19.8121449Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.8122251Z  """ 2025-07-17T06:33:19.8122737Z  Check if a user is opted into an experiment 2025-07-17T06:33:19.8123310Z  """ 2025-07-17T06:33:19.8123830Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.8124439Z  2025-07-17T06:33:19.8124942Z  2025-07-17T06:33:19.8125620Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.8126433Z  """ 2025-07-17T06:33:19.8126957Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.8127574Z  """ 2025-07-17T06:33:19.8128296Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.8129052Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.8129757Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.8130400Z  return False 2025-07-17T06:33:19.8130856Z  2025-07-17T06:33:19.8131358Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.8132001Z  log.warning( 2025-07-17T06:33:19.8132912Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.8133840Z  ) 2025-07-17T06:33:19.8134244Z  2025-07-17T06:33:19.8134610Z  return True 2025-07-17T06:33:19.8135044Z  2025-07-17T06:33:19.8135396Z  2025-07-17T06:33:19.8135782Z def get_runner_prefix( 2025-07-17T06:33:19.8136282Z  rollout_state: str, 2025-07-17T06:33:19.8136816Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:19.8137377Z  branch: str, 2025-07-17T06:33:19.8138041Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.8138790Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.8139428Z  is_canary: bool = False, 2025-07-17T06:33:19.8139939Z ) -> str: 2025-07-17T06:33:19.8140427Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:19.8141065Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.8141626Z  2025-07-17T06:33:19.8142130Z  fleet_prefix = "" 2025-07-17T06:33:19.8142634Z  prefixes = [] 2025-07-17T06:33:19.8143344Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.8144362Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.8145127Z  log.info( 2025-07-17T06:33:19.8145886Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.8146685Z  ) 2025-07-17T06:33:19.8147140Z  continue 2025-07-17T06:33:19.8147696Z  2025-07-17T06:33:19.8148100Z  if opt_out_experiments: 2025-07-17T06:33:19.8148715Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.8149430Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.8150078Z  log.info( 2025-07-17T06:33:19.8151126Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.8152149Z  ) 2025-07-17T06:33:19.8152601Z  continue 2025-07-17T06:33:19.8153070Z  2025-07-17T06:33:19.8153470Z  if eligible_experiments: 2025-07-17T06:33:19.8154098Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.8154789Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.8155382Z  log.info( 2025-07-17T06:33:19.8156238Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.8157123Z  ) 2025-07-17T06:33:19.8157667Z  continue 2025-07-17T06:33:19.8158385Z  elif not experiment_settings.default: 2025-07-17T06:33:19.8158970Z  log.info( 2025-07-17T06:33:19.8159713Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.8160500Z  ) 2025-07-17T06:33:19.8160926Z  continue 2025-07-17T06:33:19.8161382Z  2025-07-17T06:33:19.8161891Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.8162554Z  opted_out_users = [ 2025-07-17T06:33:19.8163071Z  requestor 2025-07-17T06:33:19.8163599Z  for requestor in workflow_requestors 2025-07-17T06:33:19.8164341Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.8165009Z  ] 2025-07-17T06:33:19.8165405Z  2025-07-17T06:33:19.8165786Z  if opted_out_users: 2025-07-17T06:33:19.8166320Z  log.info( 2025-07-17T06:33:19.8167035Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.8167872Z  ) 2025-07-17T06:33:19.8168309Z  continue 2025-07-17T06:33:19.8168766Z  2025-07-17T06:33:19.8169270Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.8169926Z  opted_in_users = [ 2025-07-17T06:33:19.8170484Z  requestor 2025-07-17T06:33:19.8171026Z  for requestor in workflow_requestors 2025-07-17T06:33:19.8171767Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.8172437Z  ] 2025-07-17T06:33:19.8172829Z  2025-07-17T06:33:19.8173216Z  enabled = False 2025-07-17T06:33:19.8173725Z  if opted_in_users: 2025-07-17T06:33:19.8174375Z  log.info( 2025-07-17T06:33:19.8175073Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.8175804Z  ) 2025-07-17T06:33:19.8176257Z  enabled = True 2025-07-17T06:33:19.8176737Z  2025-07-17T06:33:19.8177182Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.8178191Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.8179215Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.8179926Z  log.info( 2025-07-17T06:33:19.8180886Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.8181864Z  ) 2025-07-17T06:33:19.8182338Z  enabled = True 2025-07-17T06:33:19.8182842Z  2025-07-17T06:33:19.8183215Z  if enabled: 2025-07-17T06:33:19.8183715Z  label = experiment_name 2025-07-17T06:33:19.8184403Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.8185296Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.8186241Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.8187068Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.8187881Z  if is_canary: 2025-07-17T06:33:19.8188448Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.8189042Z  fleet_prefix = label 2025-07-17T06:33:19.8189584Z  else: 2025-07-17T06:33:19.8190253Z  prefixes.append(label) 2025-07-17T06:33:19.8190792Z  2025-07-17T06:33:19.8191174Z  if len(prefixes) > 1: 2025-07-17T06:33:19.8191682Z  log.error( 2025-07-17T06:33:19.8192807Z  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-07-17T06:33:19.8193993Z  ) 2025-07-17T06:33:19.8194429Z  prefixes = prefixes[:1] 2025-07-17T06:33:19.8194942Z  2025-07-17T06:33:19.8195338Z  # Fleet always comes first 2025-07-17T06:33:19.8195862Z  if fleet_prefix: 2025-07-17T06:33:19.8196379Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.8196917Z  2025-07-17T06:33:19.8197403Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.8198125Z  2025-07-17T06:33:19.8198486Z  2025-07-17T06:33:19.8199172Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.8199987Z  """ 2025-07-17T06:33:19.8200634Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.8201387Z  2025-07-17T06:33:19.8202004Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.8202747Z  """ 2025-07-17T06:33:19.8203179Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.8203790Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.8204502Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.8205141Z  2025-07-17T06:33:19.8205493Z  2025-07-17T06:33:19.8206132Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.8207070Z  for _ in range(num_retries): 2025-07-17T06:33:19.8207699Z  try: 2025-07-17T06:33:19.8208196Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:19.8208911Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.8209618Z  return json.loads(content) 2025-07-17T06:33:19.8210187Z  except Exception as e: 2025-07-17T06:33:19.8210802Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.8211396Z  2025-07-17T06:33:19.8212010Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.8212781Z  return {} 2025-07-17T06:33:19.8213203Z  2025-07-17T06:33:19.8213628Z  2025-07-17T06:33:19.8213991Z @cache 2025-07-17T06:33:19.8214693Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.8215504Z  """ 2025-07-17T06:33:19.8215950Z  Dynamically get PR information 2025-07-17T06:33:19.8216481Z  """ 2025-07-17T06:33:19.8217032Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.8217800Z  headers = { 2025-07-17T06:33:19.8218336Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.8219005Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:19.8219566Z  } 2025-07-17T06:33:19.8220059Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.8220719Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.8221299Z  headers=headers, 2025-07-17T06:33:19.8221784Z  ) 2025-07-17T06:33:19.8222159Z  2025-07-17T06:33:19.8222551Z  if not json_response: 2025-07-17T06:33:19.8223197Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.8224010Z  return {} 2025-07-17T06:33:19.8224454Z  2025-07-17T06:33:19.8224841Z  return json_response 2025-07-17T06:33:19.8225315Z  2025-07-17T06:33:19.8225673Z  2025-07-17T06:33:19.8226308Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.8227087Z  """ 2025-07-17T06:33:19.8227779Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.8228479Z  """ 2025-07-17T06:33:19.8229022Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.8229668Z  return { 2025-07-17T06:33:19.8230324Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.8231058Z  } 2025-07-17T06:33:19.8231431Z  2025-07-17T06:33:19.8231795Z  2025-07-17T06:33:19.8232175Z def main() -> None: 2025-07-17T06:33:19.8232660Z  args = parse_args() 2025-07-17T06:33:19.8233131Z  2025-07-17T06:33:19.8233586Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.8234150Z  2025-07-17T06:33:19.8234550Z  # Check if the PR is opt-out 2025-07-17T06:33:19.8235102Z  if args.pr_number: 2025-07-17T06:33:19.8235837Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.8236669Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.8237209Z  log.info( 2025-07-17T06:33:19.8238084Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.8238890Z  ) 2025-07-17T06:33:19.8239524Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.8240262Z  sys.exit() 2025-07-17T06:33:19.8240844Z  2025-07-17T06:33:19.8241216Z  try: 2025-07-17T06:33:19.8241711Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.8242482Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.8243161Z  ) 2025-07-17T06:33:19.8243558Z  2025-07-17T06:33:19.8243988Z  username = get_potential_pr_author( 2025-07-17T06:33:19.8244569Z  args.github_token, 2025-07-17T06:33:19.8245105Z  args.github_repo, 2025-07-17T06:33:19.8245628Z  args.github_actor, 2025-07-17T06:33:19.8246175Z  args.github_ref_type, 2025-07-17T06:33:19.8246723Z  args.github_branch, 2025-07-17T06:33:19.8247232Z  ) 2025-07-17T06:33:19.8247717Z  2025-07-17T06:33:19.8248249Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.8248910Z  2025-07-17T06:33:19.8249346Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.8249946Z  rollout_state, 2025-07-17T06:33:19.8250497Z  (args.github_issue_owner, username), 2025-07-17T06:33:19.8251085Z  args.github_branch, 2025-07-17T06:33:19.8251644Z  args.eligible_experiments, 2025-07-17T06:33:19.8252233Z  args.opt_out_experiments, 2025-07-17T06:33:19.8252781Z  is_canary, 2025-07-17T06:33:19.8253241Z  ) 2025-07-17T06:33:19.8253638Z  2025-07-17T06:33:19.8254029Z  except Exception as e: 2025-07-17T06:33:19.8254544Z  log.error( 2025-07-17T06:33:19.8255300Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.8256096Z  ) 2025-07-17T06:33:19.8256622Z  2025-07-17T06:33:19.8257190Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.8257998Z  2025-07-17T06:33:19.8258352Z  2025-07-17T06:33:19.8258740Z if __name__ == "__main__": 2025-07-17T06:33:19.8259231Z  main() 2025-07-17T06:33:19.8259635Z  2025-07-17T06:33:19.8259986Z EOF 2025-07-17T06:33:19.8260365Z  2025-07-17T06:33:19.8260754Z cat runner_determinator.py 2025-07-17T06:33:19.8499998Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.8501062Z env: 2025-07-17T06:33:19.8501849Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.8502289Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.8502744Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.8503251Z ISSUE_OWNER: 2025-07-17T06:33:19.8503648Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.8504072Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:19.8504527Z PR_NUMBER: 2025-07-17T06:33:19.8504938Z ##[endgroup] 2025-07-17T06:33:19.8714662Z # flake8: noqa: G004 2025-07-17T06:33:19.8715032Z 2025-07-17T06:33:19.8715458Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.8716440Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.8717227Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.8717964Z 2025-07-17T06:33:19.8718145Z """ 2025-07-17T06:33:19.8718729Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.8719606Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.8720526Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.8721333Z of which runners should be used to run which job. 2025-07-17T06:33:19.8721734Z 2025-07-17T06:33:19.8722114Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.8723221Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.8724123Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.8724835Z list, defined. 2025-07-17T06:33:19.8725060Z 2025-07-17T06:33:19.8725413Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.8726342Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.8727153Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.8727884Z 2025-07-17T06:33:19.8728271Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.8729145Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.8729874Z experiments which the user could be opted in to. 2025-07-17T06:33:19.8730275Z 2025-07-17T06:33:19.8730482Z The user list has the following rules: 2025-07-17T06:33:19.8730822Z 2025-07-17T06:33:19.8731147Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.8732009Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.8732765Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.8733157Z 2025-07-17T06:33:19.8733326Z Example config: 2025-07-17T06:33:19.8733775Z # A list of experiments that can be opted into. 2025-07-17T06:33:19.8734430Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.8735044Z # Expected syntax is: 2025-07-17T06:33:19.8735671Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.8736635Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.8737243Z 2025-07-17T06:33:19.8737414Z experiments: 2025-07-17T06:33:19.8738061Z lf: 2025-07-17T06:33:19.8738446Z rollout_percent: 25 2025-07-17T06:33:19.8738890Z all_branches: false 2025-07-17T06:33:19.8739528Z default: true 2025-07-17T06:33:19.8739928Z --- 2025-07-17T06:33:19.8740136Z 2025-07-17T06:33:19.8740299Z # Opt-ins: 2025-07-17T06:33:19.8740870Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.8741730Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.8742503Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.8743150Z # Experiments should be from the above list. 2025-07-17T06:33:19.8743537Z 2025-07-17T06:33:19.8743724Z @User1,-lf,split_build 2025-07-17T06:33:19.8744147Z @User2,lf 2025-07-17T06:33:19.8744568Z @User3,split_build 2025-07-17T06:33:19.8744965Z """ 2025-07-17T06:33:19.8745162Z 2025-07-17T06:33:19.8745324Z import json 2025-07-17T06:33:19.8745682Z import logging 2025-07-17T06:33:19.8746058Z import os 2025-07-17T06:33:19.8746412Z import random 2025-07-17T06:33:19.8746783Z import re 2025-07-17T06:33:19.8747138Z import sys 2025-07-17T06:33:19.8747539Z from argparse import ArgumentParser 2025-07-17T06:33:19.8748501Z from collections.abc import Iterable 2025-07-17T06:33:19.8749021Z from functools import cache 2025-07-17T06:33:19.8749488Z from logging import LogRecord 2025-07-17T06:33:19.8749967Z from typing import Any, NamedTuple 2025-07-17T06:33:19.8750502Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.8750870Z 2025-07-17T06:33:19.8751030Z import yaml 2025-07-17T06:33:19.8751420Z from github import Auth, Github 2025-07-17T06:33:19.8751905Z from github.Issue import Issue 2025-07-17T06:33:19.8752216Z 2025-07-17T06:33:19.8752223Z 2025-07-17T06:33:19.8752439Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.8753115Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.8753970Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.8754536Z 2025-07-17T06:33:19.8754765Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.8755490Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.8756019Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.8756571Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.8756928Z 2025-07-17T06:33:19.8757117Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.8757444Z 2025-07-17T06:33:19.8757939Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.8758451Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.8758732Z 2025-07-17T06:33:19.8758748Z 2025-07-17T06:33:19.8758937Z class Experiment(NamedTuple): 2025-07-17T06:33:19.8759407Z rollout_perc: float = ( 2025-07-17T06:33:19.8760047Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.8760727Z ) 2025-07-17T06:33:19.8761091Z all_branches: bool = ( 2025-07-17T06:33:19.8761743Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.8762407Z ) 2025-07-17T06:33:19.8762774Z default: bool = ( 2025-07-17T06:33:19.8763335Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.8763973Z ) 2025-07-17T06:33:19.8764164Z 2025-07-17T06:33:19.8764344Z # Add more fields as needed 2025-07-17T06:33:19.8764647Z 2025-07-17T06:33:19.8764654Z 2025-07-17T06:33:19.8764836Z class Settings(NamedTuple): 2025-07-17T06:33:19.8765272Z """ 2025-07-17T06:33:19.8765712Z Settings for the experiments that can be opted into. 2025-07-17T06:33:19.8766285Z """ 2025-07-17T06:33:19.8766479Z 2025-07-17T06:33:19.8766681Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.8767040Z 2025-07-17T06:33:19.8767053Z 2025-07-17T06:33:19.8767260Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.8768066Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.8768507Z 2025-07-17T06:33:19.8768664Z COLORS = { 2025-07-17T06:33:19.8769054Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.8769756Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.8770242Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.8770728Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.8771205Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.8771660Z } 2025-07-17T06:33:19.8771861Z 2025-07-17T06:33:19.8772076Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.8772822Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.8773605Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.8774175Z return super().format(record) 2025-07-17T06:33:19.8774504Z 2025-07-17T06:33:19.8774511Z 2025-07-17T06:33:19.8774702Z handler = logging.StreamHandler() 2025-07-17T06:33:19.8775397Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.8775949Z 2025-07-17T06:33:19.8776192Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.8776774Z log.addHandler(handler) 2025-07-17T06:33:19.8777218Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.8777506Z 2025-07-17T06:33:19.8777514Z 2025-07-17T06:33:19.8777955Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.8778526Z """ 2025-07-17T06:33:19.8779022Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.8779643Z """ 2025-07-17T06:33:19.8780002Z if not GITHUB_OUTPUT: 2025-07-17T06:33:19.8781077Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.8782195Z log.warning( 2025-07-17T06:33:19.8783034Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:19.8783960Z ) 2025-07-17T06:33:19.8794006Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.8794614Z return 2025-07-17T06:33:19.8794854Z 2025-07-17T06:33:19.8795267Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.8795888Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.8796644Z f.write(f"{key}={value}\n") 2025-07-17T06:33:19.8796977Z 2025-07-17T06:33:19.8796984Z 2025-07-17T06:33:19.8797294Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.8798211Z return frozenset( 2025-07-17T06:33:19.8798826Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.8799524Z ) 2025-07-17T06:33:19.8799718Z 2025-07-17T06:33:19.8799725Z 2025-07-17T06:33:19.8799910Z def parse_args() -> Any: 2025-07-17T06:33:19.8800468Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.8801339Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.8802116Z parser.add_argument( 2025-07-17T06:33:19.8802582Z "--github-issue-repo", 2025-07-17T06:33:19.8803038Z type=str, 2025-07-17T06:33:19.8803458Z required=False, 2025-07-17T06:33:19.8803900Z default="pytorch/test-infra", 2025-07-17T06:33:19.8804431Z help="GitHub repo to get the issue", 2025-07-17T06:33:19.8804929Z ) 2025-07-17T06:33:19.8805296Z parser.add_argument( 2025-07-17T06:33:19.8805736Z "--github-repo", 2025-07-17T06:33:19.8806162Z type=str, 2025-07-17T06:33:19.8806548Z required=True, 2025-07-17T06:33:19.8807015Z help="GitHub repo where CI is running", 2025-07-17T06:33:19.8807532Z ) 2025-07-17T06:33:19.8808224Z parser.add_argument( 2025-07-17T06:33:19.8808842Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.8809494Z ) 2025-07-17T06:33:19.8809859Z parser.add_argument( 2025-07-17T06:33:19.8810470Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.8811145Z ) 2025-07-17T06:33:19.8811500Z parser.add_argument( 2025-07-17T06:33:19.8812313Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.8813000Z ) 2025-07-17T06:33:19.8813364Z parser.add_argument( 2025-07-17T06:33:19.8814016Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.8814731Z ) 2025-07-17T06:33:19.8815089Z parser.add_argument( 2025-07-17T06:33:19.8815527Z "--github-ref-type", 2025-07-17T06:33:19.8815974Z type=str, 2025-07-17T06:33:19.8816363Z required=True, 2025-07-17T06:33:19.8816852Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.8817398Z ) 2025-07-17T06:33:19.8818004Z parser.add_argument( 2025-07-17T06:33:19.8818459Z "--eligible-experiments", 2025-07-17T06:33:19.8818976Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.8819491Z required=False, 2025-07-17T06:33:19.8819911Z default="", 2025-07-17T06:33:19.8820769Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.8821709Z ) 2025-07-17T06:33:19.8875183Z parser.add_argument( 2025-07-17T06:33:19.8876236Z "--opt-out-experiments", 2025-07-17T06:33:19.8877142Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.8878132Z required=False, 2025-07-17T06:33:19.8878569Z default="", 2025-07-17T06:33:19.8878951Z help=( 2025-07-17T06:33:19.8879639Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.8880779Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.8881621Z ), 2025-07-17T06:33:19.8881972Z ) 2025-07-17T06:33:19.8882334Z parser.add_argument( 2025-07-17T06:33:19.8882767Z "--pr-number", 2025-07-17T06:33:19.8883164Z type=str, 2025-07-17T06:33:19.8883558Z required=False, 2025-07-17T06:33:19.8883996Z default="", 2025-07-17T06:33:19.8884694Z help="the optional PR number where this is run", 2025-07-17T06:33:19.8885251Z ) 2025-07-17T06:33:19.8885454Z 2025-07-17T06:33:19.8885639Z return parser.parse_args() 2025-07-17T06:33:19.8885943Z 2025-07-17T06:33:19.8885950Z 2025-07-17T06:33:19.8886354Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.8887101Z auth = Auth.Token(github_token) 2025-07-17T06:33:19.8887811Z return Github(auth=auth) 2025-07-17T06:33:19.8888131Z 2025-07-17T06:33:19.8888138Z 2025-07-17T06:33:19.8888600Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.8889410Z repo = gh.get_repo(repo) 2025-07-17T06:33:19.8889895Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.8890265Z 2025-07-17T06:33:19.8890272Z 2025-07-17T06:33:19.8890456Z def get_potential_pr_author( 2025-07-17T06:33:19.8891093Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.8891769Z ) -> str: 2025-07-17T06:33:19.8892282Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.8893077Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.8893834Z # embedded in the tag name: ciflow// 2025-07-17T06:33:19.8894259Z 2025-07-17T06:33:19.8894450Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.8894784Z 2025-07-17T06:33:19.8895050Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.8895673Z split_tag = ref_name.split("/") 2025-07-17T06:33:19.8896160Z if ( 2025-07-17T06:33:19.8896544Z len(split_tag) == 3 2025-07-17T06:33:19.8897014Z and split_tag[0] == "ciflow" 2025-07-17T06:33:19.8897532Z and split_tag[2].isnumeric() 2025-07-17T06:33:19.8898214Z ): 2025-07-17T06:33:19.8898602Z pr_number = split_tag[2] 2025-07-17T06:33:19.8899248Z try: 2025-07-17T06:33:19.8899671Z repository = gh.get_repo(repo) 2025-07-17T06:33:19.8900277Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.8900868Z except Exception as e: 2025-07-17T06:33:19.8901378Z raise Exception( # noqa: TRY002 2025-07-17T06:33:19.8902033Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.8902665Z ) from e 2025-07-17T06:33:19.8903181Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.8903872Z # In all other cases, return the original input username 2025-07-17T06:33:19.8904455Z return username 2025-07-17T06:33:19.8904689Z 2025-07-17T06:33:19.8904695Z 2025-07-17T06:33:19.8904917Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.8905446Z """ 2025-07-17T06:33:19.8906068Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.8906844Z """ 2025-07-17T06:33:19.8907374Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.8908077Z 2025-07-17T06:33:19.8908085Z 2025-07-17T06:33:19.8908280Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.8908766Z try: 2025-07-17T06:33:19.8909138Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.8909638Z return data 2025-07-17T06:33:19.8910040Z except yaml.YAMLError: 2025-07-17T06:33:19.8910513Z log.exception("Error loading YAML") 2025-07-17T06:33:19.8911013Z raise 2025-07-17T06:33:19.8911232Z 2025-07-17T06:33:19.8911239Z 2025-07-17T06:33:19.8911643Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.8912376Z """ 2025-07-17T06:33:19.8912988Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.8913587Z 2025-07-17T06:33:19.8914082Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.8914840Z and the text below is the list of opted in users. 2025-07-17T06:33:19.8915244Z 2025-07-17T06:33:19.8915609Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.8916307Z """ 2025-07-17T06:33:19.8916734Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.8917335Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.8918172Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.8918764Z else: 2025-07-17T06:33:19.8919135Z return "", rollout_state 2025-07-17T06:33:19.8919435Z 2025-07-17T06:33:19.8919443Z 2025-07-17T06:33:19.8919643Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.8920137Z """ 2025-07-17T06:33:19.8920653Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.8921286Z """ 2025-07-17T06:33:19.8921486Z 2025-07-17T06:33:19.8921501Z 2025-07-17T06:33:19.8921840Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.8922489Z """ 2025-07-17T06:33:19.8923185Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:19.8923868Z 2025-07-17T06:33:19.8924620Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.8925667Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.8926377Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.8926874Z 2025-07-17T06:33:19.8926881Z 2025-07-17T06:33:19.8927043Z """ 2025-07-17T06:33:19.8927405Z optins = UserOptins() 2025-07-17T06:33:19.8928183Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.8928739Z user = user.strip("\r\n\t -") 2025-07-17T06:33:19.8929296Z if not user or not user.startswith("@"): 2025-07-17T06:33:19.8930039Z # Not a valid user. Skip 2025-07-17T06:33:19.8930528Z continue 2025-07-17T06:33:19.8930768Z 2025-07-17T06:33:19.8930926Z if user: 2025-07-17T06:33:19.8931365Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.8932053Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.8932544Z 2025-07-17T06:33:19.8932708Z return optins 2025-07-17T06:33:19.8932935Z 2025-07-17T06:33:19.8932948Z 2025-07-17T06:33:19.8933227Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.8933818Z """ 2025-07-17T06:33:19.8934212Z Check if the experiment name is valid. 2025-07-17T06:33:19.8934723Z A valid name: 2025-07-17T06:33:19.8935349Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.8936522Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.8937419Z - Cannot contain spaces 2025-07-17T06:33:19.8938019Z """ 2025-07-17T06:33:19.8938336Z 2025-07-17T06:33:19.8938595Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.8939300Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.8939743Z 2025-07-17T06:33:19.8939904Z if valid: 2025-07-17T06:33:19.8940281Z return True 2025-07-17T06:33:19.8940518Z 2025-07-17T06:33:19.8940682Z log.error( 2025-07-17T06:33:19.8942181Z 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-07-17T06:33:19.8943740Z ) 2025-07-17T06:33:19.8944088Z return False 2025-07-17T06:33:19.8944323Z 2025-07-17T06:33:19.8944331Z 2025-07-17T06:33:19.8944633Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.8945251Z """ 2025-07-17T06:33:19.8945976Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.8946704Z """ 2025-07-17T06:33:19.8947046Z try: 2025-07-17T06:33:19.8947456Z if settings_text: 2025-07-17T06:33:19.8948473Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.8949381Z # for easy reading 2025-07-17T06:33:19.8950165Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.8951042Z # the backtick character in shell commands. 2025-07-17T06:33:19.8951642Z backtick = chr(96) # backtick character 2025-07-17T06:33:19.8952295Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.8952960Z settings = load_yaml(settings_text) 2025-07-17T06:33:19.8953336Z 2025-07-17T06:33:19.8953757Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.8954515Z experiments = {} 2025-07-17T06:33:19.8954813Z 2025-07-17T06:33:19.8955197Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.8955965Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.8957073Z # 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-07-17T06:33:19.8958445Z continue 2025-07-17T06:33:19.8958741Z 2025-07-17T06:33:19.8958920Z valid_settings = {} 2025-07-17T06:33:19.8959439Z for setting in exp_settings: 2025-07-17T06:33:19.8959993Z if setting not in Experiment._fields: 2025-07-17T06:33:19.8960546Z log.warning( 2025-07-17T06:33:19.8961237Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.8962170Z ) 2025-07-17T06:33:19.8962588Z else: 2025-07-17T06:33:19.8963095Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.8963521Z 2025-07-17T06:33:19.8963792Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.8964416Z return Settings(experiments) 2025-07-17T06:33:19.8964761Z 2025-07-17T06:33:19.8964939Z except Exception: 2025-07-17T06:33:19.8965404Z log.exception("Failed to parse settings") 2025-07-17T06:33:19.8965794Z 2025-07-17T06:33:19.8965963Z return Settings() 2025-07-17T06:33:19.8966214Z 2025-07-17T06:33:19.8966221Z 2025-07-17T06:33:19.8966472Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.8967029Z """ 2025-07-17T06:33:19.8967468Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.8968559Z 2025-07-17T06:33:19.8968922Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.8969700Z and the text below is the list of opted in users. 2025-07-17T06:33:19.8970103Z 2025-07-17T06:33:19.8970504Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.8971241Z """ 2025-07-17T06:33:19.8971786Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.8972543Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.8972948Z 2025-07-17T06:33:19.8972955Z 2025-07-17T06:33:19.8973199Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.8973747Z """ 2025-07-17T06:33:19.8974127Z Parse users from the rollout state. 2025-07-17T06:33:19.8974474Z 2025-07-17T06:33:19.8974626Z """ 2025-07-17T06:33:19.8975143Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.8975893Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.8976292Z 2025-07-17T06:33:19.8976303Z 2025-07-17T06:33:19.8976861Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.8977737Z """ 2025-07-17T06:33:19.8978153Z Check if a user is opted into an experiment 2025-07-17T06:33:19.8978690Z """ 2025-07-17T06:33:19.8979132Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.8979558Z 2025-07-17T06:33:19.8979565Z 2025-07-17T06:33:19.8979980Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.8980731Z """ 2025-07-17T06:33:19.8981182Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.8981762Z """ 2025-07-17T06:33:19.8982252Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.8982933Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.8983557Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.8984169Z return False 2025-07-17T06:33:19.8984425Z 2025-07-17T06:33:19.8984701Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.8985299Z log.warning( 2025-07-17T06:33:19.8986097Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.8986977Z ) 2025-07-17T06:33:19.8987189Z 2025-07-17T06:33:19.8987353Z return True 2025-07-17T06:33:19.8987673Z 2025-07-17T06:33:19.8987680Z 2025-07-17T06:33:19.8987862Z def get_runner_prefix( 2025-07-17T06:33:19.8988301Z rollout_state: str, 2025-07-17T06:33:19.8988748Z workflow_requestors: Iterable[str], 2025-07-17T06:33:19.8989264Z branch: str, 2025-07-17T06:33:19.8989743Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.8990393Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.8990981Z is_canary: bool = False, 2025-07-17T06:33:19.8991442Z ) -> str: 2025-07-17T06:33:19.8991846Z settings = parse_settings(rollout_state) 2025-07-17T06:33:19.8992572Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.8992938Z 2025-07-17T06:33:19.8993105Z fleet_prefix = "" 2025-07-17T06:33:19.8993525Z prefixes = [] 2025-07-17T06:33:19.8994148Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.8995084Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.8995796Z log.info( 2025-07-17T06:33:19.8996463Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.8997217Z ) 2025-07-17T06:33:19.8997767Z continue 2025-07-17T06:33:19.8998163Z 2025-07-17T06:33:19.8998354Z if opt_out_experiments: 2025-07-17T06:33:19.8998890Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.8999532Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.9000125Z log.info( 2025-07-17T06:33:19.9001042Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.9002017Z ) 2025-07-17T06:33:19.9002402Z continue 2025-07-17T06:33:19.9002671Z 2025-07-17T06:33:19.9002853Z if eligible_experiments: 2025-07-17T06:33:19.9003427Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.9004058Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.9004618Z log.info( 2025-07-17T06:33:19.9005393Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.9006228Z ) 2025-07-17T06:33:19.9006614Z continue 2025-07-17T06:33:19.9007085Z elif not experiment_settings.default: 2025-07-17T06:33:19.9007798Z log.info( 2025-07-17T06:33:19.9008655Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.9009407Z ) 2025-07-17T06:33:19.9009774Z continue 2025-07-17T06:33:19.9010014Z 2025-07-17T06:33:19.9010289Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.9010897Z opted_out_users = [ 2025-07-17T06:33:19.9011337Z requestor 2025-07-17T06:33:19.9011776Z for requestor in workflow_requestors 2025-07-17T06:33:19.9012441Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.9013056Z ] 2025-07-17T06:33:19.9013265Z 2025-07-17T06:33:19.9013441Z if opted_out_users: 2025-07-17T06:33:19.9013888Z log.info( 2025-07-17T06:33:19.9014487Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.9015184Z ) 2025-07-17T06:33:19.9015557Z continue 2025-07-17T06:33:19.9015807Z 2025-07-17T06:33:19.9016093Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.9016724Z opted_in_users = [ 2025-07-17T06:33:19.9017165Z requestor 2025-07-17T06:33:19.9017728Z for requestor in workflow_requestors 2025-07-17T06:33:19.9018405Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.9019029Z ] 2025-07-17T06:33:19.9019231Z 2025-07-17T06:33:19.9019399Z enabled = False 2025-07-17T06:33:19.9019833Z if opted_in_users: 2025-07-17T06:33:19.9020264Z log.info( 2025-07-17T06:33:19.9020856Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.9021535Z ) 2025-07-17T06:33:19.9021919Z enabled = True 2025-07-17T06:33:19.9022197Z 2025-07-17T06:33:19.9022407Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.9023242Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.9024313Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.9024963Z log.info( 2025-07-17T06:33:19.9025822Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.9026742Z ) 2025-07-17T06:33:19.9027146Z enabled = True 2025-07-17T06:33:19.9027438Z 2025-07-17T06:33:19.9027722Z if enabled: 2025-07-17T06:33:19.9028143Z label = experiment_name 2025-07-17T06:33:19.9028683Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.9029511Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.9030399Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.9031143Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.9031808Z if is_canary: 2025-07-17T06:33:19.9032281Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.9032830Z fleet_prefix = label 2025-07-17T06:33:19.9033316Z else: 2025-07-17T06:33:19.9033729Z prefixes.append(label) 2025-07-17T06:33:19.9034068Z 2025-07-17T06:33:19.9034254Z if len(prefixes) > 1: 2025-07-17T06:33:19.9034686Z log.error( 2025-07-17T06:33:19.9035723Z 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-07-17T06:33:19.9036842Z ) 2025-07-17T06:33:19.9037225Z prefixes = prefixes[:1] 2025-07-17T06:33:19.9037530Z 2025-07-17T06:33:19.9037980Z # Fleet always comes first 2025-07-17T06:33:19.9038481Z if fleet_prefix: 2025-07-17T06:33:19.9038930Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.9039295Z 2025-07-17T06:33:19.9039729Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.9040146Z 2025-07-17T06:33:19.9040159Z 2025-07-17T06:33:19.9040608Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.9041378Z """ 2025-07-17T06:33:19.9041952Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.9042518Z 2025-07-17T06:33:19.9042904Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.9043604Z """ 2025-07-17T06:33:19.9043988Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.9044520Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.9045150Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.9045593Z 2025-07-17T06:33:19.9045599Z 2025-07-17T06:33:19.9045988Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.9046749Z for _ in range(num_retries): 2025-07-17T06:33:19.9047220Z try: 2025-07-17T06:33:19.9047851Z req = Request(url=url, headers=headers) 2025-07-17T06:33:19.9048552Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.9049181Z return json.loads(content) 2025-07-17T06:33:19.9049707Z except Exception as e: 2025-07-17T06:33:19.9050234Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.9050638Z 2025-07-17T06:33:19.9051013Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.9051718Z return {} 2025-07-17T06:33:19.9051945Z 2025-07-17T06:33:19.9051952Z 2025-07-17T06:33:19.9052105Z @cache 2025-07-17T06:33:19.9052724Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.9053473Z """ 2025-07-17T06:33:19.9053860Z Dynamically get PR information 2025-07-17T06:33:19.9054337Z """ 2025-07-17T06:33:19.9054989Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.9055612Z headers = { 2025-07-17T06:33:19.9056061Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.9056658Z "Authorization": f"token {github_token}", 2025-07-17T06:33:19.9057191Z } 2025-07-17T06:33:19.9057788Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.9058424Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.9058972Z headers=headers, 2025-07-17T06:33:19.9059393Z ) 2025-07-17T06:33:19.9059589Z 2025-07-17T06:33:19.9059766Z if not json_response: 2025-07-17T06:33:19.9060319Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.9060927Z return {} 2025-07-17T06:33:19.9061159Z 2025-07-17T06:33:19.9061333Z return json_response 2025-07-17T06:33:19.9061635Z 2025-07-17T06:33:19.9061643Z 2025-07-17T06:33:19.9062038Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.9062773Z """ 2025-07-17T06:33:19.9063286Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.9063938Z """ 2025-07-17T06:33:19.9064406Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.9065007Z return { 2025-07-17T06:33:19.9065588Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.9066292Z } 2025-07-17T06:33:19.9066489Z 2025-07-17T06:33:19.9066497Z 2025-07-17T06:33:19.9066669Z def main() -> None: 2025-07-17T06:33:19.9067076Z args = parse_args() 2025-07-17T06:33:19.9067339Z 2025-07-17T06:33:19.9067561Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.9068042Z 2025-07-17T06:33:19.9068231Z # Check if the PR is opt-out 2025-07-17T06:33:19.9068712Z if args.pr_number: 2025-07-17T06:33:19.9069347Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.9070255Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.9070759Z log.info( 2025-07-17T06:33:19.9071437Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.9072198Z ) 2025-07-17T06:33:19.9072729Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.9073394Z sys.exit() 2025-07-17T06:33:19.9073650Z 2025-07-17T06:33:19.9073810Z try: 2025-07-17T06:33:19.9074241Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.9074941Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.9075578Z ) 2025-07-17T06:33:19.9075779Z 2025-07-17T06:33:19.9075982Z username = get_potential_pr_author( 2025-07-17T06:33:19.9076513Z args.github_token, 2025-07-17T06:33:19.9076988Z args.github_repo, 2025-07-17T06:33:19.9077449Z args.github_actor, 2025-07-17T06:33:19.9078043Z args.github_ref_type, 2025-07-17T06:33:19.9078535Z args.github_branch, 2025-07-17T06:33:19.9078999Z ) 2025-07-17T06:33:19.9079201Z 2025-07-17T06:33:19.9079477Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.9079928Z 2025-07-17T06:33:19.9080139Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.9080691Z rollout_state, 2025-07-17T06:33:19.9081163Z (args.github_issue_owner, username), 2025-07-17T06:33:19.9081710Z args.github_branch, 2025-07-17T06:33:19.9082193Z args.eligible_experiments, 2025-07-17T06:33:19.9082726Z args.opt_out_experiments, 2025-07-17T06:33:19.9083214Z is_canary, 2025-07-17T06:33:19.9083619Z ) 2025-07-17T06:33:19.9083820Z 2025-07-17T06:33:19.9084000Z except Exception as e: 2025-07-17T06:33:19.9084448Z log.error( 2025-07-17T06:33:19.9085109Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.9086008Z ) 2025-07-17T06:33:19.9086211Z 2025-07-17T06:33:19.9086545Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.9087041Z 2025-07-17T06:33:19.9087048Z 2025-07-17T06:33:19.9087226Z if __name__ == "__main__": 2025-07-17T06:33:19.9087759Z main() 2025-07-17T06:33:19.9087969Z 2025-07-17T06:33:19.9184738Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.9185660Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.9214402Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.9214867Z env: 2025-07-17T06:33:19.9215507Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.9215918Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.9216366Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.9216878Z ISSUE_OWNER: 2025-07-17T06:33:19.9217278Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.9218048Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:19.9218503Z PR_NUMBER: 2025-07-17T06:33:19.9218904Z ##[endgroup] 2025-07-17T06:33:20.2795962Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.0217382Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.0598384Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.0832848Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-07-17T06:33:21.1052362Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.1087182Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.1537145Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.1576823Z 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-07-17T06:33:21.1629111Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.1650261Z 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-07-17T06:33:21.1667165Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.1935550Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.1971101Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.2220424Z 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-07-17T06:33:21.3304043Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.3341261Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.4404451Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.4444107Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:21.4630986Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.4666946Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.4903343Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.4983881Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 22.0 MB/s eta 0:00:00 2025-07-17T06:33:21.5020182Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.5082352Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 82.8 MB/s eta 0:00:00 2025-07-17T06:33:21.5119098Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:21.5207154Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 124.8 MB/s eta 0:00:00 2025-07-17T06:33:21.5245574Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.5300874Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.5365405Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 103.7 MB/s eta 0:00:00 2025-07-17T06:33:21.5400301Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:21.5440389Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 34.3 MB/s eta 0:00:00 2025-07-17T06:33:21.5471346Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.5531794Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 24.2 MB/s eta 0:00:00 2025-07-17T06:33:21.8524193Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.3864657Z 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.2 2025-07-17T06:33:22.4702548Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.4702852Z curr_branch="main" 2025-07-17T06:33:22.4703110Z curr_ref_type="branch" 2025-07-17T06:33:22.4703366Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.4703617Z  2025-07-17T06:33:22.4703808Z python3 runner_determinator.py \ 2025-07-17T06:33:22.4704083Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.4704362Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.4704620Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.4704880Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.4705162Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.4705442Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.4705716Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.4706013Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.4706379Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.4706667Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.4735999Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.4736232Z env: 2025-07-17T06:33:22.4736762Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.4736962Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.4737173Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.4737411Z ISSUE_OWNER: 2025-07-17T06:33:22.4737747Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.4737982Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:22.4738195Z PR_NUMBER: 2025-07-17T06:33:22.4738377Z ##[endgroup] 2025-07-17T06:33:22.4786142Z Current branch is 'main' 2025-07-17T06:33:23.9696017Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-07-17T06:33:23.9697479Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:23.9698880Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:23.9699816Z INFO : Setting output: label-type='' 2025-07-17T06:33:24.0006782Z Evaluate and set job outputs 2025-07-17T06:33:24.0013839Z Cleaning up orphan processes