2025-03-14T03:56:27.0175129Z Current runner version: '2.322.0' 2025-03-14T03:56:27.0198240Z ##[group]Operating System 2025-03-14T03:56:27.0199127Z Ubuntu 2025-03-14T03:56:27.0199636Z 24.04.2 2025-03-14T03:56:27.0200168Z LTS 2025-03-14T03:56:27.0200654Z ##[endgroup] 2025-03-14T03:56:27.0201151Z ##[group]Runner Image 2025-03-14T03:56:27.0201753Z Image: ubuntu-24.04 2025-03-14T03:56:27.0202301Z Version: 20250309.1.0 2025-03-14T03:56:27.0203366Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:56:27.0204844Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:56:27.0205939Z ##[endgroup] 2025-03-14T03:56:27.0206489Z ##[group]Runner Image Provisioner 2025-03-14T03:56:27.0207139Z 2.0.422.1 2025-03-14T03:56:27.0207634Z ##[endgroup] 2025-03-14T03:56:27.0208655Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:56:27.0210683Z Contents: read 2025-03-14T03:56:27.0211248Z Metadata: read 2025-03-14T03:56:27.0212037Z ##[endgroup] 2025-03-14T03:56:27.0215114Z Secret source: Actions 2025-03-14T03:56:27.0216437Z Prepare workflow directory 2025-03-14T03:56:27.0704056Z Prepare all required actions 2025-03-14T03:56:27.0759058Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:56:27.0763847Z ##[group] Inputs 2025-03-14T03:56:27.0764482Z check_experiments: 2025-03-14T03:56:27.0765077Z triggering_actor: pytorchmergebot 2025-03-14T03:56:27.0765982Z issue_owner: 2025-03-14T03:56:27.0766549Z curr_branch: main 2025-03-14T03:56:27.0767076Z curr_ref_type: branch 2025-03-14T03:56:27.0767613Z issue_number: 5132 2025-03-14T03:56:27.0768194Z ##[endgroup] 2025-03-14T03:56:27.0768887Z Complete job name: before-test / get-label-type / runner-determinator 2025-03-14T03:56:27.9631856Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:56:27.9633585Z cat < runner_determinator.py 2025-03-14T03:56:27.9634213Z # flake8: noqa: G004 2025-03-14T03:56:27.9634751Z  2025-03-14T03:56:27.9635709Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:56:27.9636767Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:56:27.9637677Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:56:27.9638347Z  2025-03-14T03:56:27.9638748Z """ 2025-03-14T03:56:27.9639428Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:56:27.9640421Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:56:27.9641476Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:56:27.9642434Z of which runners should be used to run which job. 2025-03-14T03:56:27.9643068Z  2025-03-14T03:56:27.9643729Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:56:27.9644770Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:56:27.9645893Z settings are considered to be empty with only the second part, the user 2025-03-14T03:56:27.9646669Z list, defined. 2025-03-14T03:56:27.9647126Z  2025-03-14T03:56:27.9647760Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:56:27.9648797Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:56:27.9649743Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:56:27.9650421Z  2025-03-14T03:56:27.9651078Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:56:27.9652061Z The user list is also a comma separated list of additional features or 2025-03-14T03:56:27.9653160Z experiments which the user could be opted in to. 2025-03-14T03:56:27.9653794Z  2025-03-14T03:56:27.9654266Z The user list has the following rules: 2025-03-14T03:56:27.9654854Z  2025-03-14T03:56:27.9655575Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:56:27.9656569Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:56:27.9657450Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:56:27.9658076Z  2025-03-14T03:56:27.9658598Z Example config: 2025-03-14T03:56:27.9659184Z  # A list of experiments that can be opted into. 2025-03-14T03:56:27.9659953Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:56:27.9660679Z  # Expected syntax is: 2025-03-14T03:56:27.9661444Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:56:27.9662541Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:56:27.9663375Z  2025-03-14T03:56:27.9663794Z  experiments: 2025-03-14T03:56:27.9664263Z  lf: 2025-03-14T03:56:27.9664721Z  rollout_percent: 25 2025-03-14T03:56:27.9665272Z  all_branches: false 2025-03-14T03:56:27.9665917Z  default: true 2025-03-14T03:56:27.9666418Z  --- 2025-03-14T03:56:27.9666835Z  2025-03-14T03:56:27.9667234Z  # Opt-ins: 2025-03-14T03:56:27.9667936Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:56:27.9669077Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:56:27.9669972Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:56:27.9670773Z  # Experiments should be from the above list. 2025-03-14T03:56:27.9671391Z  2025-03-14T03:56:27.9671826Z  @User1,-lf,split_build 2025-03-14T03:56:27.9672362Z  @User2,lf 2025-03-14T03:56:27.9672839Z  @User3,split_build 2025-03-14T03:56:27.9673341Z """ 2025-03-14T03:56:27.9673744Z  2025-03-14T03:56:27.9674145Z import json 2025-03-14T03:56:27.9674602Z import logging 2025-03-14T03:56:27.9675079Z import os 2025-03-14T03:56:27.9675672Z import random 2025-03-14T03:56:27.9676149Z import re 2025-03-14T03:56:27.9676597Z import sys 2025-03-14T03:56:27.9677099Z from argparse import ArgumentParser 2025-03-14T03:56:27.9677733Z from collections.abc import Iterable 2025-03-14T03:56:27.9678343Z from functools import cache 2025-03-14T03:56:27.9678914Z from logging import LogRecord 2025-03-14T03:56:27.9679513Z from typing import Any, NamedTuple 2025-03-14T03:56:27.9680176Z from urllib.request import Request, urlopen 2025-03-14T03:56:27.9680777Z  2025-03-14T03:56:27.9681179Z import yaml 2025-03-14T03:56:27.9681661Z from github import Auth, Github 2025-03-14T03:56:27.9682256Z from github.Issue import Issue 2025-03-14T03:56:27.9682803Z  2025-03-14T03:56:27.9683194Z  2025-03-14T03:56:27.9683689Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:56:27.9684488Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:56:27.9685572Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:56:27.9686366Z  2025-03-14T03:56:27.9686871Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:56:27.9687542Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:56:27.9688162Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:56:27.9688998Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:56:27.9689589Z  2025-03-14T03:56:27.9690041Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:56:27.9690611Z  2025-03-14T03:56:27.9691034Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:56:27.9691590Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:56:27.9692113Z  2025-03-14T03:56:27.9692501Z  2025-03-14T03:56:27.9692932Z class Experiment(NamedTuple): 2025-03-14T03:56:27.9693554Z  rollout_perc: float = ( 2025-03-14T03:56:27.9694329Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:56:27.9695100Z  ) 2025-03-14T03:56:27.9695653Z  all_branches: bool = ( 2025-03-14T03:56:27.9696418Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:56:27.9697217Z  ) 2025-03-14T03:56:27.9697661Z  default: bool = ( 2025-03-14T03:56:27.9698382Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:56:27.9699100Z  ) 2025-03-14T03:56:27.9699516Z  2025-03-14T03:56:27.9699950Z  # Add more fields as needed 2025-03-14T03:56:27.9700490Z  2025-03-14T03:56:27.9700877Z  2025-03-14T03:56:27.9701306Z class Settings(NamedTuple): 2025-03-14T03:56:27.9701844Z  """ 2025-03-14T03:56:27.9702407Z  Settings for the experiments that can be opted into. 2025-03-14T03:56:27.9703064Z  """ 2025-03-14T03:56:27.9703478Z  2025-03-14T03:56:27.9703944Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:56:27.9704533Z  2025-03-14T03:56:27.9705143Z  2025-03-14T03:56:27.9705768Z class ColorFormatter(logging.Formatter): 2025-03-14T03:56:27.9706525Z  """Color codes the log messages based on the log level""" 2025-03-14T03:56:27.9707194Z  2025-03-14T03:56:27.9707609Z  COLORS = { 2025-03-14T03:56:27.9708128Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:56:27.9708725Z  "ERROR": "\033[31m", # Red 2025-03-14T03:56:27.9709322Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:56:27.9709925Z  "INFO": "\033[0m", # Reset 2025-03-14T03:56:27.9710510Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:56:27.9711064Z  } 2025-03-14T03:56:27.9711480Z  2025-03-14T03:56:27.9711971Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:56:27.9712832Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:56:27.9713736Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:56:27.9714423Z  return super().format(record) 2025-03-14T03:56:27.9714995Z  2025-03-14T03:56:27.9715394Z  2025-03-14T03:56:27.9715996Z handler = logging.StreamHandler() 2025-03-14T03:56:27.9716827Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:56:27.9717625Z  2025-03-14T03:56:27.9718147Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:56:27.9718831Z log.addHandler(handler) 2025-03-14T03:56:27.9719387Z log.setLevel(logging.INFO) 2025-03-14T03:56:27.9719924Z  2025-03-14T03:56:27.9720318Z  2025-03-14T03:56:27.9720850Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:56:27.9721514Z  """ 2025-03-14T03:56:27.9722124Z  Defines outputs of the github action that invokes this script 2025-03-14T03:56:27.9722855Z  """ 2025-03-14T03:56:27.9723305Z  if not GITHUB_OUTPUT: 2025-03-14T03:56:27.9724508Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:56:27.9725991Z  log.warning( 2025-03-14T03:56:27.9726982Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:56:27.9727994Z  ) 2025-03-14T03:56:27.9728526Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:56:27.9729151Z  return 2025-03-14T03:56:27.9729623Z  2025-03-14T03:56:27.9730079Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:56:27.9730752Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:56:27.9731418Z  f.write(f"{key}={value}\n") 2025-03-14T03:56:27.9731971Z  2025-03-14T03:56:27.9732377Z  2025-03-14T03:56:27.9732963Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:56:27.9733700Z  return frozenset( 2025-03-14T03:56:27.9734446Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:56:27.9735205Z  ) 2025-03-14T03:56:27.9735715Z  2025-03-14T03:56:27.9736115Z  2025-03-14T03:56:27.9736540Z def parse_args() -> Any: 2025-03-14T03:56:27.9737223Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:56:27.9738206Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:56:27.9739056Z  parser.add_argument( 2025-03-14T03:56:27.9739634Z  "--github-issue-repo", 2025-03-14T03:56:27.9740208Z  type=str, 2025-03-14T03:56:27.9740717Z  required=False, 2025-03-14T03:56:27.9741438Z  default="pytorch/test-infra", 2025-03-14T03:56:27.9742089Z  help="GitHub repo to get the issue", 2025-03-14T03:56:27.9742687Z  ) 2025-03-14T03:56:27.9743146Z  parser.add_argument( 2025-03-14T03:56:27.9743686Z  "--github-repo", 2025-03-14T03:56:27.9744208Z  type=str, 2025-03-14T03:56:27.9744705Z  required=True, 2025-03-14T03:56:27.9745286Z  help="GitHub repo where CI is running", 2025-03-14T03:56:27.9745997Z  ) 2025-03-14T03:56:27.9746447Z  parser.add_argument( 2025-03-14T03:56:27.9747181Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:56:27.9747925Z  ) 2025-03-14T03:56:27.9748364Z  parser.add_argument( 2025-03-14T03:56:27.9749117Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:56:27.9749893Z  ) 2025-03-14T03:56:27.9750334Z  parser.add_argument( 2025-03-14T03:56:27.9751098Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:56:27.9751872Z  ) 2025-03-14T03:56:27.9752317Z  parser.add_argument( 2025-03-14T03:56:27.9753104Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:56:27.9753902Z  ) 2025-03-14T03:56:27.9754353Z  parser.add_argument( 2025-03-14T03:56:27.9754901Z  "--github-ref-type", 2025-03-14T03:56:27.9755445Z  type=str, 2025-03-14T03:56:27.9756051Z  required=True, 2025-03-14T03:56:27.9756659Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:56:27.9757294Z  ) 2025-03-14T03:56:27.9757737Z  parser.add_argument( 2025-03-14T03:56:27.9758301Z  "--eligible-experiments", 2025-03-14T03:56:27.9758927Z  type=_str_comma_separated_to_set, 2025-03-14T03:56:27.9759542Z  required=False, 2025-03-14T03:56:27.9760062Z  default="", 2025-03-14T03:56:27.9761186Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:56:27.9762206Z  ) 2025-03-14T03:56:27.9762642Z  parser.add_argument( 2025-03-14T03:56:27.9763187Z  "--pr-number", 2025-03-14T03:56:27.9763705Z  type=str, 2025-03-14T03:56:27.9764200Z  required=False, 2025-03-14T03:56:27.9764723Z  default="", 2025-03-14T03:56:27.9765343Z  help="the optional PR number where this is run", 2025-03-14T03:56:27.9766109Z  ) 2025-03-14T03:56:27.9766528Z  2025-03-14T03:56:27.9766970Z  return parser.parse_args() 2025-03-14T03:56:27.9767527Z  2025-03-14T03:56:27.9767930Z  2025-03-14T03:56:27.9768632Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:56:27.9769509Z  auth = Auth.Token(github_token) 2025-03-14T03:56:27.9770122Z  return Github(auth=auth) 2025-03-14T03:56:27.9770665Z  2025-03-14T03:56:27.9771062Z  2025-03-14T03:56:27.9771812Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:56:27.9772730Z  repo = gh.get_repo(repo) 2025-03-14T03:56:27.9773347Z  return repo.get_issue(number=issue_num) 2025-03-14T03:56:27.9773949Z  2025-03-14T03:56:27.9774335Z  2025-03-14T03:56:27.9774772Z def get_potential_pr_author( 2025-03-14T03:56:27.9775642Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:56:27.9776436Z ) -> str: 2025-03-14T03:56:27.9777193Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:56:27.9778129Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:56:27.9779007Z  # embedded in the tag name: ciflow// 2025-03-14T03:56:27.9779666Z  2025-03-14T03:56:27.9780119Z  gh = get_gh_client(github_token) 2025-03-14T03:56:27.9780688Z  2025-03-14T03:56:27.9781249Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:56:27.9781975Z  split_tag = ref_name.split("/") 2025-03-14T03:56:27.9782566Z  if ( 2025-03-14T03:56:27.9783047Z  len(split_tag) == 3 2025-03-14T03:56:27.9783636Z  and split_tag[0] == "ciflow" 2025-03-14T03:56:27.9784266Z  and split_tag[2].isnumeric() 2025-03-14T03:56:27.9784845Z  ): 2025-03-14T03:56:27.9785345Z  pr_number = split_tag[2] 2025-03-14T03:56:27.9786024Z  try: 2025-03-14T03:56:27.9786561Z  repository = gh.get_repo(repo) 2025-03-14T03:56:27.9787282Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:56:27.9787994Z  except Exception as e: 2025-03-14T03:56:27.9788617Z  raise Exception( # noqa: TRY002 2025-03-14T03:56:27.9789384Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:56:27.9790112Z  ) from e 2025-03-14T03:56:27.9790768Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:56:27.9791578Z  # In all other cases, return the original input username 2025-03-14T03:56:27.9792257Z  return username 2025-03-14T03:56:27.9792750Z  2025-03-14T03:56:27.9793143Z  2025-03-14T03:56:27.9793630Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:56:27.9794235Z  """ 2025-03-14T03:56:27.9794995Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:56:27.9796095Z  """ 2025-03-14T03:56:27.9796735Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:56:27.9797485Z  2025-03-14T03:56:27.9797869Z  2025-03-14T03:56:27.9798318Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:56:27.9798892Z  try: 2025-03-14T03:56:27.9799375Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:56:27.9799962Z  return data 2025-03-14T03:56:27.9800478Z  except yaml.YAMLError: 2025-03-14T03:56:27.9801068Z  log.exception("Error loading YAML") 2025-03-14T03:56:27.9801658Z  raise 2025-03-14T03:56:27.9802109Z  2025-03-14T03:56:27.9802498Z  2025-03-14T03:56:27.9803204Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:56:27.9804052Z  """ 2025-03-14T03:56:27.9804802Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:56:27.9805756Z  2025-03-14T03:56:27.9806402Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:56:27.9807270Z  and the text below is the list of opted in users. 2025-03-14T03:56:27.9807904Z  2025-03-14T03:56:27.9808555Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:56:27.9809349Z  """ 2025-03-14T03:56:27.9809896Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:56:27.9810591Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:56:27.9811455Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:56:27.9812145Z  else: 2025-03-14T03:56:27.9812610Z  return "", rollout_state 2025-03-14T03:56:27.9813159Z  2025-03-14T03:56:27.9813566Z  2025-03-14T03:56:27.9814033Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:56:27.9814618Z  """ 2025-03-14T03:56:27.9815241Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:56:27.9816101Z  """ 2025-03-14T03:56:27.9816561Z  2025-03-14T03:56:27.9816953Z  2025-03-14T03:56:27.9817559Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:56:27.9818311Z  """ 2025-03-14T03:56:27.9819144Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:56:27.9820062Z  2025-03-14T03:56:27.9820981Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:56:27.9822093Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:56:27.9822890Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:56:27.9823596Z  2025-03-14T03:56:27.9823988Z  2025-03-14T03:56:27.9824395Z  """ 2025-03-14T03:56:27.9824845Z  optins = UserOptins() 2025-03-14T03:56:27.9825454Z  for user in user_optin_text.split("\n"): 2025-03-14T03:56:27.9826203Z  user = user.strip("\r\n\t -") 2025-03-14T03:56:27.9826857Z  if not user or not user.startswith("@"): 2025-03-14T03:56:27.9827502Z  # Not a valid user. Skip 2025-03-14T03:56:27.9828077Z  continue 2025-03-14T03:56:27.9828567Z  2025-03-14T03:56:27.9828964Z  if user: 2025-03-14T03:56:27.9829527Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:56:27.9830323Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:56:27.9831041Z  2025-03-14T03:56:27.9831592Z  return optins 2025-03-14T03:56:27.9832071Z  2025-03-14T03:56:27.9832465Z  2025-03-14T03:56:27.9833044Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:56:27.9833747Z  """ 2025-03-14T03:56:27.9834241Z  Check if the experiment name is valid. 2025-03-14T03:56:27.9834837Z  A valid name: 2025-03-14T03:56:27.9835707Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:56:27.9836776Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:56:27.9837586Z  - Cannot contain spaces 2025-03-14T03:56:27.9838147Z  """ 2025-03-14T03:56:27.9838593Z  2025-03-14T03:56:27.9839127Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:56:27.9839953Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:56:27.9840651Z  2025-03-14T03:56:27.9841061Z  if valid: 2025-03-14T03:56:27.9841535Z  return True 2025-03-14T03:56:27.9842015Z  2025-03-14T03:56:27.9842424Z  log.error( 2025-03-14T03:56:27.9844039Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-03-14T03:56:27.9845793Z  ) 2025-03-14T03:56:27.9846220Z  return False 2025-03-14T03:56:27.9846691Z  2025-03-14T03:56:27.9847073Z  2025-03-14T03:56:27.9847787Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:56:27.9848524Z  """ 2025-03-14T03:56:27.9849214Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:56:27.9850016Z  """ 2025-03-14T03:56:27.9850435Z  try: 2025-03-14T03:56:27.9850884Z  if settings_text: 2025-03-14T03:56:27.9851739Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:56:27.9852638Z  # for easy reading 2025-03-14T03:56:27.9853558Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:56:27.9854561Z  # the backtick character in shell commands. 2025-03-14T03:56:27.9855265Z  backtick = chr(96) # backtick character 2025-03-14T03:56:27.9856146Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:56:27.9856935Z  settings = load_yaml(settings_text) 2025-03-14T03:56:27.9857536Z  2025-03-14T03:56:27.9858208Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:56:27.9859046Z  experiments = {} 2025-03-14T03:56:27.9859578Z  2025-03-14T03:56:27.9860214Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:56:27.9861090Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:56:27.9862322Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-03-14T03:56:27.9863470Z  continue 2025-03-14T03:56:27.9863992Z  2025-03-14T03:56:27.9864426Z  valid_settings = {} 2025-03-14T03:56:27.9865037Z  for setting in exp_settings: 2025-03-14T03:56:27.9865795Z  if setting not in Experiment._fields: 2025-03-14T03:56:27.9866448Z  log.warning( 2025-03-14T03:56:27.9867412Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:56:27.9868217Z  ) 2025-03-14T03:56:27.9868742Z  else: 2025-03-14T03:56:27.9869370Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:56:27.9870029Z  2025-03-14T03:56:27.9870576Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:56:27.9871309Z  return Settings(experiments) 2025-03-14T03:56:27.9871890Z  2025-03-14T03:56:27.9872303Z  except Exception: 2025-03-14T03:56:27.9872899Z  log.exception("Failed to parse settings") 2025-03-14T03:56:27.9873524Z  2025-03-14T03:56:27.9873938Z  return Settings() 2025-03-14T03:56:27.9874430Z  2025-03-14T03:56:27.9874815Z  2025-03-14T03:56:27.9875340Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:56:27.9876104Z  """ 2025-03-14T03:56:27.9876629Z  Parse settings, if any, from the rollout state. 2025-03-14T03:56:27.9877267Z  2025-03-14T03:56:27.9877903Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:56:27.9878759Z  and the text below is the list of opted in users. 2025-03-14T03:56:27.9879391Z  2025-03-14T03:56:27.9880072Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:56:27.9880896Z  """ 2025-03-14T03:56:27.9881551Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:56:27.9882661Z  return parse_settings_from_text(settings_text) 2025-03-14T03:56:27.9883301Z  2025-03-14T03:56:27.9883686Z  2025-03-14T03:56:27.9884211Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:56:27.9884872Z  """ 2025-03-14T03:56:27.9885346Z  Parse users from the rollout state. 2025-03-14T03:56:27.9886027Z  2025-03-14T03:56:27.9886434Z  """ 2025-03-14T03:56:27.9887076Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:56:27.9887928Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:56:27.9888548Z  2025-03-14T03:56:27.9888936Z  2025-03-14T03:56:27.9889645Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:56:27.9890485Z  """ 2025-03-14T03:56:27.9891015Z  Check if a user is opted into an experiment 2025-03-14T03:56:27.9891642Z  """ 2025-03-14T03:56:27.9892194Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:56:27.9892850Z  2025-03-14T03:56:27.9893246Z  2025-03-14T03:56:27.9893960Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:56:27.9894816Z  """ 2025-03-14T03:56:27.9895378Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:56:27.9896187Z  """ 2025-03-14T03:56:27.9896804Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:56:27.9897594Z  experiment_optout = "-" + experiment_name 2025-03-14T03:56:27.9898342Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:56:27.9899029Z  return False 2025-03-14T03:56:27.9899515Z  2025-03-14T03:56:27.9900064Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:56:27.9900757Z  log.warning( 2025-03-14T03:56:27.9901691Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:56:27.9902799Z  ) 2025-03-14T03:56:27.9903233Z  2025-03-14T03:56:27.9903631Z  return True 2025-03-14T03:56:27.9904101Z  2025-03-14T03:56:27.9904489Z  2025-03-14T03:56:27.9904909Z def get_runner_prefix( 2025-03-14T03:56:27.9905443Z  rollout_state: str, 2025-03-14T03:56:27.9906139Z  workflow_requestors: Iterable[str], 2025-03-14T03:56:27.9907033Z  branch: str, 2025-03-14T03:56:27.9908292Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:56:27.9909730Z  is_canary: bool = False, 2025-03-14T03:56:27.9910858Z ) -> str: 2025-03-14T03:56:27.9911965Z  settings = parse_settings(rollout_state) 2025-03-14T03:56:27.9913395Z  user_optins = parse_users(rollout_state) 2025-03-14T03:56:27.9914600Z  2025-03-14T03:56:27.9915393Z  fleet_prefix = "" 2025-03-14T03:56:27.9916656Z  prefixes = [] 2025-03-14T03:56:27.9918406Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:56:27.9920399Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:56:27.9921909Z  log.info( 2025-03-14T03:56:27.9923468Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:56:27.9925210Z  ) 2025-03-14T03:56:27.9926358Z  continue 2025-03-14T03:56:27.9927354Z  2025-03-14T03:56:27.9928250Z  if eligible_experiments: 2025-03-14T03:56:27.9929784Z  if experiment_name not in eligible_experiments: 2025-03-14T03:56:27.9931334Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:56:27.9932611Z  log.info( 2025-03-14T03:56:27.9934427Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:56:27.9936441Z  ) 2025-03-14T03:56:27.9937412Z  continue 2025-03-14T03:56:27.9938639Z  elif not experiment_settings.default: 2025-03-14T03:56:27.9939808Z  log.info( 2025-03-14T03:56:27.9941385Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:56:27.9942875Z  ) 2025-03-14T03:56:27.9943784Z  continue 2025-03-14T03:56:27.9944706Z  2025-03-14T03:56:27.9945922Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:56:27.9947342Z  opted_out_users = [ 2025-03-14T03:56:27.9948412Z  requestor 2025-03-14T03:56:27.9949555Z  for requestor in workflow_requestors 2025-03-14T03:56:27.9951025Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:56:27.9952497Z  ] 2025-03-14T03:56:27.9953361Z  2025-03-14T03:56:27.9954187Z  if opted_out_users: 2025-03-14T03:56:27.9955256Z  log.info( 2025-03-14T03:56:27.9956905Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:56:27.9958547Z  ) 2025-03-14T03:56:27.9959642Z  continue 2025-03-14T03:56:27.9960927Z  2025-03-14T03:56:27.9962011Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:56:27.9963430Z  opted_in_users = [ 2025-03-14T03:56:27.9964580Z  requestor 2025-03-14T03:56:27.9965869Z  for requestor in workflow_requestors 2025-03-14T03:56:27.9967319Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:56:27.9969077Z  ] 2025-03-14T03:56:27.9969948Z  2025-03-14T03:56:27.9970763Z  enabled = False 2025-03-14T03:56:27.9971830Z  if opted_in_users: 2025-03-14T03:56:27.9972853Z  log.info( 2025-03-14T03:56:27.9974324Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:56:27.9975811Z  ) 2025-03-14T03:56:27.9976313Z  enabled = True 2025-03-14T03:56:27.9976841Z  2025-03-14T03:56:27.9977322Z  elif experiment_settings.rollout_perc: 2025-03-14T03:56:27.9978282Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:56:27.9979299Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:56:27.9980019Z  log.info( 2025-03-14T03:56:27.9980990Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:56:27.9981982Z  ) 2025-03-14T03:56:27.9982477Z  enabled = True 2025-03-14T03:56:27.9983012Z  2025-03-14T03:56:27.9983414Z  if enabled: 2025-03-14T03:56:27.9983941Z  label = experiment_name 2025-03-14T03:56:27.9984591Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:56:27.9985741Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:56:27.9986940Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:56:27.9987838Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:56:27.9988569Z  if is_canary: 2025-03-14T03:56:27.9989166Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:56:27.9989789Z  fleet_prefix = label 2025-03-14T03:56:27.9990345Z  else: 2025-03-14T03:56:27.9990872Z  prefixes.append(label) 2025-03-14T03:56:27.9991443Z  2025-03-14T03:56:27.9991864Z  if len(prefixes) > 1: 2025-03-14T03:56:27.9992390Z  log.error( 2025-03-14T03:56:27.9993525Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-03-14T03:56:27.9994690Z  ) 2025-03-14T03:56:27.9995151Z  prefixes = prefixes[:1] 2025-03-14T03:56:27.9995918Z  2025-03-14T03:56:27.9996352Z  # Fleet always comes first 2025-03-14T03:56:27.9996917Z  if fleet_prefix: 2025-03-14T03:56:27.9997454Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:56:27.9998038Z  2025-03-14T03:56:27.9998551Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:56:27.9999181Z  2025-03-14T03:56:27.9999572Z  2025-03-14T03:56:28.0000273Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:56:28.0001103Z  """ 2025-03-14T03:56:28.0001767Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:56:28.0002534Z  2025-03-14T03:56:28.0003181Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:56:28.0003950Z  """ 2025-03-14T03:56:28.0077506Z  gh = get_gh_client(github_token) 2025-03-14T03:56:28.0078375Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:56:28.0079202Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:56:28.0080121Z  2025-03-14T03:56:28.0080506Z  2025-03-14T03:56:28.0081178Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:56:28.0081998Z  for _ in range(num_retries): 2025-03-14T03:56:28.0082548Z  try: 2025-03-14T03:56:28.0083065Z  req = Request(url=url, headers=headers) 2025-03-14T03:56:28.0083798Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:56:28.0084511Z  return json.loads(content) 2025-03-14T03:56:28.0085112Z  except Exception as e: 2025-03-14T03:56:28.0085870Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:56:28.0086488Z  2025-03-14T03:56:28.0087123Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:56:28.0087900Z  return {} 2025-03-14T03:56:28.0088352Z  2025-03-14T03:56:28.0088722Z  2025-03-14T03:56:28.0089112Z @cache 2025-03-14T03:56:28.0089822Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:56:28.0090621Z  """ 2025-03-14T03:56:28.0091077Z  Dynamically get PR information 2025-03-14T03:56:28.0091627Z  """ 2025-03-14T03:56:28.0092205Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:56:28.0092894Z  headers = { 2025-03-14T03:56:28.0093448Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:56:28.0094122Z  "Authorization": f"token {github_token}", 2025-03-14T03:56:28.0094698Z  } 2025-03-14T03:56:28.0095324Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:56:28.0096128Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:56:28.0096726Z  headers=headers, 2025-03-14T03:56:28.0097234Z  ) 2025-03-14T03:56:28.0097636Z  2025-03-14T03:56:28.0098030Z  if not json_response: 2025-03-14T03:56:28.0098700Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:56:28.0099375Z  return {} 2025-03-14T03:56:28.0099843Z  2025-03-14T03:56:28.0100259Z  return json_response 2025-03-14T03:56:28.0100762Z  2025-03-14T03:56:28.0101158Z  2025-03-14T03:56:28.0101816Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:56:28.0102598Z  """ 2025-03-14T03:56:28.0103206Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:56:28.0103926Z  """ 2025-03-14T03:56:28.0104478Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:56:28.0105147Z  return { 2025-03-14T03:56:28.0105913Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:56:28.0106685Z  } 2025-03-14T03:56:28.0107082Z  2025-03-14T03:56:28.0107452Z  2025-03-14T03:56:28.0107853Z def main() -> None: 2025-03-14T03:56:28.0108351Z  args = parse_args() 2025-03-14T03:56:28.0108848Z  2025-03-14T03:56:28.0109316Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:56:28.0109915Z  2025-03-14T03:56:28.0110341Z  # Check if the PR is opt-out 2025-03-14T03:56:28.0110925Z  if args.pr_number: 2025-03-14T03:56:28.0111699Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:56:28.0112528Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:56:28.0113085Z  log.info( 2025-03-14T03:56:28.0113863Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:56:28.0114859Z  ) 2025-03-14T03:56:28.0116019Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:56:28.0116792Z  sys.exit() 2025-03-14T03:56:28.0117278Z  2025-03-14T03:56:28.0117668Z  try: 2025-03-14T03:56:28.0118189Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:56:28.0118982Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:56:28.0119677Z  ) 2025-03-14T03:56:28.0120096Z  2025-03-14T03:56:28.0120540Z  username = get_potential_pr_author( 2025-03-14T03:56:28.0121146Z  args.github_token, 2025-03-14T03:56:28.0121729Z  args.github_repo, 2025-03-14T03:56:28.0122297Z  args.github_actor, 2025-03-14T03:56:28.0122883Z  args.github_ref_type, 2025-03-14T03:56:28.0123466Z  args.github_branch, 2025-03-14T03:56:28.0123990Z  ) 2025-03-14T03:56:28.0124412Z  2025-03-14T03:56:28.0124953Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:56:28.0125720Z  2025-03-14T03:56:28.0126190Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:56:28.0126815Z  rollout_state, 2025-03-14T03:56:28.0127407Z  (args.github_issue_owner, username), 2025-03-14T03:56:28.0128021Z  args.github_branch, 2025-03-14T03:56:28.0128604Z  args.eligible_experiments, 2025-03-14T03:56:28.0129180Z  is_canary, 2025-03-14T03:56:28.0129814Z  ) 2025-03-14T03:56:28.0130250Z  2025-03-14T03:56:28.0130670Z  except Exception as e: 2025-03-14T03:56:28.0131218Z  log.error( 2025-03-14T03:56:28.0132006Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:56:28.0132825Z  ) 2025-03-14T03:56:28.0133240Z  2025-03-14T03:56:28.0133828Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:56:28.0134547Z  2025-03-14T03:56:28.0134931Z  2025-03-14T03:56:28.0135337Z if __name__ == "__main__": 2025-03-14T03:56:28.0135958Z  main() 2025-03-14T03:56:28.0136394Z  2025-03-14T03:56:28.0136782Z EOF 2025-03-14T03:56:28.0137200Z  2025-03-14T03:56:28.0137622Z cat runner_determinator.py 2025-03-14T03:56:28.0423303Z shell: /usr/bin/bash -e {0} 2025-03-14T03:56:28.0424128Z env: 2025-03-14T03:56:28.0424810Z GITHUB_TOKEN: *** 2025-03-14T03:56:28.0425254Z ISSUE_NUMBER: 5132 2025-03-14T03:56:28.0425904Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:56:28.0426441Z ISSUE_OWNER: 2025-03-14T03:56:28.0426873Z CHECK_EXPERIMENTS: 2025-03-14T03:56:28.0427318Z PR_NUMBER: 2025-03-14T03:56:28.0427724Z ##[endgroup] 2025-03-14T03:56:28.0651095Z # flake8: noqa: G004 2025-03-14T03:56:28.0651861Z 2025-03-14T03:56:28.0652786Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:56:28.0654075Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:56:28.0654904Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:56:28.0655360Z 2025-03-14T03:56:28.0655779Z """ 2025-03-14T03:56:28.0656452Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:56:28.0657784Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:56:28.0659392Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:56:28.0660247Z of which runners should be used to run which job. 2025-03-14T03:56:28.0660664Z 2025-03-14T03:56:28.0661268Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:56:28.0662181Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:56:28.0663512Z settings are considered to be empty with only the second part, the user 2025-03-14T03:56:28.0664301Z list, defined. 2025-03-14T03:56:28.0664548Z 2025-03-14T03:56:28.0664960Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:56:28.0666322Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:56:28.0667182Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:56:28.0667912Z 2025-03-14T03:56:28.0668486Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:56:28.0669415Z The user list is also a comma separated list of additional features or 2025-03-14T03:56:28.0670170Z experiments which the user could be opted in to. 2025-03-14T03:56:28.0670594Z 2025-03-14T03:56:28.0670818Z The user list has the following rules: 2025-03-14T03:56:28.0671173Z 2025-03-14T03:56:28.0671500Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:56:28.0672376Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:56:28.0673150Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:56:28.0673564Z 2025-03-14T03:56:28.0673742Z Example config: 2025-03-14T03:56:28.0674214Z # A list of experiments that can be opted into. 2025-03-14T03:56:28.0674907Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:56:28.0675774Z # Expected syntax is: 2025-03-14T03:56:28.0676527Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:56:28.0677714Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:56:28.0678372Z 2025-03-14T03:56:28.0678557Z experiments: 2025-03-14T03:56:28.0678971Z lf: 2025-03-14T03:56:28.0679385Z rollout_percent: 25 2025-03-14T03:56:28.0679869Z all_branches: false 2025-03-14T03:56:28.0680332Z default: true 2025-03-14T03:56:28.0680763Z --- 2025-03-14T03:56:28.0680984Z 2025-03-14T03:56:28.0681170Z # Opt-ins: 2025-03-14T03:56:28.0681778Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:56:28.0682662Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:56:28.0683459Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:56:28.0684167Z # Experiments should be from the above list. 2025-03-14T03:56:28.0684571Z 2025-03-14T03:56:28.0684759Z @User1,-lf,split_build 2025-03-14T03:56:28.0685215Z @User2,lf 2025-03-14T03:56:28.0685838Z @User3,split_build 2025-03-14T03:56:28.0686285Z """ 2025-03-14T03:56:28.0686484Z 2025-03-14T03:56:28.0686655Z import json 2025-03-14T03:56:28.0687041Z import logging 2025-03-14T03:56:28.0687442Z import os 2025-03-14T03:56:28.0687832Z import random 2025-03-14T03:56:28.0688225Z import re 2025-03-14T03:56:28.0688612Z import sys 2025-03-14T03:56:28.0689030Z from argparse import ArgumentParser 2025-03-14T03:56:28.0689591Z from collections.abc import Iterable 2025-03-14T03:56:28.0690127Z from functools import cache 2025-03-14T03:56:28.0690637Z from logging import LogRecord 2025-03-14T03:56:28.0691156Z from typing import Any, NamedTuple 2025-03-14T03:56:28.0691727Z from urllib.request import Request, urlopen 2025-03-14T03:56:28.0692115Z 2025-03-14T03:56:28.0692295Z import yaml 2025-03-14T03:56:28.0692704Z from github import Auth, Github 2025-03-14T03:56:28.0693214Z from github.Issue import Issue 2025-03-14T03:56:28.0693539Z 2025-03-14T03:56:28.0693547Z 2025-03-14T03:56:28.0693789Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:56:28.0694504Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:56:28.0695403Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:56:28.0696353Z 2025-03-14T03:56:28.0696609Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:56:28.0697219Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:56:28.0697741Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:56:28.0698317Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:56:28.0698689Z 2025-03-14T03:56:28.0698892Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:56:28.0699244Z 2025-03-14T03:56:28.0699442Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:56:28.0699930Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:56:28.0700224Z 2025-03-14T03:56:28.0700233Z 2025-03-14T03:56:28.0700440Z class Experiment(NamedTuple): 2025-03-14T03:56:28.0700934Z rollout_perc: float = ( 2025-03-14T03:56:28.0701613Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:56:28.0702321Z ) 2025-03-14T03:56:28.0702723Z all_branches: bool = ( 2025-03-14T03:56:28.0703400Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:56:28.0704101Z ) 2025-03-14T03:56:28.0704485Z default: bool = ( 2025-03-14T03:56:28.0705086Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:56:28.0705968Z ) 2025-03-14T03:56:28.0706180Z 2025-03-14T03:56:28.0706381Z # Add more fields as needed 2025-03-14T03:56:28.0706701Z 2025-03-14T03:56:28.0706709Z 2025-03-14T03:56:28.0706907Z class Settings(NamedTuple): 2025-03-14T03:56:28.0707364Z """ 2025-03-14T03:56:28.0707838Z Settings for the experiments that can be opted into. 2025-03-14T03:56:28.0708440Z """ 2025-03-14T03:56:28.0708642Z 2025-03-14T03:56:28.0708863Z experiments: dict[str, Experiment] = {} 2025-03-14T03:56:28.0709235Z 2025-03-14T03:56:28.0709243Z 2025-03-14T03:56:28.0709615Z class ColorFormatter(logging.Formatter): 2025-03-14T03:56:28.0710273Z """Color codes the log messages based on the log level""" 2025-03-14T03:56:28.0710728Z 2025-03-14T03:56:28.0710901Z COLORS = { 2025-03-14T03:56:28.0711327Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:56:28.0711867Z "ERROR": "\033[31m", # Red 2025-03-14T03:56:28.0712380Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:56:28.0712896Z "INFO": "\033[0m", # Reset 2025-03-14T03:56:28.0713400Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:56:28.0713883Z } 2025-03-14T03:56:28.0714085Z 2025-03-14T03:56:28.0714318Z def format(self, record: LogRecord) -> str: 2025-03-14T03:56:28.0715094Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:56:28.0716156Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:56:28.0716756Z return super().format(record) 2025-03-14T03:56:28.0717110Z 2025-03-14T03:56:28.0717118Z 2025-03-14T03:56:28.0717335Z handler = logging.StreamHandler() 2025-03-14T03:56:28.0718089Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:56:28.0718671Z 2025-03-14T03:56:28.0718946Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:56:28.0719557Z log.addHandler(handler) 2025-03-14T03:56:28.0720020Z log.setLevel(logging.INFO) 2025-03-14T03:56:28.0720320Z 2025-03-14T03:56:28.0720328Z 2025-03-14T03:56:28.0720585Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:56:28.0721168Z """ 2025-03-14T03:56:28.0721694Z Defines outputs of the github action that invokes this script 2025-03-14T03:56:28.0722362Z """ 2025-03-14T03:56:28.0722764Z if not GITHUB_OUTPUT: 2025-03-14T03:56:28.0723866Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:56:28.0725019Z log.warning( 2025-03-14T03:56:28.0726088Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:56:28.0727052Z ) 2025-03-14T03:56:28.0737149Z print(f"::set-output name={key}::{value}") 2025-03-14T03:56:28.0737987Z return 2025-03-14T03:56:28.0738241Z 2025-03-14T03:56:28.0738450Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:56:28.0739050Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:56:28.0739648Z f.write(f"{key}={value}\n") 2025-03-14T03:56:28.0739987Z 2025-03-14T03:56:28.0739995Z 2025-03-14T03:56:28.0740314Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:56:28.0740988Z return frozenset( 2025-03-14T03:56:28.0741625Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:56:28.0742344Z ) 2025-03-14T03:56:28.0742559Z 2025-03-14T03:56:28.0742567Z 2025-03-14T03:56:28.0742761Z def parse_args() -> Any: 2025-03-14T03:56:28.0743350Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:56:28.0744235Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:56:28.0745028Z parser.add_argument( 2025-03-14T03:56:28.0745713Z "--github-issue-repo", 2025-03-14T03:56:28.0746223Z type=str, 2025-03-14T03:56:28.0746655Z required=False, 2025-03-14T03:56:28.0747139Z default="pytorch/test-infra", 2025-03-14T03:56:28.0747691Z help="GitHub repo to get the issue", 2025-03-14T03:56:28.0748235Z ) 2025-03-14T03:56:28.0748621Z parser.add_argument( 2025-03-14T03:56:28.0749079Z "--github-repo", 2025-03-14T03:56:28.0749519Z type=str, 2025-03-14T03:56:28.0749924Z required=True, 2025-03-14T03:56:28.0750401Z help="GitHub repo where CI is running", 2025-03-14T03:56:28.0750942Z ) 2025-03-14T03:56:28.0751328Z parser.add_argument( 2025-03-14T03:56:28.0751955Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:56:28.0752773Z ) 2025-03-14T03:56:28.0753180Z parser.add_argument( 2025-03-14T03:56:28.0753823Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:56:28.0754531Z ) 2025-03-14T03:56:28.0754915Z parser.add_argument( 2025-03-14T03:56:28.0755845Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:56:28.0756618Z ) 2025-03-14T03:56:28.0757007Z parser.add_argument( 2025-03-14T03:56:28.0757695Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:56:28.0758435Z ) 2025-03-14T03:56:28.0758824Z parser.add_argument( 2025-03-14T03:56:28.0759298Z "--github-ref-type", 2025-03-14T03:56:28.0759769Z type=str, 2025-03-14T03:56:28.0760181Z required=True, 2025-03-14T03:56:28.0760689Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:56:28.0761263Z ) 2025-03-14T03:56:28.0761651Z parser.add_argument( 2025-03-14T03:56:28.0762153Z "--eligible-experiments", 2025-03-14T03:56:28.0762704Z type=_str_comma_separated_to_set, 2025-03-14T03:56:28.0763247Z required=False, 2025-03-14T03:56:28.0763688Z default="", 2025-03-14T03:56:28.0764581Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:56:28.0765816Z ) 2025-03-14T03:56:28.0766266Z parser.add_argument( 2025-03-14T03:56:28.0766739Z "--pr-number", 2025-03-14T03:56:28.0767174Z type=str, 2025-03-14T03:56:28.0767603Z required=False, 2025-03-14T03:56:28.0768273Z default="", 2025-03-14T03:56:28.0768949Z help="the optional PR number where this is run", 2025-03-14T03:56:28.0769543Z ) 2025-03-14T03:56:28.0769807Z 2025-03-14T03:56:28.0770035Z return parser.parse_args() 2025-03-14T03:56:28.0770466Z 2025-03-14T03:56:28.0770473Z 2025-03-14T03:56:28.0771057Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:56:28.0771850Z auth = Auth.Token(github_token) 2025-03-14T03:56:28.0772385Z return Github(auth=auth) 2025-03-14T03:56:28.0772710Z 2025-03-14T03:56:28.0772909Z 2025-03-14T03:56:28.0773401Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:56:28.0774283Z repo = gh.get_repo(repo) 2025-03-14T03:56:28.0774808Z return repo.get_issue(number=issue_num) 2025-03-14T03:56:28.0775194Z 2025-03-14T03:56:28.0775202Z 2025-03-14T03:56:28.0775413Z def get_potential_pr_author( 2025-03-14T03:56:28.0776260Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:56:28.0776983Z ) -> str: 2025-03-14T03:56:28.0777552Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:56:28.0778397Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:56:28.0779195Z # embedded in the tag name: ciflow// 2025-03-14T03:56:28.0779630Z 2025-03-14T03:56:28.0779833Z gh = get_gh_client(github_token) 2025-03-14T03:56:28.0780188Z 2025-03-14T03:56:28.0780486Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:56:28.0781158Z split_tag = ref_name.split("/") 2025-03-14T03:56:28.0781679Z if ( 2025-03-14T03:56:28.0782086Z len(split_tag) == 3 2025-03-14T03:56:28.0782595Z and split_tag[0] == "ciflow" 2025-03-14T03:56:28.0783146Z and split_tag[2].isnumeric() 2025-03-14T03:56:28.0783675Z ): 2025-03-14T03:56:28.0784113Z pr_number = split_tag[2] 2025-03-14T03:56:28.0784626Z try: 2025-03-14T03:56:28.0785076Z repository = gh.get_repo(repo) 2025-03-14T03:56:28.0785824Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:56:28.0786457Z except Exception as e: 2025-03-14T03:56:28.0787005Z raise Exception( # noqa: TRY002 2025-03-14T03:56:28.0787877Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:56:28.0788571Z ) from e 2025-03-14T03:56:28.0789120Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:56:28.0789869Z # In all other cases, return the original input username 2025-03-14T03:56:28.0790481Z return username 2025-03-14T03:56:28.0790732Z 2025-03-14T03:56:28.0790741Z 2025-03-14T03:56:28.0790986Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:56:28.0791548Z """ 2025-03-14T03:56:28.0792232Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:56:28.0793023Z """ 2025-03-14T03:56:28.0793600Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:56:28.0794140Z 2025-03-14T03:56:28.0794149Z 2025-03-14T03:56:28.0794360Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:56:28.0794884Z try: 2025-03-14T03:56:28.0795302Z data = yaml.safe_load(yaml_text) 2025-03-14T03:56:28.0795973Z return data 2025-03-14T03:56:28.0796420Z except yaml.YAMLError: 2025-03-14T03:56:28.0796930Z log.exception("Error loading YAML") 2025-03-14T03:56:28.0797488Z raise 2025-03-14T03:56:28.0797717Z 2025-03-14T03:56:28.0797725Z 2025-03-14T03:56:28.0798164Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:56:28.0798923Z """ 2025-03-14T03:56:28.0799568Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:56:28.0800185Z 2025-03-14T03:56:28.0800543Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:56:28.0801319Z and the text below is the list of opted in users. 2025-03-14T03:56:28.0801749Z 2025-03-14T03:56:28.0802150Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:56:28.0802873Z """ 2025-03-14T03:56:28.0803340Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:56:28.0803965Z if len(rollout_state_parts) >= 2: 2025-03-14T03:56:28.0804599Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:56:28.0805363Z else: 2025-03-14T03:56:28.0806089Z return "", rollout_state 2025-03-14T03:56:28.0806426Z 2025-03-14T03:56:28.0806434Z 2025-03-14T03:56:28.0806651Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:56:28.0807195Z """ 2025-03-14T03:56:28.0807741Z Dictionary of users with a list of features they have opted into 2025-03-14T03:56:28.0808414Z """ 2025-03-14T03:56:28.0808622Z 2025-03-14T03:56:28.0808630Z 2025-03-14T03:56:28.0808985Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:56:28.0809665Z """ 2025-03-14T03:56:28.0810390Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:56:28.0811093Z 2025-03-14T03:56:28.0811740Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:56:28.0812754Z - Example line: "@User1,lf,split_build" 2025-03-14T03:56:28.0813473Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:56:28.0813962Z 2025-03-14T03:56:28.0813970Z 2025-03-14T03:56:28.0814143Z """ 2025-03-14T03:56:28.0814533Z optins = UserOptins() 2025-03-14T03:56:28.0815038Z for user in user_optin_text.split("\n"): 2025-03-14T03:56:28.0815778Z user = user.strip("\r\n\t -") 2025-03-14T03:56:28.0816370Z if not user or not user.startswith("@"): 2025-03-14T03:56:28.0816964Z # Not a valid user. Skip 2025-03-14T03:56:28.0817486Z continue 2025-03-14T03:56:28.0817744Z 2025-03-14T03:56:28.0817917Z if user: 2025-03-14T03:56:28.0818380Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:56:28.0819098Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:56:28.0819767Z 2025-03-14T03:56:28.0819966Z return optins 2025-03-14T03:56:28.0820225Z 2025-03-14T03:56:28.0820233Z 2025-03-14T03:56:28.0820542Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:56:28.0821191Z """ 2025-03-14T03:56:28.0821612Z Check if the experiment name is valid. 2025-03-14T03:56:28.0822162Z A valid name: 2025-03-14T03:56:28.0822834Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:56:28.0823837Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:56:28.0824588Z - Cannot contain spaces 2025-03-14T03:56:28.0825066Z """ 2025-03-14T03:56:28.0825284Z 2025-03-14T03:56:28.0825670Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:56:28.0826404Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:56:28.0826861Z 2025-03-14T03:56:28.0827041Z if valid: 2025-03-14T03:56:28.0827457Z return True 2025-03-14T03:56:28.0827705Z 2025-03-14T03:56:28.0827883Z log.error( 2025-03-14T03:56:28.0829359Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-03-14T03:56:28.0831011Z ) 2025-03-14T03:56:28.0831395Z return False 2025-03-14T03:56:28.0831645Z 2025-03-14T03:56:28.0831654Z 2025-03-14T03:56:28.0831988Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:56:28.0832650Z """ 2025-03-14T03:56:28.0833269Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:56:28.0834028Z """ 2025-03-14T03:56:28.0834407Z try: 2025-03-14T03:56:28.0834812Z if settings_text: 2025-03-14T03:56:28.0835708Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:56:28.0836549Z # for easy reading 2025-03-14T03:56:28.0837372Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:56:28.0838496Z # the backtick character in shell commands. 2025-03-14T03:56:28.0839129Z backtick = chr(96) # backtick character 2025-03-14T03:56:28.0839825Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:56:28.0840519Z settings = load_yaml(settings_text) 2025-03-14T03:56:28.0840906Z 2025-03-14T03:56:28.0841324Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:56:28.0842110Z experiments = {} 2025-03-14T03:56:28.0842428Z 2025-03-14T03:56:28.0842797Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:56:28.0843577Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:56:28.0844732Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-03-14T03:56:28.0846150Z continue 2025-03-14T03:56:28.0846486Z 2025-03-14T03:56:28.0846684Z valid_settings = {} 2025-03-14T03:56:28.0847232Z for setting in exp_settings: 2025-03-14T03:56:28.0847844Z if setting not in Experiment._fields: 2025-03-14T03:56:28.0848435Z log.warning( 2025-03-14T03:56:28.0849174Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:56:28.0849920Z ) 2025-03-14T03:56:28.0850367Z else: 2025-03-14T03:56:28.0850905Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:56:28.0851351Z 2025-03-14T03:56:28.0851642Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:56:28.0852509Z return Settings(experiments) 2025-03-14T03:56:28.0852894Z 2025-03-14T03:56:28.0853086Z except Exception: 2025-03-14T03:56:28.0853606Z log.exception("Failed to parse settings") 2025-03-14T03:56:28.0854023Z 2025-03-14T03:56:28.0854206Z return Settings() 2025-03-14T03:56:28.0854480Z 2025-03-14T03:56:28.0854489Z 2025-03-14T03:56:28.0854751Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:56:28.0855339Z """ 2025-03-14T03:56:28.0855912Z Parse settings, if any, from the rollout state. 2025-03-14T03:56:28.0856330Z 2025-03-14T03:56:28.0856696Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:56:28.0857472Z and the text below is the list of opted in users. 2025-03-14T03:56:28.0857897Z 2025-03-14T03:56:28.0858338Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:56:28.0859102Z """ 2025-03-14T03:56:28.0859692Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:56:28.0860493Z return parse_settings_from_text(settings_text) 2025-03-14T03:56:28.0860908Z 2025-03-14T03:56:28.0860916Z 2025-03-14T03:56:28.0861190Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:56:28.0861771Z """ 2025-03-14T03:56:28.0862209Z Parse users from the rollout state. 2025-03-14T03:56:28.0862582Z 2025-03-14T03:56:28.0862750Z """ 2025-03-14T03:56:28.0863303Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:56:28.0864067Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:56:28.0864473Z 2025-03-14T03:56:28.0864481Z 2025-03-14T03:56:28.0864914Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:56:28.0865791Z """ 2025-03-14T03:56:28.0866240Z Check if a user is opted into an experiment 2025-03-14T03:56:28.0866818Z """ 2025-03-14T03:56:28.0867295Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:56:28.0867735Z 2025-03-14T03:56:28.0867742Z 2025-03-14T03:56:28.0868178Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:56:28.0869091Z """ 2025-03-14T03:56:28.0869573Z Check if a user explicitly opted out of an experiment 2025-03-14T03:56:28.0870182Z """ 2025-03-14T03:56:28.0870711Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:56:28.0871413Z experiment_optout = "-" + experiment_name 2025-03-14T03:56:28.0872075Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:56:28.0872690Z return False 2025-03-14T03:56:28.0872956Z 2025-03-14T03:56:28.0873237Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:56:28.0873898Z log.warning( 2025-03-14T03:56:28.0874727Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:56:28.0875773Z ) 2025-03-14T03:56:28.0876011Z 2025-03-14T03:56:28.0876185Z return True 2025-03-14T03:56:28.0876439Z 2025-03-14T03:56:28.0876446Z 2025-03-14T03:56:28.0876638Z def get_runner_prefix( 2025-03-14T03:56:28.0877112Z rollout_state: str, 2025-03-14T03:56:28.0877599Z workflow_requestors: Iterable[str], 2025-03-14T03:56:28.0878142Z branch: str, 2025-03-14T03:56:28.0878646Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:56:28.0879273Z is_canary: bool = False, 2025-03-14T03:56:28.0879748Z ) -> str: 2025-03-14T03:56:28.0880187Z settings = parse_settings(rollout_state) 2025-03-14T03:56:28.0880794Z user_optins = parse_users(rollout_state) 2025-03-14T03:56:28.0881177Z 2025-03-14T03:56:28.0881360Z fleet_prefix = "" 2025-03-14T03:56:28.0881805Z prefixes = [] 2025-03-14T03:56:28.0882452Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:56:28.0883412Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:56:28.0884309Z log.info( 2025-03-14T03:56:28.0885022Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:56:28.0886108Z ) 2025-03-14T03:56:28.0886527Z continue 2025-03-14T03:56:28.0886793Z 2025-03-14T03:56:28.0886995Z if eligible_experiments: 2025-03-14T03:56:28.0887568Z if experiment_name not in eligible_experiments: 2025-03-14T03:56:28.0888249Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:56:28.0888824Z log.info( 2025-03-14T03:56:28.0889645Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:56:28.0890513Z ) 2025-03-14T03:56:28.0890935Z continue 2025-03-14T03:56:28.0891436Z elif not experiment_settings.default: 2025-03-14T03:56:28.0891998Z log.info( 2025-03-14T03:56:28.0892699Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:56:28.0893468Z ) 2025-03-14T03:56:28.0893876Z continue 2025-03-14T03:56:28.0894136Z 2025-03-14T03:56:28.0894449Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:56:28.0895087Z opted_out_users = [ 2025-03-14T03:56:28.0895675Z requestor 2025-03-14T03:56:28.0896161Z for requestor in workflow_requestors 2025-03-14T03:56:28.0896863Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:56:28.0897529Z ] 2025-03-14T03:56:28.0897743Z 2025-03-14T03:56:28.0897938Z if opted_out_users: 2025-03-14T03:56:28.0898419Z log.info( 2025-03-14T03:56:28.0899074Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:56:28.0899820Z ) 2025-03-14T03:56:28.0900234Z continue 2025-03-14T03:56:28.0900492Z 2025-03-14T03:56:28.0900820Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:56:28.0901461Z opted_in_users = [ 2025-03-14T03:56:28.0901932Z requestor 2025-03-14T03:56:28.0903225Z for requestor in workflow_requestors 2025-03-14T03:56:28.0903943Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:56:28.0904596Z ] 2025-03-14T03:56:28.0904824Z 2025-03-14T03:56:28.0905009Z enabled = False 2025-03-14T03:56:28.0905629Z if opted_in_users: 2025-03-14T03:56:28.0906124Z log.info( 2025-03-14T03:56:28.0906761Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:56:28.0907478Z ) 2025-03-14T03:56:28.0907887Z enabled = True 2025-03-14T03:56:28.0908187Z 2025-03-14T03:56:28.0908416Z elif experiment_settings.rollout_perc: 2025-03-14T03:56:28.0909298Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:56:28.0910259Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:56:28.0910941Z log.info( 2025-03-14T03:56:28.0911854Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:56:28.0912823Z ) 2025-03-14T03:56:28.0913273Z enabled = True 2025-03-14T03:56:28.0913587Z 2025-03-14T03:56:28.0913765Z if enabled: 2025-03-14T03:56:28.0914232Z label = experiment_name 2025-03-14T03:56:28.0914863Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:56:28.0915838Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:56:28.0916775Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:56:28.0917737Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:56:28.0918448Z if is_canary: 2025-03-14T03:56:28.0918974Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:56:28.0919550Z fleet_prefix = label 2025-03-14T03:56:28.0920070Z else: 2025-03-14T03:56:28.0920513Z prefixes.append(label) 2025-03-14T03:56:28.0920877Z 2025-03-14T03:56:28.0921068Z if len(prefixes) > 1: 2025-03-14T03:56:28.0921538Z log.error( 2025-03-14T03:56:28.0922653Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-03-14T03:56:28.0923819Z ) 2025-03-14T03:56:28.0924228Z prefixes = prefixes[:1] 2025-03-14T03:56:28.0924560Z 2025-03-14T03:56:28.0924763Z # Fleet always comes first 2025-03-14T03:56:28.0925260Z if fleet_prefix: 2025-03-14T03:56:28.0926048Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:56:28.0926446Z 2025-03-14T03:56:28.0926721Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:56:28.0927158Z 2025-03-14T03:56:28.0927166Z 2025-03-14T03:56:28.0927624Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:56:28.0928446Z """ 2025-03-14T03:56:28.0929062Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:56:28.0929639Z 2025-03-14T03:56:28.0930043Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:56:28.0930779Z """ 2025-03-14T03:56:28.0931178Z gh = get_gh_client(github_token) 2025-03-14T03:56:28.0931764Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:56:28.0932425Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:56:28.0932896Z 2025-03-14T03:56:28.0932905Z 2025-03-14T03:56:28.0933320Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:56:28.0934113Z for _ in range(num_retries): 2025-03-14T03:56:28.0934622Z try: 2025-03-14T03:56:28.0935066Z req = Request(url=url, headers=headers) 2025-03-14T03:56:28.0935901Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:56:28.0936741Z return json.loads(content) 2025-03-14T03:56:28.0937287Z except Exception as e: 2025-03-14T03:56:28.0937848Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:56:28.0938269Z 2025-03-14T03:56:28.0938666Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:56:28.0939400Z return {} 2025-03-14T03:56:28.0939637Z 2025-03-14T03:56:28.0939645Z 2025-03-14T03:56:28.0939815Z @cache 2025-03-14T03:56:28.0940464Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:56:28.0941245Z """ 2025-03-14T03:56:28.0941663Z Dynamically get PR information 2025-03-14T03:56:28.0942174Z """ 2025-03-14T03:56:28.0942702Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:56:28.0943359Z headers = { 2025-03-14T03:56:28.0943848Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:56:28.0944502Z "Authorization": f"token {github_token}", 2025-03-14T03:56:28.0945072Z } 2025-03-14T03:56:28.0945630Z json_response: dict[str, Any] = download_json( 2025-03-14T03:56:28.0946280Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:56:28.0946853Z headers=headers, 2025-03-14T03:56:28.0947326Z ) 2025-03-14T03:56:28.0947537Z 2025-03-14T03:56:28.0947728Z if not json_response: 2025-03-14T03:56:28.0948326Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:56:28.0948997Z return {} 2025-03-14T03:56:28.0949245Z 2025-03-14T03:56:28.0949436Z return json_response 2025-03-14T03:56:28.0949722Z 2025-03-14T03:56:28.0949731Z 2025-03-14T03:56:28.0950145Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:56:28.0951050Z """ 2025-03-14T03:56:28.0951610Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:56:28.0952292Z """ 2025-03-14T03:56:28.0952797Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:56:28.0953442Z return { 2025-03-14T03:56:28.0954049Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:56:28.0954801Z } 2025-03-14T03:56:28.0955016Z 2025-03-14T03:56:28.0955023Z 2025-03-14T03:56:28.0955223Z def main() -> None: 2025-03-14T03:56:28.0955823Z args = parse_args() 2025-03-14T03:56:28.0956109Z 2025-03-14T03:56:28.0956346Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:56:28.0956743Z 2025-03-14T03:56:28.0956952Z # Check if the PR is opt-out 2025-03-14T03:56:28.0957460Z if args.pr_number: 2025-03-14T03:56:28.0958138Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:56:28.0958942Z if OPT_OUT_LABEL in labels: 2025-03-14T03:56:28.0959481Z log.info( 2025-03-14T03:56:28.0960212Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:56:28.0961019Z ) 2025-03-14T03:56:28.0961593Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:56:28.0962286Z sys.exit() 2025-03-14T03:56:28.0962558Z 2025-03-14T03:56:28.0962730Z try: 2025-03-14T03:56:28.0963184Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:56:28.0963919Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:56:28.0964584Z ) 2025-03-14T03:56:28.0964805Z 2025-03-14T03:56:28.0965022Z username = get_potential_pr_author( 2025-03-14T03:56:28.0965861Z args.github_token, 2025-03-14T03:56:28.0966433Z args.github_repo, 2025-03-14T03:56:28.0966941Z args.github_actor, 2025-03-14T03:56:28.0967445Z args.github_ref_type, 2025-03-14T03:56:28.0967974Z args.github_branch, 2025-03-14T03:56:28.0968458Z ) 2025-03-14T03:56:28.0968673Z 2025-03-14T03:56:28.0968970Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:56:28.0969596Z 2025-03-14T03:56:28.0969830Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:56:28.0970403Z rollout_state, 2025-03-14T03:56:28.0970910Z (args.github_issue_owner, username), 2025-03-14T03:56:28.0971487Z args.github_branch, 2025-03-14T03:56:28.0971999Z args.eligible_experiments, 2025-03-14T03:56:28.0972543Z is_canary, 2025-03-14T03:56:28.0972974Z ) 2025-03-14T03:56:28.0973197Z 2025-03-14T03:56:28.0973392Z except Exception as e: 2025-03-14T03:56:28.0973872Z log.error( 2025-03-14T03:56:28.0974571Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:56:28.0975359Z ) 2025-03-14T03:56:28.0975696Z 2025-03-14T03:56:28.0976061Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:56:28.0976578Z 2025-03-14T03:56:28.0976586Z 2025-03-14T03:56:28.0976776Z if __name__ == "__main__": 2025-03-14T03:56:28.0977249Z main() 2025-03-14T03:56:28.0977474Z 2025-03-14T03:56:28.1067595Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:56:28.1068508Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:56:28.1115247Z shell: /usr/bin/bash -e {0} 2025-03-14T03:56:28.1115900Z env: 2025-03-14T03:56:28.1116515Z GITHUB_TOKEN: *** 2025-03-14T03:56:28.1116960Z ISSUE_NUMBER: 5132 2025-03-14T03:56:28.1117428Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:56:28.1117950Z ISSUE_OWNER: 2025-03-14T03:56:28.1118384Z CHECK_EXPERIMENTS: 2025-03-14T03:56:28.1118828Z PR_NUMBER: 2025-03-14T03:56:28.1119228Z ##[endgroup] 2025-03-14T03:56:28.4257124Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:56:28.6791279Z Collecting urllib3==1.26.18 2025-03-14T03:56:28.7137965Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:56:28.7330217Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.4 MB/s eta 0:00:00 2025-03-14T03:56:28.7538722Z Collecting PyGithub==2.3.0 2025-03-14T03:56:28.7607098Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:56:28.8002358Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:56:28.8040864Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-03-14T03:56:28.8084864Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-14T03:56:28.8103275Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-03-14T03:56:28.8119890Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-14T03:56:28.8367775Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:56:28.8400320Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:56:28.8626436Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-03-14T03:56:28.9672679Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:56:28.9767796Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:56:29.0770878Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:56:29.0820585Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-03-14T03:56:29.0991504Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:56:29.1040213Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:56:29.1284066Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:56:29.1388890Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 18.1 MB/s eta 0:00:00 2025-03-14T03:56:29.1430941Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:56:29.1544240Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 35.6 MB/s eta 0:00:00 2025-03-14T03:56:29.1613652Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-14T03:56:29.1802266Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 48.8 MB/s eta 0:00:00 2025-03-14T03:56:29.1836432Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:56:29.1892444Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:56:29.1988886Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 57.9 MB/s eta 0:00:00 2025-03-14T03:56:29.2026849Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-03-14T03:56:29.2068143Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 29.2 MB/s eta 0:00:00 2025-03-14T03:56:29.2102895Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:56:29.2145927Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.4 MB/s eta 0:00:00 2025-03-14T03:56:29.5041744Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:56:30.0274947Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-03-14T03:56:30.1123856Z ##[group]Run curr_branch="main" 2025-03-14T03:56:30.1125052Z curr_branch="main" 2025-03-14T03:56:30.1126359Z curr_ref_type="branch" 2025-03-14T03:56:30.1127604Z echo "Current branch is '$curr_branch'" 2025-03-14T03:56:30.1128862Z  2025-03-14T03:56:30.1129812Z python3 runner_determinator.py \ 2025-03-14T03:56:30.1131141Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:56:30.1132475Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:56:30.1133846Z  --github-branch "$curr_branch" \ 2025-03-14T03:56:30.1135195Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:56:30.1136703Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:56:30.1138105Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:56:30.1139491Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:56:30.1141021Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:56:30.1142511Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:56:30.1192647Z shell: /usr/bin/bash -e {0} 2025-03-14T03:56:30.1193712Z env: 2025-03-14T03:56:30.1195087Z GITHUB_TOKEN: *** 2025-03-14T03:56:30.1196280Z ISSUE_NUMBER: 5132 2025-03-14T03:56:30.1197264Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:56:30.1198374Z ISSUE_OWNER: 2025-03-14T03:56:30.1199232Z CHECK_EXPERIMENTS: 2025-03-14T03:56:30.1200148Z PR_NUMBER: 2025-03-14T03:56:30.1200955Z ##[endgroup] 2025-03-14T03:56:30.1276036Z Current branch is 'main' 2025-03-14T03:56:31.5053191Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:56:31.5054217Z INFO : Setting output: label-type='' 2025-03-14T03:56:31.5374227Z Evaluate and set job outputs 2025-03-14T03:56:31.5381517Z Cleaning up orphan processes