2025-10-10T00:01:08.2790853Z Current runner version: '2.328.0' 2025-10-10T00:01:08.2822525Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.2823961Z Hosted Compute Agent 2025-10-10T00:01:08.2824930Z Version: 20250912.392 2025-10-10T00:01:08.2826045Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.2827381Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.2828320Z ##[endgroup] 2025-10-10T00:01:08.2829332Z ##[group]Operating System 2025-10-10T00:01:08.2830454Z Ubuntu 2025-10-10T00:01:08.2831244Z 24.04.3 2025-10-10T00:01:08.2832707Z LTS 2025-10-10T00:01:08.2833462Z ##[endgroup] 2025-10-10T00:01:08.2834330Z ##[group]Runner Image 2025-10-10T00:01:08.2835359Z Image: ubuntu-24.04 2025-10-10T00:01:08.2836220Z Version: 20250929.60.1 2025-10-10T00:01:08.2838016Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.2841038Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.2842897Z ##[endgroup] 2025-10-10T00:01:08.2844665Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.2847714Z Contents: read 2025-10-10T00:01:08.2848524Z Metadata: read 2025-10-10T00:01:08.2849324Z ##[endgroup] 2025-10-10T00:01:08.2852538Z Secret source: Actions 2025-10-10T00:01:08.2853930Z Prepare workflow directory 2025-10-10T00:01:08.3593358Z Prepare all required actions 2025-10-10T00:01:08.3676377Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.3684536Z ##[group] Inputs 2025-10-10T00:01:08.3685586Z check_experiments: 2025-10-10T00:01:08.3686639Z opt_out_experiments: 2025-10-10T00:01:08.3687616Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.3688673Z issue_owner: 2025-10-10T00:01:08.3689795Z curr_branch: main 2025-10-10T00:01:08.3690685Z curr_ref_type: branch 2025-10-10T00:01:08.3691875Z issue_number: 5132 2025-10-10T00:01:08.3692748Z ##[endgroup] 2025-10-10T00:01:08.3693913Z Complete job name: before-test / get-label-type / runner-determinator 2025-10-10T00:01:08.8612971Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:08.8615389Z cat < runner_determinator.py 2025-10-10T00:01:08.8616104Z # flake8: noqa: G004 2025-10-10T00:01:08.8616634Z  2025-10-10T00:01:08.8617499Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.8618580Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.8619719Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.8620560Z  2025-10-10T00:01:08.8621004Z """ 2025-10-10T00:01:08.8621730Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.8622824Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.8624053Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.8625082Z of which runners should be used to run which job. 2025-10-10T00:01:08.8625812Z  2025-10-10T00:01:08.8626517Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.8627684Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.8628763Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.8629718Z list, defined. 2025-10-10T00:01:08.8630310Z  2025-10-10T00:01:08.8631014Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.8632118Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.8633180Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.8633908Z  2025-10-10T00:01:08.8634908Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.8635913Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.8636920Z experiments which the user could be opted in to. 2025-10-10T00:01:08.8637623Z  2025-10-10T00:01:08.8709699Z The user list has the following rules: 2025-10-10T00:01:08.8710486Z  2025-10-10T00:01:08.8711100Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.8712068Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.8712930Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.8713517Z  2025-10-10T00:01:08.8713905Z Example config: 2025-10-10T00:01:08.8714441Z  # A list of experiments that can be opted into. 2025-10-10T00:01:08.8715182Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.8715889Z  # Expected syntax is: 2025-10-10T00:01:08.8716620Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.8717672Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.8718471Z  2025-10-10T00:01:08.8718856Z  experiments: 2025-10-10T00:01:08.8719295Z  lf: 2025-10-10T00:01:08.8719847Z  rollout_percent: 25 2025-10-10T00:01:08.8720374Z  all_branches: false 2025-10-10T00:01:08.8720890Z  default: true 2025-10-10T00:01:08.8721360Z  --- 2025-10-10T00:01:08.8721745Z  2025-10-10T00:01:08.8722117Z  # Opt-ins: 2025-10-10T00:01:08.8722782Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.8723962Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.8724837Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.8725570Z  # Experiments should be from the above list. 2025-10-10T00:01:08.8726167Z  2025-10-10T00:01:08.8726566Z  @User1,-lf,split_build 2025-10-10T00:01:08.8727121Z  @User2,lf 2025-10-10T00:01:08.8727577Z  @User3,split_build 2025-10-10T00:01:08.8728054Z """ 2025-10-10T00:01:08.8728440Z  2025-10-10T00:01:08.8728832Z import json 2025-10-10T00:01:08.8729279Z import logging 2025-10-10T00:01:08.8729980Z import os 2025-10-10T00:01:08.8730417Z import random 2025-10-10T00:01:08.8730860Z import re 2025-10-10T00:01:08.8731285Z import sys 2025-10-10T00:01:08.8731771Z from argparse import ArgumentParser 2025-10-10T00:01:08.8732444Z from collections.abc import Iterable 2025-10-10T00:01:08.8733031Z from functools import cache 2025-10-10T00:01:08.8733574Z from logging import LogRecord 2025-10-10T00:01:08.8734137Z from typing import Any, NamedTuple 2025-10-10T00:01:08.8734748Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.8735339Z  2025-10-10T00:01:08.8735732Z import yaml 2025-10-10T00:01:08.8736195Z from github import Auth, Github 2025-10-10T00:01:08.8736761Z from github.Issue import Issue 2025-10-10T00:01:08.8737278Z  2025-10-10T00:01:08.8737648Z  2025-10-10T00:01:08.8738109Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.8738884Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.8739963Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.8740735Z  2025-10-10T00:01:08.8741379Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.8742017Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.8742613Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.8743256Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.8743824Z  2025-10-10T00:01:08.8744253Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.8744800Z  2025-10-10T00:01:08.8745197Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.8745729Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.8746218Z  2025-10-10T00:01:08.8746579Z  2025-10-10T00:01:08.8746986Z class Experiment(NamedTuple): 2025-10-10T00:01:08.8747535Z  rollout_perc: float = ( 2025-10-10T00:01:08.8748270Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.8749006Z  ) 2025-10-10T00:01:08.8749521Z  all_branches: bool = ( 2025-10-10T00:01:08.8750255Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.8750979Z  ) 2025-10-10T00:01:08.8751396Z  default: bool = ( 2025-10-10T00:01:08.8752047Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.8752741Z  ) 2025-10-10T00:01:08.8753129Z  2025-10-10T00:01:08.8753540Z  # Add more fields as needed 2025-10-10T00:01:08.8754064Z  2025-10-10T00:01:08.8754426Z  2025-10-10T00:01:08.8754823Z class Settings(NamedTuple): 2025-10-10T00:01:08.8755337Z  """ 2025-10-10T00:01:08.8755875Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:08.8756504Z  """ 2025-10-10T00:01:08.8756908Z  2025-10-10T00:01:08.8757343Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.8757921Z  2025-10-10T00:01:08.8758410Z  2025-10-10T00:01:08.8758861Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.8759674Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.8760301Z  2025-10-10T00:01:08.8760692Z  COLORS = { 2025-10-10T00:01:08.8761172Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.8761743Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.8762297Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.8762865Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.8763413Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.8763933Z  } 2025-10-10T00:01:08.8764326Z  2025-10-10T00:01:08.8764773Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.8765607Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.8766464Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.8767104Z  return super().format(record) 2025-10-10T00:01:08.8767638Z  2025-10-10T00:01:08.8768007Z  2025-10-10T00:01:08.8768432Z handler = logging.StreamHandler() 2025-10-10T00:01:08.8769222Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.8770160Z  2025-10-10T00:01:08.8770656Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.8771315Z log.addHandler(handler) 2025-10-10T00:01:08.8771837Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.8772339Z  2025-10-10T00:01:08.8772708Z  2025-10-10T00:01:08.8773210Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.8773843Z  """ 2025-10-10T00:01:08.8774418Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.8775243Z  """ 2025-10-10T00:01:08.8775666Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:08.8776835Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.8778041Z  log.warning( 2025-10-10T00:01:08.8779004Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.8780109Z  ) 2025-10-10T00:01:08.8780601Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.8781192Z  return 2025-10-10T00:01:08.8781614Z  2025-10-10T00:01:08.8782042Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.8782667Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.8783296Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:08.8783831Z  2025-10-10T00:01:08.8784200Z  2025-10-10T00:01:08.8784760Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.8785464Z  return frozenset( 2025-10-10T00:01:08.8786165Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.8786890Z  ) 2025-10-10T00:01:08.8787295Z  2025-10-10T00:01:08.8787669Z  2025-10-10T00:01:08.8788063Z def parse_args() -> Any: 2025-10-10T00:01:08.8788716Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.8789818Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.8790663Z  parser.add_argument( 2025-10-10T00:01:08.8791200Z  "--github-issue-repo", 2025-10-10T00:01:08.8791745Z  type=str, 2025-10-10T00:01:08.8792236Z  required=False, 2025-10-10T00:01:08.8792894Z  default="pytorch/test-infra", 2025-10-10T00:01:08.8793520Z  help="GitHub repo to get the issue", 2025-10-10T00:01:08.8794080Z  ) 2025-10-10T00:01:08.8794501Z  parser.add_argument( 2025-10-10T00:01:08.8795007Z  "--github-repo", 2025-10-10T00:01:08.8795522Z  type=str, 2025-10-10T00:01:08.8796005Z  required=True, 2025-10-10T00:01:08.8796563Z  help="GitHub repo where CI is running", 2025-10-10T00:01:08.8797140Z  ) 2025-10-10T00:01:08.8797561Z  parser.add_argument( 2025-10-10T00:01:08.8798261Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.8798971Z  ) 2025-10-10T00:01:08.8799393Z  parser.add_argument( 2025-10-10T00:01:08.8800461Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.8801218Z  ) 2025-10-10T00:01:08.8801640Z  parser.add_argument( 2025-10-10T00:01:08.8802382Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.8803135Z  ) 2025-10-10T00:01:08.8803559Z  parser.add_argument( 2025-10-10T00:01:08.8804322Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.8805081Z  ) 2025-10-10T00:01:08.8805531Z  parser.add_argument( 2025-10-10T00:01:08.8806081Z  "--github-ref-type", 2025-10-10T00:01:08.8806635Z  type=str, 2025-10-10T00:01:08.8807140Z  required=True, 2025-10-10T00:01:08.8807760Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.8808393Z  ) 2025-10-10T00:01:08.8808849Z  parser.add_argument( 2025-10-10T00:01:08.8809805Z  "--eligible-experiments", 2025-10-10T00:01:08.8810445Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8811054Z  required=False, 2025-10-10T00:01:08.8811589Z  default="", 2025-10-10T00:01:08.8812579Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.8813605Z  ) 2025-10-10T00:01:08.8814060Z  parser.add_argument( 2025-10-10T00:01:08.8814623Z  "--opt-out-experiments", 2025-10-10T00:01:08.8815238Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8815840Z  required=False, 2025-10-10T00:01:08.8816371Z  default="", 2025-10-10T00:01:08.8816874Z  help=( 2025-10-10T00:01:08.8817670Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.8818933Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.8819982Z  ), 2025-10-10T00:01:08.8820434Z  ) 2025-10-10T00:01:08.8820892Z  parser.add_argument( 2025-10-10T00:01:08.8821444Z  "--pr-number", 2025-10-10T00:01:08.8821975Z  type=str, 2025-10-10T00:01:08.8822484Z  required=False, 2025-10-10T00:01:08.8823016Z  default="", 2025-10-10T00:01:08.8823619Z  help="the optional PR number where this is run", 2025-10-10T00:01:08.8824263Z  ) 2025-10-10T00:01:08.8824684Z  2025-10-10T00:01:08.8825128Z  return parser.parse_args() 2025-10-10T00:01:08.8825683Z  2025-10-10T00:01:08.8826086Z  2025-10-10T00:01:08.8826770Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8827792Z  auth = Auth.Token(github_token) 2025-10-10T00:01:08.8828422Z  return Github(auth=auth) 2025-10-10T00:01:08.8828969Z  2025-10-10T00:01:08.8829376Z  2025-10-10T00:01:08.8830231Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8831147Z  repo = gh.get_repo(repo) 2025-10-10T00:01:08.8831776Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.8832382Z  2025-10-10T00:01:08.8832789Z  2025-10-10T00:01:08.8833223Z def get_potential_pr_author( 2025-10-10T00:01:08.8833998Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.8834765Z ) -> str: 2025-10-10T00:01:08.8835395Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.8836318Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.8837181Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:08.8837837Z  2025-10-10T00:01:08.8838292Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.8838870Z  2025-10-10T00:01:08.8839553Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.8840293Z  split_tag = ref_name.split("/") 2025-10-10T00:01:08.8840885Z  if ( 2025-10-10T00:01:08.8841368Z  len(split_tag) == 3 2025-10-10T00:01:08.8841967Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:08.8842588Z  and split_tag[2].isnumeric() 2025-10-10T00:01:08.8843173Z  ): 2025-10-10T00:01:08.8843663Z  pr_number = split_tag[2] 2025-10-10T00:01:08.8844241Z  try: 2025-10-10T00:01:08.8844774Z  repository = gh.get_repo(repo) 2025-10-10T00:01:08.8845629Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.8846340Z  except Exception as e: 2025-10-10T00:01:08.8846974Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:08.8847751Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.8848487Z  ) from e 2025-10-10T00:01:08.8849150Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.8850418Z  # In all other cases, return the original input username 2025-10-10T00:01:08.8851105Z  return username 2025-10-10T00:01:08.8851607Z  2025-10-10T00:01:08.8852009Z  2025-10-10T00:01:08.8852501Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.8853123Z  """ 2025-10-10T00:01:08.8853890Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.8854774Z  """ 2025-10-10T00:01:08.8855427Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.8856172Z  2025-10-10T00:01:08.8856567Z  2025-10-10T00:01:08.8857029Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.8857610Z  try: 2025-10-10T00:01:08.8858089Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.8858768Z  return data 2025-10-10T00:01:08.8859553Z  except yaml.YAMLError: 2025-10-10T00:01:08.8860161Z  log.exception("Error loading YAML") 2025-10-10T00:01:08.8860753Z  raise 2025-10-10T00:01:08.8861218Z  2025-10-10T00:01:08.8861611Z  2025-10-10T00:01:08.8862321Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.8863155Z  """ 2025-10-10T00:01:08.8864026Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.8864864Z  2025-10-10T00:01:08.8865483Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8866364Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.8867008Z  2025-10-10T00:01:08.8867661Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.8868453Z  """ 2025-10-10T00:01:08.8869000Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.8869805Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.8870519Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.8871205Z  else: 2025-10-10T00:01:08.8871676Z  return "", rollout_state 2025-10-10T00:01:08.8872229Z  2025-10-10T00:01:08.8872621Z  2025-10-10T00:01:08.8873095Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.8873687Z  """ 2025-10-10T00:01:08.8874307Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.8875037Z  """ 2025-10-10T00:01:08.8875443Z  2025-10-10T00:01:08.8875837Z  2025-10-10T00:01:08.8876444Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.8877193Z  """ 2025-10-10T00:01:08.8878015Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.8878936Z  2025-10-10T00:01:08.8879942Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.8881048Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.8881967Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.8882679Z  2025-10-10T00:01:08.8883080Z  2025-10-10T00:01:08.8883469Z  """ 2025-10-10T00:01:08.8883923Z  optins = UserOptins() 2025-10-10T00:01:08.8884521Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.8885172Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:08.8885824Z  if not user or not user.startswith("@"): 2025-10-10T00:01:08.8886466Z  # Not a valid user. Skip 2025-10-10T00:01:08.8887078Z  continue 2025-10-10T00:01:08.8887564Z  2025-10-10T00:01:08.8887968Z  if user: 2025-10-10T00:01:08.8888505Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.8889299Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.8890128Z  2025-10-10T00:01:08.8890542Z  return optins 2025-10-10T00:01:08.8891029Z  2025-10-10T00:01:08.8891415Z  2025-10-10T00:01:08.8891988Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.8892680Z  """ 2025-10-10T00:01:08.8893173Z  Check if the experiment name is valid. 2025-10-10T00:01:08.8893778Z  A valid name: 2025-10-10T00:01:08.8894537Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.8895583Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.8896380Z  - Cannot contain spaces 2025-10-10T00:01:08.8896920Z  """ 2025-10-10T00:01:08.8897337Z  2025-10-10T00:01:08.8897861Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.8898925Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.8899830Z  2025-10-10T00:01:08.8900252Z  if valid: 2025-10-10T00:01:08.8900721Z  return True 2025-10-10T00:01:08.8901206Z  2025-10-10T00:01:08.8901609Z  log.error( 2025-10-10T00:01:08.8903201Z  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-10-10T00:01:08.8904864Z  ) 2025-10-10T00:01:08.8905291Z  return False 2025-10-10T00:01:08.8905766Z  2025-10-10T00:01:08.8906158Z  2025-10-10T00:01:08.8906737Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.8907444Z  """ 2025-10-10T00:01:08.8908134Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.8908935Z  """ 2025-10-10T00:01:08.8909365Z  try: 2025-10-10T00:01:08.8909922Z  if settings_text: 2025-10-10T00:01:08.8910766Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.8911691Z  # for easy reading 2025-10-10T00:01:08.8912603Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.8913601Z  # the backtick character in shell commands. 2025-10-10T00:01:08.8914306Z  backtick = chr(96) # backtick character 2025-10-10T00:01:08.8915074Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.8915839Z  settings = load_yaml(settings_text) 2025-10-10T00:01:08.8916422Z  2025-10-10T00:01:08.8917096Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.8918057Z  experiments = {} 2025-10-10T00:01:08.8918594Z  2025-10-10T00:01:08.8919235Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.8920199Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.8921425Z  # 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-10-10T00:01:08.8922566Z  continue 2025-10-10T00:01:08.8923094Z  2025-10-10T00:01:08.8923533Z  valid_settings = {} 2025-10-10T00:01:08.8924144Z  for setting in exp_settings: 2025-10-10T00:01:08.8924807Z  if setting not in Experiment._fields: 2025-10-10T00:01:08.8925461Z  log.warning( 2025-10-10T00:01:08.8926278Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.8927108Z  ) 2025-10-10T00:01:08.8927631Z  else: 2025-10-10T00:01:08.8928262Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.8928906Z  2025-10-10T00:01:08.8929544Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.8930279Z  return Settings(experiments) 2025-10-10T00:01:08.8930857Z  2025-10-10T00:01:08.8931279Z  except Exception: 2025-10-10T00:01:08.8931877Z  log.exception("Failed to parse settings") 2025-10-10T00:01:08.8932498Z  2025-10-10T00:01:08.8932916Z  return Settings() 2025-10-10T00:01:08.8933420Z  2025-10-10T00:01:08.8933818Z  2025-10-10T00:01:08.8934468Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.8935126Z  """ 2025-10-10T00:01:08.8935650Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.8936275Z  2025-10-10T00:01:08.8936884Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8937748Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.8938380Z  2025-10-10T00:01:08.8939054Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.8939973Z  """ 2025-10-10T00:01:08.8940626Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8941502Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.8942121Z  2025-10-10T00:01:08.8942512Z  2025-10-10T00:01:08.8943044Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.8943694Z  """ 2025-10-10T00:01:08.8944172Z  Parse users from the rollout state. 2025-10-10T00:01:08.8944754Z  2025-10-10T00:01:08.8945145Z  """ 2025-10-10T00:01:08.8945778Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8946629Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.8947245Z  2025-10-10T00:01:08.8947642Z  2025-10-10T00:01:08.8948339Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8949171Z  """ 2025-10-10T00:01:08.8949780Z  Check if a user is opted into an experiment 2025-10-10T00:01:08.8950398Z  """ 2025-10-10T00:01:08.8950948Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.8951609Z  2025-10-10T00:01:08.8952140Z  2025-10-10T00:01:08.8952851Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8953696Z  """ 2025-10-10T00:01:08.8954247Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.8954908Z  """ 2025-10-10T00:01:08.8955508Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.8956303Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.8957041Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.8957724Z  return False 2025-10-10T00:01:08.8958214Z  2025-10-10T00:01:08.8958743Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.8959535Z  log.warning( 2025-10-10T00:01:08.8960470Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.8961460Z  ) 2025-10-10T00:01:08.8961898Z  2025-10-10T00:01:08.8962306Z  return True 2025-10-10T00:01:08.8962777Z  2025-10-10T00:01:08.8963168Z  2025-10-10T00:01:08.8963595Z def get_runner_prefix( 2025-10-10T00:01:08.8964123Z  rollout_state: str, 2025-10-10T00:01:08.8964695Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:08.8965285Z  branch: str, 2025-10-10T00:01:08.8965905Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8966686Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8967352Z  is_canary: bool = False, 2025-10-10T00:01:08.8967900Z ) -> str: 2025-10-10T00:01:08.8968419Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:08.8969095Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.8969795Z  2025-10-10T00:01:08.8970335Z  fleet_prefix = "" 2025-10-10T00:01:08.8970862Z  prefixes = [] 2025-10-10T00:01:08.8971623Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.8972676Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.8973475Z  log.info( 2025-10-10T00:01:08.8974275Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.8975117Z  ) 2025-10-10T00:01:08.8975610Z  continue 2025-10-10T00:01:08.8976099Z  2025-10-10T00:01:08.8976528Z  if opt_out_experiments: 2025-10-10T00:01:08.8977165Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.8977909Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.8978596Z  log.info( 2025-10-10T00:01:08.8979753Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.8980820Z  ) 2025-10-10T00:01:08.8981320Z  continue 2025-10-10T00:01:08.8981833Z  2025-10-10T00:01:08.8982264Z  if eligible_experiments: 2025-10-10T00:01:08.8982923Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.8983653Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.8984284Z  log.info( 2025-10-10T00:01:08.8985195Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.8986123Z  ) 2025-10-10T00:01:08.8986791Z  continue 2025-10-10T00:01:08.8987382Z  elif not experiment_settings.default: 2025-10-10T00:01:08.8988006Z  log.info( 2025-10-10T00:01:08.8988787Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.8989708Z  ) 2025-10-10T00:01:08.8990175Z  continue 2025-10-10T00:01:08.8990697Z  2025-10-10T00:01:08.8991250Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.8991958Z  opted_out_users = [ 2025-10-10T00:01:08.8992500Z  requestor 2025-10-10T00:01:08.8993067Z  for requestor in workflow_requestors 2025-10-10T00:01:08.8993840Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.8994549Z  ] 2025-10-10T00:01:08.8994987Z  2025-10-10T00:01:08.8995413Z  if opted_out_users: 2025-10-10T00:01:08.8995984Z  log.info( 2025-10-10T00:01:08.8996719Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.8997505Z  ) 2025-10-10T00:01:08.8997972Z  continue 2025-10-10T00:01:08.8998465Z  2025-10-10T00:01:08.8999059Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.8999854Z  opted_in_users = [ 2025-10-10T00:01:08.9000415Z  requestor 2025-10-10T00:01:08.9000981Z  for requestor in workflow_requestors 2025-10-10T00:01:08.9001758Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.9002458Z  ] 2025-10-10T00:01:08.9002901Z  2025-10-10T00:01:08.9003314Z  enabled = False 2025-10-10T00:01:08.9003863Z  if opted_in_users: 2025-10-10T00:01:08.9004532Z  log.info( 2025-10-10T00:01:08.9005258Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.9006025Z  ) 2025-10-10T00:01:08.9006498Z  enabled = True 2025-10-10T00:01:08.9007020Z  2025-10-10T00:01:08.9007489Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.9008421Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.9009571Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.9010306Z  log.info( 2025-10-10T00:01:08.9011301Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.9012312Z  ) 2025-10-10T00:01:08.9012832Z  enabled = True 2025-10-10T00:01:08.9013375Z  2025-10-10T00:01:08.9013788Z  if enabled: 2025-10-10T00:01:08.9014325Z  label = experiment_name 2025-10-10T00:01:08.9014971Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.9015899Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.9016888Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.9017752Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.9018506Z  if is_canary: 2025-10-10T00:01:08.9019097Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.9019836Z  fleet_prefix = label 2025-10-10T00:01:08.9020412Z  else: 2025-10-10T00:01:08.9021089Z  prefixes.append(label) 2025-10-10T00:01:08.9021658Z  2025-10-10T00:01:08.9022086Z  if len(prefixes) > 1: 2025-10-10T00:01:08.9022628Z  log.error( 2025-10-10T00:01:08.9023792Z  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-10-10T00:01:08.9025008Z  ) 2025-10-10T00:01:08.9025486Z  prefixes = prefixes[:1] 2025-10-10T00:01:08.9026040Z  2025-10-10T00:01:08.9026471Z  # Fleet always comes first 2025-10-10T00:01:08.9027078Z  if fleet_prefix: 2025-10-10T00:01:08.9027635Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.9028224Z  2025-10-10T00:01:08.9028745Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.9029390Z  2025-10-10T00:01:08.9029890Z  2025-10-10T00:01:08.9030611Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.9031469Z  """ 2025-10-10T00:01:08.9032150Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.9032935Z  2025-10-10T00:01:08.9033590Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.9034366Z  """ 2025-10-10T00:01:08.9034857Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.9035497Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.9036235Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.9036918Z  2025-10-10T00:01:08.9037318Z  2025-10-10T00:01:08.9037999Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.9038964Z  for _ in range(num_retries): 2025-10-10T00:01:08.9039644Z  try: 2025-10-10T00:01:08.9040171Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:08.9040928Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.9041672Z  return json.loads(content) 2025-10-10T00:01:08.9042276Z  except Exception as e: 2025-10-10T00:01:08.9042937Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.9043560Z  2025-10-10T00:01:08.9044223Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.9045019Z  return {} 2025-10-10T00:01:08.9045484Z  2025-10-10T00:01:08.9045875Z  2025-10-10T00:01:08.9046278Z @cache 2025-10-10T00:01:08.9047009Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.9047862Z  """ 2025-10-10T00:01:08.9048344Z  Dynamically get PR information 2025-10-10T00:01:08.9048907Z  """ 2025-10-10T00:01:08.9049607Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.9050316Z  headers = { 2025-10-10T00:01:08.9050889Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.9051593Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:08.9052195Z  } 2025-10-10T00:01:08.9052712Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.9053414Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.9054033Z  headers=headers, 2025-10-10T00:01:08.9054554Z  ) 2025-10-10T00:01:08.9054970Z  2025-10-10T00:01:08.9055396Z  if not json_response: 2025-10-10T00:01:08.9056094Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.9056946Z  return {} 2025-10-10T00:01:08.9057427Z  2025-10-10T00:01:08.9057849Z  return json_response 2025-10-10T00:01:08.9058370Z  2025-10-10T00:01:08.9058770Z  2025-10-10T00:01:08.9059539Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.9060360Z  """ 2025-10-10T00:01:08.9060985Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.9061731Z  """ 2025-10-10T00:01:08.9062315Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.9063001Z  return { 2025-10-10T00:01:08.9063694Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.9064461Z  } 2025-10-10T00:01:08.9064885Z  2025-10-10T00:01:08.9065284Z  2025-10-10T00:01:08.9065706Z def main() -> None: 2025-10-10T00:01:08.9066218Z  args = parse_args() 2025-10-10T00:01:08.9066725Z  2025-10-10T00:01:08.9067213Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.9067820Z  2025-10-10T00:01:08.9068260Z  # Check if the PR is opt-out 2025-10-10T00:01:08.9068835Z  if args.pr_number: 2025-10-10T00:01:08.9069716Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.9070558Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.9071138Z  log.info( 2025-10-10T00:01:08.9071950Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.9072796Z  ) 2025-10-10T00:01:08.9073537Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.9074311Z  sys.exit() 2025-10-10T00:01:08.9074933Z  2025-10-10T00:01:08.9075338Z  try: 2025-10-10T00:01:08.9075872Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.9076683Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.9077397Z  ) 2025-10-10T00:01:08.9077833Z  2025-10-10T00:01:08.9078296Z  username = get_potential_pr_author( 2025-10-10T00:01:08.9078919Z  args.github_token, 2025-10-10T00:01:08.9079594Z  args.github_repo, 2025-10-10T00:01:08.9080172Z  args.github_actor, 2025-10-10T00:01:08.9080755Z  args.github_ref_type, 2025-10-10T00:01:08.9081374Z  args.github_branch, 2025-10-10T00:01:08.9081928Z  ) 2025-10-10T00:01:08.9082364Z  2025-10-10T00:01:08.9082925Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.9083615Z  2025-10-10T00:01:08.9084096Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.9084722Z  rollout_state, 2025-10-10T00:01:08.9085317Z  (args.github_issue_owner, username), 2025-10-10T00:01:08.9085945Z  args.github_branch, 2025-10-10T00:01:08.9086537Z  args.eligible_experiments, 2025-10-10T00:01:08.9087168Z  args.opt_out_experiments, 2025-10-10T00:01:08.9087752Z  is_canary, 2025-10-10T00:01:08.9088259Z  ) 2025-10-10T00:01:08.9088692Z  2025-10-10T00:01:08.9089119Z  except Exception as e: 2025-10-10T00:01:08.9089762Z  log.error( 2025-10-10T00:01:08.9090565Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.9091541Z  ) 2025-10-10T00:01:08.9091984Z  2025-10-10T00:01:08.9092588Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.9093317Z  2025-10-10T00:01:08.9093716Z  2025-10-10T00:01:08.9094129Z if __name__ == "__main__": 2025-10-10T00:01:08.9094668Z  main() 2025-10-10T00:01:08.9095102Z  2025-10-10T00:01:08.9095501Z EOF 2025-10-10T00:01:08.9095902Z  2025-10-10T00:01:08.9096326Z cat runner_determinator.py 2025-10-10T00:01:09.0322692Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.0323506Z env: 2025-10-10T00:01:09.0324193Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.0324646Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.0325128Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.0325672Z ISSUE_OWNER: 2025-10-10T00:01:09.0326091Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.0326543Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.0326989Z PR_NUMBER: 2025-10-10T00:01:09.0327408Z ##[endgroup] 2025-10-10T00:01:09.0527209Z # flake8: noqa: G004 2025-10-10T00:01:09.0527583Z 2025-10-10T00:01:09.0528019Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:09.0529007Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:09.0530216Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:09.0530696Z 2025-10-10T00:01:09.0530862Z """ 2025-10-10T00:01:09.0531466Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:09.0532383Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:09.0533314Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:09.0534166Z of which runners should be used to run which job. 2025-10-10T00:01:09.0534592Z 2025-10-10T00:01:09.0534983Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:09.0536093Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:09.0537014Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:09.0537737Z list, defined. 2025-10-10T00:01:09.0537991Z 2025-10-10T00:01:09.0538378Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:09.0539340Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:09.0540554Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:09.0541022Z 2025-10-10T00:01:09.0541401Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:09.0542307Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:09.0543107Z experiments which the user could be opted in to. 2025-10-10T00:01:09.0543534Z 2025-10-10T00:01:09.0543736Z The user list has the following rules: 2025-10-10T00:01:09.0544115Z 2025-10-10T00:01:09.0544449Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:09.0545334Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:09.0546125Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:09.0546544Z 2025-10-10T00:01:09.0546727Z Example config: 2025-10-10T00:01:09.0547212Z # A list of experiments that can be opted into. 2025-10-10T00:01:09.0547910Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:09.0548603Z # Expected syntax is: 2025-10-10T00:01:09.0549280Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:09.0550518Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:09.0551164Z 2025-10-10T00:01:09.0551337Z experiments: 2025-10-10T00:01:09.0551767Z lf: 2025-10-10T00:01:09.0552171Z rollout_percent: 25 2025-10-10T00:01:09.0552824Z all_branches: false 2025-10-10T00:01:09.0553303Z default: true 2025-10-10T00:01:09.0553743Z --- 2025-10-10T00:01:09.0553971Z 2025-10-10T00:01:09.0554139Z # Opt-ins: 2025-10-10T00:01:09.0554742Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:09.0555645Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:09.0556447Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:09.0557139Z # Experiments should be from the above list. 2025-10-10T00:01:09.0557546Z 2025-10-10T00:01:09.0557726Z @User1,-lf,split_build 2025-10-10T00:01:09.0558201Z @User2,lf 2025-10-10T00:01:09.0558615Z @User3,split_build 2025-10-10T00:01:09.0559048Z """ 2025-10-10T00:01:09.0559266Z 2025-10-10T00:01:09.0559620Z import json 2025-10-10T00:01:09.0560126Z import logging 2025-10-10T00:01:09.0560541Z import os 2025-10-10T00:01:09.0560937Z import random 2025-10-10T00:01:09.0561353Z import re 2025-10-10T00:01:09.0561755Z import sys 2025-10-10T00:01:09.0562191Z from argparse import ArgumentParser 2025-10-10T00:01:09.0562750Z from collections.abc import Iterable 2025-10-10T00:01:09.0563309Z from functools import cache 2025-10-10T00:01:09.0563813Z from logging import LogRecord 2025-10-10T00:01:09.0564335Z from typing import Any, NamedTuple 2025-10-10T00:01:09.0564890Z from urllib.request import Request, urlopen 2025-10-10T00:01:09.0565287Z 2025-10-10T00:01:09.0565455Z import yaml 2025-10-10T00:01:09.0565877Z from github import Auth, Github 2025-10-10T00:01:09.0566409Z from github.Issue import Issue 2025-10-10T00:01:09.0566737Z 2025-10-10T00:01:09.0566744Z 2025-10-10T00:01:09.0566973Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:09.0567687Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:09.0568589Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:09.0569168Z 2025-10-10T00:01:09.0569404Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:09.0570349Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:09.0570899Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:09.0571491Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:09.0571872Z 2025-10-10T00:01:09.0572077Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:09.0572438Z 2025-10-10T00:01:09.0572630Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:09.0573133Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:09.0573438Z 2025-10-10T00:01:09.0573445Z 2025-10-10T00:01:09.0573636Z class Experiment(NamedTuple): 2025-10-10T00:01:09.0574154Z rollout_perc: float = ( 2025-10-10T00:01:09.0574820Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:09.0575540Z ) 2025-10-10T00:01:09.0575942Z all_branches: bool = ( 2025-10-10T00:01:09.0576602Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:09.0577322Z ) 2025-10-10T00:01:09.0577710Z default: bool = ( 2025-10-10T00:01:09.0578317Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:09.0578987Z ) 2025-10-10T00:01:09.0579208Z 2025-10-10T00:01:09.0579389Z # Add more fields as needed 2025-10-10T00:01:09.0579913Z 2025-10-10T00:01:09.0579921Z 2025-10-10T00:01:09.0580125Z class Settings(NamedTuple): 2025-10-10T00:01:09.0580597Z """ 2025-10-10T00:01:09.0581087Z Settings for the experiments that can be opted into. 2025-10-10T00:01:09.0581688Z """ 2025-10-10T00:01:09.0581907Z 2025-10-10T00:01:09.0582121Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:09.0582502Z 2025-10-10T00:01:09.0582510Z 2025-10-10T00:01:09.0582721Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:09.0583369Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:09.0583833Z 2025-10-10T00:01:09.0584004Z COLORS = { 2025-10-10T00:01:09.0584430Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:09.0585114Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:09.0585755Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:09.0586296Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:09.0586807Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:09.0587306Z } 2025-10-10T00:01:09.0587531Z 2025-10-10T00:01:09.0587750Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:09.0588523Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:09.0589329Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:09.0590151Z return super().format(record) 2025-10-10T00:01:09.0590515Z 2025-10-10T00:01:09.0590524Z 2025-10-10T00:01:09.0590725Z handler = logging.StreamHandler() 2025-10-10T00:01:09.0591449Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:09.0592038Z 2025-10-10T00:01:09.0592285Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:09.0592898Z log.addHandler(handler) 2025-10-10T00:01:09.0593376Z log.setLevel(logging.INFO) 2025-10-10T00:01:09.0593683Z 2025-10-10T00:01:09.0593691Z 2025-10-10T00:01:09.0593947Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:09.0594533Z """ 2025-10-10T00:01:09.0595069Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:09.0595731Z """ 2025-10-10T00:01:09.0596134Z if not GITHUB_OUTPUT: 2025-10-10T00:01:09.0597228Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:09.0598378Z log.warning( 2025-10-10T00:01:09.0599267Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:09.0600436Z ) 2025-10-10T00:01:09.0610324Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:09.0610966Z return 2025-10-10T00:01:09.0611247Z 2025-10-10T00:01:09.0611627Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:09.0612256Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:09.0612872Z f.write(f"{key}={value}\n") 2025-10-10T00:01:09.0613219Z 2025-10-10T00:01:09.0613227Z 2025-10-10T00:01:09.0613534Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:09.0614190Z return frozenset( 2025-10-10T00:01:09.0614833Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:09.0615543Z ) 2025-10-10T00:01:09.0615772Z 2025-10-10T00:01:09.0615780Z 2025-10-10T00:01:09.0615964Z def parse_args() -> Any: 2025-10-10T00:01:09.0616542Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:09.0617432Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:09.0618243Z parser.add_argument( 2025-10-10T00:01:09.0618727Z "--github-issue-repo", 2025-10-10T00:01:09.0619223Z type=str, 2025-10-10T00:01:09.0619925Z required=False, 2025-10-10T00:01:09.0620426Z default="pytorch/test-infra", 2025-10-10T00:01:09.0620996Z help="GitHub repo to get the issue", 2025-10-10T00:01:09.0621535Z ) 2025-10-10T00:01:09.0670507Z parser.add_argument( 2025-10-10T00:01:09.0671109Z "--github-repo", 2025-10-10T00:01:09.0671581Z type=str, 2025-10-10T00:01:09.0672013Z required=True, 2025-10-10T00:01:09.0672503Z help="GitHub repo where CI is running", 2025-10-10T00:01:09.0673063Z ) 2025-10-10T00:01:09.0673456Z parser.add_argument( 2025-10-10T00:01:09.0674109Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:09.0674797Z ) 2025-10-10T00:01:09.0675195Z parser.add_argument( 2025-10-10T00:01:09.0675830Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:09.0676537Z ) 2025-10-10T00:01:09.0676932Z parser.add_argument( 2025-10-10T00:01:09.0677817Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:09.0678551Z ) 2025-10-10T00:01:09.0678955Z parser.add_argument( 2025-10-10T00:01:09.0679768Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:09.0680518Z ) 2025-10-10T00:01:09.0680923Z parser.add_argument( 2025-10-10T00:01:09.0681403Z "--github-ref-type", 2025-10-10T00:01:09.0681887Z type=str, 2025-10-10T00:01:09.0682312Z required=True, 2025-10-10T00:01:09.0682836Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:09.0683418Z ) 2025-10-10T00:01:09.0683818Z parser.add_argument( 2025-10-10T00:01:09.0684301Z "--eligible-experiments", 2025-10-10T00:01:09.0684853Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.0685405Z required=False, 2025-10-10T00:01:09.0685843Z default="", 2025-10-10T00:01:09.0686731Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:09.0687693Z ) 2025-10-10T00:01:09.0688093Z parser.add_argument( 2025-10-10T00:01:09.0688575Z "--opt-out-experiments", 2025-10-10T00:01:09.0689111Z type=_str_comma_separated_to_set, 2025-10-10T00:01:09.0689995Z required=False, 2025-10-10T00:01:09.0690479Z default="", 2025-10-10T00:01:09.0690903Z help=( 2025-10-10T00:01:09.0691608Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:09.0692771Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:09.0693630Z ), 2025-10-10T00:01:09.0694010Z ) 2025-10-10T00:01:09.0694399Z parser.add_argument( 2025-10-10T00:01:09.0694860Z "--pr-number", 2025-10-10T00:01:09.0695294Z type=str, 2025-10-10T00:01:09.0695729Z required=False, 2025-10-10T00:01:09.0696182Z default="", 2025-10-10T00:01:09.0696831Z help="the optional PR number where this is run", 2025-10-10T00:01:09.0697431Z ) 2025-10-10T00:01:09.0697653Z 2025-10-10T00:01:09.0697849Z return parser.parse_args() 2025-10-10T00:01:09.0698186Z 2025-10-10T00:01:09.0698193Z 2025-10-10T00:01:09.0698708Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.0699635Z auth = Auth.Token(github_token) 2025-10-10T00:01:09.0700179Z return Github(auth=auth) 2025-10-10T00:01:09.0700614Z 2025-10-10T00:01:09.0700628Z 2025-10-10T00:01:09.0701231Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:09.0702087Z repo = gh.get_repo(repo) 2025-10-10T00:01:09.0702614Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:09.0703003Z 2025-10-10T00:01:09.0703010Z 2025-10-10T00:01:09.0703199Z def get_potential_pr_author( 2025-10-10T00:01:09.0703888Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:09.0704582Z ) -> str: 2025-10-10T00:01:09.0705122Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:09.0705949Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:09.0706711Z # embedded in the tag name: ciflow// 2025-10-10T00:01:09.0707149Z 2025-10-10T00:01:09.0707345Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.0707697Z 2025-10-10T00:01:09.0707963Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:09.0708613Z split_tag = ref_name.split("/") 2025-10-10T00:01:09.0709138Z if ( 2025-10-10T00:01:09.0709698Z len(split_tag) == 3 2025-10-10T00:01:09.0710211Z and split_tag[0] == "ciflow" 2025-10-10T00:01:09.0710769Z and split_tag[2].isnumeric() 2025-10-10T00:01:09.0711289Z ): 2025-10-10T00:01:09.0711693Z pr_number = split_tag[2] 2025-10-10T00:01:09.0712370Z try: 2025-10-10T00:01:09.0712812Z repository = gh.get_repo(repo) 2025-10-10T00:01:09.0713451Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:09.0714069Z except Exception as e: 2025-10-10T00:01:09.0714607Z raise Exception( # noqa: TRY002 2025-10-10T00:01:09.0715296Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:09.0715960Z ) from e 2025-10-10T00:01:09.0716523Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:09.0717231Z # In all other cases, return the original input username 2025-10-10T00:01:09.0717845Z return username 2025-10-10T00:01:09.0718114Z 2025-10-10T00:01:09.0718121Z 2025-10-10T00:01:09.0718344Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:09.0718901Z """ 2025-10-10T00:01:09.0719676Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:09.0720492Z """ 2025-10-10T00:01:09.0721068Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:09.0721611Z 2025-10-10T00:01:09.0721618Z 2025-10-10T00:01:09.0721812Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:09.0722341Z try: 2025-10-10T00:01:09.0722755Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:09.0723286Z return data 2025-10-10T00:01:09.0723721Z except yaml.YAMLError: 2025-10-10T00:01:09.0724231Z log.exception("Error loading YAML") 2025-10-10T00:01:09.0724764Z raise 2025-10-10T00:01:09.0725017Z 2025-10-10T00:01:09.0725024Z 2025-10-10T00:01:09.0725448Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:09.0726213Z """ 2025-10-10T00:01:09.0726850Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:09.0727487Z 2025-10-10T00:01:09.0727969Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.0728756Z and the text below is the list of opted in users. 2025-10-10T00:01:09.0729190Z 2025-10-10T00:01:09.0729675Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:09.0730409Z """ 2025-10-10T00:01:09.0730874Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:09.0731530Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:09.0732178Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:09.0732819Z else: 2025-10-10T00:01:09.0733248Z return "", rollout_state 2025-10-10T00:01:09.0733596Z 2025-10-10T00:01:09.0733605Z 2025-10-10T00:01:09.0733822Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:09.0734367Z """ 2025-10-10T00:01:09.0734933Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:09.0735631Z """ 2025-10-10T00:01:09.0735863Z 2025-10-10T00:01:09.0735871Z 2025-10-10T00:01:09.0736224Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:09.0736932Z """ 2025-10-10T00:01:09.0737685Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:09.0738411Z 2025-10-10T00:01:09.0739044Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:09.0740249Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:09.0740975Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:09.0741484Z 2025-10-10T00:01:09.0741492Z 2025-10-10T00:01:09.0741671Z """ 2025-10-10T00:01:09.0742096Z optins = UserOptins() 2025-10-10T00:01:09.0742647Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:09.0743281Z user = user.strip("\r\n\t -") 2025-10-10T00:01:09.0743886Z if not user or not user.startswith("@"): 2025-10-10T00:01:09.0744641Z # Not a valid user. Skip 2025-10-10T00:01:09.0745479Z continue 2025-10-10T00:01:09.0745939Z 2025-10-10T00:01:09.0746137Z if user: 2025-10-10T00:01:09.0746621Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:09.0747370Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:09.0747901Z 2025-10-10T00:01:09.0748083Z return optins 2025-10-10T00:01:09.0748358Z 2025-10-10T00:01:09.0748365Z 2025-10-10T00:01:09.0748664Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:09.0749318Z """ 2025-10-10T00:01:09.0749879Z Check if the experiment name is valid. 2025-10-10T00:01:09.0750450Z A valid name: 2025-10-10T00:01:09.0751130Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:09.0752143Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:09.0752934Z - Cannot contain spaces 2025-10-10T00:01:09.0753444Z """ 2025-10-10T00:01:09.0753678Z 2025-10-10T00:01:09.0753954Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:09.0754697Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:09.0755180Z 2025-10-10T00:01:09.0755360Z if valid: 2025-10-10T00:01:09.0755780Z return True 2025-10-10T00:01:09.0756052Z 2025-10-10T00:01:09.0756236Z log.error( 2025-10-10T00:01:09.0757741Z 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-10-10T00:01:09.0759512Z ) 2025-10-10T00:01:09.0759923Z return False 2025-10-10T00:01:09.0760189Z 2025-10-10T00:01:09.0760196Z 2025-10-10T00:01:09.0760517Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:09.0761190Z """ 2025-10-10T00:01:09.0761971Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:09.0762774Z """ 2025-10-10T00:01:09.0763165Z try: 2025-10-10T00:01:09.0763589Z if settings_text: 2025-10-10T00:01:09.0764375Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:09.0765233Z # for easy reading 2025-10-10T00:01:09.0766078Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:09.0767028Z # the backtick character in shell commands. 2025-10-10T00:01:09.0767697Z backtick = chr(96) # backtick character 2025-10-10T00:01:09.0768421Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:09.0769158Z settings = load_yaml(settings_text) 2025-10-10T00:01:09.0769678Z 2025-10-10T00:01:09.0770126Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:09.0770945Z experiments = {} 2025-10-10T00:01:09.0771285Z 2025-10-10T00:01:09.0771684Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:09.0772498Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:09.0773666Z # 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-10-10T00:01:09.0774775Z continue 2025-10-10T00:01:09.0775094Z 2025-10-10T00:01:09.0775292Z valid_settings = {} 2025-10-10T00:01:09.0775860Z for setting in exp_settings: 2025-10-10T00:01:09.0776486Z if setting not in Experiment._fields: 2025-10-10T00:01:09.0777089Z log.warning( 2025-10-10T00:01:09.0777843Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:09.0778760Z ) 2025-10-10T00:01:09.0779241Z else: 2025-10-10T00:01:09.0779960Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:09.0780417Z 2025-10-10T00:01:09.0780715Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:09.0781395Z return Settings(experiments) 2025-10-10T00:01:09.0781793Z 2025-10-10T00:01:09.0781982Z except Exception: 2025-10-10T00:01:09.0782501Z log.exception("Failed to parse settings") 2025-10-10T00:01:09.0782927Z 2025-10-10T00:01:09.0783114Z return Settings() 2025-10-10T00:01:09.0783397Z 2025-10-10T00:01:09.0783404Z 2025-10-10T00:01:09.0783667Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:09.0784273Z """ 2025-10-10T00:01:09.0784758Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:09.0785196Z 2025-10-10T00:01:09.0785564Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:09.0786403Z and the text below is the list of opted in users. 2025-10-10T00:01:09.0786842Z 2025-10-10T00:01:09.0787269Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:09.0788061Z """ 2025-10-10T00:01:09.0788663Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.0789577Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:09.0790019Z 2025-10-10T00:01:09.0790032Z 2025-10-10T00:01:09.0790294Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:09.0790900Z """ 2025-10-10T00:01:09.0791349Z Parse users from the rollout state. 2025-10-10T00:01:09.0791728Z 2025-10-10T00:01:09.0791899Z """ 2025-10-10T00:01:09.0792477Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:09.0793280Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:09.0793721Z 2025-10-10T00:01:09.0793728Z 2025-10-10T00:01:09.0794285Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.0795097Z """ 2025-10-10T00:01:09.0795552Z Check if a user is opted into an experiment 2025-10-10T00:01:09.0796144Z """ 2025-10-10T00:01:09.0796655Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:09.0797118Z 2025-10-10T00:01:09.0797125Z 2025-10-10T00:01:09.0797566Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:09.0798377Z """ 2025-10-10T00:01:09.0798891Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:09.0799641Z """ 2025-10-10T00:01:09.0800199Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:09.0800951Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:09.0801644Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:09.0802315Z return False 2025-10-10T00:01:09.0802604Z 2025-10-10T00:01:09.0802909Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:09.0803572Z log.warning( 2025-10-10T00:01:09.0804444Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:09.0805394Z ) 2025-10-10T00:01:09.0805642Z 2025-10-10T00:01:09.0805831Z return True 2025-10-10T00:01:09.0806100Z 2025-10-10T00:01:09.0806107Z 2025-10-10T00:01:09.0806313Z def get_runner_prefix( 2025-10-10T00:01:09.0806801Z rollout_state: str, 2025-10-10T00:01:09.0807326Z workflow_requestors: Iterable[str], 2025-10-10T00:01:09.0807903Z branch: str, 2025-10-10T00:01:09.0808454Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.0809174Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:09.0809937Z is_canary: bool = False, 2025-10-10T00:01:09.0810445Z ) -> str: 2025-10-10T00:01:09.0811056Z settings = parse_settings(rollout_state) 2025-10-10T00:01:09.0811698Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:09.0812112Z 2025-10-10T00:01:09.0812308Z fleet_prefix = "" 2025-10-10T00:01:09.0812792Z prefixes = [] 2025-10-10T00:01:09.0813472Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:09.0814470Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:09.0815247Z log.info( 2025-10-10T00:01:09.0815987Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:09.0816812Z ) 2025-10-10T00:01:09.0817253Z continue 2025-10-10T00:01:09.0817539Z 2025-10-10T00:01:09.0817755Z if opt_out_experiments: 2025-10-10T00:01:09.0818346Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:09.0819048Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:09.0819867Z log.info( 2025-10-10T00:01:09.0820869Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:09.0821912Z ) 2025-10-10T00:01:09.0822373Z continue 2025-10-10T00:01:09.0822677Z 2025-10-10T00:01:09.0822883Z if eligible_experiments: 2025-10-10T00:01:09.0823535Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:09.0824238Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:09.0824854Z log.info( 2025-10-10T00:01:09.0825700Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:09.0826603Z ) 2025-10-10T00:01:09.0827063Z continue 2025-10-10T00:01:09.0827596Z elif not experiment_settings.default: 2025-10-10T00:01:09.0828200Z log.info( 2025-10-10T00:01:09.0829052Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:09.0829975Z ) 2025-10-10T00:01:09.0830418Z continue 2025-10-10T00:01:09.0830703Z 2025-10-10T00:01:09.0831003Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:09.0831681Z opted_out_users = [ 2025-10-10T00:01:09.0832187Z requestor 2025-10-10T00:01:09.0832707Z for requestor in workflow_requestors 2025-10-10T00:01:09.0833433Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.0834126Z ] 2025-10-10T00:01:09.0834373Z 2025-10-10T00:01:09.0834580Z if opted_out_users: 2025-10-10T00:01:09.0835080Z log.info( 2025-10-10T00:01:09.0835759Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:09.0836522Z ) 2025-10-10T00:01:09.0836958Z continue 2025-10-10T00:01:09.0837244Z 2025-10-10T00:01:09.0837551Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:09.0838238Z opted_in_users = [ 2025-10-10T00:01:09.0838743Z requestor 2025-10-10T00:01:09.0839257Z for requestor in workflow_requestors 2025-10-10T00:01:09.0840092Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:09.0840774Z ] 2025-10-10T00:01:09.0841013Z 2025-10-10T00:01:09.0841209Z enabled = False 2025-10-10T00:01:09.0841699Z if opted_in_users: 2025-10-10T00:01:09.0842192Z log.info( 2025-10-10T00:01:09.0842855Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:09.0843633Z ) 2025-10-10T00:01:09.0844073Z enabled = True 2025-10-10T00:01:09.0844394Z 2025-10-10T00:01:09.0844632Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:09.0845539Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:09.0846679Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:09.0847395Z log.info( 2025-10-10T00:01:09.0848325Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:09.0849314Z ) 2025-10-10T00:01:09.0849882Z enabled = True 2025-10-10T00:01:09.0850226Z 2025-10-10T00:01:09.0850414Z if enabled: 2025-10-10T00:01:09.0850899Z label = experiment_name 2025-10-10T00:01:09.0851510Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:09.0852408Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:09.0853348Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:09.0854182Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:09.0854908Z if is_canary: 2025-10-10T00:01:09.0855465Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:09.0856075Z fleet_prefix = label 2025-10-10T00:01:09.0856624Z else: 2025-10-10T00:01:09.0857107Z prefixes.append(label) 2025-10-10T00:01:09.0857494Z 2025-10-10T00:01:09.0857694Z if len(prefixes) > 1: 2025-10-10T00:01:09.0858193Z log.error( 2025-10-10T00:01:09.0859287Z 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-10-10T00:01:09.0860625Z ) 2025-10-10T00:01:09.0861080Z prefixes = prefixes[:1] 2025-10-10T00:01:09.0861427Z 2025-10-10T00:01:09.0861639Z # Fleet always comes first 2025-10-10T00:01:09.0862176Z if fleet_prefix: 2025-10-10T00:01:09.0862680Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:09.0863081Z 2025-10-10T00:01:09.0863491Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:09.0863949Z 2025-10-10T00:01:09.0863956Z 2025-10-10T00:01:09.0864427Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:09.0865266Z """ 2025-10-10T00:01:09.0865914Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:09.0866518Z 2025-10-10T00:01:09.0866924Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:09.0867695Z """ 2025-10-10T00:01:09.0868138Z gh = get_gh_client(github_token) 2025-10-10T00:01:09.0868742Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:09.0869848Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:09.0870372Z 2025-10-10T00:01:09.0870379Z 2025-10-10T00:01:09.0870803Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:09.0871639Z for _ in range(num_retries): 2025-10-10T00:01:09.0872178Z try: 2025-10-10T00:01:09.0872671Z req = Request(url=url, headers=headers) 2025-10-10T00:01:09.0873403Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:09.0874133Z return json.loads(content) 2025-10-10T00:01:09.0874730Z except Exception as e: 2025-10-10T00:01:09.0875334Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:09.0875768Z 2025-10-10T00:01:09.0876173Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:09.0876944Z return {} 2025-10-10T00:01:09.0877199Z 2025-10-10T00:01:09.0877206Z 2025-10-10T00:01:09.0877390Z @cache 2025-10-10T00:01:09.0878066Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:09.0878884Z """ 2025-10-10T00:01:09.0879330Z Dynamically get PR information 2025-10-10T00:01:09.0880161Z """ 2025-10-10T00:01:09.0880722Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:09.0881411Z headers = { 2025-10-10T00:01:09.0881948Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:09.0882623Z "Authorization": f"token {github_token}", 2025-10-10T00:01:09.0883220Z } 2025-10-10T00:01:09.0883696Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:09.0884366Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:09.0884972Z headers=headers, 2025-10-10T00:01:09.0885461Z ) 2025-10-10T00:01:09.0885698Z 2025-10-10T00:01:09.0885903Z if not json_response: 2025-10-10T00:01:09.0886526Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:09.0887202Z return {} 2025-10-10T00:01:09.0887472Z 2025-10-10T00:01:09.0887669Z return json_response 2025-10-10T00:01:09.0887984Z 2025-10-10T00:01:09.0887991Z 2025-10-10T00:01:09.0888419Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:09.0889217Z """ 2025-10-10T00:01:09.0889907Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:09.0890621Z """ 2025-10-10T00:01:09.0891159Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:09.0891833Z return { 2025-10-10T00:01:09.0892474Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:09.0893238Z } 2025-10-10T00:01:09.0893480Z 2025-10-10T00:01:09.0893487Z 2025-10-10T00:01:09.0893679Z def main() -> None: 2025-10-10T00:01:09.0894154Z args = parse_args() 2025-10-10T00:01:09.0894457Z 2025-10-10T00:01:09.0894701Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:09.0895128Z 2025-10-10T00:01:09.0895340Z # Check if the PR is opt-out 2025-10-10T00:01:09.0895881Z if args.pr_number: 2025-10-10T00:01:09.0896589Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:09.0897526Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:09.0898091Z log.info( 2025-10-10T00:01:09.0898831Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:09.0899766Z ) 2025-10-10T00:01:09.0900380Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.0901110Z sys.exit() 2025-10-10T00:01:09.0901413Z 2025-10-10T00:01:09.0901596Z try: 2025-10-10T00:01:09.0902090Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:09.0902855Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:09.0903558Z ) 2025-10-10T00:01:09.0903799Z 2025-10-10T00:01:09.0904025Z username = get_potential_pr_author( 2025-10-10T00:01:09.0904633Z args.github_token, 2025-10-10T00:01:09.0905162Z args.github_repo, 2025-10-10T00:01:09.0905697Z args.github_actor, 2025-10-10T00:01:09.0906238Z args.github_ref_type, 2025-10-10T00:01:09.0906800Z args.github_branch, 2025-10-10T00:01:09.0907323Z ) 2025-10-10T00:01:09.0907567Z 2025-10-10T00:01:09.0907875Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:09.0908365Z 2025-10-10T00:01:09.0908609Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:09.0909215Z rollout_state, 2025-10-10T00:01:09.0909854Z (args.github_issue_owner, username), 2025-10-10T00:01:09.0910457Z args.github_branch, 2025-10-10T00:01:09.0911015Z args.eligible_experiments, 2025-10-10T00:01:09.0911603Z args.opt_out_experiments, 2025-10-10T00:01:09.0912171Z is_canary, 2025-10-10T00:01:09.0912644Z ) 2025-10-10T00:01:09.0912882Z 2025-10-10T00:01:09.0913088Z except Exception as e: 2025-10-10T00:01:09.0913599Z log.error( 2025-10-10T00:01:09.0914320Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:09.0915314Z ) 2025-10-10T00:01:09.0915552Z 2025-10-10T00:01:09.0915909Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:09.0916448Z 2025-10-10T00:01:09.0916455Z 2025-10-10T00:01:09.0916657Z if __name__ == "__main__": 2025-10-10T00:01:09.0917148Z main() 2025-10-10T00:01:09.0917391Z 2025-10-10T00:01:09.1005355Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.1006255Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:09.1037098Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:09.1037571Z env: 2025-10-10T00:01:09.1038170Z GITHUB_TOKEN: *** 2025-10-10T00:01:09.1038583Z ISSUE_NUMBER: 5132 2025-10-10T00:01:09.1039028Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:09.1039730Z ISSUE_OWNER: 2025-10-10T00:01:09.1040155Z CHECK_EXPERIMENTS: 2025-10-10T00:01:09.1040595Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:09.1041036Z PR_NUMBER: 2025-10-10T00:01:09.1041419Z ##[endgroup] 2025-10-10T00:01:12.5385503Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:13.9817483Z Collecting urllib3==1.26.18 2025-10-10T00:01:14.0334483Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:14.0548194Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.7 MB/s eta 0:00:00 2025-10-10T00:01:14.0787759Z Collecting PyGithub==2.3.0 2025-10-10T00:01:14.0841777Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:14.1267289Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:14.1310575Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:14.1355227Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:14.1371291Z 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-10-10T00:01:14.1385450Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:14.1624101Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:14.1661312Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:14.1884599Z 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-10-10T00:01:14.3105818Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:14.3151256Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:14.4462680Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:14.4525510Z 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-10-10T00:01:14.4719365Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:14.4760090Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:14.4998807Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:14.5116766Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.5 MB/s eta 0:00:00 2025-10-10T00:01:14.5190238Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:14.5306641Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 34.5 MB/s eta 0:00:00 2025-10-10T00:01:14.5344203Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:14.5632090Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 51.2 MB/s eta 0:00:00 2025-10-10T00:01:14.5680899Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:14.5810723Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:14.5870044Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 50.6 MB/s eta 0:00:00 2025-10-10T00:01:14.5916260Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:14.5955995Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 34.9 MB/s eta 0:00:00 2025-10-10T00:01:14.6006938Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:14.6046860Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 46.8 MB/s eta 0:00:00 2025-10-10T00:01:14.9674965Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:15.4956183Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:15.5708050Z ##[group]Run curr_branch="main" 2025-10-10T00:01:15.5708353Z curr_branch="main" 2025-10-10T00:01:15.5708572Z curr_ref_type="branch" 2025-10-10T00:01:15.5708824Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:15.5709101Z  2025-10-10T00:01:15.5709282Z python3 runner_determinator.py \ 2025-10-10T00:01:15.5709809Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:15.5710078Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:15.5710329Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:15.5710583Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:15.5710866Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:15.5711143Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:15.5711405Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:15.5711704Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:15.5712058Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:15.5712339Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:15.5745981Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:15.5746208Z env: 2025-10-10T00:01:15.5746671Z GITHUB_TOKEN: *** 2025-10-10T00:01:15.5746852Z ISSUE_NUMBER: 5132 2025-10-10T00:01:15.5747051Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:15.5747280Z ISSUE_OWNER: 2025-10-10T00:01:15.5747455Z CHECK_EXPERIMENTS: 2025-10-10T00:01:15.5747639Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:15.5747817Z PR_NUMBER: 2025-10-10T00:01:15.5747977Z ##[endgroup] 2025-10-10T00:01:15.5798220Z Current branch is 'main' 2025-10-10T00:01:17.9447404Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-10-10T00:01:17.9448480Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:17.9449836Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:17.9450716Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:17.9451415Z INFO : Setting output: label-type='lf.' 2025-10-10T00:01:17.9750959Z Evaluate and set job outputs 2025-10-10T00:01:17.9757060Z Set output 'label-type' 2025-10-10T00:01:17.9758831Z Cleaning up orphan processes