2025-11-03T15:43:04.6452127Z Current runner version: '2.329.0' 2025-11-03T15:43:04.6474757Z ##[group]Runner Image Provisioner 2025-11-03T15:43:04.6475626Z Hosted Compute Agent 2025-11-03T15:43:04.6476134Z Version: 20251016.436 2025-11-03T15:43:04.6476717Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:04.6477516Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:04.6478086Z ##[endgroup] 2025-11-03T15:43:04.6478620Z ##[group]Operating System 2025-11-03T15:43:04.6479215Z Ubuntu 2025-11-03T15:43:04.6479689Z 24.04.3 2025-11-03T15:43:04.6480112Z LTS 2025-11-03T15:43:04.6480603Z ##[endgroup] 2025-11-03T15:43:04.6481048Z ##[group]Runner Image 2025-11-03T15:43:04.6481607Z Image: ubuntu-24.04 2025-11-03T15:43:04.6482152Z Version: 20251030.96.2 2025-11-03T15:43:04.6483306Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:04.6484785Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:04.6485800Z ##[endgroup] 2025-11-03T15:43:04.6488185Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:04.6490477Z Actions: read 2025-11-03T15:43:04.6490987Z Attestations: read 2025-11-03T15:43:04.6491573Z Checks: read 2025-11-03T15:43:04.6492043Z Contents: read 2025-11-03T15:43:04.6492807Z Deployments: read 2025-11-03T15:43:04.6493858Z Discussions: read 2025-11-03T15:43:04.6494366Z Issues: read 2025-11-03T15:43:04.6494838Z Metadata: read 2025-11-03T15:43:04.6495261Z Models: read 2025-11-03T15:43:04.6495868Z Packages: read 2025-11-03T15:43:04.6496324Z Pages: read 2025-11-03T15:43:04.6496822Z PullRequests: read 2025-11-03T15:43:04.6497371Z RepositoryProjects: read 2025-11-03T15:43:04.6497927Z SecurityEvents: read 2025-11-03T15:43:04.6498535Z Statuses: read 2025-11-03T15:43:04.6499061Z ##[endgroup] 2025-11-03T15:43:04.6501848Z Secret source: Actions 2025-11-03T15:43:04.6503013Z Prepare workflow directory 2025-11-03T15:43:04.7005872Z Prepare all required actions 2025-11-03T15:43:04.7061939Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:04.7066997Z ##[group] Inputs 2025-11-03T15:43:04.7067584Z check_experiments: 2025-11-03T15:43:04.7068178Z opt_out_experiments: 2025-11-03T15:43:04.7068695Z triggering_actor: pytorchmergebot 2025-11-03T15:43:04.7069370Z issue_owner: 2025-11-03T15:43:04.7069886Z curr_branch: main 2025-11-03T15:43:04.7070396Z curr_ref_type: branch 2025-11-03T15:43:04.7070948Z issue_number: 5132 2025-11-03T15:43:04.7071460Z ##[endgroup] 2025-11-03T15:43:04.7072076Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:04.7651022Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:04.7653631Z cat < runner_determinator.py 2025-11-03T15:43:04.7654408Z # flake8: noqa: G004 2025-11-03T15:43:04.7654979Z  2025-11-03T15:43:04.7655735Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:04.7656834Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:04.7657743Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:04.7658475Z  2025-11-03T15:43:04.7658902Z """ 2025-11-03T15:43:04.7659609Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:04.7660643Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:04.7661786Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:04.7662962Z of which runners should be used to run which job. 2025-11-03T15:43:04.7663729Z  2025-11-03T15:43:04.7664379Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:04.7665381Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:04.7666682Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:04.7667490Z list, defined. 2025-11-03T15:43:04.7667979Z  2025-11-03T15:43:04.7668820Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:04.7669867Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:04.7670879Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:04.7671569Z  2025-11-03T15:43:04.7672269Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:04.7673349Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:04.7674296Z experiments which the user could be opted in to. 2025-11-03T15:43:04.7674959Z  2025-11-03T15:43:04.7675400Z The user list has the following rules: 2025-11-03T15:43:04.7676110Z  2025-11-03T15:43:04.7676698Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:04.7677633Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:04.7678587Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:04.7679197Z  2025-11-03T15:43:04.7679631Z Example config: 2025-11-03T15:43:04.7680253Z  # A list of experiments that can be opted into. 2025-11-03T15:43:04.7681071Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:04.7681764Z  # Expected syntax is: 2025-11-03T15:43:04.7682703Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:04.7683786Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:04.7684585Z  2025-11-03T15:43:04.7685135Z  experiments: 2025-11-03T15:43:04.7685608Z  lf: 2025-11-03T15:43:04.7686114Z  rollout_percent: 25 2025-11-03T15:43:04.7686747Z  all_branches: false 2025-11-03T15:43:04.7687342Z  default: true 2025-11-03T15:43:04.7687877Z  --- 2025-11-03T15:43:04.7688377Z  2025-11-03T15:43:04.7688887Z  # Opt-ins: 2025-11-03T15:43:04.7689667Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:04.7690851Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:04.7691774Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:04.7692724Z  # Experiments should be from the above list. 2025-11-03T15:43:04.7693626Z  2025-11-03T15:43:04.7694103Z  @User1,-lf,split_build 2025-11-03T15:43:04.7694621Z  @User2,lf 2025-11-03T15:43:04.7695229Z  @User3,split_build 2025-11-03T15:43:04.7695739Z """ 2025-11-03T15:43:04.7696170Z  2025-11-03T15:43:04.7696676Z import json 2025-11-03T15:43:04.7697181Z import logging 2025-11-03T15:43:04.7697661Z import os 2025-11-03T15:43:04.7698211Z import random 2025-11-03T15:43:04.7698718Z import re 2025-11-03T15:43:04.7699170Z import sys 2025-11-03T15:43:04.7699796Z from argparse import ArgumentParser 2025-11-03T15:43:04.7700435Z from collections.abc import Iterable 2025-11-03T15:43:04.7701079Z from functools import cache 2025-11-03T15:43:04.7701685Z from logging import LogRecord 2025-11-03T15:43:04.7702341Z from typing import Any, NamedTuple 2025-11-03T15:43:04.7703272Z from urllib.request import Request, urlopen 2025-11-03T15:43:04.7704022Z  2025-11-03T15:43:04.7704470Z import yaml 2025-11-03T15:43:04.7705193Z from github import Auth, Github 2025-11-03T15:43:04.7705880Z from github.Issue import Issue 2025-11-03T15:43:04.7706422Z  2025-11-03T15:43:04.7706860Z  2025-11-03T15:43:04.7707415Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:04.7708253Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:04.7709248Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:04.7710050Z  2025-11-03T15:43:04.7710613Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:04.7711276Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:04.7712009Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:04.7712838Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:04.7713433Z  2025-11-03T15:43:04.7713982Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:04.7714550Z  2025-11-03T15:43:04.7715015Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:04.7715635Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:04.7716210Z  2025-11-03T15:43:04.7716607Z  2025-11-03T15:43:04.7717120Z class Experiment(NamedTuple): 2025-11-03T15:43:04.7717750Z  rollout_perc: float = ( 2025-11-03T15:43:04.7718500Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:04.7719353Z  ) 2025-11-03T15:43:04.7719826Z  all_branches: bool = ( 2025-11-03T15:43:04.7720603Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:04.7721373Z  ) 2025-11-03T15:43:04.7721871Z  default: bool = ( 2025-11-03T15:43:04.7722693Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:04.7723485Z  ) 2025-11-03T15:43:04.7723970Z  2025-11-03T15:43:04.7724411Z  # Add more fields as needed 2025-11-03T15:43:04.7725022Z  2025-11-03T15:43:04.7725434Z  2025-11-03T15:43:04.7725902Z class Settings(NamedTuple): 2025-11-03T15:43:04.7726541Z  """ 2025-11-03T15:43:04.7727115Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:04.7727803Z  """ 2025-11-03T15:43:04.7728258Z  2025-11-03T15:43:04.7728777Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:04.7729357Z  2025-11-03T15:43:04.7729986Z  2025-11-03T15:43:04.7730500Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:04.7731259Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:04.7732403Z  2025-11-03T15:43:04.7733134Z  COLORS = { 2025-11-03T15:43:04.7733734Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:04.7734327Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:04.7735035Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:04.7735656Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:04.7736225Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:04.7736864Z  } 2025-11-03T15:43:04.7737287Z  2025-11-03T15:43:04.7737829Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:04.7738727Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:04.7739620Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:04.7740353Z  return super().format(record) 2025-11-03T15:43:04.7740932Z  2025-11-03T15:43:04.7741400Z  2025-11-03T15:43:04.7741834Z handler = logging.StreamHandler() 2025-11-03T15:43:04.7742984Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:04.7743991Z  2025-11-03T15:43:04.7744544Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:04.7745333Z log.addHandler(handler) 2025-11-03T15:43:04.7745918Z log.setLevel(logging.INFO) 2025-11-03T15:43:04.7746474Z  2025-11-03T15:43:04.7746937Z  2025-11-03T15:43:04.7747502Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:04.7748148Z  """ 2025-11-03T15:43:04.7814224Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:04.7815431Z  """ 2025-11-03T15:43:04.7816161Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:04.7818064Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:04.7819254Z  log.warning( 2025-11-03T15:43:04.7820172Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:04.7821113Z  ) 2025-11-03T15:43:04.7821588Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:04.7822143Z  return 2025-11-03T15:43:04.7822843Z  2025-11-03T15:43:04.7823313Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:04.7823925Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:04.7824523Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:04.7825017Z  2025-11-03T15:43:04.7825373Z  2025-11-03T15:43:04.7825899Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:04.7826563Z  return frozenset( 2025-11-03T15:43:04.7827221Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:04.7827891Z  ) 2025-11-03T15:43:04.7828251Z  2025-11-03T15:43:04.7828590Z  2025-11-03T15:43:04.7828960Z def parse_args() -> Any: 2025-11-03T15:43:04.7829579Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:04.7830468Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:04.7831235Z  parser.add_argument( 2025-11-03T15:43:04.7831741Z  "--github-issue-repo", 2025-11-03T15:43:04.7832240Z  type=str, 2025-11-03T15:43:04.7833200Z  required=False, 2025-11-03T15:43:04.7833897Z  default="pytorch/test-infra", 2025-11-03T15:43:04.7834483Z  help="GitHub repo to get the issue", 2025-11-03T15:43:04.7835001Z  ) 2025-11-03T15:43:04.7835395Z  parser.add_argument( 2025-11-03T15:43:04.7835891Z  "--github-repo", 2025-11-03T15:43:04.7836355Z  type=str, 2025-11-03T15:43:04.7836810Z  required=True, 2025-11-03T15:43:04.7837324Z  help="GitHub repo where CI is running", 2025-11-03T15:43:04.7837863Z  ) 2025-11-03T15:43:04.7838241Z  parser.add_argument( 2025-11-03T15:43:04.7838898Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:04.7839578Z  ) 2025-11-03T15:43:04.7839977Z  parser.add_argument( 2025-11-03T15:43:04.7840663Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:04.7841357Z  ) 2025-11-03T15:43:04.7841747Z  parser.add_argument( 2025-11-03T15:43:04.7842426Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:04.7843447Z  ) 2025-11-03T15:43:04.7843846Z  parser.add_argument( 2025-11-03T15:43:04.7844561Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:04.7845423Z  ) 2025-11-03T15:43:04.7845813Z  parser.add_argument( 2025-11-03T15:43:04.7846300Z  "--github-ref-type", 2025-11-03T15:43:04.7846786Z  type=str, 2025-11-03T15:43:04.7847231Z  required=True, 2025-11-03T15:43:04.7847772Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:04.7848339Z  ) 2025-11-03T15:43:04.7848729Z  parser.add_argument( 2025-11-03T15:43:04.7849240Z  "--eligible-experiments", 2025-11-03T15:43:04.7849800Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:04.7850334Z  required=False, 2025-11-03T15:43:04.7850801Z  default="", 2025-11-03T15:43:04.7851686Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:04.7853182Z  ) 2025-11-03T15:43:04.7853587Z  parser.add_argument( 2025-11-03T15:43:04.7854092Z  "--opt-out-experiments", 2025-11-03T15:43:04.7854636Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:04.7855171Z  required=False, 2025-11-03T15:43:04.7855634Z  default="", 2025-11-03T15:43:04.7856071Z  help=( 2025-11-03T15:43:04.7856790Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:04.7857927Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:04.7858758Z  ), 2025-11-03T15:43:04.7859149Z  ) 2025-11-03T15:43:04.7859541Z  parser.add_argument( 2025-11-03T15:43:04.7860031Z  "--pr-number", 2025-11-03T15:43:04.7860485Z  type=str, 2025-11-03T15:43:04.7860935Z  required=False, 2025-11-03T15:43:04.7861393Z  default="", 2025-11-03T15:43:04.7861933Z  help="the optional PR number where this is run", 2025-11-03T15:43:04.7862678Z  ) 2025-11-03T15:43:04.7863093Z  2025-11-03T15:43:04.7863489Z  return parser.parse_args() 2025-11-03T15:43:04.7863976Z  2025-11-03T15:43:04.7864311Z  2025-11-03T15:43:04.7864912Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.7865834Z  auth = Auth.Token(github_token) 2025-11-03T15:43:04.7866368Z  return Github(auth=auth) 2025-11-03T15:43:04.7866844Z  2025-11-03T15:43:04.7867178Z  2025-11-03T15:43:04.7867837Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.7868665Z  repo = gh.get_repo(repo) 2025-11-03T15:43:04.7869225Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:04.7869744Z  2025-11-03T15:43:04.7870083Z  2025-11-03T15:43:04.7870456Z def get_potential_pr_author( 2025-11-03T15:43:04.7871136Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:04.7871821Z ) -> str: 2025-11-03T15:43:04.7872387Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:04.7873326Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:04.7874103Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:04.7874678Z  2025-11-03T15:43:04.7875069Z  gh = get_gh_client(github_token) 2025-11-03T15:43:04.7875565Z  2025-11-03T15:43:04.7876038Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:04.7876679Z  split_tag = ref_name.split("/") 2025-11-03T15:43:04.7877329Z  if ( 2025-11-03T15:43:04.7877759Z  len(split_tag) == 3 2025-11-03T15:43:04.7878294Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:04.7878847Z  and split_tag[2].isnumeric() 2025-11-03T15:43:04.7879353Z  ): 2025-11-03T15:43:04.7879790Z  pr_number = split_tag[2] 2025-11-03T15:43:04.7880302Z  try: 2025-11-03T15:43:04.7880777Z  repository = gh.get_repo(repo) 2025-11-03T15:43:04.7881429Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:04.7882059Z  except Exception as e: 2025-11-03T15:43:04.7882898Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:04.7883618Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:04.7884279Z  ) from e 2025-11-03T15:43:04.7884878Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:04.7885592Z  # In all other cases, return the original input username 2025-11-03T15:43:04.7886191Z  return username 2025-11-03T15:43:04.7886620Z  2025-11-03T15:43:04.7886966Z  2025-11-03T15:43:04.7887391Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:04.7887934Z  """ 2025-11-03T15:43:04.7888617Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:04.7889393Z  """ 2025-11-03T15:43:04.7889965Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:04.7890628Z  2025-11-03T15:43:04.7890969Z  2025-11-03T15:43:04.7891357Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:04.7891868Z  try: 2025-11-03T15:43:04.7892284Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:04.7892944Z  return data 2025-11-03T15:43:04.7893405Z  except yaml.YAMLError: 2025-11-03T15:43:04.7893929Z  log.exception("Error loading YAML") 2025-11-03T15:43:04.7894451Z  raise 2025-11-03T15:43:04.7894838Z  2025-11-03T15:43:04.7895182Z  2025-11-03T15:43:04.7895797Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:04.7896536Z  """ 2025-11-03T15:43:04.7897318Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:04.7898065Z  2025-11-03T15:43:04.7898615Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.7899387Z  and the text below is the list of opted in users. 2025-11-03T15:43:04.7899950Z  2025-11-03T15:43:04.7900516Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:04.7901214Z  """ 2025-11-03T15:43:04.7901686Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:04.7902292Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:04.7903156Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:04.7903754Z  else: 2025-11-03T15:43:04.7904174Z  return "", rollout_state 2025-11-03T15:43:04.7904651Z  2025-11-03T15:43:04.7904991Z  2025-11-03T15:43:04.7905395Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:04.7905914Z  """ 2025-11-03T15:43:04.7906457Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:04.7907102Z  """ 2025-11-03T15:43:04.7907456Z  2025-11-03T15:43:04.7907782Z  2025-11-03T15:43:04.7908448Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:04.7909100Z  """ 2025-11-03T15:43:04.7909826Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:04.7910637Z  2025-11-03T15:43:04.7911434Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:04.7912423Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:04.7913237Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:04.7913868Z  2025-11-03T15:43:04.7914198Z  2025-11-03T15:43:04.7914527Z  """ 2025-11-03T15:43:04.7914916Z  optins = UserOptins() 2025-11-03T15:43:04.7915443Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:04.7916018Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:04.7916596Z  if not user or not user.startswith("@"): 2025-11-03T15:43:04.7917163Z  # Not a valid user. Skip 2025-11-03T15:43:04.7917662Z  continue 2025-11-03T15:43:04.7918080Z  2025-11-03T15:43:04.7918417Z  if user: 2025-11-03T15:43:04.7918902Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:04.7919609Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:04.7920241Z  2025-11-03T15:43:04.7920599Z  return optins 2025-11-03T15:43:04.7921013Z  2025-11-03T15:43:04.7921344Z  2025-11-03T15:43:04.7921846Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:04.7922463Z  """ 2025-11-03T15:43:04.7923171Z  Check if the experiment name is valid. 2025-11-03T15:43:04.7923701Z  A valid name: 2025-11-03T15:43:04.7924388Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:04.7925326Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:04.7926035Z  - Cannot contain spaces 2025-11-03T15:43:04.7926504Z  """ 2025-11-03T15:43:04.7926864Z  2025-11-03T15:43:04.7927335Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:04.7928053Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:04.7928790Z  2025-11-03T15:43:04.7929129Z  if valid: 2025-11-03T15:43:04.7929542Z  return True 2025-11-03T15:43:04.7929955Z  2025-11-03T15:43:04.7930302Z  log.error( 2025-11-03T15:43:04.7931956Z  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-11-03T15:43:04.7933665Z  ) 2025-11-03T15:43:04.7934039Z  return False 2025-11-03T15:43:04.7934448Z  2025-11-03T15:43:04.7934777Z  2025-11-03T15:43:04.7935296Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:04.7935932Z  """ 2025-11-03T15:43:04.7936542Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:04.7937237Z  """ 2025-11-03T15:43:04.7937605Z  try: 2025-11-03T15:43:04.7937988Z  if settings_text: 2025-11-03T15:43:04.7938741Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:04.7939522Z  # for easy reading 2025-11-03T15:43:04.7940336Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:04.7941369Z  # the backtick character in shell commands. 2025-11-03T15:43:04.7941987Z  backtick = chr(96) # backtick character 2025-11-03T15:43:04.7942890Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:04.7943606Z  settings = load_yaml(settings_text) 2025-11-03T15:43:04.7944118Z  2025-11-03T15:43:04.7944725Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:04.7945467Z  experiments = {} 2025-11-03T15:43:04.7945929Z  2025-11-03T15:43:04.7946489Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:04.7947262Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:04.7948380Z  # 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-11-03T15:43:04.7949391Z  continue 2025-11-03T15:43:04.7949845Z  2025-11-03T15:43:04.7950218Z  valid_settings = {} 2025-11-03T15:43:04.7950769Z  for setting in exp_settings: 2025-11-03T15:43:04.7951346Z  if setting not in Experiment._fields: 2025-11-03T15:43:04.7951914Z  log.warning( 2025-11-03T15:43:04.7952748Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:04.7953458Z  ) 2025-11-03T15:43:04.7953913Z  else: 2025-11-03T15:43:04.7954461Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:04.7955036Z  2025-11-03T15:43:04.7955509Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:04.7956164Z  return Settings(experiments) 2025-11-03T15:43:04.7956665Z  2025-11-03T15:43:04.7957023Z  except Exception: 2025-11-03T15:43:04.7957555Z  log.exception("Failed to parse settings") 2025-11-03T15:43:04.7958091Z  2025-11-03T15:43:04.7958441Z  return Settings() 2025-11-03T15:43:04.7958862Z  2025-11-03T15:43:04.7959185Z  2025-11-03T15:43:04.7959757Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:04.7960334Z  """ 2025-11-03T15:43:04.7960798Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:04.7961347Z  2025-11-03T15:43:04.7961879Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.7962916Z  and the text below is the list of opted in users. 2025-11-03T15:43:04.7963502Z  2025-11-03T15:43:04.7964091Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:04.7964814Z  """ 2025-11-03T15:43:04.7965397Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.7966170Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:04.7966718Z  2025-11-03T15:43:04.7967045Z  2025-11-03T15:43:04.7967503Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:04.7968069Z  """ 2025-11-03T15:43:04.7968489Z  Parse users from the rollout state. 2025-11-03T15:43:04.7968999Z  2025-11-03T15:43:04.7969332Z  """ 2025-11-03T15:43:04.7969898Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.7970653Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:04.7971337Z  2025-11-03T15:43:04.7971671Z  2025-11-03T15:43:04.7972293Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.7973159Z  """ 2025-11-03T15:43:04.7973612Z  Check if a user is opted into an experiment 2025-11-03T15:43:04.7974151Z  """ 2025-11-03T15:43:04.7974634Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:04.7975211Z  2025-11-03T15:43:04.7975536Z  2025-11-03T15:43:04.7976167Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.7976914Z  """ 2025-11-03T15:43:04.7977408Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:04.7977984Z  """ 2025-11-03T15:43:04.7978514Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:04.7979229Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:04.7979898Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:04.7980512Z  return False 2025-11-03T15:43:04.7980934Z  2025-11-03T15:43:04.7981406Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:04.7982003Z  log.warning( 2025-11-03T15:43:04.7983040Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:04.7983908Z  ) 2025-11-03T15:43:04.7984275Z  2025-11-03T15:43:04.7984626Z  return True 2025-11-03T15:43:04.7985024Z  2025-11-03T15:43:04.7985361Z  2025-11-03T15:43:04.7985722Z def get_runner_prefix( 2025-11-03T15:43:04.7986210Z  rollout_state: str, 2025-11-03T15:43:04.7986726Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:04.7987248Z  branch: str, 2025-11-03T15:43:04.7987794Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.7988488Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.7989082Z  is_canary: bool = False, 2025-11-03T15:43:04.7989546Z ) -> str: 2025-11-03T15:43:04.7990003Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:04.7990600Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:04.7991116Z  2025-11-03T15:43:04.7991599Z  fleet_prefix = "" 2025-11-03T15:43:04.7992056Z  prefixes = [] 2025-11-03T15:43:04.7992835Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:04.7993778Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:04.7994499Z  log.info( 2025-11-03T15:43:04.7995208Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:04.7995946Z  ) 2025-11-03T15:43:04.7996357Z  continue 2025-11-03T15:43:04.7996773Z  2025-11-03T15:43:04.7997145Z  if opt_out_experiments: 2025-11-03T15:43:04.7997708Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:04.7998363Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:04.7998952Z  log.info( 2025-11-03T15:43:04.7999874Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:04.8000827Z  ) 2025-11-03T15:43:04.8001251Z  continue 2025-11-03T15:43:04.8001692Z  2025-11-03T15:43:04.8002182Z  if eligible_experiments: 2025-11-03T15:43:04.8003041Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:04.8003706Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:04.8004261Z  log.info( 2025-11-03T15:43:04.8005068Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:04.8005882Z  ) 2025-11-03T15:43:04.8006315Z  continue 2025-11-03T15:43:04.8006836Z  elif not experiment_settings.default: 2025-11-03T15:43:04.8007381Z  log.info( 2025-11-03T15:43:04.8008065Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:04.8008788Z  ) 2025-11-03T15:43:04.8009197Z  continue 2025-11-03T15:43:04.8009616Z  2025-11-03T15:43:04.8010090Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:04.8010709Z  opted_out_users = [ 2025-11-03T15:43:04.8011189Z  requestor 2025-11-03T15:43:04.8011692Z  for requestor in workflow_requestors 2025-11-03T15:43:04.8012373Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.8013116Z  ] 2025-11-03T15:43:04.8013489Z  2025-11-03T15:43:04.8013852Z  if opted_out_users: 2025-11-03T15:43:04.8014329Z  log.info( 2025-11-03T15:43:04.8014990Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:04.8015674Z  ) 2025-11-03T15:43:04.8016079Z  continue 2025-11-03T15:43:04.8016497Z  2025-11-03T15:43:04.8016961Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:04.8017579Z  opted_in_users = [ 2025-11-03T15:43:04.8018050Z  requestor 2025-11-03T15:43:04.8018557Z  for requestor in workflow_requestors 2025-11-03T15:43:04.8019231Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.8019851Z  ] 2025-11-03T15:43:04.8020224Z  2025-11-03T15:43:04.8020574Z  enabled = False 2025-11-03T15:43:04.8021039Z  if opted_in_users: 2025-11-03T15:43:04.8021678Z  log.info( 2025-11-03T15:43:04.8022318Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:04.8023193Z  ) 2025-11-03T15:43:04.8023608Z  enabled = True 2025-11-03T15:43:04.8024053Z  2025-11-03T15:43:04.8024460Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:04.8025307Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:04.8026227Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:04.8026880Z  log.info( 2025-11-03T15:43:04.8027755Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:04.8028655Z  ) 2025-11-03T15:43:04.8029099Z  enabled = True 2025-11-03T15:43:04.8029574Z  2025-11-03T15:43:04.8029919Z  if enabled: 2025-11-03T15:43:04.8030381Z  label = experiment_name 2025-11-03T15:43:04.8030959Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:04.8031781Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:04.8032890Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:04.8033660Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:04.8034307Z  if is_canary: 2025-11-03T15:43:04.8034831Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:04.8035395Z  fleet_prefix = label 2025-11-03T15:43:04.8035893Z  else: 2025-11-03T15:43:04.8036360Z  prefixes.append(label) 2025-11-03T15:43:04.8036856Z  2025-11-03T15:43:04.8037217Z  if len(prefixes) > 1: 2025-11-03T15:43:04.8037682Z  log.error( 2025-11-03T15:43:04.8038720Z  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-11-03T15:43:04.8039799Z  ) 2025-11-03T15:43:04.8040206Z  prefixes = prefixes[:1] 2025-11-03T15:43:04.8040686Z  2025-11-03T15:43:04.8041048Z  # Fleet always comes first 2025-11-03T15:43:04.8041550Z  if fleet_prefix: 2025-11-03T15:43:04.8042036Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:04.8042760Z  2025-11-03T15:43:04.8043262Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:04.8043868Z  2025-11-03T15:43:04.8044204Z  2025-11-03T15:43:04.8044835Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:04.8045590Z  """ 2025-11-03T15:43:04.8046186Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:04.8046876Z  2025-11-03T15:43:04.8047440Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:04.8048149Z  """ 2025-11-03T15:43:04.8048558Z  gh = get_gh_client(github_token) 2025-11-03T15:43:04.8049120Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:04.8049774Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:04.8050361Z  2025-11-03T15:43:04.8050695Z  2025-11-03T15:43:04.8051280Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:04.8052162Z  for _ in range(num_retries): 2025-11-03T15:43:04.8052772Z  try: 2025-11-03T15:43:04.8053228Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:04.8053910Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:04.8054559Z  return json.loads(content) 2025-11-03T15:43:04.8055095Z  except Exception as e: 2025-11-03T15:43:04.8055670Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:04.8056218Z  2025-11-03T15:43:04.8056796Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:04.8057498Z  return {} 2025-11-03T15:43:04.8057905Z  2025-11-03T15:43:04.8058235Z  2025-11-03T15:43:04.8058570Z @cache 2025-11-03T15:43:04.8059209Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:04.8059955Z  """ 2025-11-03T15:43:04.8060404Z  Dynamically get PR information 2025-11-03T15:43:04.8060900Z  """ 2025-11-03T15:43:04.8061420Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:04.8062044Z  headers = { 2025-11-03T15:43:04.8062730Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:04.8063502Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:04.8064029Z  } 2025-11-03T15:43:04.8064477Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:04.8065090Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:04.8065630Z  headers=headers, 2025-11-03T15:43:04.8066079Z  ) 2025-11-03T15:43:04.8066441Z  2025-11-03T15:43:04.8066804Z  if not json_response: 2025-11-03T15:43:04.8067424Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:04.8068049Z  return {} 2025-11-03T15:43:04.8068465Z  2025-11-03T15:43:04.8068825Z  return json_response 2025-11-03T15:43:04.8069276Z  2025-11-03T15:43:04.8069615Z  2025-11-03T15:43:04.8070198Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:04.8070916Z  """ 2025-11-03T15:43:04.8071469Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:04.8072109Z  """ 2025-11-03T15:43:04.8072719Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:04.8073324Z  return { 2025-11-03T15:43:04.8073923Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:04.8074590Z  } 2025-11-03T15:43:04.8074943Z  2025-11-03T15:43:04.8075269Z  2025-11-03T15:43:04.8075629Z def main() -> None: 2025-11-03T15:43:04.8076084Z  args = parse_args() 2025-11-03T15:43:04.8076529Z  2025-11-03T15:43:04.8076941Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:04.8077472Z  2025-11-03T15:43:04.8077839Z  # Check if the PR is opt-out 2025-11-03T15:43:04.8078344Z  if args.pr_number: 2025-11-03T15:43:04.8079041Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:04.8079782Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:04.8080288Z  log.info( 2025-11-03T15:43:04.8080993Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:04.8081745Z  ) 2025-11-03T15:43:04.8082334Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.8083270Z  sys.exit() 2025-11-03T15:43:04.8083842Z  2025-11-03T15:43:04.8084177Z  try: 2025-11-03T15:43:04.8084640Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:04.8085354Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:04.8085988Z  ) 2025-11-03T15:43:04.8086353Z  2025-11-03T15:43:04.8086755Z  username = get_potential_pr_author( 2025-11-03T15:43:04.8087293Z  args.github_token, 2025-11-03T15:43:04.8087792Z  args.github_repo, 2025-11-03T15:43:04.8088301Z  args.github_actor, 2025-11-03T15:43:04.8088806Z  args.github_ref_type, 2025-11-03T15:43:04.8089314Z  args.github_branch, 2025-11-03T15:43:04.8089785Z  ) 2025-11-03T15:43:04.8090155Z  2025-11-03T15:43:04.8090641Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:04.8091233Z  2025-11-03T15:43:04.8091651Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:04.8092211Z  rollout_state, 2025-11-03T15:43:04.8092859Z  (args.github_issue_owner, username), 2025-11-03T15:43:04.8093408Z  args.github_branch, 2025-11-03T15:43:04.8094059Z  args.eligible_experiments, 2025-11-03T15:43:04.8094605Z  args.opt_out_experiments, 2025-11-03T15:43:04.8095127Z  is_canary, 2025-11-03T15:43:04.8095563Z  ) 2025-11-03T15:43:04.8095930Z  2025-11-03T15:43:04.8096298Z  except Exception as e: 2025-11-03T15:43:04.8096772Z  log.error( 2025-11-03T15:43:04.8097477Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:04.8098213Z  ) 2025-11-03T15:43:04.8098590Z  2025-11-03T15:43:04.8099111Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.8099751Z  2025-11-03T15:43:04.8100180Z  2025-11-03T15:43:04.8100532Z if __name__ == "__main__": 2025-11-03T15:43:04.8100986Z  main() 2025-11-03T15:43:04.8101356Z  2025-11-03T15:43:04.8101689Z EOF 2025-11-03T15:43:04.8102033Z  2025-11-03T15:43:04.8102397Z cat runner_determinator.py 2025-11-03T15:43:04.8558845Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:04.8560119Z env: 2025-11-03T15:43:04.8561124Z GITHUB_TOKEN: *** 2025-11-03T15:43:04.8561827Z ISSUE_NUMBER: 5132 2025-11-03T15:43:04.8562816Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:04.8563710Z ISSUE_OWNER: 2025-11-03T15:43:04.8564370Z CHECK_EXPERIMENTS: 2025-11-03T15:43:04.8565079Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:04.8565757Z PR_NUMBER: 2025-11-03T15:43:04.8566369Z ##[endgroup] 2025-11-03T15:43:04.8878386Z # flake8: noqa: G004 2025-11-03T15:43:04.8878855Z 2025-11-03T15:43:04.8879526Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:04.8881023Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:04.8882349Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:04.8883315Z 2025-11-03T15:43:04.8883559Z """ 2025-11-03T15:43:04.8884477Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:04.8885927Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:04.8887408Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:04.8888737Z of which runners should be used to run which job. 2025-11-03T15:43:04.8889413Z 2025-11-03T15:43:04.8890019Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:04.8891681Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:04.8893369Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:04.8894491Z list, defined. 2025-11-03T15:43:04.8894841Z 2025-11-03T15:43:04.8895423Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:04.8896934Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:04.8898285Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:04.8899017Z 2025-11-03T15:43:04.8899602Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:04.8900993Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:04.8902241Z experiments which the user could be opted in to. 2025-11-03T15:43:04.8903141Z 2025-11-03T15:43:04.8903483Z The user list has the following rules: 2025-11-03T15:43:04.8904064Z 2025-11-03T15:43:04.8904590Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:04.8906022Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:04.8907359Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:04.8908045Z 2025-11-03T15:43:04.8908312Z Example config: 2025-11-03T15:43:04.8909004Z # A list of experiments that can be opted into. 2025-11-03T15:43:04.8910286Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:04.8911264Z # Expected syntax is: 2025-11-03T15:43:04.8912256Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:04.8914010Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:04.8915010Z 2025-11-03T15:43:04.8915274Z experiments: 2025-11-03T15:43:04.8915902Z lf: 2025-11-03T15:43:04.8916538Z rollout_percent: 25 2025-11-03T15:43:04.8917262Z all_branches: false 2025-11-03T15:43:04.8918088Z default: true 2025-11-03T15:43:04.8918751Z --- 2025-11-03T15:43:04.8919069Z 2025-11-03T15:43:04.8919328Z # Opt-ins: 2025-11-03T15:43:04.8920230Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:04.8921617Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:04.8924012Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:04.8925247Z # Experiments should be from the above list. 2025-11-03T15:43:04.8925916Z 2025-11-03T15:43:04.8926218Z @User1,-lf,split_build 2025-11-03T15:43:04.8926984Z @User2,lf 2025-11-03T15:43:04.8927722Z @User3,split_build 2025-11-03T15:43:04.8928420Z """ 2025-11-03T15:43:04.8928756Z 2025-11-03T15:43:04.8929038Z import json 2025-11-03T15:43:04.8929673Z import logging 2025-11-03T15:43:04.8930332Z import os 2025-11-03T15:43:04.8930921Z import random 2025-11-03T15:43:04.8931515Z import re 2025-11-03T15:43:04.8932085Z import sys 2025-11-03T15:43:04.8932965Z from argparse import ArgumentParser 2025-11-03T15:43:04.8933857Z from collections.abc import Iterable 2025-11-03T15:43:04.8934683Z from functools import cache 2025-11-03T15:43:04.8935443Z from logging import LogRecord 2025-11-03T15:43:04.8936222Z from typing import Any, NamedTuple 2025-11-03T15:43:04.8937111Z from urllib.request import Request, urlopen 2025-11-03T15:43:04.8937761Z 2025-11-03T15:43:04.8938019Z import yaml 2025-11-03T15:43:04.8938632Z from github import Auth, Github 2025-11-03T15:43:04.8939399Z from github.Issue import Issue 2025-11-03T15:43:04.8939887Z 2025-11-03T15:43:04.8939899Z 2025-11-03T15:43:04.8940239Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:04.8941324Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:04.8942929Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:04.8943940Z 2025-11-03T15:43:04.8944359Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:04.8945550Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:04.8946406Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:04.8947311Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:04.8947999Z 2025-11-03T15:43:04.8948344Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:04.8948915Z 2025-11-03T15:43:04.8949224Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:04.8950011Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:04.8950516Z 2025-11-03T15:43:04.8950529Z 2025-11-03T15:43:04.8950866Z class Experiment(NamedTuple): 2025-11-03T15:43:04.8951764Z rollout_perc: float = ( 2025-11-03T15:43:04.8953009Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:04.8954198Z ) 2025-11-03T15:43:04.8954819Z all_branches: bool = ( 2025-11-03T15:43:04.8955950Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:04.8957135Z ) 2025-11-03T15:43:04.8957759Z default: bool = ( 2025-11-03T15:43:04.8958765Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:04.8959887Z ) 2025-11-03T15:43:04.8960250Z 2025-11-03T15:43:04.8960623Z # Add more fields as needed 2025-11-03T15:43:04.8961164Z 2025-11-03T15:43:04.8961175Z 2025-11-03T15:43:04.8961494Z class Settings(NamedTuple): 2025-11-03T15:43:04.8962213Z """ 2025-11-03T15:43:04.8963536Z Settings for the experiments that can be opted into. 2025-11-03T15:43:04.8964533Z """ 2025-11-03T15:43:04.8964893Z 2025-11-03T15:43:04.8965237Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:04.8965871Z 2025-11-03T15:43:04.8965883Z 2025-11-03T15:43:04.8966254Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:04.8967315Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:04.8968058Z 2025-11-03T15:43:04.8968328Z COLORS = { 2025-11-03T15:43:04.8968987Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:04.8969775Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:04.8970533Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:04.8971281Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:04.8971935Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:04.8972380Z } 2025-11-03T15:43:04.8972802Z 2025-11-03T15:43:04.8973048Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:04.8973774Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:04.8974516Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:04.8975056Z return super().format(record) 2025-11-03T15:43:04.8975375Z 2025-11-03T15:43:04.8975382Z 2025-11-03T15:43:04.8975564Z handler = logging.StreamHandler() 2025-11-03T15:43:04.8976223Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:04.8976740Z 2025-11-03T15:43:04.8976967Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:04.8977507Z log.addHandler(handler) 2025-11-03T15:43:04.8977913Z log.setLevel(logging.INFO) 2025-11-03T15:43:04.8978186Z 2025-11-03T15:43:04.8978192Z 2025-11-03T15:43:04.8978424Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:04.8978935Z """ 2025-11-03T15:43:04.8979391Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:04.8979968Z """ 2025-11-03T15:43:04.8980291Z if not GITHUB_OUTPUT: 2025-11-03T15:43:04.8981300Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:04.8982330Z log.warning( 2025-11-03T15:43:04.8983323Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:04.8984180Z ) 2025-11-03T15:43:04.8994435Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:04.8995012Z return 2025-11-03T15:43:04.8995256Z 2025-11-03T15:43:04.8995622Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:04.8996183Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:04.8996707Z f.write(f"{key}={value}\n") 2025-11-03T15:43:04.8997016Z 2025-11-03T15:43:04.8997023Z 2025-11-03T15:43:04.8997301Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:04.8997892Z return frozenset( 2025-11-03T15:43:04.8998476Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:04.8999107Z ) 2025-11-03T15:43:04.8999287Z 2025-11-03T15:43:04.8999294Z 2025-11-03T15:43:04.8999458Z def parse_args() -> Any: 2025-11-03T15:43:04.8999972Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:04.9000775Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:04.9001489Z parser.add_argument( 2025-11-03T15:43:04.9001903Z "--github-issue-repo", 2025-11-03T15:43:04.9002334Z type=str, 2025-11-03T15:43:04.9002973Z required=False, 2025-11-03T15:43:04.9003405Z default="pytorch/test-infra", 2025-11-03T15:43:04.9003913Z help="GitHub repo to get the issue", 2025-11-03T15:43:04.9004382Z ) 2025-11-03T15:43:04.9004722Z parser.add_argument( 2025-11-03T15:43:04.9005124Z "--github-repo", 2025-11-03T15:43:04.9005512Z type=str, 2025-11-03T15:43:04.9005868Z required=True, 2025-11-03T15:43:04.9006433Z help="GitHub repo where CI is running", 2025-11-03T15:43:04.9006913Z ) 2025-11-03T15:43:04.9007255Z parser.add_argument( 2025-11-03T15:43:04.9007820Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:04.9008425Z ) 2025-11-03T15:43:04.9008767Z parser.add_argument( 2025-11-03T15:43:04.9009340Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:04.9009962Z ) 2025-11-03T15:43:04.9010291Z parser.add_argument( 2025-11-03T15:43:04.9010885Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:04.9011522Z ) 2025-11-03T15:43:04.9011861Z parser.add_argument( 2025-11-03T15:43:04.9012459Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:04.9013418Z ) 2025-11-03T15:43:04.9013770Z parser.add_argument( 2025-11-03T15:43:04.9014182Z "--github-ref-type", 2025-11-03T15:43:04.9014616Z type=str, 2025-11-03T15:43:04.9014971Z required=True, 2025-11-03T15:43:04.9015417Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:04.9015915Z ) 2025-11-03T15:43:04.9016277Z parser.add_argument( 2025-11-03T15:43:04.9016695Z "--eligible-experiments", 2025-11-03T15:43:04.9017167Z type=_str_comma_separated_to_set, 2025-11-03T15:43:04.9017635Z required=False, 2025-11-03T15:43:04.9018016Z default="", 2025-11-03T15:43:04.9018803Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:04.9019657Z ) 2025-11-03T15:43:04.9019995Z parser.add_argument( 2025-11-03T15:43:04.9020412Z "--opt-out-experiments", 2025-11-03T15:43:04.9020884Z type=_str_comma_separated_to_set, 2025-11-03T15:43:04.9021354Z required=False, 2025-11-03T15:43:04.9021740Z default="", 2025-11-03T15:43:04.9022098Z help=( 2025-11-03T15:43:04.9022962Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:04.9024058Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:04.9024838Z ), 2025-11-03T15:43:04.9025166Z ) 2025-11-03T15:43:04.9025498Z parser.add_argument( 2025-11-03T15:43:04.9025909Z "--pr-number", 2025-11-03T15:43:04.9026291Z type=str, 2025-11-03T15:43:04.9026662Z required=False, 2025-11-03T15:43:04.9027040Z default="", 2025-11-03T15:43:04.9027620Z help="the optional PR number where this is run", 2025-11-03T15:43:04.9028142Z ) 2025-11-03T15:43:04.9028328Z 2025-11-03T15:43:04.9028503Z return parser.parse_args() 2025-11-03T15:43:04.9028791Z 2025-11-03T15:43:04.9028797Z 2025-11-03T15:43:04.9029177Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.9029890Z auth = Auth.Token(github_token) 2025-11-03T15:43:04.9030369Z return Github(auth=auth) 2025-11-03T15:43:04.9030646Z 2025-11-03T15:43:04.9030653Z 2025-11-03T15:43:04.9031076Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:04.9031820Z repo = gh.get_repo(repo) 2025-11-03T15:43:04.9032282Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:04.9032902Z 2025-11-03T15:43:04.9032910Z 2025-11-03T15:43:04.9033094Z def get_potential_pr_author( 2025-11-03T15:43:04.9081291Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:04.9082751Z ) -> str: 2025-11-03T15:43:04.9083629Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:04.9084402Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:04.9085110Z # embedded in the tag name: ciflow// 2025-11-03T15:43:04.9085511Z 2025-11-03T15:43:04.9085882Z gh = get_gh_client(github_token) 2025-11-03T15:43:04.9086213Z 2025-11-03T15:43:04.9086471Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:04.9087058Z split_tag = ref_name.split("/") 2025-11-03T15:43:04.9087521Z if ( 2025-11-03T15:43:04.9087881Z len(split_tag) == 3 2025-11-03T15:43:04.9088328Z and split_tag[0] == "ciflow" 2025-11-03T15:43:04.9088816Z and split_tag[2].isnumeric() 2025-11-03T15:43:04.9089265Z ): 2025-11-03T15:43:04.9089619Z pr_number = split_tag[2] 2025-11-03T15:43:04.9090054Z try: 2025-11-03T15:43:04.9090461Z repository = gh.get_repo(repo) 2025-11-03T15:43:04.9091039Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:04.9091592Z except Exception as e: 2025-11-03T15:43:04.9092071Z raise Exception( # noqa: TRY002 2025-11-03T15:43:04.9092907Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:04.9093518Z ) from e 2025-11-03T15:43:04.9094005Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:04.9094657Z # In all other cases, return the original input username 2025-11-03T15:43:04.9095207Z return username 2025-11-03T15:43:04.9095440Z 2025-11-03T15:43:04.9095447Z 2025-11-03T15:43:04.9095658Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:04.9096153Z """ 2025-11-03T15:43:04.9096742Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:04.9097455Z """ 2025-11-03T15:43:04.9097954Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:04.9098446Z 2025-11-03T15:43:04.9098453Z 2025-11-03T15:43:04.9098634Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:04.9099090Z try: 2025-11-03T15:43:04.9099448Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:04.9099921Z return data 2025-11-03T15:43:04.9100298Z except yaml.YAMLError: 2025-11-03T15:43:04.9100744Z log.exception("Error loading YAML") 2025-11-03T15:43:04.9101209Z raise 2025-11-03T15:43:04.9101412Z 2025-11-03T15:43:04.9101426Z 2025-11-03T15:43:04.9101814Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:04.9102684Z """ 2025-11-03T15:43:04.9103278Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:04.9103834Z 2025-11-03T15:43:04.9104299Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.9105013Z and the text below is the list of opted in users. 2025-11-03T15:43:04.9105392Z 2025-11-03T15:43:04.9105741Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:04.9106383Z """ 2025-11-03T15:43:04.9106790Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:04.9107346Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:04.9107905Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:04.9108445Z else: 2025-11-03T15:43:04.9108787Z return "", rollout_state 2025-11-03T15:43:04.9109070Z 2025-11-03T15:43:04.9109076Z 2025-11-03T15:43:04.9109267Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:04.9109737Z """ 2025-11-03T15:43:04.9110212Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:04.9110805Z """ 2025-11-03T15:43:04.9110992Z 2025-11-03T15:43:04.9110999Z 2025-11-03T15:43:04.9111315Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:04.9111936Z """ 2025-11-03T15:43:04.9112763Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:04.9113419Z 2025-11-03T15:43:04.9114008Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:04.9115086Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:04.9115723Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:04.9116166Z 2025-11-03T15:43:04.9116172Z 2025-11-03T15:43:04.9116316Z """ 2025-11-03T15:43:04.9116653Z optins = UserOptins() 2025-11-03T15:43:04.9117103Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:04.9117605Z user = user.strip("\r\n\t -") 2025-11-03T15:43:04.9118108Z if not user or not user.startswith("@"): 2025-11-03T15:43:04.9118619Z # Not a valid user. Skip 2025-11-03T15:43:04.9119067Z continue 2025-11-03T15:43:04.9119291Z 2025-11-03T15:43:04.9119432Z if user: 2025-11-03T15:43:04.9119834Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:04.9120480Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:04.9120946Z 2025-11-03T15:43:04.9121102Z return optins 2025-11-03T15:43:04.9121319Z 2025-11-03T15:43:04.9121326Z 2025-11-03T15:43:04.9121598Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:04.9122145Z """ 2025-11-03T15:43:04.9122708Z Check if the experiment name is valid. 2025-11-03T15:43:04.9123221Z A valid name: 2025-11-03T15:43:04.9123814Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:04.9124686Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:04.9125346Z - Cannot contain spaces 2025-11-03T15:43:04.9125777Z """ 2025-11-03T15:43:04.9125959Z 2025-11-03T15:43:04.9126197Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:04.9126839Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:04.9127249Z 2025-11-03T15:43:04.9127393Z if valid: 2025-11-03T15:43:04.9127739Z return True 2025-11-03T15:43:04.9127961Z 2025-11-03T15:43:04.9128108Z log.error( 2025-11-03T15:43:04.9129454Z 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-11-03T15:43:04.9130935Z ) 2025-11-03T15:43:04.9131258Z return False 2025-11-03T15:43:04.9131473Z 2025-11-03T15:43:04.9131479Z 2025-11-03T15:43:04.9131754Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:04.9132328Z """ 2025-11-03T15:43:04.9133286Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:04.9133972Z """ 2025-11-03T15:43:04.9134291Z try: 2025-11-03T15:43:04.9134629Z if settings_text: 2025-11-03T15:43:04.9135288Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:04.9136017Z # for easy reading 2025-11-03T15:43:04.9136751Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:04.9137580Z # the backtick character in shell commands. 2025-11-03T15:43:04.9138140Z backtick = chr(96) # backtick character 2025-11-03T15:43:04.9138747Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:04.9139355Z settings = load_yaml(settings_text) 2025-11-03T15:43:04.9139697Z 2025-11-03T15:43:04.9140073Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:04.9140768Z experiments = {} 2025-11-03T15:43:04.9141038Z 2025-11-03T15:43:04.9141395Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:04.9142105Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:04.9143287Z # 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-11-03T15:43:04.9144376Z continue 2025-11-03T15:43:04.9144647Z 2025-11-03T15:43:04.9144811Z valid_settings = {} 2025-11-03T15:43:04.9145295Z for setting in exp_settings: 2025-11-03T15:43:04.9145820Z if setting not in Experiment._fields: 2025-11-03T15:43:04.9146332Z log.warning( 2025-11-03T15:43:04.9146973Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:04.9147637Z ) 2025-11-03T15:43:04.9148023Z else: 2025-11-03T15:43:04.9148499Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:04.9148887Z 2025-11-03T15:43:04.9149138Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:04.9149717Z return Settings(experiments) 2025-11-03T15:43:04.9150045Z 2025-11-03T15:43:04.9150207Z except Exception: 2025-11-03T15:43:04.9150641Z log.exception("Failed to parse settings") 2025-11-03T15:43:04.9150996Z 2025-11-03T15:43:04.9151152Z return Settings() 2025-11-03T15:43:04.9151388Z 2025-11-03T15:43:04.9151395Z 2025-11-03T15:43:04.9151620Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:04.9152145Z """ 2025-11-03T15:43:04.9152640Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:04.9153019Z 2025-11-03T15:43:04.9153340Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:04.9154045Z and the text below is the list of opted in users. 2025-11-03T15:43:04.9154414Z 2025-11-03T15:43:04.9154788Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:04.9155487Z """ 2025-11-03T15:43:04.9155993Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.9156695Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:04.9157062Z 2025-11-03T15:43:04.9157069Z 2025-11-03T15:43:04.9157298Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:04.9157827Z """ 2025-11-03T15:43:04.9158186Z Parse users from the rollout state. 2025-11-03T15:43:04.9158507Z 2025-11-03T15:43:04.9158644Z """ 2025-11-03T15:43:04.9159135Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:04.9159801Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:04.9160175Z 2025-11-03T15:43:04.9160181Z 2025-11-03T15:43:04.9160680Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.9161368Z """ 2025-11-03T15:43:04.9161733Z Check if a user is opted into an experiment 2025-11-03T15:43:04.9162217Z """ 2025-11-03T15:43:04.9162804Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:04.9163261Z 2025-11-03T15:43:04.9163276Z 2025-11-03T15:43:04.9163660Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:04.9164345Z """ 2025-11-03T15:43:04.9164761Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:04.9165294Z """ 2025-11-03T15:43:04.9165752Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:04.9166396Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:04.9166991Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:04.9167535Z return False 2025-11-03T15:43:04.9167766Z 2025-11-03T15:43:04.9168019Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:04.9168578Z log.warning( 2025-11-03T15:43:04.9169309Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:04.9170108Z ) 2025-11-03T15:43:04.9170294Z 2025-11-03T15:43:04.9170448Z return True 2025-11-03T15:43:04.9170798Z 2025-11-03T15:43:04.9170805Z 2025-11-03T15:43:04.9170961Z def get_runner_prefix( 2025-11-03T15:43:04.9171354Z rollout_state: str, 2025-11-03T15:43:04.9171769Z workflow_requestors: Iterable[str], 2025-11-03T15:43:04.9172242Z branch: str, 2025-11-03T15:43:04.9173175Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.9173799Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:04.9174337Z is_canary: bool = False, 2025-11-03T15:43:04.9174745Z ) -> str: 2025-11-03T15:43:04.9175121Z settings = parse_settings(rollout_state) 2025-11-03T15:43:04.9175666Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:04.9176005Z 2025-11-03T15:43:04.9176164Z fleet_prefix = "" 2025-11-03T15:43:04.9176542Z prefixes = [] 2025-11-03T15:43:04.9177111Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:04.9177965Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:04.9178623Z log.info( 2025-11-03T15:43:04.9179247Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:04.9179936Z ) 2025-11-03T15:43:04.9180276Z continue 2025-11-03T15:43:04.9180500Z 2025-11-03T15:43:04.9180666Z if opt_out_experiments: 2025-11-03T15:43:04.9181147Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:04.9181728Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:04.9182253Z log.info( 2025-11-03T15:43:04.9183250Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:04.9184148Z ) 2025-11-03T15:43:04.9184504Z continue 2025-11-03T15:43:04.9184744Z 2025-11-03T15:43:04.9184911Z if eligible_experiments: 2025-11-03T15:43:04.9185417Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:04.9185999Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:04.9186513Z log.info( 2025-11-03T15:43:04.9187221Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:04.9187993Z ) 2025-11-03T15:43:04.9188350Z continue 2025-11-03T15:43:04.9188777Z elif not experiment_settings.default: 2025-11-03T15:43:04.9189258Z log.info( 2025-11-03T15:43:04.9189981Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:04.9190669Z ) 2025-11-03T15:43:04.9191001Z continue 2025-11-03T15:43:04.9191233Z 2025-11-03T15:43:04.9191486Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:04.9192038Z opted_out_users = [ 2025-11-03T15:43:04.9192447Z requestor 2025-11-03T15:43:04.9192978Z for requestor in workflow_requestors 2025-11-03T15:43:04.9193586Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.9194164Z ] 2025-11-03T15:43:04.9194351Z 2025-11-03T15:43:04.9194508Z if opted_out_users: 2025-11-03T15:43:04.9194917Z log.info( 2025-11-03T15:43:04.9195489Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:04.9196134Z ) 2025-11-03T15:43:04.9196474Z continue 2025-11-03T15:43:04.9196696Z 2025-11-03T15:43:04.9196944Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:04.9197493Z opted_in_users = [ 2025-11-03T15:43:04.9197883Z requestor 2025-11-03T15:43:04.9198286Z for requestor in workflow_requestors 2025-11-03T15:43:04.9198878Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:04.9199442Z ] 2025-11-03T15:43:04.9199752Z 2025-11-03T15:43:04.9199904Z enabled = False 2025-11-03T15:43:04.9200298Z if opted_in_users: 2025-11-03T15:43:04.9200700Z log.info( 2025-11-03T15:43:04.9201241Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:04.9201858Z ) 2025-11-03T15:43:04.9202199Z enabled = True 2025-11-03T15:43:04.9202456Z 2025-11-03T15:43:04.9202859Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:04.9203670Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:04.9204525Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:04.9205116Z log.info( 2025-11-03T15:43:04.9205902Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:04.9206747Z ) 2025-11-03T15:43:04.9207112Z enabled = True 2025-11-03T15:43:04.9207388Z 2025-11-03T15:43:04.9207533Z if enabled: 2025-11-03T15:43:04.9207907Z label = experiment_name 2025-11-03T15:43:04.9208401Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:04.9209153Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:04.9209957Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:04.9210650Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:04.9211244Z if is_canary: 2025-11-03T15:43:04.9211685Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:04.9212176Z fleet_prefix = label 2025-11-03T15:43:04.9212748Z else: 2025-11-03T15:43:04.9213128Z prefixes.append(label) 2025-11-03T15:43:04.9213445Z 2025-11-03T15:43:04.9213603Z if len(prefixes) > 1: 2025-11-03T15:43:04.9214006Z log.error( 2025-11-03T15:43:04.9214939Z 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-11-03T15:43:04.9215958Z ) 2025-11-03T15:43:04.9216302Z prefixes = prefixes[:1] 2025-11-03T15:43:04.9216586Z 2025-11-03T15:43:04.9216755Z # Fleet always comes first 2025-11-03T15:43:04.9217174Z if fleet_prefix: 2025-11-03T15:43:04.9217581Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:04.9217910Z 2025-11-03T15:43:04.9218286Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:04.9218680Z 2025-11-03T15:43:04.9218686Z 2025-11-03T15:43:04.9219097Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:04.9219806Z """ 2025-11-03T15:43:04.9220328Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:04.9220854Z 2025-11-03T15:43:04.9221211Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:04.9221858Z """ 2025-11-03T15:43:04.9222209Z gh = get_gh_client(github_token) 2025-11-03T15:43:04.9222830Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:04.9223403Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:04.9223815Z 2025-11-03T15:43:04.9223826Z 2025-11-03T15:43:04.9224195Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:04.9224887Z for _ in range(num_retries): 2025-11-03T15:43:04.9225323Z try: 2025-11-03T15:43:04.9225710Z req = Request(url=url, headers=headers) 2025-11-03T15:43:04.9226314Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:04.9226898Z return json.loads(content) 2025-11-03T15:43:04.9227367Z except Exception as e: 2025-11-03T15:43:04.9227855Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:04.9228375Z 2025-11-03T15:43:04.9228725Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:04.9229369Z return {} 2025-11-03T15:43:04.9229571Z 2025-11-03T15:43:04.9229577Z 2025-11-03T15:43:04.9229713Z @cache 2025-11-03T15:43:04.9230270Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:04.9230952Z """ 2025-11-03T15:43:04.9231294Z Dynamically get PR information 2025-11-03T15:43:04.9231737Z """ 2025-11-03T15:43:04.9232181Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:04.9232856Z headers = { 2025-11-03T15:43:04.9233261Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:04.9233813Z "Authorization": f"token {github_token}", 2025-11-03T15:43:04.9234295Z } 2025-11-03T15:43:04.9234677Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:04.9235230Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:04.9235723Z headers=headers, 2025-11-03T15:43:04.9236101Z ) 2025-11-03T15:43:04.9236277Z 2025-11-03T15:43:04.9236434Z if not json_response: 2025-11-03T15:43:04.9236948Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:04.9237502Z return {} 2025-11-03T15:43:04.9237717Z 2025-11-03T15:43:04.9237871Z return json_response 2025-11-03T15:43:04.9238116Z 2025-11-03T15:43:04.9238122Z 2025-11-03T15:43:04.9238484Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:04.9239145Z """ 2025-11-03T15:43:04.9239615Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:04.9240196Z """ 2025-11-03T15:43:04.9240625Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:04.9241167Z return { 2025-11-03T15:43:04.9241686Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:04.9242702Z } 2025-11-03T15:43:04.9243003Z 2025-11-03T15:43:04.9243010Z 2025-11-03T15:43:04.9243167Z def main() -> None: 2025-11-03T15:43:04.9243545Z args = parse_args() 2025-11-03T15:43:04.9243785Z 2025-11-03T15:43:04.9243979Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:04.9244331Z 2025-11-03T15:43:04.9244510Z # Check if the PR is opt-out 2025-11-03T15:43:04.9244937Z if args.pr_number: 2025-11-03T15:43:04.9245525Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:04.9246362Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:04.9246821Z log.info( 2025-11-03T15:43:04.9247482Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:04.9248176Z ) 2025-11-03T15:43:04.9248671Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.9249273Z sys.exit() 2025-11-03T15:43:04.9249518Z 2025-11-03T15:43:04.9249665Z try: 2025-11-03T15:43:04.9250046Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:04.9250692Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:04.9251263Z ) 2025-11-03T15:43:04.9251453Z 2025-11-03T15:43:04.9251637Z username = get_potential_pr_author( 2025-11-03T15:43:04.9252128Z args.github_token, 2025-11-03T15:43:04.9252706Z args.github_repo, 2025-11-03T15:43:04.9253143Z args.github_actor, 2025-11-03T15:43:04.9253569Z args.github_ref_type, 2025-11-03T15:43:04.9254023Z args.github_branch, 2025-11-03T15:43:04.9254433Z ) 2025-11-03T15:43:04.9254623Z 2025-11-03T15:43:04.9254883Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:04.9255299Z 2025-11-03T15:43:04.9255523Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:04.9256037Z rollout_state, 2025-11-03T15:43:04.9256608Z (args.github_issue_owner, username), 2025-11-03T15:43:04.9257099Z args.github_branch, 2025-11-03T15:43:04.9257548Z args.eligible_experiments, 2025-11-03T15:43:04.9258038Z args.opt_out_experiments, 2025-11-03T15:43:04.9258497Z is_canary, 2025-11-03T15:43:04.9258859Z ) 2025-11-03T15:43:04.9259048Z 2025-11-03T15:43:04.9259212Z except Exception as e: 2025-11-03T15:43:04.9259612Z log.error( 2025-11-03T15:43:04.9260223Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:04.9260922Z ) 2025-11-03T15:43:04.9261108Z 2025-11-03T15:43:04.9261404Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:04.9261854Z 2025-11-03T15:43:04.9261861Z 2025-11-03T15:43:04.9262024Z if __name__ == "__main__": 2025-11-03T15:43:04.9262414Z main() 2025-11-03T15:43:04.9262752Z 2025-11-03T15:43:04.9352365Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:04.9353367Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:04.9385616Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:04.9386054Z env: 2025-11-03T15:43:04.9386581Z GITHUB_TOKEN: *** 2025-11-03T15:43:04.9386956Z ISSUE_NUMBER: 5132 2025-11-03T15:43:04.9387365Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:04.9387836Z ISSUE_OWNER: 2025-11-03T15:43:04.9388192Z CHECK_EXPERIMENTS: 2025-11-03T15:43:04.9388588Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:04.9388971Z PR_NUMBER: 2025-11-03T15:43:04.9389303Z ##[endgroup] 2025-11-03T15:43:06.4677076Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:07.2035211Z Collecting urllib3==1.26.18 2025-11-03T15:43:07.2815940Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:07.3076867Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.5 MB/s eta 0:00:00 2025-11-03T15:43:07.3407943Z Collecting PyGithub==2.3.0 2025-11-03T15:43:07.3560640Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:07.4090927Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:07.4243439Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:07.4288040Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:07.4304997Z 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-11-03T15:43:07.4320282Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:07.4656934Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:07.4805763Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:07.5029625Z 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-11-03T15:43:07.6494474Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:07.6646444Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:07.8175794Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:07.8329313Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:07.8593086Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:07.8741268Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:07.9106939Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:07.9294994Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.0 MB/s eta 0:00:00 2025-11-03T15:43:07.9467688Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:07.9653431Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 20.6 MB/s eta 0:00:00 2025-11-03T15:43:07.9805130Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:08.0051749Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 60.4 MB/s eta 0:00:00 2025-11-03T15:43:08.0200865Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:08.0373218Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:08.0421831Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 65.3 MB/s eta 0:00:00 2025-11-03T15:43:08.0576026Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:08.0622892Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 37.1 MB/s eta 0:00:00 2025-11-03T15:43:08.0773353Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:08.0823826Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 38.9 MB/s eta 0:00:00 2025-11-03T15:43:08.3845363Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:08.9174810Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:08.9956868Z ##[group]Run curr_branch="main" 2025-11-03T15:43:08.9957189Z curr_branch="main" 2025-11-03T15:43:08.9957425Z curr_ref_type="branch" 2025-11-03T15:43:08.9957678Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:08.9957946Z  2025-11-03T15:43:08.9958129Z python3 runner_determinator.py \ 2025-11-03T15:43:08.9958413Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:08.9958687Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:08.9958950Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:08.9959219Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:08.9959512Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:08.9959790Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:08.9960073Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:08.9960381Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:08.9960738Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:08.9961024Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:08.9994066Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:08.9994297Z env: 2025-11-03T15:43:08.9994847Z GITHUB_TOKEN: *** 2025-11-03T15:43:08.9995035Z ISSUE_NUMBER: 5132 2025-11-03T15:43:08.9995245Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:08.9995481Z ISSUE_OWNER: 2025-11-03T15:43:08.9995662Z CHECK_EXPERIMENTS: 2025-11-03T15:43:08.9995845Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:08.9996035Z PR_NUMBER: 2025-11-03T15:43:08.9996195Z ##[endgroup] 2025-11-03T15:43:09.0045781Z Current branch is 'main' 2025-11-03T15:43:10.5129192Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:10.5131122Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:10.5132062Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:10.5133027Z INFO : Setting output: label-type='' 2025-11-03T15:43:10.5441124Z Evaluate and set job outputs 2025-11-03T15:43:10.5447889Z Cleaning up orphan processes