2025-03-14T03:51:43.2990463Z Current runner version: '2.322.0' 2025-03-14T03:51:43.3016554Z ##[group]Operating System 2025-03-14T03:51:43.3017395Z Ubuntu 2025-03-14T03:51:43.3018012Z 24.04.2 2025-03-14T03:51:43.3018514Z LTS 2025-03-14T03:51:43.3019021Z ##[endgroup] 2025-03-14T03:51:43.3019534Z ##[group]Runner Image 2025-03-14T03:51:43.3020097Z Image: ubuntu-24.04 2025-03-14T03:51:43.3020649Z Version: 20250309.1.0 2025-03-14T03:51:43.3021702Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:51:43.3023081Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:51:43.3024040Z ##[endgroup] 2025-03-14T03:51:43.3024515Z ##[group]Runner Image Provisioner 2025-03-14T03:51:43.3025268Z 2.0.422.1 2025-03-14T03:51:43.3025827Z ##[endgroup] 2025-03-14T03:51:43.3026879Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:51:43.3028935Z Contents: read 2025-03-14T03:51:43.3029523Z Metadata: read 2025-03-14T03:51:43.3030298Z Packages: read 2025-03-14T03:51:43.3030894Z ##[endgroup] 2025-03-14T03:51:43.3034023Z Secret source: Actions 2025-03-14T03:51:43.3035317Z Prepare workflow directory 2025-03-14T03:51:43.3531790Z Prepare all required actions 2025-03-14T03:51:43.3587207Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:51:43.3591992Z ##[group] Inputs 2025-03-14T03:51:43.3592649Z check_experiments: 2025-03-14T03:51:43.3593232Z triggering_actor: pytorchmergebot 2025-03-14T03:51:43.3593970Z issue_owner: 2025-03-14T03:51:43.3594502Z curr_branch: main 2025-03-14T03:51:43.3595255Z curr_ref_type: branch 2025-03-14T03:51:43.3595805Z issue_number: 5132 2025-03-14T03:51:43.3596358Z ##[endgroup] 2025-03-14T03:51:43.3597000Z Complete job name: get-label-type / runner-determinator 2025-03-14T03:51:43.4296811Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:51:43.4298447Z cat < runner_determinator.py 2025-03-14T03:51:43.4299043Z # flake8: noqa: G004 2025-03-14T03:51:43.4299500Z  2025-03-14T03:51:43.4300165Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.4301119Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.4301947Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.4302555Z  2025-03-14T03:51:43.4302907Z """ 2025-03-14T03:51:43.4303515Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.4304420Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.4305580Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.4306442Z of which runners should be used to run which job. 2025-03-14T03:51:43.4307021Z  2025-03-14T03:51:43.4307629Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.4308558Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.4309459Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.4310167Z list, defined. 2025-03-14T03:51:43.4310576Z  2025-03-14T03:51:43.4311157Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.4312100Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.4312972Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.4313595Z  2025-03-14T03:51:43.4314178Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.4315185Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.4316300Z experiments which the user could be opted in to. 2025-03-14T03:51:43.4316881Z  2025-03-14T03:51:43.4317321Z The user list has the following rules: 2025-03-14T03:51:43.4317843Z  2025-03-14T03:51:43.4318368Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.4319234Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.4320024Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.4320585Z  2025-03-14T03:51:43.4320953Z Example config: 2025-03-14T03:51:43.4321480Z  # A list of experiments that can be opted into. 2025-03-14T03:51:43.4322248Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.4322906Z  # Expected syntax is: 2025-03-14T03:51:43.4323639Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.4325011Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.4325831Z  2025-03-14T03:51:43.4326239Z  experiments: 2025-03-14T03:51:43.4326682Z  lf: 2025-03-14T03:51:43.4327116Z  rollout_percent: 25 2025-03-14T03:51:43.4327677Z  all_branches: false 2025-03-14T03:51:43.4328179Z  default: true 2025-03-14T03:51:43.4328635Z  --- 2025-03-14T03:51:43.4329013Z  2025-03-14T03:51:43.4329383Z  # Opt-ins: 2025-03-14T03:51:43.4330027Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.4331095Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.4331911Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.4332609Z  # Experiments should be from the above list. 2025-03-14T03:51:43.4333159Z  2025-03-14T03:51:43.4333536Z  @User1,-lf,split_build 2025-03-14T03:51:43.4334019Z  @User2,lf 2025-03-14T03:51:43.4334447Z  @User3,split_build 2025-03-14T03:51:43.4335094Z """ 2025-03-14T03:51:43.4335460Z  2025-03-14T03:51:43.4335828Z import json 2025-03-14T03:51:43.4336245Z import logging 2025-03-14T03:51:43.4336672Z import os 2025-03-14T03:51:43.4337069Z import random 2025-03-14T03:51:43.4337513Z import re 2025-03-14T03:51:43.4337919Z import sys 2025-03-14T03:51:43.4338432Z from argparse import ArgumentParser 2025-03-14T03:51:43.4339068Z from collections.abc import Iterable 2025-03-14T03:51:43.4339661Z from functools import cache 2025-03-14T03:51:43.4340179Z from logging import LogRecord 2025-03-14T03:51:43.4340715Z from typing import Any, NamedTuple 2025-03-14T03:51:43.4341317Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.4341878Z  2025-03-14T03:51:43.4342239Z import yaml 2025-03-14T03:51:43.4342683Z from github import Auth, Github 2025-03-14T03:51:43.4343211Z from github.Issue import Issue 2025-03-14T03:51:43.4343707Z  2025-03-14T03:51:43.4344057Z  2025-03-14T03:51:43.4344499Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.4345344Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.4346253Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.4346973Z  2025-03-14T03:51:43.4347430Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.4348059Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.4348620Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.4349406Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.4349939Z  2025-03-14T03:51:43.4350349Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.4350860Z  2025-03-14T03:51:43.4351243Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.4351751Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.4352243Z  2025-03-14T03:51:43.4352612Z  2025-03-14T03:51:43.4352994Z class Experiment(NamedTuple): 2025-03-14T03:51:43.4353512Z  rollout_perc: float = ( 2025-03-14T03:51:43.4354223Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.4355025Z  ) 2025-03-14T03:51:43.4355432Z  all_branches: bool = ( 2025-03-14T03:51:43.4356133Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.4356871Z  ) 2025-03-14T03:51:43.4357301Z  default: bool = ( 2025-03-14T03:51:43.4357948Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.4358606Z  ) 2025-03-14T03:51:43.4358974Z  2025-03-14T03:51:43.4359357Z  # Add more fields as needed 2025-03-14T03:51:43.4359850Z  2025-03-14T03:51:43.4360197Z  2025-03-14T03:51:43.4360577Z class Settings(NamedTuple): 2025-03-14T03:51:43.4361122Z  """ 2025-03-14T03:51:43.4361674Z  Settings for the experiments that can be opted into. 2025-03-14T03:51:43.4362328Z  """ 2025-03-14T03:51:43.4362758Z  2025-03-14T03:51:43.4363205Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.4363738Z  2025-03-14T03:51:43.4364210Z  2025-03-14T03:51:43.4364785Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.4365464Z  """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.4366071Z  2025-03-14T03:51:43.4366428Z  COLORS = { 2025-03-14T03:51:43.4366877Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.4367427Z  "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.4367956Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.4368492Z  "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.4369024Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.4369523Z  } 2025-03-14T03:51:43.4369904Z  2025-03-14T03:51:43.4370343Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.4371127Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.4371924Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.4372530Z  return super().format(record) 2025-03-14T03:51:43.4373041Z  2025-03-14T03:51:43.4373396Z  2025-03-14T03:51:43.4373805Z handler = logging.StreamHandler() 2025-03-14T03:51:43.4374664Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.4375398Z  2025-03-14T03:51:43.4375864Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.4376481Z log.addHandler(handler) 2025-03-14T03:51:43.4376983Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.4377515Z  2025-03-14T03:51:43.4377917Z  2025-03-14T03:51:43.4378418Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.4379010Z  """ 2025-03-14T03:51:43.4379565Z  Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.4380213Z  """ 2025-03-14T03:51:43.4380663Z  if not GITHUB_OUTPUT: 2025-03-14T03:51:43.4381756Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.4382984Z  log.warning( 2025-03-14T03:51:43.4383869Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.4384885Z  ) 2025-03-14T03:51:43.4385383Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.4385938Z  return 2025-03-14T03:51:43.4386403Z  2025-03-14T03:51:43.4386854Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.4387463Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.4388055Z  f.write(f"{key}={value}\n") 2025-03-14T03:51:43.4388556Z  2025-03-14T03:51:43.4388907Z  2025-03-14T03:51:43.4389432Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.4390107Z  return frozenset( 2025-03-14T03:51:43.4390769Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.4391464Z  ) 2025-03-14T03:51:43.4391840Z  2025-03-14T03:51:43.4392187Z  2025-03-14T03:51:43.4392562Z def parse_args() -> Any: 2025-03-14T03:51:43.4393173Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.4394066Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.4394952Z  parser.add_argument( 2025-03-14T03:51:43.4395457Z  "--github-issue-repo", 2025-03-14T03:51:43.4395973Z  type=str, 2025-03-14T03:51:43.4396428Z  required=False, 2025-03-14T03:51:43.4397061Z  default="pytorch/test-infra", 2025-03-14T03:51:43.4397676Z  help="GitHub repo to get the issue", 2025-03-14T03:51:43.4398207Z  ) 2025-03-14T03:51:43.4398598Z  parser.add_argument( 2025-03-14T03:51:43.4399083Z  "--github-repo", 2025-03-14T03:51:43.4399554Z  type=str, 2025-03-14T03:51:43.4400001Z  required=True, 2025-03-14T03:51:43.4400522Z  help="GitHub repo where CI is running", 2025-03-14T03:51:43.4401058Z  ) 2025-03-14T03:51:43.4401495Z  parser.add_argument( 2025-03-14T03:51:43.4402184Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.4402855Z  ) 2025-03-14T03:51:43.4403251Z  parser.add_argument( 2025-03-14T03:51:43.4403937Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.4404713Z  ) 2025-03-14T03:51:43.4405118Z  parser.add_argument( 2025-03-14T03:51:43.4405812Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.4406513Z  ) 2025-03-14T03:51:43.4406913Z  parser.add_argument( 2025-03-14T03:51:43.4407614Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.4408332Z  ) 2025-03-14T03:51:43.4408733Z  parser.add_argument( 2025-03-14T03:51:43.4409228Z  "--github-ref-type", 2025-03-14T03:51:43.4409729Z  type=str, 2025-03-14T03:51:43.4410190Z  required=True, 2025-03-14T03:51:43.4410769Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.4411338Z  ) 2025-03-14T03:51:43.4411784Z  parser.add_argument( 2025-03-14T03:51:43.4412347Z  "--eligible-experiments", 2025-03-14T03:51:43.4412913Z  type=_str_comma_separated_to_set, 2025-03-14T03:51:43.4413461Z  required=False, 2025-03-14T03:51:43.4414082Z  default="", 2025-03-14T03:51:43.4415070Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.4416064Z  ) 2025-03-14T03:51:43.4416464Z  parser.add_argument( 2025-03-14T03:51:43.4416949Z  "--pr-number", 2025-03-14T03:51:43.4417448Z  type=str, 2025-03-14T03:51:43.4417903Z  required=False, 2025-03-14T03:51:43.4418370Z  default="", 2025-03-14T03:51:43.4418917Z  help="the optional PR number where this is run", 2025-03-14T03:51:43.4419495Z  ) 2025-03-14T03:51:43.4419873Z  2025-03-14T03:51:43.4420266Z  return parser.parse_args() 2025-03-14T03:51:43.4420757Z  2025-03-14T03:51:43.4421110Z  2025-03-14T03:51:43.4421728Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.4422513Z  auth = Auth.Token(github_token) 2025-03-14T03:51:43.4423054Z  return Github(auth=auth) 2025-03-14T03:51:43.4423549Z  2025-03-14T03:51:43.4423893Z  2025-03-14T03:51:43.4424657Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.4425477Z  repo = gh.get_repo(repo) 2025-03-14T03:51:43.4426031Z  return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.4426563Z  2025-03-14T03:51:43.4426918Z  2025-03-14T03:51:43.4427303Z def get_potential_pr_author( 2025-03-14T03:51:43.4428046Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.4428735Z ) -> str: 2025-03-14T03:51:43.4429440Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.4430280Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.4431062Z  # embedded in the tag name: ciflow// 2025-03-14T03:51:43.4431651Z  2025-03-14T03:51:43.4432048Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.4432563Z  2025-03-14T03:51:43.4433056Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.4433699Z  split_tag = ref_name.split("/") 2025-03-14T03:51:43.4434227Z  if ( 2025-03-14T03:51:43.4434789Z  len(split_tag) == 3 2025-03-14T03:51:43.4435342Z  and split_tag[0] == "ciflow" 2025-03-14T03:51:43.4435901Z  and split_tag[2].isnumeric() 2025-03-14T03:51:43.4436412Z  ): 2025-03-14T03:51:43.4436846Z  pr_number = split_tag[2] 2025-03-14T03:51:43.4437365Z  try: 2025-03-14T03:51:43.4437851Z  repository = gh.get_repo(repo) 2025-03-14T03:51:43.4438503Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.4439139Z  except Exception as e: 2025-03-14T03:51:43.4439694Z  raise Exception( # noqa: TRY002 2025-03-14T03:51:43.4440413Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.4441070Z  ) from e 2025-03-14T03:51:43.4441658Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.4442386Z  # In all other cases, return the original input username 2025-03-14T03:51:43.4442992Z  return username 2025-03-14T03:51:43.4443426Z  2025-03-14T03:51:43.4443791Z  2025-03-14T03:51:43.4444228Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.4444871Z  """ 2025-03-14T03:51:43.4445561Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.4446475Z  """ 2025-03-14T03:51:43.4447053Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.4447718Z  2025-03-14T03:51:43.4448063Z  2025-03-14T03:51:43.4448459Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.4448968Z  try: 2025-03-14T03:51:43.4449389Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.4449912Z  return data 2025-03-14T03:51:43.4450379Z  except yaml.YAMLError: 2025-03-14T03:51:43.4450906Z  log.exception("Error loading YAML") 2025-03-14T03:51:43.4451430Z  raise 2025-03-14T03:51:43.4451826Z  2025-03-14T03:51:43.4452168Z  2025-03-14T03:51:43.4452806Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.4453551Z  """ 2025-03-14T03:51:43.4454204Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.4455035Z  2025-03-14T03:51:43.4455603Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.4456382Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.4456946Z  2025-03-14T03:51:43.4457525Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.4458224Z  """ 2025-03-14T03:51:43.4458694Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.4459308Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.4460068Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.4460679Z  else: 2025-03-14T03:51:43.4461097Z  return "", rollout_state 2025-03-14T03:51:43.4461585Z  2025-03-14T03:51:43.4461926Z  2025-03-14T03:51:43.4462335Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.4462861Z  """ 2025-03-14T03:51:43.4463425Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.4464105Z  """ 2025-03-14T03:51:43.4464479Z  2025-03-14T03:51:43.4464921Z  2025-03-14T03:51:43.4465466Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.4466138Z  """ 2025-03-14T03:51:43.4466888Z  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:51:43.4467741Z  2025-03-14T03:51:43.4468546Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.4469543Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.4470250Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.4470891Z  2025-03-14T03:51:43.4471235Z  2025-03-14T03:51:43.4471585Z  """ 2025-03-14T03:51:43.4471986Z  optins = UserOptins() 2025-03-14T03:51:43.4472524Z  for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.4473105Z  user = user.strip("\r\n\t -") 2025-03-14T03:51:43.4473684Z  if not user or not user.startswith("@"): 2025-03-14T03:51:43.4474253Z  # Not a valid user. Skip 2025-03-14T03:51:43.4474939Z  continue 2025-03-14T03:51:43.4475369Z  2025-03-14T03:51:43.4475733Z  if user: 2025-03-14T03:51:43.4476232Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.4476945Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.4477732Z  2025-03-14T03:51:43.4478098Z  return optins 2025-03-14T03:51:43.4478527Z  2025-03-14T03:51:43.4478872Z  2025-03-14T03:51:43.4479379Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.4480005Z  """ 2025-03-14T03:51:43.4480439Z  Check if the experiment name is valid. 2025-03-14T03:51:43.4480979Z  A valid name: 2025-03-14T03:51:43.4481668Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.4482615Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.4483327Z  - Cannot contain spaces 2025-03-14T03:51:43.4483815Z  """ 2025-03-14T03:51:43.4484187Z  2025-03-14T03:51:43.4484882Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.4485730Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.4486363Z  2025-03-14T03:51:43.4486717Z  if valid: 2025-03-14T03:51:43.4487138Z  return True 2025-03-14T03:51:43.4487596Z  2025-03-14T03:51:43.4487955Z  log.error( 2025-03-14T03:51:43.4489388Z  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:51:43.4490876Z  ) 2025-03-14T03:51:43.4491255Z  return False 2025-03-14T03:51:43.4491673Z  2025-03-14T03:51:43.4492020Z  2025-03-14T03:51:43.4492696Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.4493336Z  """ 2025-03-14T03:51:43.4493956Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.4494783Z  """ 2025-03-14T03:51:43.4495161Z  try: 2025-03-14T03:51:43.4495553Z  if settings_text: 2025-03-14T03:51:43.4496319Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.4497095Z  # for easy reading 2025-03-14T03:51:43.4497918Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.4498814Z  # the backtick character in shell commands. 2025-03-14T03:51:43.4499442Z  backtick = chr(96) # backtick character 2025-03-14T03:51:43.4500140Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.4500826Z  settings = load_yaml(settings_text) 2025-03-14T03:51:43.4501345Z  2025-03-14T03:51:43.4501946Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.4502700Z  experiments = {} 2025-03-14T03:51:43.4503171Z  2025-03-14T03:51:43.4503737Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.4504513Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.4505697Z  # 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:51:43.4506715Z  continue 2025-03-14T03:51:43.4507183Z  2025-03-14T03:51:43.4507570Z  valid_settings = {} 2025-03-14T03:51:43.4508139Z  for setting in exp_settings: 2025-03-14T03:51:43.4508729Z  if setting not in Experiment._fields: 2025-03-14T03:51:43.4509431Z  log.warning( 2025-03-14T03:51:43.4510167Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.4510907Z  ) 2025-03-14T03:51:43.4511372Z  else: 2025-03-14T03:51:43.4511932Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.4512517Z  2025-03-14T03:51:43.4512997Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.4513659Z  return Settings(experiments) 2025-03-14T03:51:43.4514170Z  2025-03-14T03:51:43.4514542Z  except Exception: 2025-03-14T03:51:43.4515178Z  log.exception("Failed to parse settings") 2025-03-14T03:51:43.4515724Z  2025-03-14T03:51:43.4516097Z  return Settings() 2025-03-14T03:51:43.4516549Z  2025-03-14T03:51:43.4516903Z  2025-03-14T03:51:43.4517400Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.4517981Z  """ 2025-03-14T03:51:43.4518453Z  Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.4519011Z  2025-03-14T03:51:43.4519563Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.4520342Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.4520908Z  2025-03-14T03:51:43.4521512Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.4522240Z  """ 2025-03-14T03:51:43.4522828Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.4523742Z  return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.4524306Z  2025-03-14T03:51:43.4524734Z  2025-03-14T03:51:43.4525222Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.4525797Z  """ 2025-03-14T03:51:43.4526226Z  Parse users from the rollout state. 2025-03-14T03:51:43.4526737Z  2025-03-14T03:51:43.4527083Z  """ 2025-03-14T03:51:43.4527652Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.4528415Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.4528970Z  2025-03-14T03:51:43.4529316Z  2025-03-14T03:51:43.4529949Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.4530695Z  """ 2025-03-14T03:51:43.4531150Z  Check if a user is opted into an experiment 2025-03-14T03:51:43.4531704Z  """ 2025-03-14T03:51:43.4532196Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.4532786Z  2025-03-14T03:51:43.4533122Z  2025-03-14T03:51:43.4533750Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.4534502Z  """ 2025-03-14T03:51:43.4535094Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.4535685Z  """ 2025-03-14T03:51:43.4536250Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.4536957Z  experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.4537627Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.4538234Z  return False 2025-03-14T03:51:43.4538674Z  2025-03-14T03:51:43.4539152Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.4539756Z  log.warning( 2025-03-14T03:51:43.4540576Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.4541568Z  ) 2025-03-14T03:51:43.4541957Z  2025-03-14T03:51:43.4542320Z  return True 2025-03-14T03:51:43.4542729Z  2025-03-14T03:51:43.4543098Z  2025-03-14T03:51:43.4543469Z def get_runner_prefix( 2025-03-14T03:51:43.4543978Z  rollout_state: str, 2025-03-14T03:51:43.4544481Z  workflow_requestors: Iterable[str], 2025-03-14T03:51:43.4545116Z  branch: str, 2025-03-14T03:51:43.4545656Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.4546270Z  is_canary: bool = False, 2025-03-14T03:51:43.4546749Z ) -> str: 2025-03-14T03:51:43.4547220Z  settings = parse_settings(rollout_state) 2025-03-14T03:51:43.4547821Z  user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.4548343Z  2025-03-14T03:51:43.4548707Z  fleet_prefix = "" 2025-03-14T03:51:43.4549168Z  prefixes = [] 2025-03-14T03:51:43.4549841Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.4550784Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.4551498Z  log.info( 2025-03-14T03:51:43.4552206Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.4552946Z  ) 2025-03-14T03:51:43.4553354Z  continue 2025-03-14T03:51:43.4553783Z  2025-03-14T03:51:43.4554168Z  if eligible_experiments: 2025-03-14T03:51:43.4554963Z  if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.4555626Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.4556186Z  log.info( 2025-03-14T03:51:43.4557003Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.4557833Z  ) 2025-03-14T03:51:43.4558272Z  continue 2025-03-14T03:51:43.4558788Z  elif not experiment_settings.default: 2025-03-14T03:51:43.4559349Z  log.info( 2025-03-14T03:51:43.4560047Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.4560768Z  ) 2025-03-14T03:51:43.4561178Z  continue 2025-03-14T03:51:43.4561610Z  2025-03-14T03:51:43.4562085Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.4562713Z  opted_out_users = [ 2025-03-14T03:51:43.4563215Z  requestor 2025-03-14T03:51:43.4563718Z  for requestor in workflow_requestors 2025-03-14T03:51:43.4564410Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.4565134Z  ] 2025-03-14T03:51:43.4565512Z  2025-03-14T03:51:43.4565878Z  if opted_out_users: 2025-03-14T03:51:43.4566358Z  log.info( 2025-03-14T03:51:43.4567023Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.4567715Z  ) 2025-03-14T03:51:43.4568120Z  continue 2025-03-14T03:51:43.4568543Z  2025-03-14T03:51:43.4569015Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.4569632Z  opted_in_users = [ 2025-03-14T03:51:43.4570115Z  requestor 2025-03-14T03:51:43.4570613Z  for requestor in workflow_requestors 2025-03-14T03:51:43.4571292Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.4572038Z  ] 2025-03-14T03:51:43.4572421Z  2025-03-14T03:51:43.4572783Z  enabled = False 2025-03-14T03:51:43.4573311Z  if opted_in_users: 2025-03-14T03:51:43.4573785Z  log.info( 2025-03-14T03:51:43.4574427Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.4575194Z  ) 2025-03-14T03:51:43.4575619Z  enabled = True 2025-03-14T03:51:43.4576076Z  2025-03-14T03:51:43.4576498Z  elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.4577347Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.4578284Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.4578933Z  log.info( 2025-03-14T03:51:43.4579810Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.4580706Z  ) 2025-03-14T03:51:43.4581145Z  enabled = True 2025-03-14T03:51:43.4581620Z  2025-03-14T03:51:43.4581980Z  if enabled: 2025-03-14T03:51:43.4582454Z  label = experiment_name 2025-03-14T03:51:43.4583035Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.4583862Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.4584940Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.4585727Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.4586400Z  if is_canary: 2025-03-14T03:51:43.4586937Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.4587499Z  fleet_prefix = label 2025-03-14T03:51:43.4587997Z  else: 2025-03-14T03:51:43.4588469Z  prefixes.append(label) 2025-03-14T03:51:43.4588973Z  2025-03-14T03:51:43.4589345Z  if len(prefixes) > 1: 2025-03-14T03:51:43.4589825Z  log.error( 2025-03-14T03:51:43.4590870Z  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:51:43.4591934Z  ) 2025-03-14T03:51:43.4592354Z  prefixes = prefixes[:1] 2025-03-14T03:51:43.4592841Z  2025-03-14T03:51:43.4593223Z  # Fleet always comes first 2025-03-14T03:51:43.4593730Z  if fleet_prefix: 2025-03-14T03:51:43.4594216Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.4594826Z  2025-03-14T03:51:43.4595285Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.4595853Z  2025-03-14T03:51:43.4596195Z  2025-03-14T03:51:43.4596833Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.4597589Z  """ 2025-03-14T03:51:43.4598195Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.4598891Z  2025-03-14T03:51:43.4599474Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.4600178Z  """ 2025-03-14T03:51:43.4600593Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.4601154Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.4601836Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.4602583Z  2025-03-14T03:51:43.4602924Z  2025-03-14T03:51:43.4603525Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.4604274Z  for _ in range(num_retries): 2025-03-14T03:51:43.4604862Z  try: 2025-03-14T03:51:43.4605362Z  req = Request(url=url, headers=headers) 2025-03-14T03:51:43.4606034Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.4606687Z  return json.loads(content) 2025-03-14T03:51:43.4607218Z  except Exception as e: 2025-03-14T03:51:43.4607797Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.4608355Z  2025-03-14T03:51:43.4608933Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.4609715Z  return {} 2025-03-14T03:51:43.4610126Z  2025-03-14T03:51:43.4610469Z  2025-03-14T03:51:43.4610816Z @cache 2025-03-14T03:51:43.4611463Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.4612218Z  """ 2025-03-14T03:51:43.4612642Z  Dynamically get PR information 2025-03-14T03:51:43.4613178Z  """ 2025-03-14T03:51:43.4613705Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.4614328Z  headers = { 2025-03-14T03:51:43.4614914Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.4615570Z  "Authorization": f"token {github_token}", 2025-03-14T03:51:43.4616099Z  } 2025-03-14T03:51:43.4616675Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.4617329Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.4617888Z  headers=headers, 2025-03-14T03:51:43.4618351Z  ) 2025-03-14T03:51:43.4618712Z  2025-03-14T03:51:43.4619078Z  if not json_response: 2025-03-14T03:51:43.4619697Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.4620323Z  return {} 2025-03-14T03:51:43.4620745Z  2025-03-14T03:51:43.4621112Z  return json_response 2025-03-14T03:51:43.4621564Z  2025-03-14T03:51:43.4621904Z  2025-03-14T03:51:43.4622499Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.4623221Z  """ 2025-03-14T03:51:43.4623775Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.4624428Z  """ 2025-03-14T03:51:43.4625064Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.4625687Z  return { 2025-03-14T03:51:43.4626304Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.4626985Z  } 2025-03-14T03:51:43.4627345Z  2025-03-14T03:51:43.4627699Z  2025-03-14T03:51:43.4628061Z def main() -> None: 2025-03-14T03:51:43.4628515Z  args = parse_args() 2025-03-14T03:51:43.4628964Z  2025-03-14T03:51:43.4629390Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.4629929Z  2025-03-14T03:51:43.4630311Z  # Check if the PR is opt-out 2025-03-14T03:51:43.4630826Z  if args.pr_number: 2025-03-14T03:51:43.4631521Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.4632287Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.4632796Z  log.info( 2025-03-14T03:51:43.4633522Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.4634426Z  ) 2025-03-14T03:51:43.4635110Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.4635800Z  sys.exit() 2025-03-14T03:51:43.4636274Z  2025-03-14T03:51:43.4636612Z  try: 2025-03-14T03:51:43.4637078Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.4637802Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.4638445Z  ) 2025-03-14T03:51:43.4638831Z  2025-03-14T03:51:43.4639235Z  username = get_potential_pr_author( 2025-03-14T03:51:43.4639785Z  args.github_token, 2025-03-14T03:51:43.4640300Z  args.github_repo, 2025-03-14T03:51:43.4640807Z  args.github_actor, 2025-03-14T03:51:43.4641328Z  args.github_ref_type, 2025-03-14T03:51:43.4641847Z  args.github_branch, 2025-03-14T03:51:43.4642333Z  ) 2025-03-14T03:51:43.4642721Z  2025-03-14T03:51:43.4643202Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.4643807Z  2025-03-14T03:51:43.4644229Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.4644887Z  rollout_state, 2025-03-14T03:51:43.4645419Z  (args.github_issue_owner, username), 2025-03-14T03:51:43.4645975Z  args.github_branch, 2025-03-14T03:51:43.4646516Z  args.eligible_experiments, 2025-03-14T03:51:43.4647049Z  is_canary, 2025-03-14T03:51:43.4647609Z  ) 2025-03-14T03:51:43.4648592Z  2025-03-14T03:51:43.4649130Z  except Exception as e: 2025-03-14T03:51:43.4649955Z  log.error( 2025-03-14T03:51:43.4651211Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.4652444Z  ) 2025-03-14T03:51:43.4653004Z  2025-03-14T03:51:43.4653550Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.4654204Z  2025-03-14T03:51:43.4654541Z  2025-03-14T03:51:43.4655147Z if __name__ == "__main__": 2025-03-14T03:51:43.4655625Z  main() 2025-03-14T03:51:43.4656015Z  2025-03-14T03:51:43.4656353Z EOF 2025-03-14T03:51:43.4656704Z  2025-03-14T03:51:43.4657080Z cat runner_determinator.py 2025-03-14T03:51:43.5029620Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.5030381Z env: 2025-03-14T03:51:43.5031041Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.5031446Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.5031883Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.5032377Z ISSUE_OWNER: 2025-03-14T03:51:43.5032776Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.5033169Z PR_NUMBER: 2025-03-14T03:51:43.5093279Z ##[endgroup] 2025-03-14T03:51:43.5318465Z # flake8: noqa: G004 2025-03-14T03:51:43.5318796Z 2025-03-14T03:51:43.5319222Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.5320158Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.5320914Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.5321344Z 2025-03-14T03:51:43.5321495Z """ 2025-03-14T03:51:43.5322043Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.5322862Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.5323741Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.5324511Z of which runners should be used to run which job. 2025-03-14T03:51:43.5325775Z 2025-03-14T03:51:43.5326167Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.5327031Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.5327875Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.5328530Z list, defined. 2025-03-14T03:51:43.5328750Z 2025-03-14T03:51:43.5329097Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.5329954Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.5330731Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.5331159Z 2025-03-14T03:51:43.5331512Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.5332344Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.5333039Z experiments which the user could be opted in to. 2025-03-14T03:51:43.5333435Z 2025-03-14T03:51:43.5333620Z The user list has the following rules: 2025-03-14T03:51:43.5333953Z 2025-03-14T03:51:43.5334245Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.5335252Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.5335979Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.5336350Z 2025-03-14T03:51:43.5336635Z Example config: 2025-03-14T03:51:43.5337328Z # A list of experiments that can be opted into. 2025-03-14T03:51:43.5338356Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.5339357Z # Expected syntax is: 2025-03-14T03:51:43.5340318Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.5341449Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.5342044Z 2025-03-14T03:51:43.5342204Z experiments: 2025-03-14T03:51:43.5342578Z lf: 2025-03-14T03:51:43.5342933Z rollout_percent: 25 2025-03-14T03:51:43.5343373Z all_branches: false 2025-03-14T03:51:43.5343793Z default: true 2025-03-14T03:51:43.5344175Z --- 2025-03-14T03:51:43.5344372Z 2025-03-14T03:51:43.5344526Z # Opt-ins: 2025-03-14T03:51:43.5345356Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.5346188Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.5346931Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.5347539Z # Experiments should be from the above list. 2025-03-14T03:51:43.5347913Z 2025-03-14T03:51:43.5348082Z @User1,-lf,split_build 2025-03-14T03:51:43.5348498Z @User2,lf 2025-03-14T03:51:43.5348867Z @User3,split_build 2025-03-14T03:51:43.5349255Z """ 2025-03-14T03:51:43.5349435Z 2025-03-14T03:51:43.5349587Z import json 2025-03-14T03:51:43.5349935Z import logging 2025-03-14T03:51:43.5350301Z import os 2025-03-14T03:51:43.5350646Z import random 2025-03-14T03:51:43.5351054Z import re 2025-03-14T03:51:43.5351447Z import sys 2025-03-14T03:51:43.5351817Z from argparse import ArgumentParser 2025-03-14T03:51:43.5352318Z from collections.abc import Iterable 2025-03-14T03:51:43.5352811Z from functools import cache 2025-03-14T03:51:43.5353256Z from logging import LogRecord 2025-03-14T03:51:43.5353705Z from typing import Any, NamedTuple 2025-03-14T03:51:43.5354212Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.5354810Z 2025-03-14T03:51:43.5355023Z import yaml 2025-03-14T03:51:43.5355402Z from github import Auth, Github 2025-03-14T03:51:43.5355866Z from github.Issue import Issue 2025-03-14T03:51:43.5356147Z 2025-03-14T03:51:43.5356153Z 2025-03-14T03:51:43.5356361Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.5357016Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.5357826Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.5358504Z 2025-03-14T03:51:43.5358720Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.5359263Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.5359742Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.5360251Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.5360588Z 2025-03-14T03:51:43.5360771Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.5361086Z 2025-03-14T03:51:43.5361259Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.5361700Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.5362000Z 2025-03-14T03:51:43.5362006Z 2025-03-14T03:51:43.5362187Z class Experiment(NamedTuple): 2025-03-14T03:51:43.5362634Z rollout_perc: float = ( 2025-03-14T03:51:43.5363237Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.5363867Z ) 2025-03-14T03:51:43.5364218Z all_branches: bool = ( 2025-03-14T03:51:43.5365035Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.5365722Z ) 2025-03-14T03:51:43.5366059Z default: bool = ( 2025-03-14T03:51:43.5366595Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.5367194Z ) 2025-03-14T03:51:43.5367374Z 2025-03-14T03:51:43.5367546Z # Add more fields as needed 2025-03-14T03:51:43.5367828Z 2025-03-14T03:51:43.5367835Z 2025-03-14T03:51:43.5368016Z class Settings(NamedTuple): 2025-03-14T03:51:43.5368486Z """ 2025-03-14T03:51:43.5368914Z Settings for the experiments that can be opted into. 2025-03-14T03:51:43.5369452Z """ 2025-03-14T03:51:43.5369634Z 2025-03-14T03:51:43.5369830Z experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.5370171Z 2025-03-14T03:51:43.5370178Z 2025-03-14T03:51:43.5370513Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.5371112Z """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.5371514Z 2025-03-14T03:51:43.5371669Z COLORS = { 2025-03-14T03:51:43.5372044Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.5372515Z "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.5372981Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.5373446Z "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.5373891Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.5374327Z } 2025-03-14T03:51:43.5374513Z 2025-03-14T03:51:43.5374933Z def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.5375669Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.5376401Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.5376947Z return super().format(record) 2025-03-14T03:51:43.5377274Z 2025-03-14T03:51:43.5377280Z 2025-03-14T03:51:43.5377473Z handler = logging.StreamHandler() 2025-03-14T03:51:43.5378142Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.5378670Z 2025-03-14T03:51:43.5378897Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.5379451Z log.addHandler(handler) 2025-03-14T03:51:43.5379872Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.5380143Z 2025-03-14T03:51:43.5380149Z 2025-03-14T03:51:43.5380383Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.5380917Z """ 2025-03-14T03:51:43.5381399Z Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.5381990Z """ 2025-03-14T03:51:43.5382332Z if not GITHUB_OUTPUT: 2025-03-14T03:51:43.5383403Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.5385378Z log.warning( 2025-03-14T03:51:43.5386784Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.5388318Z ) 2025-03-14T03:51:43.5401986Z print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.5403155Z return 2025-03-14T03:51:43.5403523Z 2025-03-14T03:51:43.5403838Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.5404949Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.5405893Z f.write(f"{key}={value}\n") 2025-03-14T03:51:43.5406435Z 2025-03-14T03:51:43.5406445Z 2025-03-14T03:51:43.5406937Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.5407978Z return frozenset( 2025-03-14T03:51:43.5408959Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.5410035Z ) 2025-03-14T03:51:43.5410377Z 2025-03-14T03:51:43.5410389Z 2025-03-14T03:51:43.5410685Z def parse_args() -> Any: 2025-03-14T03:51:43.5411487Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.5412321Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.5413069Z parser.add_argument( 2025-03-14T03:51:43.5413498Z "--github-issue-repo", 2025-03-14T03:51:43.5414048Z type=str, 2025-03-14T03:51:43.5414433Z required=False, 2025-03-14T03:51:43.5415074Z default="pytorch/test-infra", 2025-03-14T03:51:43.5415593Z help="GitHub repo to get the issue", 2025-03-14T03:51:43.5416065Z ) 2025-03-14T03:51:43.5416419Z parser.add_argument( 2025-03-14T03:51:43.5416850Z "--github-repo", 2025-03-14T03:51:43.5417258Z type=str, 2025-03-14T03:51:43.5417630Z required=True, 2025-03-14T03:51:43.5418076Z help="GitHub repo where CI is running", 2025-03-14T03:51:43.5418578Z ) 2025-03-14T03:51:43.5418919Z parser.add_argument( 2025-03-14T03:51:43.5419488Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.5420315Z ) 2025-03-14T03:51:43.5420682Z parser.add_argument( 2025-03-14T03:51:43.5421274Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.5421921Z ) 2025-03-14T03:51:43.5422262Z parser.add_argument( 2025-03-14T03:51:43.5422860Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.5423506Z ) 2025-03-14T03:51:43.5423840Z parser.add_argument( 2025-03-14T03:51:43.5424456Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.5425442Z ) 2025-03-14T03:51:43.5425787Z parser.add_argument( 2025-03-14T03:51:43.5426210Z "--github-ref-type", 2025-03-14T03:51:43.5426628Z type=str, 2025-03-14T03:51:43.5427003Z required=True, 2025-03-14T03:51:43.5427452Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.5427980Z ) 2025-03-14T03:51:43.5428325Z parser.add_argument( 2025-03-14T03:51:43.5428763Z "--eligible-experiments", 2025-03-14T03:51:43.5429245Z type=_str_comma_separated_to_set, 2025-03-14T03:51:43.5429736Z required=False, 2025-03-14T03:51:43.5430141Z default="", 2025-03-14T03:51:43.5430934Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.5431801Z ) 2025-03-14T03:51:43.5432144Z parser.add_argument( 2025-03-14T03:51:43.5432554Z "--pr-number", 2025-03-14T03:51:43.5432944Z type=str, 2025-03-14T03:51:43.5433318Z required=False, 2025-03-14T03:51:43.5433702Z default="", 2025-03-14T03:51:43.5434144Z help="the optional PR number where this is run", 2025-03-14T03:51:43.5434815Z ) 2025-03-14T03:51:43.5435002Z 2025-03-14T03:51:43.5435186Z return parser.parse_args() 2025-03-14T03:51:43.5435473Z 2025-03-14T03:51:43.5435479Z 2025-03-14T03:51:43.5435864Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.5436574Z auth = Auth.Token(github_token) 2025-03-14T03:51:43.5437047Z return Github(auth=auth) 2025-03-14T03:51:43.5437472Z 2025-03-14T03:51:43.5437478Z 2025-03-14T03:51:43.5437906Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.5438653Z repo = gh.get_repo(repo) 2025-03-14T03:51:43.5439123Z return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.5439462Z 2025-03-14T03:51:43.5439468Z 2025-03-14T03:51:43.5439650Z def get_potential_pr_author( 2025-03-14T03:51:43.5440250Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.5440880Z ) -> str: 2025-03-14T03:51:43.5441366Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.5442115Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.5442816Z # embedded in the tag name: ciflow// 2025-03-14T03:51:43.5443204Z 2025-03-14T03:51:43.5443386Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.5443697Z 2025-03-14T03:51:43.5443946Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.5444540Z split_tag = ref_name.split("/") 2025-03-14T03:51:43.5445179Z if ( 2025-03-14T03:51:43.5445547Z len(split_tag) == 3 2025-03-14T03:51:43.5445998Z and split_tag[0] == "ciflow" 2025-03-14T03:51:43.5446488Z and split_tag[2].isnumeric() 2025-03-14T03:51:43.5446963Z ): 2025-03-14T03:51:43.5447331Z pr_number = split_tag[2] 2025-03-14T03:51:43.5447797Z try: 2025-03-14T03:51:43.5448196Z repository = gh.get_repo(repo) 2025-03-14T03:51:43.5448767Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.5449336Z except Exception as e: 2025-03-14T03:51:43.5449825Z raise Exception( # noqa: TRY002 2025-03-14T03:51:43.5450578Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.5451191Z ) from e 2025-03-14T03:51:43.5451686Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.5452340Z # In all other cases, return the original input username 2025-03-14T03:51:43.5452894Z return username 2025-03-14T03:51:43.5453120Z 2025-03-14T03:51:43.5453128Z 2025-03-14T03:51:43.5453335Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.5453839Z """ 2025-03-14T03:51:43.5454442Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.5455422Z """ 2025-03-14T03:51:43.5455937Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.5456448Z 2025-03-14T03:51:43.5456455Z 2025-03-14T03:51:43.5456638Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.5457111Z try: 2025-03-14T03:51:43.5457476Z data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.5457956Z return data 2025-03-14T03:51:43.5458350Z except yaml.YAMLError: 2025-03-14T03:51:43.5458811Z log.exception("Error loading YAML") 2025-03-14T03:51:43.5459304Z raise 2025-03-14T03:51:43.5459511Z 2025-03-14T03:51:43.5459516Z 2025-03-14T03:51:43.5459914Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.5460610Z """ 2025-03-14T03:51:43.5461185Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.5461786Z 2025-03-14T03:51:43.5462111Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.5462818Z and the text below is the list of opted in users. 2025-03-14T03:51:43.5463198Z 2025-03-14T03:51:43.5463555Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.5464215Z """ 2025-03-14T03:51:43.5464818Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.5465406Z if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.5465976Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.5466689Z else: 2025-03-14T03:51:43.5467052Z return "", rollout_state 2025-03-14T03:51:43.5467343Z 2025-03-14T03:51:43.5467348Z 2025-03-14T03:51:43.5467542Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.5468016Z """ 2025-03-14T03:51:43.5468507Z Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.5469117Z """ 2025-03-14T03:51:43.5469298Z 2025-03-14T03:51:43.5469304Z 2025-03-14T03:51:43.5469630Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.5470238Z """ 2025-03-14T03:51:43.5470894Z 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:51:43.5471532Z 2025-03-14T03:51:43.5472108Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.5473045Z - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.5473696Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.5474144Z 2025-03-14T03:51:43.5474157Z 2025-03-14T03:51:43.5474303Z """ 2025-03-14T03:51:43.5474764Z optins = UserOptins() 2025-03-14T03:51:43.5475228Z for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.5475740Z user = user.strip("\r\n\t -") 2025-03-14T03:51:43.5476259Z if not user or not user.startswith("@"): 2025-03-14T03:51:43.5476782Z # Not a valid user. Skip 2025-03-14T03:51:43.5477245Z continue 2025-03-14T03:51:43.5477473Z 2025-03-14T03:51:43.5477628Z if user: 2025-03-14T03:51:43.5478035Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.5478696Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.5479282Z 2025-03-14T03:51:43.5479446Z return optins 2025-03-14T03:51:43.5479667Z 2025-03-14T03:51:43.5479673Z 2025-03-14T03:51:43.5479953Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.5480514Z """ 2025-03-14T03:51:43.5480879Z Check if the experiment name is valid. 2025-03-14T03:51:43.5481364Z A valid name: 2025-03-14T03:51:43.5481957Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.5482841Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.5483516Z - Cannot contain spaces 2025-03-14T03:51:43.5483946Z """ 2025-03-14T03:51:43.5484125Z 2025-03-14T03:51:43.5484367Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.5485132Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.5485556Z 2025-03-14T03:51:43.5485706Z if valid: 2025-03-14T03:51:43.5486066Z return True 2025-03-14T03:51:43.5486290Z 2025-03-14T03:51:43.5486444Z log.error( 2025-03-14T03:51:43.5487804Z 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:51:43.5489314Z ) 2025-03-14T03:51:43.5489646Z return False 2025-03-14T03:51:43.5489870Z 2025-03-14T03:51:43.5489876Z 2025-03-14T03:51:43.5490161Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.5490746Z """ 2025-03-14T03:51:43.5491297Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.5491976Z """ 2025-03-14T03:51:43.5492296Z try: 2025-03-14T03:51:43.5492644Z if settings_text: 2025-03-14T03:51:43.5493317Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.5494066Z # for easy reading 2025-03-14T03:51:43.5494896Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.5495893Z # the backtick character in shell commands. 2025-03-14T03:51:43.5496462Z backtick = chr(96) # backtick character 2025-03-14T03:51:43.5497107Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.5497734Z settings = load_yaml(settings_text) 2025-03-14T03:51:43.5498082Z 2025-03-14T03:51:43.5498467Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.5499169Z experiments = {} 2025-03-14T03:51:43.5499442Z 2025-03-14T03:51:43.5499771Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.5500476Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.5501519Z # 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:51:43.5502503Z continue 2025-03-14T03:51:43.5502767Z 2025-03-14T03:51:43.5502940Z valid_settings = {} 2025-03-14T03:51:43.5503427Z for setting in exp_settings: 2025-03-14T03:51:43.5503952Z if setting not in Experiment._fields: 2025-03-14T03:51:43.5504470Z log.warning( 2025-03-14T03:51:43.5505250Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.5505927Z ) 2025-03-14T03:51:43.5506326Z else: 2025-03-14T03:51:43.5506797Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.5507196Z 2025-03-14T03:51:43.5507457Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.5508182Z return Settings(experiments) 2025-03-14T03:51:43.5508531Z 2025-03-14T03:51:43.5508690Z except Exception: 2025-03-14T03:51:43.5509133Z log.exception("Failed to parse settings") 2025-03-14T03:51:43.5509506Z 2025-03-14T03:51:43.5509670Z return Settings() 2025-03-14T03:51:43.5509909Z 2025-03-14T03:51:43.5509915Z 2025-03-14T03:51:43.5510143Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.5510678Z """ 2025-03-14T03:51:43.5511075Z Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.5511453Z 2025-03-14T03:51:43.5511779Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.5512487Z and the text below is the list of opted in users. 2025-03-14T03:51:43.5512860Z 2025-03-14T03:51:43.5513268Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.5513952Z """ 2025-03-14T03:51:43.5514465Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.5515267Z return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.5515645Z 2025-03-14T03:51:43.5515657Z 2025-03-14T03:51:43.5515877Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.5516394Z """ 2025-03-14T03:51:43.5516749Z Parse users from the rollout state. 2025-03-14T03:51:43.5517077Z 2025-03-14T03:51:43.5517226Z """ 2025-03-14T03:51:43.5517725Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.5518406Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.5518773Z 2025-03-14T03:51:43.5518779Z 2025-03-14T03:51:43.5519166Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.5519853Z """ 2025-03-14T03:51:43.5520227Z Check if a user is opted into an experiment 2025-03-14T03:51:43.5520723Z """ 2025-03-14T03:51:43.5521141Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.5521540Z 2025-03-14T03:51:43.5521546Z 2025-03-14T03:51:43.5521933Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.5522822Z """ 2025-03-14T03:51:43.5523252Z Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.5523787Z """ 2025-03-14T03:51:43.5524255Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.5525166Z experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.5525782Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.5526405Z return False 2025-03-14T03:51:43.5526635Z 2025-03-14T03:51:43.5526884Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.5527450Z log.warning( 2025-03-14T03:51:43.5528198Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.5529015Z ) 2025-03-14T03:51:43.5529210Z 2025-03-14T03:51:43.5529366Z return True 2025-03-14T03:51:43.5529576Z 2025-03-14T03:51:43.5529582Z 2025-03-14T03:51:43.5529751Z def get_runner_prefix( 2025-03-14T03:51:43.5530156Z rollout_state: str, 2025-03-14T03:51:43.5530578Z workflow_requestors: Iterable[str], 2025-03-14T03:51:43.5531059Z branch: str, 2025-03-14T03:51:43.5531510Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.5532063Z is_canary: bool = False, 2025-03-14T03:51:43.5532490Z ) -> str: 2025-03-14T03:51:43.5532879Z settings = parse_settings(rollout_state) 2025-03-14T03:51:43.5533409Z user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.5533757Z 2025-03-14T03:51:43.5533922Z fleet_prefix = "" 2025-03-14T03:51:43.5534311Z prefixes = [] 2025-03-14T03:51:43.5534995Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.5535868Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.5536668Z log.info( 2025-03-14T03:51:43.5537314Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.5538025Z ) 2025-03-14T03:51:43.5538362Z continue 2025-03-14T03:51:43.5538597Z 2025-03-14T03:51:43.5538774Z if eligible_experiments: 2025-03-14T03:51:43.5539286Z if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.5539862Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.5540383Z log.info( 2025-03-14T03:51:43.5541117Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.5541890Z ) 2025-03-14T03:51:43.5542255Z continue 2025-03-14T03:51:43.5542725Z elif not experiment_settings.default: 2025-03-14T03:51:43.5543227Z log.info( 2025-03-14T03:51:43.5543842Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.5544520Z ) 2025-03-14T03:51:43.5544972Z continue 2025-03-14T03:51:43.5545213Z 2025-03-14T03:51:43.5545471Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.5546051Z opted_out_users = [ 2025-03-14T03:51:43.5546475Z requestor 2025-03-14T03:51:43.5546893Z for requestor in workflow_requestors 2025-03-14T03:51:43.5547516Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.5548098Z ] 2025-03-14T03:51:43.5548285Z 2025-03-14T03:51:43.5548457Z if opted_out_users: 2025-03-14T03:51:43.5548878Z log.info( 2025-03-14T03:51:43.5549438Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.5550087Z ) 2025-03-14T03:51:43.5550436Z continue 2025-03-14T03:51:43.5550664Z 2025-03-14T03:51:43.5550926Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.5551491Z opted_in_users = [ 2025-03-14T03:51:43.5551905Z requestor 2025-03-14T03:51:43.5552446Z for requestor in workflow_requestors 2025-03-14T03:51:43.5553062Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.5553645Z ] 2025-03-14T03:51:43.5553833Z 2025-03-14T03:51:43.5553997Z enabled = False 2025-03-14T03:51:43.5554395Z if opted_in_users: 2025-03-14T03:51:43.5554899Z log.info( 2025-03-14T03:51:43.5555455Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.5556082Z ) 2025-03-14T03:51:43.5556444Z enabled = True 2025-03-14T03:51:43.5556701Z 2025-03-14T03:51:43.5556904Z elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.5557684Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.5558545Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.5559150Z log.info( 2025-03-14T03:51:43.5559955Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.5560810Z ) 2025-03-14T03:51:43.5561181Z enabled = True 2025-03-14T03:51:43.5561461Z 2025-03-14T03:51:43.5561611Z if enabled: 2025-03-14T03:51:43.5562027Z label = experiment_name 2025-03-14T03:51:43.5562539Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.5563298Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.5564109Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.5565012Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.5565638Z if is_canary: 2025-03-14T03:51:43.5566103Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.5566624Z fleet_prefix = label 2025-03-14T03:51:43.5567077Z else: 2025-03-14T03:51:43.5567468Z prefixes.append(label) 2025-03-14T03:51:43.5567795Z 2025-03-14T03:51:43.5567961Z if len(prefixes) > 1: 2025-03-14T03:51:43.5568376Z log.error( 2025-03-14T03:51:43.5569328Z 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:51:43.5570363Z ) 2025-03-14T03:51:43.5570727Z prefixes = prefixes[:1] 2025-03-14T03:51:43.5571007Z 2025-03-14T03:51:43.5571179Z # Fleet always comes first 2025-03-14T03:51:43.5571619Z if fleet_prefix: 2025-03-14T03:51:43.5572038Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.5572368Z 2025-03-14T03:51:43.5572604Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.5572980Z 2025-03-14T03:51:43.5572986Z 2025-03-14T03:51:43.5573398Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.5574126Z """ 2025-03-14T03:51:43.5574755Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.5575286Z 2025-03-14T03:51:43.5575645Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.5576301Z """ 2025-03-14T03:51:43.5576665Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.5577162Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.5577747Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.5578167Z 2025-03-14T03:51:43.5578173Z 2025-03-14T03:51:43.5578541Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.5579247Z for _ in range(num_retries): 2025-03-14T03:51:43.5579691Z try: 2025-03-14T03:51:43.5580082Z req = Request(url=url, headers=headers) 2025-03-14T03:51:43.5580698Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.5581455Z return json.loads(content) 2025-03-14T03:51:43.5581959Z except Exception as e: 2025-03-14T03:51:43.5582455Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.5582831Z 2025-03-14T03:51:43.5583186Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.5583846Z return {} 2025-03-14T03:51:43.5584047Z 2025-03-14T03:51:43.5584052Z 2025-03-14T03:51:43.5584196Z @cache 2025-03-14T03:51:43.5584858Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.5585555Z """ 2025-03-14T03:51:43.5585932Z Dynamically get PR information 2025-03-14T03:51:43.5586385Z """ 2025-03-14T03:51:43.5586836Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.5587464Z headers = { 2025-03-14T03:51:43.5587880Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.5588447Z "Authorization": f"token {github_token}", 2025-03-14T03:51:43.5588950Z } 2025-03-14T03:51:43.5589340Z json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.5589899Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.5590411Z headers=headers, 2025-03-14T03:51:43.5590808Z ) 2025-03-14T03:51:43.5590987Z 2025-03-14T03:51:43.5591163Z if not json_response: 2025-03-14T03:51:43.5591680Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.5592251Z return {} 2025-03-14T03:51:43.5592473Z 2025-03-14T03:51:43.5592633Z return json_response 2025-03-14T03:51:43.5592890Z 2025-03-14T03:51:43.5592896Z 2025-03-14T03:51:43.5593264Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.5594058Z """ 2025-03-14T03:51:43.5594549Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.5595244Z """ 2025-03-14T03:51:43.5595694Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.5596263Z return { 2025-03-14T03:51:43.5596798Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.5597449Z } 2025-03-14T03:51:43.5597631Z 2025-03-14T03:51:43.5597638Z 2025-03-14T03:51:43.5597796Z def main() -> None: 2025-03-14T03:51:43.5598184Z args = parse_args() 2025-03-14T03:51:43.5598437Z 2025-03-14T03:51:43.5598636Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.5599001Z 2025-03-14T03:51:43.5599176Z # Check if the PR is opt-out 2025-03-14T03:51:43.5599637Z if args.pr_number: 2025-03-14T03:51:43.5600249Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.5600958Z if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.5601424Z log.info( 2025-03-14T03:51:43.5602058Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.5602775Z ) 2025-03-14T03:51:43.5603283Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.5603902Z sys.exit() 2025-03-14T03:51:43.5604149Z 2025-03-14T03:51:43.5604296Z try: 2025-03-14T03:51:43.5604789Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.5605448Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.5606040Z ) 2025-03-14T03:51:43.5606225Z 2025-03-14T03:51:43.5606411Z username = get_potential_pr_author( 2025-03-14T03:51:43.5606916Z args.github_token, 2025-03-14T03:51:43.5607355Z args.github_repo, 2025-03-14T03:51:43.5607794Z args.github_actor, 2025-03-14T03:51:43.5608235Z args.github_ref_type, 2025-03-14T03:51:43.5608688Z args.github_branch, 2025-03-14T03:51:43.5609111Z ) 2025-03-14T03:51:43.5609301Z 2025-03-14T03:51:43.5609556Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.5610124Z 2025-03-14T03:51:43.5610320Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.5610838Z rollout_state, 2025-03-14T03:51:43.5611291Z (args.github_issue_owner, username), 2025-03-14T03:51:43.5611790Z args.github_branch, 2025-03-14T03:51:43.5612244Z args.eligible_experiments, 2025-03-14T03:51:43.5612719Z is_canary, 2025-03-14T03:51:43.5613097Z ) 2025-03-14T03:51:43.5613283Z 2025-03-14T03:51:43.5613461Z except Exception as e: 2025-03-14T03:51:43.5613870Z log.error( 2025-03-14T03:51:43.5614480Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.5615276Z ) 2025-03-14T03:51:43.5615461Z 2025-03-14T03:51:43.5615772Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.5616228Z 2025-03-14T03:51:43.5616234Z 2025-03-14T03:51:43.5616408Z if __name__ == "__main__": 2025-03-14T03:51:43.5616809Z main() 2025-03-14T03:51:43.5617010Z 2025-03-14T03:51:43.5703484Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.5704317Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.5750840Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.5751296Z env: 2025-03-14T03:51:43.5751892Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.5752289Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.5752708Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.5753183Z ISSUE_OWNER: 2025-03-14T03:51:43.5753558Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.5753947Z PR_NUMBER: 2025-03-14T03:51:43.5754288Z ##[endgroup] 2025-03-14T03:51:43.9567758Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:51:44.3111596Z Collecting urllib3==1.26.18 2025-03-14T03:51:44.3445506Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:51:44.3681441Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.8 MB/s eta 0:00:00 2025-03-14T03:51:44.3870558Z Collecting PyGithub==2.3.0 2025-03-14T03:51:44.3900041Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:51:44.4391334Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:51:44.4422492Z 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:51:44.4469831Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-14T03:51:44.4486316Z 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:51:44.4500729Z 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:51:44.4761147Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:51:44.4792221Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:51:44.5025137Z 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:51:44.6119021Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:44.6152939Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:51:44.7211817Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:51:44.7252262Z 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:51:44.7435532Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:44.7463758Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:51:44.7708788Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:51:44.7839730Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 15.2 MB/s eta 0:00:00 2025-03-14T03:51:44.7871737Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:51:44.7975049Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 39.9 MB/s eta 0:00:00 2025-03-14T03:51:44.8004034Z 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:51:44.8145522Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 67.5 MB/s eta 0:00:00 2025-03-14T03:51:44.8173288Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:51:44.8227212Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:51:44.8432700Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 24.8 MB/s eta 0:00:00 2025-03-14T03:51:44.8465356Z 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:51:44.8514165Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 24.5 MB/s eta 0:00:00 2025-03-14T03:51:44.8541700Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:51:44.8589731Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 35.4 MB/s eta 0:00:00 2025-03-14T03:51:45.1547588Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:51:45.6767542Z 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:51:45.7507119Z ##[group]Run curr_branch="main" 2025-03-14T03:51:45.7507515Z curr_branch="main" 2025-03-14T03:51:45.7507792Z curr_ref_type="branch" 2025-03-14T03:51:45.7508144Z echo "Current branch is '$curr_branch'" 2025-03-14T03:51:45.7508471Z  2025-03-14T03:51:45.7508736Z python3 runner_determinator.py \ 2025-03-14T03:51:45.7509083Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:51:45.7509444Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:51:45.7509767Z  --github-branch "$curr_branch" \ 2025-03-14T03:51:45.7510093Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:51:45.7510449Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:51:45.7510797Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:51:45.7511148Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:51:45.7511517Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:51:45.7511893Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:51:45.7559152Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:45.7559455Z env: 2025-03-14T03:51:45.7560015Z GITHUB_TOKEN: *** 2025-03-14T03:51:45.7560261Z ISSUE_NUMBER: 5132 2025-03-14T03:51:45.7560525Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:45.7560822Z ISSUE_OWNER: 2025-03-14T03:51:45.7561061Z CHECK_EXPERIMENTS: 2025-03-14T03:51:45.7561306Z PR_NUMBER: 2025-03-14T03:51:45.7561543Z ##[endgroup] 2025-03-14T03:51:45.7625910Z Current branch is 'main' 2025-03-14T03:51:47.1692106Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:51:47.1693197Z INFO : Setting output: label-type='' 2025-03-14T03:51:47.2002736Z Evaluate and set job outputs 2025-03-14T03:51:47.2010805Z Cleaning up orphan processes