2024-12-17T23:34:09.6034506Z Current runner version: '2.321.0' 2024-12-17T23:34:09.6057163Z ##[group]Operating System 2024-12-17T23:34:09.6057943Z Ubuntu 2024-12-17T23:34:09.6058436Z 22.04.5 2024-12-17T23:34:09.6059020Z LTS 2024-12-17T23:34:09.6059504Z ##[endgroup] 2024-12-17T23:34:09.6060028Z ##[group]Runner Image 2024-12-17T23:34:09.6060634Z Image: ubuntu-22.04 2024-12-17T23:34:09.6061165Z Version: 20241211.1.0 2024-12-17T23:34:09.6062174Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20241211.1/images/ubuntu/Ubuntu2204-Readme.md 2024-12-17T23:34:09.6063623Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20241211.1 2024-12-17T23:34:09.6064518Z ##[endgroup] 2024-12-17T23:34:09.6065020Z ##[group]Runner Image Provisioner 2024-12-17T23:34:09.6065661Z 2.0.404.1 2024-12-17T23:34:09.6066121Z ##[endgroup] 2024-12-17T23:34:09.6067138Z ##[group]GITHUB_TOKEN Permissions 2024-12-17T23:34:09.6068866Z Contents: read 2024-12-17T23:34:09.6069445Z Metadata: read 2024-12-17T23:34:09.6070183Z ##[endgroup] 2024-12-17T23:34:09.6072983Z Secret source: Actions 2024-12-17T23:34:09.6073805Z Prepare workflow directory 2024-12-17T23:34:09.6551608Z Prepare all required actions 2024-12-17T23:34:09.6605930Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/release/2.6 (0cdf8b1d09254cfda66191d1bd01e3041c3c76f7) 2024-12-17T23:34:09.6610608Z ##[group] Inputs 2024-12-17T23:34:09.6611215Z check_experiments: 2024-12-17T23:34:09.6611896Z triggering_actor: malfet 2024-12-17T23:34:09.6612470Z issue_owner: 2024-12-17T23:34:09.6612967Z curr_branch: release/2.6 2024-12-17T23:34:09.6613608Z curr_ref_type: branch 2024-12-17T23:34:09.6614144Z issue_number: 5132 2024-12-17T23:34:09.6614653Z ##[endgroup] 2024-12-17T23:34:09.6615396Z Complete job name: before-test / get-label-type / runner-determinator 2024-12-17T23:34:10.4950737Z ##[group]Run cat < runner_determinator.py 2024-12-17T23:34:10.4953077Z cat < runner_determinator.py 2024-12-17T23:34:10.4953745Z # flake8: noqa: G004 2024-12-17T23:34:10.4954425Z  2024-12-17T23:34:10.4955149Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2024-12-17T23:34:10.4956175Z # must be kept in sync. You can do it easily by running the following command: 2024-12-17T23:34:10.4957236Z # python .github/scripts/update_runner_determinator.py 2024-12-17T23:34:10.4957933Z  2024-12-17T23:34:10.4958601Z """ 2024-12-17T23:34:10.4959440Z This runner determinator is used to determine which set of runners to run a 2024-12-17T23:34:10.4960449Z GitHub job on. It uses the first comment of a GitHub issue (by default 2024-12-17T23:34:10.4961620Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2024-12-17T23:34:10.4962552Z of which runners should be used to run which job. 2024-12-17T23:34:10.4963214Z  2024-12-17T23:34:10.4963984Z The configuration has two parts, the settings and a list of opted-in users, 2024-12-17T23:34:10.4965027Z separated by a line containing "---". If the line is not present, the 2024-12-17T23:34:10.4966024Z settings are considered to be empty with only the second part, the user 2024-12-17T23:34:10.4966874Z list, defined. 2024-12-17T23:34:10.4967385Z  2024-12-17T23:34:10.4968055Z The first part is a YAML block that defines the rollout settings. This can be 2024-12-17T23:34:10.4969182Z used to define any settings that are needed to determine which runners to use. 2024-12-17T23:34:10.4970105Z It's fields are defined by the RolloutSettings class below. 2024-12-17T23:34:10.4970818Z  2024-12-17T23:34:10.4971563Z The second part is a list of users who are explicitly opted in to the LF fleet. 2024-12-17T23:34:10.4972523Z The user list is also a comma separated list of additional features or 2024-12-17T23:34:10.4973656Z experiments which the user could be opted in to. 2024-12-17T23:34:10.4974405Z  2024-12-17T23:34:10.4974887Z The user list has the following rules: 2024-12-17T23:34:10.4975503Z  2024-12-17T23:34:10.4976201Z - Users are GitHub usernames, which must start with the @ prefix 2024-12-17T23:34:10.4977180Z - Each user is also a comma-separated list of features/experiments to enable 2024-12-17T23:34:10.4978072Z - A "#" prefix opts the user out of all experiments 2024-12-17T23:34:10.4978816Z  2024-12-17T23:34:10.4979399Z Example config: 2024-12-17T23:34:10.4980010Z  # A list of experiments that can be opted into. 2024-12-17T23:34:10.4980914Z  # This defines the behavior they'll induce when opted into. 2024-12-17T23:34:10.4981656Z  # Expected syntax is: 2024-12-17T23:34:10.4982751Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2024-12-17T23:34:10.4983997Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2024-12-17T23:34:10.4984873Z  2024-12-17T23:34:10.4985406Z  experiments: 2024-12-17T23:34:10.4985927Z  lf: 2024-12-17T23:34:10.4986483Z  rollout_percent: 25 2024-12-17T23:34:10.4987140Z  all_branches: false 2024-12-17T23:34:10.4987717Z  default: true 2024-12-17T23:34:10.4988289Z  --- 2024-12-17T23:34:10.4988809Z  2024-12-17T23:34:10.4989249Z  # Opt-ins: 2024-12-17T23:34:10.4990001Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2024-12-17T23:34:10.4991236Z  # and specifying experiments to enable in a comma-separated list. 2024-12-17T23:34:10.4992140Z  # To always opt out of an experiment, prefix it with a "-". 2024-12-17T23:34:10.4992947Z  # Experiments should be from the above list. 2024-12-17T23:34:10.4993658Z  2024-12-17T23:34:10.4994131Z  @User1,-lf,split_build 2024-12-17T23:34:10.4994726Z  @User2,lf 2024-12-17T23:34:10.4995306Z  @User3,split_build 2024-12-17T23:34:10.4995864Z """ 2024-12-17T23:34:10.4996327Z  2024-12-17T23:34:10.4996830Z import json 2024-12-17T23:34:10.4997335Z import logging 2024-12-17T23:34:10.4997855Z import os 2024-12-17T23:34:10.4998728Z import random 2024-12-17T23:34:10.4999286Z import re 2024-12-17T23:34:10.4999775Z import sys 2024-12-17T23:34:10.5000381Z from argparse import ArgumentParser 2024-12-17T23:34:10.5001039Z from functools import lru_cache 2024-12-17T23:34:10.5001727Z from logging import LogRecord 2024-12-17T23:34:10.5002632Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2024-12-17T23:34:10.5003566Z from urllib.request import Request, urlopen 2024-12-17T23:34:10.5004179Z  2024-12-17T23:34:10.5004700Z import yaml 2024-12-17T23:34:10.5005250Z from github import Auth, Github 2024-12-17T23:34:10.5005848Z from github.Issue import Issue 2024-12-17T23:34:10.5006496Z  2024-12-17T23:34:10.5006953Z  2024-12-17T23:34:10.5007452Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2024-12-17T23:34:10.5008338Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2024-12-17T23:34:10.5009359Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2024-12-17T23:34:10.5010127Z  2024-12-17T23:34:10.5010729Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2024-12-17T23:34:10.5011446Z GH_OUTPUT_KEY_AMI = "runner-ami" 2024-12-17T23:34:10.5012076Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2024-12-17T23:34:10.5012815Z OPT_OUT_LABEL = "no-runner-experiments" 2024-12-17T23:34:10.5013724Z  2024-12-17T23:34:10.5014204Z SETTING_EXPERIMENTS = "experiments" 2024-12-17T23:34:10.5015143Z  2024-12-17T23:34:10.5015905Z LF_FLEET_EXPERIMENT = "lf" 2024-12-17T23:34:10.5016828Z CANARY_FLEET_SUFFIX = ".c" 2024-12-17T23:34:10.5017511Z  2024-12-17T23:34:10.5017992Z  2024-12-17T23:34:10.5018436Z class Experiment(NamedTuple): 2024-12-17T23:34:10.5019122Z  rollout_perc: float = ( 2024-12-17T23:34:10.5019932Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2024-12-17T23:34:10.5020698Z  ) 2024-12-17T23:34:10.5021286Z  all_branches: bool = ( 2024-12-17T23:34:10.5022087Z  False # If True, the experiment is also enabled on the exception branches 2024-12-17T23:34:10.5022848Z  ) 2024-12-17T23:34:10.5023485Z  default: bool = ( 2024-12-17T23:34:10.5024193Z  True # If True, the experiment is enabled by default for all queries 2024-12-17T23:34:10.5024923Z  ) 2024-12-17T23:34:10.5025567Z  2024-12-17T23:34:10.5026020Z  # Add more fields as needed 2024-12-17T23:34:10.5026589Z  2024-12-17T23:34:10.5027129Z  2024-12-17T23:34:10.5027565Z class Settings(NamedTuple): 2024-12-17T23:34:10.5028129Z  """ 2024-12-17T23:34:10.5028820Z  Settings for the experiments that can be opted into. 2024-12-17T23:34:10.5029471Z  """ 2024-12-17T23:34:10.5029925Z  2024-12-17T23:34:10.5030586Z  experiments: Dict[str, Experiment] = {} 2024-12-17T23:34:10.5031179Z  2024-12-17T23:34:10.5031611Z  2024-12-17T23:34:10.5032436Z class ColorFormatter(logging.Formatter): 2024-12-17T23:34:10.5033196Z  """Color codes the log messages based on the log level""" 2024-12-17T23:34:10.5033895Z  2024-12-17T23:34:10.5034444Z  COLORS = { 2024-12-17T23:34:10.5034961Z  "WARNING": "\033[33m", # Yellow 2024-12-17T23:34:10.5035600Z  "ERROR": "\033[31m", # Red 2024-12-17T23:34:10.5036299Z  "CRITICAL": "\033[31m", # Red 2024-12-17T23:34:10.5036895Z  "INFO": "\033[0m", # Reset 2024-12-17T23:34:10.5037514Z  "DEBUG": "\033[0m", # Reset 2024-12-17T23:34:10.5038447Z  } 2024-12-17T23:34:10.5038907Z  2024-12-17T23:34:10.5039436Z  def format(self, record: LogRecord) -> str: 2024-12-17T23:34:10.5040412Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2024-12-17T23:34:10.5041321Z  record.msg = f"{log_color}{record.msg}\033[0m" 2024-12-17T23:34:10.5041967Z  return super().format(record) 2024-12-17T23:34:10.5042655Z  2024-12-17T23:34:10.5043114Z  2024-12-17T23:34:10.5043562Z handler = logging.StreamHandler() 2024-12-17T23:34:10.5044499Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2024-12-17T23:34:10.5045337Z  2024-12-17T23:34:10.5045869Z log = logging.getLogger(os.path.basename(__file__)) 2024-12-17T23:34:10.5046651Z log.addHandler(handler) 2024-12-17T23:34:10.5047256Z log.setLevel(logging.INFO) 2024-12-17T23:34:10.5047808Z  2024-12-17T23:34:10.5048352Z  2024-12-17T23:34:10.5048922Z def set_github_output(key: str, value: str) -> None: 2024-12-17T23:34:10.5049558Z  """ 2024-12-17T23:34:10.5050293Z  Defines outputs of the github action that invokes this script 2024-12-17T23:34:10.5051032Z  """ 2024-12-17T23:34:10.5051486Z  if not GITHUB_OUTPUT: 2024-12-17T23:34:10.5052775Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2024-12-17T23:34:10.5054155Z  log.warning( 2024-12-17T23:34:10.5055222Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2024-12-17T23:34:10.5056219Z  ) 2024-12-17T23:34:10.5056817Z  print(f"::set-output name={key}::{value}") 2024-12-17T23:34:10.5057552Z  return 2024-12-17T23:34:10.5058041Z  2024-12-17T23:34:10.5058544Z  with open(GITHUB_OUTPUT, "a") as f: 2024-12-17T23:34:10.5059312Z  log.info(f"Setting output: {key}='{value}'") 2024-12-17T23:34:10.5059983Z  f.write(f"{key}={value}\n") 2024-12-17T23:34:10.5060579Z  2024-12-17T23:34:10.5061086Z  2024-12-17T23:34:10.5061688Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2024-12-17T23:34:10.5062442Z  return frozenset( 2024-12-17T23:34:10.5063262Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2024-12-17T23:34:10.5064055Z  ) 2024-12-17T23:34:10.5064519Z  2024-12-17T23:34:10.5065001Z  2024-12-17T23:34:10.5065486Z def parse_args() -> Any: 2024-12-17T23:34:10.5066175Z  parser = ArgumentParser("Get dynamic rollout settings") 2024-12-17T23:34:10.5067205Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2024-12-17T23:34:10.5068091Z  parser.add_argument( 2024-12-17T23:34:10.5068662Z  "--github-issue-repo", 2024-12-17T23:34:10.5069301Z  type=str, 2024-12-17T23:34:10.5069859Z  required=False, 2024-12-17T23:34:10.5070585Z  default="pytorch/test-infra", 2024-12-17T23:34:10.5071325Z  help="GitHub repo to get the issue", 2024-12-17T23:34:10.5072002Z  ) 2024-12-17T23:34:10.5072465Z  parser.add_argument( 2024-12-17T23:34:10.5073089Z  "--github-repo", 2024-12-17T23:34:10.5073686Z  type=str, 2024-12-17T23:34:10.5074190Z  required=True, 2024-12-17T23:34:10.5074843Z  help="GitHub repo where CI is running", 2024-12-17T23:34:10.5075510Z  ) 2024-12-17T23:34:10.5075963Z  parser.add_argument( 2024-12-17T23:34:10.5076771Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2024-12-17T23:34:10.5077584Z  ) 2024-12-17T23:34:10.5078067Z  parser.add_argument( 2024-12-17T23:34:10.5079183Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2024-12-17T23:34:10.5080083Z  ) 2024-12-17T23:34:10.5080581Z  parser.add_argument( 2024-12-17T23:34:10.5081404Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2024-12-17T23:34:10.5082309Z  ) 2024-12-17T23:34:10.5082794Z  parser.add_argument( 2024-12-17T23:34:10.5083656Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2024-12-17T23:34:10.5084484Z  ) 2024-12-17T23:34:10.5084972Z  parser.add_argument( 2024-12-17T23:34:10.5085583Z  "--github-ref-type", 2024-12-17T23:34:10.5086182Z  type=str, 2024-12-17T23:34:10.5086729Z  required=True, 2024-12-17T23:34:10.5087383Z  help="Current GitHub ref type, branch or tag", 2024-12-17T23:34:10.5088083Z  ) 2024-12-17T23:34:10.5088588Z  parser.add_argument( 2024-12-17T23:34:10.5089192Z  "--eligible-experiments", 2024-12-17T23:34:10.5089860Z  type=_str_comma_separated_to_set, 2024-12-17T23:34:10.5090506Z  required=False, 2024-12-17T23:34:10.5091121Z  default="", 2024-12-17T23:34:10.5092261Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2024-12-17T23:34:10.5093292Z  ) 2024-12-17T23:34:10.5093858Z  parser.add_argument( 2024-12-17T23:34:10.5094419Z  "--pr-number", 2024-12-17T23:34:10.5094969Z  type=str, 2024-12-17T23:34:10.5095577Z  required=False, 2024-12-17T23:34:10.5096119Z  default="", 2024-12-17T23:34:10.5096745Z  help="the optional PR number where this is run", 2024-12-17T23:34:10.5097473Z  ) 2024-12-17T23:34:10.5097923Z  2024-12-17T23:34:10.5098402Z  return parser.parse_args() 2024-12-17T23:34:10.5099053Z  2024-12-17T23:34:10.5099482Z  2024-12-17T23:34:10.5100018Z def get_gh_client(github_token: str) -> Github: 2024-12-17T23:34:10.5100794Z  auth = Auth.Token(github_token) 2024-12-17T23:34:10.5101429Z  return Github(auth=auth) 2024-12-17T23:34:10.5101990Z  2024-12-17T23:34:10.5102519Z  2024-12-17T23:34:10.5103102Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2024-12-17T23:34:10.5103850Z  repo = gh.get_repo(repo) 2024-12-17T23:34:10.5104561Z  return repo.get_issue(number=issue_num) 2024-12-17T23:34:10.5105153Z  2024-12-17T23:34:10.5105594Z  2024-12-17T23:34:10.5106131Z def get_potential_pr_author( 2024-12-17T23:34:10.5106882Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2024-12-17T23:34:10.5107669Z ) -> str: 2024-12-17T23:34:10.5108406Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2024-12-17T23:34:10.5109468Z  # Fetch the actual username from the original PR. The PR number is 2024-12-17T23:34:10.5110331Z  # embedded in the tag name: ciflow// 2024-12-17T23:34:10.5111261Z  2024-12-17T23:34:10.5111728Z  gh = get_gh_client(github_token) 2024-12-17T23:34:10.5112338Z  2024-12-17T23:34:10.5112997Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2024-12-17T23:34:10.5113726Z  split_tag = ref_name.split("/") 2024-12-17T23:34:10.5114322Z  if ( 2024-12-17T23:34:10.5114913Z  len(split_tag) == 3 2024-12-17T23:34:10.5115518Z  and split_tag[0] == "ciflow" 2024-12-17T23:34:10.5116158Z  and split_tag[2].isnumeric() 2024-12-17T23:34:10.5116836Z  ): 2024-12-17T23:34:10.5117342Z  pr_number = split_tag[2] 2024-12-17T23:34:10.5117943Z  try: 2024-12-17T23:34:10.5118756Z  repository = gh.get_repo(repo) 2024-12-17T23:34:10.5119487Z  pull = repository.get_pull(number=int(pr_number)) 2024-12-17T23:34:10.5120206Z  except Exception as e: 2024-12-17T23:34:10.5120964Z  raise Exception( # noqa: TRY002 2024-12-17T23:34:10.5121759Z  f"issue with pull request {pr_number} from repo {repository}" 2024-12-17T23:34:10.5122461Z  ) from e 2024-12-17T23:34:10.5123152Z  return pull.user.login 2024-12-17T23:34:10.5123868Z  # In all other cases, return the original input username 2024-12-17T23:34:10.5124521Z  return username 2024-12-17T23:34:10.5125146Z  2024-12-17T23:34:10.5125606Z  2024-12-17T23:34:10.5126085Z def is_exception_branch(branch: str) -> bool: 2024-12-17T23:34:10.5126823Z  """ 2024-12-17T23:34:10.5127607Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2024-12-17T23:34:10.5128421Z  """ 2024-12-17T23:34:10.5129177Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2024-12-17T23:34:10.5130109Z  2024-12-17T23:34:10.5130515Z  2024-12-17T23:34:10.5131087Z def load_yaml(yaml_text: str) -> Any: 2024-12-17T23:34:10.5131700Z  try: 2024-12-17T23:34:10.5132183Z  data = yaml.safe_load(yaml_text) 2024-12-17T23:34:10.5132873Z  return data 2024-12-17T23:34:10.5133445Z  except yaml.YAMLError: 2024-12-17T23:34:10.5134130Z  log.exception("Error loading YAML") 2024-12-17T23:34:10.5134735Z  raise 2024-12-17T23:34:10.5135242Z  2024-12-17T23:34:10.5135721Z  2024-12-17T23:34:10.5136430Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2024-12-17T23:34:10.5137290Z  """ 2024-12-17T23:34:10.5138090Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2024-12-17T23:34:10.5138921Z  2024-12-17T23:34:10.5139580Z  If the issue body contains "---" then the text above that is the settings 2024-12-17T23:34:10.5140489Z  and the text below is the list of opted in users. 2024-12-17T23:34:10.5141129Z  2024-12-17T23:34:10.5141832Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2024-12-17T23:34:10.5142661Z  """ 2024-12-17T23:34:10.5143232Z  rollout_state_parts = rollout_state.split("---") 2024-12-17T23:34:10.5143947Z  if len(rollout_state_parts) >= 2: 2024-12-17T23:34:10.5144722Z  return rollout_state_parts[0], rollout_state_parts[1] 2024-12-17T23:34:10.5145454Z  else: 2024-12-17T23:34:10.5146063Z  return "", rollout_state 2024-12-17T23:34:10.5146694Z  2024-12-17T23:34:10.5147156Z  2024-12-17T23:34:10.5147618Z class UserOptins(Dict[str, List[str]]): 2024-12-17T23:34:10.5148279Z  """ 2024-12-17T23:34:10.5148977Z  Dictionary of users with a list of features they have opted into 2024-12-17T23:34:10.5149681Z  """ 2024-12-17T23:34:10.5150175Z  2024-12-17T23:34:10.5150635Z  2024-12-17T23:34:10.5151228Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2024-12-17T23:34:10.5152032Z  """ 2024-12-17T23:34:10.5152874Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2024-12-17T23:34:10.5153751Z  2024-12-17T23:34:10.5154706Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2024-12-17T23:34:10.5155823Z  - Example line: "@User1,lf,split_build" 2024-12-17T23:34:10.5156616Z  - A "#" prefix indicates the user is opted out of all experiments 2024-12-17T23:34:10.5157372Z  2024-12-17T23:34:10.5157839Z  2024-12-17T23:34:10.5158538Z  """ 2024-12-17T23:34:10.5159110Z  optins = UserOptins() 2024-12-17T23:34:10.5159768Z  for user in user_optin_text.split("\n"): 2024-12-17T23:34:10.5160447Z  user = user.strip("\r\n\t -") 2024-12-17T23:34:10.5161132Z  if not user or not user.startswith("@"): 2024-12-17T23:34:10.5161808Z  # Not a valid user. Skip 2024-12-17T23:34:10.5162420Z  continue 2024-12-17T23:34:10.5162950Z  2024-12-17T23:34:10.5163408Z  if user: 2024-12-17T23:34:10.5164001Z  usr_name = user.split(",")[0].strip("@") 2024-12-17T23:34:10.5164841Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2024-12-17T23:34:10.5165622Z  2024-12-17T23:34:10.5166084Z  return optins 2024-12-17T23:34:10.5166609Z  2024-12-17T23:34:10.5167256Z  2024-12-17T23:34:10.5167863Z def is_valid_experiment_name(experiment_name: str) -> bool: 2024-12-17T23:34:10.5168600Z  """ 2024-12-17T23:34:10.5169168Z  Check if the experiment name is valid. 2024-12-17T23:34:10.5169793Z  A valid name: 2024-12-17T23:34:10.5170585Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2024-12-17T23:34:10.5171642Z  - The special characters "_" & "-" shouldn't be the first or last characters 2024-12-17T23:34:10.5172440Z  - Cannot contain spaces 2024-12-17T23:34:10.5173102Z  """ 2024-12-17T23:34:10.5173529Z  2024-12-17T23:34:10.5174090Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2024-12-17T23:34:10.5175005Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2024-12-17T23:34:10.5175678Z  2024-12-17T23:34:10.5176121Z  if valid: 2024-12-17T23:34:10.5176704Z  return True 2024-12-17T23:34:10.5177187Z  2024-12-17T23:34:10.5177632Z  log.error( 2024-12-17T23:34:10.5179231Z  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." 2024-12-17T23:34:10.5180820Z  ) 2024-12-17T23:34:10.5181257Z  return False 2024-12-17T23:34:10.5181854Z  2024-12-17T23:34:10.5182290Z  2024-12-17T23:34:10.5182866Z def parse_settings_from_text(settings_text: str) -> Settings: 2024-12-17T23:34:10.5183677Z  """ 2024-12-17T23:34:10.5184528Z  Parse the experiments from the issue body into a list of ExperimentSettings 2024-12-17T23:34:10.5185334Z  """ 2024-12-17T23:34:10.5185867Z  try: 2024-12-17T23:34:10.5186342Z  if settings_text: 2024-12-17T23:34:10.5187183Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2024-12-17T23:34:10.5188124Z  # for easy reading 2024-12-17T23:34:10.5189054Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2024-12-17T23:34:10.5190004Z  # the backtick character in shell commands. 2024-12-17T23:34:10.5190781Z  backtick = chr(96) # backtick character 2024-12-17T23:34:10.5191574Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2024-12-17T23:34:10.5192322Z  settings = load_yaml(settings_text) 2024-12-17T23:34:10.5192971Z  2024-12-17T23:34:10.5193686Z  # For now we just load experiments. We can expand this if/when we add more settings 2024-12-17T23:34:10.5194496Z  experiments = {} 2024-12-17T23:34:10.5195094Z  2024-12-17T23:34:10.5195776Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2024-12-17T23:34:10.5196619Z  if not is_valid_experiment_name(exp_name): 2024-12-17T23:34:10.5197898Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2024-12-17T23:34:10.5199332Z  continue 2024-12-17T23:34:10.5199894Z  2024-12-17T23:34:10.5200469Z  valid_settings = {} 2024-12-17T23:34:10.5201069Z  for setting in exp_settings: 2024-12-17T23:34:10.5201764Z  if setting not in Experiment._fields: 2024-12-17T23:34:10.5202522Z  log.warning( 2024-12-17T23:34:10.5203309Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2024-12-17T23:34:10.5204564Z  ) 2024-12-17T23:34:10.5205218Z  else: 2024-12-17T23:34:10.5205866Z  valid_settings[setting] = exp_settings[setting] 2024-12-17T23:34:10.5206487Z  2024-12-17T23:34:10.5207151Z  experiments[exp_name] = Experiment(**valid_settings) 2024-12-17T23:34:10.5207905Z  return Settings(experiments) 2024-12-17T23:34:10.5208475Z  2024-12-17T23:34:10.5209007Z  except Exception: 2024-12-17T23:34:10.5209621Z  log.exception("Failed to parse settings") 2024-12-17T23:34:10.5210223Z  2024-12-17T23:34:10.5210743Z  return Settings() 2024-12-17T23:34:10.5211271Z  2024-12-17T23:34:10.5211667Z  2024-12-17T23:34:10.5212300Z def parse_settings(rollout_state: str) -> Settings: 2024-12-17T23:34:10.5212986Z  """ 2024-12-17T23:34:10.5213497Z  Parse settings, if any, from the rollout state. 2024-12-17T23:34:10.5214215Z  2024-12-17T23:34:10.5214878Z  If the issue body contains "---" then the text above that is the settings 2024-12-17T23:34:10.5215697Z  and the text below is the list of opted in users. 2024-12-17T23:34:10.5216423Z  2024-12-17T23:34:10.5217134Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2024-12-17T23:34:10.5217998Z  """ 2024-12-17T23:34:10.5218662Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:34:10.5219550Z  return parse_settings_from_text(settings_text) 2024-12-17T23:34:10.5220237Z  2024-12-17T23:34:10.5220813Z  2024-12-17T23:34:10.5221374Z def parse_users(rollout_state: str) -> UserOptins: 2024-12-17T23:34:10.5222088Z  """ 2024-12-17T23:34:10.5222613Z  Parse users from the rollout state. 2024-12-17T23:34:10.5223224Z  2024-12-17T23:34:10.5223701Z  """ 2024-12-17T23:34:10.5224357Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:34:10.5225205Z  return parse_user_opt_in_from_text(users_text) 2024-12-17T23:34:10.5225893Z  2024-12-17T23:34:10.5226319Z  2024-12-17T23:34:10.5227038Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:34:10.5227906Z  """ 2024-12-17T23:34:10.5228451Z  Check if a user is opted into an experiment 2024-12-17T23:34:10.5229081Z  """ 2024-12-17T23:34:10.5229728Z  return experiment_name in user_optins.get(user, []) 2024-12-17T23:34:10.5230389Z  2024-12-17T23:34:10.5230817Z  2024-12-17T23:34:10.5231587Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:34:10.5232449Z  """ 2024-12-17T23:34:10.5232997Z  Check if a user explicitly opted out of an experiment 2024-12-17T23:34:10.5233726Z  """ 2024-12-17T23:34:10.5234376Z  # if the experiment is prefixed with a "-", then it's an opt-out 2024-12-17T23:34:10.5235136Z  experiment_optout = "-" + experiment_name 2024-12-17T23:34:10.5235966Z  if experiment_optout not in user_optins.get(user, []): 2024-12-17T23:34:10.5236679Z  return False 2024-12-17T23:34:10.5237155Z  2024-12-17T23:34:10.5237764Z  if is_user_opted_in(user, user_optins, experiment_name): 2024-12-17T23:34:10.5238795Z  log.warning( 2024-12-17T23:34:10.5239732Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2024-12-17T23:34:10.5240745Z  ) 2024-12-17T23:34:10.5241241Z  2024-12-17T23:34:10.5241841Z  return True 2024-12-17T23:34:10.5242500Z  2024-12-17T23:34:10.5242981Z  2024-12-17T23:34:10.5243395Z def get_runner_prefix( 2024-12-17T23:34:10.5244004Z  rollout_state: str, 2024-12-17T23:34:10.5244633Z  workflow_requestors: Iterable[str], 2024-12-17T23:34:10.5245248Z  branch: str, 2024-12-17T23:34:10.5245909Z  eligible_experiments: FrozenSet[str] = frozenset(), 2024-12-17T23:34:10.5246640Z  is_canary: bool = False, 2024-12-17T23:34:10.5247203Z ) -> str: 2024-12-17T23:34:10.5247758Z  settings = parse_settings(rollout_state) 2024-12-17T23:34:10.5248486Z  user_optins = parse_users(rollout_state) 2024-12-17T23:34:10.5249102Z  2024-12-17T23:34:10.5249565Z  fleet_prefix = "" 2024-12-17T23:34:10.5250144Z  prefixes = [] 2024-12-17T23:34:10.5250906Z  for experiment_name, experiment_settings in settings.experiments.items(): 2024-12-17T23:34:10.5251969Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2024-12-17T23:34:10.5252806Z  log.info( 2024-12-17T23:34:10.5253613Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2024-12-17T23:34:10.5254522Z  ) 2024-12-17T23:34:10.5254992Z  continue 2024-12-17T23:34:10.5255505Z  2024-12-17T23:34:10.5256042Z  if eligible_experiments: 2024-12-17T23:34:10.5256696Z  if experiment_name not in eligible_experiments: 2024-12-17T23:34:10.5257422Z  exp_list = ", ".join(eligible_experiments) 2024-12-17T23:34:10.5258284Z  log.info( 2024-12-17T23:34:10.5259173Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2024-12-17T23:34:10.5260110Z  ) 2024-12-17T23:34:10.5260705Z  continue 2024-12-17T23:34:10.5261278Z  elif not experiment_settings.default: 2024-12-17T23:34:10.5261928Z  log.info( 2024-12-17T23:34:10.5262772Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2024-12-17T23:34:10.5263586Z  ) 2024-12-17T23:34:10.5264063Z  continue 2024-12-17T23:34:10.5264635Z  2024-12-17T23:34:10.5265212Z  # Is any workflow_requestor opted out to this experiment? 2024-12-17T23:34:10.5265899Z  opted_out_users = [ 2024-12-17T23:34:10.5266532Z  requestor 2024-12-17T23:34:10.5267146Z  for requestor in workflow_requestors 2024-12-17T23:34:10.5267892Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2024-12-17T23:34:10.5268676Z  ] 2024-12-17T23:34:10.5269173Z  2024-12-17T23:34:10.5269595Z  if opted_out_users: 2024-12-17T23:34:10.5270243Z  log.info( 2024-12-17T23:34:10.5271017Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2024-12-17T23:34:10.5271758Z  ) 2024-12-17T23:34:10.5272313Z  continue 2024-12-17T23:34:10.5272848Z  2024-12-17T23:34:10.5273374Z  # Is any workflow_requestor opted in to this experiment? 2024-12-17T23:34:10.5274140Z  opted_in_users = [ 2024-12-17T23:34:10.5274719Z  requestor 2024-12-17T23:34:10.5275273Z  for requestor in workflow_requestors 2024-12-17T23:34:10.5276157Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2024-12-17T23:34:10.5276884Z  ] 2024-12-17T23:34:10.5277332Z  2024-12-17T23:34:10.5278013Z  enabled = False 2024-12-17T23:34:10.5279098Z  if opted_in_users: 2024-12-17T23:34:10.5279655Z  log.info( 2024-12-17T23:34:10.5280472Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2024-12-17T23:34:10.5281235Z  ) 2024-12-17T23:34:10.5281739Z  enabled = True 2024-12-17T23:34:10.5282338Z  2024-12-17T23:34:10.5282842Z  elif experiment_settings.rollout_perc: 2024-12-17T23:34:10.5283774Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2024-12-17T23:34:10.5284930Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2024-12-17T23:34:10.5285639Z  log.info( 2024-12-17T23:34:10.5286676Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2024-12-17T23:34:10.5287683Z  ) 2024-12-17T23:34:10.5288192Z  enabled = True 2024-12-17T23:34:10.5288801Z  2024-12-17T23:34:10.5289261Z  if enabled: 2024-12-17T23:34:10.5289795Z  label = experiment_name 2024-12-17T23:34:10.5290502Z  if experiment_name == LF_FLEET_EXPERIMENT: 2024-12-17T23:34:10.5291437Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2024-12-17T23:34:10.5292417Z  # - If it's enabled, then we always list it's prefix first 2024-12-17T23:34:10.5293446Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2024-12-17T23:34:10.5294267Z  if is_canary: 2024-12-17T23:34:10.5294883Z  label += CANARY_FLEET_SUFFIX 2024-12-17T23:34:10.5295554Z  fleet_prefix = label 2024-12-17T23:34:10.5296179Z  else: 2024-12-17T23:34:10.5296730Z  prefixes.append(label) 2024-12-17T23:34:10.5297328Z  2024-12-17T23:34:10.5297812Z  if len(prefixes) > 1: 2024-12-17T23:34:10.5298376Z  log.error( 2024-12-17T23:34:10.5299517Z  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:])}" 2024-12-17T23:34:10.5300712Z  ) 2024-12-17T23:34:10.5301241Z  prefixes = prefixes[:1] 2024-12-17T23:34:10.5301905Z  2024-12-17T23:34:10.5302338Z  # Fleet always comes first 2024-12-17T23:34:10.5302936Z  if fleet_prefix: 2024-12-17T23:34:10.5303589Z  prefixes.insert(0, fleet_prefix) 2024-12-17T23:34:10.5304158Z  2024-12-17T23:34:10.5304756Z  return ".".join(prefixes) + "." if prefixes else "" 2024-12-17T23:34:10.5305549Z  2024-12-17T23:34:10.5306013Z  2024-12-17T23:34:10.5306791Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2024-12-17T23:34:10.5307780Z  """ 2024-12-17T23:34:10.5308491Z  Gets the first comment of the issue, which contains the desired rollout state. 2024-12-17T23:34:10.5309334Z  2024-12-17T23:34:10.5310138Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2024-12-17T23:34:10.5310886Z  """ 2024-12-17T23:34:10.5311402Z  gh = get_gh_client(github_token) 2024-12-17T23:34:10.5312115Z  issue = get_issue(gh, repo, issue_num) 2024-12-17T23:34:10.5312840Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2024-12-17T23:34:10.5313537Z  2024-12-17T23:34:10.5314025Z  2024-12-17T23:34:10.5314713Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2024-12-17T23:34:10.5315710Z  for _ in range(num_retries): 2024-12-17T23:34:10.5316367Z  try: 2024-12-17T23:34:10.5316935Z  req = Request(url=url, headers=headers) 2024-12-17T23:34:10.5317660Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2024-12-17T23:34:10.5318820Z  return json.loads(content) 2024-12-17T23:34:10.5319548Z  except Exception as e: 2024-12-17T23:34:10.5320189Z  log.warning(f"Could not download {url}: {e}") 2024-12-17T23:34:10.5320930Z  2024-12-17T23:34:10.5321624Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2024-12-17T23:34:10.5322399Z  return {} 2024-12-17T23:34:10.5322951Z  2024-12-17T23:34:10.5323404Z  2024-12-17T23:34:10.5323817Z @lru_cache(maxsize=None) 2024-12-17T23:34:10.5324711Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2024-12-17T23:34:10.5325556Z  """ 2024-12-17T23:34:10.5326059Z  Dynamically get PR information 2024-12-17T23:34:10.5326707Z  """ 2024-12-17T23:34:10.5327317Z  github_api = f"https://api.github.com/repos/{github_repo}" 2024-12-17T23:34:10.5328015Z  headers = { 2024-12-17T23:34:10.5328663Z  "Accept": "application/vnd.github.v3+json", 2024-12-17T23:34:10.5329379Z  "Authorization": f"token {github_token}", 2024-12-17T23:34:10.5329991Z  } 2024-12-17T23:34:10.5330603Z  json_response: Dict[str, Any] = download_json( 2024-12-17T23:34:10.5331487Z  url=f"{github_api}/issues/{pr_number}", 2024-12-17T23:34:10.5332145Z  headers=headers, 2024-12-17T23:34:10.5332749Z  ) 2024-12-17T23:34:10.5333215Z  2024-12-17T23:34:10.5333678Z  if not json_response: 2024-12-17T23:34:10.5334422Z  log.warning(f"Failed to get the labels for #{pr_number}") 2024-12-17T23:34:10.5335140Z  return {} 2024-12-17T23:34:10.5335653Z  2024-12-17T23:34:10.5336145Z  return json_response 2024-12-17T23:34:10.5336695Z  2024-12-17T23:34:10.5337128Z  2024-12-17T23:34:10.5337854Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2024-12-17T23:34:10.5338660Z  """ 2024-12-17T23:34:10.5339309Z  Dynamically get the latest list of labels from the pull request 2024-12-17T23:34:10.5340121Z  """ 2024-12-17T23:34:10.5340718Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2024-12-17T23:34:10.5341406Z  return { 2024-12-17T23:34:10.5342182Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2024-12-17T23:34:10.5342932Z  } 2024-12-17T23:34:10.5343367Z  2024-12-17T23:34:10.5343872Z  2024-12-17T23:34:10.5344303Z def main() -> None: 2024-12-17T23:34:10.5344825Z  args = parse_args() 2024-12-17T23:34:10.5345433Z  2024-12-17T23:34:10.5345931Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2024-12-17T23:34:10.5346541Z  2024-12-17T23:34:10.5347101Z  # Check if the PR is opt-out 2024-12-17T23:34:10.5347682Z  if args.pr_number: 2024-12-17T23:34:10.5348451Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2024-12-17T23:34:10.5349385Z  if OPT_OUT_LABEL in labels: 2024-12-17T23:34:10.5349957Z  log.info( 2024-12-17T23:34:10.5350755Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2024-12-17T23:34:10.5351695Z  ) 2024-12-17T23:34:10.5352532Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:34:10.5353241Z  sys.exit() 2024-12-17T23:34:10.5353875Z  2024-12-17T23:34:10.5354314Z  try: 2024-12-17T23:34:10.5354810Z  rollout_state = get_rollout_state_from_issue( 2024-12-17T23:34:10.5355728Z  args.github_token, args.github_issue_repo, args.github_issue 2024-12-17T23:34:10.5356460Z  ) 2024-12-17T23:34:10.5356892Z  2024-12-17T23:34:10.5357477Z  username = get_potential_pr_author( 2024-12-17T23:34:10.5358113Z  args.github_token, 2024-12-17T23:34:10.5359338Z  args.github_repo, 2024-12-17T23:34:10.5360037Z  args.github_actor, 2024-12-17T23:34:10.5360645Z  args.github_ref_type, 2024-12-17T23:34:10.5361218Z  args.github_branch, 2024-12-17T23:34:10.5361868Z  ) 2024-12-17T23:34:10.5362359Z  2024-12-17T23:34:10.5362887Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2024-12-17T23:34:10.5363670Z  2024-12-17T23:34:10.5364203Z  runner_label_prefix = get_runner_prefix( 2024-12-17T23:34:10.5364794Z  rollout_state, 2024-12-17T23:34:10.5365487Z  (args.github_issue_owner, username), 2024-12-17T23:34:10.5366153Z  args.github_branch, 2024-12-17T23:34:10.5366821Z  args.eligible_experiments, 2024-12-17T23:34:10.5367415Z  is_canary, 2024-12-17T23:34:10.5367966Z  ) 2024-12-17T23:34:10.5368469Z  2024-12-17T23:34:10.5368910Z  except Exception as e: 2024-12-17T23:34:10.5369647Z  log.error( 2024-12-17T23:34:10.5370638Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2024-12-17T23:34:10.5371492Z  ) 2024-12-17T23:34:10.5371958Z  2024-12-17T23:34:10.5372619Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:34:10.5373359Z  2024-12-17T23:34:10.5373790Z  2024-12-17T23:34:10.5374291Z if __name__ == "__main__": 2024-12-17T23:34:10.5374845Z  main() 2024-12-17T23:34:10.5375326Z  2024-12-17T23:34:10.5375823Z EOF 2024-12-17T23:34:10.5376249Z  2024-12-17T23:34:10.5376709Z cat runner_determinator.py 2024-12-17T23:34:10.5924874Z shell: /usr/bin/bash -e {0} 2024-12-17T23:34:10.5925932Z env: 2024-12-17T23:34:10.5926706Z GITHUB_TOKEN: *** 2024-12-17T23:34:10.5927201Z ISSUE_NUMBER: 5132 2024-12-17T23:34:10.5927857Z TRIGGERING_ACTOR: malfet 2024-12-17T23:34:10.5928360Z ISSUE_OWNER: 2024-12-17T23:34:10.5928821Z CHECK_EXPERIMENTS: 2024-12-17T23:34:10.5929424Z PR_NUMBER: 2024-12-17T23:34:10.5929854Z ##[endgroup] 2024-12-17T23:34:10.6161839Z # flake8: noqa: G004 2024-12-17T23:34:10.6162301Z 2024-12-17T23:34:10.6162767Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2024-12-17T23:34:10.6163835Z # must be kept in sync. You can do it easily by running the following command: 2024-12-17T23:34:10.6164860Z # python .github/scripts/update_runner_determinator.py 2024-12-17T23:34:10.6165435Z 2024-12-17T23:34:10.6165621Z """ 2024-12-17T23:34:10.6166325Z This runner determinator is used to determine which set of runners to run a 2024-12-17T23:34:10.6167398Z GitHub job on. It uses the first comment of a GitHub issue (by default 2024-12-17T23:34:10.6168377Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2024-12-17T23:34:10.6169314Z of which runners should be used to run which job. 2024-12-17T23:34:10.6169853Z 2024-12-17T23:34:10.6170301Z The configuration has two parts, the settings and a list of opted-in users, 2024-12-17T23:34:10.6171271Z separated by a line containing "---". If the line is not present, the 2024-12-17T23:34:10.6172515Z settings are considered to be empty with only the second part, the user 2024-12-17T23:34:10.6173420Z list, defined. 2024-12-17T23:34:10.6173724Z 2024-12-17T23:34:10.6174120Z The first part is a YAML block that defines the rollout settings. This can be 2024-12-17T23:34:10.6175116Z used to define any settings that are needed to determine which runners to use. 2024-12-17T23:34:10.6176153Z It's fields are defined by the RolloutSettings class below. 2024-12-17T23:34:10.6176664Z 2024-12-17T23:34:10.6177102Z The second part is a list of users who are explicitly opted in to the LF fleet. 2024-12-17T23:34:10.6178028Z The user list is also a comma separated list of additional features or 2024-12-17T23:34:10.6178970Z experiments which the user could be opted in to. 2024-12-17T23:34:10.6179459Z 2024-12-17T23:34:10.6179713Z The user list has the following rules: 2024-12-17T23:34:10.6180135Z 2024-12-17T23:34:10.6180447Z - Users are GitHub usernames, which must start with the @ prefix 2024-12-17T23:34:10.6181530Z - Each user is also a comma-separated list of features/experiments to enable 2024-12-17T23:34:10.6182420Z - A "#" prefix opts the user out of all experiments 2024-12-17T23:34:10.6182883Z 2024-12-17T23:34:10.6183171Z Example config: 2024-12-17T23:34:10.6183763Z # A list of experiments that can be opted into. 2024-12-17T23:34:10.6184568Z # This defines the behavior they'll induce when opted into. 2024-12-17T23:34:10.6185371Z # Expected syntax is: 2024-12-17T23:34:10.6186177Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2024-12-17T23:34:10.6187262Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2024-12-17T23:34:10.6187932Z 2024-12-17T23:34:10.6188374Z experiments: 2024-12-17T23:34:10.6188921Z lf: 2024-12-17T23:34:10.6189431Z rollout_percent: 25 2024-12-17T23:34:10.6190089Z all_branches: false 2024-12-17T23:34:10.6190656Z default: true 2024-12-17T23:34:10.6191201Z --- 2024-12-17T23:34:10.6191492Z 2024-12-17T23:34:10.6191785Z # Opt-ins: 2024-12-17T23:34:10.6192469Z # Users can opt into the LF fleet by adding their GitHub username to this list 2024-12-17T23:34:10.6193456Z # and specifying experiments to enable in a comma-separated list. 2024-12-17T23:34:10.6194424Z # To always opt out of an experiment, prefix it with a "-". 2024-12-17T23:34:10.6195188Z # Experiments should be from the above list. 2024-12-17T23:34:10.6195681Z 2024-12-17T23:34:10.6195882Z @User1,-lf,split_build 2024-12-17T23:34:10.6196513Z @User2,lf 2024-12-17T23:34:10.6197008Z @User3,split_build 2024-12-17T23:34:10.6197549Z """ 2024-12-17T23:34:10.6197832Z 2024-12-17T23:34:10.6198108Z import json 2024-12-17T23:34:10.6198901Z import logging 2024-12-17T23:34:10.6199446Z import os 2024-12-17T23:34:10.6200008Z import random 2024-12-17T23:34:10.6200502Z import re 2024-12-17T23:34:10.6201019Z import sys 2024-12-17T23:34:10.6201602Z from argparse import ArgumentParser 2024-12-17T23:34:10.6202237Z from functools import lru_cache 2024-12-17T23:34:10.6202871Z from logging import LogRecord 2024-12-17T23:34:10.6203731Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2024-12-17T23:34:10.6204593Z from urllib.request import Request, urlopen 2024-12-17T23:34:10.6205085Z 2024-12-17T23:34:10.6205276Z import yaml 2024-12-17T23:34:10.6205835Z from github import Auth, Github 2024-12-17T23:34:10.6206440Z from github.Issue import Issue 2024-12-17T23:34:10.6206865Z 2024-12-17T23:34:10.6206871Z 2024-12-17T23:34:10.6207110Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2024-12-17T23:34:10.6207957Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2024-12-17T23:34:10.6208908Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2024-12-17T23:34:10.6209582Z 2024-12-17T23:34:10.6209866Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2024-12-17T23:34:10.6210795Z GH_OUTPUT_KEY_AMI = "runner-ami" 2024-12-17T23:34:10.6211469Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2024-12-17T23:34:10.6212104Z OPT_OUT_LABEL = "no-runner-experiments" 2024-12-17T23:34:10.6212549Z 2024-12-17T23:34:10.6212827Z SETTING_EXPERIMENTS = "experiments" 2024-12-17T23:34:10.6213257Z 2024-12-17T23:34:10.6213507Z LF_FLEET_EXPERIMENT = "lf" 2024-12-17T23:34:10.6214066Z CANARY_FLEET_SUFFIX = ".c" 2024-12-17T23:34:10.6214451Z 2024-12-17T23:34:10.6214457Z 2024-12-17T23:34:10.6214745Z class Experiment(NamedTuple): 2024-12-17T23:34:10.6215389Z rollout_perc: float = ( 2024-12-17T23:34:10.6216118Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2024-12-17T23:34:10.6216989Z ) 2024-12-17T23:34:10.6217499Z all_branches: bool = ( 2024-12-17T23:34:10.6218253Z False # If True, the experiment is also enabled on the exception branches 2024-12-17T23:34:10.6219106Z ) 2024-12-17T23:34:10.6219610Z default: bool = ( 2024-12-17T23:34:10.6220277Z True # If True, the experiment is enabled by default for all queries 2024-12-17T23:34:10.6221104Z ) 2024-12-17T23:34:10.6221389Z 2024-12-17T23:34:10.6221631Z # Add more fields as needed 2024-12-17T23:34:10.6222003Z 2024-12-17T23:34:10.6222010Z 2024-12-17T23:34:10.6222261Z class Settings(NamedTuple): 2024-12-17T23:34:10.6222842Z """ 2024-12-17T23:34:10.6223441Z Settings for the experiments that can be opted into. 2024-12-17T23:34:10.6224151Z """ 2024-12-17T23:34:10.6224405Z 2024-12-17T23:34:10.6224695Z experiments: Dict[str, Experiment] = {} 2024-12-17T23:34:10.6225180Z 2024-12-17T23:34:10.6225186Z 2024-12-17T23:34:10.6225431Z class ColorFormatter(logging.Formatter): 2024-12-17T23:34:10.6226190Z """Color codes the log messages based on the log level""" 2024-12-17T23:34:10.6226823Z 2024-12-17T23:34:10.6227092Z COLORS = { 2024-12-17T23:34:10.6227655Z "WARNING": "\033[33m", # Yellow 2024-12-17T23:34:10.6228320Z "ERROR": "\033[31m", # Red 2024-12-17T23:34:10.6228970Z "CRITICAL": "\033[31m", # Red 2024-12-17T23:34:10.6229627Z "INFO": "\033[0m", # Reset 2024-12-17T23:34:10.6230233Z "DEBUG": "\033[0m", # Reset 2024-12-17T23:34:10.6230852Z } 2024-12-17T23:34:10.6231178Z 2024-12-17T23:34:10.6231432Z def format(self, record: LogRecord) -> str: 2024-12-17T23:34:10.6232296Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2024-12-17T23:34:10.6233191Z record.msg = f"{log_color}{record.msg}\033[0m" 2024-12-17T23:34:10.6233927Z return super().format(record) 2024-12-17T23:34:10.6234364Z 2024-12-17T23:34:10.6234372Z 2024-12-17T23:34:10.6234590Z handler = logging.StreamHandler() 2024-12-17T23:34:10.6235476Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2024-12-17T23:34:10.6236116Z 2024-12-17T23:34:10.6236377Z log = logging.getLogger(os.path.basename(__file__)) 2024-12-17T23:34:10.6237070Z log.addHandler(handler) 2024-12-17T23:34:10.6237727Z log.setLevel(logging.INFO) 2024-12-17T23:34:10.6238083Z 2024-12-17T23:34:10.6238089Z 2024-12-17T23:34:10.6238612Z def set_github_output(key: str, value: str) -> None: 2024-12-17T23:34:10.6239337Z """ 2024-12-17T23:34:10.6240084Z Defines outputs of the github action that invokes this script 2024-12-17T23:34:10.6240814Z """ 2024-12-17T23:34:10.6241311Z if not GITHUB_OUTPUT: 2024-12-17T23:34:10.6242588Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2024-12-17T23:34:10.6243761Z log.warning( 2024-12-17T23:34:10.6244710Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2024-12-17T23:34:10.6245826Z ) 2024-12-17T23:34:10.6256351Z print(f"::set-output name={key}::{value}") 2024-12-17T23:34:10.6257065Z return 2024-12-17T23:34:10.6257508Z 2024-12-17T23:34:10.6257774Z with open(GITHUB_OUTPUT, "a") as f: 2024-12-17T23:34:10.6258708Z log.info(f"Setting output: {key}='{value}'") 2024-12-17T23:34:10.6259378Z f.write(f"{key}={value}\n") 2024-12-17T23:34:10.6259897Z 2024-12-17T23:34:10.6259905Z 2024-12-17T23:34:10.6260257Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2024-12-17T23:34:10.6261074Z return frozenset( 2024-12-17T23:34:10.6261779Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2024-12-17T23:34:10.6263021Z ) 2024-12-17T23:34:10.6263310Z 2024-12-17T23:34:10.6263317Z 2024-12-17T23:34:10.6263562Z def parse_args() -> Any: 2024-12-17T23:34:10.6264233Z parser = ArgumentParser("Get dynamic rollout settings") 2024-12-17T23:34:10.6265277Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2024-12-17T23:34:10.6266161Z parser.add_argument( 2024-12-17T23:34:10.6266719Z "--github-issue-repo", 2024-12-17T23:34:10.6267368Z type=str, 2024-12-17T23:34:10.6267903Z required=False, 2024-12-17T23:34:10.6268455Z default="pytorch/test-infra", 2024-12-17T23:34:10.6269178Z help="GitHub repo to get the issue", 2024-12-17T23:34:10.6269828Z ) 2024-12-17T23:34:10.6270296Z parser.add_argument( 2024-12-17T23:34:10.6270929Z "--github-repo", 2024-12-17T23:34:10.6271503Z type=str, 2024-12-17T23:34:10.6271981Z required=True, 2024-12-17T23:34:10.6272643Z help="GitHub repo where CI is running", 2024-12-17T23:34:10.6273304Z ) 2024-12-17T23:34:10.6273757Z parser.add_argument( 2024-12-17T23:34:10.6274545Z "--github-issue", type=int, required=True, help="GitHub issue number" 2024-12-17T23:34:10.6275344Z ) 2024-12-17T23:34:10.6275805Z parser.add_argument( 2024-12-17T23:34:10.6276789Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2024-12-17T23:34:10.6277609Z ) 2024-12-17T23:34:10.6278085Z parser.add_argument( 2024-12-17T23:34:10.6279310Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2024-12-17T23:34:10.6280161Z ) 2024-12-17T23:34:10.6280631Z parser.add_argument( 2024-12-17T23:34:10.6281500Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2024-12-17T23:34:10.6282328Z ) 2024-12-17T23:34:10.6282785Z parser.add_argument( 2024-12-17T23:34:10.6283439Z "--github-ref-type", 2024-12-17T23:34:10.6284025Z type=str, 2024-12-17T23:34:10.6284512Z required=True, 2024-12-17T23:34:10.6285198Z help="Current GitHub ref type, branch or tag", 2024-12-17T23:34:10.6285884Z ) 2024-12-17T23:34:10.6286342Z parser.add_argument( 2024-12-17T23:34:10.6286999Z "--eligible-experiments", 2024-12-17T23:34:10.6287633Z type=_str_comma_separated_to_set, 2024-12-17T23:34:10.6288259Z required=False, 2024-12-17T23:34:10.6288861Z default="", 2024-12-17T23:34:10.6289810Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2024-12-17T23:34:10.6290823Z ) 2024-12-17T23:34:10.6291377Z parser.add_argument( 2024-12-17T23:34:10.6291942Z "--pr-number", 2024-12-17T23:34:10.6292460Z type=str, 2024-12-17T23:34:10.6293040Z required=False, 2024-12-17T23:34:10.6293591Z default="", 2024-12-17T23:34:10.6294162Z help="the optional PR number where this is run", 2024-12-17T23:34:10.6294904Z ) 2024-12-17T23:34:10.6295175Z 2024-12-17T23:34:10.6295436Z return parser.parse_args() 2024-12-17T23:34:10.6295808Z 2024-12-17T23:34:10.6295815Z 2024-12-17T23:34:10.6296084Z def get_gh_client(github_token: str) -> Github: 2024-12-17T23:34:10.6296810Z auth = Auth.Token(github_token) 2024-12-17T23:34:10.6297456Z return Github(auth=auth) 2024-12-17T23:34:10.6297823Z 2024-12-17T23:34:10.6297829Z 2024-12-17T23:34:10.6298162Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2024-12-17T23:34:10.6298949Z repo = gh.get_repo(repo) 2024-12-17T23:34:10.6299786Z return repo.get_issue(number=issue_num) 2024-12-17T23:34:10.6300222Z 2024-12-17T23:34:10.6300228Z 2024-12-17T23:34:10.6300458Z def get_potential_pr_author( 2024-12-17T23:34:10.6301272Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2024-12-17T23:34:10.6302094Z ) -> str: 2024-12-17T23:34:10.6302707Z # If the trigger was a new tag added by a bot, this is a ciflow case 2024-12-17T23:34:10.6303683Z # Fetch the actual username from the original PR. The PR number is 2024-12-17T23:34:10.6304541Z # embedded in the tag name: ciflow// 2024-12-17T23:34:10.6305051Z 2024-12-17T23:34:10.6305239Z gh = get_gh_client(github_token) 2024-12-17T23:34:10.6305712Z 2024-12-17T23:34:10.6306073Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2024-12-17T23:34:10.6306777Z split_tag = ref_name.split("/") 2024-12-17T23:34:10.6307378Z if ( 2024-12-17T23:34:10.6307993Z len(split_tag) == 3 2024-12-17T23:34:10.6308577Z and split_tag[0] == "ciflow" 2024-12-17T23:34:10.6309219Z and split_tag[2].isnumeric() 2024-12-17T23:34:10.6309943Z ): 2024-12-17T23:34:10.6310426Z pr_number = split_tag[2] 2024-12-17T23:34:10.6311009Z try: 2024-12-17T23:34:10.6311658Z repository = gh.get_repo(repo) 2024-12-17T23:34:10.6312356Z pull = repository.get_pull(number=int(pr_number)) 2024-12-17T23:34:10.6313074Z except Exception as e: 2024-12-17T23:34:10.6313779Z raise Exception( # noqa: TRY002 2024-12-17T23:34:10.6314528Z f"issue with pull request {pr_number} from repo {repository}" 2024-12-17T23:34:10.6315285Z ) from e 2024-12-17T23:34:10.6315928Z return pull.user.login 2024-12-17T23:34:10.6316736Z # In all other cases, return the original input username 2024-12-17T23:34:10.6317456Z return username 2024-12-17T23:34:10.6317841Z 2024-12-17T23:34:10.6317853Z 2024-12-17T23:34:10.6318358Z def is_exception_branch(branch: str) -> bool: 2024-12-17T23:34:10.6319100Z """ 2024-12-17T23:34:10.6319847Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2024-12-17T23:34:10.6320831Z """ 2024-12-17T23:34:10.6321481Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2024-12-17T23:34:10.6322091Z 2024-12-17T23:34:10.6322097Z 2024-12-17T23:34:10.6322302Z def load_yaml(yaml_text: str) -> Any: 2024-12-17T23:34:10.6323000Z try: 2024-12-17T23:34:10.6323492Z data = yaml.safe_load(yaml_text) 2024-12-17T23:34:10.6324112Z return data 2024-12-17T23:34:10.6324755Z except yaml.YAMLError: 2024-12-17T23:34:10.6325350Z log.exception("Error loading YAML") 2024-12-17T23:34:10.6325981Z raise 2024-12-17T23:34:10.6326421Z 2024-12-17T23:34:10.6326427Z 2024-12-17T23:34:10.6326873Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2024-12-17T23:34:10.6327728Z """ 2024-12-17T23:34:10.6328430Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2024-12-17T23:34:10.6329201Z 2024-12-17T23:34:10.6329581Z If the issue body contains "---" then the text above that is the settings 2024-12-17T23:34:10.6330446Z and the text below is the list of opted in users. 2024-12-17T23:34:10.6330914Z 2024-12-17T23:34:10.6331282Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2024-12-17T23:34:10.6332197Z """ 2024-12-17T23:34:10.6332764Z rollout_state_parts = rollout_state.split("---") 2024-12-17T23:34:10.6333421Z if len(rollout_state_parts) >= 2: 2024-12-17T23:34:10.6334249Z return rollout_state_parts[0], rollout_state_parts[1] 2024-12-17T23:34:10.6334946Z else: 2024-12-17T23:34:10.6335406Z return "", rollout_state 2024-12-17T23:34:10.6335917Z 2024-12-17T23:34:10.6335923Z 2024-12-17T23:34:10.6336142Z class UserOptins(Dict[str, List[str]]): 2024-12-17T23:34:10.6336955Z """ 2024-12-17T23:34:10.6337670Z Dictionary of users with a list of features they have opted into 2024-12-17T23:34:10.6338417Z """ 2024-12-17T23:34:10.6338718Z 2024-12-17T23:34:10.6338724Z 2024-12-17T23:34:10.6339073Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2024-12-17T23:34:10.6339887Z """ 2024-12-17T23:34:10.6340685Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2024-12-17T23:34:10.6341452Z 2024-12-17T23:34:10.6342067Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2024-12-17T23:34:10.6343217Z - Example line: "@User1,lf,split_build" 2024-12-17T23:34:10.6344006Z - A "#" prefix indicates the user is opted out of all experiments 2024-12-17T23:34:10.6344583Z 2024-12-17T23:34:10.6344590Z 2024-12-17T23:34:10.6344789Z """ 2024-12-17T23:34:10.6345342Z optins = UserOptins() 2024-12-17T23:34:10.6345972Z for user in user_optin_text.split("\n"): 2024-12-17T23:34:10.6346627Z user = user.strip("\r\n\t -") 2024-12-17T23:34:10.6347344Z if not user or not user.startswith("@"): 2024-12-17T23:34:10.6348051Z # Not a valid user. Skip 2024-12-17T23:34:10.6348644Z continue 2024-12-17T23:34:10.6348980Z 2024-12-17T23:34:10.6349228Z if user: 2024-12-17T23:34:10.6349805Z usr_name = user.split(",")[0].strip("@") 2024-12-17T23:34:10.6350597Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2024-12-17T23:34:10.6351165Z 2024-12-17T23:34:10.6351425Z return optins 2024-12-17T23:34:10.6351746Z 2024-12-17T23:34:10.6351753Z 2024-12-17T23:34:10.6352107Z def is_valid_experiment_name(experiment_name: str) -> bool: 2024-12-17T23:34:10.6352955Z """ 2024-12-17T23:34:10.6353549Z Check if the experiment name is valid. 2024-12-17T23:34:10.6354228Z A valid name: 2024-12-17T23:34:10.6354937Z - Contains only alphanumeric characters and the special characters "_" & "-" 2024-12-17T23:34:10.6356021Z - The special characters "_" & "-" shouldn't be the first or last characters 2024-12-17T23:34:10.6356888Z - Cannot contain spaces 2024-12-17T23:34:10.6357429Z """ 2024-12-17T23:34:10.6357719Z 2024-12-17T23:34:10.6358064Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2024-12-17T23:34:10.6359243Z valid = bool(re.match(valid_char_regex, experiment_name)) 2024-12-17T23:34:10.6359764Z 2024-12-17T23:34:10.6359991Z if valid: 2024-12-17T23:34:10.6360546Z return True 2024-12-17T23:34:10.6360966Z 2024-12-17T23:34:10.6361160Z log.error( 2024-12-17T23:34:10.6362691Z 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." 2024-12-17T23:34:10.6364348Z ) 2024-12-17T23:34:10.6364851Z return False 2024-12-17T23:34:10.6365160Z 2024-12-17T23:34:10.6365167Z 2024-12-17T23:34:10.6365526Z def parse_settings_from_text(settings_text: str) -> Settings: 2024-12-17T23:34:10.6366283Z """ 2024-12-17T23:34:10.6367003Z Parse the experiments from the issue body into a list of ExperimentSettings 2024-12-17T23:34:10.6367825Z """ 2024-12-17T23:34:10.6368328Z try: 2024-12-17T23:34:10.6368841Z if settings_text: 2024-12-17T23:34:10.6369683Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2024-12-17T23:34:10.6370640Z # for easy reading 2024-12-17T23:34:10.6371508Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2024-12-17T23:34:10.6372514Z # the backtick character in shell commands. 2024-12-17T23:34:10.6373314Z backtick = chr(96) # backtick character 2024-12-17T23:34:10.6374063Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2024-12-17T23:34:10.6375034Z settings = load_yaml(settings_text) 2024-12-17T23:34:10.6375453Z 2024-12-17T23:34:10.6375997Z # For now we just load experiments. We can expand this if/when we add more settings 2024-12-17T23:34:10.6376824Z experiments = {} 2024-12-17T23:34:10.6377244Z 2024-12-17T23:34:10.6377615Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2024-12-17T23:34:10.6378542Z if not is_valid_experiment_name(exp_name): 2024-12-17T23:34:10.6379750Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2024-12-17T23:34:10.6380854Z continue 2024-12-17T23:34:10.6381291Z 2024-12-17T23:34:10.6381519Z valid_settings = {} 2024-12-17T23:34:10.6382184Z for setting in exp_settings: 2024-12-17T23:34:10.6382826Z if setting not in Experiment._fields: 2024-12-17T23:34:10.6383560Z log.warning( 2024-12-17T23:34:10.6384386Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2024-12-17T23:34:10.6385166Z ) 2024-12-17T23:34:10.6385819Z else: 2024-12-17T23:34:10.6386470Z valid_settings[setting] = exp_settings[setting] 2024-12-17T23:34:10.6386950Z 2024-12-17T23:34:10.6387238Z experiments[exp_name] = Experiment(**valid_settings) 2024-12-17T23:34:10.6388065Z return Settings(experiments) 2024-12-17T23:34:10.6388488Z 2024-12-17T23:34:10.6388719Z except Exception: 2024-12-17T23:34:10.6389279Z log.exception("Failed to parse settings") 2024-12-17T23:34:10.6389804Z 2024-12-17T23:34:10.6390187Z return Settings() 2024-12-17T23:34:10.6390565Z 2024-12-17T23:34:10.6390571Z 2024-12-17T23:34:10.6390838Z def parse_settings(rollout_state: str) -> Settings: 2024-12-17T23:34:10.6391517Z """ 2024-12-17T23:34:10.6392141Z Parse settings, if any, from the rollout state. 2024-12-17T23:34:10.6392643Z 2024-12-17T23:34:10.6393006Z If the issue body contains "---" then the text above that is the settings 2024-12-17T23:34:10.6393881Z and the text below is the list of opted in users. 2024-12-17T23:34:10.6394416Z 2024-12-17T23:34:10.6394854Z If it doesn't contain "---" then the settings are empty and the default values are used. 2024-12-17T23:34:10.6395697Z """ 2024-12-17T23:34:10.6396400Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:34:10.6397308Z return parse_settings_from_text(settings_text) 2024-12-17T23:34:10.6397812Z 2024-12-17T23:34:10.6397818Z 2024-12-17T23:34:10.6398088Z def parse_users(rollout_state: str) -> UserOptins: 2024-12-17T23:34:10.6399591Z """ 2024-12-17T23:34:10.6400239Z Parse users from the rollout state. 2024-12-17T23:34:10.6400669Z 2024-12-17T23:34:10.6400853Z """ 2024-12-17T23:34:10.6401513Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:34:10.6402429Z return parse_user_opt_in_from_text(users_text) 2024-12-17T23:34:10.6402896Z 2024-12-17T23:34:10.6402902Z 2024-12-17T23:34:10.6403325Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:34:10.6404314Z """ 2024-12-17T23:34:10.6404927Z Check if a user is opted into an experiment 2024-12-17T23:34:10.6405560Z """ 2024-12-17T23:34:10.6406111Z return experiment_name in user_optins.get(user, []) 2024-12-17T23:34:10.6406656Z 2024-12-17T23:34:10.6406712Z 2024-12-17T23:34:10.6407155Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:34:10.6408018Z """ 2024-12-17T23:34:10.6408575Z Check if a user explicitly opted out of an experiment 2024-12-17T23:34:10.6409345Z """ 2024-12-17T23:34:10.6409977Z # if the experiment is prefixed with a "-", then it's an opt-out 2024-12-17T23:34:10.6410911Z experiment_optout = "-" + experiment_name 2024-12-17T23:34:10.6411763Z if experiment_optout not in user_optins.get(user, []): 2024-12-17T23:34:10.6412474Z return False 2024-12-17T23:34:10.6412791Z 2024-12-17T23:34:10.6413054Z if is_user_opted_in(user, user_optins, experiment_name): 2024-12-17T23:34:10.6413869Z log.warning( 2024-12-17T23:34:10.6414757Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2024-12-17T23:34:10.6415680Z ) 2024-12-17T23:34:10.6416078Z 2024-12-17T23:34:10.6416263Z return True 2024-12-17T23:34:10.6416560Z 2024-12-17T23:34:10.6416566Z 2024-12-17T23:34:10.6416806Z def get_runner_prefix( 2024-12-17T23:34:10.6417314Z rollout_state: str, 2024-12-17T23:34:10.6417985Z workflow_requestors: Iterable[str], 2024-12-17T23:34:10.6418612Z branch: str, 2024-12-17T23:34:10.6419164Z eligible_experiments: FrozenSet[str] = frozenset(), 2024-12-17T23:34:10.6419969Z is_canary: bool = False, 2024-12-17T23:34:10.6420544Z ) -> str: 2024-12-17T23:34:10.6421040Z settings = parse_settings(rollout_state) 2024-12-17T23:34:10.6421805Z user_optins = parse_users(rollout_state) 2024-12-17T23:34:10.6422242Z 2024-12-17T23:34:10.6422472Z fleet_prefix = "" 2024-12-17T23:34:10.6422983Z prefixes = [] 2024-12-17T23:34:10.6423792Z for experiment_name, experiment_settings in settings.experiments.items(): 2024-12-17T23:34:10.6424828Z if not experiment_settings.all_branches and is_exception_branch(branch): 2024-12-17T23:34:10.6425705Z log.info( 2024-12-17T23:34:10.6426479Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2024-12-17T23:34:10.6427363Z ) 2024-12-17T23:34:10.6428077Z continue 2024-12-17T23:34:10.6428428Z 2024-12-17T23:34:10.6428641Z if eligible_experiments: 2024-12-17T23:34:10.6429338Z if experiment_name not in eligible_experiments: 2024-12-17T23:34:10.6430146Z exp_list = ", ".join(eligible_experiments) 2024-12-17T23:34:10.6430798Z log.info( 2024-12-17T23:34:10.6431706Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2024-12-17T23:34:10.6432686Z ) 2024-12-17T23:34:10.6433181Z continue 2024-12-17T23:34:10.6433790Z elif not experiment_settings.default: 2024-12-17T23:34:10.6434478Z log.info( 2024-12-17T23:34:10.6435241Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2024-12-17T23:34:10.6436081Z ) 2024-12-17T23:34:10.6436617Z continue 2024-12-17T23:34:10.6436948Z 2024-12-17T23:34:10.6437265Z # Is any workflow_requestor opted out to this experiment? 2024-12-17T23:34:10.6437988Z opted_out_users = [ 2024-12-17T23:34:10.6438916Z requestor 2024-12-17T23:34:10.6439530Z for requestor in workflow_requestors 2024-12-17T23:34:10.6440328Z if is_user_opted_out(requestor, user_optins, experiment_name) 2024-12-17T23:34:10.6441132Z ] 2024-12-17T23:34:10.6441444Z 2024-12-17T23:34:10.6441646Z if opted_out_users: 2024-12-17T23:34:10.6442234Z log.info( 2024-12-17T23:34:10.6443019Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2024-12-17T23:34:10.6443821Z ) 2024-12-17T23:34:10.6444331Z continue 2024-12-17T23:34:10.6444639Z 2024-12-17T23:34:10.6445020Z # Is any workflow_requestor opted in to this experiment? 2024-12-17T23:34:10.6445757Z opted_in_users = [ 2024-12-17T23:34:10.6446288Z requestor 2024-12-17T23:34:10.6446932Z for requestor in workflow_requestors 2024-12-17T23:34:10.6447727Z if is_user_opted_in(requestor, user_optins, experiment_name) 2024-12-17T23:34:10.6448419Z ] 2024-12-17T23:34:10.6448732Z 2024-12-17T23:34:10.6449180Z enabled = False 2024-12-17T23:34:10.6449774Z if opted_in_users: 2024-12-17T23:34:10.6450322Z log.info( 2024-12-17T23:34:10.6451081Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2024-12-17T23:34:10.6451892Z ) 2024-12-17T23:34:10.6452377Z enabled = True 2024-12-17T23:34:10.6452743Z 2024-12-17T23:34:10.6453036Z elif experiment_settings.rollout_perc: 2024-12-17T23:34:10.6453972Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2024-12-17T23:34:10.6454987Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2024-12-17T23:34:10.6455792Z log.info( 2024-12-17T23:34:10.6456778Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2024-12-17T23:34:10.6458538Z ) 2024-12-17T23:34:10.6459133Z enabled = True 2024-12-17T23:34:10.6459793Z 2024-12-17T23:34:10.6460054Z if enabled: 2024-12-17T23:34:10.6460584Z label = experiment_name 2024-12-17T23:34:10.6461286Z if experiment_name == LF_FLEET_EXPERIMENT: 2024-12-17T23:34:10.6462305Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2024-12-17T23:34:10.6463284Z # - If it's enabled, then we always list it's prefix first 2024-12-17T23:34:10.6464112Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2024-12-17T23:34:10.6464959Z if is_canary: 2024-12-17T23:34:10.6465566Z label += CANARY_FLEET_SUFFIX 2024-12-17T23:34:10.6466191Z fleet_prefix = label 2024-12-17T23:34:10.6467047Z else: 2024-12-17T23:34:10.6467638Z prefixes.append(label) 2024-12-17T23:34:10.6468050Z 2024-12-17T23:34:10.6468237Z if len(prefixes) > 1: 2024-12-17T23:34:10.6468895Z log.error( 2024-12-17T23:34:10.6470015Z 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:])}" 2024-12-17T23:34:10.6471149Z ) 2024-12-17T23:34:10.6471868Z prefixes = prefixes[:1] 2024-12-17T23:34:10.6472288Z 2024-12-17T23:34:10.6472537Z # Fleet always comes first 2024-12-17T23:34:10.6473205Z if fleet_prefix: 2024-12-17T23:34:10.6473765Z prefixes.insert(0, fleet_prefix) 2024-12-17T23:34:10.6474232Z 2024-12-17T23:34:10.6474496Z return ".".join(prefixes) + "." if prefixes else "" 2024-12-17T23:34:10.6474965Z 2024-12-17T23:34:10.6474971Z 2024-12-17T23:34:10.6475505Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2024-12-17T23:34:10.6476401Z """ 2024-12-17T23:34:10.6477126Z Gets the first comment of the issue, which contains the desired rollout state. 2024-12-17T23:34:10.6477728Z 2024-12-17T23:34:10.6478461Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2024-12-17T23:34:10.6479341Z """ 2024-12-17T23:34:10.6479858Z gh = get_gh_client(github_token) 2024-12-17T23:34:10.6480565Z issue = get_issue(gh, repo, issue_num) 2024-12-17T23:34:10.6481327Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2024-12-17T23:34:10.6481862Z 2024-12-17T23:34:10.6481868Z 2024-12-17T23:34:10.6482277Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2024-12-17T23:34:10.6483515Z for _ in range(num_retries): 2024-12-17T23:34:10.6484198Z try: 2024-12-17T23:34:10.6484707Z req = Request(url=url, headers=headers) 2024-12-17T23:34:10.6485537Z content = urlopen(req, timeout=5).read().decode("utf-8") 2024-12-17T23:34:10.6486413Z return json.loads(content) 2024-12-17T23:34:10.6487020Z except Exception as e: 2024-12-17T23:34:10.6487730Z log.warning(f"Could not download {url}: {e}") 2024-12-17T23:34:10.6488511Z 2024-12-17T23:34:10.6488947Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2024-12-17T23:34:10.6489736Z return {} 2024-12-17T23:34:10.6490064Z 2024-12-17T23:34:10.6490071Z 2024-12-17T23:34:10.6490345Z @lru_cache(maxsize=None) 2024-12-17T23:34:10.6491174Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2024-12-17T23:34:10.6491997Z """ 2024-12-17T23:34:10.6492571Z Dynamically get PR information 2024-12-17T23:34:10.6493193Z """ 2024-12-17T23:34:10.6493777Z github_api = f"https://api.github.com/repos/{github_repo}" 2024-12-17T23:34:10.6494566Z headers = { 2024-12-17T23:34:10.6495158Z "Accept": "application/vnd.github.v3+json", 2024-12-17T23:34:10.6495860Z "Authorization": f"token {github_token}", 2024-12-17T23:34:10.6496576Z } 2024-12-17T23:34:10.6497139Z json_response: Dict[str, Any] = download_json( 2024-12-17T23:34:10.6497952Z url=f"{github_api}/issues/{pr_number}", 2024-12-17T23:34:10.6498713Z headers=headers, 2024-12-17T23:34:10.6499387Z ) 2024-12-17T23:34:10.6499682Z 2024-12-17T23:34:10.6499880Z if not json_response: 2024-12-17T23:34:10.6500626Z log.warning(f"Failed to get the labels for #{pr_number}") 2024-12-17T23:34:10.6501524Z return {} 2024-12-17T23:34:10.6501838Z 2024-12-17T23:34:10.6502039Z return json_response 2024-12-17T23:34:10.6502405Z 2024-12-17T23:34:10.6502412Z 2024-12-17T23:34:10.6502893Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2024-12-17T23:34:10.6503775Z """ 2024-12-17T23:34:10.6504401Z Dynamically get the latest list of labels from the pull request 2024-12-17T23:34:10.6505163Z """ 2024-12-17T23:34:10.6510484Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2024-12-17T23:34:10.6511306Z return { 2024-12-17T23:34:10.6512044Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2024-12-17T23:34:10.6512908Z } 2024-12-17T23:34:10.6513179Z 2024-12-17T23:34:10.6513185Z 2024-12-17T23:34:10.6513415Z def main() -> None: 2024-12-17T23:34:10.6513976Z args = parse_args() 2024-12-17T23:34:10.6514380Z 2024-12-17T23:34:10.6514621Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2024-12-17T23:34:10.6515065Z 2024-12-17T23:34:10.6515310Z # Check if the PR is opt-out 2024-12-17T23:34:10.6515952Z if args.pr_number: 2024-12-17T23:34:10.6516747Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2024-12-17T23:34:10.6517596Z if OPT_OUT_LABEL in labels: 2024-12-17T23:34:10.6518532Z log.info( 2024-12-17T23:34:10.6519419Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2024-12-17T23:34:10.6520304Z ) 2024-12-17T23:34:10.6521103Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:34:10.6521846Z sys.exit() 2024-12-17T23:34:10.6522210Z 2024-12-17T23:34:10.6522410Z try: 2024-12-17T23:34:10.6523014Z rollout_state = get_rollout_state_from_issue( 2024-12-17T23:34:10.6523800Z args.github_token, args.github_issue_repo, args.github_issue 2024-12-17T23:34:10.6524566Z ) 2024-12-17T23:34:10.6524834Z 2024-12-17T23:34:10.6525159Z username = get_potential_pr_author( 2024-12-17T23:34:10.6525769Z args.github_token, 2024-12-17T23:34:10.6526784Z args.github_repo, 2024-12-17T23:34:10.6527475Z args.github_actor, 2024-12-17T23:34:10.6528293Z args.github_ref_type, 2024-12-17T23:34:10.6528952Z args.github_branch, 2024-12-17T23:34:10.6529610Z ) 2024-12-17T23:34:10.6529895Z 2024-12-17T23:34:10.6530209Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2024-12-17T23:34:10.6530765Z 2024-12-17T23:34:10.6531001Z runner_label_prefix = get_runner_prefix( 2024-12-17T23:34:10.6531722Z rollout_state, 2024-12-17T23:34:10.6532515Z (args.github_issue_owner, username), 2024-12-17T23:34:10.6533193Z args.github_branch, 2024-12-17T23:34:10.6533878Z args.eligible_experiments, 2024-12-17T23:34:10.6534478Z is_canary, 2024-12-17T23:34:10.6535001Z ) 2024-12-17T23:34:10.6535266Z 2024-12-17T23:34:10.6535585Z except Exception as e: 2024-12-17T23:34:10.6536135Z log.error( 2024-12-17T23:34:10.6536903Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2024-12-17T23:34:10.6537841Z ) 2024-12-17T23:34:10.6538118Z 2024-12-17T23:34:10.6538460Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:34:10.6539035Z 2024-12-17T23:34:10.6539041Z 2024-12-17T23:34:10.6539233Z if __name__ == "__main__": 2024-12-17T23:34:10.6539874Z main() 2024-12-17T23:34:10.6540155Z 2024-12-17T23:34:10.6639359Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2024-12-17T23:34:10.6640364Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2024-12-17T23:34:10.6708512Z shell: /usr/bin/bash -e {0} 2024-12-17T23:34:10.6709468Z env: 2024-12-17T23:34:10.6710583Z GITHUB_TOKEN: *** 2024-12-17T23:34:10.6711613Z ISSUE_NUMBER: 5132 2024-12-17T23:34:10.6712579Z TRIGGERING_ACTOR: malfet 2024-12-17T23:34:10.6713424Z ISSUE_OWNER: 2024-12-17T23:34:10.6714833Z CHECK_EXPERIMENTS: 2024-12-17T23:34:10.6715927Z PR_NUMBER: 2024-12-17T23:34:10.6716752Z ##[endgroup] 2024-12-17T23:34:13.3103308Z Defaulting to user installation because normal site-packages is not writeable 2024-12-17T23:34:14.1579642Z Collecting urllib3==1.26.18 2024-12-17T23:34:14.2035095Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2024-12-17T23:34:14.2348459Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 KB 6.8 MB/s eta 0:00:00 2024-12-17T23:34:14.2581069Z Collecting PyGithub==2.3.0 2024-12-17T23:34:14.2604741Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2024-12-17T23:34:14.2698853Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 KB 46.9 MB/s eta 0:00:00 2024-12-17T23:34:14.3150756Z Collecting typing-extensions>=4.0.0 2024-12-17T23:34:14.3172202Z Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB) 2024-12-17T23:34:14.3438950Z Collecting pyjwt[crypto]>=2.4.0 2024-12-17T23:34:14.3460619Z Downloading PyJWT-2.10.1-py3-none-any.whl (22 kB) 2024-12-17T23:34:14.3492795Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.25.1) 2024-12-17T23:34:14.3754920Z Collecting Deprecated 2024-12-17T23:34:14.3784811Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2024-12-17T23:34:14.4146521Z Collecting pynacl>=1.4.0 2024-12-17T23:34:14.4171532Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2024-12-17T23:34:14.4299675Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 KB 80.1 MB/s eta 0:00:00 2024-12-17T23:34:14.4427575Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (3.4.8) 2024-12-17T23:34:14.6664658Z Collecting cffi>=1.4.1 2024-12-17T23:34:14.6693744Z Downloading cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (446 kB) 2024-12-17T23:34:14.6776582Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 446.2/446.2 KB 72.7 MB/s eta 0:00:00 2024-12-17T23:34:14.8726819Z Collecting wrapt<2,>=1.10 2024-12-17T23:34:14.8774626Z Downloading wrapt-1.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82 kB) 2024-12-17T23:34:14.8833575Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.7/82.7 KB 18.6 MB/s eta 0:00:00 2024-12-17T23:34:14.8979682Z Collecting pycparser 2024-12-17T23:34:14.9002221Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2024-12-17T23:34:14.9046211Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 KB 43.0 MB/s eta 0:00:00 2024-12-17T23:34:15.2347443Z Installing collected packages: wrapt, urllib3, typing-extensions, pyjwt, pycparser, Deprecated, cffi, pynacl, PyGithub 2024-12-17T23:34:15.7123814Z Successfully installed Deprecated-1.2.15 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pyjwt-2.10.1 pynacl-1.5.0 typing-extensions-4.12.2 urllib3-1.26.18 wrapt-1.17.0 2024-12-17T23:34:15.7838847Z ##[group]Run curr_branch="release/2.6" 2024-12-17T23:34:15.7839494Z curr_branch="release/2.6" 2024-12-17T23:34:15.7839988Z curr_ref_type="branch" 2024-12-17T23:34:15.7840417Z echo "Current branch is '$curr_branch'" 2024-12-17T23:34:15.7840839Z  2024-12-17T23:34:15.7841269Z python3 runner_determinator.py \ 2024-12-17T23:34:15.7841682Z  --github-token "$GITHUB_TOKEN" \ 2024-12-17T23:34:15.7842083Z  --github-issue "$ISSUE_NUMBER" \ 2024-12-17T23:34:15.7842575Z  --github-branch "$curr_branch" \ 2024-12-17T23:34:15.7842944Z  --github-actor "$TRIGGERING_ACTOR" \ 2024-12-17T23:34:15.7843343Z  --github-issue-owner "$ISSUE_OWNER" \ 2024-12-17T23:34:15.7843876Z  --github-ref-type "$curr_ref_type" \ 2024-12-17T23:34:15.7844248Z  --github-repo "$GITHUB_REPOSITORY" \ 2024-12-17T23:34:15.7844666Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2024-12-17T23:34:15.7845247Z  --pr-number "${PR_NUMBER}" 2024-12-17T23:34:15.7903071Z shell: /usr/bin/bash -e {0} 2024-12-17T23:34:15.7903426Z env: 2024-12-17T23:34:15.7904203Z GITHUB_TOKEN: *** 2024-12-17T23:34:15.7904571Z ISSUE_NUMBER: 5132 2024-12-17T23:34:15.7904872Z TRIGGERING_ACTOR: malfet 2024-12-17T23:34:15.7905286Z ISSUE_OWNER: 2024-12-17T23:34:15.7905625Z CHECK_EXPERIMENTS: 2024-12-17T23:34:15.7905927Z PR_NUMBER: 2024-12-17T23:34:15.7906267Z ##[endgroup] 2024-12-17T23:34:15.7982963Z Current branch is 'release/2.6' 2024-12-17T23:34:17.1858710Z INFO : Based on rollout percentage of 95%, enabling experiment lf. 2024-12-17T23:34:17.1860108Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2024-12-17T23:34:17.1861247Z INFO : Setting output: label-type='lf.' 2024-12-17T23:34:17.2149472Z Evaluate and set job outputs 2024-12-17T23:34:17.2157113Z Set output 'label-type' 2024-12-17T23:34:17.2159801Z Cleaning up orphan processes