2025-10-10T00:01:08.9834971Z Current runner version: '2.328.0' 2025-10-10T00:01:08.9858627Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.9859534Z Hosted Compute Agent 2025-10-10T00:01:08.9860071Z Version: 20250912.392 2025-10-10T00:01:08.9860659Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.9861320Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.9862159Z ##[endgroup] 2025-10-10T00:01:08.9862652Z ##[group]Operating System 2025-10-10T00:01:08.9863192Z Ubuntu 2025-10-10T00:01:08.9863749Z 24.04.3 2025-10-10T00:01:08.9864175Z LTS 2025-10-10T00:01:08.9864641Z ##[endgroup] 2025-10-10T00:01:08.9865176Z ##[group]Runner Image 2025-10-10T00:01:08.9865713Z Image: ubuntu-24.04 2025-10-10T00:01:08.9866174Z Version: 20250929.60.1 2025-10-10T00:01:08.9867243Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.9868782Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.9869804Z ##[endgroup] 2025-10-10T00:01:08.9870718Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.9873304Z Contents: read 2025-10-10T00:01:08.9873817Z Metadata: read 2025-10-10T00:01:08.9874300Z ##[endgroup] 2025-10-10T00:01:08.9876377Z Secret source: Actions 2025-10-10T00:01:08.9877097Z Prepare workflow directory 2025-10-10T00:01:09.0388598Z Prepare all required actions 2025-10-10T00:01:09.0445040Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:09.0450003Z ##[group] Inputs 2025-10-10T00:01:09.0450688Z check_experiments: 2025-10-10T00:01:09.0451206Z opt_out_experiments: 2025-10-10T00:01:09.0452151Z triggering_actor: pytorchmergebot 2025-10-10T00:01:09.0452777Z issue_owner: 2025-10-10T00:01:09.0453276Z curr_branch: main 2025-10-10T00:01:09.0453728Z curr_ref_type: branch 2025-10-10T00:01:09.0454503Z issue_number: 5132 2025-10-10T00:01:09.0455031Z ##[endgroup] 2025-10-10T00:01:09.0455666Z Complete job name: before-test / get-label-type / runner-determinator 2025-10-10T00:01:09.7465705Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:09.7468429Z cat < runner_determinator.py 2025-10-10T00:01:09.7469146Z # flake8: noqa: G004 2025-10-10T00:01:09.7469740Z  2025-10-10T00:01:09.7470511Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.7471875Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.7473042Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.7473767Z  2025-10-10T00:01:09.7474348Z """ 2025-10-10T00:01:09.7475074Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.7476122Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.7477414Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.7478442Z of which runners should be used to run which job. 2025-10-10T00:01:09.7479224Z  2025-10-10T00:01:09.7479948Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.7481037Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.7482573Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.7483589Z list, defined. 2025-10-10T00:01:09.7484107Z  2025-10-10T00:01:09.7484988Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.7486143Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.7487144Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.7487964Z  2025-10-10T00:01:09.7488975Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.7490047Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.7491041Z experiments which the user could be opted in to. 2025-10-10T00:01:09.7491947Z  2025-10-10T00:01:09.7492502Z The user list has the following rules: 2025-10-10T00:01:09.7493105Z  2025-10-10T00:01:09.7493920Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.7494971Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.7496236Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.7574352Z  2025-10-10T00:01:09.7574761Z Example config: 2025-10-10T00:01:09.7575367Z  # A list of experiments that can be opted into. 2025-10-10T00:01:09.7576141Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.7576872Z  # Expected syntax is: 2025-10-10T00:01:09.7577624Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.7578711Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.7579526Z  2025-10-10T00:01:09.7579938Z  experiments: 2025-10-10T00:01:09.7580389Z  lf: 2025-10-10T00:01:09.7580821Z  rollout_percent: 25 2025-10-10T00:01:09.7581346Z  all_branches: false 2025-10-10T00:01:09.7582004Z  default: true 2025-10-10T00:01:09.7582479Z  --- 2025-10-10T00:01:09.7582894Z  2025-10-10T00:01:09.7583275Z  # Opt-ins: 2025-10-10T00:01:09.7583953Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.7585198Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.7586072Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.7586817Z  # Experiments should be from the above list. 2025-10-10T00:01:09.7587400Z  2025-10-10T00:01:09.7587817Z  @User1,-lf,split_build 2025-10-10T00:01:09.7588324Z  @User2,lf 2025-10-10T00:01:09.7588794Z  @User3,split_build 2025-10-10T00:01:09.7589277Z """ 2025-10-10T00:01:09.7589660Z  2025-10-10T00:01:09.7590049Z import json 2025-10-10T00:01:09.7590491Z import logging 2025-10-10T00:01:09.7590935Z import os 2025-10-10T00:01:09.7591368Z import random 2025-10-10T00:01:09.7591935Z import re 2025-10-10T00:01:09.7592356Z import sys 2025-10-10T00:01:09.7592848Z from argparse import ArgumentParser 2025-10-10T00:01:09.7593536Z from collections.abc import Iterable 2025-10-10T00:01:09.7594374Z from functools import cache 2025-10-10T00:01:09.7594935Z from logging import LogRecord 2025-10-10T00:01:09.7595503Z from typing import Any, NamedTuple 2025-10-10T00:01:09.7596129Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.7596724Z  2025-10-10T00:01:09.7597104Z import yaml 2025-10-10T00:01:09.7597574Z from github import Auth, Github 2025-10-10T00:01:09.7598143Z from github.Issue import Issue 2025-10-10T00:01:09.7598666Z  2025-10-10T00:01:09.7599050Z  2025-10-10T00:01:09.7599524Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.7600297Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.7601281Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.7602183Z  2025-10-10T00:01:09.7602879Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.7603529Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.7604147Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.7604809Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.7605374Z  2025-10-10T00:01:09.7605815Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.7606358Z  2025-10-10T00:01:09.7606758Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.7607299Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.7607795Z  2025-10-10T00:01:09.7608172Z  2025-10-10T00:01:09.7608590Z class Experiment(NamedTuple): 2025-10-10T00:01:09.7609149Z  rollout_perc: float = ( 2025-10-10T00:01:09.7609885Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.7610627Z  ) 2025-10-10T00:01:09.7611051Z  all_branches: bool = ( 2025-10-10T00:01:09.7612106Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.7612908Z  ) 2025-10-10T00:01:09.7613324Z  default: bool = ( 2025-10-10T00:01:09.7614003Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.7614689Z  ) 2025-10-10T00:01:09.7615083Z  2025-10-10T00:01:09.7615494Z  # Add more fields as needed 2025-10-10T00:01:09.7616006Z  2025-10-10T00:01:09.7616388Z  2025-10-10T00:01:09.7616799Z class Settings(NamedTuple): 2025-10-10T00:01:09.7617320Z  """ 2025-10-10T00:01:09.7617855Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:09.7618489Z  """ 2025-10-10T00:01:09.7618889Z  2025-10-10T00:01:09.7619338Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.7619910Z  2025-10-10T00:01:09.7620423Z  2025-10-10T00:01:09.7620890Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.7621601Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.7622355Z  2025-10-10T00:01:09.7622747Z  COLORS = { 2025-10-10T00:01:09.7623235Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.7623803Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.7624371Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.7624941Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.7625493Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.7626022Z  } 2025-10-10T00:01:09.7626415Z  2025-10-10T00:01:09.7626882Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.7627703Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.7628554Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.7629203Z  return super().format(record) 2025-10-10T00:01:09.7629736Z  2025-10-10T00:01:09.7630109Z  2025-10-10T00:01:09.7630536Z handler = logging.StreamHandler() 2025-10-10T00:01:09.7631344Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.7632429Z  2025-10-10T00:01:09.7632966Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.7633611Z log.addHandler(handler) 2025-10-10T00:01:09.7634142Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.7634649Z  2025-10-10T00:01:09.7635017Z  2025-10-10T00:01:09.7635523Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.7636142Z  """ 2025-10-10T00:01:09.7636732Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.7637568Z  """ 2025-10-10T00:01:09.7638006Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:09.7639178Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.7640389Z  log.warning( 2025-10-10T00:01:09.7641354Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.7642470Z  ) 2025-10-10T00:01:09.7642984Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.7643599Z  return 2025-10-10T00:01:09.7644044Z  2025-10-10T00:01:09.7644476Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.7645116Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.7645747Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:09.7646285Z  2025-10-10T00:01:09.7646668Z  2025-10-10T00:01:09.7647228Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.7647949Z  return frozenset( 2025-10-10T00:01:09.7648660Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.7649393Z  ) 2025-10-10T00:01:09.7649805Z  2025-10-10T00:01:09.7650193Z  2025-10-10T00:01:09.7650604Z def parse_args() -> Any: 2025-10-10T00:01:09.7651268Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.7652798Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.7653626Z  parser.add_argument( 2025-10-10T00:01:09.7654198Z  "--github-issue-repo", 2025-10-10T00:01:09.7654760Z  type=str, 2025-10-10T00:01:09.7655257Z  required=False, 2025-10-10T00:01:09.7655943Z  default="pytorch/test-infra", 2025-10-10T00:01:09.7656583Z  help="GitHub repo to get the issue", 2025-10-10T00:01:09.7657158Z  ) 2025-10-10T00:01:09.7657591Z  parser.add_argument( 2025-10-10T00:01:09.7658125Z  "--github-repo", 2025-10-10T00:01:09.7658637Z  type=str, 2025-10-10T00:01:09.7659120Z  required=True, 2025-10-10T00:01:09.7659672Z  help="GitHub repo where CI is running", 2025-10-10T00:01:09.7660237Z  ) 2025-10-10T00:01:09.7660662Z  parser.add_argument( 2025-10-10T00:01:09.7661374Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.7662208Z  ) 2025-10-10T00:01:09.7662641Z  parser.add_argument( 2025-10-10T00:01:09.7663389Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.7664152Z  ) 2025-10-10T00:01:09.7664582Z  parser.add_argument( 2025-10-10T00:01:09.7665324Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.7666068Z  ) 2025-10-10T00:01:09.7666501Z  parser.add_argument( 2025-10-10T00:01:09.7667269Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.7668055Z  ) 2025-10-10T00:01:09.7668496Z  parser.add_argument( 2025-10-10T00:01:09.7669026Z  "--github-ref-type", 2025-10-10T00:01:09.7669556Z  type=str, 2025-10-10T00:01:09.7670038Z  required=True, 2025-10-10T00:01:09.7670637Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.7671241Z  ) 2025-10-10T00:01:09.7671759Z  parser.add_argument( 2025-10-10T00:01:09.7672461Z  "--eligible-experiments", 2025-10-10T00:01:09.7673060Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.7673640Z  required=False, 2025-10-10T00:01:09.7674137Z  default="", 2025-10-10T00:01:09.7675089Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.7676094Z  ) 2025-10-10T00:01:09.7676516Z  parser.add_argument( 2025-10-10T00:01:09.7677059Z  "--opt-out-experiments", 2025-10-10T00:01:09.7677659Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:09.7678236Z  required=False, 2025-10-10T00:01:09.7678739Z  default="", 2025-10-10T00:01:09.7679214Z  help=( 2025-10-10T00:01:09.7679988Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.7681224Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.7682238Z  ), 2025-10-10T00:01:09.7682671Z  ) 2025-10-10T00:01:09.7683092Z  parser.add_argument( 2025-10-10T00:01:09.7683618Z  "--pr-number", 2025-10-10T00:01:09.7684116Z  type=str, 2025-10-10T00:01:09.7684596Z  required=False, 2025-10-10T00:01:09.7685090Z  default="", 2025-10-10T00:01:09.7685669Z  help="the optional PR number where this is run", 2025-10-10T00:01:09.7686291Z  ) 2025-10-10T00:01:09.7686693Z  2025-10-10T00:01:09.7687119Z  return parser.parse_args() 2025-10-10T00:01:09.7687647Z  2025-10-10T00:01:09.7688023Z  2025-10-10T00:01:09.7688677Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.7689649Z  auth = Auth.Token(github_token) 2025-10-10T00:01:09.7690264Z  return Github(auth=auth) 2025-10-10T00:01:09.7690782Z  2025-10-10T00:01:09.7691156Z  2025-10-10T00:01:09.7691980Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.7692872Z  repo = gh.get_repo(repo) 2025-10-10T00:01:09.7693478Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.7694066Z  2025-10-10T00:01:09.7694441Z  2025-10-10T00:01:09.7694856Z def get_potential_pr_author( 2025-10-10T00:01:09.7695594Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.7696341Z ) -> str: 2025-10-10T00:01:09.7696952Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.7697851Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.7698696Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:09.7699325Z  2025-10-10T00:01:09.7699764Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.7700311Z  2025-10-10T00:01:09.7700843Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.7701549Z  split_tag = ref_name.split("/") 2025-10-10T00:01:09.7702209Z  if ( 2025-10-10T00:01:09.7702678Z  len(split_tag) == 3 2025-10-10T00:01:09.7703243Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:09.7703843Z  and split_tag[2].isnumeric() 2025-10-10T00:01:09.7704396Z  ): 2025-10-10T00:01:09.7704865Z  pr_number = split_tag[2] 2025-10-10T00:01:09.7705422Z  try: 2025-10-10T00:01:09.7705937Z  repository = gh.get_repo(repo) 2025-10-10T00:01:09.7706767Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.7707448Z  except Exception as e: 2025-10-10T00:01:09.7708051Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:09.7708795Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.7709511Z  ) from e 2025-10-10T00:01:09.7710148Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.7710938Z  # In all other cases, return the original input username 2025-10-10T00:01:09.7711593Z  return username 2025-10-10T00:01:09.7712160Z  2025-10-10T00:01:09.7712571Z  2025-10-10T00:01:09.7713040Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.7713639Z  """ 2025-10-10T00:01:09.7714375Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.7715222Z  """ 2025-10-10T00:01:09.7715851Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.7716566Z  2025-10-10T00:01:09.7716947Z  2025-10-10T00:01:09.7717378Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.7717937Z  try: 2025-10-10T00:01:09.7718404Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.7718974Z  return data 2025-10-10T00:01:09.7719478Z  except yaml.YAMLError: 2025-10-10T00:01:09.7720055Z  log.exception("Error loading YAML") 2025-10-10T00:01:09.7720635Z  raise 2025-10-10T00:01:09.7721060Z  2025-10-10T00:01:09.7721435Z  2025-10-10T00:01:09.7722253Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.7723057Z  """ 2025-10-10T00:01:09.7724033Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.7725196Z  2025-10-10T00:01:09.7725810Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.7726667Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.7727291Z  2025-10-10T00:01:09.7727927Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.7728706Z  """ 2025-10-10T00:01:09.7729377Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.7730172Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.7730871Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.7731518Z  else: 2025-10-10T00:01:09.7732519Z  return "", rollout_state 2025-10-10T00:01:09.7733099Z  2025-10-10T00:01:09.7733474Z  2025-10-10T00:01:09.7733915Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.7734485Z  """ 2025-10-10T00:01:09.7735089Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.7735770Z  """ 2025-10-10T00:01:09.7736157Z  2025-10-10T00:01:09.7736513Z  2025-10-10T00:01:09.7737088Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.7737782Z  """ 2025-10-10T00:01:09.7738556Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.7739419Z  2025-10-10T00:01:09.7740270Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.7741339Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.7742550Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.7743236Z  2025-10-10T00:01:09.7743612Z  2025-10-10T00:01:09.7743981Z  """ 2025-10-10T00:01:09.7744396Z  optins = UserOptins() 2025-10-10T00:01:09.7744961Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.7745584Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:09.7746195Z  if not user or not user.startswith("@"): 2025-10-10T00:01:09.7746848Z  # Not a valid user. Skip 2025-10-10T00:01:09.7747382Z  continue 2025-10-10T00:01:09.7747844Z  2025-10-10T00:01:09.7748225Z  if user: 2025-10-10T00:01:09.7748737Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.7749488Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.7750162Z  2025-10-10T00:01:09.7750545Z  return optins 2025-10-10T00:01:09.7750991Z  2025-10-10T00:01:09.7751355Z  2025-10-10T00:01:09.7751987Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.7752643Z  """ 2025-10-10T00:01:09.7753111Z  Check if the experiment name is valid. 2025-10-10T00:01:09.7753668Z  A valid name: 2025-10-10T00:01:09.7754388Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.7755375Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.7756137Z  - Cannot contain spaces 2025-10-10T00:01:09.7756650Z  """ 2025-10-10T00:01:09.7757045Z  2025-10-10T00:01:09.7757553Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.7758515Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.7759362Z  2025-10-10T00:01:09.7759752Z  if valid: 2025-10-10T00:01:09.7760203Z  return True 2025-10-10T00:01:09.7760673Z  2025-10-10T00:01:09.7761058Z  log.error( 2025-10-10T00:01:09.7762712Z  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-10-10T00:01:09.7764318Z  ) 2025-10-10T00:01:09.7764722Z  return False 2025-10-10T00:01:09.7765158Z  2025-10-10T00:01:09.7765521Z  2025-10-10T00:01:09.7766076Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.7766762Z  """ 2025-10-10T00:01:09.7767412Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.7768169Z  """ 2025-10-10T00:01:09.7768566Z  try: 2025-10-10T00:01:09.7768982Z  if settings_text: 2025-10-10T00:01:09.7769779Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.7770612Z  # for easy reading 2025-10-10T00:01:09.7771530Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.7772577Z  # the backtick character in shell commands. 2025-10-10T00:01:09.7773239Z  backtick = chr(96) # backtick character 2025-10-10T00:01:09.7773982Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.7774712Z  settings = load_yaml(settings_text) 2025-10-10T00:01:09.7775268Z  2025-10-10T00:01:09.7775910Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.7776852Z  experiments = {} 2025-10-10T00:01:09.7777358Z  2025-10-10T00:01:09.7777971Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.7778791Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.7779957Z  # 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-10-10T00:01:09.7781084Z  continue 2025-10-10T00:01:09.7781588Z  2025-10-10T00:01:09.7782100Z  valid_settings = {} 2025-10-10T00:01:09.7782692Z  for setting in exp_settings: 2025-10-10T00:01:09.7783317Z  if setting not in Experiment._fields: 2025-10-10T00:01:09.7783949Z  log.warning( 2025-10-10T00:01:09.7784735Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.7785491Z  ) 2025-10-10T00:01:09.7785998Z  else: 2025-10-10T00:01:09.7786593Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.7787210Z  2025-10-10T00:01:09.7787724Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.7788424Z  return Settings(experiments) 2025-10-10T00:01:09.7788978Z  2025-10-10T00:01:09.7789368Z  except Exception: 2025-10-10T00:01:09.7789942Z  log.exception("Failed to parse settings") 2025-10-10T00:01:09.7790529Z  2025-10-10T00:01:09.7790938Z  return Settings() 2025-10-10T00:01:09.7791412Z  2025-10-10T00:01:09.7791887Z  2025-10-10T00:01:09.7792525Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.7793166Z  """ 2025-10-10T00:01:09.7793679Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.7794275Z  2025-10-10T00:01:09.7794872Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.7795693Z  and the text below is the list of opted in users. 2025-10-10T00:01:09.7796290Z  2025-10-10T00:01:09.7796933Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.7797710Z  """ 2025-10-10T00:01:09.7798340Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.7799163Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.7799753Z  2025-10-10T00:01:09.7800117Z  2025-10-10T00:01:09.7800634Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.7801244Z  """ 2025-10-10T00:01:09.7801799Z  Parse users from the rollout state. 2025-10-10T00:01:09.7802356Z  2025-10-10T00:01:09.7802729Z  """ 2025-10-10T00:01:09.7803332Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.7804137Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.7804733Z  2025-10-10T00:01:09.7805104Z  2025-10-10T00:01:09.7805779Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.7806579Z  """ 2025-10-10T00:01:09.7807069Z  Check if a user is opted into an experiment 2025-10-10T00:01:09.7807659Z  """ 2025-10-10T00:01:09.7808193Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.7808813Z  2025-10-10T00:01:09.7809303Z  2025-10-10T00:01:09.7810005Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.7810811Z  """ 2025-10-10T00:01:09.7811343Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.7812063Z  """ 2025-10-10T00:01:09.7812680Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.7813444Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.7814149Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.7814809Z  return False 2025-10-10T00:01:09.7815265Z  2025-10-10T00:01:09.7815782Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.7816432Z  log.warning( 2025-10-10T00:01:09.7817346Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.7818284Z  ) 2025-10-10T00:01:09.7818690Z  2025-10-10T00:01:09.7819090Z  return True 2025-10-10T00:01:09.7819537Z  2025-10-10T00:01:09.7819916Z  2025-10-10T00:01:09.7820315Z def get_runner_prefix( 2025-10-10T00:01:09.7820830Z  rollout_state: str, 2025-10-10T00:01:09.7821369Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:09.7822040Z  branch: str, 2025-10-10T00:01:09.7822627Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.7823372Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.7824022Z  is_canary: bool = False, 2025-10-10T00:01:09.7824528Z ) -> str: 2025-10-10T00:01:09.7825042Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:09.7825681Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.7826251Z  2025-10-10T00:01:09.7826767Z  fleet_prefix = "" 2025-10-10T00:01:09.7827268Z  prefixes = [] 2025-10-10T00:01:09.7827991Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.7829001Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.7829766Z  log.info( 2025-10-10T00:01:09.7830524Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.7831327Z  ) 2025-10-10T00:01:09.7831888Z  continue 2025-10-10T00:01:09.7832351Z  2025-10-10T00:01:09.7832768Z  if opt_out_experiments: 2025-10-10T00:01:09.7833381Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.7834114Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.7834790Z  log.info( 2025-10-10T00:01:09.7835797Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.7836819Z  ) 2025-10-10T00:01:09.7837279Z  continue 2025-10-10T00:01:09.7837766Z  2025-10-10T00:01:09.7838176Z  if eligible_experiments: 2025-10-10T00:01:09.7838814Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.7839513Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.7840108Z  log.info( 2025-10-10T00:01:09.7840968Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.7841943Z  ) 2025-10-10T00:01:09.7842545Z  continue 2025-10-10T00:01:09.7843112Z  elif not experiment_settings.default: 2025-10-10T00:01:09.7843700Z  log.info( 2025-10-10T00:01:09.7844445Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.7845215Z  ) 2025-10-10T00:01:09.7845666Z  continue 2025-10-10T00:01:09.7846120Z  2025-10-10T00:01:09.7846635Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.7847299Z  opted_out_users = [ 2025-10-10T00:01:09.7847825Z  requestor 2025-10-10T00:01:09.7848362Z  for requestor in workflow_requestors 2025-10-10T00:01:09.7849097Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.7849774Z  ] 2025-10-10T00:01:09.7850174Z  2025-10-10T00:01:09.7850584Z  if opted_out_users: 2025-10-10T00:01:09.7851119Z  log.info( 2025-10-10T00:01:09.7851936Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.7852686Z  ) 2025-10-10T00:01:09.7853138Z  continue 2025-10-10T00:01:09.7853603Z  2025-10-10T00:01:09.7854113Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.7854781Z  opted_in_users = [ 2025-10-10T00:01:09.7855311Z  requestor 2025-10-10T00:01:09.7855862Z  for requestor in workflow_requestors 2025-10-10T00:01:09.7856595Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.7857272Z  ] 2025-10-10T00:01:09.7857685Z  2025-10-10T00:01:09.7858077Z  enabled = False 2025-10-10T00:01:09.7858593Z  if opted_in_users: 2025-10-10T00:01:09.7859230Z  log.info( 2025-10-10T00:01:09.7859937Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.7860663Z  ) 2025-10-10T00:01:09.7861122Z  enabled = True 2025-10-10T00:01:09.7861608Z  2025-10-10T00:01:09.7862166Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.7863086Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.7864138Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.7864887Z  log.info( 2025-10-10T00:01:09.7865885Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.7866898Z  ) 2025-10-10T00:01:09.7867388Z  enabled = True 2025-10-10T00:01:09.7867894Z  2025-10-10T00:01:09.7868289Z  if enabled: 2025-10-10T00:01:09.7868792Z  label = experiment_name 2025-10-10T00:01:09.7869419Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.7870297Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.7871238Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.7872172Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.7872881Z  if is_canary: 2025-10-10T00:01:09.7873449Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.7874047Z  fleet_prefix = label 2025-10-10T00:01:09.7874597Z  else: 2025-10-10T00:01:09.7875249Z  prefixes.append(label) 2025-10-10T00:01:09.7875786Z  2025-10-10T00:01:09.7876189Z  if len(prefixes) > 1: 2025-10-10T00:01:09.7876699Z  log.error( 2025-10-10T00:01:09.7877827Z  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-10-10T00:01:09.7878985Z  ) 2025-10-10T00:01:09.7879441Z  prefixes = prefixes[:1] 2025-10-10T00:01:09.7879965Z  2025-10-10T00:01:09.7880367Z  # Fleet always comes first 2025-10-10T00:01:09.7880919Z  if fleet_prefix: 2025-10-10T00:01:09.7881448Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.7882108Z  2025-10-10T00:01:09.7882604Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.7883222Z  2025-10-10T00:01:09.7883594Z  2025-10-10T00:01:09.7884289Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.7885107Z  """ 2025-10-10T00:01:09.7885758Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.7886514Z  2025-10-10T00:01:09.7887139Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.7887886Z  """ 2025-10-10T00:01:09.7888338Z  gh = get_gh_client(github_token) 2025-10-10T00:01:09.7888951Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.7889661Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.7890295Z  2025-10-10T00:01:09.7890675Z  2025-10-10T00:01:09.7891325Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.7892412Z  for _ in range(num_retries): 2025-10-10T00:01:09.7892952Z  try: 2025-10-10T00:01:09.7893460Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:09.7894182Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.7894883Z  return json.loads(content) 2025-10-10T00:01:09.7895469Z  except Exception as e: 2025-10-10T00:01:09.7896085Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.7896683Z  2025-10-10T00:01:09.7897302Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.7898062Z  return {} 2025-10-10T00:01:09.7898498Z  2025-10-10T00:01:09.7898864Z  2025-10-10T00:01:09.7899237Z @cache 2025-10-10T00:01:09.7899933Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.7900745Z  """ 2025-10-10T00:01:09.7901193Z  Dynamically get PR information 2025-10-10T00:01:09.7901829Z  """ 2025-10-10T00:01:09.7902396Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.7903073Z  headers = { 2025-10-10T00:01:09.7903617Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.7904288Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:09.7904867Z  } 2025-10-10T00:01:09.7905364Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.7906036Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.7906627Z  headers=headers, 2025-10-10T00:01:09.7907118Z  ) 2025-10-10T00:01:09.7907515Z  2025-10-10T00:01:09.7907911Z  if not json_response: 2025-10-10T00:01:09.7908572Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.7909379Z  return {} 2025-10-10T00:01:09.7909844Z  2025-10-10T00:01:09.7910238Z  return json_response 2025-10-10T00:01:09.7910741Z  2025-10-10T00:01:09.7911109Z  2025-10-10T00:01:09.7911858Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.7912669Z  """ 2025-10-10T00:01:09.7913262Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.7913959Z  """ 2025-10-10T00:01:09.7914503Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.7915160Z  return { 2025-10-10T00:01:09.7915820Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.7916553Z  } 2025-10-10T00:01:09.7916951Z  2025-10-10T00:01:09.7917327Z  2025-10-10T00:01:09.7917729Z def main() -> None: 2025-10-10T00:01:09.7918221Z  args = parse_args() 2025-10-10T00:01:09.7918707Z  2025-10-10T00:01:09.7919168Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.7919747Z  2025-10-10T00:01:09.7920154Z  # Check if the PR is opt-out 2025-10-10T00:01:09.7920700Z  if args.pr_number: 2025-10-10T00:01:09.7921436Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.7922352Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.7922907Z  log.info( 2025-10-10T00:01:09.7923674Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.7924476Z  ) 2025-10-10T00:01:09.7925110Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.7925852Z  sys.exit() 2025-10-10T00:01:09.7926453Z  2025-10-10T00:01:09.7926838Z  try: 2025-10-10T00:01:09.7927347Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.7928127Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.7928824Z  ) 2025-10-10T00:01:09.7929232Z  2025-10-10T00:01:09.7929679Z  username = get_potential_pr_author( 2025-10-10T00:01:09.7930267Z  args.github_token, 2025-10-10T00:01:09.7930816Z  args.github_repo, 2025-10-10T00:01:09.7931363Z  args.github_actor, 2025-10-10T00:01:09.7932026Z  args.github_ref_type, 2025-10-10T00:01:09.7932593Z  args.github_branch, 2025-10-10T00:01:09.7933106Z  ) 2025-10-10T00:01:09.7933522Z  2025-10-10T00:01:09.7934045Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.7934705Z  2025-10-10T00:01:09.7935157Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.7935765Z  rollout_state, 2025-10-10T00:01:09.7936337Z  (args.github_issue_owner, username), 2025-10-10T00:01:09.7936933Z  args.github_branch, 2025-10-10T00:01:09.7937507Z  args.eligible_experiments, 2025-10-10T00:01:09.7938101Z  args.opt_out_experiments, 2025-10-10T00:01:09.7938669Z  is_canary, 2025-10-10T00:01:09.7939141Z  ) 2025-10-10T00:01:09.7939550Z  2025-10-10T00:01:09.7939968Z  except Exception as e: 2025-10-10T00:01:09.7940490Z  log.error( 2025-10-10T00:01:09.7941261Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.7942305Z  ) 2025-10-10T00:01:09.7942727Z  2025-10-10T00:01:09.7943296Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.7944000Z  2025-10-10T00:01:09.7944370Z  2025-10-10T00:01:09.7944768Z if __name__ == "__main__": 2025-10-10T00:01:09.7945275Z  main() 2025-10-10T00:01:09.7945691Z  2025-10-10T00:01:09.7946062Z EOF 2025-10-10T00:01:09.7946445Z  2025-10-10T00:01:09.7946855Z cat runner_determinator.py 2025-10-10T00:01:09.9201476Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.9202933Z env: 2025-10-10T00:01:09.9203907Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.9204429Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.9204986Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.9205609Z ISSUE_OWNER: 2025-10-10T00:01:09.9206110Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.9206643Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.9207176Z PR_NUMBER: 2025-10-10T00:01:09.9207679Z ##[endgroup] 2025-10-10T00:01:09.9419244Z # flake8: noqa: G004 2025-10-10T00:01:09.9419615Z 2025-10-10T00:01:09.9420043Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.9420987Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.9422065Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.9422521Z 2025-10-10T00:01:09.9422688Z """ 2025-10-10T00:01:09.9423261Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.9424143Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.9425030Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.9425834Z of which runners should be used to run which job. 2025-10-10T00:01:09.9426223Z 2025-10-10T00:01:09.9426601Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.9427693Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.9428581Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.9429313Z list, defined. 2025-10-10T00:01:09.9429544Z 2025-10-10T00:01:09.9429898Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.9430806Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.9431826Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.9432303Z 2025-10-10T00:01:09.9432676Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.9433530Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.9434256Z experiments which the user could be opted in to. 2025-10-10T00:01:09.9434651Z 2025-10-10T00:01:09.9434847Z The user list has the following rules: 2025-10-10T00:01:09.9435193Z 2025-10-10T00:01:09.9435512Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.9436374Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.9437129Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.9437519Z 2025-10-10T00:01:09.9437695Z Example config: 2025-10-10T00:01:09.9438144Z # A list of experiments that can be opted into. 2025-10-10T00:01:09.9438815Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.9439431Z # Expected syntax is: 2025-10-10T00:01:09.9440067Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.9441026Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.9442349Z 2025-10-10T00:01:09.9442552Z experiments: 2025-10-10T00:01:09.9442972Z lf: 2025-10-10T00:01:09.9443353Z rollout_percent: 25 2025-10-10T00:01:09.9444019Z all_branches: false 2025-10-10T00:01:09.9444472Z default: true 2025-10-10T00:01:09.9444885Z --- 2025-10-10T00:01:09.9445090Z 2025-10-10T00:01:09.9445252Z # Opt-ins: 2025-10-10T00:01:09.9445833Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.9446704Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.9447476Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.9448130Z # Experiments should be from the above list. 2025-10-10T00:01:09.9448511Z 2025-10-10T00:01:09.9448699Z @User1,-lf,split_build 2025-10-10T00:01:09.9449137Z @User2,lf 2025-10-10T00:01:09.9449517Z @User3,split_build 2025-10-10T00:01:09.9449929Z """ 2025-10-10T00:01:09.9450119Z 2025-10-10T00:01:09.9450287Z import json 2025-10-10T00:01:09.9450664Z import logging 2025-10-10T00:01:09.9451038Z import os 2025-10-10T00:01:09.9451412Z import random 2025-10-10T00:01:09.9452032Z import re 2025-10-10T00:01:09.9452417Z import sys 2025-10-10T00:01:09.9452826Z from argparse import ArgumentParser 2025-10-10T00:01:09.9453354Z from collections.abc import Iterable 2025-10-10T00:01:09.9453873Z from functools import cache 2025-10-10T00:01:09.9454344Z from logging import LogRecord 2025-10-10T00:01:09.9454828Z from typing import Any, NamedTuple 2025-10-10T00:01:09.9455352Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.9455717Z 2025-10-10T00:01:09.9455882Z import yaml 2025-10-10T00:01:09.9456270Z from github import Auth, Github 2025-10-10T00:01:09.9456753Z from github.Issue import Issue 2025-10-10T00:01:09.9457050Z 2025-10-10T00:01:09.9457057Z 2025-10-10T00:01:09.9457275Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.9457948Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.9458823Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.9459375Z 2025-10-10T00:01:09.9459602Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.9460304Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.9460819Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.9461379Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.9462021Z 2025-10-10T00:01:09.9462236Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.9462574Z 2025-10-10T00:01:09.9462761Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.9463224Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.9463505Z 2025-10-10T00:01:09.9463511Z 2025-10-10T00:01:09.9463693Z class Experiment(NamedTuple): 2025-10-10T00:01:09.9464186Z rollout_perc: float = ( 2025-10-10T00:01:09.9464819Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.9465497Z ) 2025-10-10T00:01:09.9465867Z all_branches: bool = ( 2025-10-10T00:01:09.9466481Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.9467150Z ) 2025-10-10T00:01:09.9467511Z default: bool = ( 2025-10-10T00:01:09.9468079Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.9468708Z ) 2025-10-10T00:01:09.9468907Z 2025-10-10T00:01:09.9469086Z # Add more fields as needed 2025-10-10T00:01:09.9469387Z 2025-10-10T00:01:09.9469394Z 2025-10-10T00:01:09.9469587Z class Settings(NamedTuple): 2025-10-10T00:01:09.9470028Z """ 2025-10-10T00:01:09.9470479Z Settings for the experiments that can be opted into. 2025-10-10T00:01:09.9471046Z """ 2025-10-10T00:01:09.9471240Z 2025-10-10T00:01:09.9471455Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.9472009Z 2025-10-10T00:01:09.9472017Z 2025-10-10T00:01:09.9472236Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.9472857Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.9473287Z 2025-10-10T00:01:09.9473455Z COLORS = { 2025-10-10T00:01:09.9473854Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.9474515Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.9475107Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.9475624Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.9476107Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.9476574Z } 2025-10-10T00:01:09.9476764Z 2025-10-10T00:01:09.9476981Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.9477730Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.9478508Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.9479087Z return super().format(record) 2025-10-10T00:01:09.9479415Z 2025-10-10T00:01:09.9479422Z 2025-10-10T00:01:09.9479623Z handler = logging.StreamHandler() 2025-10-10T00:01:09.9480314Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.9480868Z 2025-10-10T00:01:09.9481113Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.9481884Z log.addHandler(handler) 2025-10-10T00:01:09.9482347Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.9482630Z 2025-10-10T00:01:09.9482637Z 2025-10-10T00:01:09.9482883Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.9483440Z """ 2025-10-10T00:01:09.9483941Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.9484557Z """ 2025-10-10T00:01:09.9484922Z if not GITHUB_OUTPUT: 2025-10-10T00:01:09.9485983Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.9487096Z log.warning( 2025-10-10T00:01:09.9487943Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.9488876Z ) 2025-10-10T00:01:09.9498719Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.9499324Z return 2025-10-10T00:01:09.9499575Z 2025-10-10T00:01:09.9499959Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.9500554Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.9501131Z f.write(f"{key}={value}\n") 2025-10-10T00:01:09.9501464Z 2025-10-10T00:01:09.9501472Z 2025-10-10T00:01:09.9502002Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.9502646Z return frozenset( 2025-10-10T00:01:09.9503255Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.9503923Z ) 2025-10-10T00:01:09.9504124Z 2025-10-10T00:01:09.9504131Z 2025-10-10T00:01:09.9504311Z def parse_args() -> Any: 2025-10-10T00:01:09.9504866Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.9505718Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.9506480Z parser.add_argument( 2025-10-10T00:01:09.9506934Z "--github-issue-repo", 2025-10-10T00:01:09.9507405Z type=str, 2025-10-10T00:01:09.9507805Z required=False, 2025-10-10T00:01:09.9508256Z default="pytorch/test-infra", 2025-10-10T00:01:09.9508791Z help="GitHub repo to get the issue", 2025-10-10T00:01:09.9509300Z ) 2025-10-10T00:01:09.9509676Z parser.add_argument( 2025-10-10T00:01:09.9510135Z "--github-repo", 2025-10-10T00:01:09.9510560Z type=str, 2025-10-10T00:01:09.9561902Z required=True, 2025-10-10T00:01:09.9562935Z help="GitHub repo where CI is running", 2025-10-10T00:01:09.9564081Z ) 2025-10-10T00:01:09.9564874Z parser.add_argument( 2025-10-10T00:01:09.9566018Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.9567328Z ) 2025-10-10T00:01:09.9568073Z parser.add_argument( 2025-10-10T00:01:09.9569332Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.9570721Z ) 2025-10-10T00:01:09.9571450Z parser.add_argument( 2025-10-10T00:01:09.9573362Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.9574720Z ) 2025-10-10T00:01:09.9575447Z parser.add_argument( 2025-10-10T00:01:09.9576668Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.9578031Z ) 2025-10-10T00:01:09.9578688Z parser.add_argument( 2025-10-10T00:01:09.9579520Z "--github-ref-type", 2025-10-10T00:01:09.9580398Z type=str, 2025-10-10T00:01:09.9581196Z required=True, 2025-10-10T00:01:09.9582604Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.9583651Z ) 2025-10-10T00:01:09.9584298Z parser.add_argument( 2025-10-10T00:01:09.9584881Z "--eligible-experiments", 2025-10-10T00:01:09.9585413Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.9585923Z required=False, 2025-10-10T00:01:09.9586346Z default="", 2025-10-10T00:01:09.9587194Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.9588120Z ) 2025-10-10T00:01:09.9588482Z parser.add_argument( 2025-10-10T00:01:09.9588973Z "--opt-out-experiments", 2025-10-10T00:01:09.9589478Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.9589989Z required=False, 2025-10-10T00:01:09.9590408Z default="", 2025-10-10T00:01:09.9590794Z help=( 2025-10-10T00:01:09.9591459Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.9592852Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.9593681Z ), 2025-10-10T00:01:09.9594029Z ) 2025-10-10T00:01:09.9594396Z parser.add_argument( 2025-10-10T00:01:09.9594826Z "--pr-number", 2025-10-10T00:01:09.9595239Z type=str, 2025-10-10T00:01:09.9595636Z required=False, 2025-10-10T00:01:09.9596055Z default="", 2025-10-10T00:01:09.9596684Z help="the optional PR number where this is run", 2025-10-10T00:01:09.9597254Z ) 2025-10-10T00:01:09.9597452Z 2025-10-10T00:01:09.9597674Z return parser.parse_args() 2025-10-10T00:01:09.9597977Z 2025-10-10T00:01:09.9597983Z 2025-10-10T00:01:09.9598378Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.9599126Z auth = Auth.Token(github_token) 2025-10-10T00:01:09.9599635Z return Github(auth=auth) 2025-10-10T00:01:09.9599933Z 2025-10-10T00:01:09.9599939Z 2025-10-10T00:01:09.9600389Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.9601178Z repo = gh.get_repo(repo) 2025-10-10T00:01:09.9601860Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.9602246Z 2025-10-10T00:01:09.9602253Z 2025-10-10T00:01:09.9602443Z def get_potential_pr_author( 2025-10-10T00:01:09.9603090Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.9603759Z ) -> str: 2025-10-10T00:01:09.9604275Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.9605052Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.9605777Z # embedded in the tag name: ciflow// 2025-10-10T00:01:09.9606181Z 2025-10-10T00:01:09.9606370Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.9606700Z 2025-10-10T00:01:09.9606960Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.9607568Z split_tag = ref_name.split("/") 2025-10-10T00:01:09.9608093Z if ( 2025-10-10T00:01:09.9608482Z len(split_tag) == 3 2025-10-10T00:01:09.9608960Z and split_tag[0] == "ciflow" 2025-10-10T00:01:09.9609481Z and split_tag[2].isnumeric() 2025-10-10T00:01:09.9609967Z ): 2025-10-10T00:01:09.9610356Z pr_number = split_tag[2] 2025-10-10T00:01:09.9610977Z try: 2025-10-10T00:01:09.9611406Z repository = gh.get_repo(repo) 2025-10-10T00:01:09.9612212Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.9612808Z except Exception as e: 2025-10-10T00:01:09.9613322Z raise Exception( # noqa: TRY002 2025-10-10T00:01:09.9613974Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.9614634Z ) from e 2025-10-10T00:01:09.9615196Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.9615892Z # In all other cases, return the original input username 2025-10-10T00:01:09.9616595Z return username 2025-10-10T00:01:09.9616898Z 2025-10-10T00:01:09.9616904Z 2025-10-10T00:01:09.9617193Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.9617725Z """ 2025-10-10T00:01:09.9618355Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.9619136Z """ 2025-10-10T00:01:09.9619669Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.9620194Z 2025-10-10T00:01:09.9620201Z 2025-10-10T00:01:09.9620391Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.9620888Z try: 2025-10-10T00:01:09.9621294Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.9622023Z return data 2025-10-10T00:01:09.9622434Z except yaml.YAMLError: 2025-10-10T00:01:09.9622924Z log.exception("Error loading YAML") 2025-10-10T00:01:09.9623438Z raise 2025-10-10T00:01:09.9623664Z 2025-10-10T00:01:09.9623671Z 2025-10-10T00:01:09.9624088Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.9624827Z """ 2025-10-10T00:01:09.9625441Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.9626035Z 2025-10-10T00:01:09.9626535Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.9627290Z and the text below is the list of opted in users. 2025-10-10T00:01:09.9627698Z 2025-10-10T00:01:09.9628064Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.9628780Z """ 2025-10-10T00:01:09.9629248Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.9629844Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.9630441Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.9631023Z else: 2025-10-10T00:01:09.9631395Z return "", rollout_state 2025-10-10T00:01:09.9632288Z 2025-10-10T00:01:09.9632296Z 2025-10-10T00:01:09.9632514Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.9633017Z """ 2025-10-10T00:01:09.9633549Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.9634188Z """ 2025-10-10T00:01:09.9634395Z 2025-10-10T00:01:09.9634402Z 2025-10-10T00:01:09.9634737Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.9635377Z """ 2025-10-10T00:01:09.9636072Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.9636771Z 2025-10-10T00:01:09.9637386Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.9638384Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.9639063Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.9639538Z 2025-10-10T00:01:09.9639546Z 2025-10-10T00:01:09.9639707Z """ 2025-10-10T00:01:09.9640067Z optins = UserOptins() 2025-10-10T00:01:09.9640554Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.9641095Z user = user.strip("\r\n\t -") 2025-10-10T00:01:09.9641821Z if not user or not user.startswith("@"): 2025-10-10T00:01:09.9642605Z # Not a valid user. Skip 2025-10-10T00:01:09.9643095Z continue 2025-10-10T00:01:09.9643336Z 2025-10-10T00:01:09.9643502Z if user: 2025-10-10T00:01:09.9643937Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.9644649Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.9645175Z 2025-10-10T00:01:09.9645336Z return optins 2025-10-10T00:01:09.9645579Z 2025-10-10T00:01:09.9645585Z 2025-10-10T00:01:09.9645870Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.9646455Z """ 2025-10-10T00:01:09.9646850Z Check if the experiment name is valid. 2025-10-10T00:01:09.9647368Z A valid name: 2025-10-10T00:01:09.9647990Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.9648920Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.9649637Z - Cannot contain spaces 2025-10-10T00:01:09.9650099Z """ 2025-10-10T00:01:09.9650296Z 2025-10-10T00:01:09.9650555Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.9651245Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.9651941Z 2025-10-10T00:01:09.9652126Z if valid: 2025-10-10T00:01:09.9652529Z return True 2025-10-10T00:01:09.9652772Z 2025-10-10T00:01:09.9652937Z log.error( 2025-10-10T00:01:09.9654389Z 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-10-10T00:01:09.9655930Z ) 2025-10-10T00:01:09.9656282Z return False 2025-10-10T00:01:09.9656513Z 2025-10-10T00:01:09.9656520Z 2025-10-10T00:01:09.9656829Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.9657454Z """ 2025-10-10T00:01:09.9658176Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.9658911Z """ 2025-10-10T00:01:09.9659254Z try: 2025-10-10T00:01:09.9659628Z if settings_text: 2025-10-10T00:01:09.9660361Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.9661165Z # for easy reading 2025-10-10T00:01:09.9662300Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.9663223Z # the backtick character in shell commands. 2025-10-10T00:01:09.9663869Z backtick = chr(96) # backtick character 2025-10-10T00:01:09.9664535Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.9665363Z settings = load_yaml(settings_text) 2025-10-10T00:01:09.9665747Z 2025-10-10T00:01:09.9666172Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.9666943Z experiments = {} 2025-10-10T00:01:09.9667239Z 2025-10-10T00:01:09.9667623Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.9668369Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.9669466Z # 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-10-10T00:01:09.9670495Z continue 2025-10-10T00:01:09.9670781Z 2025-10-10T00:01:09.9670957Z valid_settings = {} 2025-10-10T00:01:09.9671472Z for setting in exp_settings: 2025-10-10T00:01:09.9672164Z if setting not in Experiment._fields: 2025-10-10T00:01:09.9672722Z log.warning( 2025-10-10T00:01:09.9673416Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.9674309Z ) 2025-10-10T00:01:09.9674728Z else: 2025-10-10T00:01:09.9675240Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.9675667Z 2025-10-10T00:01:09.9675944Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.9676587Z return Settings(experiments) 2025-10-10T00:01:09.9676940Z 2025-10-10T00:01:09.9677117Z except Exception: 2025-10-10T00:01:09.9677585Z log.exception("Failed to parse settings") 2025-10-10T00:01:09.9677976Z 2025-10-10T00:01:09.9678141Z return Settings() 2025-10-10T00:01:09.9678394Z 2025-10-10T00:01:09.9678401Z 2025-10-10T00:01:09.9678645Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.9679212Z """ 2025-10-10T00:01:09.9679640Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.9680037Z 2025-10-10T00:01:09.9680379Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.9681148Z and the text below is the list of opted in users. 2025-10-10T00:01:09.9681549Z 2025-10-10T00:01:09.9682113Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.9682860Z """ 2025-10-10T00:01:09.9683408Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.9684166Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.9684558Z 2025-10-10T00:01:09.9684565Z 2025-10-10T00:01:09.9684808Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.9685358Z """ 2025-10-10T00:01:09.9685755Z Parse users from the rollout state. 2025-10-10T00:01:09.9686102Z 2025-10-10T00:01:09.9686261Z """ 2025-10-10T00:01:09.9686787Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.9687515Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.9687921Z 2025-10-10T00:01:09.9687928Z 2025-10-10T00:01:09.9688456Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.9689212Z """ 2025-10-10T00:01:09.9689621Z Check if a user is opted into an experiment 2025-10-10T00:01:09.9690160Z """ 2025-10-10T00:01:09.9690608Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.9691032Z 2025-10-10T00:01:09.9691039Z 2025-10-10T00:01:09.9691452Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.9692351Z """ 2025-10-10T00:01:09.9692801Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.9693382Z """ 2025-10-10T00:01:09.9693878Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.9694572Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.9695210Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.9695817Z return False 2025-10-10T00:01:09.9696067Z 2025-10-10T00:01:09.9696346Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.9696940Z log.warning( 2025-10-10T00:01:09.9697747Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.9698616Z ) 2025-10-10T00:01:09.9698831Z 2025-10-10T00:01:09.9698995Z return True 2025-10-10T00:01:09.9699226Z 2025-10-10T00:01:09.9699233Z 2025-10-10T00:01:09.9699408Z def get_runner_prefix( 2025-10-10T00:01:09.9699846Z rollout_state: str, 2025-10-10T00:01:09.9700307Z workflow_requestors: Iterable[str], 2025-10-10T00:01:09.9700816Z branch: str, 2025-10-10T00:01:09.9701298Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.9702069Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.9702655Z is_canary: bool = False, 2025-10-10T00:01:09.9703103Z ) -> str: 2025-10-10T00:01:09.9703660Z settings = parse_settings(rollout_state) 2025-10-10T00:01:09.9704245Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.9704615Z 2025-10-10T00:01:09.9704784Z fleet_prefix = "" 2025-10-10T00:01:09.9705205Z prefixes = [] 2025-10-10T00:01:09.9705836Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.9706769Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.9707464Z log.info( 2025-10-10T00:01:09.9708140Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.9708883Z ) 2025-10-10T00:01:09.9709264Z continue 2025-10-10T00:01:09.9709514Z 2025-10-10T00:01:09.9709697Z if opt_out_experiments: 2025-10-10T00:01:09.9710228Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.9710871Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.9711453Z log.info( 2025-10-10T00:01:09.9712482Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.9713453Z ) 2025-10-10T00:01:09.9713852Z continue 2025-10-10T00:01:09.9714118Z 2025-10-10T00:01:09.9714303Z if eligible_experiments: 2025-10-10T00:01:09.9714886Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.9715523Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.9716073Z log.info( 2025-10-10T00:01:09.9716849Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.9717680Z ) 2025-10-10T00:01:09.9718078Z continue 2025-10-10T00:01:09.9718546Z elif not experiment_settings.default: 2025-10-10T00:01:09.9719079Z log.info( 2025-10-10T00:01:09.9719852Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.9720597Z ) 2025-10-10T00:01:09.9720974Z continue 2025-10-10T00:01:09.9721221Z 2025-10-10T00:01:09.9721495Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.9722275Z opted_out_users = [ 2025-10-10T00:01:09.9722731Z requestor 2025-10-10T00:01:09.9723203Z for requestor in workflow_requestors 2025-10-10T00:01:09.9723874Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.9724516Z ] 2025-10-10T00:01:09.9724722Z 2025-10-10T00:01:09.9724901Z if opted_out_users: 2025-10-10T00:01:09.9725347Z log.info( 2025-10-10T00:01:09.9725969Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.9726662Z ) 2025-10-10T00:01:09.9727043Z continue 2025-10-10T00:01:09.9727294Z 2025-10-10T00:01:09.9727569Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.9728170Z opted_in_users = [ 2025-10-10T00:01:09.9728603Z requestor 2025-10-10T00:01:09.9729086Z for requestor in workflow_requestors 2025-10-10T00:01:09.9729748Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.9730364Z ] 2025-10-10T00:01:09.9730568Z 2025-10-10T00:01:09.9730743Z enabled = False 2025-10-10T00:01:09.9731178Z if opted_in_users: 2025-10-10T00:01:09.9731737Z log.info( 2025-10-10T00:01:09.9732340Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.9733023Z ) 2025-10-10T00:01:09.9733409Z enabled = True 2025-10-10T00:01:09.9733690Z 2025-10-10T00:01:09.9733903Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.9734743Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.9735817Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.9736465Z log.info( 2025-10-10T00:01:09.9737331Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.9738257Z ) 2025-10-10T00:01:09.9738661Z enabled = True 2025-10-10T00:01:09.9738964Z 2025-10-10T00:01:09.9739128Z if enabled: 2025-10-10T00:01:09.9739551Z label = experiment_name 2025-10-10T00:01:09.9740098Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.9740924Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.9741909Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.9742683Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.9743349Z if is_canary: 2025-10-10T00:01:09.9743840Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.9744396Z fleet_prefix = label 2025-10-10T00:01:09.9744884Z else: 2025-10-10T00:01:09.9745315Z prefixes.append(label) 2025-10-10T00:01:09.9745662Z 2025-10-10T00:01:09.9745842Z if len(prefixes) > 1: 2025-10-10T00:01:09.9746285Z log.error( 2025-10-10T00:01:09.9747306Z 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-10-10T00:01:09.9748419Z ) 2025-10-10T00:01:09.9748804Z prefixes = prefixes[:1] 2025-10-10T00:01:09.9749116Z 2025-10-10T00:01:09.9749303Z # Fleet always comes first 2025-10-10T00:01:09.9749773Z if fleet_prefix: 2025-10-10T00:01:09.9750214Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.9750574Z 2025-10-10T00:01:09.9750956Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.9751377Z 2025-10-10T00:01:09.9751384Z 2025-10-10T00:01:09.9751924Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.9752708Z """ 2025-10-10T00:01:09.9753282Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.9753845Z 2025-10-10T00:01:09.9754224Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.9754937Z """ 2025-10-10T00:01:09.9755318Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.9755866Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.9756490Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.9756938Z 2025-10-10T00:01:09.9756944Z 2025-10-10T00:01:09.9757334Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.9758100Z for _ in range(num_retries): 2025-10-10T00:01:09.9758575Z try: 2025-10-10T00:01:09.9759001Z req = Request(url=url, headers=headers) 2025-10-10T00:01:09.9759658Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.9760299Z return json.loads(content) 2025-10-10T00:01:09.9760818Z except Exception as e: 2025-10-10T00:01:09.9761353Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.9761893Z 2025-10-10T00:01:09.9762271Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.9763197Z return {} 2025-10-10T00:01:09.9763428Z 2025-10-10T00:01:09.9763436Z 2025-10-10T00:01:09.9763596Z @cache 2025-10-10T00:01:09.9764204Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.9764958Z """ 2025-10-10T00:01:09.9765344Z Dynamically get PR information 2025-10-10T00:01:09.9765984Z """ 2025-10-10T00:01:09.9766480Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.9767107Z headers = { 2025-10-10T00:01:09.9767559Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.9768157Z "Authorization": f"token {github_token}", 2025-10-10T00:01:09.9768689Z } 2025-10-10T00:01:09.9769111Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.9769724Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.9770265Z headers=headers, 2025-10-10T00:01:09.9770689Z ) 2025-10-10T00:01:09.9770883Z 2025-10-10T00:01:09.9771061Z if not json_response: 2025-10-10T00:01:09.9771772Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.9772387Z return {} 2025-10-10T00:01:09.9772626Z 2025-10-10T00:01:09.9772801Z return json_response 2025-10-10T00:01:09.9773075Z 2025-10-10T00:01:09.9773082Z 2025-10-10T00:01:09.9773482Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.9774205Z """ 2025-10-10T00:01:09.9774721Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.9775357Z """ 2025-10-10T00:01:09.9775845Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.9776453Z return { 2025-10-10T00:01:09.9777031Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.9777732Z } 2025-10-10T00:01:09.9777933Z 2025-10-10T00:01:09.9777939Z 2025-10-10T00:01:09.9778108Z def main() -> None: 2025-10-10T00:01:09.9778529Z args = parse_args() 2025-10-10T00:01:09.9778792Z 2025-10-10T00:01:09.9779011Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.9779400Z 2025-10-10T00:01:09.9779591Z # Check if the PR is opt-out 2025-10-10T00:01:09.9780071Z if args.pr_number: 2025-10-10T00:01:09.9780718Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.9781592Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.9782207Z log.info( 2025-10-10T00:01:09.9782892Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.9783649Z ) 2025-10-10T00:01:09.9784206Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.9784862Z sys.exit() 2025-10-10T00:01:09.9785129Z 2025-10-10T00:01:09.9785288Z try: 2025-10-10T00:01:09.9785713Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.9786421Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.9787053Z ) 2025-10-10T00:01:09.9787257Z 2025-10-10T00:01:09.9787459Z username = get_potential_pr_author( 2025-10-10T00:01:09.9787998Z args.github_token, 2025-10-10T00:01:09.9788469Z args.github_repo, 2025-10-10T00:01:09.9788946Z args.github_actor, 2025-10-10T00:01:09.9789427Z args.github_ref_type, 2025-10-10T00:01:09.9789924Z args.github_branch, 2025-10-10T00:01:09.9790366Z ) 2025-10-10T00:01:09.9790576Z 2025-10-10T00:01:09.9790854Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.9791296Z 2025-10-10T00:01:09.9791517Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.9792160Z rollout_state, 2025-10-10T00:01:09.9792644Z (args.github_issue_owner, username), 2025-10-10T00:01:09.9793179Z args.github_branch, 2025-10-10T00:01:09.9793665Z args.eligible_experiments, 2025-10-10T00:01:09.9794193Z args.opt_out_experiments, 2025-10-10T00:01:09.9794697Z is_canary, 2025-10-10T00:01:09.9795096Z ) 2025-10-10T00:01:09.9795305Z 2025-10-10T00:01:09.9795486Z except Exception as e: 2025-10-10T00:01:09.9795934Z log.error( 2025-10-10T00:01:09.9796587Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.9797479Z ) 2025-10-10T00:01:09.9797681Z 2025-10-10T00:01:09.9798006Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.9798506Z 2025-10-10T00:01:09.9798513Z 2025-10-10T00:01:09.9798690Z if __name__ == "__main__": 2025-10-10T00:01:09.9799116Z main() 2025-10-10T00:01:09.9799330Z 2025-10-10T00:01:09.9891218Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.9892326Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.9925276Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.9925738Z env: 2025-10-10T00:01:09.9926358Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.9926793Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.9927233Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.9927728Z ISSUE_OWNER: 2025-10-10T00:01:09.9928116Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.9928541Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.9928962Z PR_NUMBER: 2025-10-10T00:01:09.9929373Z ##[endgroup] 2025-10-10T00:01:12.2760944Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:13.2341253Z Collecting urllib3==1.26.18 2025-10-10T00:01:13.2678908Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:13.2890904Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-10-10T00:01:13.3095324Z Collecting PyGithub==2.3.0 2025-10-10T00:01:13.3126276Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:13.3574985Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:13.3605192Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:13.3650683Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:13.3668017Z 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-10-10T00:01:13.3682266Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:13.3995210Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:13.4038686Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:13.4271115Z 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-10-10T00:01:13.5583012Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.5620759Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:13.7017738Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:13.7049758Z 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-10-10T00:01:13.7242545Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.7279770Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:13.7511016Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:13.7572469Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 33.3 MB/s eta 0:00:00 2025-10-10T00:01:13.7644144Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:13.7707851Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 74.7 MB/s eta 0:00:00 2025-10-10T00:01:13.7741101Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:13.7880057Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 115.0 MB/s eta 0:00:00 2025-10-10T00:01:13.7910855Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:13.8020299Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:13.8074747Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 59.1 MB/s eta 0:00:00 2025-10-10T00:01:13.8113862Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:13.8155085Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.1 MB/s eta 0:00:00 2025-10-10T00:01:13.8231442Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:13.8287464Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 27.8 MB/s eta 0:00:00 2025-10-10T00:01:14.1795330Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:14.7192482Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:14.8151242Z ##[group]Run curr_branch="main" 2025-10-10T00:01:14.8151557Z curr_branch="main" 2025-10-10T00:01:14.8151993Z curr_ref_type="branch" 2025-10-10T00:01:14.8152253Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:14.8152529Z  2025-10-10T00:01:14.8152721Z python3 runner_determinator.py \ 2025-10-10T00:01:14.8153005Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:14.8153278Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:14.8153526Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:14.8153786Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:14.8154084Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:14.8154354Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:14.8154638Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:14.8154934Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:14.8155290Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:14.8155581Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:14.8189146Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:14.8189375Z env: 2025-10-10T00:01:14.8189889Z GITHUB_TOKEN: *** 2025-10-10T00:01:14.8190083Z ISSUE_NUMBER: 5132 2025-10-10T00:01:14.8190294Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:14.8190521Z ISSUE_OWNER: 2025-10-10T00:01:14.8190701Z CHECK_EXPERIMENTS: 2025-10-10T00:01:14.8190889Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:14.8191076Z PR_NUMBER: 2025-10-10T00:01:14.8191244Z ##[endgroup] 2025-10-10T00:01:14.8242234Z Current branch is 'main' 2025-10-10T00:01:16.6516734Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:16.6517822Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:16.6518687Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:16.6519344Z INFO : Setting output: label-type='' 2025-10-10T00:01:16.6847606Z Evaluate and set job outputs 2025-10-10T00:01:16.6854507Z Cleaning up orphan processes