2025-11-03T15:48:15.1408690Z Current runner version: '2.329.0' 2025-11-03T15:48:15.1435383Z ##[group]Runner Image Provisioner 2025-11-03T15:48:15.1436246Z Hosted Compute Agent 2025-11-03T15:48:15.1436869Z Version: 20251016.436 2025-11-03T15:48:15.1437531Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:48:15.1438238Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:48:15.1438916Z ##[endgroup] 2025-11-03T15:48:15.1439451Z ##[group]Operating System 2025-11-03T15:48:15.1440409Z Ubuntu 2025-11-03T15:48:15.1440977Z 24.04.3 2025-11-03T15:48:15.1441442Z LTS 2025-11-03T15:48:15.1441914Z ##[endgroup] 2025-11-03T15:48:15.1442381Z ##[group]Runner Image 2025-11-03T15:48:15.1443074Z Image: ubuntu-24.04 2025-11-03T15:48:15.1443575Z Version: 20251030.96.2 2025-11-03T15:48:15.1444690Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:48:15.1446469Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:48:15.1447554Z ##[endgroup] 2025-11-03T15:48:15.1448565Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:48:15.1450932Z Contents: read 2025-11-03T15:48:15.1451572Z Metadata: read 2025-11-03T15:48:15.1452035Z ##[endgroup] 2025-11-03T15:48:15.1454199Z Secret source: Actions 2025-11-03T15:48:15.1455360Z Prepare workflow directory 2025-11-03T15:48:15.1973722Z Prepare all required actions 2025-11-03T15:48:15.2033960Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:48:15.2039379Z ##[group] Inputs 2025-11-03T15:48:15.2040384Z check_experiments: 2025-11-03T15:48:15.2040903Z opt_out_experiments: 2025-11-03T15:48:15.2041616Z triggering_actor: pytorchmergebot 2025-11-03T15:48:15.2042194Z issue_owner: 2025-11-03T15:48:15.2042678Z curr_branch: main 2025-11-03T15:48:15.2043333Z curr_ref_type: branch 2025-11-03T15:48:15.2043959Z issue_number: 5132 2025-11-03T15:48:15.2044468Z ##[endgroup] 2025-11-03T15:48:15.2045210Z Complete job name: before-test / get-label-type / runner-determinator 2025-11-03T15:48:15.9405218Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:48:15.9407956Z cat < runner_determinator.py 2025-11-03T15:48:15.9408720Z # flake8: noqa: G004 2025-11-03T15:48:15.9409245Z  2025-11-03T15:48:15.9410301Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:48:15.9411461Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:48:15.9412487Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:48:15.9413226Z  2025-11-03T15:48:15.9413685Z """ 2025-11-03T15:48:15.9414437Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:48:15.9415473Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:48:15.9416793Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:48:15.9417815Z of which runners should be used to run which job. 2025-11-03T15:48:15.9418501Z  2025-11-03T15:48:15.9419276Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:48:15.9420513Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:48:15.9421580Z settings are considered to be empty with only the second part, the user 2025-11-03T15:48:15.9422485Z list, defined. 2025-11-03T15:48:15.9422992Z  2025-11-03T15:48:15.9423634Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:48:15.9424767Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:48:15.9425759Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:48:15.9426445Z  2025-11-03T15:48:15.9427545Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:48:15.9428538Z The user list is also a comma separated list of additional features or 2025-11-03T15:48:15.9429432Z experiments which the user could be opted in to. 2025-11-03T15:48:15.9430299Z  2025-11-03T15:48:15.9430761Z The user list has the following rules: 2025-11-03T15:48:15.9431387Z  2025-11-03T15:48:15.9432052Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:48:15.9433064Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:48:15.9433967Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:48:15.9434630Z  2025-11-03T15:48:15.9435100Z Example config: 2025-11-03T15:48:15.9435667Z  # A list of experiments that can be opted into. 2025-11-03T15:48:15.9436536Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:48:15.9437271Z  # Expected syntax is: 2025-11-03T15:48:15.9438072Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:48:15.9524864Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:48:15.9525994Z  2025-11-03T15:48:15.9526405Z  experiments: 2025-11-03T15:48:15.9526903Z  lf: 2025-11-03T15:48:15.9527353Z  rollout_percent: 25 2025-11-03T15:48:15.9527918Z  all_branches: false 2025-11-03T15:48:15.9528455Z  default: true 2025-11-03T15:48:15.9528952Z  --- 2025-11-03T15:48:15.9529353Z  2025-11-03T15:48:15.9530215Z  # Opt-ins: 2025-11-03T15:48:15.9530931Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:48:15.9532396Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:48:15.9533349Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:48:15.9534130Z  # Experiments should be from the above list. 2025-11-03T15:48:15.9534748Z  2025-11-03T15:48:15.9535173Z  @User1,-lf,split_build 2025-11-03T15:48:15.9535719Z  @User2,lf 2025-11-03T15:48:15.9536194Z  @User3,split_build 2025-11-03T15:48:15.9536706Z """ 2025-11-03T15:48:15.9537108Z  2025-11-03T15:48:15.9537502Z import json 2025-11-03T15:48:15.9537958Z import logging 2025-11-03T15:48:15.9538418Z import os 2025-11-03T15:48:15.9538857Z import random 2025-11-03T15:48:15.9539311Z import re 2025-11-03T15:48:15.9539876Z import sys 2025-11-03T15:48:15.9540364Z from argparse import ArgumentParser 2025-11-03T15:48:15.9541144Z from collections.abc import Iterable 2025-11-03T15:48:15.9541776Z from functools import cache 2025-11-03T15:48:15.9542305Z from logging import LogRecord 2025-11-03T15:48:15.9542874Z from typing import Any, NamedTuple 2025-11-03T15:48:15.9543489Z from urllib.request import Request, urlopen 2025-11-03T15:48:15.9544062Z  2025-11-03T15:48:15.9544425Z import yaml 2025-11-03T15:48:15.9544866Z from github import Auth, Github 2025-11-03T15:48:15.9545419Z from github.Issue import Issue 2025-11-03T15:48:15.9545925Z  2025-11-03T15:48:15.9546278Z  2025-11-03T15:48:15.9546717Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:48:15.9547493Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:48:15.9548450Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:48:15.9549217Z  2025-11-03T15:48:15.9550032Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:48:15.9550661Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:48:15.9551254Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:48:15.9551875Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:48:15.9552408Z  2025-11-03T15:48:15.9552800Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:48:15.9553315Z  2025-11-03T15:48:15.9553690Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:48:15.9554185Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:48:15.9554650Z  2025-11-03T15:48:15.9554983Z  2025-11-03T15:48:15.9555358Z class Experiment(NamedTuple): 2025-11-03T15:48:15.9555870Z  rollout_perc: float = ( 2025-11-03T15:48:15.9556576Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:48:15.9557281Z  ) 2025-11-03T15:48:15.9557676Z  all_branches: bool = ( 2025-11-03T15:48:15.9558382Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:48:15.9559081Z  ) 2025-11-03T15:48:15.9559457Z  default: bool = ( 2025-11-03T15:48:15.9560181Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:48:15.9560850Z  ) 2025-11-03T15:48:15.9561208Z  2025-11-03T15:48:15.9561596Z  # Add more fields as needed 2025-11-03T15:48:15.9562079Z  2025-11-03T15:48:15.9562423Z  2025-11-03T15:48:15.9562794Z class Settings(NamedTuple): 2025-11-03T15:48:15.9563268Z  """ 2025-11-03T15:48:15.9563764Z  Settings for the experiments that can be opted into. 2025-11-03T15:48:15.9564352Z  """ 2025-11-03T15:48:15.9564718Z  2025-11-03T15:48:15.9565120Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:48:15.9565656Z  2025-11-03T15:48:15.9566120Z  2025-11-03T15:48:15.9566543Z class ColorFormatter(logging.Formatter): 2025-11-03T15:48:15.9567214Z  """Color codes the log messages based on the log level""" 2025-11-03T15:48:15.9567813Z  2025-11-03T15:48:15.9568162Z  COLORS = { 2025-11-03T15:48:15.9568605Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:48:15.9569135Z  "ERROR": "\033[31m", # Red 2025-11-03T15:48:15.9570389Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:48:15.9570922Z  "INFO": "\033[0m", # Reset 2025-11-03T15:48:15.9571441Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:48:15.9571925Z  } 2025-11-03T15:48:15.9572300Z  2025-11-03T15:48:15.9572713Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:48:15.9573493Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:48:15.9574290Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:48:15.9574891Z  return super().format(record) 2025-11-03T15:48:15.9575409Z  2025-11-03T15:48:15.9575799Z  2025-11-03T15:48:15.9576240Z handler = logging.StreamHandler() 2025-11-03T15:48:15.9576994Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:48:15.9577714Z  2025-11-03T15:48:15.9578169Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:48:15.9578773Z log.addHandler(handler) 2025-11-03T15:48:15.9579251Z log.setLevel(logging.INFO) 2025-11-03T15:48:15.9579825Z  2025-11-03T15:48:15.9580160Z  2025-11-03T15:48:15.9580637Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:48:15.9581226Z  """ 2025-11-03T15:48:15.9581773Z  Defines outputs of the github action that invokes this script 2025-11-03T15:48:15.9582588Z  """ 2025-11-03T15:48:15.9582971Z  if not GITHUB_OUTPUT: 2025-11-03T15:48:15.9584081Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:48:15.9585185Z  log.warning( 2025-11-03T15:48:15.9586070Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:48:15.9586996Z  ) 2025-11-03T15:48:15.9587454Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:48:15.9588013Z  return 2025-11-03T15:48:15.9588407Z  2025-11-03T15:48:15.9588802Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:48:15.9589398Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:48:15.9590095Z  f.write(f"{key}={value}\n") 2025-11-03T15:48:15.9590596Z  2025-11-03T15:48:15.9590938Z  2025-11-03T15:48:15.9591461Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:48:15.9592125Z  return frozenset( 2025-11-03T15:48:15.9592787Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:48:15.9593459Z  ) 2025-11-03T15:48:15.9593820Z  2025-11-03T15:48:15.9594156Z  2025-11-03T15:48:15.9594515Z def parse_args() -> Any: 2025-11-03T15:48:15.9595124Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:48:15.9596006Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:48:15.9596786Z  parser.add_argument( 2025-11-03T15:48:15.9597276Z  "--github-issue-repo", 2025-11-03T15:48:15.9597813Z  type=str, 2025-11-03T15:48:15.9598261Z  required=False, 2025-11-03T15:48:15.9598869Z  default="pytorch/test-infra", 2025-11-03T15:48:15.9599445Z  help="GitHub repo to get the issue", 2025-11-03T15:48:15.9600060Z  ) 2025-11-03T15:48:15.9600449Z  parser.add_argument( 2025-11-03T15:48:15.9600918Z  "--github-repo", 2025-11-03T15:48:15.9601390Z  type=str, 2025-11-03T15:48:15.9601829Z  required=True, 2025-11-03T15:48:15.9602351Z  help="GitHub repo where CI is running", 2025-11-03T15:48:15.9602883Z  ) 2025-11-03T15:48:15.9603274Z  parser.add_argument( 2025-11-03T15:48:15.9603935Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:48:15.9604593Z  ) 2025-11-03T15:48:15.9604975Z  parser.add_argument( 2025-11-03T15:48:15.9605636Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:48:15.9606331Z  ) 2025-11-03T15:48:15.9606719Z  parser.add_argument( 2025-11-03T15:48:15.9607401Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:48:15.9608095Z  ) 2025-11-03T15:48:15.9608482Z  parser.add_argument( 2025-11-03T15:48:15.9609193Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:48:15.9610156Z  ) 2025-11-03T15:48:15.9610551Z  parser.add_argument( 2025-11-03T15:48:15.9611033Z  "--github-ref-type", 2025-11-03T15:48:15.9611510Z  type=str, 2025-11-03T15:48:15.9611956Z  required=True, 2025-11-03T15:48:15.9612509Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:48:15.9613062Z  ) 2025-11-03T15:48:15.9613451Z  parser.add_argument( 2025-11-03T15:48:15.9614079Z  "--eligible-experiments", 2025-11-03T15:48:15.9614632Z  type=_str_comma_separated_to_set, 2025-11-03T15:48:15.9615214Z  required=False, 2025-11-03T15:48:15.9615715Z  default="", 2025-11-03T15:48:15.9616614Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:48:15.9617535Z  ) 2025-11-03T15:48:15.9617918Z  parser.add_argument( 2025-11-03T15:48:15.9618412Z  "--opt-out-experiments", 2025-11-03T15:48:15.9618957Z  type=_str_comma_separated_to_set, 2025-11-03T15:48:15.9619664Z  required=False, 2025-11-03T15:48:15.9620146Z  default="", 2025-11-03T15:48:15.9620575Z  help=( 2025-11-03T15:48:15.9621275Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:48:15.9622422Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:48:15.9623262Z  ), 2025-11-03T15:48:15.9623639Z  ) 2025-11-03T15:48:15.9624024Z  parser.add_argument( 2025-11-03T15:48:15.9624501Z  "--pr-number", 2025-11-03T15:48:15.9624963Z  type=str, 2025-11-03T15:48:15.9625400Z  required=False, 2025-11-03T15:48:15.9625861Z  default="", 2025-11-03T15:48:15.9626384Z  help="the optional PR number where this is run", 2025-11-03T15:48:15.9626950Z  ) 2025-11-03T15:48:15.9627307Z  2025-11-03T15:48:15.9627682Z  return parser.parse_args() 2025-11-03T15:48:15.9628170Z  2025-11-03T15:48:15.9628503Z  2025-11-03T15:48:15.9629114Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:48:15.9630135Z  auth = Auth.Token(github_token) 2025-11-03T15:48:15.9630683Z  return Github(auth=auth) 2025-11-03T15:48:15.9631156Z  2025-11-03T15:48:15.9631497Z  2025-11-03T15:48:15.9632153Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:48:15.9632967Z  repo = gh.get_repo(repo) 2025-11-03T15:48:15.9633503Z  return repo.get_issue(number=issue_num) 2025-11-03T15:48:15.9634018Z  2025-11-03T15:48:15.9634356Z  2025-11-03T15:48:15.9634717Z def get_potential_pr_author( 2025-11-03T15:48:15.9635397Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:48:15.9636074Z ) -> str: 2025-11-03T15:48:15.9636632Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:48:15.9637476Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:48:15.9638255Z  # embedded in the tag name: ciflow// 2025-11-03T15:48:15.9638834Z  2025-11-03T15:48:15.9639222Z  gh = get_gh_client(github_token) 2025-11-03T15:48:15.9639837Z  2025-11-03T15:48:15.9640312Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:48:15.9640967Z  split_tag = ref_name.split("/") 2025-11-03T15:48:15.9641495Z  if ( 2025-11-03T15:48:15.9641916Z  len(split_tag) == 3 2025-11-03T15:48:15.9642446Z  and split_tag[0] == "ciflow" 2025-11-03T15:48:15.9642991Z  and split_tag[2].isnumeric() 2025-11-03T15:48:15.9643494Z  ): 2025-11-03T15:48:15.9643913Z  pr_number = split_tag[2] 2025-11-03T15:48:15.9644418Z  try: 2025-11-03T15:48:15.9644885Z  repository = gh.get_repo(repo) 2025-11-03T15:48:15.9645662Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:48:15.9646296Z  except Exception as e: 2025-11-03T15:48:15.9646842Z  raise Exception( # noqa: TRY002 2025-11-03T15:48:15.9647533Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:48:15.9648184Z  ) from e 2025-11-03T15:48:15.9648782Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:48:15.9649645Z  # In all other cases, return the original input username 2025-11-03T15:48:15.9650257Z  return username 2025-11-03T15:48:15.9650690Z  2025-11-03T15:48:15.9651187Z  2025-11-03T15:48:15.9651851Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:48:15.9652430Z  """ 2025-11-03T15:48:15.9653121Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:48:15.9653925Z  """ 2025-11-03T15:48:15.9654500Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:48:15.9655188Z  2025-11-03T15:48:15.9655521Z  2025-11-03T15:48:15.9655915Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:48:15.9656421Z  try: 2025-11-03T15:48:15.9656843Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:48:15.9657368Z  return data 2025-11-03T15:48:15.9657830Z  except yaml.YAMLError: 2025-11-03T15:48:15.9658375Z  log.exception("Error loading YAML") 2025-11-03T15:48:15.9658906Z  raise 2025-11-03T15:48:15.9659307Z  2025-11-03T15:48:15.9659762Z  2025-11-03T15:48:15.9660391Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:48:15.9661138Z  """ 2025-11-03T15:48:15.9661947Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:48:15.9662712Z  2025-11-03T15:48:15.9663253Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:48:15.9664033Z  and the text below is the list of opted in users. 2025-11-03T15:48:15.9664589Z  2025-11-03T15:48:15.9665170Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:48:15.9665871Z  """ 2025-11-03T15:48:15.9666349Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:48:15.9666979Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:48:15.9667615Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:48:15.9668439Z  else: 2025-11-03T15:48:15.9668897Z  return "", rollout_state 2025-11-03T15:48:15.9669382Z  2025-11-03T15:48:15.9669812Z  2025-11-03T15:48:15.9670221Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:48:15.9670739Z  """ 2025-11-03T15:48:15.9671293Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:48:15.9671949Z  """ 2025-11-03T15:48:15.9672301Z  2025-11-03T15:48:15.9672632Z  2025-11-03T15:48:15.9673155Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:48:15.9673819Z  """ 2025-11-03T15:48:15.9674552Z  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:48:15.9675382Z  2025-11-03T15:48:15.9676188Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:48:15.9677193Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:48:15.9678022Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:48:15.9678651Z  2025-11-03T15:48:15.9678975Z  2025-11-03T15:48:15.9679300Z  """ 2025-11-03T15:48:15.9679792Z  optins = UserOptins() 2025-11-03T15:48:15.9680331Z  for user in user_optin_text.split("\n"): 2025-11-03T15:48:15.9680903Z  user = user.strip("\r\n\t -") 2025-11-03T15:48:15.9681478Z  if not user or not user.startswith("@"): 2025-11-03T15:48:15.9682090Z  # Not a valid user. Skip 2025-11-03T15:48:15.9682595Z  continue 2025-11-03T15:48:15.9683005Z  2025-11-03T15:48:15.9683384Z  if user: 2025-11-03T15:48:15.9683856Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:48:15.9684568Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:48:15.9685215Z  2025-11-03T15:48:15.9685565Z  return optins 2025-11-03T15:48:15.9685982Z  2025-11-03T15:48:15.9686305Z  2025-11-03T15:48:15.9686809Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:48:15.9687421Z  """ 2025-11-03T15:48:15.9687847Z  Check if the experiment name is valid. 2025-11-03T15:48:15.9688388Z  A valid name: 2025-11-03T15:48:15.9689072Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:48:15.9690126Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:48:15.9690841Z  - Cannot contain spaces 2025-11-03T15:48:15.9691328Z  """ 2025-11-03T15:48:15.9691682Z  2025-11-03T15:48:15.9692138Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:48:15.9692862Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:48:15.9693637Z  2025-11-03T15:48:15.9694184Z  if valid: 2025-11-03T15:48:15.9694592Z  return True 2025-11-03T15:48:15.9695008Z  2025-11-03T15:48:15.9695347Z  log.error( 2025-11-03T15:48:15.9696804Z  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:48:15.9698367Z  ) 2025-11-03T15:48:15.9698736Z  return False 2025-11-03T15:48:15.9699150Z  2025-11-03T15:48:15.9699573Z  2025-11-03T15:48:15.9700104Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:48:15.9700748Z  """ 2025-11-03T15:48:15.9701372Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:48:15.9702089Z  """ 2025-11-03T15:48:15.9702454Z  try: 2025-11-03T15:48:15.9702841Z  if settings_text: 2025-11-03T15:48:15.9703597Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:48:15.9704393Z  # for easy reading 2025-11-03T15:48:15.9705245Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:48:15.9706150Z  # the backtick character in shell commands. 2025-11-03T15:48:15.9706770Z  backtick = chr(96) # backtick character 2025-11-03T15:48:15.9707458Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:48:15.9708137Z  settings = load_yaml(settings_text) 2025-11-03T15:48:15.9708643Z  2025-11-03T15:48:15.9709238Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:48:15.9710222Z  experiments = {} 2025-11-03T15:48:15.9710681Z  2025-11-03T15:48:15.9711240Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:48:15.9712006Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:48:15.9713113Z  # 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:48:15.9714150Z  continue 2025-11-03T15:48:15.9714603Z  2025-11-03T15:48:15.9714973Z  valid_settings = {} 2025-11-03T15:48:15.9715511Z  for setting in exp_settings: 2025-11-03T15:48:15.9716098Z  if setting not in Experiment._fields: 2025-11-03T15:48:15.9716667Z  log.warning( 2025-11-03T15:48:15.9717411Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:48:15.9718125Z  ) 2025-11-03T15:48:15.9718577Z  else: 2025-11-03T15:48:15.9719136Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:48:15.9719794Z  2025-11-03T15:48:15.9720272Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:48:15.9720930Z  return Settings(experiments) 2025-11-03T15:48:15.9721436Z  2025-11-03T15:48:15.9721786Z  except Exception: 2025-11-03T15:48:15.9722311Z  log.exception("Failed to parse settings") 2025-11-03T15:48:15.9722850Z  2025-11-03T15:48:15.9723194Z  return Settings() 2025-11-03T15:48:15.9723620Z  2025-11-03T15:48:15.9723954Z  2025-11-03T15:48:15.9724539Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:48:15.9725125Z  """ 2025-11-03T15:48:15.9725590Z  Parse settings, if any, from the rollout state. 2025-11-03T15:48:15.9726139Z  2025-11-03T15:48:15.9726683Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:48:15.9727460Z  and the text below is the list of opted in users. 2025-11-03T15:48:15.9728012Z  2025-11-03T15:48:15.9728616Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:48:15.9729340Z  """ 2025-11-03T15:48:15.9730109Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:48:15.9730896Z  return parse_settings_from_text(settings_text) 2025-11-03T15:48:15.9731442Z  2025-11-03T15:48:15.9731769Z  2025-11-03T15:48:15.9732247Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:48:15.9732824Z  """ 2025-11-03T15:48:15.9733234Z  Parse users from the rollout state. 2025-11-03T15:48:15.9733739Z  2025-11-03T15:48:15.9734064Z  """ 2025-11-03T15:48:15.9734628Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:48:15.9735390Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:48:15.9735937Z  2025-11-03T15:48:15.9736271Z  2025-11-03T15:48:15.9736887Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:48:15.9737687Z  """ 2025-11-03T15:48:15.9738132Z  Check if a user is opted into an experiment 2025-11-03T15:48:15.9738674Z  """ 2025-11-03T15:48:15.9739156Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:48:15.9739828Z  2025-11-03T15:48:15.9740286Z  2025-11-03T15:48:15.9740913Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:48:15.9741672Z  """ 2025-11-03T15:48:15.9742158Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:48:15.9742751Z  """ 2025-11-03T15:48:15.9743282Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:48:15.9743999Z  experiment_optout = "-" + experiment_name 2025-11-03T15:48:15.9744676Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:48:15.9745290Z  return False 2025-11-03T15:48:15.9745719Z  2025-11-03T15:48:15.9746184Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:48:15.9746799Z  log.warning( 2025-11-03T15:48:15.9747641Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:48:15.9748539Z  ) 2025-11-03T15:48:15.9748916Z  2025-11-03T15:48:15.9749264Z  return True 2025-11-03T15:48:15.9749798Z  2025-11-03T15:48:15.9750132Z  2025-11-03T15:48:15.9750491Z def get_runner_prefix( 2025-11-03T15:48:15.9750956Z  rollout_state: str, 2025-11-03T15:48:15.9751465Z  workflow_requestors: Iterable[str], 2025-11-03T15:48:15.9751987Z  branch: str, 2025-11-03T15:48:15.9752544Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:48:15.9753255Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:48:15.9753856Z  is_canary: bool = False, 2025-11-03T15:48:15.9754329Z ) -> str: 2025-11-03T15:48:15.9754775Z  settings = parse_settings(rollout_state) 2025-11-03T15:48:15.9755386Z  user_optins = parse_users(rollout_state) 2025-11-03T15:48:15.9755918Z  2025-11-03T15:48:15.9756405Z  fleet_prefix = "" 2025-11-03T15:48:15.9756868Z  prefixes = [] 2025-11-03T15:48:15.9757547Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:48:15.9758525Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:48:15.9759243Z  log.info( 2025-11-03T15:48:15.9760073Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:48:15.9760830Z  ) 2025-11-03T15:48:15.9761251Z  continue 2025-11-03T15:48:15.9761673Z  2025-11-03T15:48:15.9762040Z  if opt_out_experiments: 2025-11-03T15:48:15.9762617Z  if experiment_name in opt_out_experiments: 2025-11-03T15:48:15.9763272Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:48:15.9763877Z  log.info( 2025-11-03T15:48:15.9764841Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:48:15.9765869Z  ) 2025-11-03T15:48:15.9766300Z  continue 2025-11-03T15:48:15.9766739Z  2025-11-03T15:48:15.9767111Z  if eligible_experiments: 2025-11-03T15:48:15.9767701Z  if experiment_name not in eligible_experiments: 2025-11-03T15:48:15.9768358Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:48:15.9768921Z  log.info( 2025-11-03T15:48:15.9769834Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:48:15.9770688Z  ) 2025-11-03T15:48:15.9771237Z  continue 2025-11-03T15:48:15.9771761Z  elif not experiment_settings.default: 2025-11-03T15:48:15.9772300Z  log.info( 2025-11-03T15:48:15.9772989Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:48:15.9773723Z  ) 2025-11-03T15:48:15.9774129Z  continue 2025-11-03T15:48:15.9774550Z  2025-11-03T15:48:15.9775021Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:48:15.9775649Z  opted_out_users = [ 2025-11-03T15:48:15.9776116Z  requestor 2025-11-03T15:48:15.9776613Z  for requestor in workflow_requestors 2025-11-03T15:48:15.9777326Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:48:15.9777960Z  ] 2025-11-03T15:48:15.9778334Z  2025-11-03T15:48:15.9778688Z  if opted_out_users: 2025-11-03T15:48:15.9779166Z  log.info( 2025-11-03T15:48:15.9779925Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:48:15.9780626Z  ) 2025-11-03T15:48:15.9781024Z  continue 2025-11-03T15:48:15.9781446Z  2025-11-03T15:48:15.9781922Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:48:15.9782538Z  opted_in_users = [ 2025-11-03T15:48:15.9783021Z  requestor 2025-11-03T15:48:15.9783512Z  for requestor in workflow_requestors 2025-11-03T15:48:15.9784200Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:48:15.9784816Z  ] 2025-11-03T15:48:15.9785188Z  2025-11-03T15:48:15.9785533Z  enabled = False 2025-11-03T15:48:15.9786007Z  if opted_in_users: 2025-11-03T15:48:15.9786613Z  log.info( 2025-11-03T15:48:15.9787263Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:48:15.9787942Z  ) 2025-11-03T15:48:15.9788336Z  enabled = True 2025-11-03T15:48:15.9788831Z  2025-11-03T15:48:15.9789284Z  elif experiment_settings.rollout_perc: 2025-11-03T15:48:15.9790240Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:48:15.9791184Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:48:15.9791828Z  log.info( 2025-11-03T15:48:15.9792720Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:48:15.9793678Z  ) 2025-11-03T15:48:15.9794177Z  enabled = True 2025-11-03T15:48:15.9794651Z  2025-11-03T15:48:15.9794993Z  if enabled: 2025-11-03T15:48:15.9795461Z  label = experiment_name 2025-11-03T15:48:15.9796023Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:48:15.9796871Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:48:15.9797803Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:48:15.9798579Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:48:15.9799250Z  if is_canary: 2025-11-03T15:48:15.9799861Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:48:15.9800411Z  fleet_prefix = label 2025-11-03T15:48:15.9800912Z  else: 2025-11-03T15:48:15.9801519Z  prefixes.append(label) 2025-11-03T15:48:15.9802017Z  2025-11-03T15:48:15.9802382Z  if len(prefixes) > 1: 2025-11-03T15:48:15.9802853Z  log.error( 2025-11-03T15:48:15.9803910Z  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:48:15.9805013Z  ) 2025-11-03T15:48:15.9805420Z  prefixes = prefixes[:1] 2025-11-03T15:48:15.9805906Z  2025-11-03T15:48:15.9806272Z  # Fleet always comes first 2025-11-03T15:48:15.9806777Z  if fleet_prefix: 2025-11-03T15:48:15.9807263Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:48:15.9807768Z  2025-11-03T15:48:15.9808220Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:48:15.9808782Z  2025-11-03T15:48:15.9809117Z  2025-11-03T15:48:15.9809862Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:48:15.9810636Z  """ 2025-11-03T15:48:15.9811244Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:48:15.9811946Z  2025-11-03T15:48:15.9812529Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:48:15.9813223Z  """ 2025-11-03T15:48:15.9813633Z  gh = get_gh_client(github_token) 2025-11-03T15:48:15.9814194Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:48:15.9814858Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:48:15.9815511Z  2025-11-03T15:48:15.9815888Z  2025-11-03T15:48:15.9816514Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:48:15.9817390Z  for _ in range(num_retries): 2025-11-03T15:48:15.9817937Z  try: 2025-11-03T15:48:15.9818389Z  req = Request(url=url, headers=headers) 2025-11-03T15:48:15.9819118Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:48:15.9819875Z  return json.loads(content) 2025-11-03T15:48:15.9820406Z  except Exception as e: 2025-11-03T15:48:15.9820986Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:48:15.9821528Z  2025-11-03T15:48:15.9822103Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:48:15.9822807Z  return {} 2025-11-03T15:48:15.9823200Z  2025-11-03T15:48:15.9823528Z  2025-11-03T15:48:15.9823865Z @cache 2025-11-03T15:48:15.9824512Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:48:15.9825267Z  """ 2025-11-03T15:48:15.9825678Z  Dynamically get PR information 2025-11-03T15:48:15.9826167Z  """ 2025-11-03T15:48:15.9826688Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:48:15.9827315Z  headers = { 2025-11-03T15:48:15.9827809Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:48:15.9828438Z  "Authorization": f"token {github_token}", 2025-11-03T15:48:15.9828972Z  } 2025-11-03T15:48:15.9829427Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:48:15.9830135Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:48:15.9830688Z  headers=headers, 2025-11-03T15:48:15.9831136Z  ) 2025-11-03T15:48:15.9831492Z  2025-11-03T15:48:15.9831847Z  if not json_response: 2025-11-03T15:48:15.9832458Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:48:15.9833229Z  return {} 2025-11-03T15:48:15.9833634Z  2025-11-03T15:48:15.9833999Z  return json_response 2025-11-03T15:48:15.9834442Z  2025-11-03T15:48:15.9834771Z  2025-11-03T15:48:15.9835358Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:48:15.9836081Z  """ 2025-11-03T15:48:15.9836630Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:48:15.9837276Z  """ 2025-11-03T15:48:15.9837782Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:48:15.9838384Z  return { 2025-11-03T15:48:15.9838993Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:48:15.9839770Z  } 2025-11-03T15:48:15.9840127Z  2025-11-03T15:48:15.9840461Z  2025-11-03T15:48:15.9840826Z def main() -> None: 2025-11-03T15:48:15.9841274Z  args = parse_args() 2025-11-03T15:48:15.9841716Z  2025-11-03T15:48:15.9842138Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:48:15.9842670Z  2025-11-03T15:48:15.9843039Z  # Check if the PR is opt-out 2025-11-03T15:48:15.9843541Z  if args.pr_number: 2025-11-03T15:48:15.9844241Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:48:15.9844991Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:48:15.9845499Z  log.info( 2025-11-03T15:48:15.9846222Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:48:15.9846965Z  ) 2025-11-03T15:48:15.9847546Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:48:15.9848219Z  sys.exit() 2025-11-03T15:48:15.9848793Z  2025-11-03T15:48:15.9849130Z  try: 2025-11-03T15:48:15.9849686Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:48:15.9850408Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:48:15.9851043Z  ) 2025-11-03T15:48:15.9851410Z  2025-11-03T15:48:15.9851803Z  username = get_potential_pr_author( 2025-11-03T15:48:15.9852348Z  args.github_token, 2025-11-03T15:48:15.9852842Z  args.github_repo, 2025-11-03T15:48:15.9853342Z  args.github_actor, 2025-11-03T15:48:15.9853849Z  args.github_ref_type, 2025-11-03T15:48:15.9854354Z  args.github_branch, 2025-11-03T15:48:15.9854820Z  ) 2025-11-03T15:48:15.9855186Z  2025-11-03T15:48:15.9855675Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:48:15.9856273Z  2025-11-03T15:48:15.9856687Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:48:15.9857240Z  rollout_state, 2025-11-03T15:48:15.9857765Z  (args.github_issue_owner, username), 2025-11-03T15:48:15.9858322Z  args.github_branch, 2025-11-03T15:48:15.9858837Z  args.eligible_experiments, 2025-11-03T15:48:15.9859391Z  args.opt_out_experiments, 2025-11-03T15:48:15.9860001Z  is_canary, 2025-11-03T15:48:15.9860433Z  ) 2025-11-03T15:48:15.9860799Z  2025-11-03T15:48:15.9861172Z  except Exception as e: 2025-11-03T15:48:15.9861643Z  log.error( 2025-11-03T15:48:15.9862356Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:48:15.9863233Z  ) 2025-11-03T15:48:15.9863606Z  2025-11-03T15:48:15.9864135Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:48:15.9864775Z  2025-11-03T15:48:15.9865127Z  2025-11-03T15:48:15.9865479Z if __name__ == "__main__": 2025-11-03T15:48:15.9865934Z  main() 2025-11-03T15:48:15.9866310Z  2025-11-03T15:48:15.9866634Z EOF 2025-11-03T15:48:15.9866981Z  2025-11-03T15:48:15.9867341Z cat runner_determinator.py 2025-11-03T15:48:16.0964253Z shell: /usr/bin/bash -e {0} 2025-11-03T15:48:16.0965410Z env: 2025-11-03T15:48:16.0966478Z GITHUB_TOKEN: *** 2025-11-03T15:48:16.0967130Z ISSUE_NUMBER: 5132 2025-11-03T15:48:16.0967847Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:48:16.0968653Z ISSUE_OWNER: 2025-11-03T15:48:16.0969284Z CHECK_EXPERIMENTS: 2025-11-03T15:48:16.0970219Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:48:16.0970894Z PR_NUMBER: 2025-11-03T15:48:16.0971517Z ##[endgroup] 2025-11-03T15:48:16.1217018Z # flake8: noqa: G004 2025-11-03T15:48:16.1217367Z 2025-11-03T15:48:16.1217805Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:48:16.1218786Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:48:16.1219994Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:48:16.1220504Z 2025-11-03T15:48:16.1220659Z """ 2025-11-03T15:48:16.1221240Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:48:16.1222133Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:48:16.1223069Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:48:16.1223882Z of which runners should be used to run which job. 2025-11-03T15:48:16.1224297Z 2025-11-03T15:48:16.1224681Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:48:16.1225918Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:48:16.1226833Z settings are considered to be empty with only the second part, the user 2025-11-03T15:48:16.1227567Z list, defined. 2025-11-03T15:48:16.1227809Z 2025-11-03T15:48:16.1228190Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:48:16.1229089Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:48:16.1230251Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:48:16.1230696Z 2025-11-03T15:48:16.1231049Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:48:16.1231897Z The user list is also a comma separated list of additional features or 2025-11-03T15:48:16.1232598Z experiments which the user could be opted in to. 2025-11-03T15:48:16.1232990Z 2025-11-03T15:48:16.1233177Z The user list has the following rules: 2025-11-03T15:48:16.1233511Z 2025-11-03T15:48:16.1233825Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:48:16.1234671Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:48:16.1235399Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:48:16.1235773Z 2025-11-03T15:48:16.1235921Z Example config: 2025-11-03T15:48:16.1236344Z # A list of experiments that can be opted into. 2025-11-03T15:48:16.1236970Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:48:16.1237558Z # Expected syntax is: 2025-11-03T15:48:16.1238210Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:48:16.1239161Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:48:16.1240020Z 2025-11-03T15:48:16.1240184Z experiments: 2025-11-03T15:48:16.1240541Z lf: 2025-11-03T15:48:16.1240896Z rollout_percent: 25 2025-11-03T15:48:16.1241565Z all_branches: false 2025-11-03T15:48:16.1241994Z default: true 2025-11-03T15:48:16.1242367Z --- 2025-11-03T15:48:16.1242557Z 2025-11-03T15:48:16.1242705Z # Opt-ins: 2025-11-03T15:48:16.1243242Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:48:16.1244072Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:48:16.1244881Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:48:16.1245589Z # Experiments should be from the above list. 2025-11-03T15:48:16.1245945Z 2025-11-03T15:48:16.1246115Z @User1,-lf,split_build 2025-11-03T15:48:16.1246512Z @User2,lf 2025-11-03T15:48:16.1246869Z @User3,split_build 2025-11-03T15:48:16.1247245Z """ 2025-11-03T15:48:16.1247431Z 2025-11-03T15:48:16.1247581Z import json 2025-11-03T15:48:16.1247913Z import logging 2025-11-03T15:48:16.1248260Z import os 2025-11-03T15:48:16.1248585Z import random 2025-11-03T15:48:16.1248933Z import re 2025-11-03T15:48:16.1249268Z import sys 2025-11-03T15:48:16.1249949Z from argparse import ArgumentParser 2025-11-03T15:48:16.1250465Z from collections.abc import Iterable 2025-11-03T15:48:16.1250949Z from functools import cache 2025-11-03T15:48:16.1251388Z from logging import LogRecord 2025-11-03T15:48:16.1251847Z from typing import Any, NamedTuple 2025-11-03T15:48:16.1252347Z from urllib.request import Request, urlopen 2025-11-03T15:48:16.1252694Z 2025-11-03T15:48:16.1252837Z import yaml 2025-11-03T15:48:16.1253200Z from github import Auth, Github 2025-11-03T15:48:16.1253652Z from github.Issue import Issue 2025-11-03T15:48:16.1253946Z 2025-11-03T15:48:16.1253952Z 2025-11-03T15:48:16.1254153Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:48:16.1254799Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:48:16.1255618Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:48:16.1256157Z 2025-11-03T15:48:16.1256373Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:48:16.1257054Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:48:16.1257547Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:48:16.1258059Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:48:16.1258395Z 2025-11-03T15:48:16.1258572Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:48:16.1258878Z 2025-11-03T15:48:16.1259048Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:48:16.1259672Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:48:16.1260044Z 2025-11-03T15:48:16.1260050Z 2025-11-03T15:48:16.1260225Z class Experiment(NamedTuple): 2025-11-03T15:48:16.1260659Z rollout_perc: float = ( 2025-11-03T15:48:16.1261263Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:48:16.1261897Z ) 2025-11-03T15:48:16.1262227Z all_branches: bool = ( 2025-11-03T15:48:16.1262813Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:48:16.1263432Z ) 2025-11-03T15:48:16.1263767Z default: bool = ( 2025-11-03T15:48:16.1264305Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:48:16.1264907Z ) 2025-11-03T15:48:16.1265083Z 2025-11-03T15:48:16.1265244Z # Add more fields as needed 2025-11-03T15:48:16.1265532Z 2025-11-03T15:48:16.1265538Z 2025-11-03T15:48:16.1265706Z class Settings(NamedTuple): 2025-11-03T15:48:16.1266107Z """ 2025-11-03T15:48:16.1266524Z Settings for the experiments that can be opted into. 2025-11-03T15:48:16.1267058Z """ 2025-11-03T15:48:16.1267231Z 2025-11-03T15:48:16.1267423Z experiments: dict[str, Experiment] = {} 2025-11-03T15:48:16.1267764Z 2025-11-03T15:48:16.1267770Z 2025-11-03T15:48:16.1267956Z class ColorFormatter(logging.Formatter): 2025-11-03T15:48:16.1268522Z """Color codes the log messages based on the log level""" 2025-11-03T15:48:16.1268938Z 2025-11-03T15:48:16.1269080Z COLORS = { 2025-11-03T15:48:16.1269446Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:48:16.1270481Z "ERROR": "\033[31m", # Red 2025-11-03T15:48:16.1270948Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:48:16.1271399Z "INFO": "\033[0m", # Reset 2025-11-03T15:48:16.1271849Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:48:16.1272277Z } 2025-11-03T15:48:16.1272461Z 2025-11-03T15:48:16.1272660Z def format(self, record: LogRecord) -> str: 2025-11-03T15:48:16.1273357Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:48:16.1274082Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:48:16.1274619Z return super().format(record) 2025-11-03T15:48:16.1274937Z 2025-11-03T15:48:16.1274943Z 2025-11-03T15:48:16.1275116Z handler = logging.StreamHandler() 2025-11-03T15:48:16.1275804Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:48:16.1276320Z 2025-11-03T15:48:16.1276544Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:48:16.1277086Z log.addHandler(handler) 2025-11-03T15:48:16.1277492Z log.setLevel(logging.INFO) 2025-11-03T15:48:16.1277768Z 2025-11-03T15:48:16.1277774Z 2025-11-03T15:48:16.1278003Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:48:16.1278534Z """ 2025-11-03T15:48:16.1278988Z Defines outputs of the github action that invokes this script 2025-11-03T15:48:16.1279779Z """ 2025-11-03T15:48:16.1280124Z if not GITHUB_OUTPUT: 2025-11-03T15:48:16.1281147Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:48:16.1282198Z log.warning( 2025-11-03T15:48:16.1282998Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:48:16.1283860Z ) 2025-11-03T15:48:16.1294722Z print(f"::set-output name={key}::{value}") 2025-11-03T15:48:16.1295293Z return 2025-11-03T15:48:16.1295521Z 2025-11-03T15:48:16.1295891Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:48:16.1296456Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:48:16.1297040Z f.write(f"{key}={value}\n") 2025-11-03T15:48:16.1297355Z 2025-11-03T15:48:16.1297361Z 2025-11-03T15:48:16.1297641Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:48:16.1298236Z return frozenset( 2025-11-03T15:48:16.1298798Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:48:16.1299426Z ) 2025-11-03T15:48:16.1299876Z 2025-11-03T15:48:16.1299883Z 2025-11-03T15:48:16.1300056Z def parse_args() -> Any: 2025-11-03T15:48:16.1300583Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:48:16.1301381Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:48:16.1302125Z parser.add_argument( 2025-11-03T15:48:16.1302548Z "--github-issue-repo", 2025-11-03T15:48:16.1302976Z type=str, 2025-11-03T15:48:16.1303342Z required=False, 2025-11-03T15:48:16.1303747Z default="pytorch/test-infra", 2025-11-03T15:48:16.1304244Z help="GitHub repo to get the issue", 2025-11-03T15:48:16.1304712Z ) 2025-11-03T15:48:16.1305043Z parser.add_argument( 2025-11-03T15:48:16.1305439Z "--github-repo", 2025-11-03T15:48:16.1305828Z type=str, 2025-11-03T15:48:16.1306172Z required=True, 2025-11-03T15:48:16.1364687Z help="GitHub repo where CI is running", 2025-11-03T15:48:16.1365578Z ) 2025-11-03T15:48:16.1365978Z parser.add_argument( 2025-11-03T15:48:16.1366647Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:48:16.1367322Z ) 2025-11-03T15:48:16.1367687Z parser.add_argument( 2025-11-03T15:48:16.1368307Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:48:16.1368997Z ) 2025-11-03T15:48:16.1369363Z parser.add_argument( 2025-11-03T15:48:16.1370558Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:48:16.1371264Z ) 2025-11-03T15:48:16.1371615Z parser.add_argument( 2025-11-03T15:48:16.1372272Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:48:16.1372989Z ) 2025-11-03T15:48:16.1373346Z parser.add_argument( 2025-11-03T15:48:16.1373780Z "--github-ref-type", 2025-11-03T15:48:16.1374227Z type=str, 2025-11-03T15:48:16.1374613Z required=True, 2025-11-03T15:48:16.1375077Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:48:16.1375621Z ) 2025-11-03T15:48:16.1375971Z parser.add_argument( 2025-11-03T15:48:16.1376411Z "--eligible-experiments", 2025-11-03T15:48:16.1376908Z type=_str_comma_separated_to_set, 2025-11-03T15:48:16.1377419Z required=False, 2025-11-03T15:48:16.1377821Z default="", 2025-11-03T15:48:16.1378679Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:48:16.1379954Z ) 2025-11-03T15:48:16.1380326Z parser.add_argument( 2025-11-03T15:48:16.1380772Z "--opt-out-experiments", 2025-11-03T15:48:16.1381260Z type=_str_comma_separated_to_set, 2025-11-03T15:48:16.1381777Z required=False, 2025-11-03T15:48:16.1382176Z default="", 2025-11-03T15:48:16.1382552Z help=( 2025-11-03T15:48:16.1383206Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:48:16.1384375Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:48:16.1385221Z ), 2025-11-03T15:48:16.1385555Z ) 2025-11-03T15:48:16.1385888Z parser.add_argument( 2025-11-03T15:48:16.1386297Z "--pr-number", 2025-11-03T15:48:16.1386675Z type=str, 2025-11-03T15:48:16.1387034Z required=False, 2025-11-03T15:48:16.1387428Z default="", 2025-11-03T15:48:16.1388047Z help="the optional PR number where this is run", 2025-11-03T15:48:16.1388578Z ) 2025-11-03T15:48:16.1388761Z 2025-11-03T15:48:16.1388936Z return parser.parse_args() 2025-11-03T15:48:16.1389236Z 2025-11-03T15:48:16.1389242Z 2025-11-03T15:48:16.1389754Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:48:16.1390494Z auth = Auth.Token(github_token) 2025-11-03T15:48:16.1390967Z return Github(auth=auth) 2025-11-03T15:48:16.1391240Z 2025-11-03T15:48:16.1391247Z 2025-11-03T15:48:16.1391686Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:48:16.1392435Z repo = gh.get_repo(repo) 2025-11-03T15:48:16.1392901Z return repo.get_issue(number=issue_num) 2025-11-03T15:48:16.1393244Z 2025-11-03T15:48:16.1393250Z 2025-11-03T15:48:16.1393425Z def get_potential_pr_author( 2025-11-03T15:48:16.1394047Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:48:16.1394686Z ) -> str: 2025-11-03T15:48:16.1395162Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:48:16.1395934Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:48:16.1396634Z # embedded in the tag name: ciflow// 2025-11-03T15:48:16.1397077Z 2025-11-03T15:48:16.1397247Z gh = get_gh_client(github_token) 2025-11-03T15:48:16.1397560Z 2025-11-03T15:48:16.1397807Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:48:16.1398397Z split_tag = ref_name.split("/") 2025-11-03T15:48:16.1398867Z if ( 2025-11-03T15:48:16.1399219Z len(split_tag) == 3 2025-11-03T15:48:16.1399760Z and split_tag[0] == "ciflow" 2025-11-03T15:48:16.1400246Z and split_tag[2].isnumeric() 2025-11-03T15:48:16.1400707Z ): 2025-11-03T15:48:16.1401053Z pr_number = split_tag[2] 2025-11-03T15:48:16.1401679Z try: 2025-11-03T15:48:16.1402073Z repository = gh.get_repo(repo) 2025-11-03T15:48:16.1402656Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:48:16.1403224Z except Exception as e: 2025-11-03T15:48:16.1403705Z raise Exception( # noqa: TRY002 2025-11-03T15:48:16.1404333Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:48:16.1404933Z ) from e 2025-11-03T15:48:16.1405456Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:48:16.1406106Z # In all other cases, return the original input username 2025-11-03T15:48:16.1406664Z return username 2025-11-03T15:48:16.1406883Z 2025-11-03T15:48:16.1406890Z 2025-11-03T15:48:16.1407135Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:48:16.1407644Z """ 2025-11-03T15:48:16.1408253Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:48:16.1408991Z """ 2025-11-03T15:48:16.1409726Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:48:16.1410370Z 2025-11-03T15:48:16.1410376Z 2025-11-03T15:48:16.1410564Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:48:16.1411027Z try: 2025-11-03T15:48:16.1411378Z data = yaml.safe_load(yaml_text) 2025-11-03T15:48:16.1411854Z return data 2025-11-03T15:48:16.1412251Z except yaml.YAMLError: 2025-11-03T15:48:16.1412699Z log.exception("Error loading YAML") 2025-11-03T15:48:16.1413179Z raise 2025-11-03T15:48:16.1413378Z 2025-11-03T15:48:16.1413384Z 2025-11-03T15:48:16.1413774Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:48:16.1414467Z """ 2025-11-03T15:48:16.1415046Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:48:16.1415619Z 2025-11-03T15:48:16.1416112Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:48:16.1416838Z and the text below is the list of opted in users. 2025-11-03T15:48:16.1417219Z 2025-11-03T15:48:16.1417571Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:48:16.1418239Z """ 2025-11-03T15:48:16.1418641Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:48:16.1419208Z if len(rollout_state_parts) >= 2: 2025-11-03T15:48:16.1420109Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:48:16.1420677Z else: 2025-11-03T15:48:16.1421029Z return "", rollout_state 2025-11-03T15:48:16.1421325Z 2025-11-03T15:48:16.1421332Z 2025-11-03T15:48:16.1421514Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:48:16.1421990Z """ 2025-11-03T15:48:16.1422473Z Dictionary of users with a list of features they have opted into 2025-11-03T15:48:16.1423085Z """ 2025-11-03T15:48:16.1423280Z 2025-11-03T15:48:16.1423286Z 2025-11-03T15:48:16.1423608Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:48:16.1424230Z """ 2025-11-03T15:48:16.1424899Z 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:48:16.1425569Z 2025-11-03T15:48:16.1426160Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:48:16.1427106Z - Example line: "@User1,lf,split_build" 2025-11-03T15:48:16.1427745Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:48:16.1428200Z 2025-11-03T15:48:16.1428207Z 2025-11-03T15:48:16.1428350Z """ 2025-11-03T15:48:16.1428684Z optins = UserOptins() 2025-11-03T15:48:16.1429134Z for user in user_optin_text.split("\n"): 2025-11-03T15:48:16.1429857Z user = user.strip("\r\n\t -") 2025-11-03T15:48:16.1430361Z if not user or not user.startswith("@"): 2025-11-03T15:48:16.1431061Z # Not a valid user. Skip 2025-11-03T15:48:16.1431511Z continue 2025-11-03T15:48:16.1431743Z 2025-11-03T15:48:16.1431914Z if user: 2025-11-03T15:48:16.1432315Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:48:16.1432969Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:48:16.1433433Z 2025-11-03T15:48:16.1433589Z return optins 2025-11-03T15:48:16.1433808Z 2025-11-03T15:48:16.1433814Z 2025-11-03T15:48:16.1434079Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:48:16.1434647Z """ 2025-11-03T15:48:16.1435008Z Check if the experiment name is valid. 2025-11-03T15:48:16.1435680Z A valid name: 2025-11-03T15:48:16.1436283Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:48:16.1437175Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:48:16.1437858Z - Cannot contain spaces 2025-11-03T15:48:16.1438279Z """ 2025-11-03T15:48:16.1438457Z 2025-11-03T15:48:16.1438702Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:48:16.1439353Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:48:16.1439929Z 2025-11-03T15:48:16.1440076Z if valid: 2025-11-03T15:48:16.1440417Z return True 2025-11-03T15:48:16.1440647Z 2025-11-03T15:48:16.1440794Z log.error( 2025-11-03T15:48:16.1442150Z 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:48:16.1443617Z ) 2025-11-03T15:48:16.1443942Z return False 2025-11-03T15:48:16.1444160Z 2025-11-03T15:48:16.1444167Z 2025-11-03T15:48:16.1444443Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:48:16.1445017Z """ 2025-11-03T15:48:16.1445712Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:48:16.1446387Z """ 2025-11-03T15:48:16.1446702Z try: 2025-11-03T15:48:16.1447038Z if settings_text: 2025-11-03T15:48:16.1447715Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:48:16.1448453Z # for easy reading 2025-11-03T15:48:16.1449210Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:48:16.1450151Z # the backtick character in shell commands. 2025-11-03T15:48:16.1450719Z backtick = chr(96) # backtick character 2025-11-03T15:48:16.1451326Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:48:16.1451946Z settings = load_yaml(settings_text) 2025-11-03T15:48:16.1452287Z 2025-11-03T15:48:16.1452672Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:48:16.1453366Z experiments = {} 2025-11-03T15:48:16.1453643Z 2025-11-03T15:48:16.1454033Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:48:16.1454725Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:48:16.1455766Z # 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:48:16.1456740Z continue 2025-11-03T15:48:16.1457001Z 2025-11-03T15:48:16.1457167Z valid_settings = {} 2025-11-03T15:48:16.1457647Z for setting in exp_settings: 2025-11-03T15:48:16.1458159Z if setting not in Experiment._fields: 2025-11-03T15:48:16.1458676Z log.warning( 2025-11-03T15:48:16.1459326Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:48:16.1460457Z ) 2025-11-03T15:48:16.1460859Z else: 2025-11-03T15:48:16.1461326Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:48:16.1461716Z 2025-11-03T15:48:16.1461979Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:48:16.1462559Z return Settings(experiments) 2025-11-03T15:48:16.1462888Z 2025-11-03T15:48:16.1463047Z except Exception: 2025-11-03T15:48:16.1463482Z log.exception("Failed to parse settings") 2025-11-03T15:48:16.1463858Z 2025-11-03T15:48:16.1464012Z return Settings() 2025-11-03T15:48:16.1464245Z 2025-11-03T15:48:16.1464252Z 2025-11-03T15:48:16.1464487Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:48:16.1465008Z """ 2025-11-03T15:48:16.1465407Z Parse settings, if any, from the rollout state. 2025-11-03T15:48:16.1465806Z 2025-11-03T15:48:16.1466133Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:48:16.1466850Z and the text below is the list of opted in users. 2025-11-03T15:48:16.1467233Z 2025-11-03T15:48:16.1467619Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:48:16.1468313Z """ 2025-11-03T15:48:16.1468826Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:48:16.1469670Z return parse_settings_from_text(settings_text) 2025-11-03T15:48:16.1470047Z 2025-11-03T15:48:16.1470059Z 2025-11-03T15:48:16.1470283Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:48:16.1470789Z """ 2025-11-03T15:48:16.1471144Z Parse users from the rollout state. 2025-11-03T15:48:16.1471475Z 2025-11-03T15:48:16.1471620Z """ 2025-11-03T15:48:16.1472103Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:48:16.1472791Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:48:16.1473168Z 2025-11-03T15:48:16.1473174Z 2025-11-03T15:48:16.1473707Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:48:16.1474409Z """ 2025-11-03T15:48:16.1474777Z Check if a user is opted into an experiment 2025-11-03T15:48:16.1475272Z """ 2025-11-03T15:48:16.1475677Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:48:16.1476069Z 2025-11-03T15:48:16.1476075Z 2025-11-03T15:48:16.1476470Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:48:16.1477166Z """ 2025-11-03T15:48:16.1477575Z Check if a user explicitly opted out of an experiment 2025-11-03T15:48:16.1478109Z """ 2025-11-03T15:48:16.1478566Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:48:16.1479198Z experiment_optout = "-" + experiment_name 2025-11-03T15:48:16.1479907Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:48:16.1480470Z return False 2025-11-03T15:48:16.1480702Z 2025-11-03T15:48:16.1480960Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:48:16.1481510Z log.warning( 2025-11-03T15:48:16.1482285Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:48:16.1483098Z ) 2025-11-03T15:48:16.1483292Z 2025-11-03T15:48:16.1483441Z return True 2025-11-03T15:48:16.1483655Z 2025-11-03T15:48:16.1483661Z 2025-11-03T15:48:16.1483827Z def get_runner_prefix( 2025-11-03T15:48:16.1484221Z rollout_state: str, 2025-11-03T15:48:16.1484693Z workflow_requestors: Iterable[str], 2025-11-03T15:48:16.1485169Z branch: str, 2025-11-03T15:48:16.1485620Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:48:16.1486230Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:48:16.1486769Z is_canary: bool = False, 2025-11-03T15:48:16.1487181Z ) -> str: 2025-11-03T15:48:16.1487689Z settings = parse_settings(rollout_state) 2025-11-03T15:48:16.1488221Z user_optins = parse_users(rollout_state) 2025-11-03T15:48:16.1488568Z 2025-11-03T15:48:16.1488719Z fleet_prefix = "" 2025-11-03T15:48:16.1489104Z prefixes = [] 2025-11-03T15:48:16.1489790Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:48:16.1490669Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:48:16.1491347Z log.info( 2025-11-03T15:48:16.1491996Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:48:16.1492695Z ) 2025-11-03T15:48:16.1493034Z continue 2025-11-03T15:48:16.1493261Z 2025-11-03T15:48:16.1493437Z if opt_out_experiments: 2025-11-03T15:48:16.1493913Z if experiment_name in opt_out_experiments: 2025-11-03T15:48:16.1494497Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:48:16.1495031Z log.info( 2025-11-03T15:48:16.1495893Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:48:16.1496798Z ) 2025-11-03T15:48:16.1497204Z continue 2025-11-03T15:48:16.1497451Z 2025-11-03T15:48:16.1497626Z if eligible_experiments: 2025-11-03T15:48:16.1498157Z if experiment_name not in eligible_experiments: 2025-11-03T15:48:16.1498743Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:48:16.1499238Z log.info( 2025-11-03T15:48:16.1500256Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:48:16.1501063Z ) 2025-11-03T15:48:16.1501426Z continue 2025-11-03T15:48:16.1501848Z elif not experiment_settings.default: 2025-11-03T15:48:16.1502342Z log.info( 2025-11-03T15:48:16.1503125Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:48:16.1503865Z ) 2025-11-03T15:48:16.1504216Z continue 2025-11-03T15:48:16.1504442Z 2025-11-03T15:48:16.1504692Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:48:16.1505266Z opted_out_users = [ 2025-11-03T15:48:16.1505674Z requestor 2025-11-03T15:48:16.1506091Z for requestor in workflow_requestors 2025-11-03T15:48:16.1506703Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:48:16.1507282Z ] 2025-11-03T15:48:16.1507467Z 2025-11-03T15:48:16.1507635Z if opted_out_users: 2025-11-03T15:48:16.1508035Z log.info( 2025-11-03T15:48:16.1508617Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:48:16.1509260Z ) 2025-11-03T15:48:16.1510404Z continue 2025-11-03T15:48:16.1510655Z 2025-11-03T15:48:16.1510912Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:48:16.1511484Z opted_in_users = [ 2025-11-03T15:48:16.1511887Z requestor 2025-11-03T15:48:16.1512311Z for requestor in workflow_requestors 2025-11-03T15:48:16.1512957Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:48:16.1513528Z ] 2025-11-03T15:48:16.1513710Z 2025-11-03T15:48:16.1513873Z enabled = False 2025-11-03T15:48:16.1514262Z if opted_in_users: 2025-11-03T15:48:16.1514667Z log.info( 2025-11-03T15:48:16.1515216Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:48:16.1515850Z ) 2025-11-03T15:48:16.1516194Z enabled = True 2025-11-03T15:48:16.1516458Z 2025-11-03T15:48:16.1516652Z elif experiment_settings.rollout_perc: 2025-11-03T15:48:16.1517433Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:48:16.1518518Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:48:16.1519129Z log.info( 2025-11-03T15:48:16.1520047Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:48:16.1520908Z ) 2025-11-03T15:48:16.1521266Z enabled = True 2025-11-03T15:48:16.1521550Z 2025-11-03T15:48:16.1521694Z if enabled: 2025-11-03T15:48:16.1522076Z label = experiment_name 2025-11-03T15:48:16.1522581Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:48:16.1523361Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:48:16.1524171Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:48:16.1524874Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:48:16.1525492Z if is_canary: 2025-11-03T15:48:16.1525940Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:48:16.1526443Z fleet_prefix = label 2025-11-03T15:48:16.1526883Z else: 2025-11-03T15:48:16.1527272Z prefixes.append(label) 2025-11-03T15:48:16.1527588Z 2025-11-03T15:48:16.1527750Z if len(prefixes) > 1: 2025-11-03T15:48:16.1528149Z log.error( 2025-11-03T15:48:16.1529109Z 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:48:16.1530291Z ) 2025-11-03T15:48:16.1530643Z prefixes = prefixes[:1] 2025-11-03T15:48:16.1530928Z 2025-11-03T15:48:16.1531098Z # Fleet always comes first 2025-11-03T15:48:16.1531527Z if fleet_prefix: 2025-11-03T15:48:16.1531930Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:48:16.1532261Z 2025-11-03T15:48:16.1532620Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:48:16.1533006Z 2025-11-03T15:48:16.1533012Z 2025-11-03T15:48:16.1533407Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:48:16.1534118Z """ 2025-11-03T15:48:16.1534651Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:48:16.1535167Z 2025-11-03T15:48:16.1535524Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:48:16.1536175Z """ 2025-11-03T15:48:16.1536515Z gh = get_gh_client(github_token) 2025-11-03T15:48:16.1537007Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:48:16.1537591Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:48:16.1538003Z 2025-11-03T15:48:16.1538010Z 2025-11-03T15:48:16.1538383Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:48:16.1539094Z for _ in range(num_retries): 2025-11-03T15:48:16.1539641Z try: 2025-11-03T15:48:16.1540044Z req = Request(url=url, headers=headers) 2025-11-03T15:48:16.1540655Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:48:16.1541249Z return json.loads(content) 2025-11-03T15:48:16.1541729Z except Exception as e: 2025-11-03T15:48:16.1542227Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:48:16.1542603Z 2025-11-03T15:48:16.1542966Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:48:16.1543616Z return {} 2025-11-03T15:48:16.1543818Z 2025-11-03T15:48:16.1543825Z 2025-11-03T15:48:16.1543974Z @cache 2025-11-03T15:48:16.1544544Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:48:16.1545242Z """ 2025-11-03T15:48:16.1545586Z Dynamically get PR information 2025-11-03T15:48:16.1546172Z """ 2025-11-03T15:48:16.1546624Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:48:16.1547194Z headers = { 2025-11-03T15:48:16.1547601Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:48:16.1548151Z "Authorization": f"token {github_token}", 2025-11-03T15:48:16.1548639Z } 2025-11-03T15:48:16.1549019Z json_response: dict[str, Any] = download_json( 2025-11-03T15:48:16.1549677Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:48:16.1550175Z headers=headers, 2025-11-03T15:48:16.1550573Z ) 2025-11-03T15:48:16.1550750Z 2025-11-03T15:48:16.1550912Z if not json_response: 2025-11-03T15:48:16.1551457Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:48:16.1552024Z return {} 2025-11-03T15:48:16.1552240Z 2025-11-03T15:48:16.1552397Z return json_response 2025-11-03T15:48:16.1552643Z 2025-11-03T15:48:16.1552649Z 2025-11-03T15:48:16.1553023Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:48:16.1553684Z """ 2025-11-03T15:48:16.1554169Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:48:16.1554764Z """ 2025-11-03T15:48:16.1555205Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:48:16.1555763Z return { 2025-11-03T15:48:16.1556291Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:48:16.1556933Z } 2025-11-03T15:48:16.1557112Z 2025-11-03T15:48:16.1557117Z 2025-11-03T15:48:16.1557270Z def main() -> None: 2025-11-03T15:48:16.1557654Z args = parse_args() 2025-11-03T15:48:16.1557897Z 2025-11-03T15:48:16.1558098Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:48:16.1558460Z 2025-11-03T15:48:16.1558629Z # Check if the PR is opt-out 2025-11-03T15:48:16.1559071Z if args.pr_number: 2025-11-03T15:48:16.1559774Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:48:16.1560600Z if OPT_OUT_LABEL in labels: 2025-11-03T15:48:16.1561055Z log.info( 2025-11-03T15:48:16.1561686Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:48:16.1562385Z ) 2025-11-03T15:48:16.1562889Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:48:16.1563491Z sys.exit() 2025-11-03T15:48:16.1563734Z 2025-11-03T15:48:16.1563877Z try: 2025-11-03T15:48:16.1564273Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:48:16.1564946Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:48:16.1565539Z ) 2025-11-03T15:48:16.1565724Z 2025-11-03T15:48:16.1565906Z username = get_potential_pr_author( 2025-11-03T15:48:16.1566404Z args.github_token, 2025-11-03T15:48:16.1566831Z args.github_repo, 2025-11-03T15:48:16.1567265Z args.github_actor, 2025-11-03T15:48:16.1567698Z args.github_ref_type, 2025-11-03T15:48:16.1568157Z args.github_branch, 2025-11-03T15:48:16.1568574Z ) 2025-11-03T15:48:16.1568763Z 2025-11-03T15:48:16.1569024Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:48:16.1569437Z 2025-11-03T15:48:16.1569793Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:48:16.1570300Z rollout_state, 2025-11-03T15:48:16.1570754Z (args.github_issue_owner, username), 2025-11-03T15:48:16.1571248Z args.github_branch, 2025-11-03T15:48:16.1571709Z args.eligible_experiments, 2025-11-03T15:48:16.1572192Z args.opt_out_experiments, 2025-11-03T15:48:16.1572651Z is_canary, 2025-11-03T15:48:16.1573015Z ) 2025-11-03T15:48:16.1573197Z 2025-11-03T15:48:16.1573362Z except Exception as e: 2025-11-03T15:48:16.1573770Z log.error( 2025-11-03T15:48:16.1574378Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:48:16.1575237Z ) 2025-11-03T15:48:16.1575421Z 2025-11-03T15:48:16.1575720Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:48:16.1576184Z 2025-11-03T15:48:16.1576190Z 2025-11-03T15:48:16.1576346Z if __name__ == "__main__": 2025-11-03T15:48:16.1576740Z main() 2025-11-03T15:48:16.1576926Z 2025-11-03T15:48:16.1675103Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:48:16.1676014Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:48:16.1710309Z shell: /usr/bin/bash -e {0} 2025-11-03T15:48:16.1710810Z env: 2025-11-03T15:48:16.1711478Z GITHUB_TOKEN: *** 2025-11-03T15:48:16.1711904Z ISSUE_NUMBER: 5132 2025-11-03T15:48:16.1712363Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:48:16.1712881Z ISSUE_OWNER: 2025-11-03T15:48:16.1713296Z CHECK_EXPERIMENTS: 2025-11-03T15:48:16.1713735Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:48:16.1714198Z PR_NUMBER: 2025-11-03T15:48:16.1714581Z ##[endgroup] 2025-11-03T15:48:18.8222947Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:48:19.9202782Z Collecting urllib3==1.26.18 2025-11-03T15:48:19.9620798Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:48:19.9846575Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-11-03T15:48:20.0067608Z Collecting PyGithub==2.3.0 2025-11-03T15:48:20.0101763Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:48:20.0541761Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:48:20.0605204Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:48:20.0660098Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:48:20.0678388Z 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:48:20.0694213Z 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:48:20.0970327Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:48:20.1004650Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:48:20.1241833Z 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:48:20.2503169Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:48:20.2539004Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:48:20.4051163Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:48:20.4089263Z 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:48:20.4284981Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:48:20.4474420Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:48:20.4728693Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:48:20.4792546Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 32.5 MB/s eta 0:00:00 2025-11-03T15:48:20.6879456Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:48:20.6948706Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 71.1 MB/s eta 0:00:00 2025-11-03T15:48:20.6992432Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:48:20.7122262Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 131.1 MB/s eta 0:00:00 2025-11-03T15:48:20.7179186Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:48:20.7237693Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:48:20.7311871Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 44.6 MB/s eta 0:00:00 2025-11-03T15:48:20.7356282Z 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:48:20.7402914Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 40.2 MB/s eta 0:00:00 2025-11-03T15:48:20.7435366Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:48:20.7485834Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 32.9 MB/s eta 0:00:00 2025-11-03T15:48:21.1470706Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:48:21.6997448Z 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:48:21.8157955Z ##[group]Run curr_branch="main" 2025-11-03T15:48:21.8158285Z curr_branch="main" 2025-11-03T15:48:21.8158527Z curr_ref_type="branch" 2025-11-03T15:48:21.8158799Z echo "Current branch is '$curr_branch'" 2025-11-03T15:48:21.8159114Z  2025-11-03T15:48:21.8159309Z python3 runner_determinator.py \ 2025-11-03T15:48:21.8159906Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:48:21.8160216Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:48:21.8160499Z  --github-branch "$curr_branch" \ 2025-11-03T15:48:21.8160800Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:48:21.8161134Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:48:21.8161490Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:48:21.8161816Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:48:21.8162194Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:48:21.8162626Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:48:21.8162969Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:48:21.8197945Z shell: /usr/bin/bash -e {0} 2025-11-03T15:48:21.8198255Z env: 2025-11-03T15:48:21.8198864Z GITHUB_TOKEN: *** 2025-11-03T15:48:21.8199136Z ISSUE_NUMBER: 5132 2025-11-03T15:48:21.8199417Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:48:21.8199927Z ISSUE_OWNER: 2025-11-03T15:48:21.8200181Z CHECK_EXPERIMENTS: 2025-11-03T15:48:21.8200442Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:48:21.8200714Z PR_NUMBER: 2025-11-03T15:48:21.8200943Z ##[endgroup] 2025-11-03T15:48:21.8255478Z Current branch is 'main' 2025-11-03T15:48:23.8883806Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:48:23.8885587Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:48:23.8887244Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:48:23.8888588Z INFO : Setting output: label-type='' 2025-11-03T15:48:23.9251738Z Evaluate and set job outputs 2025-11-03T15:48:23.9259749Z Cleaning up orphan processes