2025-09-07T06:09:27.8618706Z Current runner version: '2.328.0' 2025-09-07T06:09:27.8642124Z ##[group]Runner Image Provisioner 2025-09-07T06:09:27.8642922Z Hosted Compute Agent 2025-09-07T06:09:27.8643649Z Version: 20250829.383 2025-09-07T06:09:27.8644356Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:27.8645037Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:27.8645606Z ##[endgroup] 2025-09-07T06:09:27.8646153Z ##[group]Operating System 2025-09-07T06:09:27.8646702Z Ubuntu 2025-09-07T06:09:27.8647148Z 24.04.3 2025-09-07T06:09:27.8647631Z LTS 2025-09-07T06:09:27.8648113Z ##[endgroup] 2025-09-07T06:09:27.8648550Z ##[group]Runner Image 2025-09-07T06:09:27.8649115Z Image: ubuntu-24.04 2025-09-07T06:09:27.8649571Z Version: 20250831.1.0 2025-09-07T06:09:27.8650553Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:27.8652051Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:27.8653014Z ##[endgroup] 2025-09-07T06:09:27.8654152Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:27.8656438Z Metadata: read 2025-09-07T06:09:27.8657050Z ##[endgroup] 2025-09-07T06:09:27.8659067Z Secret source: Actions 2025-09-07T06:09:27.8659740Z Prepare workflow directory 2025-09-07T06:09:27.9197466Z Prepare all required actions 2025-09-07T06:09:27.9278345Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:27.9283632Z ##[group] Inputs 2025-09-07T06:09:27.9284220Z check_experiments: 2025-09-07T06:09:27.9284805Z opt_out_experiments: 2025-09-07T06:09:27.9285484Z triggering_actor: pytorchmergebot 2025-09-07T06:09:27.9286052Z issue_owner: 2025-09-07T06:09:27.9286536Z curr_branch: main 2025-09-07T06:09:27.9287077Z curr_ref_type: branch 2025-09-07T06:09:27.9287603Z issue_number: 5132 2025-09-07T06:09:27.9288232Z ##[endgroup] 2025-09-07T06:09:27.9288910Z Complete job name: get-label-type / runner-determinator 2025-09-07T06:09:28.6439813Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:28.6442342Z cat < runner_determinator.py 2025-09-07T06:09:28.6443447Z # flake8: noqa: G004 2025-09-07T06:09:28.6444106Z  2025-09-07T06:09:28.6444947Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.6446066Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.6447090Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.6447840Z  2025-09-07T06:09:28.6448312Z """ 2025-09-07T06:09:28.6449087Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.6450101Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.6451377Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.6452370Z of which runners should be used to run which job. 2025-09-07T06:09:28.6453059Z  2025-09-07T06:09:28.6454264Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.6455333Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.6456363Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.6457288Z list, defined. 2025-09-07T06:09:28.6457829Z  2025-09-07T06:09:28.6458504Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.6459660Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.6460681Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.6461404Z  2025-09-07T06:09:28.6462225Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.6463719Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.6464655Z experiments which the user could be opted in to. 2025-09-07T06:09:28.6465436Z  2025-09-07T06:09:28.6465943Z The user list has the following rules: 2025-09-07T06:09:28.6466596Z  2025-09-07T06:09:28.6467338Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.6468403Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.6469333Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.6470023Z  2025-09-07T06:09:28.6470526Z Example config: 2025-09-07T06:09:28.6471129Z  # A list of experiments that can be opted into. 2025-09-07T06:09:28.6472023Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.6472802Z  # Expected syntax is: 2025-09-07T06:09:28.6473763Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.6474947Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.6475827Z  2025-09-07T06:09:28.6476311Z  experiments: 2025-09-07T06:09:28.6570217Z  lf: 2025-09-07T06:09:28.6570982Z  rollout_percent: 25 2025-09-07T06:09:28.6571533Z  all_branches: false 2025-09-07T06:09:28.6572075Z  default: true 2025-09-07T06:09:28.6572551Z  --- 2025-09-07T06:09:28.6572955Z  2025-09-07T06:09:28.6573691Z  # Opt-ins: 2025-09-07T06:09:28.6574386Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.6575734Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.6576660Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.6577421Z  # Experiments should be from the above list. 2025-09-07T06:09:28.6578017Z  2025-09-07T06:09:28.6578428Z  @User1,-lf,split_build 2025-09-07T06:09:28.6578946Z  @User2,lf 2025-09-07T06:09:28.6579417Z  @User3,split_build 2025-09-07T06:09:28.6579901Z """ 2025-09-07T06:09:28.6580297Z  2025-09-07T06:09:28.6580690Z import json 2025-09-07T06:09:28.6581142Z import logging 2025-09-07T06:09:28.6581584Z import os 2025-09-07T06:09:28.6582010Z import random 2025-09-07T06:09:28.6582452Z import re 2025-09-07T06:09:28.6582879Z import sys 2025-09-07T06:09:28.6583483Z from argparse import ArgumentParser 2025-09-07T06:09:28.6584177Z from collections.abc import Iterable 2025-09-07T06:09:28.6584802Z from functools import cache 2025-09-07T06:09:28.6585355Z from logging import LogRecord 2025-09-07T06:09:28.6585920Z from typing import Any, NamedTuple 2025-09-07T06:09:28.6586542Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.6587133Z  2025-09-07T06:09:28.6587515Z import yaml 2025-09-07T06:09:28.6587975Z from github import Auth, Github 2025-09-07T06:09:28.6588545Z from github.Issue import Issue 2025-09-07T06:09:28.6589069Z  2025-09-07T06:09:28.6589438Z  2025-09-07T06:09:28.6589896Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.6590676Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.6591636Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.6592390Z  2025-09-07T06:09:28.6592872Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.6593834Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.6594450Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.6595099Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.6595670Z  2025-09-07T06:09:28.6596110Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.6596651Z  2025-09-07T06:09:28.6597078Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.6597606Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.6598116Z  2025-09-07T06:09:28.6598487Z  2025-09-07T06:09:28.6598896Z class Experiment(NamedTuple): 2025-09-07T06:09:28.6599438Z  rollout_perc: float = ( 2025-09-07T06:09:28.6600171Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.6600902Z  ) 2025-09-07T06:09:28.6601328Z  all_branches: bool = ( 2025-09-07T06:09:28.6602072Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.6602788Z  ) 2025-09-07T06:09:28.6603322Z  default: bool = ( 2025-09-07T06:09:28.6603997Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.6604689Z  ) 2025-09-07T06:09:28.6605074Z  2025-09-07T06:09:28.6605484Z  # Add more fields as needed 2025-09-07T06:09:28.6606002Z  2025-09-07T06:09:28.6606371Z  2025-09-07T06:09:28.6606780Z class Settings(NamedTuple): 2025-09-07T06:09:28.6607280Z  """ 2025-09-07T06:09:28.6607815Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:28.6608441Z  """ 2025-09-07T06:09:28.6608840Z  2025-09-07T06:09:28.6609279Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.6609834Z  2025-09-07T06:09:28.6610363Z  2025-09-07T06:09:28.6610840Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.6611552Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.6612184Z  2025-09-07T06:09:28.6612569Z  COLORS = { 2025-09-07T06:09:28.6613048Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.6614019Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.6614616Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.6615180Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.6615745Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.6616268Z  } 2025-09-07T06:09:28.6616665Z  2025-09-07T06:09:28.6617126Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.6617946Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.6618791Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.6619430Z  return super().format(record) 2025-09-07T06:09:28.6619961Z  2025-09-07T06:09:28.6620326Z  2025-09-07T06:09:28.6620748Z handler = logging.StreamHandler() 2025-09-07T06:09:28.6621541Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.6622308Z  2025-09-07T06:09:28.6622798Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.6623800Z log.addHandler(handler) 2025-09-07T06:09:28.6624322Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.6624824Z  2025-09-07T06:09:28.6625196Z  2025-09-07T06:09:28.6625700Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.6626323Z  """ 2025-09-07T06:09:28.6626900Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.6627585Z  """ 2025-09-07T06:09:28.6628164Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:28.6629323Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.6630558Z  log.warning( 2025-09-07T06:09:28.6631515Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.6632493Z  ) 2025-09-07T06:09:28.6632994Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.6633708Z  return 2025-09-07T06:09:28.6634162Z  2025-09-07T06:09:28.6634596Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.6635246Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.6635878Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:28.6636412Z  2025-09-07T06:09:28.6636791Z  2025-09-07T06:09:28.6637350Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.6638062Z  return frozenset( 2025-09-07T06:09:28.6638781Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.6639518Z  ) 2025-09-07T06:09:28.6639923Z  2025-09-07T06:09:28.6640300Z  2025-09-07T06:09:28.6640695Z def parse_args() -> Any: 2025-09-07T06:09:28.6641355Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.6642297Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.6643226Z  parser.add_argument( 2025-09-07T06:09:28.6643764Z  "--github-issue-repo", 2025-09-07T06:09:28.6644298Z  type=str, 2025-09-07T06:09:28.6644778Z  required=False, 2025-09-07T06:09:28.6645485Z  default="pytorch/test-infra", 2025-09-07T06:09:28.6646120Z  help="GitHub repo to get the issue", 2025-09-07T06:09:28.6646674Z  ) 2025-09-07T06:09:28.6647098Z  parser.add_argument( 2025-09-07T06:09:28.6647610Z  "--github-repo", 2025-09-07T06:09:28.6648126Z  type=str, 2025-09-07T06:09:28.6648610Z  required=True, 2025-09-07T06:09:28.6649163Z  help="GitHub repo where CI is running", 2025-09-07T06:09:28.6649739Z  ) 2025-09-07T06:09:28.6650161Z  parser.add_argument( 2025-09-07T06:09:28.6650867Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.6651574Z  ) 2025-09-07T06:09:28.6652000Z  parser.add_argument( 2025-09-07T06:09:28.6652726Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.6653815Z  ) 2025-09-07T06:09:28.6654277Z  parser.add_argument( 2025-09-07T06:09:28.6655016Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.6655770Z  ) 2025-09-07T06:09:28.6656187Z  parser.add_argument( 2025-09-07T06:09:28.6656956Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.6657719Z  ) 2025-09-07T06:09:28.6658169Z  parser.add_argument( 2025-09-07T06:09:28.6658707Z  "--github-ref-type", 2025-09-07T06:09:28.6659230Z  type=str, 2025-09-07T06:09:28.6659718Z  required=True, 2025-09-07T06:09:28.6660314Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.6660915Z  ) 2025-09-07T06:09:28.6661341Z  parser.add_argument( 2025-09-07T06:09:28.6661888Z  "--eligible-experiments", 2025-09-07T06:09:28.6662679Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6663421Z  required=False, 2025-09-07T06:09:28.6663932Z  default="", 2025-09-07T06:09:28.6664895Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.6665888Z  ) 2025-09-07T06:09:28.6666315Z  parser.add_argument( 2025-09-07T06:09:28.6666850Z  "--opt-out-experiments", 2025-09-07T06:09:28.6667443Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:28.6668013Z  required=False, 2025-09-07T06:09:28.6668511Z  default="", 2025-09-07T06:09:28.6668985Z  help=( 2025-09-07T06:09:28.6669745Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.6670967Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.6671868Z  ), 2025-09-07T06:09:28.6672286Z  ) 2025-09-07T06:09:28.6672710Z  parser.add_argument( 2025-09-07T06:09:28.6673521Z  "--pr-number", 2025-09-07T06:09:28.6674053Z  type=str, 2025-09-07T06:09:28.6674531Z  required=False, 2025-09-07T06:09:28.6675036Z  default="", 2025-09-07T06:09:28.6675600Z  help="the optional PR number where this is run", 2025-09-07T06:09:28.6676215Z  ) 2025-09-07T06:09:28.6676607Z  2025-09-07T06:09:28.6677022Z  return parser.parse_args() 2025-09-07T06:09:28.6677547Z  2025-09-07T06:09:28.6677914Z  2025-09-07T06:09:28.6678576Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6679545Z  auth = Auth.Token(github_token) 2025-09-07T06:09:28.6680170Z  return Github(auth=auth) 2025-09-07T06:09:28.6680683Z  2025-09-07T06:09:28.6681055Z  2025-09-07T06:09:28.6681771Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.6682640Z  repo = gh.get_repo(repo) 2025-09-07T06:09:28.6683352Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.6683940Z  2025-09-07T06:09:28.6684325Z  2025-09-07T06:09:28.6684731Z def get_potential_pr_author( 2025-09-07T06:09:28.6685486Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.6686224Z ) -> str: 2025-09-07T06:09:28.6686831Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.6687730Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.6688559Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:28.6689183Z  2025-09-07T06:09:28.6689614Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.6690164Z  2025-09-07T06:09:28.6690685Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.6691387Z  split_tag = ref_name.split("/") 2025-09-07T06:09:28.6691950Z  if ( 2025-09-07T06:09:28.6692409Z  len(split_tag) == 3 2025-09-07T06:09:28.6692984Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:28.6693963Z  and split_tag[2].isnumeric() 2025-09-07T06:09:28.6694537Z  ): 2025-09-07T06:09:28.6695004Z  pr_number = split_tag[2] 2025-09-07T06:09:28.6695562Z  try: 2025-09-07T06:09:28.6696086Z  repository = gh.get_repo(repo) 2025-09-07T06:09:28.6696784Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.6697615Z  except Exception as e: 2025-09-07T06:09:28.6698215Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:28.6698967Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.6699682Z  ) from e 2025-09-07T06:09:28.6700320Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.6701107Z  # In all other cases, return the original input username 2025-09-07T06:09:28.6701748Z  return username 2025-09-07T06:09:28.6702214Z  2025-09-07T06:09:28.6702581Z  2025-09-07T06:09:28.6703055Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.6704369Z  """ 2025-09-07T06:09:28.6705116Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.6705979Z  """ 2025-09-07T06:09:28.6706596Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.6707317Z  2025-09-07T06:09:28.6707680Z  2025-09-07T06:09:28.6708110Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.6708670Z  try: 2025-09-07T06:09:28.6709137Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.6709704Z  return data 2025-09-07T06:09:28.6710206Z  except yaml.YAMLError: 2025-09-07T06:09:28.6710792Z  log.exception("Error loading YAML") 2025-09-07T06:09:28.6711357Z  raise 2025-09-07T06:09:28.6711788Z  2025-09-07T06:09:28.6712157Z  2025-09-07T06:09:28.6712836Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.6713775Z  """ 2025-09-07T06:09:28.6714615Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.6715438Z  2025-09-07T06:09:28.6716033Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6716895Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.6717502Z  2025-09-07T06:09:28.6718139Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.6718890Z  """ 2025-09-07T06:09:28.6719405Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.6720066Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.6720746Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.6721392Z  else: 2025-09-07T06:09:28.6721834Z  return "", rollout_state 2025-09-07T06:09:28.6722618Z  2025-09-07T06:09:28.6722990Z  2025-09-07T06:09:28.6723556Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.6724121Z  """ 2025-09-07T06:09:28.6724717Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.6725414Z  """ 2025-09-07T06:09:28.6725796Z  2025-09-07T06:09:28.6726162Z  2025-09-07T06:09:28.6726737Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.6727447Z  """ 2025-09-07T06:09:28.6728229Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.6729117Z  2025-09-07T06:09:28.6729983Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.6731095Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.6731852Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.6732658Z  2025-09-07T06:09:28.6733018Z  2025-09-07T06:09:28.6733721Z  """ 2025-09-07T06:09:28.6734160Z  optins = UserOptins() 2025-09-07T06:09:28.6734752Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.6735380Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:28.6736006Z  if not user or not user.startswith("@"): 2025-09-07T06:09:28.6736620Z  # Not a valid user. Skip 2025-09-07T06:09:28.6737168Z  continue 2025-09-07T06:09:28.6737620Z  2025-09-07T06:09:28.6737999Z  if user: 2025-09-07T06:09:28.6738563Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.6739327Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.6740016Z  2025-09-07T06:09:28.6740406Z  return optins 2025-09-07T06:09:28.6740866Z  2025-09-07T06:09:28.6741221Z  2025-09-07T06:09:28.6741759Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.6742413Z  """ 2025-09-07T06:09:28.6742877Z  Check if the experiment name is valid. 2025-09-07T06:09:28.6743563Z  A valid name: 2025-09-07T06:09:28.6744292Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.6745305Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.6746081Z  - Cannot contain spaces 2025-09-07T06:09:28.6746610Z  """ 2025-09-07T06:09:28.6746997Z  2025-09-07T06:09:28.6747501Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.6748290Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.6749069Z  2025-09-07T06:09:28.6749455Z  if valid: 2025-09-07T06:09:28.6749896Z  return True 2025-09-07T06:09:28.6750349Z  2025-09-07T06:09:28.6750724Z  log.error( 2025-09-07T06:09:28.6752281Z  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-09-07T06:09:28.6754033Z  ) 2025-09-07T06:09:28.6754447Z  return False 2025-09-07T06:09:28.6754897Z  2025-09-07T06:09:28.6755256Z  2025-09-07T06:09:28.6755819Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.6756503Z  """ 2025-09-07T06:09:28.6757174Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.6757948Z  """ 2025-09-07T06:09:28.6758352Z  try: 2025-09-07T06:09:28.6758775Z  if settings_text: 2025-09-07T06:09:28.6759588Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.6760439Z  # for easy reading 2025-09-07T06:09:28.6761323Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.6762292Z  # the backtick character in shell commands. 2025-09-07T06:09:28.6762977Z  backtick = chr(96) # backtick character 2025-09-07T06:09:28.6763820Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.6764561Z  settings = load_yaml(settings_text) 2025-09-07T06:09:28.6765113Z  2025-09-07T06:09:28.6765778Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.6766699Z  experiments = {} 2025-09-07T06:09:28.6767198Z  2025-09-07T06:09:28.6767815Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.6768637Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.6769824Z  # 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-09-07T06:09:28.6770930Z  continue 2025-09-07T06:09:28.6771427Z  2025-09-07T06:09:28.6771844Z  valid_settings = {} 2025-09-07T06:09:28.6772429Z  for setting in exp_settings: 2025-09-07T06:09:28.6773062Z  if setting not in Experiment._fields: 2025-09-07T06:09:28.6773999Z  log.warning( 2025-09-07T06:09:28.6774821Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.6775591Z  ) 2025-09-07T06:09:28.6776086Z  else: 2025-09-07T06:09:28.6776696Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.6777308Z  2025-09-07T06:09:28.6777833Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.6778529Z  return Settings(experiments) 2025-09-07T06:09:28.6779078Z  2025-09-07T06:09:28.6779472Z  except Exception: 2025-09-07T06:09:28.6780039Z  log.exception("Failed to parse settings") 2025-09-07T06:09:28.6780624Z  2025-09-07T06:09:28.6781006Z  return Settings() 2025-09-07T06:09:28.6781474Z  2025-09-07T06:09:28.6781829Z  2025-09-07T06:09:28.6782519Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.6783295Z  """ 2025-09-07T06:09:28.6783815Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.6784421Z  2025-09-07T06:09:28.6785002Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.6785853Z  and the text below is the list of opted in users. 2025-09-07T06:09:28.6786449Z  2025-09-07T06:09:28.6787103Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.6787871Z  """ 2025-09-07T06:09:28.6788497Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6789338Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.6789928Z  2025-09-07T06:09:28.6790293Z  2025-09-07T06:09:28.6790784Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.6791410Z  """ 2025-09-07T06:09:28.6791861Z  Parse users from the rollout state. 2025-09-07T06:09:28.6792420Z  2025-09-07T06:09:28.6792779Z  """ 2025-09-07T06:09:28.6793486Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.6794315Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.6794902Z  2025-09-07T06:09:28.6795297Z  2025-09-07T06:09:28.6795971Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6796772Z  """ 2025-09-07T06:09:28.6797252Z  Check if a user is opted into an experiment 2025-09-07T06:09:28.6797839Z  """ 2025-09-07T06:09:28.6798362Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.6798977Z  2025-09-07T06:09:28.6799341Z  2025-09-07T06:09:28.6800149Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.6800974Z  """ 2025-09-07T06:09:28.6801502Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.6802130Z  """ 2025-09-07T06:09:28.6802709Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.6803573Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.6804290Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.6804930Z  return False 2025-09-07T06:09:28.6805385Z  2025-09-07T06:09:28.6805897Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.6806547Z  log.warning( 2025-09-07T06:09:28.6807455Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.6808381Z  ) 2025-09-07T06:09:28.6808787Z  2025-09-07T06:09:28.6809161Z  return True 2025-09-07T06:09:28.6809597Z  2025-09-07T06:09:28.6809953Z  2025-09-07T06:09:28.6810343Z def get_runner_prefix( 2025-09-07T06:09:28.6810848Z  rollout_state: str, 2025-09-07T06:09:28.6811392Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:28.6811960Z  branch: str, 2025-09-07T06:09:28.6812540Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6813388Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.6814028Z  is_canary: bool = False, 2025-09-07T06:09:28.6814546Z ) -> str: 2025-09-07T06:09:28.6815046Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:28.6815700Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.6816267Z  2025-09-07T06:09:28.6816791Z  fleet_prefix = "" 2025-09-07T06:09:28.6817293Z  prefixes = [] 2025-09-07T06:09:28.6818012Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.6819039Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.6819806Z  log.info( 2025-09-07T06:09:28.6820571Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.6821375Z  ) 2025-09-07T06:09:28.6821825Z  continue 2025-09-07T06:09:28.6822278Z  2025-09-07T06:09:28.6822682Z  if opt_out_experiments: 2025-09-07T06:09:28.6823406Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.6824135Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.6824785Z  log.info( 2025-09-07T06:09:28.6825818Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.6826846Z  ) 2025-09-07T06:09:28.6827316Z  continue 2025-09-07T06:09:28.6827793Z  2025-09-07T06:09:28.6828200Z  if eligible_experiments: 2025-09-07T06:09:28.6828839Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.6829541Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.6830145Z  log.info( 2025-09-07T06:09:28.6831044Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.6831933Z  ) 2025-09-07T06:09:28.6832391Z  continue 2025-09-07T06:09:28.6833182Z  elif not experiment_settings.default: 2025-09-07T06:09:28.6833774Z  log.info( 2025-09-07T06:09:28.6834527Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.6835315Z  ) 2025-09-07T06:09:28.6835752Z  continue 2025-09-07T06:09:28.6836215Z  2025-09-07T06:09:28.6836724Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.6837401Z  opted_out_users = [ 2025-09-07T06:09:28.6837916Z  requestor 2025-09-07T06:09:28.6838457Z  for requestor in workflow_requestors 2025-09-07T06:09:28.6839204Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6839880Z  ] 2025-09-07T06:09:28.6840290Z  2025-09-07T06:09:28.6840681Z  if opted_out_users: 2025-09-07T06:09:28.6841230Z  log.info( 2025-09-07T06:09:28.6841948Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.6842698Z  ) 2025-09-07T06:09:28.6843237Z  continue 2025-09-07T06:09:28.6843704Z  2025-09-07T06:09:28.6844214Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.6844878Z  opted_in_users = [ 2025-09-07T06:09:28.6845403Z  requestor 2025-09-07T06:09:28.6845948Z  for requestor in workflow_requestors 2025-09-07T06:09:28.6846687Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.6847362Z  ] 2025-09-07T06:09:28.6847781Z  2025-09-07T06:09:28.6848171Z  enabled = False 2025-09-07T06:09:28.6848678Z  if opted_in_users: 2025-09-07T06:09:28.6849324Z  log.info( 2025-09-07T06:09:28.6850019Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.6850764Z  ) 2025-09-07T06:09:28.6851213Z  enabled = True 2025-09-07T06:09:28.6851706Z  2025-09-07T06:09:28.6852160Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.6853057Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.6854179Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.6854885Z  log.info( 2025-09-07T06:09:28.6855840Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.6856810Z  ) 2025-09-07T06:09:28.6857293Z  enabled = True 2025-09-07T06:09:28.6857814Z  2025-09-07T06:09:28.6858194Z  if enabled: 2025-09-07T06:09:28.6858700Z  label = experiment_name 2025-09-07T06:09:28.6859318Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.6860211Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.6861160Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.6861989Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.6862702Z  if is_canary: 2025-09-07T06:09:28.6863365Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.6863970Z  fleet_prefix = label 2025-09-07T06:09:28.6864511Z  else: 2025-09-07T06:09:28.6865024Z  prefixes.append(label) 2025-09-07T06:09:28.6865690Z  2025-09-07T06:09:28.6866085Z  if len(prefixes) > 1: 2025-09-07T06:09:28.6866598Z  log.error( 2025-09-07T06:09:28.6867729Z  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-09-07T06:09:28.6868909Z  ) 2025-09-07T06:09:28.6869346Z  prefixes = prefixes[:1] 2025-09-07T06:09:28.6869873Z  2025-09-07T06:09:28.6870283Z  # Fleet always comes first 2025-09-07T06:09:28.6870818Z  if fleet_prefix: 2025-09-07T06:09:28.6871347Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.6871897Z  2025-09-07T06:09:28.6872385Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.6872996Z  2025-09-07T06:09:28.6873463Z  2025-09-07T06:09:28.6874160Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.6874989Z  """ 2025-09-07T06:09:28.6875643Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.6876392Z  2025-09-07T06:09:28.6877011Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.6877770Z  """ 2025-09-07T06:09:28.6878226Z  gh = get_gh_client(github_token) 2025-09-07T06:09:28.6878840Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.6879560Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.6880214Z  2025-09-07T06:09:28.6880579Z  2025-09-07T06:09:28.6881241Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.6882174Z  for _ in range(num_retries): 2025-09-07T06:09:28.6882727Z  try: 2025-09-07T06:09:28.6883323Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:28.6884061Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.6884776Z  return json.loads(content) 2025-09-07T06:09:28.6885354Z  except Exception as e: 2025-09-07T06:09:28.6885989Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.6886578Z  2025-09-07T06:09:28.6887204Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.6887968Z  return {} 2025-09-07T06:09:28.6888404Z  2025-09-07T06:09:28.6888772Z  2025-09-07T06:09:28.6889137Z @cache 2025-09-07T06:09:28.6889836Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.6890639Z  """ 2025-09-07T06:09:28.6891093Z  Dynamically get PR information 2025-09-07T06:09:28.6891633Z  """ 2025-09-07T06:09:28.6892202Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.6892880Z  headers = { 2025-09-07T06:09:28.6893523Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.6894198Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:28.6894771Z  } 2025-09-07T06:09:28.6895273Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.6895944Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.6896539Z  headers=headers, 2025-09-07T06:09:28.6897018Z  ) 2025-09-07T06:09:28.6897410Z  2025-09-07T06:09:28.6897811Z  if not json_response: 2025-09-07T06:09:28.6898462Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.6899274Z  return {} 2025-09-07T06:09:28.6899727Z  2025-09-07T06:09:28.6900122Z  return json_response 2025-09-07T06:09:28.6900607Z  2025-09-07T06:09:28.6900974Z  2025-09-07T06:09:28.6901608Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.6902380Z  """ 2025-09-07T06:09:28.6902977Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.6903779Z  """ 2025-09-07T06:09:28.6904339Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.6904998Z  return { 2025-09-07T06:09:28.6905660Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.6906388Z  } 2025-09-07T06:09:28.6906783Z  2025-09-07T06:09:28.6907151Z  2025-09-07T06:09:28.6907536Z def main() -> None: 2025-09-07T06:09:28.6908034Z  args = parse_args() 2025-09-07T06:09:28.6908513Z  2025-09-07T06:09:28.6908981Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.6909558Z  2025-09-07T06:09:28.6909969Z  # Check if the PR is opt-out 2025-09-07T06:09:28.6910512Z  if args.pr_number: 2025-09-07T06:09:28.6911263Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.6912077Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.6912627Z  log.info( 2025-09-07T06:09:28.6913507Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.6914321Z  ) 2025-09-07T06:09:28.6914952Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6915682Z  sys.exit() 2025-09-07T06:09:28.6916289Z  2025-09-07T06:09:28.6916671Z  try: 2025-09-07T06:09:28.6917167Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.6917944Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.6918635Z  ) 2025-09-07T06:09:28.6919043Z  2025-09-07T06:09:28.6919471Z  username = get_potential_pr_author( 2025-09-07T06:09:28.6920064Z  args.github_token, 2025-09-07T06:09:28.6920604Z  args.github_repo, 2025-09-07T06:09:28.6921150Z  args.github_actor, 2025-09-07T06:09:28.6921712Z  args.github_ref_type, 2025-09-07T06:09:28.6922269Z  args.github_branch, 2025-09-07T06:09:28.6922789Z  ) 2025-09-07T06:09:28.6923293Z  2025-09-07T06:09:28.6923835Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.6924493Z  2025-09-07T06:09:28.6924948Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.6925557Z  rollout_state, 2025-09-07T06:09:28.6926120Z  (args.github_issue_owner, username), 2025-09-07T06:09:28.6926734Z  args.github_branch, 2025-09-07T06:09:28.6927304Z  args.eligible_experiments, 2025-09-07T06:09:28.6927907Z  args.opt_out_experiments, 2025-09-07T06:09:28.6928461Z  is_canary, 2025-09-07T06:09:28.6928940Z  ) 2025-09-07T06:09:28.6929341Z  2025-09-07T06:09:28.6929742Z  except Exception as e: 2025-09-07T06:09:28.6930294Z  log.error( 2025-09-07T06:09:28.6931062Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.6931871Z  ) 2025-09-07T06:09:28.6932280Z  2025-09-07T06:09:28.6932989Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.6933790Z  2025-09-07T06:09:28.6934157Z  2025-09-07T06:09:28.6934545Z if __name__ == "__main__": 2025-09-07T06:09:28.6935047Z  main() 2025-09-07T06:09:28.6935461Z  2025-09-07T06:09:28.6935830Z EOF 2025-09-07T06:09:28.6936216Z  2025-09-07T06:09:28.6936614Z cat runner_determinator.py 2025-09-07T06:09:28.8217786Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.8218615Z env: 2025-09-07T06:09:28.8219319Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.8219756Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.8220221Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.8220737Z ISSUE_OWNER: 2025-09-07T06:09:28.8221149Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.8221611Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.8222058Z PR_NUMBER: 2025-09-07T06:09:28.8222442Z ##[endgroup] 2025-09-07T06:09:28.8447365Z # flake8: noqa: G004 2025-09-07T06:09:28.8447723Z 2025-09-07T06:09:28.8448169Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:28.8449138Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:28.8449970Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:28.8450419Z 2025-09-07T06:09:28.8450602Z """ 2025-09-07T06:09:28.8451198Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:28.8452078Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:28.8452991Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:28.8454088Z of which runners should be used to run which job. 2025-09-07T06:09:28.8454515Z 2025-09-07T06:09:28.8454922Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:28.8456088Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:28.8457018Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:28.8457742Z list, defined. 2025-09-07T06:09:28.8457991Z 2025-09-07T06:09:28.8458363Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:28.8459314Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:28.8460156Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:28.8460608Z 2025-09-07T06:09:28.8460997Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:28.8461868Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:28.8462616Z experiments which the user could be opted in to. 2025-09-07T06:09:28.8463026Z 2025-09-07T06:09:28.8463513Z The user list has the following rules: 2025-09-07T06:09:28.8463892Z 2025-09-07T06:09:28.8464223Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:28.8465094Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:28.8465874Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:28.8466282Z 2025-09-07T06:09:28.8466471Z Example config: 2025-09-07T06:09:28.8466934Z # A list of experiments that can be opted into. 2025-09-07T06:09:28.8467621Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:28.8468264Z # Expected syntax is: 2025-09-07T06:09:28.8468947Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:28.8469934Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:28.8470562Z 2025-09-07T06:09:28.8470744Z experiments: 2025-09-07T06:09:28.8471158Z lf: 2025-09-07T06:09:28.8471553Z rollout_percent: 25 2025-09-07T06:09:28.8472033Z all_branches: false 2025-09-07T06:09:28.8472672Z default: true 2025-09-07T06:09:28.8473337Z --- 2025-09-07T06:09:28.8473675Z 2025-09-07T06:09:28.8473858Z # Opt-ins: 2025-09-07T06:09:28.8474464Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:28.8475349Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:28.8476155Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:28.8476832Z # Experiments should be from the above list. 2025-09-07T06:09:28.8477221Z 2025-09-07T06:09:28.8477416Z @User1,-lf,split_build 2025-09-07T06:09:28.8477879Z @User2,lf 2025-09-07T06:09:28.8478289Z @User3,split_build 2025-09-07T06:09:28.8478735Z """ 2025-09-07T06:09:28.8478944Z 2025-09-07T06:09:28.8479119Z import json 2025-09-07T06:09:28.8479517Z import logging 2025-09-07T06:09:28.8479913Z import os 2025-09-07T06:09:28.8480299Z import random 2025-09-07T06:09:28.8480688Z import re 2025-09-07T06:09:28.8481076Z import sys 2025-09-07T06:09:28.8481521Z from argparse import ArgumentParser 2025-09-07T06:09:28.8482066Z from collections.abc import Iterable 2025-09-07T06:09:28.8482604Z from functools import cache 2025-09-07T06:09:28.8483274Z from logging import LogRecord 2025-09-07T06:09:28.8483932Z from typing import Any, NamedTuple 2025-09-07T06:09:28.8484490Z from urllib.request import Request, urlopen 2025-09-07T06:09:28.8484888Z 2025-09-07T06:09:28.8485062Z import yaml 2025-09-07T06:09:28.8485473Z from github import Auth, Github 2025-09-07T06:09:28.8485990Z from github.Issue import Issue 2025-09-07T06:09:28.8486311Z 2025-09-07T06:09:28.8486318Z 2025-09-07T06:09:28.8486552Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:28.8487252Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:28.8488141Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:28.8488703Z 2025-09-07T06:09:28.8488944Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:28.8489693Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:28.8490235Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:28.8490809Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:28.8491166Z 2025-09-07T06:09:28.8491377Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:28.8491720Z 2025-09-07T06:09:28.8491953Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:28.8492441Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:28.8492735Z 2025-09-07T06:09:28.8492742Z 2025-09-07T06:09:28.8492945Z class Experiment(NamedTuple): 2025-09-07T06:09:28.8493585Z rollout_perc: float = ( 2025-09-07T06:09:28.8494237Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:28.8494928Z ) 2025-09-07T06:09:28.8495319Z all_branches: bool = ( 2025-09-07T06:09:28.8495953Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:28.8496643Z ) 2025-09-07T06:09:28.8497018Z default: bool = ( 2025-09-07T06:09:28.8497617Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:28.8498291Z ) 2025-09-07T06:09:28.8498501Z 2025-09-07T06:09:28.8498693Z # Add more fields as needed 2025-09-07T06:09:28.8499006Z 2025-09-07T06:09:28.8499014Z 2025-09-07T06:09:28.8499217Z class Settings(NamedTuple): 2025-09-07T06:09:28.8499672Z """ 2025-09-07T06:09:28.8500151Z Settings for the experiments that can be opted into. 2025-09-07T06:09:28.8500737Z """ 2025-09-07T06:09:28.8500945Z 2025-09-07T06:09:28.8501165Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:28.8501536Z 2025-09-07T06:09:28.8501542Z 2025-09-07T06:09:28.8501762Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:28.8502405Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:28.8502844Z 2025-09-07T06:09:28.8503024Z COLORS = { 2025-09-07T06:09:28.8503549Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:28.8504078Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:28.8504729Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:28.8505248Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:28.8505749Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:28.8506240Z } 2025-09-07T06:09:28.8506447Z 2025-09-07T06:09:28.8506674Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:28.8507440Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:28.8508238Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:28.8508838Z return super().format(record) 2025-09-07T06:09:28.8509179Z 2025-09-07T06:09:28.8509187Z 2025-09-07T06:09:28.8509399Z handler = logging.StreamHandler() 2025-09-07T06:09:28.8510115Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:28.8510680Z 2025-09-07T06:09:28.8510933Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:28.8511534Z log.addHandler(handler) 2025-09-07T06:09:28.8512012Z log.setLevel(logging.INFO) 2025-09-07T06:09:28.8512311Z 2025-09-07T06:09:28.8512318Z 2025-09-07T06:09:28.8512580Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:28.8513263Z """ 2025-09-07T06:09:28.8513805Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:28.8514450Z """ 2025-09-07T06:09:28.8514844Z if not GITHUB_OUTPUT: 2025-09-07T06:09:28.8515925Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:28.8517096Z log.warning( 2025-09-07T06:09:28.8517985Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:28.8518945Z ) 2025-09-07T06:09:28.8528848Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:28.8529482Z return 2025-09-07T06:09:28.8529735Z 2025-09-07T06:09:28.8530141Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:28.8530760Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:28.8531357Z f.write(f"{key}={value}\n") 2025-09-07T06:09:28.8531696Z 2025-09-07T06:09:28.8531703Z 2025-09-07T06:09:28.8532015Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:28.8532664Z return frozenset( 2025-09-07T06:09:28.8533598Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:28.8534317Z ) 2025-09-07T06:09:28.8534537Z 2025-09-07T06:09:28.8534547Z 2025-09-07T06:09:28.8534741Z def parse_args() -> Any: 2025-09-07T06:09:28.8535305Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:28.8536199Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:28.8536999Z parser.add_argument( 2025-09-07T06:09:28.8537472Z "--github-issue-repo", 2025-09-07T06:09:28.8537960Z type=str, 2025-09-07T06:09:28.8538403Z required=False, 2025-09-07T06:09:28.8538896Z default="pytorch/test-infra", 2025-09-07T06:09:28.8539466Z help="GitHub repo to get the issue", 2025-09-07T06:09:28.8540014Z ) 2025-09-07T06:09:28.8540403Z parser.add_argument( 2025-09-07T06:09:28.8540868Z "--github-repo", 2025-09-07T06:09:28.8541308Z type=str, 2025-09-07T06:09:28.8541726Z required=True, 2025-09-07T06:09:28.8542200Z help="GitHub repo where CI is running", 2025-09-07T06:09:28.8542744Z ) 2025-09-07T06:09:28.8543246Z parser.add_argument( 2025-09-07T06:09:28.8543865Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:28.8595771Z ) 2025-09-07T06:09:28.8596233Z parser.add_argument( 2025-09-07T06:09:28.8596916Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:28.8597613Z ) 2025-09-07T06:09:28.8598007Z parser.add_argument( 2025-09-07T06:09:28.8598702Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:28.8599616Z ) 2025-09-07T06:09:28.8600015Z parser.add_argument( 2025-09-07T06:09:28.8600687Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:28.8601443Z ) 2025-09-07T06:09:28.8601834Z parser.add_argument( 2025-09-07T06:09:28.8602310Z "--github-ref-type", 2025-09-07T06:09:28.8602776Z type=str, 2025-09-07T06:09:28.8603506Z required=True, 2025-09-07T06:09:28.8604056Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:28.8604621Z ) 2025-09-07T06:09:28.8605012Z parser.add_argument( 2025-09-07T06:09:28.8605480Z "--eligible-experiments", 2025-09-07T06:09:28.8606015Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.8606557Z required=False, 2025-09-07T06:09:28.8607000Z default="", 2025-09-07T06:09:28.8607865Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:28.8608811Z ) 2025-09-07T06:09:28.8609199Z parser.add_argument( 2025-09-07T06:09:28.8609664Z "--opt-out-experiments", 2025-09-07T06:09:28.8610185Z type=_str_comma_separated_to_set, 2025-09-07T06:09:28.8610718Z required=False, 2025-09-07T06:09:28.8611167Z default="", 2025-09-07T06:09:28.8611575Z help=( 2025-09-07T06:09:28.8612257Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:28.8613530Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:28.8614391Z ), 2025-09-07T06:09:28.8614757Z ) 2025-09-07T06:09:28.8615148Z parser.add_argument( 2025-09-07T06:09:28.8615608Z "--pr-number", 2025-09-07T06:09:28.8616038Z type=str, 2025-09-07T06:09:28.8616463Z required=False, 2025-09-07T06:09:28.8616896Z default="", 2025-09-07T06:09:28.8617535Z help="the optional PR number where this is run", 2025-09-07T06:09:28.8618113Z ) 2025-09-07T06:09:28.8618324Z 2025-09-07T06:09:28.8618526Z return parser.parse_args() 2025-09-07T06:09:28.8618838Z 2025-09-07T06:09:28.8618845Z 2025-09-07T06:09:28.8619248Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.8620021Z auth = Auth.Token(github_token) 2025-09-07T06:09:28.8620545Z return Github(auth=auth) 2025-09-07T06:09:28.8620852Z 2025-09-07T06:09:28.8620859Z 2025-09-07T06:09:28.8621319Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:28.8622132Z repo = gh.get_repo(repo) 2025-09-07T06:09:28.8622643Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:28.8623025Z 2025-09-07T06:09:28.8623032Z 2025-09-07T06:09:28.8623449Z def get_potential_pr_author( 2025-09-07T06:09:28.8624136Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:28.8624840Z ) -> str: 2025-09-07T06:09:28.8625377Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:28.8626185Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:28.8626937Z # embedded in the tag name: ciflow// 2025-09-07T06:09:28.8627361Z 2025-09-07T06:09:28.8627561Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.8627912Z 2025-09-07T06:09:28.8628185Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:28.8628820Z split_tag = ref_name.split("/") 2025-09-07T06:09:28.8629333Z if ( 2025-09-07T06:09:28.8629740Z len(split_tag) == 3 2025-09-07T06:09:28.8630239Z and split_tag[0] == "ciflow" 2025-09-07T06:09:28.8630777Z and split_tag[2].isnumeric() 2025-09-07T06:09:28.8631281Z ): 2025-09-07T06:09:28.8631683Z pr_number = split_tag[2] 2025-09-07T06:09:28.8632178Z try: 2025-09-07T06:09:28.8632773Z repository = gh.get_repo(repo) 2025-09-07T06:09:28.8633512Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:28.8634132Z except Exception as e: 2025-09-07T06:09:28.8634667Z raise Exception( # noqa: TRY002 2025-09-07T06:09:28.8635335Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:28.8635992Z ) from e 2025-09-07T06:09:28.8636541Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:28.8637246Z # In all other cases, return the original input username 2025-09-07T06:09:28.8637840Z return username 2025-09-07T06:09:28.8638095Z 2025-09-07T06:09:28.8638102Z 2025-09-07T06:09:28.8638335Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:28.8638880Z """ 2025-09-07T06:09:28.8639536Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:28.8640333Z """ 2025-09-07T06:09:28.8640890Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:28.8641415Z 2025-09-07T06:09:28.8641422Z 2025-09-07T06:09:28.8641624Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:28.8642124Z try: 2025-09-07T06:09:28.8642530Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:28.8643055Z return data 2025-09-07T06:09:28.8643780Z except yaml.YAMLError: 2025-09-07T06:09:28.8644298Z log.exception("Error loading YAML") 2025-09-07T06:09:28.8644829Z raise 2025-09-07T06:09:28.8645058Z 2025-09-07T06:09:28.8645064Z 2025-09-07T06:09:28.8645490Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:28.8646233Z """ 2025-09-07T06:09:28.8646870Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:28.8647464Z 2025-09-07T06:09:28.8647957Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.8648738Z and the text below is the list of opted in users. 2025-09-07T06:09:28.8649146Z 2025-09-07T06:09:28.8649540Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:28.8650265Z """ 2025-09-07T06:09:28.8650722Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:28.8651331Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:28.8651951Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:28.8652551Z else: 2025-09-07T06:09:28.8652950Z return "", rollout_state 2025-09-07T06:09:28.8653387Z 2025-09-07T06:09:28.8653394Z 2025-09-07T06:09:28.8653610Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:28.8654131Z """ 2025-09-07T06:09:28.8654681Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:28.8655331Z """ 2025-09-07T06:09:28.8655542Z 2025-09-07T06:09:28.8655549Z 2025-09-07T06:09:28.8655899Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:28.8656561Z """ 2025-09-07T06:09:28.8657286Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:28.8657968Z 2025-09-07T06:09:28.8658593Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:28.8659590Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:28.8660455Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:28.8661162Z 2025-09-07T06:09:28.8661169Z 2025-09-07T06:09:28.8661342Z """ 2025-09-07T06:09:28.8661902Z optins = UserOptins() 2025-09-07T06:09:28.8662542Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:28.8663247Z user = user.strip("\r\n\t -") 2025-09-07T06:09:28.8663819Z if not user or not user.startswith("@"): 2025-09-07T06:09:28.8664408Z # Not a valid user. Skip 2025-09-07T06:09:28.8665067Z continue 2025-09-07T06:09:28.8665321Z 2025-09-07T06:09:28.8665493Z if user: 2025-09-07T06:09:28.8665943Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:28.8666645Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:28.8667168Z 2025-09-07T06:09:28.8667342Z return optins 2025-09-07T06:09:28.8667593Z 2025-09-07T06:09:28.8667600Z 2025-09-07T06:09:28.8667901Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:28.8668513Z """ 2025-09-07T06:09:28.8668925Z Check if the experiment name is valid. 2025-09-07T06:09:28.8669459Z A valid name: 2025-09-07T06:09:28.8670110Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:28.8671061Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:28.8671808Z - Cannot contain spaces 2025-09-07T06:09:28.8672303Z """ 2025-09-07T06:09:28.8672514Z 2025-09-07T06:09:28.8672783Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:28.8673623Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:28.8674073Z 2025-09-07T06:09:28.8674244Z if valid: 2025-09-07T06:09:28.8674642Z return True 2025-09-07T06:09:28.8674888Z 2025-09-07T06:09:28.8675059Z log.error( 2025-09-07T06:09:28.8676529Z 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-09-07T06:09:28.8678135Z ) 2025-09-07T06:09:28.8678504Z return False 2025-09-07T06:09:28.8678754Z 2025-09-07T06:09:28.8678760Z 2025-09-07T06:09:28.8679082Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:28.8679723Z """ 2025-09-07T06:09:28.8680446Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:28.8681201Z """ 2025-09-07T06:09:28.8681567Z try: 2025-09-07T06:09:28.8681957Z if settings_text: 2025-09-07T06:09:28.8682694Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:28.8683825Z # for easy reading 2025-09-07T06:09:28.8684638Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:28.8685546Z # the backtick character in shell commands. 2025-09-07T06:09:28.8686177Z backtick = chr(96) # backtick character 2025-09-07T06:09:28.8686859Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:28.8687545Z settings = load_yaml(settings_text) 2025-09-07T06:09:28.8687919Z 2025-09-07T06:09:28.8688340Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:28.8689115Z experiments = {} 2025-09-07T06:09:28.8689417Z 2025-09-07T06:09:28.8689809Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:28.8690580Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:28.8691697Z # 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-09-07T06:09:28.8692788Z continue 2025-09-07T06:09:28.8693574Z 2025-09-07T06:09:28.8693777Z valid_settings = {} 2025-09-07T06:09:28.8694314Z for setting in exp_settings: 2025-09-07T06:09:28.8694900Z if setting not in Experiment._fields: 2025-09-07T06:09:28.8695476Z log.warning( 2025-09-07T06:09:28.8696189Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:28.8696932Z ) 2025-09-07T06:09:28.8697567Z else: 2025-09-07T06:09:28.8698099Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:28.8698525Z 2025-09-07T06:09:28.8698803Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:28.8699479Z return Settings(experiments) 2025-09-07T06:09:28.8699842Z 2025-09-07T06:09:28.8700032Z except Exception: 2025-09-07T06:09:28.8700522Z log.exception("Failed to parse settings") 2025-09-07T06:09:28.8700917Z 2025-09-07T06:09:28.8701099Z return Settings() 2025-09-07T06:09:28.8701366Z 2025-09-07T06:09:28.8701373Z 2025-09-07T06:09:28.8701624Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:28.8702207Z """ 2025-09-07T06:09:28.8702649Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:28.8703061Z 2025-09-07T06:09:28.8703528Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:28.8704319Z and the text below is the list of opted in users. 2025-09-07T06:09:28.8704741Z 2025-09-07T06:09:28.8705152Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:28.8705906Z """ 2025-09-07T06:09:28.8706476Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.8707250Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:28.8707654Z 2025-09-07T06:09:28.8707661Z 2025-09-07T06:09:28.8707920Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:28.8708495Z """ 2025-09-07T06:09:28.8708910Z Parse users from the rollout state. 2025-09-07T06:09:28.8709271Z 2025-09-07T06:09:28.8709442Z """ 2025-09-07T06:09:28.8709999Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:28.8710743Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:28.8711156Z 2025-09-07T06:09:28.8711163Z 2025-09-07T06:09:28.8711708Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.8712479Z """ 2025-09-07T06:09:28.8712905Z Check if a user is opted into an experiment 2025-09-07T06:09:28.8713574Z """ 2025-09-07T06:09:28.8714038Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:28.8714465Z 2025-09-07T06:09:28.8714478Z 2025-09-07T06:09:28.8714899Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:28.8715661Z """ 2025-09-07T06:09:28.8716138Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:28.8716727Z """ 2025-09-07T06:09:28.8717244Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:28.8717948Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:28.8718597Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:28.8719216Z return False 2025-09-07T06:09:28.8719472Z 2025-09-07T06:09:28.8719762Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:28.8720381Z log.warning( 2025-09-07T06:09:28.8721198Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:28.8722106Z ) 2025-09-07T06:09:28.8722320Z 2025-09-07T06:09:28.8722499Z return True 2025-09-07T06:09:28.8722747Z 2025-09-07T06:09:28.8722754Z 2025-09-07T06:09:28.8722936Z def get_runner_prefix( 2025-09-07T06:09:28.8723499Z rollout_state: str, 2025-09-07T06:09:28.8723981Z workflow_requestors: Iterable[str], 2025-09-07T06:09:28.8724514Z branch: str, 2025-09-07T06:09:28.8725012Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.8725680Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:28.8726279Z is_canary: bool = False, 2025-09-07T06:09:28.8726747Z ) -> str: 2025-09-07T06:09:28.8727173Z settings = parse_settings(rollout_state) 2025-09-07T06:09:28.8727901Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:28.8728275Z 2025-09-07T06:09:28.8728466Z fleet_prefix = "" 2025-09-07T06:09:28.8728905Z prefixes = [] 2025-09-07T06:09:28.8729558Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:28.8730499Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:28.8731224Z log.info( 2025-09-07T06:09:28.8731923Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:28.8732689Z ) 2025-09-07T06:09:28.8733194Z continue 2025-09-07T06:09:28.8733456Z 2025-09-07T06:09:28.8733652Z if opt_out_experiments: 2025-09-07T06:09:28.8734193Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:28.8734841Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:28.8735441Z log.info( 2025-09-07T06:09:28.8736379Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:28.8737375Z ) 2025-09-07T06:09:28.8737791Z continue 2025-09-07T06:09:28.8738066Z 2025-09-07T06:09:28.8738257Z if eligible_experiments: 2025-09-07T06:09:28.8738849Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:28.8739490Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:28.8740064Z log.info( 2025-09-07T06:09:28.8740847Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:28.8741698Z ) 2025-09-07T06:09:28.8742108Z continue 2025-09-07T06:09:28.8742586Z elif not experiment_settings.default: 2025-09-07T06:09:28.8743227Z log.info( 2025-09-07T06:09:28.8744019Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:28.8744790Z ) 2025-09-07T06:09:28.8745177Z continue 2025-09-07T06:09:28.8745441Z 2025-09-07T06:09:28.8745723Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:28.8746370Z opted_out_users = [ 2025-09-07T06:09:28.8746840Z requestor 2025-09-07T06:09:28.8747323Z for requestor in workflow_requestors 2025-09-07T06:09:28.8748017Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.8748657Z ] 2025-09-07T06:09:28.8748870Z 2025-09-07T06:09:28.8749052Z if opted_out_users: 2025-09-07T06:09:28.8749521Z log.info( 2025-09-07T06:09:28.8750152Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:28.8750872Z ) 2025-09-07T06:09:28.8751260Z continue 2025-09-07T06:09:28.8751517Z 2025-09-07T06:09:28.8751797Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:28.8752425Z opted_in_users = [ 2025-09-07T06:09:28.8752872Z requestor 2025-09-07T06:09:28.8753454Z for requestor in workflow_requestors 2025-09-07T06:09:28.8754126Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:28.8754760Z ] 2025-09-07T06:09:28.8754970Z 2025-09-07T06:09:28.8755148Z enabled = False 2025-09-07T06:09:28.8755594Z if opted_in_users: 2025-09-07T06:09:28.8756048Z log.info( 2025-09-07T06:09:28.8756656Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:28.8757353Z ) 2025-09-07T06:09:28.8757747Z enabled = True 2025-09-07T06:09:28.8758030Z 2025-09-07T06:09:28.8758257Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:28.8759103Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:28.8760188Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:28.8760848Z log.info( 2025-09-07T06:09:28.8761736Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:28.8762684Z ) 2025-09-07T06:09:28.8763206Z enabled = True 2025-09-07T06:09:28.8763520Z 2025-09-07T06:09:28.8763704Z if enabled: 2025-09-07T06:09:28.8764137Z label = experiment_name 2025-09-07T06:09:28.8764707Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:28.8765545Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:28.8766439Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:28.8767214Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:28.8767891Z if is_canary: 2025-09-07T06:09:28.8768399Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:28.8768957Z fleet_prefix = label 2025-09-07T06:09:28.8769460Z else: 2025-09-07T06:09:28.8769896Z prefixes.append(label) 2025-09-07T06:09:28.8770255Z 2025-09-07T06:09:28.8770449Z if len(prefixes) > 1: 2025-09-07T06:09:28.8770910Z log.error( 2025-09-07T06:09:28.8771956Z 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-09-07T06:09:28.8773201Z ) 2025-09-07T06:09:28.8773606Z prefixes = prefixes[:1] 2025-09-07T06:09:28.8773929Z 2025-09-07T06:09:28.8774123Z # Fleet always comes first 2025-09-07T06:09:28.8774603Z if fleet_prefix: 2025-09-07T06:09:28.8775069Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:28.8775434Z 2025-09-07T06:09:28.8775822Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:28.8776259Z 2025-09-07T06:09:28.8776266Z 2025-09-07T06:09:28.8776712Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:28.8777509Z """ 2025-09-07T06:09:28.8778101Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:28.8778676Z 2025-09-07T06:09:28.8779066Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:28.8779801Z """ 2025-09-07T06:09:28.8780210Z gh = get_gh_client(github_token) 2025-09-07T06:09:28.8780770Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:28.8781425Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:28.8781879Z 2025-09-07T06:09:28.8781886Z 2025-09-07T06:09:28.8782301Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:28.8783071Z for _ in range(num_retries): 2025-09-07T06:09:28.8783683Z try: 2025-09-07T06:09:28.8784120Z req = Request(url=url, headers=headers) 2025-09-07T06:09:28.8784802Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:28.8785462Z return json.loads(content) 2025-09-07T06:09:28.8786007Z except Exception as e: 2025-09-07T06:09:28.8786561Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:28.8786970Z 2025-09-07T06:09:28.8787359Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:28.8788090Z return {} 2025-09-07T06:09:28.8788321Z 2025-09-07T06:09:28.8788329Z 2025-09-07T06:09:28.8788494Z @cache 2025-09-07T06:09:28.8789131Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:28.8789905Z """ 2025-09-07T06:09:28.8790308Z Dynamically get PR information 2025-09-07T06:09:28.8790818Z """ 2025-09-07T06:09:28.8791321Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:28.8792132Z headers = { 2025-09-07T06:09:28.8792598Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:28.8793322Z "Authorization": f"token {github_token}", 2025-09-07T06:09:28.8793876Z } 2025-09-07T06:09:28.8794318Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:28.8794943Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:28.8795507Z headers=headers, 2025-09-07T06:09:28.8795947Z ) 2025-09-07T06:09:28.8796151Z 2025-09-07T06:09:28.8796338Z if not json_response: 2025-09-07T06:09:28.8796916Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:28.8797539Z return {} 2025-09-07T06:09:28.8797785Z 2025-09-07T06:09:28.8797974Z return json_response 2025-09-07T06:09:28.8798257Z 2025-09-07T06:09:28.8798263Z 2025-09-07T06:09:28.8798663Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:28.8799417Z """ 2025-09-07T06:09:28.8799955Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:28.8800614Z """ 2025-09-07T06:09:28.8801117Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:28.8801740Z return { 2025-09-07T06:09:28.8802340Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:28.8803046Z } 2025-09-07T06:09:28.8803365Z 2025-09-07T06:09:28.8803372Z 2025-09-07T06:09:28.8803550Z def main() -> None: 2025-09-07T06:09:28.8803977Z args = parse_args() 2025-09-07T06:09:28.8804258Z 2025-09-07T06:09:28.8804483Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:28.8804875Z 2025-09-07T06:09:28.8805083Z # Check if the PR is opt-out 2025-09-07T06:09:28.8805576Z if args.pr_number: 2025-09-07T06:09:28.8806251Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:28.8807140Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:28.8807664Z log.info( 2025-09-07T06:09:28.8808366Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:28.8809146Z ) 2025-09-07T06:09:28.8809724Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.8810404Z sys.exit() 2025-09-07T06:09:28.8810666Z 2025-09-07T06:09:28.8810840Z try: 2025-09-07T06:09:28.8811285Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:28.8812010Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:28.8812658Z ) 2025-09-07T06:09:28.8812878Z 2025-09-07T06:09:28.8813195Z username = get_potential_pr_author( 2025-09-07T06:09:28.8813756Z args.github_token, 2025-09-07T06:09:28.8814250Z args.github_repo, 2025-09-07T06:09:28.8814742Z args.github_actor, 2025-09-07T06:09:28.8815236Z args.github_ref_type, 2025-09-07T06:09:28.8815766Z args.github_branch, 2025-09-07T06:09:28.8816235Z ) 2025-09-07T06:09:28.8816456Z 2025-09-07T06:09:28.8816745Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:28.8817205Z 2025-09-07T06:09:28.8817429Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:28.8818006Z rollout_state, 2025-09-07T06:09:28.8818500Z (args.github_issue_owner, username), 2025-09-07T06:09:28.8819069Z args.github_branch, 2025-09-07T06:09:28.8819582Z args.eligible_experiments, 2025-09-07T06:09:28.8820126Z args.opt_out_experiments, 2025-09-07T06:09:28.8820646Z is_canary, 2025-09-07T06:09:28.8821065Z ) 2025-09-07T06:09:28.8821281Z 2025-09-07T06:09:28.8821471Z except Exception as e: 2025-09-07T06:09:28.8821930Z log.error( 2025-09-07T06:09:28.8822610Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:28.8823638Z ) 2025-09-07T06:09:28.8823861Z 2025-09-07T06:09:28.8824198Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:28.8824705Z 2025-09-07T06:09:28.8824712Z 2025-09-07T06:09:28.8824907Z if __name__ == "__main__": 2025-09-07T06:09:28.8825355Z main() 2025-09-07T06:09:28.8825576Z 2025-09-07T06:09:28.8920058Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.8920986Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:28.8952042Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:28.8952538Z env: 2025-09-07T06:09:28.8953423Z GITHUB_TOKEN: *** 2025-09-07T06:09:28.8953972Z ISSUE_NUMBER: 5132 2025-09-07T06:09:28.8954447Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:28.8954955Z ISSUE_OWNER: 2025-09-07T06:09:28.8955373Z CHECK_EXPERIMENTS: 2025-09-07T06:09:28.8955818Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:28.8956256Z PR_NUMBER: 2025-09-07T06:09:28.8956651Z ##[endgroup] 2025-09-07T06:09:31.8310636Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:32.8466791Z Collecting urllib3==1.26.18 2025-09-07T06:09:32.8822975Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:32.9049075Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.4 MB/s eta 0:00:00 2025-09-07T06:09:32.9281310Z Collecting PyGithub==2.3.0 2025-09-07T06:09:32.9329903Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:32.9743451Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:32.9778231Z 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-09-07T06:09:32.9824577Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:32.9836263Z 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-09-07T06:09:32.9854831Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:33.0115013Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:33.0147389Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:33.0430260Z 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-09-07T06:09:33.1598211Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:33.1641172Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:33.2878418Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:33.2920974Z 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-09-07T06:09:33.3104199Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:33.3135168Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:33.3367854Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:33.3438054Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.9 MB/s eta 0:00:00 2025-09-07T06:09:33.3484389Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:33.3543588Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 83.6 MB/s eta 0:00:00 2025-09-07T06:09:33.3579954Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:33.3672797Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 112.9 MB/s eta 0:00:00 2025-09-07T06:09:33.3740109Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:33.3829774Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:33.3897937Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 92.2 MB/s eta 0:00:00 2025-09-07T06:09:33.3930409Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:33.3972994Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 28.7 MB/s eta 0:00:00 2025-09-07T06:09:33.4006989Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:33.4049860Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 40.1 MB/s eta 0:00:00 2025-09-07T06:09:33.7814886Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:34.3177754Z 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-09-07T06:09:34.3926323Z ##[group]Run curr_branch="main" 2025-09-07T06:09:34.3926632Z curr_branch="main" 2025-09-07T06:09:34.3926858Z curr_ref_type="branch" 2025-09-07T06:09:34.3927116Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:34.3927390Z  2025-09-07T06:09:34.3927585Z python3 runner_determinator.py \ 2025-09-07T06:09:34.3927863Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:34.3928139Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:34.3928393Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:34.3928667Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:34.3928985Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:34.3929279Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:34.3929558Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:34.3929855Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:34.3930221Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:34.3930517Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:34.3961620Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:34.3961852Z env: 2025-09-07T06:09:34.3962323Z GITHUB_TOKEN: *** 2025-09-07T06:09:34.3962521Z ISSUE_NUMBER: 5132 2025-09-07T06:09:34.3962721Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:34.3962975Z ISSUE_OWNER: 2025-09-07T06:09:34.3963799Z CHECK_EXPERIMENTS: 2025-09-07T06:09:34.3964010Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:34.3964200Z PR_NUMBER: 2025-09-07T06:09:34.3964377Z ##[endgroup] 2025-09-07T06:09:34.4013369Z Current branch is 'main' 2025-09-07T06:09:36.1657006Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-09-07T06:09:36.1658341Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:36.1659102Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:36.1659807Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:36.1660368Z INFO : Setting output: label-type='lf.' 2025-09-07T06:09:36.1972477Z Evaluate and set job outputs 2025-09-07T06:09:36.1978932Z Set output 'label-type' 2025-09-07T06:09:36.1980711Z Cleaning up orphan processes