2025-03-04T19:47:16.9318519Z Current runner version: '2.322.0' 2025-03-04T19:47:16.9345656Z ##[group]Operating System 2025-03-04T19:47:16.9346644Z Ubuntu 2025-03-04T19:47:16.9347248Z 24.04.2 2025-03-04T19:47:16.9347771Z LTS 2025-03-04T19:47:16.9348220Z ##[endgroup] 2025-03-04T19:47:16.9348821Z ##[group]Runner Image 2025-03-04T19:47:16.9349684Z Image: ubuntu-24.04 2025-03-04T19:47:16.9350282Z Version: 20250223.1.0 2025-03-04T19:47:16.9351427Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250223.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-04T19:47:16.9352806Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250223.1 2025-03-04T19:47:16.9353660Z ##[endgroup] 2025-03-04T19:47:16.9354281Z ##[group]Runner Image Provisioner 2025-03-04T19:47:16.9354888Z 2.0.422.1 2025-03-04T19:47:16.9355418Z ##[endgroup] 2025-03-04T19:47:16.9356469Z ##[group]GITHUB_TOKEN Permissions 2025-03-04T19:47:16.9358448Z Contents: read 2025-03-04T19:47:16.9359141Z Metadata: read 2025-03-04T19:47:16.9360036Z ##[endgroup] 2025-03-04T19:47:16.9362978Z Secret source: Actions 2025-03-04T19:47:16.9364030Z Prepare workflow directory 2025-03-04T19:47:16.9867898Z Prepare all required actions 2025-03-04T19:47:16.9922960Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (92beda54c8707d476ea8bc193ce79a37653d2e49) 2025-03-04T19:47:16.9928170Z ##[group] Inputs 2025-03-04T19:47:16.9928764Z check_experiments: 2025-03-04T19:47:16.9929774Z triggering_actor: pytorch-bot[bot] 2025-03-04T19:47:16.9930450Z issue_owner: 2025-03-04T19:47:16.9931056Z curr_branch: ciflow/inductor/148205 2025-03-04T19:47:16.9931794Z curr_ref_type: tag 2025-03-04T19:47:16.9932322Z issue_number: 5132 2025-03-04T19:47:16.9932923Z ##[endgroup] 2025-03-04T19:47:16.9933577Z Complete job name: get-label-type / runner-determinator 2025-03-04T19:47:17.6705239Z ##[group]Run cat < runner_determinator.py 2025-03-04T19:47:17.6706874Z cat < runner_determinator.py 2025-03-04T19:47:17.6707444Z # flake8: noqa: G004 2025-03-04T19:47:17.6707930Z  2025-03-04T19:47:17.6708576Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:17.6709753Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:17.6710582Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:17.6711207Z  2025-03-04T19:47:17.6711568Z """ 2025-03-04T19:47:17.6712189Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:17.6713107Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:17.6714098Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:17.6714983Z of which runners should be used to run which job. 2025-03-04T19:47:17.6715562Z  2025-03-04T19:47:17.6716181Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:17.6717121Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:17.6718164Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:17.6718918Z list, defined. 2025-03-04T19:47:17.6719495Z  2025-03-04T19:47:17.6720140Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:17.6721094Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:17.6721981Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:17.6722609Z  2025-03-04T19:47:17.6723205Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:17.6724114Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:17.6725152Z experiments which the user could be opted in to. 2025-03-04T19:47:17.6725737Z  2025-03-04T19:47:17.6726169Z The user list has the following rules: 2025-03-04T19:47:17.6726707Z  2025-03-04T19:47:17.6727313Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:17.6728208Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:17.6729023Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:17.6729855Z  2025-03-04T19:47:17.6730343Z Example config: 2025-03-04T19:47:17.6730881Z  # A list of experiments that can be opted into. 2025-03-04T19:47:17.6731595Z  # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:17.6732255Z  # Expected syntax is: 2025-03-04T19:47:17.6732962Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:17.6733974Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:17.6734740Z  2025-03-04T19:47:17.6735115Z  experiments: 2025-03-04T19:47:17.6735552Z  lf: 2025-03-04T19:47:17.6735973Z  rollout_percent: 25 2025-03-04T19:47:17.6736475Z  all_branches: false 2025-03-04T19:47:17.6736990Z  default: true 2025-03-04T19:47:17.6737454Z  --- 2025-03-04T19:47:17.6737859Z  2025-03-04T19:47:17.6738231Z  # Opt-ins: 2025-03-04T19:47:17.6738883Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:17.6740113Z  # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:17.6740951Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:17.6741675Z  # Experiments should be from the above list. 2025-03-04T19:47:17.6742242Z  2025-03-04T19:47:17.6742626Z  @User1,-lf,split_build 2025-03-04T19:47:17.6743120Z  @User2,lf 2025-03-04T19:47:17.6743570Z  @User3,split_build 2025-03-04T19:47:17.6744035Z """ 2025-03-04T19:47:17.6744419Z  2025-03-04T19:47:17.6744784Z import json 2025-03-04T19:47:17.6745208Z import logging 2025-03-04T19:47:17.6745638Z import os 2025-03-04T19:47:17.6746047Z import random 2025-03-04T19:47:17.6746479Z import re 2025-03-04T19:47:17.6746885Z import sys 2025-03-04T19:47:17.6747356Z from argparse import ArgumentParser 2025-03-04T19:47:17.6747951Z from collections.abc import Iterable 2025-03-04T19:47:17.6748522Z from functools import cache 2025-03-04T19:47:17.6749046Z from logging import LogRecord 2025-03-04T19:47:17.6749742Z from typing import Any, NamedTuple 2025-03-04T19:47:17.6750359Z from urllib.request import Request, urlopen 2025-03-04T19:47:17.6750920Z  2025-03-04T19:47:17.6751297Z import yaml 2025-03-04T19:47:17.6751746Z from github import Auth, Github 2025-03-04T19:47:17.6752293Z from github.Issue import Issue 2025-03-04T19:47:17.6752791Z  2025-03-04T19:47:17.6753155Z  2025-03-04T19:47:17.6753611Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:17.6754353Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:17.6755259Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:17.6755980Z  2025-03-04T19:47:17.6756441Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:17.6757060Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:17.6757635Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:17.6758416Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:17.6758957Z  2025-03-04T19:47:17.6759486Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:17.6760020Z  2025-03-04T19:47:17.6760416Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:17.6760939Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:17.6761416Z  2025-03-04T19:47:17.6761779Z  2025-03-04T19:47:17.6762174Z class Experiment(NamedTuple): 2025-03-04T19:47:17.6762705Z  rollout_perc: float = ( 2025-03-04T19:47:17.6763417Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:17.6764126Z  ) 2025-03-04T19:47:17.6764523Z  all_branches: bool = ( 2025-03-04T19:47:17.6765219Z  False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:17.6765945Z  ) 2025-03-04T19:47:17.6766352Z  default: bool = ( 2025-03-04T19:47:17.6766994Z  True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:17.6767666Z  ) 2025-03-04T19:47:17.6768079Z  2025-03-04T19:47:17.6768464Z  # Add more fields as needed 2025-03-04T19:47:17.6768967Z  2025-03-04T19:47:17.6769426Z  2025-03-04T19:47:17.6769824Z class Settings(NamedTuple): 2025-03-04T19:47:17.6770320Z  """ 2025-03-04T19:47:17.6770841Z  Settings for the experiments that can be opted into. 2025-03-04T19:47:17.6771439Z  """ 2025-03-04T19:47:17.6771823Z  2025-03-04T19:47:17.6772255Z  experiments: dict[str, Experiment] = {} 2025-03-04T19:47:17.6772796Z  2025-03-04T19:47:17.6773295Z  2025-03-04T19:47:17.6773732Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:17.6774412Z  """Color codes the log messages based on the log level""" 2025-03-04T19:47:17.6775032Z  2025-03-04T19:47:17.6775413Z  COLORS = { 2025-03-04T19:47:17.6775877Z  "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:17.6776421Z  "ERROR": "\033[31m", # Red 2025-03-04T19:47:17.6776960Z  "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:17.6777499Z  "INFO": "\033[0m", # Reset 2025-03-04T19:47:17.6778048Z  "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:17.6778552Z  } 2025-03-04T19:47:17.6778930Z  2025-03-04T19:47:17.6779479Z  def format(self, record: LogRecord) -> str: 2025-03-04T19:47:17.6780277Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:17.6781091Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:17.6781716Z  return super().format(record) 2025-03-04T19:47:17.6782265Z  2025-03-04T19:47:17.6782626Z  2025-03-04T19:47:17.6783033Z handler = logging.StreamHandler() 2025-03-04T19:47:17.6783805Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:17.6784541Z  2025-03-04T19:47:17.6785021Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:17.6785644Z log.addHandler(handler) 2025-03-04T19:47:17.6786150Z log.setLevel(logging.INFO) 2025-03-04T19:47:17.6786635Z  2025-03-04T19:47:17.6786993Z  2025-03-04T19:47:17.6787475Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:17.6788083Z  """ 2025-03-04T19:47:17.6788639Z  Defines outputs of the github action that invokes this script 2025-03-04T19:47:17.6789425Z  """ 2025-03-04T19:47:17.6789837Z  if not GITHUB_OUTPUT: 2025-03-04T19:47:17.6790944Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:17.6792237Z  log.warning( 2025-03-04T19:47:17.6793127Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:17.6794042Z  ) 2025-03-04T19:47:17.6794520Z  print(f"::set-output name={key}::{value}") 2025-03-04T19:47:17.6795086Z  return 2025-03-04T19:47:17.6795507Z  2025-03-04T19:47:17.6795933Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:17.6796539Z  log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:17.6797147Z  f.write(f"{key}={value}\n") 2025-03-04T19:47:17.6797661Z  2025-03-04T19:47:17.6798035Z  2025-03-04T19:47:17.6798572Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:17.6799342Z  return frozenset( 2025-03-04T19:47:17.6800025Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:17.6800720Z  ) 2025-03-04T19:47:17.6801094Z  2025-03-04T19:47:17.6801454Z  2025-03-04T19:47:17.6801831Z def parse_args() -> Any: 2025-03-04T19:47:17.6802455Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:17.6803347Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:17.6804134Z  parser.add_argument( 2025-03-04T19:47:17.6804651Z  "--github-issue-repo", 2025-03-04T19:47:17.6805170Z  type=str, 2025-03-04T19:47:17.6805631Z  required=False, 2025-03-04T19:47:17.6806273Z  default="pytorch/test-infra", 2025-03-04T19:47:17.6806873Z  help="GitHub repo to get the issue", 2025-03-04T19:47:17.6807411Z  ) 2025-03-04T19:47:17.6807822Z  parser.add_argument( 2025-03-04T19:47:17.6808312Z  "--github-repo", 2025-03-04T19:47:17.6808804Z  type=str, 2025-03-04T19:47:17.6809386Z  required=True, 2025-03-04T19:47:17.6809919Z  help="GitHub repo where CI is running", 2025-03-04T19:47:17.6810455Z  ) 2025-03-04T19:47:17.6810861Z  parser.add_argument( 2025-03-04T19:47:17.6811524Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:17.6812194Z  ) 2025-03-04T19:47:17.6812600Z  parser.add_argument( 2025-03-04T19:47:17.6813289Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:17.6813988Z  ) 2025-03-04T19:47:17.6814384Z  parser.add_argument( 2025-03-04T19:47:17.6815118Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:17.6815843Z  ) 2025-03-04T19:47:17.6816258Z  parser.add_argument( 2025-03-04T19:47:17.6816967Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:17.6817691Z  ) 2025-03-04T19:47:17.6818092Z  parser.add_argument( 2025-03-04T19:47:17.6818592Z  "--github-ref-type", 2025-03-04T19:47:17.6819091Z  type=str, 2025-03-04T19:47:17.6819645Z  required=True, 2025-03-04T19:47:17.6820199Z  help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:17.6820773Z  ) 2025-03-04T19:47:17.6821181Z  parser.add_argument( 2025-03-04T19:47:17.6821717Z  "--eligible-experiments", 2025-03-04T19:47:17.6822280Z  type=_str_comma_separated_to_set, 2025-03-04T19:47:17.6822821Z  required=False, 2025-03-04T19:47:17.6823299Z  default="", 2025-03-04T19:47:17.6824394Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:17.6825329Z  ) 2025-03-04T19:47:17.6825726Z  parser.add_argument( 2025-03-04T19:47:17.6826213Z  "--pr-number", 2025-03-04T19:47:17.6826688Z  type=str, 2025-03-04T19:47:17.6827151Z  required=False, 2025-03-04T19:47:17.6827629Z  default="", 2025-03-04T19:47:17.6828173Z  help="the optional PR number where this is run", 2025-03-04T19:47:17.6828758Z  ) 2025-03-04T19:47:17.6829134Z  2025-03-04T19:47:17.6829657Z  return parser.parse_args() 2025-03-04T19:47:17.6830165Z  2025-03-04T19:47:17.6830529Z  2025-03-04T19:47:17.6831152Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:17.6831938Z  auth = Auth.Token(github_token) 2025-03-04T19:47:17.6832489Z  return Github(auth=auth) 2025-03-04T19:47:17.6832976Z  2025-03-04T19:47:17.6833337Z  2025-03-04T19:47:17.6834011Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:17.6834822Z  repo = gh.get_repo(repo) 2025-03-04T19:47:17.6835383Z  return repo.get_issue(number=issue_num) 2025-03-04T19:47:17.6835924Z  2025-03-04T19:47:17.6836282Z  2025-03-04T19:47:17.6836665Z def get_potential_pr_author( 2025-03-04T19:47:17.6837364Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:17.6838079Z ) -> str: 2025-03-04T19:47:17.6838803Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:17.6839757Z  # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:17.6840547Z  # embedded in the tag name: ciflow// 2025-03-04T19:47:17.6841132Z  2025-03-04T19:47:17.6841537Z  gh = get_gh_client(github_token) 2025-03-04T19:47:17.6842061Z  2025-03-04T19:47:17.6842556Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:17.6843213Z  split_tag = ref_name.split("/") 2025-03-04T19:47:17.6843752Z  if ( 2025-03-04T19:47:17.6844189Z  len(split_tag) == 3 2025-03-04T19:47:17.6844728Z  and split_tag[0] == "ciflow" 2025-03-04T19:47:17.6845297Z  and split_tag[2].isnumeric() 2025-03-04T19:47:17.6845817Z  ): 2025-03-04T19:47:17.6846263Z  pr_number = split_tag[2] 2025-03-04T19:47:17.6846783Z  try: 2025-03-04T19:47:17.6847275Z  repository = gh.get_repo(repo) 2025-03-04T19:47:17.6847930Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:17.6848566Z  except Exception as e: 2025-03-04T19:47:17.6849125Z  raise Exception( # noqa: TRY002 2025-03-04T19:47:17.6849957Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:17.6850613Z  ) from e 2025-03-04T19:47:17.6851208Z  return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:17.6851930Z  # In all other cases, return the original input username 2025-03-04T19:47:17.6852541Z  return username 2025-03-04T19:47:17.6852976Z  2025-03-04T19:47:17.6853322Z  2025-03-04T19:47:17.6853764Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:17.6854322Z  """ 2025-03-04T19:47:17.6855012Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:17.6855926Z  """ 2025-03-04T19:47:17.6856517Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:17.6857242Z  2025-03-04T19:47:17.6857610Z  2025-03-04T19:47:17.6858018Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:17.6858530Z  try: 2025-03-04T19:47:17.6858954Z  data = yaml.safe_load(yaml_text) 2025-03-04T19:47:17.6859582Z  return data 2025-03-04T19:47:17.6860052Z  except yaml.YAMLError: 2025-03-04T19:47:17.6860604Z  log.exception("Error loading YAML") 2025-03-04T19:47:17.6861143Z  raise 2025-03-04T19:47:17.6861545Z  2025-03-04T19:47:17.6861897Z  2025-03-04T19:47:17.6862552Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:17.6863307Z  """ 2025-03-04T19:47:17.6863972Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:17.6864723Z  2025-03-04T19:47:17.6865275Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:17.6866132Z  and the text below is the list of opted in users. 2025-03-04T19:47:17.6866705Z  2025-03-04T19:47:17.6867285Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:17.6868025Z  """ 2025-03-04T19:47:17.6868513Z  rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:17.6869128Z  if len(rollout_state_parts) >= 2: 2025-03-04T19:47:17.6870026Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:17.6870639Z  else: 2025-03-04T19:47:17.6871067Z  return "", rollout_state 2025-03-04T19:47:17.6871556Z  2025-03-04T19:47:17.6871950Z  2025-03-04T19:47:17.6872370Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:17.6872904Z  """ 2025-03-04T19:47:17.6873457Z  Dictionary of users with a list of features they have opted into 2025-03-04T19:47:17.6874117Z  """ 2025-03-04T19:47:17.6874486Z  2025-03-04T19:47:17.6874826Z  2025-03-04T19:47:17.6875372Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:17.6876035Z  """ 2025-03-04T19:47:17.6876769Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:17.6877605Z  2025-03-04T19:47:17.6878417Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:17.6879523Z  - Example line: "@User1,lf,split_build" 2025-03-04T19:47:17.6880238Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:17.6880875Z  2025-03-04T19:47:17.6881343Z  2025-03-04T19:47:17.6881947Z  """ 2025-03-04T19:47:17.6882353Z  optins = UserOptins() 2025-03-04T19:47:17.6882922Z  for user in user_optin_text.split("\n"): 2025-03-04T19:47:17.6883513Z  user = user.strip("\r\n\t -") 2025-03-04T19:47:17.6884101Z  if not user or not user.startswith("@"): 2025-03-04T19:47:17.6884700Z  # Not a valid user. Skip 2025-03-04T19:47:17.6885219Z  continue 2025-03-04T19:47:17.6885658Z  2025-03-04T19:47:17.6886016Z  if user: 2025-03-04T19:47:17.6886533Z  usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:17.6887249Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:17.6887907Z  2025-03-04T19:47:17.6888531Z  return optins 2025-03-04T19:47:17.6888966Z  2025-03-04T19:47:17.6889609Z  2025-03-04T19:47:17.6890434Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:17.6891121Z  """ 2025-03-04T19:47:17.6891572Z  Check if the experiment name is valid. 2025-03-04T19:47:17.6892125Z  A valid name: 2025-03-04T19:47:17.6892820Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:17.6893770Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:17.6894486Z  - Cannot contain spaces 2025-03-04T19:47:17.6895030Z  """ 2025-03-04T19:47:17.6895414Z  2025-03-04T19:47:17.6895894Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:17.6896636Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:17.6897254Z  2025-03-04T19:47:17.6897640Z  if valid: 2025-03-04T19:47:17.6898071Z  return True 2025-03-04T19:47:17.6898503Z  2025-03-04T19:47:17.6898865Z  log.error( 2025-03-04T19:47:17.6900429Z  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-04T19:47:17.6901943Z  ) 2025-03-04T19:47:17.6902328Z  return False 2025-03-04T19:47:17.6902753Z  2025-03-04T19:47:17.6903100Z  2025-03-04T19:47:17.6903784Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:17.6904440Z  """ 2025-03-04T19:47:17.6905072Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:17.6905792Z  """ 2025-03-04T19:47:17.6906161Z  try: 2025-03-04T19:47:17.6906556Z  if settings_text: 2025-03-04T19:47:17.6907320Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:17.6908103Z  # for easy reading 2025-03-04T19:47:17.6908930Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:17.6909934Z  # the backtick character in shell commands. 2025-03-04T19:47:17.6910565Z  backtick = chr(96) # backtick character 2025-03-04T19:47:17.6911259Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:17.6911951Z  settings = load_yaml(settings_text) 2025-03-04T19:47:17.6912469Z  2025-03-04T19:47:17.6913075Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:17.6913828Z  experiments = {} 2025-03-04T19:47:17.6914305Z  2025-03-04T19:47:17.6914878Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:17.6915656Z  if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:17.6916742Z  # 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-04T19:47:17.6917772Z  continue 2025-03-04T19:47:17.6918248Z  2025-03-04T19:47:17.6918636Z  valid_settings = {} 2025-03-04T19:47:17.6919291Z  for setting in exp_settings: 2025-03-04T19:47:17.6919899Z  if setting not in Experiment._fields: 2025-03-04T19:47:17.6920475Z  log.warning( 2025-03-04T19:47:17.6921354Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:17.6922075Z  ) 2025-03-04T19:47:17.6922543Z  else: 2025-03-04T19:47:17.6923132Z  valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:17.6923715Z  2025-03-04T19:47:17.6924212Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:17.6924878Z  return Settings(experiments) 2025-03-04T19:47:17.6925395Z  2025-03-04T19:47:17.6925772Z  except Exception: 2025-03-04T19:47:17.6926310Z  log.exception("Failed to parse settings") 2025-03-04T19:47:17.6926863Z  2025-03-04T19:47:17.6927237Z  return Settings() 2025-03-04T19:47:17.6927695Z  2025-03-04T19:47:17.6928041Z  2025-03-04T19:47:17.6928522Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:17.6929105Z  """ 2025-03-04T19:47:17.6929695Z  Parse settings, if any, from the rollout state. 2025-03-04T19:47:17.6930264Z  2025-03-04T19:47:17.6930810Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:17.6931584Z  and the text below is the list of opted in users. 2025-03-04T19:47:17.6932149Z  2025-03-04T19:47:17.6932747Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:17.6933479Z  """ 2025-03-04T19:47:17.6934075Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:17.6935107Z  return parse_settings_from_text(settings_text) 2025-03-04T19:47:17.6935679Z  2025-03-04T19:47:17.6936019Z  2025-03-04T19:47:17.6936492Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:17.6937088Z  """ 2025-03-04T19:47:17.6937515Z  Parse users from the rollout state. 2025-03-04T19:47:17.6938037Z  2025-03-04T19:47:17.6938385Z  """ 2025-03-04T19:47:17.6938955Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:17.6939819Z  return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:17.6940378Z  2025-03-04T19:47:17.6940724Z  2025-03-04T19:47:17.6941357Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:17.6942103Z  """ 2025-03-04T19:47:17.6942562Z  Check if a user is opted into an experiment 2025-03-04T19:47:17.6943120Z  """ 2025-03-04T19:47:17.6943621Z  return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:17.6944201Z  2025-03-04T19:47:17.6944555Z  2025-03-04T19:47:17.6945187Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:17.6945947Z  """ 2025-03-04T19:47:17.6946450Z  Check if a user explicitly opted out of an experiment 2025-03-04T19:47:17.6947036Z  """ 2025-03-04T19:47:17.6947589Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:17.6948309Z  experiment_optout = "-" + experiment_name 2025-03-04T19:47:17.6948976Z  if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:17.6949731Z  return False 2025-03-04T19:47:17.6950162Z  2025-03-04T19:47:17.6950645Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:17.6951250Z  log.warning( 2025-03-04T19:47:17.6952087Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:17.6953089Z  ) 2025-03-04T19:47:17.6953474Z  2025-03-04T19:47:17.6953833Z  return True 2025-03-04T19:47:17.6954251Z  2025-03-04T19:47:17.6954589Z  2025-03-04T19:47:17.6954959Z def get_runner_prefix( 2025-03-04T19:47:17.6955460Z  rollout_state: str, 2025-03-04T19:47:17.6955969Z  workflow_requestors: Iterable[str], 2025-03-04T19:47:17.6956500Z  branch: str, 2025-03-04T19:47:17.6957046Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:17.6957665Z  is_canary: bool = False, 2025-03-04T19:47:17.6958156Z ) -> str: 2025-03-04T19:47:17.6958629Z  settings = parse_settings(rollout_state) 2025-03-04T19:47:17.6959339Z  user_optins = parse_users(rollout_state) 2025-03-04T19:47:17.6959872Z  2025-03-04T19:47:17.6960240Z  fleet_prefix = "" 2025-03-04T19:47:17.6960710Z  prefixes = [] 2025-03-04T19:47:17.6961397Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:17.6962355Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:17.6963074Z  log.info( 2025-03-04T19:47:17.6963787Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:17.6964538Z  ) 2025-03-04T19:47:17.6964960Z  continue 2025-03-04T19:47:17.6965392Z  2025-03-04T19:47:17.6965779Z  if eligible_experiments: 2025-03-04T19:47:17.6966611Z  if experiment_name not in eligible_experiments: 2025-03-04T19:47:17.6967281Z  exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:17.6967844Z  log.info( 2025-03-04T19:47:17.6968702Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:17.6969629Z  ) 2025-03-04T19:47:17.6970070Z  continue 2025-03-04T19:47:17.6970588Z  elif not experiment_settings.default: 2025-03-04T19:47:17.6971133Z  log.info( 2025-03-04T19:47:17.6971826Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:17.6972559Z  ) 2025-03-04T19:47:17.6972984Z  continue 2025-03-04T19:47:17.6973413Z  2025-03-04T19:47:17.6973904Z  # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:17.6974536Z  opted_out_users = [ 2025-03-04T19:47:17.6975025Z  requestor 2025-03-04T19:47:17.6975531Z  for requestor in workflow_requestors 2025-03-04T19:47:17.6976225Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:17.6976854Z  ] 2025-03-04T19:47:17.6977232Z  2025-03-04T19:47:17.6977606Z  if opted_out_users: 2025-03-04T19:47:17.6978090Z  log.info( 2025-03-04T19:47:17.6978752Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:17.6979535Z  ) 2025-03-04T19:47:17.6979957Z  continue 2025-03-04T19:47:17.6980384Z  2025-03-04T19:47:17.6980861Z  # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:17.6981482Z  opted_in_users = [ 2025-03-04T19:47:17.6981978Z  requestor 2025-03-04T19:47:17.6982491Z  for requestor in workflow_requestors 2025-03-04T19:47:17.6983182Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:17.6983934Z  ] 2025-03-04T19:47:17.6984316Z  2025-03-04T19:47:17.6984683Z  enabled = False 2025-03-04T19:47:17.6985158Z  if opted_in_users: 2025-03-04T19:47:17.6985645Z  log.info( 2025-03-04T19:47:17.6986299Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:17.6986987Z  ) 2025-03-04T19:47:17.6987407Z  enabled = True 2025-03-04T19:47:17.6987861Z  2025-03-04T19:47:17.6988280Z  elif experiment_settings.rollout_perc: 2025-03-04T19:47:17.6989147Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:17.6990174Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:17.6990823Z  log.info( 2025-03-04T19:47:17.6991719Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:17.6992629Z  ) 2025-03-04T19:47:17.6993070Z  enabled = True 2025-03-04T19:47:17.6993556Z  2025-03-04T19:47:17.6993918Z  if enabled: 2025-03-04T19:47:17.6994397Z  label = experiment_name 2025-03-04T19:47:17.6994991Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:17.6995827Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:17.6996860Z  # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:17.6997641Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:17.6998318Z  if is_canary: 2025-03-04T19:47:17.6998855Z  label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:17.6999516Z  fleet_prefix = label 2025-03-04T19:47:17.7000027Z  else: 2025-03-04T19:47:17.7000500Z  prefixes.append(label) 2025-03-04T19:47:17.7001014Z  2025-03-04T19:47:17.7001420Z  if len(prefixes) > 1: 2025-03-04T19:47:17.7001901Z  log.error( 2025-03-04T19:47:17.7002982Z  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-04T19:47:17.7004065Z  ) 2025-03-04T19:47:17.7004492Z  prefixes = prefixes[:1] 2025-03-04T19:47:17.7005005Z  2025-03-04T19:47:17.7005385Z  # Fleet always comes first 2025-03-04T19:47:17.7005891Z  if fleet_prefix: 2025-03-04T19:47:17.7006382Z  prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:17.7006915Z  2025-03-04T19:47:17.7007389Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:17.7007970Z  2025-03-04T19:47:17.7008319Z  2025-03-04T19:47:17.7008963Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:17.7009825Z  """ 2025-03-04T19:47:17.7010449Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:17.7011155Z  2025-03-04T19:47:17.7011742Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:17.7012446Z  """ 2025-03-04T19:47:17.7012871Z  gh = get_gh_client(github_token) 2025-03-04T19:47:17.7013441Z  issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:17.7014106Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:17.7014834Z  2025-03-04T19:47:17.7015205Z  2025-03-04T19:47:17.7015815Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:17.7016595Z  for _ in range(num_retries): 2025-03-04T19:47:17.7017094Z  try: 2025-03-04T19:47:17.7017555Z  req = Request(url=url, headers=headers) 2025-03-04T19:47:17.7018247Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:17.7018909Z  return json.loads(content) 2025-03-04T19:47:17.7019540Z  except Exception as e: 2025-03-04T19:47:17.7020127Z  log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:17.7020691Z  2025-03-04T19:47:17.7021274Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:17.7021997Z  return {} 2025-03-04T19:47:17.7022406Z  2025-03-04T19:47:17.7022758Z  2025-03-04T19:47:17.7023101Z @cache 2025-03-04T19:47:17.7023758Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:17.7024507Z  """ 2025-03-04T19:47:17.7024926Z  Dynamically get PR information 2025-03-04T19:47:17.7025427Z  """ 2025-03-04T19:47:17.7025948Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:17.7026580Z  headers = { 2025-03-04T19:47:17.7027087Z  "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:17.7027722Z  "Authorization": f"token {github_token}", 2025-03-04T19:47:17.7028254Z  } 2025-03-04T19:47:17.7100130Z  json_response: dict[str, Any] = download_json( 2025-03-04T19:47:17.7101473Z  url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:17.7102479Z  headers=headers, 2025-03-04T19:47:17.7103249Z  ) 2025-03-04T19:47:17.7103904Z  2025-03-04T19:47:17.7104395Z  if not json_response: 2025-03-04T19:47:17.7105031Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:17.7105672Z  return {} 2025-03-04T19:47:17.7106100Z  2025-03-04T19:47:17.7106481Z  return json_response 2025-03-04T19:47:17.7106960Z  2025-03-04T19:47:17.7107307Z  2025-03-04T19:47:17.7107937Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:17.7108668Z  """ 2025-03-04T19:47:17.7109461Z  Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:17.7110153Z  """ 2025-03-04T19:47:17.7110730Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:17.7111394Z  return { 2025-03-04T19:47:17.7112030Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:17.7112718Z  } 2025-03-04T19:47:17.7113082Z  2025-03-04T19:47:17.7113434Z  2025-03-04T19:47:17.7113800Z def main() -> None: 2025-03-04T19:47:17.7114259Z  args = parse_args() 2025-03-04T19:47:17.7114704Z  2025-03-04T19:47:17.7115144Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:17.7115695Z  2025-03-04T19:47:17.7116086Z  # Check if the PR is opt-out 2025-03-04T19:47:17.7116608Z  if args.pr_number: 2025-03-04T19:47:17.7117335Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:17.7118103Z  if OPT_OUT_LABEL in labels: 2025-03-04T19:47:17.7118650Z  log.info( 2025-03-04T19:47:17.7119543Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:17.7120503Z  ) 2025-03-04T19:47:17.7121116Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:17.7121794Z  sys.exit() 2025-03-04T19:47:17.7122236Z  2025-03-04T19:47:17.7122589Z  try: 2025-03-04T19:47:17.7123062Z  rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:17.7123801Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:17.7124446Z  ) 2025-03-04T19:47:17.7124820Z  2025-03-04T19:47:17.7125235Z  username = get_potential_pr_author( 2025-03-04T19:47:17.7125789Z  args.github_token, 2025-03-04T19:47:17.7126309Z  args.github_repo, 2025-03-04T19:47:17.7126817Z  args.github_actor, 2025-03-04T19:47:17.7127365Z  args.github_ref_type, 2025-03-04T19:47:17.7127893Z  args.github_branch, 2025-03-04T19:47:17.7128379Z  ) 2025-03-04T19:47:17.7128762Z  2025-03-04T19:47:17.7129422Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:17.7130042Z  2025-03-04T19:47:17.7130471Z  runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:17.7131051Z  rollout_state, 2025-03-04T19:47:17.7131582Z  (args.github_issue_owner, username), 2025-03-04T19:47:17.7132140Z  args.github_branch, 2025-03-04T19:47:17.7132671Z  args.eligible_experiments, 2025-03-04T19:47:17.7133197Z  is_canary, 2025-03-04T19:47:17.7133770Z  ) 2025-03-04T19:47:17.7134164Z  2025-03-04T19:47:17.7134544Z  except Exception as e: 2025-03-04T19:47:17.7135030Z  log.error( 2025-03-04T19:47:17.7135747Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:17.7136501Z  ) 2025-03-04T19:47:17.7136886Z  2025-03-04T19:47:17.7137418Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:17.7138076Z  2025-03-04T19:47:17.7138417Z  2025-03-04T19:47:17.7138782Z if __name__ == "__main__": 2025-03-04T19:47:17.7139925Z  main() 2025-03-04T19:47:17.7140351Z  2025-03-04T19:47:17.7140704Z EOF 2025-03-04T19:47:17.7141055Z  2025-03-04T19:47:17.7141435Z cat runner_determinator.py 2025-03-04T19:47:17.7451713Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:17.7452633Z env: 2025-03-04T19:47:17.7453357Z GITHUB_TOKEN: *** 2025-03-04T19:47:17.7453776Z ISSUE_NUMBER: 5132 2025-03-04T19:47:17.7454209Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:17.7454697Z ISSUE_OWNER: 2025-03-04T19:47:17.7455097Z CHECK_EXPERIMENTS: 2025-03-04T19:47:17.7455505Z PR_NUMBER: 2025-03-04T19:47:17.7455880Z ##[endgroup] 2025-03-04T19:47:17.7677769Z # flake8: noqa: G004 2025-03-04T19:47:17.7678111Z 2025-03-04T19:47:17.7678525Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:47:17.7679733Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:47:17.7680501Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:47:17.7680919Z 2025-03-04T19:47:17.7681073Z """ 2025-03-04T19:47:17.7681630Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:47:17.7682456Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:47:17.7683334Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:47:17.7684105Z of which runners should be used to run which job. 2025-03-04T19:47:17.7684485Z 2025-03-04T19:47:17.7685065Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:47:17.7685918Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:47:17.7686744Z settings are considered to be empty with only the second part, the user 2025-03-04T19:47:17.7687396Z list, defined. 2025-03-04T19:47:17.7687619Z 2025-03-04T19:47:17.7687968Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:47:17.7688845Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:47:17.7690097Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:47:17.7690519Z 2025-03-04T19:47:17.7690886Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:47:17.7691724Z The user list is also a comma separated list of additional features or 2025-03-04T19:47:17.7692409Z experiments which the user could be opted in to. 2025-03-04T19:47:17.7692793Z 2025-03-04T19:47:17.7692992Z The user list has the following rules: 2025-03-04T19:47:17.7693326Z 2025-03-04T19:47:17.7693620Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:47:17.7694440Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:47:17.7695158Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:47:17.7695532Z 2025-03-04T19:47:17.7695699Z Example config: 2025-03-04T19:47:17.7696121Z # A list of experiments that can be opted into. 2025-03-04T19:47:17.7696771Z # This defines the behavior they'll induce when opted into. 2025-03-04T19:47:17.7697369Z # Expected syntax is: 2025-03-04T19:47:17.7697987Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:47:17.7699063Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:47:17.7699873Z 2025-03-04T19:47:17.7700041Z experiments: 2025-03-04T19:47:17.7700426Z lf: 2025-03-04T19:47:17.7700788Z rollout_percent: 25 2025-03-04T19:47:17.7701230Z all_branches: false 2025-03-04T19:47:17.7701653Z default: true 2025-03-04T19:47:17.7702037Z --- 2025-03-04T19:47:17.7702237Z 2025-03-04T19:47:17.7702394Z # Opt-ins: 2025-03-04T19:47:17.7702949Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:47:17.7703767Z # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:47:17.7704497Z # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:47:17.7705115Z # Experiments should be from the above list. 2025-03-04T19:47:17.7705483Z 2025-03-04T19:47:17.7705657Z @User1,-lf,split_build 2025-03-04T19:47:17.7706077Z @User2,lf 2025-03-04T19:47:17.7706448Z @User3,split_build 2025-03-04T19:47:17.7706841Z """ 2025-03-04T19:47:17.7707019Z 2025-03-04T19:47:17.7707171Z import json 2025-03-04T19:47:17.7707530Z import logging 2025-03-04T19:47:17.7707899Z import os 2025-03-04T19:47:17.7708239Z import random 2025-03-04T19:47:17.7708596Z import re 2025-03-04T19:47:17.7708933Z import sys 2025-03-04T19:47:17.7709553Z from argparse import ArgumentParser 2025-03-04T19:47:17.7710083Z from collections.abc import Iterable 2025-03-04T19:47:17.7710586Z from functools import cache 2025-03-04T19:47:17.7711035Z from logging import LogRecord 2025-03-04T19:47:17.7711495Z from typing import Any, NamedTuple 2025-03-04T19:47:17.7712004Z from urllib.request import Request, urlopen 2025-03-04T19:47:17.7712360Z 2025-03-04T19:47:17.7712514Z import yaml 2025-03-04T19:47:17.7712889Z from github import Auth, Github 2025-03-04T19:47:17.7713372Z from github.Issue import Issue 2025-03-04T19:47:17.7713661Z 2025-03-04T19:47:17.7713668Z 2025-03-04T19:47:17.7713882Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:47:17.7714560Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:47:17.7715380Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:47:17.7716190Z 2025-03-04T19:47:17.7716452Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:47:17.7717008Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:47:17.7717493Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:47:17.7718015Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:47:17.7718362Z 2025-03-04T19:47:17.7718550Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:47:17.7718874Z 2025-03-04T19:47:17.7719048Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:47:17.7719844Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:47:17.7720120Z 2025-03-04T19:47:17.7720126Z 2025-03-04T19:47:17.7720322Z class Experiment(NamedTuple): 2025-03-04T19:47:17.7720781Z rollout_perc: float = ( 2025-03-04T19:47:17.7721409Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:47:17.7722053Z ) 2025-03-04T19:47:17.7722407Z all_branches: bool = ( 2025-03-04T19:47:17.7723003Z False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:47:17.7723656Z ) 2025-03-04T19:47:17.7724006Z default: bool = ( 2025-03-04T19:47:17.7724560Z True # If True, the experiment is enabled by default for all queries 2025-03-04T19:47:17.7725180Z ) 2025-03-04T19:47:17.7725365Z 2025-03-04T19:47:17.7725545Z # Add more fields as needed 2025-03-04T19:47:17.7725834Z 2025-03-04T19:47:17.7725840Z 2025-03-04T19:47:17.7726024Z class Settings(NamedTuple): 2025-03-04T19:47:17.7726448Z """ 2025-03-04T19:47:17.7726882Z Settings for the experiments that can be opted into. 2025-03-04T19:47:17.7727426Z """ 2025-03-04T19:47:17.7727624Z 2025-03-04T19:47:17.7727820Z experiments: dict[str, Experiment] = {} 2025-03-04T19:47:17.7728171Z 2025-03-04T19:47:17.7728177Z 2025-03-04T19:47:17.7728520Z class ColorFormatter(logging.Formatter): 2025-03-04T19:47:17.7729136Z """Color codes the log messages based on the log level""" 2025-03-04T19:47:17.7729745Z 2025-03-04T19:47:17.7729905Z COLORS = { 2025-03-04T19:47:17.7730300Z "WARNING": "\033[33m", # Yellow 2025-03-04T19:47:17.7730792Z "ERROR": "\033[31m", # Red 2025-03-04T19:47:17.7731260Z "CRITICAL": "\033[31m", # Red 2025-03-04T19:47:17.7731742Z "INFO": "\033[0m", # Reset 2025-03-04T19:47:17.7732198Z "DEBUG": "\033[0m", # Reset 2025-03-04T19:47:17.7732652Z } 2025-03-04T19:47:17.7732846Z 2025-03-04T19:47:17.7733053Z def format(self, record: LogRecord) -> str: 2025-03-04T19:47:17.7733770Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:47:17.7734504Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:47:17.7735057Z return super().format(record) 2025-03-04T19:47:17.7735371Z 2025-03-04T19:47:17.7735376Z 2025-03-04T19:47:17.7735565Z handler = logging.StreamHandler() 2025-03-04T19:47:17.7736241Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:47:17.7736769Z 2025-03-04T19:47:17.7737006Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:47:17.7737562Z log.addHandler(handler) 2025-03-04T19:47:17.7737997Z log.setLevel(logging.INFO) 2025-03-04T19:47:17.7738265Z 2025-03-04T19:47:17.7738271Z 2025-03-04T19:47:17.7738512Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:47:17.7739048Z """ 2025-03-04T19:47:17.7739721Z Defines outputs of the github action that invokes this script 2025-03-04T19:47:17.7740322Z """ 2025-03-04T19:47:17.7740681Z if not GITHUB_OUTPUT: 2025-03-04T19:47:17.7741688Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:47:17.7742734Z log.warning( 2025-03-04T19:47:17.7743545Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:47:17.7744411Z ) 2025-03-04T19:47:17.7754201Z print(f"::set-output name={key}::{value}") 2025-03-04T19:47:17.7754991Z return 2025-03-04T19:47:17.7755213Z 2025-03-04T19:47:17.7755403Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:47:17.7755959Z log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:47:17.7756516Z f.write(f"{key}={value}\n") 2025-03-04T19:47:17.7756834Z 2025-03-04T19:47:17.7756842Z 2025-03-04T19:47:17.7757131Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:47:17.7757741Z return frozenset( 2025-03-04T19:47:17.7758334Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:47:17.7758976Z ) 2025-03-04T19:47:17.7759172Z 2025-03-04T19:47:17.7759178Z 2025-03-04T19:47:17.7759612Z def parse_args() -> Any: 2025-03-04T19:47:17.7760182Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:47:17.7761012Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:47:17.7761755Z parser.add_argument( 2025-03-04T19:47:17.7762192Z "--github-issue-repo", 2025-03-04T19:47:17.7762641Z type=str, 2025-03-04T19:47:17.7763028Z required=False, 2025-03-04T19:47:17.7763466Z default="pytorch/test-infra", 2025-03-04T19:47:17.7763980Z help="GitHub repo to get the issue", 2025-03-04T19:47:17.7764458Z ) 2025-03-04T19:47:17.7764809Z parser.add_argument( 2025-03-04T19:47:17.7765225Z "--github-repo", 2025-03-04T19:47:17.7765647Z type=str, 2025-03-04T19:47:17.7766022Z required=True, 2025-03-04T19:47:17.7766455Z help="GitHub repo where CI is running", 2025-03-04T19:47:17.7766950Z ) 2025-03-04T19:47:17.7767303Z parser.add_argument( 2025-03-04T19:47:17.7767892Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:47:17.7768654Z ) 2025-03-04T19:47:17.7769018Z parser.add_argument( 2025-03-04T19:47:17.7769769Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:47:17.7770420Z ) 2025-03-04T19:47:17.7770775Z parser.add_argument( 2025-03-04T19:47:17.7771382Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:47:17.7772041Z ) 2025-03-04T19:47:17.7772394Z parser.add_argument( 2025-03-04T19:47:17.7773011Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:47:17.7773687Z ) 2025-03-04T19:47:17.7774040Z parser.add_argument( 2025-03-04T19:47:17.7774466Z "--github-ref-type", 2025-03-04T19:47:17.7774902Z type=str, 2025-03-04T19:47:17.7775281Z required=True, 2025-03-04T19:47:17.7775751Z help="Current GitHub ref type, branch or tag", 2025-03-04T19:47:17.7776277Z ) 2025-03-04T19:47:17.7776620Z parser.add_argument( 2025-03-04T19:47:17.7777067Z "--eligible-experiments", 2025-03-04T19:47:17.7777561Z type=_str_comma_separated_to_set, 2025-03-04T19:47:17.7778065Z required=False, 2025-03-04T19:47:17.7778477Z default="", 2025-03-04T19:47:17.7779393Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:47:17.7780270Z ) 2025-03-04T19:47:17.7780627Z parser.add_argument( 2025-03-04T19:47:17.7781059Z "--pr-number", 2025-03-04T19:47:17.7781466Z type=str, 2025-03-04T19:47:17.7781845Z required=False, 2025-03-04T19:47:17.7782246Z default="", 2025-03-04T19:47:17.7782697Z help="the optional PR number where this is run", 2025-03-04T19:47:17.7783228Z ) 2025-03-04T19:47:17.7783415Z 2025-03-04T19:47:17.7783601Z return parser.parse_args() 2025-03-04T19:47:17.7783897Z 2025-03-04T19:47:17.7783902Z 2025-03-04T19:47:17.7784283Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:47:17.7785005Z auth = Auth.Token(github_token) 2025-03-04T19:47:17.7785495Z return Github(auth=auth) 2025-03-04T19:47:17.7785780Z 2025-03-04T19:47:17.7785915Z 2025-03-04T19:47:17.7786358Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:47:17.7787113Z repo = gh.get_repo(repo) 2025-03-04T19:47:17.7787591Z return repo.get_issue(number=issue_num) 2025-03-04T19:47:17.7787937Z 2025-03-04T19:47:17.7787943Z 2025-03-04T19:47:17.7788119Z def get_potential_pr_author( 2025-03-04T19:47:17.7788729Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:47:17.7789605Z ) -> str: 2025-03-04T19:47:17.7790119Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:47:17.7790890Z # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:47:17.7791584Z # embedded in the tag name: ciflow// 2025-03-04T19:47:17.7791982Z 2025-03-04T19:47:17.7792163Z gh = get_gh_client(github_token) 2025-03-04T19:47:17.7792485Z 2025-03-04T19:47:17.7792737Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:47:17.7793339Z split_tag = ref_name.split("/") 2025-03-04T19:47:17.7793811Z if ( 2025-03-04T19:47:17.7794181Z len(split_tag) == 3 2025-03-04T19:47:17.7794640Z and split_tag[0] == "ciflow" 2025-03-04T19:47:17.7795144Z and split_tag[2].isnumeric() 2025-03-04T19:47:17.7795619Z ): 2025-03-04T19:47:17.7795996Z pr_number = split_tag[2] 2025-03-04T19:47:17.7796458Z try: 2025-03-04T19:47:17.7796863Z repository = gh.get_repo(repo) 2025-03-04T19:47:17.7797446Z pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:47:17.7798016Z except Exception as e: 2025-03-04T19:47:17.7798510Z raise Exception( # noqa: TRY002 2025-03-04T19:47:17.7799391Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:47:17.7800022Z ) from e 2025-03-04T19:47:17.7800535Z return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:47:17.7801197Z # In all other cases, return the original input username 2025-03-04T19:47:17.7801763Z return username 2025-03-04T19:47:17.7801991Z 2025-03-04T19:47:17.7801997Z 2025-03-04T19:47:17.7802216Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:47:17.7802890Z """ 2025-03-04T19:47:17.7803684Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:47:17.7804422Z """ 2025-03-04T19:47:17.7804944Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:47:17.7805455Z 2025-03-04T19:47:17.7805461Z 2025-03-04T19:47:17.7805655Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:47:17.7806133Z try: 2025-03-04T19:47:17.7806516Z data = yaml.safe_load(yaml_text) 2025-03-04T19:47:17.7807010Z return data 2025-03-04T19:47:17.7807418Z except yaml.YAMLError: 2025-03-04T19:47:17.7807880Z log.exception("Error loading YAML") 2025-03-04T19:47:17.7808383Z raise 2025-03-04T19:47:17.7808589Z 2025-03-04T19:47:17.7808594Z 2025-03-04T19:47:17.7808985Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:47:17.7809856Z """ 2025-03-04T19:47:17.7810450Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:47:17.7811019Z 2025-03-04T19:47:17.7811345Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:17.7812059Z and the text below is the list of opted in users. 2025-03-04T19:47:17.7812446Z 2025-03-04T19:47:17.7812805Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:47:17.7813459Z """ 2025-03-04T19:47:17.7813884Z rollout_state_parts = rollout_state.split("---") 2025-03-04T19:47:17.7814451Z if len(rollout_state_parts) >= 2: 2025-03-04T19:47:17.7815021Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:47:17.7815737Z else: 2025-03-04T19:47:17.7816101Z return "", rollout_state 2025-03-04T19:47:17.7816403Z 2025-03-04T19:47:17.7816408Z 2025-03-04T19:47:17.7816597Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:47:17.7817080Z """ 2025-03-04T19:47:17.7817576Z Dictionary of users with a list of features they have opted into 2025-03-04T19:47:17.7818179Z """ 2025-03-04T19:47:17.7818364Z 2025-03-04T19:47:17.7818370Z 2025-03-04T19:47:17.7818697Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:47:17.7819417Z """ 2025-03-04T19:47:17.7820099Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:47:17.7820743Z 2025-03-04T19:47:17.7821331Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:47:17.7822282Z - Example line: "@User1,lf,split_build" 2025-03-04T19:47:17.7822953Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:47:17.7823402Z 2025-03-04T19:47:17.7823408Z 2025-03-04T19:47:17.7823562Z """ 2025-03-04T19:47:17.7823913Z optins = UserOptins() 2025-03-04T19:47:17.7824377Z for user in user_optin_text.split("\n"): 2025-03-04T19:47:17.7824899Z user = user.strip("\r\n\t -") 2025-03-04T19:47:17.7825422Z if not user or not user.startswith("@"): 2025-03-04T19:47:17.7825951Z # Not a valid user. Skip 2025-03-04T19:47:17.7826439Z continue 2025-03-04T19:47:17.7826703Z 2025-03-04T19:47:17.7826856Z if user: 2025-03-04T19:47:17.7827273Z usr_name = user.split(",")[0].strip("@") 2025-03-04T19:47:17.7828049Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:47:17.7828518Z 2025-03-04T19:47:17.7828685Z return optins 2025-03-04T19:47:17.7828908Z 2025-03-04T19:47:17.7828914Z 2025-03-04T19:47:17.7829335Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:47:17.7830031Z """ 2025-03-04T19:47:17.7830417Z Check if the experiment name is valid. 2025-03-04T19:47:17.7830917Z A valid name: 2025-03-04T19:47:17.7831538Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:47:17.7832430Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:47:17.7833112Z - Cannot contain spaces 2025-03-04T19:47:17.7833551Z """ 2025-03-04T19:47:17.7833748Z 2025-03-04T19:47:17.7834002Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:47:17.7834671Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:47:17.7835089Z 2025-03-04T19:47:17.7835246Z if valid: 2025-03-04T19:47:17.7835607Z return True 2025-03-04T19:47:17.7835842Z 2025-03-04T19:47:17.7836001Z log.error( 2025-03-04T19:47:17.7837370Z 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-04T19:47:17.7838868Z ) 2025-03-04T19:47:17.7839325Z return False 2025-03-04T19:47:17.7839555Z 2025-03-04T19:47:17.7839562Z 2025-03-04T19:47:17.7839852Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:47:17.7840434Z """ 2025-03-04T19:47:17.7840982Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:47:17.7841652Z """ 2025-03-04T19:47:17.7841987Z try: 2025-03-04T19:47:17.7842339Z if settings_text: 2025-03-04T19:47:17.7843020Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:47:17.7843777Z # for easy reading 2025-03-04T19:47:17.7844517Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:47:17.7845551Z # the backtick character in shell commands. 2025-03-04T19:47:17.7846118Z backtick = chr(96) # backtick character 2025-03-04T19:47:17.7846749Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:47:17.7847369Z settings = load_yaml(settings_text) 2025-03-04T19:47:17.7847727Z 2025-03-04T19:47:17.7848101Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:47:17.7848812Z experiments = {} 2025-03-04T19:47:17.7849094Z 2025-03-04T19:47:17.7849531Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:47:17.7850244Z if not is_valid_experiment_name(exp_name): 2025-03-04T19:47:17.7851292Z # 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-04T19:47:17.7852258Z continue 2025-03-04T19:47:17.7852539Z 2025-03-04T19:47:17.7852710Z valid_settings = {} 2025-03-04T19:47:17.7853209Z for setting in exp_settings: 2025-03-04T19:47:17.7853754Z if setting not in Experiment._fields: 2025-03-04T19:47:17.7854281Z log.warning( 2025-03-04T19:47:17.7854952Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:47:17.7855623Z ) 2025-03-04T19:47:17.7856062Z else: 2025-03-04T19:47:17.7856551Z valid_settings[setting] = exp_settings[setting] 2025-03-04T19:47:17.7856950Z 2025-03-04T19:47:17.7857208Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:47:17.7857930Z return Settings(experiments) 2025-03-04T19:47:17.7858269Z 2025-03-04T19:47:17.7858438Z except Exception: 2025-03-04T19:47:17.7858888Z log.exception("Failed to parse settings") 2025-03-04T19:47:17.7859354Z 2025-03-04T19:47:17.7859516Z return Settings() 2025-03-04T19:47:17.7859782Z 2025-03-04T19:47:17.7859788Z 2025-03-04T19:47:17.7860020Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:47:17.7860555Z """ 2025-03-04T19:47:17.7860960Z Parse settings, if any, from the rollout state. 2025-03-04T19:47:17.7861336Z 2025-03-04T19:47:17.7861667Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:47:17.7862374Z and the text below is the list of opted in users. 2025-03-04T19:47:17.7862755Z 2025-03-04T19:47:17.7863157Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:47:17.7863844Z """ 2025-03-04T19:47:17.7864376Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:17.7865091Z return parse_settings_from_text(settings_text) 2025-03-04T19:47:17.7865466Z 2025-03-04T19:47:17.7865472Z 2025-03-04T19:47:17.7865705Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:47:17.7866233Z """ 2025-03-04T19:47:17.7866607Z Parse users from the rollout state. 2025-03-04T19:47:17.7866940Z 2025-03-04T19:47:17.7867095Z """ 2025-03-04T19:47:17.7867596Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:47:17.7868280Z return parse_user_opt_in_from_text(users_text) 2025-03-04T19:47:17.7868649Z 2025-03-04T19:47:17.7868655Z 2025-03-04T19:47:17.7869039Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:17.7869829Z """ 2025-03-04T19:47:17.7870215Z Check if a user is opted into an experiment 2025-03-04T19:47:17.7870713Z """ 2025-03-04T19:47:17.7871140Z return experiment_name in user_optins.get(user, []) 2025-03-04T19:47:17.7871530Z 2025-03-04T19:47:17.7871537Z 2025-03-04T19:47:17.7871929Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:47:17.7872775Z """ 2025-03-04T19:47:17.7873206Z Check if a user explicitly opted out of an experiment 2025-03-04T19:47:17.7873750Z """ 2025-03-04T19:47:17.7874222Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:47:17.7874863Z experiment_optout = "-" + experiment_name 2025-03-04T19:47:17.7875456Z if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:47:17.7876019Z return False 2025-03-04T19:47:17.7876260Z 2025-03-04T19:47:17.7876513Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:47:17.7877073Z log.warning( 2025-03-04T19:47:17.7877824Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:47:17.7878628Z ) 2025-03-04T19:47:17.7878832Z 2025-03-04T19:47:17.7878988Z return True 2025-03-04T19:47:17.7879321Z 2025-03-04T19:47:17.7879328Z 2025-03-04T19:47:17.7879495Z def get_runner_prefix( 2025-03-04T19:47:17.7879914Z rollout_state: str, 2025-03-04T19:47:17.7880348Z workflow_requestors: Iterable[str], 2025-03-04T19:47:17.7880827Z branch: str, 2025-03-04T19:47:17.7881287Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:47:17.7881852Z is_canary: bool = False, 2025-03-04T19:47:17.7882287Z ) -> str: 2025-03-04T19:47:17.7882679Z settings = parse_settings(rollout_state) 2025-03-04T19:47:17.7883218Z user_optins = parse_users(rollout_state) 2025-03-04T19:47:17.7883573Z 2025-03-04T19:47:17.7883733Z fleet_prefix = "" 2025-03-04T19:47:17.7884133Z prefixes = [] 2025-03-04T19:47:17.7884723Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:47:17.7885602Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:47:17.7886379Z log.info( 2025-03-04T19:47:17.7887015Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:47:17.7887731Z ) 2025-03-04T19:47:17.7888090Z continue 2025-03-04T19:47:17.7888324Z 2025-03-04T19:47:17.7888509Z if eligible_experiments: 2025-03-04T19:47:17.7889032Z if experiment_name not in eligible_experiments: 2025-03-04T19:47:17.7889724Z exp_list = ", ".join(eligible_experiments) 2025-03-04T19:47:17.7890258Z log.info( 2025-03-04T19:47:17.7890993Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:47:17.7891779Z ) 2025-03-04T19:47:17.7892155Z continue 2025-03-04T19:47:17.7892600Z elif not experiment_settings.default: 2025-03-04T19:47:17.7893101Z log.info( 2025-03-04T19:47:17.7893725Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:47:17.7894418Z ) 2025-03-04T19:47:17.7894770Z continue 2025-03-04T19:47:17.7894998Z 2025-03-04T19:47:17.7895263Z # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:47:17.7895844Z opted_out_users = [ 2025-03-04T19:47:17.7896270Z requestor 2025-03-04T19:47:17.7896693Z for requestor in workflow_requestors 2025-03-04T19:47:17.7897318Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:47:17.7897911Z ] 2025-03-04T19:47:17.7898101Z 2025-03-04T19:47:17.7898270Z if opted_out_users: 2025-03-04T19:47:17.7898718Z log.info( 2025-03-04T19:47:17.7899385Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:47:17.7900051Z ) 2025-03-04T19:47:17.7900410Z continue 2025-03-04T19:47:17.7900637Z 2025-03-04T19:47:17.7900894Z # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:47:17.7901471Z opted_in_users = [ 2025-03-04T19:47:17.7901893Z requestor 2025-03-04T19:47:17.7902457Z for requestor in workflow_requestors 2025-03-04T19:47:17.7903091Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:47:17.7903664Z ] 2025-03-04T19:47:17.7903860Z 2025-03-04T19:47:17.7904022Z enabled = False 2025-03-04T19:47:17.7904427Z if opted_in_users: 2025-03-04T19:47:17.7904847Z log.info( 2025-03-04T19:47:17.7905410Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:47:17.7906036Z ) 2025-03-04T19:47:17.7906405Z enabled = True 2025-03-04T19:47:17.7906670Z 2025-03-04T19:47:17.7906871Z elif experiment_settings.rollout_perc: 2025-03-04T19:47:17.7907652Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:47:17.7908523Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:47:17.7909137Z log.info( 2025-03-04T19:47:17.7910048Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:47:17.7910914Z ) 2025-03-04T19:47:17.7911298Z enabled = True 2025-03-04T19:47:17.7911578Z 2025-03-04T19:47:17.7911742Z if enabled: 2025-03-04T19:47:17.7912144Z label = experiment_name 2025-03-04T19:47:17.7912657Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:47:17.7913430Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:47:17.7914250Z # - If it's enabled, then we always list it's prefix first 2025-03-04T19:47:17.7915081Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:47:17.7915711Z if is_canary: 2025-03-04T19:47:17.7916172Z label += CANARY_FLEET_SUFFIX 2025-03-04T19:47:17.7916688Z fleet_prefix = label 2025-03-04T19:47:17.7916853Z else: 2025-03-04T19:47:17.7917036Z prefixes.append(label) 2025-03-04T19:47:17.7917043Z 2025-03-04T19:47:17.7917220Z if len(prefixes) > 1: 2025-03-04T19:47:17.7917377Z log.error( 2025-03-04T19:47:17.7918114Z 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-04T19:47:17.7918275Z ) 2025-03-04T19:47:17.7918450Z prefixes = prefixes[:1] 2025-03-04T19:47:17.7918457Z 2025-03-04T19:47:17.7918638Z # Fleet always comes first 2025-03-04T19:47:17.7918803Z if fleet_prefix: 2025-03-04T19:47:17.7918994Z prefixes.insert(0, fleet_prefix) 2025-03-04T19:47:17.7919000Z 2025-03-04T19:47:17.7919330Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:47:17.7919338Z 2025-03-04T19:47:17.7919344Z 2025-03-04T19:47:17.7919765Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:47:17.7919918Z """ 2025-03-04T19:47:17.7920290Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:47:17.7920298Z 2025-03-04T19:47:17.7920662Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:47:17.7920815Z """ 2025-03-04T19:47:17.7920999Z gh = get_gh_client(github_token) 2025-03-04T19:47:17.7921193Z issue = get_issue(gh, repo, issue_num) 2025-03-04T19:47:17.7921455Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:47:17.7921462Z 2025-03-04T19:47:17.7921468Z 2025-03-04T19:47:17.7921835Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:47:17.7922021Z for _ in range(num_retries): 2025-03-04T19:47:17.7922179Z try: 2025-03-04T19:47:17.7922378Z req = Request(url=url, headers=headers) 2025-03-04T19:47:17.7922655Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:47:17.7922958Z return json.loads(content) 2025-03-04T19:47:17.7923136Z except Exception as e: 2025-03-04T19:47:17.7923363Z log.warning(f"Could not download {url}: {e}") 2025-03-04T19:47:17.7923370Z 2025-03-04T19:47:17.7923720Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:47:17.7923876Z return {} 2025-03-04T19:47:17.7923883Z 2025-03-04T19:47:17.7923888Z 2025-03-04T19:47:17.7924035Z @cache 2025-03-04T19:47:17.7924437Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:47:17.7924586Z """ 2025-03-04T19:47:17.7924771Z Dynamically get PR information 2025-03-04T19:47:17.7924918Z """ 2025-03-04T19:47:17.7925223Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:47:17.7925399Z headers = { 2025-03-04T19:47:17.7925615Z "Accept": "application/vnd.github.v3+json", 2025-03-04T19:47:17.7925834Z "Authorization": f"token {github_token}", 2025-03-04T19:47:17.7925982Z } 2025-03-04T19:47:17.7926201Z json_response: dict[str, Any] = download_json( 2025-03-04T19:47:17.7926398Z url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:47:17.7926560Z headers=headers, 2025-03-04T19:47:17.7926714Z ) 2025-03-04T19:47:17.7926721Z 2025-03-04T19:47:17.7926888Z if not json_response: 2025-03-04T19:47:17.7927170Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:47:17.7927326Z return {} 2025-03-04T19:47:17.7927333Z 2025-03-04T19:47:17.7927502Z return json_response 2025-03-04T19:47:17.7927513Z 2025-03-04T19:47:17.7927520Z 2025-03-04T19:47:17.7927901Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:47:17.7928165Z """ 2025-03-04T19:47:17.7928482Z Dynamically get the latest list of labels from the pull request 2025-03-04T19:47:17.7928630Z """ 2025-03-04T19:47:17.7928903Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:47:17.7929065Z return { 2025-03-04T19:47:17.7929502Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:47:17.7929663Z } 2025-03-04T19:47:17.7929672Z 2025-03-04T19:47:17.7929677Z 2025-03-04T19:47:17.7929838Z def main() -> None: 2025-03-04T19:47:17.7930010Z args = parse_args() 2025-03-04T19:47:17.7930016Z 2025-03-04T19:47:17.7930225Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:47:17.7930232Z 2025-03-04T19:47:17.7930420Z # Check if the PR is opt-out 2025-03-04T19:47:17.7930585Z if args.pr_number: 2025-03-04T19:47:17.7930963Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:47:17.7931144Z if OPT_OUT_LABEL in labels: 2025-03-04T19:47:17.7931301Z log.info( 2025-03-04T19:47:17.7931721Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:47:17.7931876Z ) 2025-03-04T19:47:17.7932194Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:17.7932354Z sys.exit() 2025-03-04T19:47:17.7932360Z 2025-03-04T19:47:17.7932513Z try: 2025-03-04T19:47:17.7932734Z rollout_state = get_rollout_state_from_issue( 2025-03-04T19:47:17.7933025Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:47:17.7933183Z ) 2025-03-04T19:47:17.7933190Z 2025-03-04T19:47:17.7933381Z username = get_potential_pr_author( 2025-03-04T19:47:17.7933557Z args.github_token, 2025-03-04T19:47:17.7933726Z args.github_repo, 2025-03-04T19:47:17.7933894Z args.github_actor, 2025-03-04T19:47:17.7934082Z args.github_ref_type, 2025-03-04T19:47:17.7934259Z args.github_branch, 2025-03-04T19:47:17.7934423Z ) 2025-03-04T19:47:17.7934429Z 2025-03-04T19:47:17.7934698Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:47:17.7934845Z 2025-03-04T19:47:17.7935059Z runner_label_prefix = get_runner_prefix( 2025-03-04T19:47:17.7935224Z rollout_state, 2025-03-04T19:47:17.7935416Z (args.github_issue_owner, username), 2025-03-04T19:47:17.7935594Z args.github_branch, 2025-03-04T19:47:17.7935783Z args.eligible_experiments, 2025-03-04T19:47:17.7935948Z is_canary, 2025-03-04T19:47:17.7936094Z ) 2025-03-04T19:47:17.7936102Z 2025-03-04T19:47:17.7936281Z except Exception as e: 2025-03-04T19:47:17.7936436Z log.error( 2025-03-04T19:47:17.7936847Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:47:17.7937033Z ) 2025-03-04T19:47:17.7937040Z 2025-03-04T19:47:17.7937361Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:47:17.7937369Z 2025-03-04T19:47:17.7937374Z 2025-03-04T19:47:17.7937546Z if __name__ == "__main__": 2025-03-04T19:47:17.7937702Z main() 2025-03-04T19:47:17.7937709Z 2025-03-04T19:47:17.8022043Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:17.8022409Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:47:17.8067964Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:17.8068119Z env: 2025-03-04T19:47:17.8068549Z GITHUB_TOKEN: *** 2025-03-04T19:47:17.8068712Z ISSUE_NUMBER: 5132 2025-03-04T19:47:17.8068899Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:17.8069058Z ISSUE_OWNER: 2025-03-04T19:47:17.8069438Z CHECK_EXPERIMENTS: 2025-03-04T19:47:17.8069700Z PR_NUMBER: 2025-03-04T19:47:17.8069865Z ##[endgroup] 2025-03-04T19:47:18.1849668Z Defaulting to user installation because normal site-packages is not writeable 2025-03-04T19:47:18.5587752Z Collecting urllib3==1.26.18 2025-03-04T19:47:18.8150355Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-04T19:47:18.8437577Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.6 MB/s eta 0:00:00 2025-03-04T19:47:18.8654854Z Collecting PyGithub==2.3.0 2025-03-04T19:47:18.8796213Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-04T19:47:18.9225495Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-04T19:47:18.9372658Z 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-04T19:47:18.9425490Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-04T19:47:18.9445891Z 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-04T19:47:18.9462826Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-04T19:47:18.9713718Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-04T19:47:18.9872286Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-04T19:47:19.0119889Z 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-04T19:47:19.1232401Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:19.1375013Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-04T19:47:19.2432384Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-04T19:47:19.2581118Z 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-04T19:47:19.2837603Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:47:19.2979453Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-04T19:47:19.3328846Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-04T19:47:19.3503009Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.7 MB/s eta 0:00:00 2025-03-04T19:47:19.3645910Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-04T19:47:19.3826537Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 21.1 MB/s eta 0:00:00 2025-03-04T19:47:19.3975931Z 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-04T19:47:19.4232099Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 35.6 MB/s eta 0:00:00 2025-03-04T19:47:19.4376281Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-04T19:47:19.4543095Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-04T19:47:19.4630758Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 68.0 MB/s eta 0:00:00 2025-03-04T19:47:19.4773606Z 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-04T19:47:19.4817790Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 29.3 MB/s eta 0:00:00 2025-03-04T19:47:19.4958750Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-04T19:47:19.5006397Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 38.0 MB/s eta 0:00:00 2025-03-04T19:47:19.7894361Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-04T19:47:20.3219523Z 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-04T19:47:20.4156845Z ##[group]Run curr_branch="ciflow/inductor/148205" 2025-03-04T19:47:20.4157252Z curr_branch="ciflow/inductor/148205" 2025-03-04T19:47:20.4157547Z curr_ref_type="tag" 2025-03-04T19:47:20.4157813Z echo "Current branch is '$curr_branch'" 2025-03-04T19:47:20.4158077Z  2025-03-04T19:47:20.4158274Z python3 runner_determinator.py \ 2025-03-04T19:47:20.4158564Z  --github-token "$GITHUB_TOKEN" \ 2025-03-04T19:47:20.4158876Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-04T19:47:20.4159149Z  --github-branch "$curr_branch" \ 2025-03-04T19:47:20.4159647Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-04T19:47:20.4159941Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-04T19:47:20.4160230Z  --github-ref-type "$curr_ref_type" \ 2025-03-04T19:47:20.4160525Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-04T19:47:20.4160872Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-04T19:47:20.4161174Z  --pr-number "${PR_NUMBER}" 2025-03-04T19:47:20.4209114Z shell: /usr/bin/bash -e {0} 2025-03-04T19:47:20.4209530Z env: 2025-03-04T19:47:20.4210163Z GITHUB_TOKEN: *** 2025-03-04T19:47:20.4210372Z ISSUE_NUMBER: 5132 2025-03-04T19:47:20.4210589Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-03-04T19:47:20.4210839Z ISSUE_OWNER: 2025-03-04T19:47:20.4211029Z CHECK_EXPERIMENTS: 2025-03-04T19:47:20.4211221Z PR_NUMBER: 2025-03-04T19:47:20.4211429Z ##[endgroup] 2025-03-04T19:47:20.4281653Z Current branch is 'ciflow/inductor/148205' 2025-03-04T19:47:22.4432006Z INFO : Based on rollout percentage of 55%, enabling experiment lf. 2025-03-04T19:47:22.4433502Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-03-04T19:47:22.4434511Z INFO : Setting output: label-type='lf.' 2025-03-04T19:47:22.4839946Z Evaluate and set job outputs 2025-03-04T19:47:22.4847716Z Set output 'label-type' 2025-03-04T19:47:22.4849890Z Cleaning up orphan processes