2025-08-14T20:43:46.6942420Z Current runner version: '2.327.1' 2025-08-14T20:43:46.6966058Z ##[group]Runner Image Provisioner 2025-08-14T20:43:46.6966921Z Hosted Compute Agent 2025-08-14T20:43:46.6967597Z Version: 20250812.370 2025-08-14T20:43:46.6968254Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:46.6968970Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:46.6969690Z ##[endgroup] 2025-08-14T20:43:46.6970299Z ##[group]Operating System 2025-08-14T20:43:46.6971069Z Ubuntu 2025-08-14T20:43:46.6971666Z 24.04.2 2025-08-14T20:43:46.6972150Z LTS 2025-08-14T20:43:46.6972658Z ##[endgroup] 2025-08-14T20:43:46.6973191Z ##[group]Runner Image 2025-08-14T20:43:46.6973839Z Image: ubuntu-24.04 2025-08-14T20:43:46.6974351Z Version: 20250804.2.0 2025-08-14T20:43:46.6975425Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:46.6977015Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:46.6978103Z ##[endgroup] 2025-08-14T20:43:46.6979155Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:46.6981617Z Contents: read 2025-08-14T20:43:46.6982231Z Metadata: read 2025-08-14T20:43:46.6982789Z ##[endgroup] 2025-08-14T20:43:46.6985217Z Secret source: Actions 2025-08-14T20:43:46.6986091Z Prepare workflow directory 2025-08-14T20:43:46.7501321Z Prepare all required actions 2025-08-14T20:43:46.7559200Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:46.7564336Z ##[group] Inputs 2025-08-14T20:43:46.7565090Z check_experiments: 2025-08-14T20:43:46.7565725Z opt_out_experiments: 2025-08-14T20:43:46.7566348Z triggering_actor: pytorchmergebot 2025-08-14T20:43:46.7566961Z issue_owner: 2025-08-14T20:43:46.7567606Z curr_branch: main 2025-08-14T20:43:46.7568150Z curr_ref_type: branch 2025-08-14T20:43:46.7568834Z issue_number: 5132 2025-08-14T20:43:46.7569624Z ##[endgroup] 2025-08-14T20:43:46.7570501Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:43:47.4874041Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.4876386Z cat < runner_determinator.py 2025-08-14T20:43:47.4877075Z # flake8: noqa: G004 2025-08-14T20:43:47.4877577Z  2025-08-14T20:43:47.4878347Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.4879423Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.4880507Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.4881280Z  2025-08-14T20:43:47.4881703Z """ 2025-08-14T20:43:47.4882396Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.4883452Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.4884626Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.4885582Z of which runners should be used to run which job. 2025-08-14T20:43:47.4886304Z  2025-08-14T20:43:47.4886993Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.4887997Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.4889073Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.4889864Z list, defined. 2025-08-14T20:43:47.4890509Z  2025-08-14T20:43:47.4891239Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.4892271Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.4893251Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.4893962Z  2025-08-14T20:43:47.4894962Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.4895988Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.4896876Z experiments which the user could be opted in to. 2025-08-14T20:43:47.4897621Z  2025-08-14T20:43:47.4898083Z The user list has the following rules: 2025-08-14T20:43:47.4898728Z  2025-08-14T20:43:47.4899360Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.4900639Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.4901621Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.4902261Z  2025-08-14T20:43:47.4902738Z Example config: 2025-08-14T20:43:47.4903283Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.4904182Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.4904931Z  # Expected syntax is: 2025-08-14T20:43:47.4905656Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.4906803Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.4907643Z  2025-08-14T20:43:47.4908056Z  experiments: 2025-08-14T20:43:47.4984904Z  lf: 2025-08-14T20:43:47.4985379Z  rollout_percent: 25 2025-08-14T20:43:47.4985914Z  all_branches: false 2025-08-14T20:43:47.4986411Z  default: true 2025-08-14T20:43:47.4986862Z  --- 2025-08-14T20:43:47.4987233Z  2025-08-14T20:43:47.4987582Z  # Opt-ins: 2025-08-14T20:43:47.4988234Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.4989430Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.4990278Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.4991153Z  # Experiments should be from the above list. 2025-08-14T20:43:47.4991726Z  2025-08-14T20:43:47.4992108Z  @User1,-lf,split_build 2025-08-14T20:43:47.4992604Z  @User2,lf 2025-08-14T20:43:47.4993052Z  @User3,split_build 2025-08-14T20:43:47.4993515Z """ 2025-08-14T20:43:47.4993870Z  2025-08-14T20:43:47.4994225Z import json 2025-08-14T20:43:47.4994629Z import logging 2025-08-14T20:43:47.4995050Z import os 2025-08-14T20:43:47.4995447Z import random 2025-08-14T20:43:47.4995862Z import re 2025-08-14T20:43:47.4996242Z import sys 2025-08-14T20:43:47.4996686Z from argparse import ArgumentParser 2025-08-14T20:43:47.4997329Z from collections.abc import Iterable 2025-08-14T20:43:47.4997895Z from functools import cache 2025-08-14T20:43:47.4998416Z from logging import LogRecord 2025-08-14T20:43:47.4998972Z from typing import Any, NamedTuple 2025-08-14T20:43:47.4999571Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.5000124Z  2025-08-14T20:43:47.5000760Z import yaml 2025-08-14T20:43:47.5001200Z from github import Auth, Github 2025-08-14T20:43:47.5001744Z from github.Issue import Issue 2025-08-14T20:43:47.5002236Z  2025-08-14T20:43:47.5002567Z  2025-08-14T20:43:47.5003009Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.5003759Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.5004685Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.5005412Z  2025-08-14T20:43:47.5006031Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.5006639Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.5007211Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.5007823Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.5008361Z  2025-08-14T20:43:47.5008757Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.5009272Z  2025-08-14T20:43:47.5009643Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.5010152Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.5010750Z  2025-08-14T20:43:47.5011090Z  2025-08-14T20:43:47.5011477Z class Experiment(NamedTuple): 2025-08-14T20:43:47.5012013Z  rollout_perc: float = ( 2025-08-14T20:43:47.5012722Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.5013441Z  ) 2025-08-14T20:43:47.5013841Z  all_branches: bool = ( 2025-08-14T20:43:47.5014541Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.5015239Z  ) 2025-08-14T20:43:47.5015620Z  default: bool = ( 2025-08-14T20:43:47.5016255Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.5016922Z  ) 2025-08-14T20:43:47.5017282Z  2025-08-14T20:43:47.5017663Z  # Add more fields as needed 2025-08-14T20:43:47.5018153Z  2025-08-14T20:43:47.5018488Z  2025-08-14T20:43:47.5018853Z class Settings(NamedTuple): 2025-08-14T20:43:47.5019333Z  """ 2025-08-14T20:43:47.5019835Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.5020586Z  """ 2025-08-14T20:43:47.5020950Z  2025-08-14T20:43:47.5021366Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.5021916Z  2025-08-14T20:43:47.5022380Z  2025-08-14T20:43:47.5022806Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.5023486Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.5024092Z  2025-08-14T20:43:47.5024442Z  COLORS = { 2025-08-14T20:43:47.5024892Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.5025432Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.5025954Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.5026538Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.5027087Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.5027581Z  } 2025-08-14T20:43:47.5027940Z  2025-08-14T20:43:47.5028371Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.5029164Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.5029985Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.5030713Z  return super().format(record) 2025-08-14T20:43:47.5031227Z  2025-08-14T20:43:47.5031563Z  2025-08-14T20:43:47.5031952Z handler = logging.StreamHandler() 2025-08-14T20:43:47.5032735Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.5033476Z  2025-08-14T20:43:47.5033951Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.5034569Z log.addHandler(handler) 2025-08-14T20:43:47.5035059Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.5035531Z  2025-08-14T20:43:47.5035863Z  2025-08-14T20:43:47.5036360Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.5036946Z  """ 2025-08-14T20:43:47.5037500Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.5038295Z  """ 2025-08-14T20:43:47.5038690Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.5039819Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.5041225Z  log.warning( 2025-08-14T20:43:47.5042134Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.5043075Z  ) 2025-08-14T20:43:47.5043547Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.5044103Z  return 2025-08-14T20:43:47.5044502Z  2025-08-14T20:43:47.5044907Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.5045512Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.5046120Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.5046622Z  2025-08-14T20:43:47.5046976Z  2025-08-14T20:43:47.5047501Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.5048173Z  return frozenset( 2025-08-14T20:43:47.5048849Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.5049540Z  ) 2025-08-14T20:43:47.5049905Z  2025-08-14T20:43:47.5050244Z  2025-08-14T20:43:47.5050718Z def parse_args() -> Any: 2025-08-14T20:43:47.5051328Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.5052265Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.5053049Z  parser.add_argument( 2025-08-14T20:43:47.5053542Z  "--github-issue-repo", 2025-08-14T20:43:47.5054044Z  type=str, 2025-08-14T20:43:47.5054491Z  required=False, 2025-08-14T20:43:47.5055133Z  default="pytorch/test-infra", 2025-08-14T20:43:47.5055727Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.5056256Z  ) 2025-08-14T20:43:47.5056650Z  parser.add_argument( 2025-08-14T20:43:47.5057128Z  "--github-repo", 2025-08-14T20:43:47.5057599Z  type=str, 2025-08-14T20:43:47.5058042Z  required=True, 2025-08-14T20:43:47.5058561Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.5059097Z  ) 2025-08-14T20:43:47.5059493Z  parser.add_argument( 2025-08-14T20:43:47.5060157Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.5060953Z  ) 2025-08-14T20:43:47.5061341Z  parser.add_argument( 2025-08-14T20:43:47.5062026Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.5062736Z  ) 2025-08-14T20:43:47.5063123Z  parser.add_argument( 2025-08-14T20:43:47.5063818Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.5064520Z  ) 2025-08-14T20:43:47.5064909Z  parser.add_argument( 2025-08-14T20:43:47.5065628Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.5066367Z  ) 2025-08-14T20:43:47.5066759Z  parser.add_argument( 2025-08-14T20:43:47.5067242Z  "--github-ref-type", 2025-08-14T20:43:47.5067730Z  type=str, 2025-08-14T20:43:47.5068163Z  required=True, 2025-08-14T20:43:47.5068714Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.5069307Z  ) 2025-08-14T20:43:47.5069693Z  parser.add_argument( 2025-08-14T20:43:47.5070551Z  "--eligible-experiments", 2025-08-14T20:43:47.5071134Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.5071696Z  required=False, 2025-08-14T20:43:47.5072164Z  default="", 2025-08-14T20:43:47.5073059Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.5074009Z  ) 2025-08-14T20:43:47.5074396Z  parser.add_argument( 2025-08-14T20:43:47.5074898Z  "--opt-out-experiments", 2025-08-14T20:43:47.5075450Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.5075989Z  required=False, 2025-08-14T20:43:47.5076454Z  default="", 2025-08-14T20:43:47.5076892Z  help=( 2025-08-14T20:43:47.5077608Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.5078789Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.5079631Z  ), 2025-08-14T20:43:47.5080011Z  ) 2025-08-14T20:43:47.5080934Z  parser.add_argument( 2025-08-14T20:43:47.5081451Z  "--pr-number", 2025-08-14T20:43:47.5081909Z  type=str, 2025-08-14T20:43:47.5082358Z  required=False, 2025-08-14T20:43:47.5082822Z  default="", 2025-08-14T20:43:47.5083369Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.5083949Z  ) 2025-08-14T20:43:47.5084305Z  2025-08-14T20:43:47.5084690Z  return parser.parse_args() 2025-08-14T20:43:47.5085183Z  2025-08-14T20:43:47.5085521Z  2025-08-14T20:43:47.5086157Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5087112Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.5087658Z  return Github(auth=auth) 2025-08-14T20:43:47.5088140Z  2025-08-14T20:43:47.5088477Z  2025-08-14T20:43:47.5089140Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5089971Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.5090673Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.5091213Z  2025-08-14T20:43:47.5091601Z  2025-08-14T20:43:47.5092021Z def get_potential_pr_author( 2025-08-14T20:43:47.5092710Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.5093403Z ) -> str: 2025-08-14T20:43:47.5093969Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.5094804Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.5095602Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.5096198Z  2025-08-14T20:43:47.5096589Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.5097100Z  2025-08-14T20:43:47.5097608Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.5098270Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.5098791Z  if ( 2025-08-14T20:43:47.5099217Z  len(split_tag) == 3 2025-08-14T20:43:47.5099745Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.5100405Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.5100925Z  ): 2025-08-14T20:43:47.5101348Z  pr_number = split_tag[2] 2025-08-14T20:43:47.5101877Z  try: 2025-08-14T20:43:47.5102349Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.5103138Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.5103774Z  except Exception as e: 2025-08-14T20:43:47.5104337Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.5105040Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.5105698Z  ) from e 2025-08-14T20:43:47.5106297Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.5107028Z  # In all other cases, return the original input username 2025-08-14T20:43:47.5107646Z  return username 2025-08-14T20:43:47.5108076Z  2025-08-14T20:43:47.5108420Z  2025-08-14T20:43:47.5108858Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.5109400Z  """ 2025-08-14T20:43:47.5110089Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.5111002Z  """ 2025-08-14T20:43:47.5111587Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.5112262Z  2025-08-14T20:43:47.5112601Z  2025-08-14T20:43:47.5113003Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.5113518Z  try: 2025-08-14T20:43:47.5113939Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.5114464Z  return data 2025-08-14T20:43:47.5114926Z  except yaml.YAMLError: 2025-08-14T20:43:47.5115460Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.5115987Z  raise 2025-08-14T20:43:47.5116376Z  2025-08-14T20:43:47.5116715Z  2025-08-14T20:43:47.5117347Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.5118108Z  """ 2025-08-14T20:43:47.5118897Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.5119665Z  2025-08-14T20:43:47.5120244Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5121142Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.5121716Z  2025-08-14T20:43:47.5122299Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.5123011Z  """ 2025-08-14T20:43:47.5123491Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.5124112Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.5124759Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.5125363Z  else: 2025-08-14T20:43:47.5125776Z  return "", rollout_state 2025-08-14T20:43:47.5126463Z  2025-08-14T20:43:47.5126834Z  2025-08-14T20:43:47.5127250Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.5127763Z  """ 2025-08-14T20:43:47.5128319Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.5128973Z  """ 2025-08-14T20:43:47.5129330Z  2025-08-14T20:43:47.5129658Z  2025-08-14T20:43:47.5130203Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.5130969Z  """ 2025-08-14T20:43:47.5131714Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.5132559Z  2025-08-14T20:43:47.5133357Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.5134383Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.5135227Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.5135865Z  2025-08-14T20:43:47.5136195Z  2025-08-14T20:43:47.5136570Z  """ 2025-08-14T20:43:47.5136966Z  optins = UserOptins() 2025-08-14T20:43:47.5137506Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.5138100Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.5138679Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.5139260Z  # Not a valid user. Skip 2025-08-14T20:43:47.5139767Z  continue 2025-08-14T20:43:47.5140183Z  2025-08-14T20:43:47.5140628Z  if user: 2025-08-14T20:43:47.5141106Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.5141871Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.5142527Z  2025-08-14T20:43:47.5142889Z  return optins 2025-08-14T20:43:47.5143310Z  2025-08-14T20:43:47.5143645Z  2025-08-14T20:43:47.5144148Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.5144763Z  """ 2025-08-14T20:43:47.5145190Z  Check if the experiment name is valid. 2025-08-14T20:43:47.5145725Z  A valid name: 2025-08-14T20:43:47.5146414Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.5147375Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.5148115Z  - Cannot contain spaces 2025-08-14T20:43:47.5148602Z  """ 2025-08-14T20:43:47.5148951Z  2025-08-14T20:43:47.5149417Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.5150146Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.5151893Z  2025-08-14T20:43:47.5152254Z  if valid: 2025-08-14T20:43:47.5152670Z  return True 2025-08-14T20:43:47.5153090Z  2025-08-14T20:43:47.5153442Z  log.error( 2025-08-14T20:43:47.5154914Z  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-08-14T20:43:47.5156485Z  ) 2025-08-14T20:43:47.5156866Z  return False 2025-08-14T20:43:47.5157274Z  2025-08-14T20:43:47.5157610Z  2025-08-14T20:43:47.5158135Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.5158790Z  """ 2025-08-14T20:43:47.5159418Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.5160143Z  """ 2025-08-14T20:43:47.5160631Z  try: 2025-08-14T20:43:47.5161011Z  if settings_text: 2025-08-14T20:43:47.5161780Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.5162612Z  # for easy reading 2025-08-14T20:43:47.5163449Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.5164380Z  # the backtick character in shell commands. 2025-08-14T20:43:47.5165009Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.5165718Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.5166409Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.5166927Z  2025-08-14T20:43:47.5167538Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.5168418Z  experiments = {} 2025-08-14T20:43:47.5168895Z  2025-08-14T20:43:47.5169462Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.5170292Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.5171508Z  # 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-08-14T20:43:47.5172564Z  continue 2025-08-14T20:43:47.5173020Z  2025-08-14T20:43:47.5173389Z  valid_settings = {} 2025-08-14T20:43:47.5173945Z  for setting in exp_settings: 2025-08-14T20:43:47.5174525Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.5175102Z  log.warning( 2025-08-14T20:43:47.5175872Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.5176598Z  ) 2025-08-14T20:43:47.5177058Z  else: 2025-08-14T20:43:47.5177619Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.5178222Z  2025-08-14T20:43:47.5178705Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.5179361Z  return Settings(experiments) 2025-08-14T20:43:47.5179869Z  2025-08-14T20:43:47.5180222Z  except Exception: 2025-08-14T20:43:47.5180847Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.5181386Z  2025-08-14T20:43:47.5181740Z  return Settings() 2025-08-14T20:43:47.5182169Z  2025-08-14T20:43:47.5182507Z  2025-08-14T20:43:47.5183145Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.5183735Z  """ 2025-08-14T20:43:47.5184201Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.5184767Z  2025-08-14T20:43:47.5185324Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5186107Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.5186678Z  2025-08-14T20:43:47.5187281Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.5188010Z  """ 2025-08-14T20:43:47.5188599Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5189393Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.5189944Z  2025-08-14T20:43:47.5190268Z  2025-08-14T20:43:47.5190843Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.5191422Z  """ 2025-08-14T20:43:47.5191842Z  Parse users from the rollout state. 2025-08-14T20:43:47.5192360Z  2025-08-14T20:43:47.5192686Z  """ 2025-08-14T20:43:47.5193267Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5194037Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.5194585Z  2025-08-14T20:43:47.5194908Z  2025-08-14T20:43:47.5195536Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5196291Z  """ 2025-08-14T20:43:47.5196739Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.5197297Z  """ 2025-08-14T20:43:47.5197786Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.5198372Z  2025-08-14T20:43:47.5198816Z  2025-08-14T20:43:47.5199453Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5200222Z  """ 2025-08-14T20:43:47.5200822Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.5201420Z  """ 2025-08-14T20:43:47.5201958Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.5202689Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.5203361Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.5203978Z  return False 2025-08-14T20:43:47.5204404Z  2025-08-14T20:43:47.5204883Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.5205496Z  log.warning( 2025-08-14T20:43:47.5206342Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.5207223Z  ) 2025-08-14T20:43:47.5207586Z  2025-08-14T20:43:47.5207936Z  return True 2025-08-14T20:43:47.5208336Z  2025-08-14T20:43:47.5208668Z  2025-08-14T20:43:47.5209021Z def get_runner_prefix( 2025-08-14T20:43:47.5209497Z  rollout_state: str, 2025-08-14T20:43:47.5210007Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.5210622Z  branch: str, 2025-08-14T20:43:47.5211198Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5211914Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5212521Z  is_canary: bool = False, 2025-08-14T20:43:47.5212997Z ) -> str: 2025-08-14T20:43:47.5213447Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.5214057Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.5214591Z  2025-08-14T20:43:47.5215074Z  fleet_prefix = "" 2025-08-14T20:43:47.5215538Z  prefixes = [] 2025-08-14T20:43:47.5216225Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.5217196Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.5217914Z  log.info( 2025-08-14T20:43:47.5218639Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.5219400Z  ) 2025-08-14T20:43:47.5219817Z  continue 2025-08-14T20:43:47.5220232Z  2025-08-14T20:43:47.5220715Z  if opt_out_experiments: 2025-08-14T20:43:47.5221295Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.5221971Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.5222579Z  log.info( 2025-08-14T20:43:47.5223533Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.5224507Z  ) 2025-08-14T20:43:47.5224928Z  continue 2025-08-14T20:43:47.5225377Z  2025-08-14T20:43:47.5225781Z  if eligible_experiments: 2025-08-14T20:43:47.5226388Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.5227070Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.5227627Z  log.info( 2025-08-14T20:43:47.5228436Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.5229281Z  ) 2025-08-14T20:43:47.5229832Z  continue 2025-08-14T20:43:47.5230514Z  elif not experiment_settings.default: 2025-08-14T20:43:47.5231052Z  log.info( 2025-08-14T20:43:47.5231772Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.5232505Z  ) 2025-08-14T20:43:47.5232913Z  continue 2025-08-14T20:43:47.5233329Z  2025-08-14T20:43:47.5233807Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.5234438Z  opted_out_users = [ 2025-08-14T20:43:47.5234921Z  requestor 2025-08-14T20:43:47.5235423Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5236116Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5236757Z  ] 2025-08-14T20:43:47.5237122Z  2025-08-14T20:43:47.5237493Z  if opted_out_users: 2025-08-14T20:43:47.5237975Z  log.info( 2025-08-14T20:43:47.5238641Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.5239348Z  ) 2025-08-14T20:43:47.5239743Z  continue 2025-08-14T20:43:47.5240162Z  2025-08-14T20:43:47.5240721Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.5241388Z  opted_in_users = [ 2025-08-14T20:43:47.5241879Z  requestor 2025-08-14T20:43:47.5242379Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5243073Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5243703Z  ] 2025-08-14T20:43:47.5244085Z  2025-08-14T20:43:47.5244438Z  enabled = False 2025-08-14T20:43:47.5244918Z  if opted_in_users: 2025-08-14T20:43:47.5245504Z  log.info( 2025-08-14T20:43:47.5246159Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.5246854Z  ) 2025-08-14T20:43:47.5247261Z  enabled = True 2025-08-14T20:43:47.5247717Z  2025-08-14T20:43:47.5248122Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.5248974Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.5249912Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.5250666Z  log.info( 2025-08-14T20:43:47.5251565Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.5252516Z  ) 2025-08-14T20:43:47.5252966Z  enabled = True 2025-08-14T20:43:47.5253432Z  2025-08-14T20:43:47.5253793Z  if enabled: 2025-08-14T20:43:47.5254256Z  label = experiment_name 2025-08-14T20:43:47.5254841Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.5255696Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.5256591Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.5257377Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.5258054Z  if is_canary: 2025-08-14T20:43:47.5258586Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.5259146Z  fleet_prefix = label 2025-08-14T20:43:47.5259659Z  else: 2025-08-14T20:43:47.5260259Z  prefixes.append(label) 2025-08-14T20:43:47.5260866Z  2025-08-14T20:43:47.5261229Z  if len(prefixes) > 1: 2025-08-14T20:43:47.5261699Z  log.error( 2025-08-14T20:43:47.5262771Z  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-08-14T20:43:47.5263890Z  ) 2025-08-14T20:43:47.5264301Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.5264780Z  2025-08-14T20:43:47.5265146Z  # Fleet always comes first 2025-08-14T20:43:47.5265653Z  if fleet_prefix: 2025-08-14T20:43:47.5266136Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.5266655Z  2025-08-14T20:43:47.5267112Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.5267774Z  2025-08-14T20:43:47.5268111Z  2025-08-14T20:43:47.5268761Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.5269545Z  """ 2025-08-14T20:43:47.5270185Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.5270998Z  2025-08-14T20:43:47.5271607Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.5272371Z  """ 2025-08-14T20:43:47.5272782Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.5273345Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.5274021Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.5274618Z  2025-08-14T20:43:47.5274956Z  2025-08-14T20:43:47.5275580Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.5276494Z  for _ in range(num_retries): 2025-08-14T20:43:47.5276998Z  try: 2025-08-14T20:43:47.5277459Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.5278137Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.5278796Z  return json.loads(content) 2025-08-14T20:43:47.5279345Z  except Exception as e: 2025-08-14T20:43:47.5279928Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.5280593Z  2025-08-14T20:43:47.5281184Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.5281909Z  return {} 2025-08-14T20:43:47.5282307Z  2025-08-14T20:43:47.5282638Z  2025-08-14T20:43:47.5282978Z @cache 2025-08-14T20:43:47.5283637Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.5284411Z  """ 2025-08-14T20:43:47.5284823Z  Dynamically get PR information 2025-08-14T20:43:47.5285326Z  """ 2025-08-14T20:43:47.5285861Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.5286500Z  headers = { 2025-08-14T20:43:47.5287002Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.5287631Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.5288168Z  } 2025-08-14T20:43:47.5288621Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.5289256Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.5289825Z  headers=headers, 2025-08-14T20:43:47.5290413Z  ) 2025-08-14T20:43:47.5290788Z  2025-08-14T20:43:47.5291152Z  if not json_response: 2025-08-14T20:43:47.5291774Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.5292526Z  return {} 2025-08-14T20:43:47.5292947Z  2025-08-14T20:43:47.5293307Z  return json_response 2025-08-14T20:43:47.5293763Z  2025-08-14T20:43:47.5294104Z  2025-08-14T20:43:47.5294696Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.5295432Z  """ 2025-08-14T20:43:47.5295989Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.5296649Z  """ 2025-08-14T20:43:47.5297157Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.5297784Z  return { 2025-08-14T20:43:47.5298399Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.5299085Z  } 2025-08-14T20:43:47.5299443Z  2025-08-14T20:43:47.5299783Z  2025-08-14T20:43:47.5300147Z def main() -> None: 2025-08-14T20:43:47.5300708Z  args = parse_args() 2025-08-14T20:43:47.5301161Z  2025-08-14T20:43:47.5301584Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.5302136Z  2025-08-14T20:43:47.5302513Z  # Check if the PR is opt-out 2025-08-14T20:43:47.5303035Z  if args.pr_number: 2025-08-14T20:43:47.5303738Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.5304501Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.5305017Z  log.info( 2025-08-14T20:43:47.5305745Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.5306516Z  ) 2025-08-14T20:43:47.5307104Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5307796Z  sys.exit() 2025-08-14T20:43:47.5308355Z  2025-08-14T20:43:47.5308698Z  try: 2025-08-14T20:43:47.5309156Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.5309888Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.5310637Z  ) 2025-08-14T20:43:47.5311003Z  2025-08-14T20:43:47.5311406Z  username = get_potential_pr_author( 2025-08-14T20:43:47.5311960Z  args.github_token, 2025-08-14T20:43:47.5312465Z  args.github_repo, 2025-08-14T20:43:47.5312989Z  args.github_actor, 2025-08-14T20:43:47.5313503Z  args.github_ref_type, 2025-08-14T20:43:47.5314033Z  args.github_branch, 2025-08-14T20:43:47.5314504Z  ) 2025-08-14T20:43:47.5314877Z  2025-08-14T20:43:47.5315369Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.5315989Z  2025-08-14T20:43:47.5316410Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.5316977Z  rollout_state, 2025-08-14T20:43:47.5317513Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.5318067Z  args.github_branch, 2025-08-14T20:43:47.5318606Z  args.eligible_experiments, 2025-08-14T20:43:47.5319164Z  args.opt_out_experiments, 2025-08-14T20:43:47.5319685Z  is_canary, 2025-08-14T20:43:47.5320133Z  ) 2025-08-14T20:43:47.5320596Z  2025-08-14T20:43:47.5320972Z  except Exception as e: 2025-08-14T20:43:47.5321454Z  log.error( 2025-08-14T20:43:47.5322167Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.5323052Z  ) 2025-08-14T20:43:47.5323434Z  2025-08-14T20:43:47.5323971Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5324634Z  2025-08-14T20:43:47.5324969Z  2025-08-14T20:43:47.5325322Z if __name__ == "__main__": 2025-08-14T20:43:47.5325795Z  main() 2025-08-14T20:43:47.5326164Z  2025-08-14T20:43:47.5326503Z EOF 2025-08-14T20:43:47.5326854Z  2025-08-14T20:43:47.5327233Z cat runner_determinator.py 2025-08-14T20:43:47.5812139Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.5813350Z env: 2025-08-14T20:43:47.5814033Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.5814427Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.5814853Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.5815325Z ISSUE_OWNER: 2025-08-14T20:43:47.5815695Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.5816091Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.5816506Z PR_NUMBER: 2025-08-14T20:43:47.5816884Z ##[endgroup] 2025-08-14T20:43:47.6029102Z # flake8: noqa: G004 2025-08-14T20:43:47.6029455Z 2025-08-14T20:43:47.6029879Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.6031087Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.6031889Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.6032340Z 2025-08-14T20:43:47.6032484Z """ 2025-08-14T20:43:47.6033046Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.6033916Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.6034798Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.6035603Z of which runners should be used to run which job. 2025-08-14T20:43:47.6036008Z 2025-08-14T20:43:47.6036373Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.6037482Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.6038335Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.6039018Z list, defined. 2025-08-14T20:43:47.6039250Z 2025-08-14T20:43:47.6039590Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.6040694Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.6041516Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.6041964Z 2025-08-14T20:43:47.6042338Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.6043184Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.6043895Z experiments which the user could be opted in to. 2025-08-14T20:43:47.6044305Z 2025-08-14T20:43:47.6044500Z The user list has the following rules: 2025-08-14T20:43:47.6044851Z 2025-08-14T20:43:47.6045161Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.6046000Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.6046738Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.6047132Z 2025-08-14T20:43:47.6047290Z Example config: 2025-08-14T20:43:47.6047769Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.6048419Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.6049037Z # Expected syntax is: 2025-08-14T20:43:47.6049651Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.6050812Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.6051429Z 2025-08-14T20:43:47.6051593Z experiments: 2025-08-14T20:43:47.6051975Z lf: 2025-08-14T20:43:47.6052354Z rollout_percent: 25 2025-08-14T20:43:47.6052994Z all_branches: false 2025-08-14T20:43:47.6053445Z default: true 2025-08-14T20:43:47.6053847Z --- 2025-08-14T20:43:47.6054105Z 2025-08-14T20:43:47.6054255Z # Opt-ins: 2025-08-14T20:43:47.6054821Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.6055680Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.6056427Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.6057073Z # Experiments should be from the above list. 2025-08-14T20:43:47.6057459Z 2025-08-14T20:43:47.6057633Z @User1,-lf,split_build 2025-08-14T20:43:47.6058063Z @User2,lf 2025-08-14T20:43:47.6058452Z @User3,split_build 2025-08-14T20:43:47.6058853Z """ 2025-08-14T20:43:47.6059056Z 2025-08-14T20:43:47.6059207Z import json 2025-08-14T20:43:47.6059568Z import logging 2025-08-14T20:43:47.6059946Z import os 2025-08-14T20:43:47.6060294Z import random 2025-08-14T20:43:47.6060915Z import re 2025-08-14T20:43:47.6061280Z import sys 2025-08-14T20:43:47.6061679Z from argparse import ArgumentParser 2025-08-14T20:43:47.6062200Z from collections.abc import Iterable 2025-08-14T20:43:47.6062703Z from functools import cache 2025-08-14T20:43:47.6063181Z from logging import LogRecord 2025-08-14T20:43:47.6063658Z from typing import Any, NamedTuple 2025-08-14T20:43:47.6064187Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.6064550Z 2025-08-14T20:43:47.6064700Z import yaml 2025-08-14T20:43:47.6065089Z from github import Auth, Github 2025-08-14T20:43:47.6065551Z from github.Issue import Issue 2025-08-14T20:43:47.6065857Z 2025-08-14T20:43:47.6065863Z 2025-08-14T20:43:47.6066067Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.6066732Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.6067554Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.6068109Z 2025-08-14T20:43:47.6068324Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.6069047Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.6069578Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.6070114Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.6070745Z 2025-08-14T20:43:47.6070936Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.6071288Z 2025-08-14T20:43:47.6071468Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.6071905Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.6072192Z 2025-08-14T20:43:47.6072204Z 2025-08-14T20:43:47.6072384Z class Experiment(NamedTuple): 2025-08-14T20:43:47.6072860Z rollout_perc: float = ( 2025-08-14T20:43:47.6073491Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.6074156Z ) 2025-08-14T20:43:47.6074517Z all_branches: bool = ( 2025-08-14T20:43:47.6075119Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.6075769Z ) 2025-08-14T20:43:47.6076122Z default: bool = ( 2025-08-14T20:43:47.6076670Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.6077284Z ) 2025-08-14T20:43:47.6077481Z 2025-08-14T20:43:47.6077652Z # Add more fields as needed 2025-08-14T20:43:47.6077953Z 2025-08-14T20:43:47.6077959Z 2025-08-14T20:43:47.6078130Z class Settings(NamedTuple): 2025-08-14T20:43:47.6078568Z """ 2025-08-14T20:43:47.6079004Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.6079564Z """ 2025-08-14T20:43:47.6079760Z 2025-08-14T20:43:47.6079954Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.6080307Z 2025-08-14T20:43:47.6080427Z 2025-08-14T20:43:47.6080633Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.6081248Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.6081686Z 2025-08-14T20:43:47.6081837Z COLORS = { 2025-08-14T20:43:47.6082232Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.6082890Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.6083381Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.6083861Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.6084343Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.6084800Z } 2025-08-14T20:43:47.6084999Z 2025-08-14T20:43:47.6085207Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.6085928Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.6086680Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.6087256Z return super().format(record) 2025-08-14T20:43:47.6087588Z 2025-08-14T20:43:47.6087595Z 2025-08-14T20:43:47.6087776Z handler = logging.StreamHandler() 2025-08-14T20:43:47.6088463Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.6089010Z 2025-08-14T20:43:47.6089235Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.6089801Z log.addHandler(handler) 2025-08-14T20:43:47.6090233Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.6090806Z 2025-08-14T20:43:47.6090813Z 2025-08-14T20:43:47.6091055Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.6091612Z """ 2025-08-14T20:43:47.6092098Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.6092708Z """ 2025-08-14T20:43:47.6093056Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.6094078Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.6095141Z log.warning( 2025-08-14T20:43:47.6095960Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.6096851Z ) 2025-08-14T20:43:47.6107057Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.6107675Z return 2025-08-14T20:43:47.6107915Z 2025-08-14T20:43:47.6108308Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.6108894Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.6109458Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.6109784Z 2025-08-14T20:43:47.6109791Z 2025-08-14T20:43:47.6110078Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.6110943Z return frozenset( 2025-08-14T20:43:47.6111544Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.6112222Z ) 2025-08-14T20:43:47.6112420Z 2025-08-14T20:43:47.6112426Z 2025-08-14T20:43:47.6112593Z def parse_args() -> Any: 2025-08-14T20:43:47.6113119Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.6113949Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.6114701Z parser.add_argument( 2025-08-14T20:43:47.6115151Z "--github-issue-repo", 2025-08-14T20:43:47.6115613Z type=str, 2025-08-14T20:43:47.6116009Z required=False, 2025-08-14T20:43:47.6116443Z default="pytorch/test-infra", 2025-08-14T20:43:47.6116958Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.6117455Z ) 2025-08-14T20:43:47.6117809Z parser.add_argument( 2025-08-14T20:43:47.6118235Z "--github-repo", 2025-08-14T20:43:47.6118644Z type=str, 2025-08-14T20:43:47.6119023Z required=True, 2025-08-14T20:43:47.6119487Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.6119996Z ) 2025-08-14T20:43:47.6120459Z parser.add_argument( 2025-08-14T20:43:47.6121048Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.6121677Z ) 2025-08-14T20:43:47.6122040Z parser.add_argument( 2025-08-14T20:43:47.6122638Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.6123298Z ) 2025-08-14T20:43:47.6174629Z parser.add_argument( 2025-08-14T20:43:47.6175669Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.6176372Z ) 2025-08-14T20:43:47.6176742Z parser.add_argument( 2025-08-14T20:43:47.6177388Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.6178081Z ) 2025-08-14T20:43:47.6178442Z parser.add_argument( 2025-08-14T20:43:47.6178880Z "--github-ref-type", 2025-08-14T20:43:47.6179323Z type=str, 2025-08-14T20:43:47.6179713Z required=True, 2025-08-14T20:43:47.6180183Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.6180990Z ) 2025-08-14T20:43:47.6181342Z parser.add_argument( 2025-08-14T20:43:47.6181779Z "--eligible-experiments", 2025-08-14T20:43:47.6182281Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.6182775Z required=False, 2025-08-14T20:43:47.6183177Z default="", 2025-08-14T20:43:47.6183993Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.6184876Z ) 2025-08-14T20:43:47.6185231Z parser.add_argument( 2025-08-14T20:43:47.6185670Z "--opt-out-experiments", 2025-08-14T20:43:47.6186157Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.6186661Z required=False, 2025-08-14T20:43:47.6187070Z default="", 2025-08-14T20:43:47.6187444Z help=( 2025-08-14T20:43:47.6188094Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.6189170Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.6189961Z ), 2025-08-14T20:43:47.6190305Z ) 2025-08-14T20:43:47.6190766Z parser.add_argument( 2025-08-14T20:43:47.6191189Z "--pr-number", 2025-08-14T20:43:47.6191590Z type=str, 2025-08-14T20:43:47.6191981Z required=False, 2025-08-14T20:43:47.6192394Z default="", 2025-08-14T20:43:47.6192978Z help="the optional PR number where this is run", 2025-08-14T20:43:47.6193524Z ) 2025-08-14T20:43:47.6193734Z 2025-08-14T20:43:47.6193913Z return parser.parse_args() 2025-08-14T20:43:47.6194217Z 2025-08-14T20:43:47.6194224Z 2025-08-14T20:43:47.6194606Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.6195330Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.6195829Z return Github(auth=auth) 2025-08-14T20:43:47.6196125Z 2025-08-14T20:43:47.6196132Z 2025-08-14T20:43:47.6196554Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.6197320Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.6197809Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.6198164Z 2025-08-14T20:43:47.6198171Z 2025-08-14T20:43:47.6198341Z def get_potential_pr_author( 2025-08-14T20:43:47.6198962Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.6199610Z ) -> str: 2025-08-14T20:43:47.6200105Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.6200973Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.6201685Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.6202094Z 2025-08-14T20:43:47.6202274Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.6202605Z 2025-08-14T20:43:47.6202859Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.6203469Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.6203956Z if ( 2025-08-14T20:43:47.6204335Z len(split_tag) == 3 2025-08-14T20:43:47.6204793Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.6205311Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.6205786Z ): 2025-08-14T20:43:47.6206157Z pr_number = split_tag[2] 2025-08-14T20:43:47.6206758Z try: 2025-08-14T20:43:47.6207170Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.6207764Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.6208341Z except Exception as e: 2025-08-14T20:43:47.6208850Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.6209495Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.6210119Z ) from e 2025-08-14T20:43:47.6210815Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.6211490Z # In all other cases, return the original input username 2025-08-14T20:43:47.6212068Z return username 2025-08-14T20:43:47.6212301Z 2025-08-14T20:43:47.6212308Z 2025-08-14T20:43:47.6212512Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.6213036Z """ 2025-08-14T20:43:47.6213637Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.6214388Z """ 2025-08-14T20:43:47.6214908Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.6215417Z 2025-08-14T20:43:47.6215423Z 2025-08-14T20:43:47.6215607Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.6216086Z try: 2025-08-14T20:43:47.6216459Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.6216953Z return data 2025-08-14T20:43:47.6217347Z except yaml.YAMLError: 2025-08-14T20:43:47.6217817Z log.exception("Error loading YAML") 2025-08-14T20:43:47.6218307Z raise 2025-08-14T20:43:47.6218535Z 2025-08-14T20:43:47.6218542Z 2025-08-14T20:43:47.6218922Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.6219623Z """ 2025-08-14T20:43:47.6220203Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.6221013Z 2025-08-14T20:43:47.6221494Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.6222233Z and the text below is the list of opted in users. 2025-08-14T20:43:47.6222635Z 2025-08-14T20:43:47.6222985Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.6223657Z """ 2025-08-14T20:43:47.6224089Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.6224672Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.6225247Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.6225814Z else: 2025-08-14T20:43:47.6226182Z return "", rollout_state 2025-08-14T20:43:47.6226501Z 2025-08-14T20:43:47.6226508Z 2025-08-14T20:43:47.6226700Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.6227189Z """ 2025-08-14T20:43:47.6227710Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.6228329Z """ 2025-08-14T20:43:47.6228538Z 2025-08-14T20:43:47.6228544Z 2025-08-14T20:43:47.6228867Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.6229503Z """ 2025-08-14T20:43:47.6230174Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.6230951Z 2025-08-14T20:43:47.6231534Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.6232483Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.6233150Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.6233632Z 2025-08-14T20:43:47.6233639Z 2025-08-14T20:43:47.6233790Z """ 2025-08-14T20:43:47.6234145Z optins = UserOptins() 2025-08-14T20:43:47.6234614Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.6235152Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.6235682Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.6236349Z # Not a valid user. Skip 2025-08-14T20:43:47.6236824Z continue 2025-08-14T20:43:47.6237065Z 2025-08-14T20:43:47.6237216Z if user: 2025-08-14T20:43:47.6237631Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.6238301Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.6238785Z 2025-08-14T20:43:47.6238942Z return optins 2025-08-14T20:43:47.6239185Z 2025-08-14T20:43:47.6239192Z 2025-08-14T20:43:47.6239456Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.6240030Z """ 2025-08-14T20:43:47.6240515Z Check if the experiment name is valid. 2025-08-14T20:43:47.6241023Z A valid name: 2025-08-14T20:43:47.6241660Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.6242552Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.6243235Z - Cannot contain spaces 2025-08-14T20:43:47.6243683Z """ 2025-08-14T20:43:47.6243880Z 2025-08-14T20:43:47.6244124Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.6244804Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.6245242Z 2025-08-14T20:43:47.6245389Z if valid: 2025-08-14T20:43:47.6245755Z return True 2025-08-14T20:43:47.6245991Z 2025-08-14T20:43:47.6246143Z log.error( 2025-08-14T20:43:47.6247570Z 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-08-14T20:43:47.6249034Z ) 2025-08-14T20:43:47.6249373Z return False 2025-08-14T20:43:47.6249614Z 2025-08-14T20:43:47.6249620Z 2025-08-14T20:43:47.6249899Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.6250637Z """ 2025-08-14T20:43:47.6251324Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.6252025Z """ 2025-08-14T20:43:47.6252356Z try: 2025-08-14T20:43:47.6252721Z if settings_text: 2025-08-14T20:43:47.6253405Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.6254167Z # for easy reading 2025-08-14T20:43:47.6254912Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.6255770Z # the backtick character in shell commands. 2025-08-14T20:43:47.6256355Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.6256994Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.6257631Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.6257997Z 2025-08-14T20:43:47.6258378Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.6259104Z experiments = {} 2025-08-14T20:43:47.6259400Z 2025-08-14T20:43:47.6259767Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.6260717Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.6261793Z # 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-08-14T20:43:47.6262783Z continue 2025-08-14T20:43:47.6263082Z 2025-08-14T20:43:47.6263254Z valid_settings = {} 2025-08-14T20:43:47.6263751Z for setting in exp_settings: 2025-08-14T20:43:47.6264312Z if setting not in Experiment._fields: 2025-08-14T20:43:47.6264848Z log.warning( 2025-08-14T20:43:47.6265522Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.6266398Z ) 2025-08-14T20:43:47.6266805Z else: 2025-08-14T20:43:47.6267299Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.6267712Z 2025-08-14T20:43:47.6267968Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.6268583Z return Settings(experiments) 2025-08-14T20:43:47.6268930Z 2025-08-14T20:43:47.6269094Z except Exception: 2025-08-14T20:43:47.6269545Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.6269929Z 2025-08-14T20:43:47.6270099Z return Settings() 2025-08-14T20:43:47.6270475Z 2025-08-14T20:43:47.6270481Z 2025-08-14T20:43:47.6270716Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.6271257Z """ 2025-08-14T20:43:47.6271671Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.6272065Z 2025-08-14T20:43:47.6272384Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.6273116Z and the text below is the list of opted in users. 2025-08-14T20:43:47.6273511Z 2025-08-14T20:43:47.6273888Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.6274589Z """ 2025-08-14T20:43:47.6275103Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.6275819Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.6276215Z 2025-08-14T20:43:47.6276222Z 2025-08-14T20:43:47.6276449Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.6276977Z """ 2025-08-14T20:43:47.6277354Z Parse users from the rollout state. 2025-08-14T20:43:47.6277694Z 2025-08-14T20:43:47.6277839Z """ 2025-08-14T20:43:47.6278341Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.6279036Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.6279429Z 2025-08-14T20:43:47.6279436Z 2025-08-14T20:43:47.6279962Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.6280792Z """ 2025-08-14T20:43:47.6281180Z Check if a user is opted into an experiment 2025-08-14T20:43:47.6281699Z """ 2025-08-14T20:43:47.6282126Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.6282526Z 2025-08-14T20:43:47.6282539Z 2025-08-14T20:43:47.6282925Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.6283631Z """ 2025-08-14T20:43:47.6284058Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.6284604Z """ 2025-08-14T20:43:47.6285075Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.6285725Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.6286334Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.6286907Z return False 2025-08-14T20:43:47.6287161Z 2025-08-14T20:43:47.6287414Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.6287986Z log.warning( 2025-08-14T20:43:47.6288738Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.6289570Z ) 2025-08-14T20:43:47.6289772Z 2025-08-14T20:43:47.6289930Z return True 2025-08-14T20:43:47.6290160Z 2025-08-14T20:43:47.6290167Z 2025-08-14T20:43:47.6290462Z def get_runner_prefix( 2025-08-14T20:43:47.6290897Z rollout_state: str, 2025-08-14T20:43:47.6291320Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.6291812Z branch: str, 2025-08-14T20:43:47.6292277Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.6292906Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.6293468Z is_canary: bool = False, 2025-08-14T20:43:47.6293896Z ) -> str: 2025-08-14T20:43:47.6294422Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.6294985Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.6295346Z 2025-08-14T20:43:47.6295513Z fleet_prefix = "" 2025-08-14T20:43:47.6295910Z prefixes = [] 2025-08-14T20:43:47.6296498Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.6297382Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.6298064Z log.info( 2025-08-14T20:43:47.6298700Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.6299418Z ) 2025-08-14T20:43:47.6299777Z continue 2025-08-14T20:43:47.6300021Z 2025-08-14T20:43:47.6300192Z if opt_out_experiments: 2025-08-14T20:43:47.6300928Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.6301543Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.6302114Z log.info( 2025-08-14T20:43:47.6302991Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.6303925Z ) 2025-08-14T20:43:47.6304304Z continue 2025-08-14T20:43:47.6304575Z 2025-08-14T20:43:47.6304747Z if eligible_experiments: 2025-08-14T20:43:47.6305304Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.6305913Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.6306441Z log.info( 2025-08-14T20:43:47.6307174Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.6307968Z ) 2025-08-14T20:43:47.6308354Z continue 2025-08-14T20:43:47.6308797Z elif not experiment_settings.default: 2025-08-14T20:43:47.6309309Z log.info( 2025-08-14T20:43:47.6310057Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.6310883Z ) 2025-08-14T20:43:47.6311245Z continue 2025-08-14T20:43:47.6311499Z 2025-08-14T20:43:47.6311751Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.6312335Z opted_out_users = [ 2025-08-14T20:43:47.6312763Z requestor 2025-08-14T20:43:47.6313197Z for requestor in workflow_requestors 2025-08-14T20:43:47.6313833Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6314436Z ] 2025-08-14T20:43:47.6314638Z 2025-08-14T20:43:47.6314798Z if opted_out_users: 2025-08-14T20:43:47.6315226Z log.info( 2025-08-14T20:43:47.6315804Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.6316463Z ) 2025-08-14T20:43:47.6316813Z continue 2025-08-14T20:43:47.6317066Z 2025-08-14T20:43:47.6317318Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.6317901Z opted_in_users = [ 2025-08-14T20:43:47.6318322Z requestor 2025-08-14T20:43:47.6318748Z for requestor in workflow_requestors 2025-08-14T20:43:47.6319373Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6319952Z ] 2025-08-14T20:43:47.6320153Z 2025-08-14T20:43:47.6320398Z enabled = False 2025-08-14T20:43:47.6320810Z if opted_in_users: 2025-08-14T20:43:47.6321227Z log.info( 2025-08-14T20:43:47.6321792Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.6322443Z ) 2025-08-14T20:43:47.6322807Z enabled = True 2025-08-14T20:43:47.6323079Z 2025-08-14T20:43:47.6323279Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.6324069Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.6325074Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.6325694Z log.info( 2025-08-14T20:43:47.6326512Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.6327378Z ) 2025-08-14T20:43:47.6327763Z enabled = True 2025-08-14T20:43:47.6328052Z 2025-08-14T20:43:47.6328205Z if enabled: 2025-08-14T20:43:47.6328606Z label = experiment_name 2025-08-14T20:43:47.6329125Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.6329905Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.6330893Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.6331615Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.6332249Z if is_canary: 2025-08-14T20:43:47.6332725Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.6333241Z fleet_prefix = label 2025-08-14T20:43:47.6333714Z else: 2025-08-14T20:43:47.6334119Z prefixes.append(label) 2025-08-14T20:43:47.6334462Z 2025-08-14T20:43:47.6334632Z if len(prefixes) > 1: 2025-08-14T20:43:47.6335050Z log.error( 2025-08-14T20:43:47.6336025Z 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-08-14T20:43:47.6337065Z ) 2025-08-14T20:43:47.6337435Z prefixes = prefixes[:1] 2025-08-14T20:43:47.6337742Z 2025-08-14T20:43:47.6337912Z # Fleet always comes first 2025-08-14T20:43:47.6338349Z if fleet_prefix: 2025-08-14T20:43:47.6338779Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.6339135Z 2025-08-14T20:43:47.6339476Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.6339885Z 2025-08-14T20:43:47.6339892Z 2025-08-14T20:43:47.6340294Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.6341678Z """ 2025-08-14T20:43:47.6342242Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.6342784Z 2025-08-14T20:43:47.6343138Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.6343808Z """ 2025-08-14T20:43:47.6344177Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.6344693Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.6345290Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.6345721Z 2025-08-14T20:43:47.6345728Z 2025-08-14T20:43:47.6346105Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.6346826Z for _ in range(num_retries): 2025-08-14T20:43:47.6347278Z try: 2025-08-14T20:43:47.6347716Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.6348349Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.6348959Z return json.loads(content) 2025-08-14T20:43:47.6349457Z except Exception as e: 2025-08-14T20:43:47.6349963Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.6350531Z 2025-08-14T20:43:47.6350891Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.6351574Z return {} 2025-08-14T20:43:47.6351789Z 2025-08-14T20:43:47.6351795Z 2025-08-14T20:43:47.6351936Z @cache 2025-08-14T20:43:47.6352516Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.6353232Z """ 2025-08-14T20:43:47.6353597Z Dynamically get PR information 2025-08-14T20:43:47.6354060Z """ 2025-08-14T20:43:47.6354690Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.6355289Z headers = { 2025-08-14T20:43:47.6355712Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.6356293Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.6356795Z } 2025-08-14T20:43:47.6357192Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.6357756Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.6358275Z headers=headers, 2025-08-14T20:43:47.6358687Z ) 2025-08-14T20:43:47.6358883Z 2025-08-14T20:43:47.6359047Z if not json_response: 2025-08-14T20:43:47.6359581Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.6360156Z return {} 2025-08-14T20:43:47.6360502Z 2025-08-14T20:43:47.6360669Z return json_response 2025-08-14T20:43:47.6360939Z 2025-08-14T20:43:47.6360947Z 2025-08-14T20:43:47.6361316Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.6362015Z """ 2025-08-14T20:43:47.6362513Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.6363129Z """ 2025-08-14T20:43:47.6363590Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.6364160Z return { 2025-08-14T20:43:47.6364700Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.6365356Z } 2025-08-14T20:43:47.6365552Z 2025-08-14T20:43:47.6365559Z 2025-08-14T20:43:47.6365712Z def main() -> None: 2025-08-14T20:43:47.6366107Z args = parse_args() 2025-08-14T20:43:47.6366371Z 2025-08-14T20:43:47.6366569Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.6366942Z 2025-08-14T20:43:47.6367116Z # Check if the PR is opt-out 2025-08-14T20:43:47.6367571Z if args.pr_number: 2025-08-14T20:43:47.6368185Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.6369019Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.6369496Z log.info( 2025-08-14T20:43:47.6370136Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.6370972Z ) 2025-08-14T20:43:47.6371491Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6372118Z sys.exit() 2025-08-14T20:43:47.6372376Z 2025-08-14T20:43:47.6372526Z try: 2025-08-14T20:43:47.6372922Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.6373589Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.6374193Z ) 2025-08-14T20:43:47.6374403Z 2025-08-14T20:43:47.6374588Z username = get_potential_pr_author( 2025-08-14T20:43:47.6375099Z args.github_token, 2025-08-14T20:43:47.6375553Z args.github_repo, 2025-08-14T20:43:47.6376007Z args.github_actor, 2025-08-14T20:43:47.6376471Z args.github_ref_type, 2025-08-14T20:43:47.6376943Z args.github_branch, 2025-08-14T20:43:47.6377372Z ) 2025-08-14T20:43:47.6377574Z 2025-08-14T20:43:47.6377836Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.6378275Z 2025-08-14T20:43:47.6378475Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.6379004Z rollout_state, 2025-08-14T20:43:47.6379463Z (args.github_issue_owner, username), 2025-08-14T20:43:47.6379981Z args.github_branch, 2025-08-14T20:43:47.6380545Z args.eligible_experiments, 2025-08-14T20:43:47.6381048Z args.opt_out_experiments, 2025-08-14T20:43:47.6381528Z is_canary, 2025-08-14T20:43:47.6381912Z ) 2025-08-14T20:43:47.6382124Z 2025-08-14T20:43:47.6382292Z except Exception as e: 2025-08-14T20:43:47.6382721Z log.error( 2025-08-14T20:43:47.6383376Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.6384275Z ) 2025-08-14T20:43:47.6384481Z 2025-08-14T20:43:47.6384782Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6385261Z 2025-08-14T20:43:47.6385267Z 2025-08-14T20:43:47.6385435Z if __name__ == "__main__": 2025-08-14T20:43:47.6385844Z main() 2025-08-14T20:43:47.6386052Z 2025-08-14T20:43:47.6475963Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6476765Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6518483Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.6518924Z env: 2025-08-14T20:43:47.6519508Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.6519899Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.6520296Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.6520881Z ISSUE_OWNER: 2025-08-14T20:43:47.6521240Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.6521645Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:47.6522046Z PR_NUMBER: 2025-08-14T20:43:47.6522386Z ##[endgroup] 2025-08-14T20:43:48.9174392Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.6841889Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.7161941Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.7365537Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.3 MB/s eta 0:00:00 2025-08-14T20:43:49.7572824Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.7599797Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.8023180Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:49.8051900Z 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-08-14T20:43:49.8097909Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:49.8115845Z 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-08-14T20:43:49.8129936Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:49.8378768Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:49.8406157Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:49.8638033Z 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-08-14T20:43:49.9729252Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.9756214Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:50.0882427Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:50.0910264Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:50.1091249Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.1116513Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:50.1330880Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.1398391Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 27.0 MB/s eta 0:00:00 2025-08-14T20:43:50.1433693Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.1488408Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 92.2 MB/s eta 0:00:00 2025-08-14T20:43:50.1518954Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.1604808Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 124.6 MB/s eta 0:00:00 2025-08-14T20:43:50.1627807Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.1675047Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.1738907Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 103.5 MB/s eta 0:00:00 2025-08-14T20:43:50.1765755Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:50.1816122Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 27.6 MB/s eta 0:00:00 2025-08-14T20:43:50.1844109Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:50.1904337Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 29.7 MB/s eta 0:00:00 2025-08-14T20:43:50.5004275Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:51.0347403Z 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.3 2025-08-14T20:43:51.1296273Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.1296586Z curr_branch="main" 2025-08-14T20:43:51.1296809Z curr_ref_type="branch" 2025-08-14T20:43:51.1297100Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.1297355Z  2025-08-14T20:43:51.1297556Z python3 runner_determinator.py \ 2025-08-14T20:43:51.1297846Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.1298119Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.1298381Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.1298656Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.1298947Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.1299229Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.1299510Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.1299815Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.1300179Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.1300742Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.1342296Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.1342528Z env: 2025-08-14T20:43:51.1343144Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.1343340Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.1343549Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.1343806Z ISSUE_OWNER: 2025-08-14T20:43:51.1343983Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.1344178Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:51.1344383Z PR_NUMBER: 2025-08-14T20:43:51.1344555Z ##[endgroup] 2025-08-14T20:43:51.1405282Z Current branch is 'main' 2025-08-14T20:43:52.8941816Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.8943363Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.8944288Z INFO : Setting output: label-type='' 2025-08-14T20:43:52.9257795Z Evaluate and set job outputs 2025-08-14T20:43:52.9265393Z Cleaning up orphan processes