2025-03-14T03:57:09.1296229Z Current runner version: '2.322.0' 2025-03-14T03:57:09.1320801Z ##[group]Operating System 2025-03-14T03:57:09.1321826Z Ubuntu 2025-03-14T03:57:09.1322399Z 24.04.2 2025-03-14T03:57:09.1322922Z LTS 2025-03-14T03:57:09.1323402Z ##[endgroup] 2025-03-14T03:57:09.1323937Z ##[group]Runner Image 2025-03-14T03:57:09.1324541Z Image: ubuntu-24.04 2025-03-14T03:57:09.1325066Z Version: 20250309.1.0 2025-03-14T03:57:09.1326169Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:57:09.1327542Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:57:09.1328430Z ##[endgroup] 2025-03-14T03:57:09.1329013Z ##[group]Runner Image Provisioner 2025-03-14T03:57:09.1329810Z 2.0.422.1 2025-03-14T03:57:09.1330326Z ##[endgroup] 2025-03-14T03:57:09.1331466Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:57:09.1333423Z Contents: read 2025-03-14T03:57:09.1334067Z Metadata: read 2025-03-14T03:57:09.1334818Z ##[endgroup] 2025-03-14T03:57:09.1337829Z Secret source: Actions 2025-03-14T03:57:09.1338569Z Prepare workflow directory 2025-03-14T03:57:09.1815607Z Prepare all required actions 2025-03-14T03:57:09.1869904Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:57:09.1875049Z ##[group] Inputs 2025-03-14T03:57:09.1875673Z check_experiments: 2025-03-14T03:57:09.1876380Z triggering_actor: pytorchmergebot 2025-03-14T03:57:09.1876994Z issue_owner: 2025-03-14T03:57:09.1877512Z curr_branch: main 2025-03-14T03:57:09.1878134Z curr_ref_type: branch 2025-03-14T03:57:09.1878697Z issue_number: 5132 2025-03-14T03:57:09.1879221Z ##[endgroup] 2025-03-14T03:57:09.1880144Z Complete job name: before-test / get-label-type / runner-determinator 2025-03-14T03:57:09.7514557Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:57:09.7516261Z cat < runner_determinator.py 2025-03-14T03:57:09.7516879Z # flake8: noqa: G004 2025-03-14T03:57:09.7517395Z  2025-03-14T03:57:09.7518123Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:57:09.7519158Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:57:09.7520369Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:57:09.7521040Z  2025-03-14T03:57:09.7521435Z """ 2025-03-14T03:57:09.7522116Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:57:09.7523123Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:57:09.7524244Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:57:09.7525239Z of which runners should be used to run which job. 2025-03-14T03:57:09.7525923Z  2025-03-14T03:57:09.7526622Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:57:09.7527656Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:57:09.7528891Z settings are considered to be empty with only the second part, the user 2025-03-14T03:57:09.7529838Z list, defined. 2025-03-14T03:57:09.7530303Z  2025-03-14T03:57:09.7530985Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:57:09.7532066Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:57:09.7533038Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:57:09.7533717Z  2025-03-14T03:57:09.7534366Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:57:09.7535357Z The user list is also a comma separated list of additional features or 2025-03-14T03:57:09.7536437Z experiments which the user could be opted in to. 2025-03-14T03:57:09.7537076Z  2025-03-14T03:57:09.7537556Z The user list has the following rules: 2025-03-14T03:57:09.7538142Z  2025-03-14T03:57:09.7538765Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:57:09.7539860Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:57:09.7540748Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:57:09.7541381Z  2025-03-14T03:57:09.7541895Z Example config: 2025-03-14T03:57:09.7542475Z  # A list of experiments that can be opted into. 2025-03-14T03:57:09.7543259Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:57:09.7543993Z  # Expected syntax is: 2025-03-14T03:57:09.7544753Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:57:09.7545861Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:57:09.7546702Z  2025-03-14T03:57:09.7547118Z  experiments: 2025-03-14T03:57:09.7547590Z  lf: 2025-03-14T03:57:09.7548056Z  rollout_percent: 25 2025-03-14T03:57:09.7548642Z  all_branches: false 2025-03-14T03:57:09.7549191Z  default: true 2025-03-14T03:57:09.7549791Z  --- 2025-03-14T03:57:09.7550217Z  2025-03-14T03:57:09.7550620Z  # Opt-ins: 2025-03-14T03:57:09.7551316Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:57:09.7552473Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:57:09.7553377Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:57:09.7554149Z  # Experiments should be from the above list. 2025-03-14T03:57:09.7554761Z  2025-03-14T03:57:09.7555174Z  @User1,-lf,split_build 2025-03-14T03:57:09.7555715Z  @User2,lf 2025-03-14T03:57:09.7556195Z  @User3,split_build 2025-03-14T03:57:09.7556717Z """ 2025-03-14T03:57:09.7557126Z  2025-03-14T03:57:09.7557539Z import json 2025-03-14T03:57:09.7558004Z import logging 2025-03-14T03:57:09.7558477Z import os 2025-03-14T03:57:09.7558936Z import random 2025-03-14T03:57:09.7559412Z import re 2025-03-14T03:57:09.7560011Z import sys 2025-03-14T03:57:09.7560527Z from argparse import ArgumentParser 2025-03-14T03:57:09.7561174Z from collections.abc import Iterable 2025-03-14T03:57:09.7561794Z from functools import cache 2025-03-14T03:57:09.7562370Z from logging import LogRecord 2025-03-14T03:57:09.7562967Z from typing import Any, NamedTuple 2025-03-14T03:57:09.7563634Z from urllib.request import Request, urlopen 2025-03-14T03:57:09.7564250Z  2025-03-14T03:57:09.7564667Z import yaml 2025-03-14T03:57:09.7565174Z from github import Auth, Github 2025-03-14T03:57:09.7565771Z from github.Issue import Issue 2025-03-14T03:57:09.7566314Z  2025-03-14T03:57:09.7566715Z  2025-03-14T03:57:09.7567208Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:57:09.7568022Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:57:09.7569008Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:57:09.7569909Z  2025-03-14T03:57:09.7570444Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:57:09.7571115Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:57:09.7571743Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:57:09.7572571Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:57:09.7573163Z  2025-03-14T03:57:09.7573636Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:57:09.7574208Z  2025-03-14T03:57:09.7574634Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:57:09.7575197Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:57:09.7575718Z  2025-03-14T03:57:09.7576112Z  2025-03-14T03:57:09.7576543Z class Experiment(NamedTuple): 2025-03-14T03:57:09.7577121Z  rollout_perc: float = ( 2025-03-14T03:57:09.7577918Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:57:09.7578700Z  ) 2025-03-14T03:57:09.7579139Z  all_branches: bool = ( 2025-03-14T03:57:09.7580002Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:57:09.7580835Z  ) 2025-03-14T03:57:09.7581285Z  default: bool = ( 2025-03-14T03:57:09.7581994Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:57:09.7582723Z  ) 2025-03-14T03:57:09.7583141Z  2025-03-14T03:57:09.7583572Z  # Add more fields as needed 2025-03-14T03:57:09.7584124Z  2025-03-14T03:57:09.7584520Z  2025-03-14T03:57:09.7584954Z class Settings(NamedTuple): 2025-03-14T03:57:09.7585493Z  """ 2025-03-14T03:57:09.7586056Z  Settings for the experiments that can be opted into. 2025-03-14T03:57:09.7586771Z  """ 2025-03-14T03:57:09.7587214Z  2025-03-14T03:57:09.7587678Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:57:09.7588266Z  2025-03-14T03:57:09.7588818Z  2025-03-14T03:57:09.7589308Z class ColorFormatter(logging.Formatter): 2025-03-14T03:57:09.7590618Z  """Color codes the log messages based on the log level""" 2025-03-14T03:57:09.7591360Z  2025-03-14T03:57:09.7591769Z  COLORS = { 2025-03-14T03:57:09.7592276Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:57:09.7592870Z  "ERROR": "\033[31m", # Red 2025-03-14T03:57:09.7593451Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:57:09.7594040Z  "INFO": "\033[0m", # Reset 2025-03-14T03:57:09.7594636Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:57:09.7595180Z  } 2025-03-14T03:57:09.7595605Z  2025-03-14T03:57:09.7596088Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:57:09.7596967Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:57:09.7597852Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:57:09.7598517Z  return super().format(record) 2025-03-14T03:57:09.7599078Z  2025-03-14T03:57:09.7599582Z  2025-03-14T03:57:09.7600042Z handler = logging.StreamHandler() 2025-03-14T03:57:09.7600883Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:57:09.7601689Z  2025-03-14T03:57:09.7602211Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:57:09.7602900Z log.addHandler(handler) 2025-03-14T03:57:09.7603444Z log.setLevel(logging.INFO) 2025-03-14T03:57:09.7603976Z  2025-03-14T03:57:09.7604410Z  2025-03-14T03:57:09.7604985Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:57:09.7605690Z  """ 2025-03-14T03:57:09.7606323Z  Defines outputs of the github action that invokes this script 2025-03-14T03:57:09.7607054Z  """ 2025-03-14T03:57:09.7607512Z  if not GITHUB_OUTPUT: 2025-03-14T03:57:09.7608732Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:57:09.7610237Z  log.warning( 2025-03-14T03:57:09.7611230Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:57:09.7612252Z  ) 2025-03-14T03:57:09.7612780Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:57:09.7613406Z  return 2025-03-14T03:57:09.7613880Z  2025-03-14T03:57:09.7614335Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:57:09.7615005Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:57:09.7615681Z  f.write(f"{key}={value}\n") 2025-03-14T03:57:09.7616245Z  2025-03-14T03:57:09.7616658Z  2025-03-14T03:57:09.7617241Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:57:09.7617988Z  return frozenset( 2025-03-14T03:57:09.7618733Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:57:09.7619593Z  ) 2025-03-14T03:57:09.7620026Z  2025-03-14T03:57:09.7620418Z  2025-03-14T03:57:09.7620848Z def parse_args() -> Any: 2025-03-14T03:57:09.7621536Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:57:09.7622530Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:57:09.7623398Z  parser.add_argument( 2025-03-14T03:57:09.7623967Z  "--github-issue-repo", 2025-03-14T03:57:09.7624554Z  type=str, 2025-03-14T03:57:09.7625070Z  required=False, 2025-03-14T03:57:09.7625766Z  default="pytorch/test-infra", 2025-03-14T03:57:09.7626422Z  help="GitHub repo to get the issue", 2025-03-14T03:57:09.7627013Z  ) 2025-03-14T03:57:09.7627464Z  parser.add_argument( 2025-03-14T03:57:09.7628008Z  "--github-repo", 2025-03-14T03:57:09.7628542Z  type=str, 2025-03-14T03:57:09.7629050Z  required=True, 2025-03-14T03:57:09.7629727Z  help="GitHub repo where CI is running", 2025-03-14T03:57:09.7630326Z  ) 2025-03-14T03:57:09.7630848Z  parser.add_argument( 2025-03-14T03:57:09.7631611Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:57:09.7632366Z  ) 2025-03-14T03:57:09.7632808Z  parser.add_argument( 2025-03-14T03:57:09.7633575Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:57:09.7634355Z  ) 2025-03-14T03:57:09.7634799Z  parser.add_argument( 2025-03-14T03:57:09.7635575Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:57:09.7636367Z  ) 2025-03-14T03:57:09.7636823Z  parser.add_argument( 2025-03-14T03:57:09.7637616Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:57:09.7638426Z  ) 2025-03-14T03:57:09.7638869Z  parser.add_argument( 2025-03-14T03:57:09.7639562Z  "--github-ref-type", 2025-03-14T03:57:09.7640120Z  type=str, 2025-03-14T03:57:09.7640630Z  required=True, 2025-03-14T03:57:09.7641238Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:57:09.7641865Z  ) 2025-03-14T03:57:09.7642311Z  parser.add_argument( 2025-03-14T03:57:09.7642880Z  "--eligible-experiments", 2025-03-14T03:57:09.7643508Z  type=_str_comma_separated_to_set, 2025-03-14T03:57:09.7644115Z  required=False, 2025-03-14T03:57:09.7644638Z  default="", 2025-03-14T03:57:09.7645772Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:57:09.7646809Z  ) 2025-03-14T03:57:09.7647268Z  parser.add_argument( 2025-03-14T03:57:09.7647810Z  "--pr-number", 2025-03-14T03:57:09.7648364Z  type=str, 2025-03-14T03:57:09.7648863Z  required=False, 2025-03-14T03:57:09.7649389Z  default="", 2025-03-14T03:57:09.7650091Z  help="the optional PR number where this is run", 2025-03-14T03:57:09.7650736Z  ) 2025-03-14T03:57:09.7651158Z  2025-03-14T03:57:09.7651595Z  return parser.parse_args() 2025-03-14T03:57:09.7652156Z  2025-03-14T03:57:09.7652560Z  2025-03-14T03:57:09.7653278Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:57:09.7654174Z  auth = Auth.Token(github_token) 2025-03-14T03:57:09.7654792Z  return Github(auth=auth) 2025-03-14T03:57:09.7655339Z  2025-03-14T03:57:09.7655742Z  2025-03-14T03:57:09.7656499Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:57:09.7657416Z  repo = gh.get_repo(repo) 2025-03-14T03:57:09.7658028Z  return repo.get_issue(number=issue_num) 2025-03-14T03:57:09.7658632Z  2025-03-14T03:57:09.7659032Z  2025-03-14T03:57:09.7659565Z def get_potential_pr_author( 2025-03-14T03:57:09.7660346Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:57:09.7661141Z ) -> str: 2025-03-14T03:57:09.7661901Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:57:09.7662851Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:57:09.7663728Z  # embedded in the tag name: ciflow// 2025-03-14T03:57:09.7664384Z  2025-03-14T03:57:09.7664845Z  gh = get_gh_client(github_token) 2025-03-14T03:57:09.7665434Z  2025-03-14T03:57:09.7665979Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:57:09.7666710Z  split_tag = ref_name.split("/") 2025-03-14T03:57:09.7667296Z  if ( 2025-03-14T03:57:09.7667782Z  len(split_tag) == 3 2025-03-14T03:57:09.7668370Z  and split_tag[0] == "ciflow" 2025-03-14T03:57:09.7668990Z  and split_tag[2].isnumeric() 2025-03-14T03:57:09.7669665Z  ): 2025-03-14T03:57:09.7670161Z  pr_number = split_tag[2] 2025-03-14T03:57:09.7670735Z  try: 2025-03-14T03:57:09.7671269Z  repository = gh.get_repo(repo) 2025-03-14T03:57:09.7671995Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:57:09.7672704Z  except Exception as e: 2025-03-14T03:57:09.7673331Z  raise Exception( # noqa: TRY002 2025-03-14T03:57:09.7674100Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:57:09.7674833Z  ) from e 2025-03-14T03:57:09.7675495Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:57:09.7676308Z  # In all other cases, return the original input username 2025-03-14T03:57:09.7676988Z  return username 2025-03-14T03:57:09.7677481Z  2025-03-14T03:57:09.7677871Z  2025-03-14T03:57:09.7678370Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:57:09.7678992Z  """ 2025-03-14T03:57:09.7679853Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:57:09.7680854Z  """ 2025-03-14T03:57:09.7681484Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:57:09.7682241Z  2025-03-14T03:57:09.7682633Z  2025-03-14T03:57:09.7683076Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:57:09.7683652Z  try: 2025-03-14T03:57:09.7684126Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:57:09.7684716Z  return data 2025-03-14T03:57:09.7685231Z  except yaml.YAMLError: 2025-03-14T03:57:09.7685829Z  log.exception("Error loading YAML") 2025-03-14T03:57:09.7686424Z  raise 2025-03-14T03:57:09.7686878Z  2025-03-14T03:57:09.7687267Z  2025-03-14T03:57:09.7687982Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:57:09.7688830Z  """ 2025-03-14T03:57:09.7689697Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:57:09.7690566Z  2025-03-14T03:57:09.7691184Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:57:09.7692062Z  and the text below is the list of opted in users. 2025-03-14T03:57:09.7692703Z  2025-03-14T03:57:09.7693360Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:57:09.7694160Z  """ 2025-03-14T03:57:09.7694694Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:57:09.7695384Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:57:09.7696233Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:57:09.7696934Z  else: 2025-03-14T03:57:09.7697401Z  return "", rollout_state 2025-03-14T03:57:09.7697948Z  2025-03-14T03:57:09.7698337Z  2025-03-14T03:57:09.7698803Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:57:09.7699390Z  """ 2025-03-14T03:57:09.7700121Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:57:09.7700857Z  """ 2025-03-14T03:57:09.7701271Z  2025-03-14T03:57:09.7701666Z  2025-03-14T03:57:09.7702280Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:57:09.7703028Z  """ 2025-03-14T03:57:09.7703875Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:57:09.7704815Z  2025-03-14T03:57:09.7705728Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:57:09.7706856Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:57:09.7707649Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:57:09.7708368Z  2025-03-14T03:57:09.7708760Z  2025-03-14T03:57:09.7709161Z  """ 2025-03-14T03:57:09.7709704Z  optins = UserOptins() 2025-03-14T03:57:09.7710311Z  for user in user_optin_text.split("\n"): 2025-03-14T03:57:09.7710955Z  user = user.strip("\r\n\t -") 2025-03-14T03:57:09.7711608Z  if not user or not user.startswith("@"): 2025-03-14T03:57:09.7712248Z  # Not a valid user. Skip 2025-03-14T03:57:09.7712826Z  continue 2025-03-14T03:57:09.7713311Z  2025-03-14T03:57:09.7713722Z  if user: 2025-03-14T03:57:09.7714278Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:57:09.7715079Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:57:09.7715810Z  2025-03-14T03:57:09.7716429Z  return optins 2025-03-14T03:57:09.7716915Z  2025-03-14T03:57:09.7717310Z  2025-03-14T03:57:09.7717885Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:57:09.7718587Z  """ 2025-03-14T03:57:09.7719080Z  Check if the experiment name is valid. 2025-03-14T03:57:09.7719820Z  A valid name: 2025-03-14T03:57:09.7720601Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:57:09.7721660Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:57:09.7722468Z  - Cannot contain spaces 2025-03-14T03:57:09.7723016Z  """ 2025-03-14T03:57:09.7723443Z  2025-03-14T03:57:09.7723982Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:57:09.7724798Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:57:09.7725490Z  2025-03-14T03:57:09.7725887Z  if valid: 2025-03-14T03:57:09.7726369Z  return True 2025-03-14T03:57:09.7726851Z  2025-03-14T03:57:09.7727258Z  log.error( 2025-03-14T03:57:09.7728880Z  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-03-14T03:57:09.7730673Z  ) 2025-03-14T03:57:09.7731096Z  return False 2025-03-14T03:57:09.7731570Z  2025-03-14T03:57:09.7731953Z  2025-03-14T03:57:09.7732671Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:57:09.7733400Z  """ 2025-03-14T03:57:09.7734098Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:57:09.7734912Z  """ 2025-03-14T03:57:09.7735345Z  try: 2025-03-14T03:57:09.7735793Z  if settings_text: 2025-03-14T03:57:09.7736654Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:57:09.7737544Z  # for easy reading 2025-03-14T03:57:09.7738462Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:57:09.7739573Z  # the backtick character in shell commands. 2025-03-14T03:57:09.7740279Z  backtick = chr(96) # backtick character 2025-03-14T03:57:09.7741050Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:57:09.7741820Z  settings = load_yaml(settings_text) 2025-03-14T03:57:09.7742406Z  2025-03-14T03:57:09.7743081Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:57:09.7743929Z  experiments = {} 2025-03-14T03:57:09.7744459Z  2025-03-14T03:57:09.7745100Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:57:09.7745965Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:57:09.7747205Z  # 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-03-14T03:57:09.7748381Z  continue 2025-03-14T03:57:09.7748906Z  2025-03-14T03:57:09.7749348Z  valid_settings = {} 2025-03-14T03:57:09.7750073Z  for setting in exp_settings: 2025-03-14T03:57:09.7750726Z  if setting not in Experiment._fields: 2025-03-14T03:57:09.7751387Z  log.warning( 2025-03-14T03:57:09.7752338Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:57:09.7753139Z  ) 2025-03-14T03:57:09.7753664Z  else: 2025-03-14T03:57:09.7754281Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:57:09.7754933Z  2025-03-14T03:57:09.7755481Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:57:09.7756208Z  return Settings(experiments) 2025-03-14T03:57:09.7756780Z  2025-03-14T03:57:09.7757200Z  except Exception: 2025-03-14T03:57:09.7757787Z  log.exception("Failed to parse settings") 2025-03-14T03:57:09.7758406Z  2025-03-14T03:57:09.7758815Z  return Settings() 2025-03-14T03:57:09.7759315Z  2025-03-14T03:57:09.7759857Z  2025-03-14T03:57:09.7760412Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:57:09.7761068Z  """ 2025-03-14T03:57:09.7761595Z  Parse settings, if any, from the rollout state. 2025-03-14T03:57:09.7762223Z  2025-03-14T03:57:09.7762840Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:57:09.7763711Z  and the text below is the list of opted in users. 2025-03-14T03:57:09.7764353Z  2025-03-14T03:57:09.7765036Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:57:09.7765843Z  """ 2025-03-14T03:57:09.7766506Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:57:09.7767589Z  return parse_settings_from_text(settings_text) 2025-03-14T03:57:09.7768230Z  2025-03-14T03:57:09.7768616Z  2025-03-14T03:57:09.7769131Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:57:09.7769894Z  """ 2025-03-14T03:57:09.7770370Z  Parse users from the rollout state. 2025-03-14T03:57:09.7770947Z  2025-03-14T03:57:09.7771341Z  """ 2025-03-14T03:57:09.7771977Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:57:09.7772821Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:57:09.7773446Z  2025-03-14T03:57:09.7773836Z  2025-03-14T03:57:09.7774551Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:57:09.7775395Z  """ 2025-03-14T03:57:09.7775902Z  Check if a user is opted into an experiment 2025-03-14T03:57:09.7776522Z  """ 2025-03-14T03:57:09.7777074Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:57:09.7777730Z  2025-03-14T03:57:09.7778125Z  2025-03-14T03:57:09.7778832Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:57:09.7779793Z  """ 2025-03-14T03:57:09.7780353Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:57:09.7781016Z  """ 2025-03-14T03:57:09.7781632Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:57:09.7782425Z  experiment_optout = "-" + experiment_name 2025-03-14T03:57:09.7783160Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:57:09.7783848Z  return False 2025-03-14T03:57:09.7784331Z  2025-03-14T03:57:09.7784870Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:57:09.7785552Z  log.warning( 2025-03-14T03:57:09.7786484Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:57:09.7787572Z  ) 2025-03-14T03:57:09.7788001Z  2025-03-14T03:57:09.7788403Z  return True 2025-03-14T03:57:09.7788872Z  2025-03-14T03:57:09.7789264Z  2025-03-14T03:57:09.7789781Z def get_runner_prefix( 2025-03-14T03:57:09.7790317Z  rollout_state: str, 2025-03-14T03:57:09.7790877Z  workflow_requestors: Iterable[str], 2025-03-14T03:57:09.7791468Z  branch: str, 2025-03-14T03:57:09.7792079Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:57:09.7792764Z  is_canary: bool = False, 2025-03-14T03:57:09.7793300Z ) -> str: 2025-03-14T03:57:09.7793817Z  settings = parse_settings(rollout_state) 2025-03-14T03:57:09.7794488Z  user_optins = parse_users(rollout_state) 2025-03-14T03:57:09.7795074Z  2025-03-14T03:57:09.7795488Z  fleet_prefix = "" 2025-03-14T03:57:09.7796009Z  prefixes = [] 2025-03-14T03:57:09.7796755Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:57:09.7797811Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:57:09.7798614Z  log.info( 2025-03-14T03:57:09.7799406Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:57:09.7800359Z  ) 2025-03-14T03:57:09.7800824Z  continue 2025-03-14T03:57:09.7801310Z  2025-03-14T03:57:09.7801759Z  if eligible_experiments: 2025-03-14T03:57:09.7802572Z  if experiment_name not in eligible_experiments: 2025-03-14T03:57:09.7803314Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:57:09.7803962Z  log.info( 2025-03-14T03:57:09.7804881Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:57:09.7805810Z  ) 2025-03-14T03:57:09.7806314Z  continue 2025-03-14T03:57:09.7806904Z  elif not experiment_settings.default: 2025-03-14T03:57:09.7807516Z  log.info( 2025-03-14T03:57:09.7808298Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:57:09.7809174Z  ) 2025-03-14T03:57:09.7809741Z  continue 2025-03-14T03:57:09.7810230Z  2025-03-14T03:57:09.7810774Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:57:09.7811486Z  opted_out_users = [ 2025-03-14T03:57:09.7812042Z  requestor 2025-03-14T03:57:09.7812613Z  for requestor in workflow_requestors 2025-03-14T03:57:09.7813394Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:57:09.7814119Z  ] 2025-03-14T03:57:09.7814546Z  2025-03-14T03:57:09.7814970Z  if opted_out_users: 2025-03-14T03:57:09.7815512Z  log.info( 2025-03-14T03:57:09.7816257Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:57:09.7817035Z  ) 2025-03-14T03:57:09.7817503Z  continue 2025-03-14T03:57:09.7817986Z  2025-03-14T03:57:09.7818521Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:57:09.7819217Z  opted_in_users = [ 2025-03-14T03:57:09.7819862Z  requestor 2025-03-14T03:57:09.7820431Z  for requestor in workflow_requestors 2025-03-14T03:57:09.7821192Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:57:09.7822028Z  ] 2025-03-14T03:57:09.7822465Z  2025-03-14T03:57:09.7822882Z  enabled = False 2025-03-14T03:57:09.7823413Z  if opted_in_users: 2025-03-14T03:57:09.7823942Z  log.info( 2025-03-14T03:57:09.7824666Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:57:09.7825438Z  ) 2025-03-14T03:57:09.7825927Z  enabled = True 2025-03-14T03:57:09.7826452Z  2025-03-14T03:57:09.7826921Z  elif experiment_settings.rollout_perc: 2025-03-14T03:57:09.7827899Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:57:09.7828954Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:57:09.7829789Z  log.info( 2025-03-14T03:57:09.7830803Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:57:09.7831828Z  ) 2025-03-14T03:57:09.7832332Z  enabled = True 2025-03-14T03:57:09.7832865Z  2025-03-14T03:57:09.7833280Z  if enabled: 2025-03-14T03:57:09.7833813Z  label = experiment_name 2025-03-14T03:57:09.7834475Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:57:09.7835412Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:57:09.7836538Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:57:09.7837412Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:57:09.7838164Z  if is_canary: 2025-03-14T03:57:09.7838762Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:57:09.7839398Z  fleet_prefix = label 2025-03-14T03:57:09.7840077Z  else: 2025-03-14T03:57:09.7840639Z  prefixes.append(label) 2025-03-14T03:57:09.7841219Z  2025-03-14T03:57:09.7841645Z  if len(prefixes) > 1: 2025-03-14T03:57:09.7842181Z  log.error( 2025-03-14T03:57:09.7843370Z  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-03-14T03:57:09.7844607Z  ) 2025-03-14T03:57:09.7845075Z  prefixes = prefixes[:1] 2025-03-14T03:57:09.7845630Z  2025-03-14T03:57:09.7846059Z  # Fleet always comes first 2025-03-14T03:57:09.7846625Z  if fleet_prefix: 2025-03-14T03:57:09.7847175Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:57:09.7847755Z  2025-03-14T03:57:09.7848305Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:57:09.7848966Z  2025-03-14T03:57:09.7849368Z  2025-03-14T03:57:09.7850195Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:57:09.7851060Z  """ 2025-03-14T03:57:09.7851744Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:57:09.7852550Z  2025-03-14T03:57:09.7853211Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:57:09.7854006Z  """ 2025-03-14T03:57:09.7854486Z  gh = get_gh_client(github_token) 2025-03-14T03:57:09.7855136Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:57:09.7855887Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:57:09.7856700Z  2025-03-14T03:57:09.7857098Z  2025-03-14T03:57:09.7857783Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:57:09.7858641Z  for _ in range(num_retries): 2025-03-14T03:57:09.7859194Z  try: 2025-03-14T03:57:09.7859816Z  req = Request(url=url, headers=headers) 2025-03-14T03:57:09.7860577Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:57:09.7861325Z  return json.loads(content) 2025-03-14T03:57:09.7861935Z  except Exception as e: 2025-03-14T03:57:09.7862583Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:57:09.7863212Z  2025-03-14T03:57:09.7863871Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:57:09.7864679Z  return {} 2025-03-14T03:57:09.7865146Z  2025-03-14T03:57:09.7865542Z  2025-03-14T03:57:09.7865933Z @cache 2025-03-14T03:57:09.7866662Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:57:09.7867501Z  """ 2025-03-14T03:57:09.7867982Z  Dynamically get PR information 2025-03-14T03:57:09.7936044Z  """ 2025-03-14T03:57:09.7936730Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:57:09.7937556Z  headers = { 2025-03-14T03:57:09.7938175Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:57:09.7938856Z  "Authorization": f"token {github_token}", 2025-03-14T03:57:09.7939563Z  } 2025-03-14T03:57:09.7940286Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:57:09.7941014Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:57:09.7941615Z  headers=headers, 2025-03-14T03:57:09.7942112Z  ) 2025-03-14T03:57:09.7942511Z  2025-03-14T03:57:09.7942916Z  if not json_response: 2025-03-14T03:57:09.7943583Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:57:09.7944258Z  return {} 2025-03-14T03:57:09.7944710Z  2025-03-14T03:57:09.7945112Z  return json_response 2025-03-14T03:57:09.7945614Z  2025-03-14T03:57:09.7945990Z  2025-03-14T03:57:09.7946645Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:57:09.7947414Z  """ 2025-03-14T03:57:09.7948022Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:57:09.7948765Z  """ 2025-03-14T03:57:09.7949333Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:57:09.7950104Z  return { 2025-03-14T03:57:09.7950818Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:57:09.7951555Z  } 2025-03-14T03:57:09.7951960Z  2025-03-14T03:57:09.7952352Z  2025-03-14T03:57:09.7952749Z def main() -> None: 2025-03-14T03:57:09.7953240Z  args = parse_args() 2025-03-14T03:57:09.7953727Z  2025-03-14T03:57:09.7954252Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:57:09.7954835Z  2025-03-14T03:57:09.7955257Z  # Check if the PR is opt-out 2025-03-14T03:57:09.7955813Z  if args.pr_number: 2025-03-14T03:57:09.7956557Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:57:09.7957375Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:57:09.7957937Z  log.info( 2025-03-14T03:57:09.7958717Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:57:09.7959772Z  ) 2025-03-14T03:57:09.7960433Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:57:09.7961168Z  sys.exit() 2025-03-14T03:57:09.7961654Z  2025-03-14T03:57:09.7962044Z  try: 2025-03-14T03:57:09.7962560Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:57:09.7963354Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:57:09.7964040Z  ) 2025-03-14T03:57:09.7964466Z  2025-03-14T03:57:09.7964919Z  username = get_potential_pr_author( 2025-03-14T03:57:09.7965526Z  args.github_token, 2025-03-14T03:57:09.7966124Z  args.github_repo, 2025-03-14T03:57:09.7966677Z  args.github_actor, 2025-03-14T03:57:09.7967243Z  args.github_ref_type, 2025-03-14T03:57:09.7967818Z  args.github_branch, 2025-03-14T03:57:09.7968364Z  ) 2025-03-14T03:57:09.7968785Z  2025-03-14T03:57:09.7969332Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:57:09.7970493Z  2025-03-14T03:57:09.7970976Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:57:09.7971594Z  rollout_state, 2025-03-14T03:57:09.7972171Z  (args.github_issue_owner, username), 2025-03-14T03:57:09.7972777Z  args.github_branch, 2025-03-14T03:57:09.7973358Z  args.eligible_experiments, 2025-03-14T03:57:09.7973931Z  is_canary, 2025-03-14T03:57:09.7974559Z  ) 2025-03-14T03:57:09.7974993Z  2025-03-14T03:57:09.7975408Z  except Exception as e: 2025-03-14T03:57:09.7975935Z  log.error( 2025-03-14T03:57:09.7976719Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:57:09.7977530Z  ) 2025-03-14T03:57:09.7977948Z  2025-03-14T03:57:09.7978532Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:57:09.7979247Z  2025-03-14T03:57:09.7979735Z  2025-03-14T03:57:09.7980145Z if __name__ == "__main__": 2025-03-14T03:57:09.7980669Z  main() 2025-03-14T03:57:09.7981090Z  2025-03-14T03:57:09.7981467Z EOF 2025-03-14T03:57:09.7981867Z  2025-03-14T03:57:09.7982297Z cat runner_determinator.py 2025-03-14T03:57:09.8401934Z shell: /usr/bin/bash -e {0} 2025-03-14T03:57:09.8402754Z env: 2025-03-14T03:57:09.8403505Z GITHUB_TOKEN: *** 2025-03-14T03:57:09.8403946Z ISSUE_NUMBER: 5132 2025-03-14T03:57:09.8404424Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:57:09.8404954Z ISSUE_OWNER: 2025-03-14T03:57:09.8405384Z CHECK_EXPERIMENTS: 2025-03-14T03:57:09.8405827Z PR_NUMBER: 2025-03-14T03:57:09.8406227Z ##[endgroup] 2025-03-14T03:57:09.8623528Z # flake8: noqa: G004 2025-03-14T03:57:09.8623878Z 2025-03-14T03:57:09.8624315Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:57:09.8625291Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:57:09.8626099Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:57:09.8626553Z 2025-03-14T03:57:09.8626718Z """ 2025-03-14T03:57:09.8627316Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:57:09.8628241Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:57:09.8629188Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:57:09.8630306Z of which runners should be used to run which job. 2025-03-14T03:57:09.8630715Z 2025-03-14T03:57:09.8631341Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:57:09.8632255Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:57:09.8633139Z settings are considered to be empty with only the second part, the user 2025-03-14T03:57:09.8633847Z list, defined. 2025-03-14T03:57:09.8634086Z 2025-03-14T03:57:09.8634452Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:57:09.8635402Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:57:09.8636243Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:57:09.8636689Z 2025-03-14T03:57:09.8637064Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:57:09.8637936Z The user list is also a comma separated list of additional features or 2025-03-14T03:57:09.8638678Z experiments which the user could be opted in to. 2025-03-14T03:57:09.8639094Z 2025-03-14T03:57:09.8639307Z The user list has the following rules: 2025-03-14T03:57:09.8640239Z 2025-03-14T03:57:09.8640567Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:57:09.8641463Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:57:09.8642243Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:57:09.8642655Z 2025-03-14T03:57:09.8642839Z Example config: 2025-03-14T03:57:09.8643304Z # A list of experiments that can be opted into. 2025-03-14T03:57:09.8643991Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:57:09.8644641Z # Expected syntax is: 2025-03-14T03:57:09.8645302Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:57:09.8646449Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:57:09.8647109Z 2025-03-14T03:57:09.8647288Z experiments: 2025-03-14T03:57:09.8647699Z lf: 2025-03-14T03:57:09.8648099Z rollout_percent: 25 2025-03-14T03:57:09.8648587Z all_branches: false 2025-03-14T03:57:09.8649049Z default: true 2025-03-14T03:57:09.8649656Z --- 2025-03-14T03:57:09.8649898Z 2025-03-14T03:57:09.8650070Z # Opt-ins: 2025-03-14T03:57:09.8650675Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:57:09.8651561Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:57:09.8652363Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:57:09.8653029Z # Experiments should be from the above list. 2025-03-14T03:57:09.8653426Z 2025-03-14T03:57:09.8653617Z @User1,-lf,split_build 2025-03-14T03:57:09.8654071Z @User2,lf 2025-03-14T03:57:09.8654482Z @User3,split_build 2025-03-14T03:57:09.8654910Z """ 2025-03-14T03:57:09.8655113Z 2025-03-14T03:57:09.8655286Z import json 2025-03-14T03:57:09.8655676Z import logging 2025-03-14T03:57:09.8656085Z import os 2025-03-14T03:57:09.8656474Z import random 2025-03-14T03:57:09.8656858Z import re 2025-03-14T03:57:09.8657227Z import sys 2025-03-14T03:57:09.8657644Z from argparse import ArgumentParser 2025-03-14T03:57:09.8658216Z from collections.abc import Iterable 2025-03-14T03:57:09.8658755Z from functools import cache 2025-03-14T03:57:09.8659256Z from logging import LogRecord 2025-03-14T03:57:09.8660093Z from typing import Any, NamedTuple 2025-03-14T03:57:09.8660674Z from urllib.request import Request, urlopen 2025-03-14T03:57:09.8661050Z 2025-03-14T03:57:09.8661230Z import yaml 2025-03-14T03:57:09.8661660Z from github import Auth, Github 2025-03-14T03:57:09.8662175Z from github.Issue import Issue 2025-03-14T03:57:09.8662497Z 2025-03-14T03:57:09.8662503Z 2025-03-14T03:57:09.8662736Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:57:09.8663445Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:57:09.8664318Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:57:09.8665058Z 2025-03-14T03:57:09.8665316Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:57:09.8665918Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:57:09.8666446Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:57:09.8667028Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:57:09.8667410Z 2025-03-14T03:57:09.8667618Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:57:09.8667967Z 2025-03-14T03:57:09.8668172Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:57:09.8668665Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:57:09.8668960Z 2025-03-14T03:57:09.8668967Z 2025-03-14T03:57:09.8669166Z class Experiment(NamedTuple): 2025-03-14T03:57:09.8669849Z rollout_perc: float = ( 2025-03-14T03:57:09.8670522Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:57:09.8671221Z ) 2025-03-14T03:57:09.8671621Z all_branches: bool = ( 2025-03-14T03:57:09.8672267Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:57:09.8672971Z ) 2025-03-14T03:57:09.8673347Z default: bool = ( 2025-03-14T03:57:09.8673949Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:57:09.8674624Z ) 2025-03-14T03:57:09.8674831Z 2025-03-14T03:57:09.8675025Z # Add more fields as needed 2025-03-14T03:57:09.8675351Z 2025-03-14T03:57:09.8675357Z 2025-03-14T03:57:09.8675561Z class Settings(NamedTuple): 2025-03-14T03:57:09.8676030Z """ 2025-03-14T03:57:09.8676509Z Settings for the experiments that can be opted into. 2025-03-14T03:57:09.8677110Z """ 2025-03-14T03:57:09.8677317Z 2025-03-14T03:57:09.8677543Z experiments: dict[str, Experiment] = {} 2025-03-14T03:57:09.8677922Z 2025-03-14T03:57:09.8677928Z 2025-03-14T03:57:09.8678273Z class ColorFormatter(logging.Formatter): 2025-03-14T03:57:09.8678938Z """Color codes the log messages based on the log level""" 2025-03-14T03:57:09.8679385Z 2025-03-14T03:57:09.8679719Z COLORS = { 2025-03-14T03:57:09.8680163Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:57:09.8680700Z "ERROR": "\033[31m", # Red 2025-03-14T03:57:09.8681217Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:57:09.8681749Z "INFO": "\033[0m", # Reset 2025-03-14T03:57:09.8682263Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:57:09.8682766Z } 2025-03-14T03:57:09.8682971Z 2025-03-14T03:57:09.8683239Z def format(self, record: LogRecord) -> str: 2025-03-14T03:57:09.8684019Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:57:09.8684816Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:57:09.8685430Z return super().format(record) 2025-03-14T03:57:09.8685797Z 2025-03-14T03:57:09.8685803Z 2025-03-14T03:57:09.8686019Z handler = logging.StreamHandler() 2025-03-14T03:57:09.8686762Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:57:09.8687335Z 2025-03-14T03:57:09.8687610Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:57:09.8688215Z log.addHandler(handler) 2025-03-14T03:57:09.8688682Z log.setLevel(logging.INFO) 2025-03-14T03:57:09.8688990Z 2025-03-14T03:57:09.8688996Z 2025-03-14T03:57:09.8689263Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:57:09.8690066Z """ 2025-03-14T03:57:09.8690610Z Defines outputs of the github action that invokes this script 2025-03-14T03:57:09.8691261Z """ 2025-03-14T03:57:09.8691647Z if not GITHUB_OUTPUT: 2025-03-14T03:57:09.8692755Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:57:09.8693901Z log.warning( 2025-03-14T03:57:09.8694784Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:57:09.8695739Z ) 2025-03-14T03:57:09.8705398Z print(f"::set-output name={key}::{value}") 2025-03-14T03:57:09.8706250Z return 2025-03-14T03:57:09.8706491Z 2025-03-14T03:57:09.8706704Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:57:09.8707306Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:57:09.8707901Z f.write(f"{key}={value}\n") 2025-03-14T03:57:09.8708236Z 2025-03-14T03:57:09.8708244Z 2025-03-14T03:57:09.8708558Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:57:09.8709204Z return frozenset( 2025-03-14T03:57:09.8710127Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:57:09.8710836Z ) 2025-03-14T03:57:09.8711044Z 2025-03-14T03:57:09.8711055Z 2025-03-14T03:57:09.8711247Z def parse_args() -> Any: 2025-03-14T03:57:09.8711834Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:57:09.8712754Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:57:09.8713550Z parser.add_argument( 2025-03-14T03:57:09.8714029Z "--github-issue-repo", 2025-03-14T03:57:09.8714503Z type=str, 2025-03-14T03:57:09.8714921Z required=False, 2025-03-14T03:57:09.8715411Z default="pytorch/test-infra", 2025-03-14T03:57:09.8715974Z help="GitHub repo to get the issue", 2025-03-14T03:57:09.8716500Z ) 2025-03-14T03:57:09.8716888Z parser.add_argument( 2025-03-14T03:57:09.8717353Z "--github-repo", 2025-03-14T03:57:09.8717790Z type=str, 2025-03-14T03:57:09.8718199Z required=True, 2025-03-14T03:57:09.8718678Z help="GitHub repo where CI is running", 2025-03-14T03:57:09.8719222Z ) 2025-03-14T03:57:09.8719783Z parser.add_argument( 2025-03-14T03:57:09.8720402Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:57:09.8721226Z ) 2025-03-14T03:57:09.8721625Z parser.add_argument( 2025-03-14T03:57:09.8722270Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:57:09.8723274Z ) 2025-03-14T03:57:09.8723763Z parser.add_argument( 2025-03-14T03:57:09.8724443Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:57:09.8725171Z ) 2025-03-14T03:57:09.8725557Z parser.add_argument( 2025-03-14T03:57:09.8726234Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:57:09.8726970Z ) 2025-03-14T03:57:09.8727359Z parser.add_argument( 2025-03-14T03:57:09.8727821Z "--github-ref-type", 2025-03-14T03:57:09.8728293Z type=str, 2025-03-14T03:57:09.8728715Z required=True, 2025-03-14T03:57:09.8729210Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:57:09.8729995Z ) 2025-03-14T03:57:09.8730380Z parser.add_argument( 2025-03-14T03:57:09.8730865Z "--eligible-experiments", 2025-03-14T03:57:09.8731407Z type=_str_comma_separated_to_set, 2025-03-14T03:57:09.8731950Z required=False, 2025-03-14T03:57:09.8732409Z default="", 2025-03-14T03:57:09.8733273Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:57:09.8734259Z ) 2025-03-14T03:57:09.8734644Z parser.add_argument( 2025-03-14T03:57:09.8735106Z "--pr-number", 2025-03-14T03:57:09.8735552Z type=str, 2025-03-14T03:57:09.8735985Z required=False, 2025-03-14T03:57:09.8736431Z default="", 2025-03-14T03:57:09.8736936Z help="the optional PR number where this is run", 2025-03-14T03:57:09.8737511Z ) 2025-03-14T03:57:09.8737724Z 2025-03-14T03:57:09.8737930Z return parser.parse_args() 2025-03-14T03:57:09.8738253Z 2025-03-14T03:57:09.8738259Z 2025-03-14T03:57:09.8738677Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:57:09.8739646Z auth = Auth.Token(github_token) 2025-03-14T03:57:09.8740220Z return Github(auth=auth) 2025-03-14T03:57:09.8740531Z 2025-03-14T03:57:09.8740695Z 2025-03-14T03:57:09.8741178Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:57:09.8742008Z repo = gh.get_repo(repo) 2025-03-14T03:57:09.8742533Z return repo.get_issue(number=issue_num) 2025-03-14T03:57:09.8742910Z 2025-03-14T03:57:09.8742917Z 2025-03-14T03:57:09.8743115Z def get_potential_pr_author( 2025-03-14T03:57:09.8743784Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:57:09.8744487Z ) -> str: 2025-03-14T03:57:09.8745024Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:57:09.8745859Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:57:09.8746630Z # embedded in the tag name: ciflow// 2025-03-14T03:57:09.8747065Z 2025-03-14T03:57:09.8747268Z gh = get_gh_client(github_token) 2025-03-14T03:57:09.8747613Z 2025-03-14T03:57:09.8747895Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:57:09.8748548Z split_tag = ref_name.split("/") 2025-03-14T03:57:09.8749068Z if ( 2025-03-14T03:57:09.8749642Z len(split_tag) == 3 2025-03-14T03:57:09.8750160Z and split_tag[0] == "ciflow" 2025-03-14T03:57:09.8750712Z and split_tag[2].isnumeric() 2025-03-14T03:57:09.8751232Z ): 2025-03-14T03:57:09.8751637Z pr_number = split_tag[2] 2025-03-14T03:57:09.8752141Z try: 2025-03-14T03:57:09.8752623Z repository = gh.get_repo(repo) 2025-03-14T03:57:09.8753269Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:57:09.8753891Z except Exception as e: 2025-03-14T03:57:09.8754432Z raise Exception( # noqa: TRY002 2025-03-14T03:57:09.8755247Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:57:09.8755936Z ) from e 2025-03-14T03:57:09.8756495Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:57:09.8757222Z # In all other cases, return the original input username 2025-03-14T03:57:09.8757831Z return username 2025-03-14T03:57:09.8758087Z 2025-03-14T03:57:09.8758094Z 2025-03-14T03:57:09.8758324Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:57:09.8758880Z """ 2025-03-14T03:57:09.8759657Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:57:09.8760460Z """ 2025-03-14T03:57:09.8761028Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:57:09.8761561Z 2025-03-14T03:57:09.8761568Z 2025-03-14T03:57:09.8761772Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:57:09.8762289Z try: 2025-03-14T03:57:09.8762704Z data = yaml.safe_load(yaml_text) 2025-03-14T03:57:09.8763239Z return data 2025-03-14T03:57:09.8763677Z except yaml.YAMLError: 2025-03-14T03:57:09.8764177Z log.exception("Error loading YAML") 2025-03-14T03:57:09.8764714Z raise 2025-03-14T03:57:09.8764941Z 2025-03-14T03:57:09.8764948Z 2025-03-14T03:57:09.8765376Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:57:09.8766139Z """ 2025-03-14T03:57:09.8766778Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:57:09.8767392Z 2025-03-14T03:57:09.8767749Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:57:09.8768517Z and the text below is the list of opted in users. 2025-03-14T03:57:09.8768935Z 2025-03-14T03:57:09.8769316Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:57:09.8770144Z """ 2025-03-14T03:57:09.8770604Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:57:09.8771228Z if len(rollout_state_parts) >= 2: 2025-03-14T03:57:09.8771842Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:57:09.8772583Z else: 2025-03-14T03:57:09.8772984Z return "", rollout_state 2025-03-14T03:57:09.8773304Z 2025-03-14T03:57:09.8773316Z 2025-03-14T03:57:09.8773523Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:57:09.8774054Z """ 2025-03-14T03:57:09.8774605Z Dictionary of users with a list of features they have opted into 2025-03-14T03:57:09.8775270Z """ 2025-03-14T03:57:09.8775494Z 2025-03-14T03:57:09.8775500Z 2025-03-14T03:57:09.8775845Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:57:09.8776528Z """ 2025-03-14T03:57:09.8777255Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:57:09.8777960Z 2025-03-14T03:57:09.8778603Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:57:09.8779742Z - Example line: "@User1,lf,split_build" 2025-03-14T03:57:09.8780456Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:57:09.8780962Z 2025-03-14T03:57:09.8780970Z 2025-03-14T03:57:09.8781136Z """ 2025-03-14T03:57:09.8781534Z optins = UserOptins() 2025-03-14T03:57:09.8782045Z for user in user_optin_text.split("\n"): 2025-03-14T03:57:09.8782623Z user = user.strip("\r\n\t -") 2025-03-14T03:57:09.8783217Z if not user or not user.startswith("@"): 2025-03-14T03:57:09.8783798Z # Not a valid user. Skip 2025-03-14T03:57:09.8784312Z continue 2025-03-14T03:57:09.8784568Z 2025-03-14T03:57:09.8784745Z if user: 2025-03-14T03:57:09.8785202Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:57:09.8785923Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:57:09.8786564Z 2025-03-14T03:57:09.8786754Z return optins 2025-03-14T03:57:09.8787015Z 2025-03-14T03:57:09.8787021Z 2025-03-14T03:57:09.8787323Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:57:09.8787963Z """ 2025-03-14T03:57:09.8788384Z Check if the experiment name is valid. 2025-03-14T03:57:09.8788928Z A valid name: 2025-03-14T03:57:09.8789686Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:57:09.8790660Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:57:09.8791398Z - Cannot contain spaces 2025-03-14T03:57:09.8791881Z """ 2025-03-14T03:57:09.8792090Z 2025-03-14T03:57:09.8792369Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:57:09.8793101Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:57:09.8793566Z 2025-03-14T03:57:09.8793740Z if valid: 2025-03-14T03:57:09.8794155Z return True 2025-03-14T03:57:09.8794412Z 2025-03-14T03:57:09.8794589Z log.error( 2025-03-14T03:57:09.8796070Z 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-03-14T03:57:09.8797663Z ) 2025-03-14T03:57:09.8798032Z return False 2025-03-14T03:57:09.8798289Z 2025-03-14T03:57:09.8798296Z 2025-03-14T03:57:09.8798607Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:57:09.8799257Z """ 2025-03-14T03:57:09.8799985Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:57:09.8800732Z """ 2025-03-14T03:57:09.8801116Z try: 2025-03-14T03:57:09.8801512Z if settings_text: 2025-03-14T03:57:09.8802271Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:57:09.8803103Z # for easy reading 2025-03-14T03:57:09.8803917Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:57:09.8804990Z # the backtick character in shell commands. 2025-03-14T03:57:09.8805612Z backtick = chr(96) # backtick character 2025-03-14T03:57:09.8806305Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:57:09.8806996Z settings = load_yaml(settings_text) 2025-03-14T03:57:09.8807378Z 2025-03-14T03:57:09.8807795Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:57:09.8808580Z experiments = {} 2025-03-14T03:57:09.8808880Z 2025-03-14T03:57:09.8809248Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:57:09.8810130Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:57:09.8811271Z # 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-03-14T03:57:09.8812357Z continue 2025-03-14T03:57:09.8812664Z 2025-03-14T03:57:09.8812857Z valid_settings = {} 2025-03-14T03:57:09.8813403Z for setting in exp_settings: 2025-03-14T03:57:09.8813990Z if setting not in Experiment._fields: 2025-03-14T03:57:09.8814565Z log.warning( 2025-03-14T03:57:09.8815292Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:57:09.8816046Z ) 2025-03-14T03:57:09.8816500Z else: 2025-03-14T03:57:09.8817038Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:57:09.8817491Z 2025-03-14T03:57:09.8817787Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:57:09.8818581Z return Settings(experiments) 2025-03-14T03:57:09.8818970Z 2025-03-14T03:57:09.8819157Z except Exception: 2025-03-14T03:57:09.8819768Z log.exception("Failed to parse settings") 2025-03-14T03:57:09.8820181Z 2025-03-14T03:57:09.8820370Z return Settings() 2025-03-14T03:57:09.8820640Z 2025-03-14T03:57:09.8820647Z 2025-03-14T03:57:09.8820913Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:57:09.8821503Z """ 2025-03-14T03:57:09.8821962Z Parse settings, if any, from the rollout state. 2025-03-14T03:57:09.8822384Z 2025-03-14T03:57:09.8822743Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:57:09.8823525Z and the text below is the list of opted in users. 2025-03-14T03:57:09.8823941Z 2025-03-14T03:57:09.8824382Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:57:09.8825152Z """ 2025-03-14T03:57:09.8825732Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:57:09.8826516Z return parse_settings_from_text(settings_text) 2025-03-14T03:57:09.8826935Z 2025-03-14T03:57:09.8826942Z 2025-03-14T03:57:09.8827199Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:57:09.8827790Z """ 2025-03-14T03:57:09.8828206Z Parse users from the rollout state. 2025-03-14T03:57:09.8828573Z 2025-03-14T03:57:09.8828752Z """ 2025-03-14T03:57:09.8829295Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:57:09.8830155Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:57:09.8830570Z 2025-03-14T03:57:09.8830577Z 2025-03-14T03:57:09.8831003Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:57:09.8831778Z """ 2025-03-14T03:57:09.8832212Z Check if a user is opted into an experiment 2025-03-14T03:57:09.8832767Z """ 2025-03-14T03:57:09.8833237Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:57:09.8833673Z 2025-03-14T03:57:09.8833680Z 2025-03-14T03:57:09.8834113Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:57:09.8835095Z """ 2025-03-14T03:57:09.8835581Z Check if a user explicitly opted out of an experiment 2025-03-14T03:57:09.8836189Z """ 2025-03-14T03:57:09.8836715Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:57:09.8837433Z experiment_optout = "-" + experiment_name 2025-03-14T03:57:09.8838100Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:57:09.8838730Z return False 2025-03-14T03:57:09.8838990Z 2025-03-14T03:57:09.8839274Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:57:09.8840006Z log.warning( 2025-03-14T03:57:09.8840836Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:57:09.8841754Z ) 2025-03-14T03:57:09.8841977Z 2025-03-14T03:57:09.8842161Z return True 2025-03-14T03:57:09.8842405Z 2025-03-14T03:57:09.8842411Z 2025-03-14T03:57:09.8842603Z def get_runner_prefix( 2025-03-14T03:57:09.8843065Z rollout_state: str, 2025-03-14T03:57:09.8843545Z workflow_requestors: Iterable[str], 2025-03-14T03:57:09.8844085Z branch: str, 2025-03-14T03:57:09.8844600Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:57:09.8845224Z is_canary: bool = False, 2025-03-14T03:57:09.8845706Z ) -> str: 2025-03-14T03:57:09.8846147Z settings = parse_settings(rollout_state) 2025-03-14T03:57:09.8846753Z user_optins = parse_users(rollout_state) 2025-03-14T03:57:09.8847141Z 2025-03-14T03:57:09.8847329Z fleet_prefix = "" 2025-03-14T03:57:09.8847776Z prefixes = [] 2025-03-14T03:57:09.8848427Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:57:09.8849383Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:57:09.8850347Z log.info( 2025-03-14T03:57:09.8851065Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:57:09.8851862Z ) 2025-03-14T03:57:09.8852262Z continue 2025-03-14T03:57:09.8852521Z 2025-03-14T03:57:09.8852719Z if eligible_experiments: 2025-03-14T03:57:09.8853294Z if experiment_name not in eligible_experiments: 2025-03-14T03:57:09.8853947Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:57:09.8854525Z log.info( 2025-03-14T03:57:09.8855327Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:57:09.8856206Z ) 2025-03-14T03:57:09.8856619Z continue 2025-03-14T03:57:09.8857112Z elif not experiment_settings.default: 2025-03-14T03:57:09.8857672Z log.info( 2025-03-14T03:57:09.8858356Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:57:09.8859118Z ) 2025-03-14T03:57:09.8859608Z continue 2025-03-14T03:57:09.8859871Z 2025-03-14T03:57:09.8860162Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:57:09.8860802Z opted_out_users = [ 2025-03-14T03:57:09.8861275Z requestor 2025-03-14T03:57:09.8861755Z for requestor in workflow_requestors 2025-03-14T03:57:09.8862440Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:57:09.8863101Z ] 2025-03-14T03:57:09.8863322Z 2025-03-14T03:57:09.8863513Z if opted_out_users: 2025-03-14T03:57:09.8863990Z log.info( 2025-03-14T03:57:09.8864633Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:57:09.8865347Z ) 2025-03-14T03:57:09.8865745Z continue 2025-03-14T03:57:09.8866007Z 2025-03-14T03:57:09.8866290Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:57:09.8866930Z opted_in_users = [ 2025-03-14T03:57:09.8867399Z requestor 2025-03-14T03:57:09.8868008Z for requestor in workflow_requestors 2025-03-14T03:57:09.8868690Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:57:09.8869338Z ] 2025-03-14T03:57:09.8869654Z 2025-03-14T03:57:09.8869842Z enabled = False 2025-03-14T03:57:09.8870302Z if opted_in_users: 2025-03-14T03:57:09.8870758Z log.info( 2025-03-14T03:57:09.8871383Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:57:09.8872096Z ) 2025-03-14T03:57:09.8872522Z enabled = True 2025-03-14T03:57:09.8872813Z 2025-03-14T03:57:09.8873049Z elif experiment_settings.rollout_perc: 2025-03-14T03:57:09.8873914Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:57:09.8874876Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:57:09.8875560Z log.info( 2025-03-14T03:57:09.8876468Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:57:09.8877453Z ) 2025-03-14T03:57:09.8877889Z enabled = True 2025-03-14T03:57:09.8878200Z 2025-03-14T03:57:09.8878374Z if enabled: 2025-03-14T03:57:09.8878817Z label = experiment_name 2025-03-14T03:57:09.8879385Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:57:09.8880335Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:57:09.8881237Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:57:09.8882135Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:57:09.8882836Z if is_canary: 2025-03-14T03:57:09.8883381Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:57:09.8883960Z fleet_prefix = label 2025-03-14T03:57:09.8884484Z else: 2025-03-14T03:57:09.8884942Z prefixes.append(label) 2025-03-14T03:57:09.8885319Z 2025-03-14T03:57:09.8885514Z if len(prefixes) > 1: 2025-03-14T03:57:09.8885986Z log.error( 2025-03-14T03:57:09.8887054Z 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-03-14T03:57:09.8888221Z ) 2025-03-14T03:57:09.8888627Z prefixes = prefixes[:1] 2025-03-14T03:57:09.8888950Z 2025-03-14T03:57:09.8889150Z # Fleet always comes first 2025-03-14T03:57:09.8889735Z if fleet_prefix: 2025-03-14T03:57:09.8890216Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:57:09.8890591Z 2025-03-14T03:57:09.8890850Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:57:09.8891271Z 2025-03-14T03:57:09.8891278Z 2025-03-14T03:57:09.8891733Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:57:09.8892545Z """ 2025-03-14T03:57:09.8893141Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:57:09.8893731Z 2025-03-14T03:57:09.8894124Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:57:09.8894859Z """ 2025-03-14T03:57:09.8895265Z gh = get_gh_client(github_token) 2025-03-14T03:57:09.8895837Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:57:09.8896491Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:57:09.8896947Z 2025-03-14T03:57:09.8896953Z 2025-03-14T03:57:09.8897359Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:57:09.8898148Z for _ in range(num_retries): 2025-03-14T03:57:09.8898647Z try: 2025-03-14T03:57:09.8899098Z req = Request(url=url, headers=headers) 2025-03-14T03:57:09.8899888Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:57:09.8900687Z return json.loads(content) 2025-03-14T03:57:09.8901242Z except Exception as e: 2025-03-14T03:57:09.8901807Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:57:09.8902228Z 2025-03-14T03:57:09.8902618Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:57:09.8903353Z return {} 2025-03-14T03:57:09.8903586Z 2025-03-14T03:57:09.8903594Z 2025-03-14T03:57:09.8903767Z @cache 2025-03-14T03:57:09.8904404Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:57:09.8905191Z """ 2025-03-14T03:57:09.8905598Z Dynamically get PR information 2025-03-14T03:57:09.8906111Z """ 2025-03-14T03:57:09.8906633Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:57:09.8907279Z headers = { 2025-03-14T03:57:09.8907764Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:57:09.8908392Z "Authorization": f"token {github_token}", 2025-03-14T03:57:09.8908959Z } 2025-03-14T03:57:09.8909409Z json_response: dict[str, Any] = download_json( 2025-03-14T03:57:09.8910150Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:57:09.8910723Z headers=headers, 2025-03-14T03:57:09.8911174Z ) 2025-03-14T03:57:09.8911386Z 2025-03-14T03:57:09.8911583Z if not json_response: 2025-03-14T03:57:09.8912175Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:57:09.8912810Z return {} 2025-03-14T03:57:09.8913063Z 2025-03-14T03:57:09.8913257Z return json_response 2025-03-14T03:57:09.8913551Z 2025-03-14T03:57:09.8913558Z 2025-03-14T03:57:09.8913961Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:57:09.8914858Z """ 2025-03-14T03:57:09.8915427Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:57:09.8916111Z """ 2025-03-14T03:57:09.8916606Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:57:09.8917247Z return { 2025-03-14T03:57:09.8917848Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:57:09.8918575Z } 2025-03-14T03:57:09.8918783Z 2025-03-14T03:57:09.8918790Z 2025-03-14T03:57:09.8918980Z def main() -> None: 2025-03-14T03:57:09.8919520Z args = parse_args() 2025-03-14T03:57:09.8919817Z 2025-03-14T03:57:09.8920049Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:57:09.8920448Z 2025-03-14T03:57:09.8920648Z # Check if the PR is opt-out 2025-03-14T03:57:09.8921160Z if args.pr_number: 2025-03-14T03:57:09.8921835Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:57:09.8922619Z if OPT_OUT_LABEL in labels: 2025-03-14T03:57:09.8923130Z log.info( 2025-03-14T03:57:09.8923838Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:57:09.8924631Z ) 2025-03-14T03:57:09.8925199Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:57:09.8925900Z sys.exit() 2025-03-14T03:57:09.8926171Z 2025-03-14T03:57:09.8926337Z try: 2025-03-14T03:57:09.8926788Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:57:09.8927519Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:57:09.8928183Z ) 2025-03-14T03:57:09.8928402Z 2025-03-14T03:57:09.8928622Z username = get_potential_pr_author( 2025-03-14T03:57:09.8929189Z args.github_token, 2025-03-14T03:57:09.8929788Z args.github_repo, 2025-03-14T03:57:09.8930296Z args.github_actor, 2025-03-14T03:57:09.8930801Z args.github_ref_type, 2025-03-14T03:57:09.8931329Z args.github_branch, 2025-03-14T03:57:09.8931807Z ) 2025-03-14T03:57:09.8932033Z 2025-03-14T03:57:09.8932321Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:57:09.8932946Z 2025-03-14T03:57:09.8933176Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:57:09.8933758Z rollout_state, 2025-03-14T03:57:09.8934267Z (args.github_issue_owner, username), 2025-03-14T03:57:09.8934839Z args.github_branch, 2025-03-14T03:57:09.8935363Z args.eligible_experiments, 2025-03-14T03:57:09.8935895Z is_canary, 2025-03-14T03:57:09.8936322Z ) 2025-03-14T03:57:09.8936538Z 2025-03-14T03:57:09.8936739Z except Exception as e: 2025-03-14T03:57:09.8937212Z log.error( 2025-03-14T03:57:09.8937910Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:57:09.8938694Z ) 2025-03-14T03:57:09.8938910Z 2025-03-14T03:57:09.8939258Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:57:09.8939875Z 2025-03-14T03:57:09.8939884Z 2025-03-14T03:57:09.8940082Z if __name__ == "__main__": 2025-03-14T03:57:09.8940548Z main() 2025-03-14T03:57:09.8940770Z 2025-03-14T03:57:09.9026523Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:57:09.9027436Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:57:09.9072021Z shell: /usr/bin/bash -e {0} 2025-03-14T03:57:09.9072503Z env: 2025-03-14T03:57:09.9073138Z GITHUB_TOKEN: *** 2025-03-14T03:57:09.9073568Z ISSUE_NUMBER: 5132 2025-03-14T03:57:09.9074036Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:57:09.9074550Z ISSUE_OWNER: 2025-03-14T03:57:09.9074955Z CHECK_EXPERIMENTS: 2025-03-14T03:57:09.9075385Z PR_NUMBER: 2025-03-14T03:57:09.9075778Z ##[endgroup] 2025-03-14T03:57:10.3195031Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:57:10.7115255Z Collecting urllib3==1.26.18 2025-03-14T03:57:10.7452389Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:57:10.7663947Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.7 MB/s eta 0:00:00 2025-03-14T03:57:10.7903330Z Collecting PyGithub==2.3.0 2025-03-14T03:57:10.7935942Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:57:10.8354959Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:57:10.8389301Z 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-03-14T03:57:10.8444102Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-14T03:57:10.8460091Z 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-03-14T03:57:10.8474934Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-14T03:57:10.8732735Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:57:10.8765448Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:57:10.8995502Z 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-03-14T03:57:11.0076427Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:57:11.0109254Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:57:11.1146092Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:57:11.1186147Z 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-03-14T03:57:11.1375735Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:57:11.1406952Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:57:11.1642732Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:57:11.1702825Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 32.0 MB/s eta 0:00:00 2025-03-14T03:57:11.1733975Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:57:11.1805705Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 63.6 MB/s eta 0:00:00 2025-03-14T03:57:11.1844286Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-14T03:57:11.1938424Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 111.3 MB/s eta 0:00:00 2025-03-14T03:57:11.1977364Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:57:11.2039387Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:57:11.2111487Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 88.9 MB/s eta 0:00:00 2025-03-14T03:57:11.2144431Z 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-03-14T03:57:11.2190354Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 25.5 MB/s eta 0:00:00 2025-03-14T03:57:11.2222466Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:57:11.2273856Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 31.7 MB/s eta 0:00:00 2025-03-14T03:57:11.5142396Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:57:12.0448151Z 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-03-14T03:57:12.1188942Z ##[group]Run curr_branch="main" 2025-03-14T03:57:12.1189294Z curr_branch="main" 2025-03-14T03:57:12.1189695Z curr_ref_type="branch" 2025-03-14T03:57:12.1189972Z echo "Current branch is '$curr_branch'" 2025-03-14T03:57:12.1190242Z  2025-03-14T03:57:12.1190443Z python3 runner_determinator.py \ 2025-03-14T03:57:12.1190742Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:57:12.1191025Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:57:12.1191339Z  --github-branch "$curr_branch" \ 2025-03-14T03:57:12.1191615Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:57:12.1191910Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:57:12.1192198Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:57:12.1192498Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:57:12.1192836Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:57:12.1193169Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:57:12.1241053Z shell: /usr/bin/bash -e {0} 2025-03-14T03:57:12.1241289Z env: 2025-03-14T03:57:12.1241839Z GITHUB_TOKEN: *** 2025-03-14T03:57:12.1242043Z ISSUE_NUMBER: 5132 2025-03-14T03:57:12.1242263Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:57:12.1242512Z ISSUE_OWNER: 2025-03-14T03:57:12.1242718Z CHECK_EXPERIMENTS: 2025-03-14T03:57:12.1242924Z PR_NUMBER: 2025-03-14T03:57:12.1243113Z ##[endgroup] 2025-03-14T03:57:12.1310694Z Current branch is 'main' 2025-03-14T03:57:13.2076951Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-03-14T03:57:13.2078144Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:57:13.2078908Z INFO : Setting output: label-type='lf.' 2025-03-14T03:57:13.2380419Z Evaluate and set job outputs 2025-03-14T03:57:13.2387228Z Set output 'label-type' 2025-03-14T03:57:13.2389192Z Cleaning up orphan processes