2025-11-03T15:43:14.9491733Z Current runner version: '2.329.0' 2025-11-03T15:43:14.9516654Z ##[group]Runner Image Provisioner 2025-11-03T15:43:14.9517866Z Hosted Compute Agent 2025-11-03T15:43:14.9518430Z Version: 20251016.436 2025-11-03T15:43:14.9518986Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:14.9519761Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:14.9520319Z ##[endgroup] 2025-11-03T15:43:14.9520860Z ##[group]Operating System 2025-11-03T15:43:14.9521450Z Ubuntu 2025-11-03T15:43:14.9521933Z 24.04.3 2025-11-03T15:43:14.9522367Z LTS 2025-11-03T15:43:14.9522876Z ##[endgroup] 2025-11-03T15:43:14.9523361Z ##[group]Runner Image 2025-11-03T15:43:14.9523891Z Image: ubuntu-24.04 2025-11-03T15:43:14.9524440Z Version: 20251030.96.2 2025-11-03T15:43:14.9525884Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:14.9528603Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:14.9529593Z ##[endgroup] 2025-11-03T15:43:14.9530647Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:14.9532825Z Contents: read 2025-11-03T15:43:14.9533325Z Metadata: read 2025-11-03T15:43:14.9534246Z ##[endgroup] 2025-11-03T15:43:14.9536740Z Secret source: Actions 2025-11-03T15:43:14.9537945Z Prepare workflow directory 2025-11-03T15:43:15.0038172Z Prepare all required actions 2025-11-03T15:43:15.0095117Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:15.0100170Z ##[group] Inputs 2025-11-03T15:43:15.0100867Z check_experiments: 2025-11-03T15:43:15.0101441Z opt_out_experiments: lf 2025-11-03T15:43:15.0102036Z triggering_actor: pytorchmergebot 2025-11-03T15:43:15.0102649Z issue_owner: 2025-11-03T15:43:15.0103169Z curr_branch: main 2025-11-03T15:43:15.0103655Z curr_ref_type: branch 2025-11-03T15:43:15.0104414Z issue_number: 5132 2025-11-03T15:43:15.0105028Z ##[endgroup] 2025-11-03T15:43:15.0105679Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:15.5338402Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:15.5341176Z cat < runner_determinator.py 2025-11-03T15:43:15.5341946Z # flake8: noqa: G004 2025-11-03T15:43:15.5342535Z  2025-11-03T15:43:15.5343343Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:15.5344488Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:15.5345488Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:15.5346195Z  2025-11-03T15:43:15.5346727Z """ 2025-11-03T15:43:15.5347984Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:15.5349189Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:15.5350532Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:15.5351536Z of which runners should be used to run which job. 2025-11-03T15:43:15.5352293Z  2025-11-03T15:43:15.5353025Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:15.5354113Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:15.5355199Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:15.5356074Z list, defined. 2025-11-03T15:43:15.5356618Z  2025-11-03T15:43:15.5357422Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:15.5358601Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:15.5359583Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:15.5360317Z  2025-11-03T15:43:15.5361448Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:15.5362472Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:15.5363377Z experiments which the user could be opted in to. 2025-11-03T15:43:15.5364122Z  2025-11-03T15:43:15.5364658Z The user list has the following rules: 2025-11-03T15:43:15.5365290Z  2025-11-03T15:43:15.5366046Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:15.5367206Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:15.5368124Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:15.5368888Z  2025-11-03T15:43:15.5369347Z Example config: 2025-11-03T15:43:15.5369988Z  # A list of experiments that can be opted into. 2025-11-03T15:43:15.5370909Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:15.5371673Z  # Expected syntax is: 2025-11-03T15:43:15.5372503Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:15.5465999Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:15.5467782Z  2025-11-03T15:43:15.5468552Z  experiments: 2025-11-03T15:43:15.5469383Z  lf: 2025-11-03T15:43:15.5470248Z  rollout_percent: 25 2025-11-03T15:43:15.5471192Z  all_branches: false 2025-11-03T15:43:15.5471753Z  default: true 2025-11-03T15:43:15.5472231Z  --- 2025-11-03T15:43:15.5472636Z  2025-11-03T15:43:15.5473026Z  # Opt-ins: 2025-11-03T15:43:15.5473714Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:15.5474984Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:15.5475877Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:15.5476636Z  # Experiments should be from the above list. 2025-11-03T15:43:15.5477689Z  2025-11-03T15:43:15.5478262Z  @User1,-lf,split_build 2025-11-03T15:43:15.5478830Z  @User2,lf 2025-11-03T15:43:15.5479326Z  @User3,split_build 2025-11-03T15:43:15.5479813Z """ 2025-11-03T15:43:15.5480197Z  2025-11-03T15:43:15.5480582Z import json 2025-11-03T15:43:15.5481015Z import logging 2025-11-03T15:43:15.5481471Z import os 2025-11-03T15:43:15.5481905Z import random 2025-11-03T15:43:15.5482351Z import re 2025-11-03T15:43:15.5482780Z import sys 2025-11-03T15:43:15.5483262Z from argparse import ArgumentParser 2025-11-03T15:43:15.5483936Z from collections.abc import Iterable 2025-11-03T15:43:15.5484542Z from functools import cache 2025-11-03T15:43:15.5485080Z from logging import LogRecord 2025-11-03T15:43:15.5485660Z from typing import Any, NamedTuple 2025-11-03T15:43:15.5486281Z from urllib.request import Request, urlopen 2025-11-03T15:43:15.5486875Z  2025-11-03T15:43:15.5487463Z import yaml 2025-11-03T15:43:15.5487940Z from github import Auth, Github 2025-11-03T15:43:15.5488498Z from github.Issue import Issue 2025-11-03T15:43:15.5489018Z  2025-11-03T15:43:15.5489385Z  2025-11-03T15:43:15.5489848Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:15.5490622Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:15.5491585Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:15.5492343Z  2025-11-03T15:43:15.5493031Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:15.5493682Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:15.5494279Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:15.5494929Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:15.5495501Z  2025-11-03T15:43:15.5495932Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:15.5496477Z  2025-11-03T15:43:15.5496875Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:15.5497603Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:15.5498098Z  2025-11-03T15:43:15.5498471Z  2025-11-03T15:43:15.5498881Z class Experiment(NamedTuple): 2025-11-03T15:43:15.5499432Z  rollout_perc: float = ( 2025-11-03T15:43:15.5500185Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:15.5500908Z  ) 2025-11-03T15:43:15.5501336Z  all_branches: bool = ( 2025-11-03T15:43:15.5502064Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:15.5502790Z  ) 2025-11-03T15:43:15.5503202Z  default: bool = ( 2025-11-03T15:43:15.5503859Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:15.5504543Z  ) 2025-11-03T15:43:15.5504937Z  2025-11-03T15:43:15.5505338Z  # Add more fields as needed 2025-11-03T15:43:15.5505853Z  2025-11-03T15:43:15.5506218Z  2025-11-03T15:43:15.5506616Z class Settings(NamedTuple): 2025-11-03T15:43:15.5507358Z  """ 2025-11-03T15:43:15.5507915Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:15.5508549Z  """ 2025-11-03T15:43:15.5508951Z  2025-11-03T15:43:15.5509386Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:15.5509972Z  2025-11-03T15:43:15.5510496Z  2025-11-03T15:43:15.5510957Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:15.5511655Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:15.5512286Z  2025-11-03T15:43:15.5512663Z  COLORS = { 2025-11-03T15:43:15.5513141Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:15.5513710Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:15.5514253Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:15.5514814Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:15.5515373Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:15.5515900Z  } 2025-11-03T15:43:15.5516298Z  2025-11-03T15:43:15.5516753Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:15.5517792Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:15.5518643Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:15.5519282Z  return super().format(record) 2025-11-03T15:43:15.5519813Z  2025-11-03T15:43:15.5520190Z  2025-11-03T15:43:15.5520608Z handler = logging.StreamHandler() 2025-11-03T15:43:15.5521406Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:15.5522166Z  2025-11-03T15:43:15.5522662Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:15.5523315Z log.addHandler(handler) 2025-11-03T15:43:15.5523837Z log.setLevel(logging.INFO) 2025-11-03T15:43:15.5524330Z  2025-11-03T15:43:15.5524699Z  2025-11-03T15:43:15.5525198Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:15.5525808Z  """ 2025-11-03T15:43:15.5526380Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:15.5527403Z  """ 2025-11-03T15:43:15.5527835Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:15.5528988Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:15.5530177Z  log.warning( 2025-11-03T15:43:15.5531124Z  "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:15.5532096Z  ) 2025-11-03T15:43:15.5532591Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:15.5533179Z  return 2025-11-03T15:43:15.5533609Z  2025-11-03T15:43:15.5534038Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:15.5534667Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:15.5535288Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:15.5535813Z  2025-11-03T15:43:15.5536192Z  2025-11-03T15:43:15.5536762Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:15.5537644Z  return frozenset( 2025-11-03T15:43:15.5538357Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:15.5539089Z  ) 2025-11-03T15:43:15.5539490Z  2025-11-03T15:43:15.5539858Z  2025-11-03T15:43:15.5540259Z def parse_args() -> Any: 2025-11-03T15:43:15.5540907Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:15.5541837Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:15.5542659Z  parser.add_argument( 2025-11-03T15:43:15.5543180Z  "--github-issue-repo", 2025-11-03T15:43:15.5543719Z  type=str, 2025-11-03T15:43:15.5544192Z  required=False, 2025-11-03T15:43:15.5544877Z  default="pytorch/test-infra", 2025-11-03T15:43:15.5545506Z  help="GitHub repo to get the issue", 2025-11-03T15:43:15.5546072Z  ) 2025-11-03T15:43:15.5546497Z  parser.add_argument( 2025-11-03T15:43:15.5547214Z  "--github-repo", 2025-11-03T15:43:15.5547776Z  type=str, 2025-11-03T15:43:15.5548273Z  required=True, 2025-11-03T15:43:15.5548821Z  help="GitHub repo where CI is running", 2025-11-03T15:43:15.5549392Z  ) 2025-11-03T15:43:15.5549819Z  parser.add_argument( 2025-11-03T15:43:15.5550534Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:15.5551253Z  ) 2025-11-03T15:43:15.5551679Z  parser.add_argument( 2025-11-03T15:43:15.5552394Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:15.5553125Z  ) 2025-11-03T15:43:15.5553548Z  parser.add_argument( 2025-11-03T15:43:15.5554275Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:15.5555009Z  ) 2025-11-03T15:43:15.5555435Z  parser.add_argument( 2025-11-03T15:43:15.5556195Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:15.5556946Z  ) 2025-11-03T15:43:15.5558109Z  parser.add_argument( 2025-11-03T15:43:15.5558644Z  "--github-ref-type", 2025-11-03T15:43:15.5559165Z  type=str, 2025-11-03T15:43:15.5559632Z  required=True, 2025-11-03T15:43:15.5560228Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:15.5560820Z  ) 2025-11-03T15:43:15.5561247Z  parser.add_argument( 2025-11-03T15:43:15.5561977Z  "--eligible-experiments", 2025-11-03T15:43:15.5562587Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:15.5563156Z  required=False, 2025-11-03T15:43:15.5563657Z  default="", 2025-11-03T15:43:15.5564610Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:15.5565589Z  ) 2025-11-03T15:43:15.5566013Z  parser.add_argument( 2025-11-03T15:43:15.5566549Z  "--opt-out-experiments", 2025-11-03T15:43:15.5567345Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:15.5567934Z  required=False, 2025-11-03T15:43:15.5568436Z  default="", 2025-11-03T15:43:15.5568901Z  help=( 2025-11-03T15:43:15.5569650Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:15.5570858Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:15.5571734Z  ), 2025-11-03T15:43:15.5572149Z  ) 2025-11-03T15:43:15.5572566Z  parser.add_argument( 2025-11-03T15:43:15.5573081Z  "--pr-number", 2025-11-03T15:43:15.5573565Z  type=str, 2025-11-03T15:43:15.5574037Z  required=False, 2025-11-03T15:43:15.5574527Z  default="", 2025-11-03T15:43:15.5575094Z  help="the optional PR number where this is run", 2025-11-03T15:43:15.5575698Z  ) 2025-11-03T15:43:15.5576089Z  2025-11-03T15:43:15.5576508Z  return parser.parse_args() 2025-11-03T15:43:15.5577176Z  2025-11-03T15:43:15.5577566Z  2025-11-03T15:43:15.5578210Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:15.5579199Z  auth = Auth.Token(github_token) 2025-11-03T15:43:15.5579809Z  return Github(auth=auth) 2025-11-03T15:43:15.5580328Z  2025-11-03T15:43:15.5580705Z  2025-11-03T15:43:15.5581412Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:15.5582280Z  repo = gh.get_repo(repo) 2025-11-03T15:43:15.5582854Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:15.5583435Z  2025-11-03T15:43:15.5583811Z  2025-11-03T15:43:15.5584210Z def get_potential_pr_author( 2025-11-03T15:43:15.5584947Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:15.5585674Z ) -> str: 2025-11-03T15:43:15.5586282Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:15.5587409Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:15.5588289Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:15.5588919Z  2025-11-03T15:43:15.5589351Z  gh = get_gh_client(github_token) 2025-11-03T15:43:15.5589903Z  2025-11-03T15:43:15.5590416Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:15.5591113Z  split_tag = ref_name.split("/") 2025-11-03T15:43:15.5591667Z  if ( 2025-11-03T15:43:15.5592139Z  len(split_tag) == 3 2025-11-03T15:43:15.5592713Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:15.5593310Z  and split_tag[2].isnumeric() 2025-11-03T15:43:15.5593861Z  ): 2025-11-03T15:43:15.5594319Z  pr_number = split_tag[2] 2025-11-03T15:43:15.5594868Z  try: 2025-11-03T15:43:15.5595368Z  repository = gh.get_repo(repo) 2025-11-03T15:43:15.5596215Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:15.5596897Z  except Exception as e: 2025-11-03T15:43:15.5597705Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:15.5598462Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:15.5599164Z  ) from e 2025-11-03T15:43:15.5599804Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:15.5600577Z  # In all other cases, return the original input username 2025-11-03T15:43:15.5601232Z  return username 2025-11-03T15:43:15.5601694Z  2025-11-03T15:43:15.5602061Z  2025-11-03T15:43:15.5602532Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:15.5603115Z  """ 2025-11-03T15:43:15.5603845Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:15.5604683Z  """ 2025-11-03T15:43:15.5605306Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:15.5606032Z  2025-11-03T15:43:15.5606404Z  2025-11-03T15:43:15.5606838Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:15.5607568Z  try: 2025-11-03T15:43:15.5608024Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:15.5608584Z  return data 2025-11-03T15:43:15.5609078Z  except yaml.YAMLError: 2025-11-03T15:43:15.5609641Z  log.exception("Error loading YAML") 2025-11-03T15:43:15.5610209Z  raise 2025-11-03T15:43:15.5610643Z  2025-11-03T15:43:15.5611006Z  2025-11-03T15:43:15.5611685Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:15.5612484Z  """ 2025-11-03T15:43:15.5613332Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:15.5614146Z  2025-11-03T15:43:15.5614750Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:15.5615606Z  and the text below is the list of opted in users. 2025-11-03T15:43:15.5616213Z  2025-11-03T15:43:15.5616840Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:15.5617780Z  """ 2025-11-03T15:43:15.5618316Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:15.5618978Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:15.5619669Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:15.5620310Z  else: 2025-11-03T15:43:15.5620868Z  return "", rollout_state 2025-11-03T15:43:15.5621517Z  2025-11-03T15:43:15.5621891Z  2025-11-03T15:43:15.5622338Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:15.5622901Z  """ 2025-11-03T15:43:15.5623487Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:15.5624172Z  """ 2025-11-03T15:43:15.5624567Z  2025-11-03T15:43:15.5624931Z  2025-11-03T15:43:15.5625507Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:15.5626210Z  """ 2025-11-03T15:43:15.5627188Z  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:15.5628199Z  2025-11-03T15:43:15.5629068Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:15.5630133Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:15.5631057Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:15.5631737Z  2025-11-03T15:43:15.5632100Z  2025-11-03T15:43:15.5632461Z  """ 2025-11-03T15:43:15.5632888Z  optins = UserOptins() 2025-11-03T15:43:15.5633484Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:15.5634100Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:15.5634714Z  if not user or not user.startswith("@"): 2025-11-03T15:43:15.5635321Z  # Not a valid user. Skip 2025-11-03T15:43:15.5635857Z  continue 2025-11-03T15:43:15.5636307Z  2025-11-03T15:43:15.5636693Z  if user: 2025-11-03T15:43:15.5637501Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:15.5638286Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:15.5638980Z  2025-11-03T15:43:15.5639371Z  return optins 2025-11-03T15:43:15.5639828Z  2025-11-03T15:43:15.5640191Z  2025-11-03T15:43:15.5640729Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:15.5641395Z  """ 2025-11-03T15:43:15.5641856Z  Check if the experiment name is valid. 2025-11-03T15:43:15.5642430Z  A valid name: 2025-11-03T15:43:15.5643166Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:15.5644170Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:15.5644932Z  - Cannot contain spaces 2025-11-03T15:43:15.5645448Z  """ 2025-11-03T15:43:15.5645841Z  2025-11-03T15:43:15.5646344Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:15.5647310Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:15.5648129Z  2025-11-03T15:43:15.5648517Z  if valid: 2025-11-03T15:43:15.5648964Z  return True 2025-11-03T15:43:15.5649417Z  2025-11-03T15:43:15.5649792Z  log.error( 2025-11-03T15:43:15.5651344Z  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:15.5652962Z  ) 2025-11-03T15:43:15.5653376Z  return False 2025-11-03T15:43:15.5653826Z  2025-11-03T15:43:15.5654193Z  2025-11-03T15:43:15.5654755Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:15.5655436Z  """ 2025-11-03T15:43:15.5656097Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:15.5656858Z  """ 2025-11-03T15:43:15.5657370Z  try: 2025-11-03T15:43:15.5657787Z  if settings_text: 2025-11-03T15:43:15.5658602Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:15.5659446Z  # for easy reading 2025-11-03T15:43:15.5660315Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:15.5661273Z  # the backtick character in shell commands. 2025-11-03T15:43:15.5661931Z  backtick = chr(96) # backtick character 2025-11-03T15:43:15.5662673Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:15.5663395Z  settings = load_yaml(settings_text) 2025-11-03T15:43:15.5663943Z  2025-11-03T15:43:15.5664593Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:15.5665563Z  experiments = {} 2025-11-03T15:43:15.5666073Z  2025-11-03T15:43:15.5666683Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:15.5667617Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:15.5668801Z  # 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:15.5669911Z  continue 2025-11-03T15:43:15.5670405Z  2025-11-03T15:43:15.5670805Z  valid_settings = {} 2025-11-03T15:43:15.5671388Z  for setting in exp_settings: 2025-11-03T15:43:15.5672017Z  if setting not in Experiment._fields: 2025-11-03T15:43:15.5672624Z  log.warning( 2025-11-03T15:43:15.5673421Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:15.5674176Z  ) 2025-11-03T15:43:15.5674666Z  else: 2025-11-03T15:43:15.5675244Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:15.5675862Z  2025-11-03T15:43:15.5676376Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:15.5677164Z  return Settings(experiments) 2025-11-03T15:43:15.5677719Z  2025-11-03T15:43:15.5678107Z  except Exception: 2025-11-03T15:43:15.5678666Z  log.exception("Failed to parse settings") 2025-11-03T15:43:15.5679261Z  2025-11-03T15:43:15.5679648Z  return Settings() 2025-11-03T15:43:15.5680114Z  2025-11-03T15:43:15.5680473Z  2025-11-03T15:43:15.5681090Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:15.5681722Z  """ 2025-11-03T15:43:15.5682229Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:15.5682812Z  2025-11-03T15:43:15.5683394Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:15.5684208Z  and the text below is the list of opted in users. 2025-11-03T15:43:15.5684805Z  2025-11-03T15:43:15.5685449Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:15.5686205Z  """ 2025-11-03T15:43:15.5686829Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:15.5687750Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:15.5688333Z  2025-11-03T15:43:15.5688686Z  2025-11-03T15:43:15.5689188Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:15.5689797Z  """ 2025-11-03T15:43:15.5690238Z  Parse users from the rollout state. 2025-11-03T15:43:15.5690784Z  2025-11-03T15:43:15.5691150Z  """ 2025-11-03T15:43:15.5691753Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:15.5692550Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:15.5693131Z  2025-11-03T15:43:15.5693488Z  2025-11-03T15:43:15.5694158Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:15.5694951Z  """ 2025-11-03T15:43:15.5695425Z  Check if a user is opted into an experiment 2025-11-03T15:43:15.5696003Z  """ 2025-11-03T15:43:15.5696517Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:15.5697232Z  2025-11-03T15:43:15.5697740Z  2025-11-03T15:43:15.5698417Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:15.5699214Z  """ 2025-11-03T15:43:15.5699728Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:15.5700338Z  """ 2025-11-03T15:43:15.5700903Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:15.5701657Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:15.5702359Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:15.5703003Z  return False 2025-11-03T15:43:15.5703456Z  2025-11-03T15:43:15.5703948Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:15.5704589Z  log.warning( 2025-11-03T15:43:15.5705477Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:15.5706393Z  ) 2025-11-03T15:43:15.5706790Z  2025-11-03T15:43:15.5707271Z  return True 2025-11-03T15:43:15.5707711Z  2025-11-03T15:43:15.5708074Z  2025-11-03T15:43:15.5708466Z def get_runner_prefix( 2025-11-03T15:43:15.5708956Z  rollout_state: str, 2025-11-03T15:43:15.5709498Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:15.5710056Z  branch: str, 2025-11-03T15:43:15.5710637Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:15.5711370Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:15.5712006Z  is_canary: bool = False, 2025-11-03T15:43:15.5712516Z ) -> str: 2025-11-03T15:43:15.5713004Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:15.5713631Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:15.5714179Z  2025-11-03T15:43:15.5714691Z  fleet_prefix = "" 2025-11-03T15:43:15.5715176Z  prefixes = [] 2025-11-03T15:43:15.5715891Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:15.5716894Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:15.5717751Z  log.info( 2025-11-03T15:43:15.5718511Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:15.5719296Z  ) 2025-11-03T15:43:15.5719751Z  continue 2025-11-03T15:43:15.5720200Z  2025-11-03T15:43:15.5720599Z  if opt_out_experiments: 2025-11-03T15:43:15.5721203Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:15.5721911Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:15.5722546Z  log.info( 2025-11-03T15:43:15.5723539Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:15.5724551Z  ) 2025-11-03T15:43:15.5725003Z  continue 2025-11-03T15:43:15.5725483Z  2025-11-03T15:43:15.5725895Z  if eligible_experiments: 2025-11-03T15:43:15.5726520Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:15.5727361Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:15.5727957Z  log.info( 2025-11-03T15:43:15.5728808Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:15.5729676Z  ) 2025-11-03T15:43:15.5730126Z  continue 2025-11-03T15:43:15.5730815Z  elif not experiment_settings.default: 2025-11-03T15:43:15.5731382Z  log.info( 2025-11-03T15:43:15.5732116Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:15.5732879Z  ) 2025-11-03T15:43:15.5733308Z  continue 2025-11-03T15:43:15.5733751Z  2025-11-03T15:43:15.5734261Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:15.5734922Z  opted_out_users = [ 2025-11-03T15:43:15.5735440Z  requestor 2025-11-03T15:43:15.5735976Z  for requestor in workflow_requestors 2025-11-03T15:43:15.5736706Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:15.5737475Z  ] 2025-11-03T15:43:15.5737872Z  2025-11-03T15:43:15.5738273Z  if opted_out_users: 2025-11-03T15:43:15.5738806Z  log.info( 2025-11-03T15:43:15.5739502Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:15.5740242Z  ) 2025-11-03T15:43:15.5740675Z  continue 2025-11-03T15:43:15.5741130Z  2025-11-03T15:43:15.5741630Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:15.5742290Z  opted_in_users = [ 2025-11-03T15:43:15.5742818Z  requestor 2025-11-03T15:43:15.5743354Z  for requestor in workflow_requestors 2025-11-03T15:43:15.5744090Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:15.5744751Z  ] 2025-11-03T15:43:15.5745165Z  2025-11-03T15:43:15.5745544Z  enabled = False 2025-11-03T15:43:15.5746044Z  if opted_in_users: 2025-11-03T15:43:15.5746668Z  log.info( 2025-11-03T15:43:15.5747461Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:15.5748184Z  ) 2025-11-03T15:43:15.5748625Z  enabled = True 2025-11-03T15:43:15.5749111Z  2025-11-03T15:43:15.5749558Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:15.5750446Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:15.5751435Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:15.5752145Z  log.info( 2025-11-03T15:43:15.5753098Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:15.5754052Z  ) 2025-11-03T15:43:15.5754531Z  enabled = True 2025-11-03T15:43:15.5755029Z  2025-11-03T15:43:15.5755417Z  if enabled: 2025-11-03T15:43:15.5755910Z  label = experiment_name 2025-11-03T15:43:15.5756516Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:15.5757500Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:15.5758431Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:15.5759246Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:15.5759961Z  if is_canary: 2025-11-03T15:43:15.5760518Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:15.5761109Z  fleet_prefix = label 2025-11-03T15:43:15.5761644Z  else: 2025-11-03T15:43:15.5762280Z  prefixes.append(label) 2025-11-03T15:43:15.5762817Z  2025-11-03T15:43:15.5763212Z  if len(prefixes) > 1: 2025-11-03T15:43:15.5763710Z  log.error( 2025-11-03T15:43:15.5764834Z  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:15.5766005Z  ) 2025-11-03T15:43:15.5766445Z  prefixes = prefixes[:1] 2025-11-03T15:43:15.5766958Z  2025-11-03T15:43:15.5767450Z  # Fleet always comes first 2025-11-03T15:43:15.5767984Z  if fleet_prefix: 2025-11-03T15:43:15.5768490Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:15.5769035Z  2025-11-03T15:43:15.5769520Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:15.5770122Z  2025-11-03T15:43:15.5770562Z  2025-11-03T15:43:15.5771244Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:15.5772056Z  """ 2025-11-03T15:43:15.5772702Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:15.5773446Z  2025-11-03T15:43:15.5774069Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:15.5774805Z  """ 2025-11-03T15:43:15.5775247Z  gh = get_gh_client(github_token) 2025-11-03T15:43:15.5775845Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:15.5776549Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:15.5777274Z  2025-11-03T15:43:15.5777648Z  2025-11-03T15:43:15.5778284Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:15.5779241Z  for _ in range(num_retries): 2025-11-03T15:43:15.5779776Z  try: 2025-11-03T15:43:15.5780263Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:15.5780978Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:15.5781668Z  return json.loads(content) 2025-11-03T15:43:15.5782237Z  except Exception as e: 2025-11-03T15:43:15.5782850Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:15.5783497Z  2025-11-03T15:43:15.5784114Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:15.5784870Z  return {} 2025-11-03T15:43:15.5785295Z  2025-11-03T15:43:15.5785650Z  2025-11-03T15:43:15.5786020Z @cache 2025-11-03T15:43:15.5786700Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:15.5787604Z  """ 2025-11-03T15:43:15.5788049Z  Dynamically get PR information 2025-11-03T15:43:15.5788575Z  """ 2025-11-03T15:43:15.5789135Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:15.5789798Z  headers = { 2025-11-03T15:43:15.5790329Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:15.5790983Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:15.5791549Z  } 2025-11-03T15:43:15.5792040Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:15.5792684Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:15.5793267Z  headers=headers, 2025-11-03T15:43:15.5793745Z  ) 2025-11-03T15:43:15.5794135Z  2025-11-03T15:43:15.5794533Z  if not json_response: 2025-11-03T15:43:15.5795175Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:15.5795979Z  return {} 2025-11-03T15:43:15.5796430Z  2025-11-03T15:43:15.5796827Z  return json_response 2025-11-03T15:43:15.5797412Z  2025-11-03T15:43:15.5797782Z  2025-11-03T15:43:15.5798410Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:15.5799182Z  """ 2025-11-03T15:43:15.5799771Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:15.5800457Z  """ 2025-11-03T15:43:15.5800987Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:15.5801629Z  return { 2025-11-03T15:43:15.5802273Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:15.5802988Z  } 2025-11-03T15:43:15.5803381Z  2025-11-03T15:43:15.5803741Z  2025-11-03T15:43:15.5804142Z def main() -> None: 2025-11-03T15:43:15.5804620Z  args = parse_args() 2025-11-03T15:43:15.5805097Z  2025-11-03T15:43:15.5805549Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:15.5806122Z  2025-11-03T15:43:15.5806521Z  # Check if the PR is opt-out 2025-11-03T15:43:15.5807155Z  if args.pr_number: 2025-11-03T15:43:15.5807894Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:15.5808694Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:15.5809238Z  log.info( 2025-11-03T15:43:15.5809995Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:15.5810793Z  ) 2025-11-03T15:43:15.5811417Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:15.5812138Z  sys.exit() 2025-11-03T15:43:15.5812730Z  2025-11-03T15:43:15.5813104Z  try: 2025-11-03T15:43:15.5813601Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:15.5814368Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:15.5815040Z  ) 2025-11-03T15:43:15.5815441Z  2025-11-03T15:43:15.5815863Z  username = get_potential_pr_author( 2025-11-03T15:43:15.5816436Z  args.github_token, 2025-11-03T15:43:15.5816964Z  args.github_repo, 2025-11-03T15:43:15.5817601Z  args.github_actor, 2025-11-03T15:43:15.5818149Z  args.github_ref_type, 2025-11-03T15:43:15.5818699Z  args.github_branch, 2025-11-03T15:43:15.5819201Z  ) 2025-11-03T15:43:15.5819600Z  2025-11-03T15:43:15.5820118Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:15.5820757Z  2025-11-03T15:43:15.5821209Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:15.5821789Z  rollout_state, 2025-11-03T15:43:15.5822351Z  (args.github_issue_owner, username), 2025-11-03T15:43:15.5822937Z  args.github_branch, 2025-11-03T15:43:15.5823501Z  args.eligible_experiments, 2025-11-03T15:43:15.5824093Z  args.opt_out_experiments, 2025-11-03T15:43:15.5824643Z  is_canary, 2025-11-03T15:43:15.5825113Z  ) 2025-11-03T15:43:15.5825507Z  2025-11-03T15:43:15.5825901Z  except Exception as e: 2025-11-03T15:43:15.5826407Z  log.error( 2025-11-03T15:43:15.5827263Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:15.5828063Z  ) 2025-11-03T15:43:15.5828610Z  2025-11-03T15:43:15.5829187Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:15.5829884Z  2025-11-03T15:43:15.5830259Z  2025-11-03T15:43:15.5830641Z if __name__ == "__main__": 2025-11-03T15:43:15.5831139Z  main() 2025-11-03T15:43:15.5831543Z  2025-11-03T15:43:15.5831909Z EOF 2025-11-03T15:43:15.5832282Z  2025-11-03T15:43:15.5832690Z cat runner_determinator.py 2025-11-03T15:43:15.9731171Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:15.9732296Z env: 2025-11-03T15:43:15.9733287Z GITHUB_TOKEN: *** 2025-11-03T15:43:15.9733962Z ISSUE_NUMBER: 5132 2025-11-03T15:43:15.9734670Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:15.9735494Z ISSUE_OWNER: 2025-11-03T15:43:15.9736130Z CHECK_EXPERIMENTS: 2025-11-03T15:43:15.9736826Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:15.9737902Z PR_NUMBER: 2025-11-03T15:43:15.9738541Z ##[endgroup] 2025-11-03T15:43:15.9976661Z # flake8: noqa: G004 2025-11-03T15:43:15.9977796Z 2025-11-03T15:43:15.9979233Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:15.9982457Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:15.9985323Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:15.9986944Z 2025-11-03T15:43:15.9987840Z """ 2025-11-03T15:43:15.9989960Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:15.9993009Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:15.9996188Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:15.9999388Z of which runners should be used to run which job. 2025-11-03T15:43:16.0000920Z 2025-11-03T15:43:16.0002354Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:16.0006080Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:16.0009980Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:16.0012848Z list, defined. 2025-11-03T15:43:16.0013743Z 2025-11-03T15:43:16.0015141Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:16.0019115Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:16.0022505Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:16.0024293Z 2025-11-03T15:43:16.0025777Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:16.0029540Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:16.0032469Z experiments which the user could be opted in to. 2025-11-03T15:43:16.0034039Z 2025-11-03T15:43:16.0034794Z The user list has the following rules: 2025-11-03T15:43:16.0036107Z 2025-11-03T15:43:16.0037506Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:16.0040756Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:16.0043719Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:16.0045269Z 2025-11-03T15:43:16.0045910Z Example config: 2025-11-03T15:43:16.0047715Z # A list of experiments that can be opted into. 2025-11-03T15:43:16.0050293Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:16.0052855Z # Expected syntax is: 2025-11-03T15:43:16.0055305Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:16.0059448Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:16.0061914Z 2025-11-03T15:43:16.0062564Z experiments: 2025-11-03T15:43:16.0064035Z lf: 2025-11-03T15:43:16.0065432Z rollout_percent: 25 2025-11-03T15:43:16.0067706Z all_branches: false 2025-11-03T15:43:16.0069403Z default: true 2025-11-03T15:43:16.0070947Z --- 2025-11-03T15:43:16.0071709Z 2025-11-03T15:43:16.0072369Z # Opt-ins: 2025-11-03T15:43:16.0074575Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:16.0078148Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:16.0081211Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:16.0083761Z # Experiments should be from the above list. 2025-11-03T15:43:16.0085255Z 2025-11-03T15:43:16.0085931Z @User1,-lf,split_build 2025-11-03T15:43:16.0087801Z @User2,lf 2025-11-03T15:43:16.0089219Z @User3,split_build 2025-11-03T15:43:16.0090702Z """ 2025-11-03T15:43:16.0091388Z 2025-11-03T15:43:16.0092020Z import json 2025-11-03T15:43:16.0093393Z import logging 2025-11-03T15:43:16.0094864Z import os 2025-11-03T15:43:16.0096232Z import random 2025-11-03T15:43:16.0097945Z import re 2025-11-03T15:43:16.0099238Z import sys 2025-11-03T15:43:16.0100682Z from argparse import ArgumentParser 2025-11-03T15:43:16.0102630Z from collections.abc import Iterable 2025-11-03T15:43:16.0104662Z from functools import cache 2025-11-03T15:43:16.0106454Z from logging import LogRecord 2025-11-03T15:43:16.0108538Z from typing import Any, NamedTuple 2025-11-03T15:43:16.0110615Z from urllib.request import Request, urlopen 2025-11-03T15:43:16.0112055Z 2025-11-03T15:43:16.0112648Z import yaml 2025-11-03T15:43:16.0114100Z from github import Auth, Github 2025-11-03T15:43:16.0115895Z from github.Issue import Issue 2025-11-03T15:43:16.0117279Z 2025-11-03T15:43:16.0117292Z 2025-11-03T15:43:16.0118068Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:16.0120597Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:16.0123939Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:16.0126179Z 2025-11-03T15:43:16.0127245Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:16.0129775Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:16.0131747Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:16.0133856Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:16.0135253Z 2025-11-03T15:43:16.0135953Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:16.0137515Z 2025-11-03T15:43:16.0138232Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:16.0140019Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:16.0141150Z 2025-11-03T15:43:16.0141167Z 2025-11-03T15:43:16.0141888Z class Experiment(NamedTuple): 2025-11-03T15:43:16.0143690Z rollout_perc: float = ( 2025-11-03T15:43:16.0146129Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:16.0148998Z ) 2025-11-03T15:43:16.0150351Z all_branches: bool = ( 2025-11-03T15:43:16.0152877Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:16.0155549Z ) 2025-11-03T15:43:16.0156898Z default: bool = ( 2025-11-03T15:43:16.0159318Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:16.0161842Z ) 2025-11-03T15:43:16.0162563Z 2025-11-03T15:43:16.0163184Z # Add more fields as needed 2025-11-03T15:43:16.0164317Z 2025-11-03T15:43:16.0164331Z 2025-11-03T15:43:16.0165010Z class Settings(NamedTuple): 2025-11-03T15:43:16.0166596Z """ 2025-11-03T15:43:16.0168478Z Settings for the experiments that can be opted into. 2025-11-03T15:43:16.0170663Z """ 2025-11-03T15:43:16.0171381Z 2025-11-03T15:43:16.0172167Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:16.0173602Z 2025-11-03T15:43:16.0173618Z 2025-11-03T15:43:16.0174400Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:16.0176775Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:16.0178785Z 2025-11-03T15:43:16.0179374Z COLORS = { 2025-11-03T15:43:16.0180828Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:16.0183046Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:16.0184921Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:16.0186771Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:16.0188822Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:16.0190579Z } 2025-11-03T15:43:16.0191297Z 2025-11-03T15:43:16.0192108Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:16.0194997Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:16.0198261Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:16.0200381Z return super().format(record) 2025-11-03T15:43:16.0201628Z 2025-11-03T15:43:16.0201642Z 2025-11-03T15:43:16.0202315Z handler = logging.StreamHandler() 2025-11-03T15:43:16.0204926Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:16.0207298Z 2025-11-03T15:43:16.0208216Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:16.0210455Z log.addHandler(handler) 2025-11-03T15:43:16.0212109Z log.setLevel(logging.INFO) 2025-11-03T15:43:16.0213190Z 2025-11-03T15:43:16.0213205Z 2025-11-03T15:43:16.0214069Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:16.0216127Z """ 2025-11-03T15:43:16.0218192Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:16.0220618Z """ 2025-11-03T15:43:16.0221920Z if not GITHUB_OUTPUT: 2025-11-03T15:43:16.0226210Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:16.0231132Z log.warning( 2025-11-03T15:43:16.0234404Z "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:16.0238224Z ) 2025-11-03T15:43:16.0252880Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:16.0254846Z return 2025-11-03T15:43:16.0255641Z 2025-11-03T15:43:16.0256600Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:16.0258971Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:16.0261048Z f.write(f"{key}={value}\n") 2025-11-03T15:43:16.0262270Z 2025-11-03T15:43:16.0262296Z 2025-11-03T15:43:16.0263390Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:16.0265796Z return frozenset( 2025-11-03T15:43:16.0268286Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:16.0326080Z ) 2025-11-03T15:43:16.0326893Z 2025-11-03T15:43:16.0326911Z 2025-11-03T15:43:16.0327755Z def parse_args() -> Any: 2025-11-03T15:43:16.0329841Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:16.0333181Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:16.0336259Z parser.add_argument( 2025-11-03T15:43:16.0338197Z "--github-issue-repo", 2025-11-03T15:43:16.0339896Z type=str, 2025-11-03T15:43:16.0341310Z required=False, 2025-11-03T15:43:16.0342975Z default="pytorch/test-infra", 2025-11-03T15:43:16.0344958Z help="GitHub repo to get the issue", 2025-11-03T15:43:16.0346916Z ) 2025-11-03T15:43:16.0348465Z parser.add_argument( 2025-11-03T15:43:16.0350103Z "--github-repo", 2025-11-03T15:43:16.0351685Z type=str, 2025-11-03T15:43:16.0352949Z required=True, 2025-11-03T15:43:16.0354578Z help="GitHub repo where CI is running", 2025-11-03T15:43:16.0356565Z ) 2025-11-03T15:43:16.0358107Z parser.add_argument( 2025-11-03T15:43:16.0360536Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:16.0363141Z ) 2025-11-03T15:43:16.0364514Z parser.add_argument( 2025-11-03T15:43:16.0366977Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:16.0369841Z ) 2025-11-03T15:43:16.0371186Z parser.add_argument( 2025-11-03T15:43:16.0374035Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:16.0376778Z ) 2025-11-03T15:43:16.0378376Z parser.add_argument( 2025-11-03T15:43:16.0380867Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:16.0383987Z ) 2025-11-03T15:43:16.0385395Z parser.add_argument( 2025-11-03T15:43:16.0387358Z "--github-ref-type", 2025-11-03T15:43:16.0389069Z type=str, 2025-11-03T15:43:16.0390542Z required=True, 2025-11-03T15:43:16.0392278Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:16.0394383Z ) 2025-11-03T15:43:16.0395731Z parser.add_argument( 2025-11-03T15:43:16.0397767Z "--eligible-experiments", 2025-11-03T15:43:16.0399767Z type=_str_comma_separated_to_set, 2025-11-03T15:43:16.0401757Z required=False, 2025-11-03T15:43:16.0403321Z default="", 2025-11-03T15:43:16.0406658Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:16.0410618Z ) 2025-11-03T15:43:16.0411956Z parser.add_argument( 2025-11-03T15:43:16.0413676Z "--opt-out-experiments", 2025-11-03T15:43:16.0415567Z type=_str_comma_separated_to_set, 2025-11-03T15:43:16.0418400Z required=False, 2025-11-03T15:43:16.0420030Z default="", 2025-11-03T15:43:16.0421470Z help=( 2025-11-03T15:43:16.0423971Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:16.0428686Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:16.0431509Z ), 2025-11-03T15:43:16.0432259Z ) 2025-11-03T15:43:16.0433035Z parser.add_argument( 2025-11-03T15:43:16.0434091Z "--pr-number", 2025-11-03T15:43:16.0435305Z type=str, 2025-11-03T15:43:16.0436126Z required=False, 2025-11-03T15:43:16.0437231Z default="", 2025-11-03T15:43:16.0438456Z help="the optional PR number where this is run", 2025-11-03T15:43:16.0439679Z ) 2025-11-03T15:43:16.0440081Z 2025-11-03T15:43:16.0440459Z return parser.parse_args() 2025-11-03T15:43:16.0441136Z 2025-11-03T15:43:16.0441144Z 2025-11-03T15:43:16.0442021Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:16.0443677Z auth = Auth.Token(github_token) 2025-11-03T15:43:16.0444738Z return Github(auth=auth) 2025-11-03T15:43:16.0445358Z 2025-11-03T15:43:16.0445366Z 2025-11-03T15:43:16.0446336Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:16.0448313Z repo = gh.get_repo(repo) 2025-11-03T15:43:16.0449949Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:16.0450962Z 2025-11-03T15:43:16.0450970Z 2025-11-03T15:43:16.0451358Z def get_potential_pr_author( 2025-11-03T15:43:16.0452724Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:16.0454227Z ) -> str: 2025-11-03T15:43:16.0455298Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:16.0457204Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:16.0458790Z # embedded in the tag name: ciflow// 2025-11-03T15:43:16.0459690Z 2025-11-03T15:43:16.0460054Z gh = get_gh_client(github_token) 2025-11-03T15:43:16.0460767Z 2025-11-03T15:43:16.0461309Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:16.0462600Z split_tag = ref_name.split("/") 2025-11-03T15:43:16.0463629Z if ( 2025-11-03T15:43:16.0464386Z len(split_tag) == 3 2025-11-03T15:43:16.0465359Z and split_tag[0] == "ciflow" 2025-11-03T15:43:16.0466453Z and split_tag[2].isnumeric() 2025-11-03T15:43:16.0467674Z ): 2025-11-03T15:43:16.0468439Z pr_number = split_tag[2] 2025-11-03T15:43:16.0469660Z try: 2025-11-03T15:43:16.0470556Z repository = gh.get_repo(repo) 2025-11-03T15:43:16.0471862Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:16.0473175Z except Exception as e: 2025-11-03T15:43:16.0474267Z raise Exception( # noqa: TRY002 2025-11-03T15:43:16.0475710Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:16.0477292Z ) from e 2025-11-03T15:43:16.0478450Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:16.0479988Z # In all other cases, return the original input username 2025-11-03T15:43:16.0481264Z return username 2025-11-03T15:43:16.0481759Z 2025-11-03T15:43:16.0481767Z 2025-11-03T15:43:16.0482232Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:16.0483355Z """ 2025-11-03T15:43:16.0484745Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:16.0486459Z """ 2025-11-03T15:43:16.0487785Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:16.0488944Z 2025-11-03T15:43:16.0488951Z 2025-11-03T15:43:16.0489353Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:16.0490390Z try: 2025-11-03T15:43:16.0491186Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:16.0492241Z return data 2025-11-03T15:43:16.0493087Z except yaml.YAMLError: 2025-11-03T15:43:16.0494086Z log.exception("Error loading YAML") 2025-11-03T15:43:16.0495161Z raise 2025-11-03T15:43:16.0495604Z 2025-11-03T15:43:16.0495612Z 2025-11-03T15:43:16.0496486Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:16.0498281Z """ 2025-11-03T15:43:16.0499614Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:16.0500964Z 2025-11-03T15:43:16.0501855Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:16.0503471Z and the text below is the list of opted in users. 2025-11-03T15:43:16.0504745Z 2025-11-03T15:43:16.0505890Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:16.0507640Z """ 2025-11-03T15:43:16.0508534Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:16.0509815Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:16.0511079Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:16.0512327Z else: 2025-11-03T15:43:16.0513101Z return "", rollout_state 2025-11-03T15:43:16.0513749Z 2025-11-03T15:43:16.0513757Z 2025-11-03T15:43:16.0514162Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:16.0515223Z """ 2025-11-03T15:43:16.0516351Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:16.0517941Z """ 2025-11-03T15:43:16.0518339Z 2025-11-03T15:43:16.0518359Z 2025-11-03T15:43:16.0519071Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:16.0520475Z """ 2025-11-03T15:43:16.0522009Z 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:16.0523556Z 2025-11-03T15:43:16.0524936Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:16.0527322Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:16.0528767Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:16.0529821Z 2025-11-03T15:43:16.0529829Z 2025-11-03T15:43:16.0530138Z """ 2025-11-03T15:43:16.0530890Z optins = UserOptins() 2025-11-03T15:43:16.0531884Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:16.0533054Z user = user.strip("\r\n\t -") 2025-11-03T15:43:16.0534180Z if not user or not user.startswith("@"): 2025-11-03T15:43:16.0535540Z # Not a valid user. Skip 2025-11-03T15:43:16.0536550Z continue 2025-11-03T15:43:16.0537267Z 2025-11-03T15:43:16.0537589Z if user: 2025-11-03T15:43:16.0538481Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:16.0539942Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:16.0541021Z 2025-11-03T15:43:16.0541355Z return optins 2025-11-03T15:43:16.0541837Z 2025-11-03T15:43:16.0541844Z 2025-11-03T15:43:16.0542424Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:16.0543687Z """ 2025-11-03T15:43:16.0544479Z Check if the experiment name is valid. 2025-11-03T15:43:16.0545556Z A valid name: 2025-11-03T15:43:16.0546877Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:16.0549119Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:16.0550668Z - Cannot contain spaces 2025-11-03T15:43:16.0551627Z """ 2025-11-03T15:43:16.0552029Z 2025-11-03T15:43:16.0552545Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:16.0554008Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:16.0554967Z 2025-11-03T15:43:16.0555282Z if valid: 2025-11-03T15:43:16.0556040Z return True 2025-11-03T15:43:16.0556523Z 2025-11-03T15:43:16.0556839Z log.error( 2025-11-03T15:43:16.0560146Z 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:16.0563617Z ) 2025-11-03T15:43:16.0564330Z return False 2025-11-03T15:43:16.0564795Z 2025-11-03T15:43:16.0564801Z 2025-11-03T15:43:16.0565429Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:16.0566722Z """ 2025-11-03T15:43:16.0568170Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:16.0569700Z """ 2025-11-03T15:43:16.0570397Z try: 2025-11-03T15:43:16.0571126Z if settings_text: 2025-11-03T15:43:16.0572659Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:16.0574361Z # for easy reading 2025-11-03T15:43:16.0576033Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:16.0578079Z # the backtick character in shell commands. 2025-11-03T15:43:16.0579333Z backtick = chr(96) # backtick character 2025-11-03T15:43:16.0580706Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:16.0582093Z settings = load_yaml(settings_text) 2025-11-03T15:43:16.0582869Z 2025-11-03T15:43:16.0583729Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:16.0585341Z experiments = {} 2025-11-03T15:43:16.0585950Z 2025-11-03T15:43:16.0586726Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:16.0588436Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:16.0591719Z # 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:16.0594087Z continue 2025-11-03T15:43:16.0594669Z 2025-11-03T15:43:16.0595027Z valid_settings = {} 2025-11-03T15:43:16.0596083Z for setting in exp_settings: 2025-11-03T15:43:16.0597366Z if setting not in Experiment._fields: 2025-11-03T15:43:16.0598518Z log.warning( 2025-11-03T15:43:16.0600004Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:16.0601753Z ) 2025-11-03T15:43:16.0602633Z else: 2025-11-03T15:43:16.0603671Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:16.0604579Z 2025-11-03T15:43:16.0605140Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:16.0606473Z return Settings(experiments) 2025-11-03T15:43:16.0607296Z 2025-11-03T15:43:16.0607643Z except Exception: 2025-11-03T15:43:16.0608599Z log.exception("Failed to parse settings") 2025-11-03T15:43:16.0609394Z 2025-11-03T15:43:16.0609729Z return Settings() 2025-11-03T15:43:16.0610255Z 2025-11-03T15:43:16.0610262Z 2025-11-03T15:43:16.0610752Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:16.0611903Z """ 2025-11-03T15:43:16.0612760Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:16.0613585Z 2025-11-03T15:43:16.0614311Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:16.0615946Z and the text below is the list of opted in users. 2025-11-03T15:43:16.0616788Z 2025-11-03T15:43:16.0617731Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:16.0619264Z """ 2025-11-03T15:43:16.0620376Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:16.0621949Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:16.0622787Z 2025-11-03T15:43:16.0622794Z 2025-11-03T15:43:16.0623285Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:16.0624725Z """ 2025-11-03T15:43:16.0625683Z Parse users from the rollout state. 2025-11-03T15:43:16.0626425Z 2025-11-03T15:43:16.0626733Z """ 2025-11-03T15:43:16.0627908Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:16.0629422Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:16.0630274Z 2025-11-03T15:43:16.0630281Z 2025-11-03T15:43:16.0631266Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:16.0632815Z """ 2025-11-03T15:43:16.0633672Z Check if a user is opted into an experiment 2025-11-03T15:43:16.0634764Z """ 2025-11-03T15:43:16.0635681Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:16.0637164Z 2025-11-03T15:43:16.0637180Z 2025-11-03T15:43:16.0638644Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:16.0640532Z """ 2025-11-03T15:43:16.0641460Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:16.0643379Z """ 2025-11-03T15:43:16.0645232Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:16.0647693Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:16.0649053Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:16.0650304Z return False 2025-11-03T15:43:16.0650825Z 2025-11-03T15:43:16.0651724Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:16.0653093Z log.warning( 2025-11-03T15:43:16.0654751Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:16.0656601Z ) 2025-11-03T15:43:16.0657155Z 2025-11-03T15:43:16.0657477Z return True 2025-11-03T15:43:16.0657943Z 2025-11-03T15:43:16.0657950Z 2025-11-03T15:43:16.0658293Z def get_runner_prefix( 2025-11-03T15:43:16.0659194Z rollout_state: str, 2025-11-03T15:43:16.0660110Z workflow_requestors: Iterable[str], 2025-11-03T15:43:16.0661141Z branch: str, 2025-11-03T15:43:16.0662114Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:16.0663470Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:16.0664663Z is_canary: bool = False, 2025-11-03T15:43:16.0665572Z ) -> str: 2025-11-03T15:43:16.0666388Z settings = parse_settings(rollout_state) 2025-11-03T15:43:16.0668326Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:16.0669112Z 2025-11-03T15:43:16.0669451Z fleet_prefix = "" 2025-11-03T15:43:16.0670306Z prefixes = [] 2025-11-03T15:43:16.0671570Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:16.0673505Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:16.0674958Z log.info( 2025-11-03T15:43:16.0676314Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:16.0678038Z ) 2025-11-03T15:43:16.0678775Z continue 2025-11-03T15:43:16.0679271Z 2025-11-03T15:43:16.0679631Z if opt_out_experiments: 2025-11-03T15:43:16.0680684Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:16.0681991Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:16.0683194Z log.info( 2025-11-03T15:43:16.0685077Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:16.0687229Z ) 2025-11-03T15:43:16.0688004Z continue 2025-11-03T15:43:16.0688538Z 2025-11-03T15:43:16.0688904Z if eligible_experiments: 2025-11-03T15:43:16.0690013Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:16.0691311Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:16.0692437Z log.info( 2025-11-03T15:43:16.0694029Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:16.0695764Z ) 2025-11-03T15:43:16.0696532Z continue 2025-11-03T15:43:16.0697567Z elif not experiment_settings.default: 2025-11-03T15:43:16.0698628Z log.info( 2025-11-03T15:43:16.0700125Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:16.0701638Z ) 2025-11-03T15:43:16.0702384Z continue 2025-11-03T15:43:16.0702870Z 2025-11-03T15:43:16.0703428Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:16.0704678Z opted_out_users = [ 2025-11-03T15:43:16.0705569Z requestor 2025-11-03T15:43:16.0706467Z for requestor in workflow_requestors 2025-11-03T15:43:16.0708136Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:16.0709418Z ] 2025-11-03T15:43:16.0709831Z 2025-11-03T15:43:16.0710174Z if opted_out_users: 2025-11-03T15:43:16.0711056Z log.info( 2025-11-03T15:43:16.0712290Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:16.0713712Z ) 2025-11-03T15:43:16.0714442Z continue 2025-11-03T15:43:16.0714924Z 2025-11-03T15:43:16.0715469Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:16.0716705Z opted_in_users = [ 2025-11-03T15:43:16.0717744Z requestor 2025-11-03T15:43:16.0718640Z for requestor in workflow_requestors 2025-11-03T15:43:16.0719977Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:16.0721220Z ] 2025-11-03T15:43:16.0721629Z 2025-11-03T15:43:16.0721968Z enabled = False 2025-11-03T15:43:16.0722815Z if opted_in_users: 2025-11-03T15:43:16.0723675Z log.info( 2025-11-03T15:43:16.0724870Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:16.0726259Z ) 2025-11-03T15:43:16.0727134Z enabled = True 2025-11-03T15:43:16.0727689Z 2025-11-03T15:43:16.0728105Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:16.0729775Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:16.0731828Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:16.0733136Z log.info( 2025-11-03T15:43:16.0734875Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:16.0736733Z ) 2025-11-03T15:43:16.0737646Z enabled = True 2025-11-03T15:43:16.0738234Z 2025-11-03T15:43:16.0738546Z if enabled: 2025-11-03T15:43:16.0739354Z label = experiment_name 2025-11-03T15:43:16.0740424Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:16.0742080Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:16.0743853Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:16.0745369Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:16.0746715Z if is_canary: 2025-11-03T15:43:16.0747759Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:16.0748830Z fleet_prefix = label 2025-11-03T15:43:16.0749782Z else: 2025-11-03T15:43:16.0750607Z prefixes.append(label) 2025-11-03T15:43:16.0751320Z 2025-11-03T15:43:16.0751676Z if len(prefixes) > 1: 2025-11-03T15:43:16.0752529Z log.error( 2025-11-03T15:43:16.0754636Z 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:16.0756922Z ) 2025-11-03T15:43:16.0757766Z prefixes = prefixes[:1] 2025-11-03T15:43:16.0758371Z 2025-11-03T15:43:16.0758729Z # Fleet always comes first 2025-11-03T15:43:16.0759652Z if fleet_prefix: 2025-11-03T15:43:16.0760525Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:16.0761244Z 2025-11-03T15:43:16.0761838Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:16.0762663Z 2025-11-03T15:43:16.0762671Z 2025-11-03T15:43:16.0763527Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:16.0765055Z """ 2025-11-03T15:43:16.0766207Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:16.0767442Z 2025-11-03T15:43:16.0768208Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:16.0769624Z """ 2025-11-03T15:43:16.0770371Z gh = get_gh_client(github_token) 2025-11-03T15:43:16.0771402Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:16.0772625Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:16.0773491Z 2025-11-03T15:43:16.0773498Z 2025-11-03T15:43:16.0774277Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:16.0775768Z for _ in range(num_retries): 2025-11-03T15:43:16.0776678Z try: 2025-11-03T15:43:16.0777586Z req = Request(url=url, headers=headers) 2025-11-03T15:43:16.0778882Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:16.0780147Z return json.loads(content) 2025-11-03T15:43:16.0781170Z except Exception as e: 2025-11-03T15:43:16.0782208Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:16.0783002Z 2025-11-03T15:43:16.0783735Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:16.0785158Z return {} 2025-11-03T15:43:16.0785581Z 2025-11-03T15:43:16.0785588Z 2025-11-03T15:43:16.0785884Z @cache 2025-11-03T15:43:16.0787171Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:16.0788662Z """ 2025-11-03T15:43:16.0789441Z Dynamically get PR information 2025-11-03T15:43:16.0790376Z """ 2025-11-03T15:43:16.0791463Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:16.0792684Z headers = { 2025-11-03T15:43:16.0793546Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:16.0794720Z "Authorization": f"token {github_token}", 2025-11-03T15:43:16.0795773Z } 2025-11-03T15:43:16.0796581Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:16.0797869Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:16.0798935Z headers=headers, 2025-11-03T15:43:16.0799743Z ) 2025-11-03T15:43:16.0800122Z 2025-11-03T15:43:16.0800465Z if not json_response: 2025-11-03T15:43:16.0801546Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:16.0802759Z return {} 2025-11-03T15:43:16.0803207Z 2025-11-03T15:43:16.0803540Z return json_response 2025-11-03T15:43:16.0804082Z 2025-11-03T15:43:16.0804090Z 2025-11-03T15:43:16.0804848Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:16.0806279Z """ 2025-11-03T15:43:16.0807361Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:16.0808644Z """ 2025-11-03T15:43:16.0809553Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:16.0810743Z return { 2025-11-03T15:43:16.0811871Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:16.0813255Z } 2025-11-03T15:43:16.0813631Z 2025-11-03T15:43:16.0813639Z 2025-11-03T15:43:16.0813967Z def main() -> None: 2025-11-03T15:43:16.0814751Z args = parse_args() 2025-11-03T15:43:16.0815255Z 2025-11-03T15:43:16.0815674Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:16.0816426Z 2025-11-03T15:43:16.0816780Z # Check if the PR is opt-out 2025-11-03T15:43:16.0817810Z if args.pr_number: 2025-11-03T15:43:16.0819060Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:16.0820675Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:16.0821628Z log.info( 2025-11-03T15:43:16.0822973Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:16.0824492Z ) 2025-11-03T15:43:16.0825531Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:16.0826834Z sys.exit() 2025-11-03T15:43:16.0827431Z 2025-11-03T15:43:16.0827732Z try: 2025-11-03T15:43:16.0828563Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:16.0829951Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:16.0831216Z ) 2025-11-03T15:43:16.0831609Z 2025-11-03T15:43:16.0832004Z username = get_potential_pr_author( 2025-11-03T15:43:16.0833049Z args.github_token, 2025-11-03T15:43:16.0833976Z args.github_repo, 2025-11-03T15:43:16.0834891Z args.github_actor, 2025-11-03T15:43:16.0835832Z args.github_ref_type, 2025-11-03T15:43:16.0836789Z args.github_branch, 2025-11-03T15:43:16.0837764Z ) 2025-11-03T15:43:16.0838159Z 2025-11-03T15:43:16.0838706Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:16.0839605Z 2025-11-03T15:43:16.0840014Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:16.0841082Z rollout_state, 2025-11-03T15:43:16.0842006Z (args.github_issue_owner, username), 2025-11-03T15:43:16.0843083Z args.github_branch, 2025-11-03T15:43:16.0844034Z args.eligible_experiments, 2025-11-03T15:43:16.0845086Z args.opt_out_experiments, 2025-11-03T15:43:16.0846051Z is_canary, 2025-11-03T15:43:16.0846835Z ) 2025-11-03T15:43:16.0847332Z 2025-11-03T15:43:16.0847682Z except Exception as e: 2025-11-03T15:43:16.0848549Z log.error( 2025-11-03T15:43:16.0849857Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:16.0851613Z ) 2025-11-03T15:43:16.0852013Z 2025-11-03T15:43:16.0852644Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:16.0853617Z 2025-11-03T15:43:16.0853624Z 2025-11-03T15:43:16.0853960Z if __name__ == "__main__": 2025-11-03T15:43:16.0854808Z main() 2025-11-03T15:43:16.0855211Z 2025-11-03T15:43:16.0964537Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:16.0966209Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:16.1001196Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:16.1002080Z env: 2025-11-03T15:43:16.1003190Z GITHUB_TOKEN: *** 2025-11-03T15:43:16.1003994Z ISSUE_NUMBER: 5132 2025-11-03T15:43:16.1004856Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:16.1005832Z ISSUE_OWNER: 2025-11-03T15:43:16.1006597Z CHECK_EXPERIMENTS: 2025-11-03T15:43:16.1007612Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:16.1008464Z PR_NUMBER: 2025-11-03T15:43:16.1009222Z ##[endgroup] 2025-11-03T15:43:17.4950685Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:18.6838044Z Collecting urllib3==1.26.18 2025-11-03T15:43:18.7232997Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:18.7554721Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-11-03T15:43:18.7666255Z Collecting PyGithub==2.3.0 2025-11-03T15:43:18.7696900Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:18.8134911Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:18.8167570Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:18.8212670Z 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:18.8230129Z 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:18.8244713Z 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:18.8488313Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:18.8519086Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:18.8803207Z 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:19.0004634Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:19.0038310Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:19.1529461Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:19.1562442Z 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:19.1758640Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:19.1789055Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:19.2027297Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:19.2086901Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 33.9 MB/s eta 0:00:00 2025-11-03T15:43:19.2130071Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:19.2184118Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 91.7 MB/s eta 0:00:00 2025-11-03T15:43:19.2213945Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:19.2325454Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 147.2 MB/s eta 0:00:00 2025-11-03T15:43:19.2356783Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:19.2405497Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:19.2449963Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 71.7 MB/s eta 0:00:00 2025-11-03T15:43:19.2481085Z 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:19.2522779Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 45.1 MB/s eta 0:00:00 2025-11-03T15:43:19.2551340Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:19.2592624Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 42.7 MB/s eta 0:00:00 2025-11-03T15:43:19.5705783Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:20.1164316Z 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:20.2123620Z ##[group]Run curr_branch="main" 2025-11-03T15:43:20.2123926Z curr_branch="main" 2025-11-03T15:43:20.2124144Z curr_ref_type="branch" 2025-11-03T15:43:20.2124382Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:20.2124654Z  2025-11-03T15:43:20.2124831Z python3 runner_determinator.py \ 2025-11-03T15:43:20.2125101Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:20.2125363Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:20.2125607Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:20.2125865Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:20.2126161Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:20.2126432Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:20.2126693Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:20.2127150Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:20.2127507Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:20.2127792Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:20.2161569Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:20.2161805Z env: 2025-11-03T15:43:20.2162255Z GITHUB_TOKEN: *** 2025-11-03T15:43:20.2162447Z ISSUE_NUMBER: 5132 2025-11-03T15:43:20.2162659Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:20.2162885Z ISSUE_OWNER: 2025-11-03T15:43:20.2163068Z CHECK_EXPERIMENTS: 2025-11-03T15:43:20.2163268Z OPT_OUT_EXPERIMENTS: lf 2025-11-03T15:43:20.2163464Z PR_NUMBER: 2025-11-03T15:43:20.2163630Z ##[endgroup] 2025-11-03T15:43:20.2216010Z Current branch is 'main' 2025-11-03T15:43:21.7861868Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-11-03T15:43:21.7863352Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:21.7864497Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:21.7865298Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:21.7865868Z INFO : Setting output: label-type='' 2025-11-03T15:43:21.8200555Z Evaluate and set job outputs 2025-11-03T15:43:21.8207746Z Cleaning up orphan processes