2025-08-26T19:31:40.4762831Z Current runner version: '2.328.0' 2025-08-26T19:31:40.4788074Z ##[group]Runner Image Provisioner 2025-08-26T19:31:40.4788873Z Hosted Compute Agent 2025-08-26T19:31:40.4789518Z Version: 20250818.377 2025-08-26T19:31:40.4790146Z Commit: 3c593e9f75fe0b87e893bca80d6e12ba089c61fc 2025-08-26T19:31:40.4790913Z Build Date: 2025-08-18T14:52:18Z 2025-08-26T19:31:40.4791807Z ##[endgroup] 2025-08-26T19:31:40.4792424Z ##[group]Operating System 2025-08-26T19:31:40.4793021Z Ubuntu 2025-08-26T19:31:40.4793608Z 24.04.2 2025-08-26T19:31:40.4794098Z LTS 2025-08-26T19:31:40.4794611Z ##[endgroup] 2025-08-26T19:31:40.4795169Z ##[group]Runner Image 2025-08-26T19:31:40.4795825Z Image: ubuntu-24.04 2025-08-26T19:31:40.4796357Z Version: 20250818.1.0 2025-08-26T19:31:40.4797618Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:40.4799416Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:40.4800587Z ##[endgroup] 2025-08-26T19:31:40.4802016Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:40.4804354Z Contents: read 2025-08-26T19:31:40.4804952Z Metadata: read 2025-08-26T19:31:40.4805479Z ##[endgroup] 2025-08-26T19:31:40.4808127Z Secret source: Actions 2025-08-26T19:31:40.4809062Z Prepare workflow directory 2025-08-26T19:31:40.5312597Z Prepare all required actions 2025-08-26T19:31:40.5369391Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:40.5374837Z ##[group] Inputs 2025-08-26T19:31:40.5375925Z check_experiments: 2025-08-26T19:31:40.5376668Z opt_out_experiments: 2025-08-26T19:31:40.5377278Z triggering_actor: pytorchmergebot 2025-08-26T19:31:40.5377894Z issue_owner: 2025-08-26T19:31:40.5378492Z curr_branch: main 2025-08-26T19:31:40.5379013Z curr_ref_type: branch 2025-08-26T19:31:40.5379688Z issue_number: 5132 2025-08-26T19:31:40.5380340Z ##[endgroup] 2025-08-26T19:31:40.5381272Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-26T19:31:41.0636772Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:41.0639390Z cat < runner_determinator.py 2025-08-26T19:31:41.0640141Z # flake8: noqa: G004 2025-08-26T19:31:41.0640762Z  2025-08-26T19:31:41.0642213Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:41.0643538Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:41.0644685Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:41.0645591Z  2025-08-26T19:31:41.0646129Z """ 2025-08-26T19:31:41.0646957Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:41.0648251Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:41.0649664Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:41.0650900Z of which runners should be used to run which job. 2025-08-26T19:31:41.0651833Z  2025-08-26T19:31:41.0652695Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:41.0654050Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:41.0655288Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:41.0656335Z list, defined. 2025-08-26T19:31:41.0656881Z  2025-08-26T19:31:41.0657791Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:41.0659100Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:41.0660246Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:41.0661509Z  2025-08-26T19:31:41.0662663Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:41.0663917Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:41.0665095Z experiments which the user could be opted in to. 2025-08-26T19:31:41.0665876Z  2025-08-26T19:31:41.0666459Z The user list has the following rules: 2025-08-26T19:31:41.0667223Z  2025-08-26T19:31:41.0668028Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:41.0669206Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:41.0670370Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:41.0671371Z  2025-08-26T19:31:41.0671890Z Example config: 2025-08-26T19:31:41.0672675Z  # A list of experiments that can be opted into. 2025-08-26T19:31:41.0673639Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:41.0674563Z  # Expected syntax is: 2025-08-26T19:31:41.0762899Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:41.0765304Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.0767083Z  2025-08-26T19:31:41.0767764Z  experiments: 2025-08-26T19:31:41.0768280Z  lf: 2025-08-26T19:31:41.0768769Z  rollout_percent: 25 2025-08-26T19:31:41.0769367Z  all_branches: false 2025-08-26T19:31:41.0769952Z  default: true 2025-08-26T19:31:41.0770477Z  --- 2025-08-26T19:31:41.0770922Z  2025-08-26T19:31:41.0771597Z  # Opt-ins: 2025-08-26T19:31:41.0772381Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.0773757Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.0774764Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.0775623Z  # Experiments should be from the above list. 2025-08-26T19:31:41.0776299Z  2025-08-26T19:31:41.0776756Z  @User1,-lf,split_build 2025-08-26T19:31:41.0777338Z  @User2,lf 2025-08-26T19:31:41.0777847Z  @User3,split_build 2025-08-26T19:31:41.0778361Z """ 2025-08-26T19:31:41.0778761Z  2025-08-26T19:31:41.0779158Z import json 2025-08-26T19:31:41.0779599Z import logging 2025-08-26T19:31:41.0780061Z import os 2025-08-26T19:31:41.0780493Z import random 2025-08-26T19:31:41.0780946Z import re 2025-08-26T19:31:41.0781617Z import sys 2025-08-26T19:31:41.0782131Z from argparse import ArgumentParser 2025-08-26T19:31:41.0782830Z from collections.abc import Iterable 2025-08-26T19:31:41.0783454Z from functools import cache 2025-08-26T19:31:41.0784033Z from logging import LogRecord 2025-08-26T19:31:41.0784621Z from typing import Any, NamedTuple 2025-08-26T19:31:41.0785274Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.0785903Z  2025-08-26T19:31:41.0786297Z import yaml 2025-08-26T19:31:41.0786781Z from github import Auth, Github 2025-08-26T19:31:41.0787380Z from github.Issue import Issue 2025-08-26T19:31:41.0787924Z  2025-08-26T19:31:41.0788309Z  2025-08-26T19:31:41.0788785Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.0789592Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.0790634Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.0791803Z  2025-08-26T19:31:41.0792507Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.0793189Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.0793818Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.0794502Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.0795107Z  2025-08-26T19:31:41.0795555Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.0796125Z  2025-08-26T19:31:41.0796535Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.0797092Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.0797607Z  2025-08-26T19:31:41.0797992Z  2025-08-26T19:31:41.0798408Z class Experiment(NamedTuple): 2025-08-26T19:31:41.0798993Z  rollout_perc: float = ( 2025-08-26T19:31:41.0799772Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.0800555Z  ) 2025-08-26T19:31:41.0800995Z  all_branches: bool = ( 2025-08-26T19:31:41.0801948Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.0802720Z  ) 2025-08-26T19:31:41.0803141Z  default: bool = ( 2025-08-26T19:31:41.0803831Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.0804562Z  ) 2025-08-26T19:31:41.0804969Z  2025-08-26T19:31:41.0805384Z  # Add more fields as needed 2025-08-26T19:31:41.0805930Z  2025-08-26T19:31:41.0806310Z  2025-08-26T19:31:41.0806719Z class Settings(NamedTuple): 2025-08-26T19:31:41.0807252Z  """ 2025-08-26T19:31:41.0807806Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:41.0808474Z  """ 2025-08-26T19:31:41.0808880Z  2025-08-26T19:31:41.0809347Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.0809950Z  2025-08-26T19:31:41.0810465Z  2025-08-26T19:31:41.0810943Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.0811891Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.0812577Z  2025-08-26T19:31:41.0812961Z  COLORS = { 2025-08-26T19:31:41.0813460Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.0814048Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.0814634Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.0815223Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.0815800Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.0816347Z  } 2025-08-26T19:31:41.0816747Z  2025-08-26T19:31:41.0817225Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.0818083Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.0818980Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.0819644Z  return super().format(record) 2025-08-26T19:31:41.0820206Z  2025-08-26T19:31:41.0820589Z  2025-08-26T19:31:41.0821166Z handler = logging.StreamHandler() 2025-08-26T19:31:41.0822078Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.0822886Z  2025-08-26T19:31:41.0823405Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.0824071Z log.addHandler(handler) 2025-08-26T19:31:41.0824606Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.0825143Z  2025-08-26T19:31:41.0825518Z  2025-08-26T19:31:41.0826033Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.0826679Z  """ 2025-08-26T19:31:41.0827277Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.0828133Z  """ 2025-08-26T19:31:41.0828606Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:41.0829811Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.0831629Z  log.warning( 2025-08-26T19:31:41.0832684Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.0833706Z  ) 2025-08-26T19:31:41.0834232Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.0834849Z  return 2025-08-26T19:31:41.0835311Z  2025-08-26T19:31:41.0835757Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.0836413Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.0837063Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:41.0837627Z  2025-08-26T19:31:41.0838025Z  2025-08-26T19:31:41.0838601Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.0839348Z  return frozenset( 2025-08-26T19:31:41.0840074Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.0840830Z  ) 2025-08-26T19:31:41.0841356Z  2025-08-26T19:31:41.0841736Z  2025-08-26T19:31:41.0842148Z def parse_args() -> Any: 2025-08-26T19:31:41.0842834Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.0843826Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.0844696Z  parser.add_argument( 2025-08-26T19:31:41.0845267Z  "--github-issue-repo", 2025-08-26T19:31:41.0845825Z  type=str, 2025-08-26T19:31:41.0846328Z  required=False, 2025-08-26T19:31:41.0847050Z  default="pytorch/test-infra", 2025-08-26T19:31:41.0847719Z  help="GitHub repo to get the issue", 2025-08-26T19:31:41.0848311Z  ) 2025-08-26T19:31:41.0848756Z  parser.add_argument( 2025-08-26T19:31:41.0849309Z  "--github-repo", 2025-08-26T19:31:41.0849831Z  type=str, 2025-08-26T19:31:41.0850336Z  required=True, 2025-08-26T19:31:41.0850925Z  help="GitHub repo where CI is running", 2025-08-26T19:31:41.0851642Z  ) 2025-08-26T19:31:41.0852085Z  parser.add_argument( 2025-08-26T19:31:41.0852826Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.0853589Z  ) 2025-08-26T19:31:41.0854029Z  parser.add_argument( 2025-08-26T19:31:41.0854798Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.0855603Z  ) 2025-08-26T19:31:41.0856047Z  parser.add_argument( 2025-08-26T19:31:41.0856837Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.0857634Z  ) 2025-08-26T19:31:41.0858082Z  parser.add_argument( 2025-08-26T19:31:41.0858882Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.0859691Z  ) 2025-08-26T19:31:41.0860159Z  parser.add_argument( 2025-08-26T19:31:41.0860704Z  "--github-ref-type", 2025-08-26T19:31:41.0861394Z  type=str, 2025-08-26T19:31:41.0861889Z  required=True, 2025-08-26T19:31:41.0862524Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.0863170Z  ) 2025-08-26T19:31:41.0863611Z  parser.add_argument( 2025-08-26T19:31:41.0864331Z  "--eligible-experiments", 2025-08-26T19:31:41.0864971Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.0865580Z  required=False, 2025-08-26T19:31:41.0866111Z  default="", 2025-08-26T19:31:41.0867126Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.0868174Z  ) 2025-08-26T19:31:41.0868610Z  parser.add_argument( 2025-08-26T19:31:41.0869175Z  "--opt-out-experiments", 2025-08-26T19:31:41.0869793Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.0870386Z  required=False, 2025-08-26T19:31:41.0870914Z  default="", 2025-08-26T19:31:41.0871511Z  help=( 2025-08-26T19:31:41.0872315Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.0873632Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.0874591Z  ), 2025-08-26T19:31:41.0875030Z  ) 2025-08-26T19:31:41.0875469Z  parser.add_argument( 2025-08-26T19:31:41.0876013Z  "--pr-number", 2025-08-26T19:31:41.0876524Z  type=str, 2025-08-26T19:31:41.0877025Z  required=False, 2025-08-26T19:31:41.0877554Z  default="", 2025-08-26T19:31:41.0878152Z  help="the optional PR number where this is run", 2025-08-26T19:31:41.0878792Z  ) 2025-08-26T19:31:41.0879216Z  2025-08-26T19:31:41.0879659Z  return parser.parse_args() 2025-08-26T19:31:41.0880209Z  2025-08-26T19:31:41.0880596Z  2025-08-26T19:31:41.0881386Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.0882413Z  auth = Auth.Token(github_token) 2025-08-26T19:31:41.0883049Z  return Github(auth=auth) 2025-08-26T19:31:41.0883593Z  2025-08-26T19:31:41.0883975Z  2025-08-26T19:31:41.0884725Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.0885655Z  repo = gh.get_repo(repo) 2025-08-26T19:31:41.0886278Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.0886881Z  2025-08-26T19:31:41.0887259Z  2025-08-26T19:31:41.0887680Z def get_potential_pr_author( 2025-08-26T19:31:41.0888459Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.0889246Z ) -> str: 2025-08-26T19:31:41.0889883Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.0890820Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.0891816Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:41.0892478Z  2025-08-26T19:31:41.0892922Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.0893493Z  2025-08-26T19:31:41.0894032Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.0894765Z  split_tag = ref_name.split("/") 2025-08-26T19:31:41.0895350Z  if ( 2025-08-26T19:31:41.0895821Z  len(split_tag) == 3 2025-08-26T19:31:41.0896412Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:41.0897045Z  and split_tag[2].isnumeric() 2025-08-26T19:31:41.0897621Z  ): 2025-08-26T19:31:41.0898103Z  pr_number = split_tag[2] 2025-08-26T19:31:41.0898680Z  try: 2025-08-26T19:31:41.0899212Z  repository = gh.get_repo(repo) 2025-08-26T19:31:41.0900081Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.0900799Z  except Exception as e: 2025-08-26T19:31:41.0901533Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:41.0902316Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.0903066Z  ) from e 2025-08-26T19:31:41.0903733Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.0904557Z  # In all other cases, return the original input username 2025-08-26T19:31:41.0905246Z  return username 2025-08-26T19:31:41.0905741Z  2025-08-26T19:31:41.0906138Z  2025-08-26T19:31:41.0906619Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.0907240Z  """ 2025-08-26T19:31:41.0908022Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.0908928Z  """ 2025-08-26T19:31:41.0909573Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.0910331Z  2025-08-26T19:31:41.0910727Z  2025-08-26T19:31:41.0911267Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.0911853Z  try: 2025-08-26T19:31:41.0912328Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.0912926Z  return data 2025-08-26T19:31:41.0913446Z  except yaml.YAMLError: 2025-08-26T19:31:41.0914042Z  log.exception("Error loading YAML") 2025-08-26T19:31:41.0914650Z  raise 2025-08-26T19:31:41.0915091Z  2025-08-26T19:31:41.0915473Z  2025-08-26T19:31:41.0916178Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.0917038Z  """ 2025-08-26T19:31:41.0917915Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.0918787Z  2025-08-26T19:31:41.0919409Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.0920312Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.0920950Z  2025-08-26T19:31:41.0921701Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.0922506Z  """ 2025-08-26T19:31:41.0923043Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.0923727Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.0924575Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.0925379Z  else: 2025-08-26T19:31:41.0925843Z  return "", rollout_state 2025-08-26T19:31:41.0926389Z  2025-08-26T19:31:41.0926773Z  2025-08-26T19:31:41.0927228Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.0927824Z  """ 2025-08-26T19:31:41.0928477Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.0929217Z  """ 2025-08-26T19:31:41.0929624Z  2025-08-26T19:31:41.0929988Z  2025-08-26T19:31:41.0930591Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.0931433Z  """ 2025-08-26T19:31:41.0932262Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.0933208Z  2025-08-26T19:31:41.0934128Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.0935284Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.0936215Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.0936943Z  2025-08-26T19:31:41.0937312Z  2025-08-26T19:31:41.0937697Z  """ 2025-08-26T19:31:41.0938134Z  optins = UserOptins() 2025-08-26T19:31:41.0938725Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.0939376Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:41.0940016Z  if not user or not user.startswith("@"): 2025-08-26T19:31:41.0940659Z  # Not a valid user. Skip 2025-08-26T19:31:41.0941327Z  continue 2025-08-26T19:31:41.0941842Z  2025-08-26T19:31:41.0942233Z  if user: 2025-08-26T19:31:41.0942778Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.0943576Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.0944303Z  2025-08-26T19:31:41.0944711Z  return optins 2025-08-26T19:31:41.0945176Z  2025-08-26T19:31:41.0945556Z  2025-08-26T19:31:41.0946117Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.0946821Z  """ 2025-08-26T19:31:41.0947296Z  Check if the experiment name is valid. 2025-08-26T19:31:41.0947905Z  A valid name: 2025-08-26T19:31:41.0948684Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.0949758Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.0950579Z  - Cannot contain spaces 2025-08-26T19:31:41.0951210Z  """ 2025-08-26T19:31:41.0951615Z  2025-08-26T19:31:41.0952136Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.0952955Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.0953863Z  2025-08-26T19:31:41.0954431Z  if valid: 2025-08-26T19:31:41.0954908Z  return True 2025-08-26T19:31:41.0955379Z  2025-08-26T19:31:41.0955776Z  log.error( 2025-08-26T19:31:41.0957473Z  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-08-26T19:31:41.0959199Z  ) 2025-08-26T19:31:41.0959623Z  return False 2025-08-26T19:31:41.0960073Z  2025-08-26T19:31:41.0960444Z  2025-08-26T19:31:41.0961018Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.0961844Z  """ 2025-08-26T19:31:41.0962528Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.0963334Z  """ 2025-08-26T19:31:41.0963744Z  try: 2025-08-26T19:31:41.0964167Z  if settings_text: 2025-08-26T19:31:41.0965007Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.0965887Z  # for easy reading 2025-08-26T19:31:41.0966828Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.0967866Z  # the backtick character in shell commands. 2025-08-26T19:31:41.0968570Z  backtick = chr(96) # backtick character 2025-08-26T19:31:41.0969367Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.0970141Z  settings = load_yaml(settings_text) 2025-08-26T19:31:41.0970730Z  2025-08-26T19:31:41.0971500Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.0972493Z  experiments = {} 2025-08-26T19:31:41.0973034Z  2025-08-26T19:31:41.0973665Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.0974540Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.0975788Z  # 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-08-26T19:31:41.0976985Z  continue 2025-08-26T19:31:41.0977514Z  2025-08-26T19:31:41.0977935Z  valid_settings = {} 2025-08-26T19:31:41.0978546Z  for setting in exp_settings: 2025-08-26T19:31:41.0979205Z  if setting not in Experiment._fields: 2025-08-26T19:31:41.0979856Z  log.warning( 2025-08-26T19:31:41.0980709Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.0981894Z  ) 2025-08-26T19:31:41.0982430Z  else: 2025-08-26T19:31:41.0983049Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.0983709Z  2025-08-26T19:31:41.0984244Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.0984985Z  return Settings(experiments) 2025-08-26T19:31:41.0985566Z  2025-08-26T19:31:41.0985969Z  except Exception: 2025-08-26T19:31:41.0986570Z  log.exception("Failed to parse settings") 2025-08-26T19:31:41.0987185Z  2025-08-26T19:31:41.0987593Z  return Settings() 2025-08-26T19:31:41.0988081Z  2025-08-26T19:31:41.0988483Z  2025-08-26T19:31:41.0989154Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.0989838Z  """ 2025-08-26T19:31:41.0990363Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.0990998Z  2025-08-26T19:31:41.0991743Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.0992636Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.0993270Z  2025-08-26T19:31:41.0993945Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.0994769Z  """ 2025-08-26T19:31:41.0995431Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.0996323Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.0996940Z  2025-08-26T19:31:41.0997317Z  2025-08-26T19:31:41.0997844Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.0998502Z  """ 2025-08-26T19:31:41.0998980Z  Parse users from the rollout state. 2025-08-26T19:31:41.0999558Z  2025-08-26T19:31:41.0999944Z  """ 2025-08-26T19:31:41.1000584Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.1001547Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.1002182Z  2025-08-26T19:31:41.1002556Z  2025-08-26T19:31:41.1003264Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.1004114Z  """ 2025-08-26T19:31:41.1004630Z  Check if a user is opted into an experiment 2025-08-26T19:31:41.1005240Z  """ 2025-08-26T19:31:41.1005795Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.1006467Z  2025-08-26T19:31:41.1006981Z  2025-08-26T19:31:41.1007704Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.1008559Z  """ 2025-08-26T19:31:41.1009110Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.1009774Z  """ 2025-08-26T19:31:41.1010374Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.1011292Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.1012051Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.1012767Z  return False 2025-08-26T19:31:41.1013256Z  2025-08-26T19:31:41.1013805Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.1014497Z  log.warning( 2025-08-26T19:31:41.1015472Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.1016478Z  ) 2025-08-26T19:31:41.1016894Z  2025-08-26T19:31:41.1017304Z  return True 2025-08-26T19:31:41.1017762Z  2025-08-26T19:31:41.1018147Z  2025-08-26T19:31:41.1018551Z def get_runner_prefix( 2025-08-26T19:31:41.1019090Z  rollout_state: str, 2025-08-26T19:31:41.1019659Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:41.1020267Z  branch: str, 2025-08-26T19:31:41.1020881Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.1021760Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.1022450Z  is_canary: bool = False, 2025-08-26T19:31:41.1022983Z ) -> str: 2025-08-26T19:31:41.1023509Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:41.1024184Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.1024793Z  2025-08-26T19:31:41.1025318Z  fleet_prefix = "" 2025-08-26T19:31:41.1025823Z  prefixes = [] 2025-08-26T19:31:41.1026576Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.1027654Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.1028492Z  log.info( 2025-08-26T19:31:41.1029286Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.1030138Z  ) 2025-08-26T19:31:41.1030613Z  continue 2025-08-26T19:31:41.1031224Z  2025-08-26T19:31:41.1031658Z  if opt_out_experiments: 2025-08-26T19:31:41.1032296Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.1033051Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.1033747Z  log.info( 2025-08-26T19:31:41.1034828Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.1035938Z  ) 2025-08-26T19:31:41.1036421Z  continue 2025-08-26T19:31:41.1036963Z  2025-08-26T19:31:41.1037385Z  if eligible_experiments: 2025-08-26T19:31:41.1038067Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.1038795Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.1039432Z  log.info( 2025-08-26T19:31:41.1040344Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.1041385Z  ) 2025-08-26T19:31:41.1042035Z  continue 2025-08-26T19:31:41.1042618Z  elif not experiment_settings.default: 2025-08-26T19:31:41.1043222Z  log.info( 2025-08-26T19:31:41.1044009Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.1044836Z  ) 2025-08-26T19:31:41.1045293Z  continue 2025-08-26T19:31:41.1045756Z  2025-08-26T19:31:41.1046293Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.1046993Z  opted_out_users = [ 2025-08-26T19:31:41.1047542Z  requestor 2025-08-26T19:31:41.1048091Z  for requestor in workflow_requestors 2025-08-26T19:31:41.1048869Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.1049590Z  ] 2025-08-26T19:31:41.1050005Z  2025-08-26T19:31:41.1050430Z  if opted_out_users: 2025-08-26T19:31:41.1051004Z  log.info( 2025-08-26T19:31:41.1051862Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.1052656Z  ) 2025-08-26T19:31:41.1053113Z  continue 2025-08-26T19:31:41.1053592Z  2025-08-26T19:31:41.1054115Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.1054816Z  opted_in_users = [ 2025-08-26T19:31:41.1055354Z  requestor 2025-08-26T19:31:41.1055921Z  for requestor in workflow_requestors 2025-08-26T19:31:41.1056702Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.1057418Z  ] 2025-08-26T19:31:41.1057837Z  2025-08-26T19:31:41.1058235Z  enabled = False 2025-08-26T19:31:41.1058770Z  if opted_in_users: 2025-08-26T19:31:41.1059421Z  log.info( 2025-08-26T19:31:41.1060147Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.1060896Z  ) 2025-08-26T19:31:41.1061454Z  enabled = True 2025-08-26T19:31:41.1061961Z  2025-08-26T19:31:41.1062424Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.1063355Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.1064399Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.1065126Z  log.info( 2025-08-26T19:31:41.1066105Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.1067111Z  ) 2025-08-26T19:31:41.1067631Z  enabled = True 2025-08-26T19:31:41.1068162Z  2025-08-26T19:31:41.1068562Z  if enabled: 2025-08-26T19:31:41.1069079Z  label = experiment_name 2025-08-26T19:31:41.1069727Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.1070657Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.1071733Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.1072587Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.1073326Z  if is_canary: 2025-08-26T19:31:41.1073910Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.1074523Z  fleet_prefix = label 2025-08-26T19:31:41.1075083Z  else: 2025-08-26T19:31:41.1075751Z  prefixes.append(label) 2025-08-26T19:31:41.1076307Z  2025-08-26T19:31:41.1076711Z  if len(prefixes) > 1: 2025-08-26T19:31:41.1077235Z  log.error( 2025-08-26T19:31:41.1078403Z  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-08-26T19:31:41.1079617Z  ) 2025-08-26T19:31:41.1080086Z  prefixes = prefixes[:1] 2025-08-26T19:31:41.1080624Z  2025-08-26T19:31:41.1081137Z  # Fleet always comes first 2025-08-26T19:31:41.1081703Z  if fleet_prefix: 2025-08-26T19:31:41.1082241Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.1082819Z  2025-08-26T19:31:41.1083313Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.1083950Z  2025-08-26T19:31:41.1084342Z  2025-08-26T19:31:41.1085070Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.1085916Z  """ 2025-08-26T19:31:41.1086586Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.1087373Z  2025-08-26T19:31:41.1088019Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.1088887Z  """ 2025-08-26T19:31:41.1089349Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.1089995Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.1090741Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.1091515Z  2025-08-26T19:31:41.1091900Z  2025-08-26T19:31:41.1092570Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.1093571Z  for _ in range(num_retries): 2025-08-26T19:31:41.1094131Z  try: 2025-08-26T19:31:41.1094648Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:41.1095412Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.1096144Z  return json.loads(content) 2025-08-26T19:31:41.1096821Z  except Exception as e: 2025-08-26T19:31:41.1097474Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.1098104Z  2025-08-26T19:31:41.1098737Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.1099521Z  return {} 2025-08-26T19:31:41.1099964Z  2025-08-26T19:31:41.1100342Z  2025-08-26T19:31:41.1100722Z @cache 2025-08-26T19:31:41.1101529Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.1102371Z  """ 2025-08-26T19:31:41.1102825Z  Dynamically get PR information 2025-08-26T19:31:41.1103376Z  """ 2025-08-26T19:31:41.1103943Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.1104641Z  headers = { 2025-08-26T19:31:41.1105198Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.1105878Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:41.1106465Z  } 2025-08-26T19:31:41.1106972Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.1107662Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.1108273Z  headers=headers, 2025-08-26T19:31:41.1108773Z  ) 2025-08-26T19:31:41.1109178Z  2025-08-26T19:31:41.1109585Z  if not json_response: 2025-08-26T19:31:41.1110264Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.1111204Z  return {} 2025-08-26T19:31:41.1111682Z  2025-08-26T19:31:41.1112086Z  return json_response 2025-08-26T19:31:41.1112593Z  2025-08-26T19:31:41.1112960Z  2025-08-26T19:31:41.1113614Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.1114415Z  """ 2025-08-26T19:31:41.1115022Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.1115743Z  """ 2025-08-26T19:31:41.1116302Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.1116993Z  return { 2025-08-26T19:31:41.1117666Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.1118427Z  } 2025-08-26T19:31:41.1118829Z  2025-08-26T19:31:41.1119209Z  2025-08-26T19:31:41.1119621Z def main() -> None: 2025-08-26T19:31:41.1120124Z  args = parse_args() 2025-08-26T19:31:41.1120625Z  2025-08-26T19:31:41.1121189Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.1121784Z  2025-08-26T19:31:41.1122199Z  # Check if the PR is opt-out 2025-08-26T19:31:41.1122764Z  if args.pr_number: 2025-08-26T19:31:41.1123522Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.1124356Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.1124926Z  log.info( 2025-08-26T19:31:41.1125722Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.1126557Z  ) 2025-08-26T19:31:41.1127204Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.1127962Z  sys.exit() 2025-08-26T19:31:41.1128601Z  2025-08-26T19:31:41.1128991Z  try: 2025-08-26T19:31:41.1129507Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.1130305Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.1131014Z  ) 2025-08-26T19:31:41.1131522Z  2025-08-26T19:31:41.1131967Z  username = get_potential_pr_author( 2025-08-26T19:31:41.1132561Z  args.github_token, 2025-08-26T19:31:41.1133122Z  args.github_repo, 2025-08-26T19:31:41.1133669Z  args.github_actor, 2025-08-26T19:31:41.1134234Z  args.github_ref_type, 2025-08-26T19:31:41.1134803Z  args.github_branch, 2025-08-26T19:31:41.1135330Z  ) 2025-08-26T19:31:41.1135748Z  2025-08-26T19:31:41.1136293Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.1136966Z  2025-08-26T19:31:41.1137425Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.1138049Z  rollout_state, 2025-08-26T19:31:41.1138635Z  (args.github_issue_owner, username), 2025-08-26T19:31:41.1139249Z  args.github_branch, 2025-08-26T19:31:41.1139835Z  args.eligible_experiments, 2025-08-26T19:31:41.1140453Z  args.opt_out_experiments, 2025-08-26T19:31:41.1141128Z  is_canary, 2025-08-26T19:31:41.1141611Z  ) 2025-08-26T19:31:41.1142030Z  2025-08-26T19:31:41.1142451Z  except Exception as e: 2025-08-26T19:31:41.1142992Z  log.error( 2025-08-26T19:31:41.1143786Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.1144745Z  ) 2025-08-26T19:31:41.1145173Z  2025-08-26T19:31:41.1145769Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.1146488Z  2025-08-26T19:31:41.1146865Z  2025-08-26T19:31:41.1147270Z if __name__ == "__main__": 2025-08-26T19:31:41.1147798Z  main() 2025-08-26T19:31:41.1148214Z  2025-08-26T19:31:41.1148596Z EOF 2025-08-26T19:31:41.1148983Z  2025-08-26T19:31:41.1149403Z cat runner_determinator.py 2025-08-26T19:31:41.1401975Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.1403027Z env: 2025-08-26T19:31:41.1403979Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.1404593Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.1405263Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.1406018Z ISSUE_OWNER: 2025-08-26T19:31:41.1406614Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.1407252Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:41.1407879Z PR_NUMBER: 2025-08-26T19:31:41.1408470Z ##[endgroup] 2025-08-26T19:31:41.1628856Z # flake8: noqa: G004 2025-08-26T19:31:41.1629210Z 2025-08-26T19:31:41.1629669Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:41.1630690Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:41.1631790Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:41.1632274Z 2025-08-26T19:31:41.1632438Z """ 2025-08-26T19:31:41.1633055Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:41.1633979Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:41.1634940Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:41.1635794Z of which runners should be used to run which job. 2025-08-26T19:31:41.1636223Z 2025-08-26T19:31:41.1636628Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:41.1637772Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:41.1638718Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:41.1639462Z list, defined. 2025-08-26T19:31:41.1639697Z 2025-08-26T19:31:41.1640087Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:41.1641306Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:41.1642197Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:41.1642674Z 2025-08-26T19:31:41.1643062Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:41.1643989Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:41.1644765Z experiments which the user could be opted in to. 2025-08-26T19:31:41.1645189Z 2025-08-26T19:31:41.1645402Z The user list has the following rules: 2025-08-26T19:31:41.1645768Z 2025-08-26T19:31:41.1646109Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:41.1647023Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:41.1647824Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:41.1648239Z 2025-08-26T19:31:41.1648420Z Example config: 2025-08-26T19:31:41.1648895Z # A list of experiments that can be opted into. 2025-08-26T19:31:41.1649586Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:41.1650235Z # Expected syntax is: 2025-08-26T19:31:41.1650901Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:41.1652379Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.1653013Z 2025-08-26T19:31:41.1653190Z experiments: 2025-08-26T19:31:41.1653584Z lf: 2025-08-26T19:31:41.1653973Z rollout_percent: 25 2025-08-26T19:31:41.1654605Z all_branches: false 2025-08-26T19:31:41.1655077Z default: true 2025-08-26T19:31:41.1655489Z --- 2025-08-26T19:31:41.1655703Z 2025-08-26T19:31:41.1655874Z # Opt-ins: 2025-08-26T19:31:41.1656466Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.1657362Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.1658160Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.1658842Z # Experiments should be from the above list. 2025-08-26T19:31:41.1659234Z 2025-08-26T19:31:41.1659427Z @User1,-lf,split_build 2025-08-26T19:31:41.1659880Z @User2,lf 2025-08-26T19:31:41.1660318Z @User3,split_build 2025-08-26T19:31:41.1660745Z """ 2025-08-26T19:31:41.1660996Z 2025-08-26T19:31:41.1661385Z import json 2025-08-26T19:31:41.1661791Z import logging 2025-08-26T19:31:41.1662188Z import os 2025-08-26T19:31:41.1662560Z import random 2025-08-26T19:31:41.1662957Z import re 2025-08-26T19:31:41.1663342Z import sys 2025-08-26T19:31:41.1663765Z from argparse import ArgumentParser 2025-08-26T19:31:41.1664323Z from collections.abc import Iterable 2025-08-26T19:31:41.1664860Z from functools import cache 2025-08-26T19:31:41.1665357Z from logging import LogRecord 2025-08-26T19:31:41.1665867Z from typing import Any, NamedTuple 2025-08-26T19:31:41.1666420Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.1666800Z 2025-08-26T19:31:41.1666970Z import yaml 2025-08-26T19:31:41.1667389Z from github import Auth, Github 2025-08-26T19:31:41.1667886Z from github.Issue import Issue 2025-08-26T19:31:41.1668207Z 2025-08-26T19:31:41.1668216Z 2025-08-26T19:31:41.1668440Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.1669167Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.1670063Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.1670649Z 2025-08-26T19:31:41.1670882Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.1671824Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.1672382Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.1672942Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.1673313Z 2025-08-26T19:31:41.1673510Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.1673847Z 2025-08-26T19:31:41.1674048Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.1674519Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.1674808Z 2025-08-26T19:31:41.1674822Z 2025-08-26T19:31:41.1675015Z class Experiment(NamedTuple): 2025-08-26T19:31:41.1675498Z rollout_perc: float = ( 2025-08-26T19:31:41.1676165Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.1676875Z ) 2025-08-26T19:31:41.1677268Z all_branches: bool = ( 2025-08-26T19:31:41.1677923Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.1678618Z ) 2025-08-26T19:31:41.1679013Z default: bool = ( 2025-08-26T19:31:41.1679609Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.1680269Z ) 2025-08-26T19:31:41.1680472Z 2025-08-26T19:31:41.1680660Z # Add more fields as needed 2025-08-26T19:31:41.1680982Z 2025-08-26T19:31:41.1680989Z 2025-08-26T19:31:41.1681480Z class Settings(NamedTuple): 2025-08-26T19:31:41.1681968Z """ 2025-08-26T19:31:41.1682436Z Settings for the experiments that can be opted into. 2025-08-26T19:31:41.1683032Z """ 2025-08-26T19:31:41.1683234Z 2025-08-26T19:31:41.1683451Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.1683827Z 2025-08-26T19:31:41.1683843Z 2025-08-26T19:31:41.1684059Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.1684689Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.1685141Z 2025-08-26T19:31:41.1685307Z COLORS = { 2025-08-26T19:31:41.1685728Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.1686394Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.1686928Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.1687441Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.1687949Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.1688461Z } 2025-08-26T19:31:41.1688679Z 2025-08-26T19:31:41.1688908Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.1689698Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.1690540Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.1691369Z return super().format(record) 2025-08-26T19:31:41.1691738Z 2025-08-26T19:31:41.1691746Z 2025-08-26T19:31:41.1691950Z handler = logging.StreamHandler() 2025-08-26T19:31:41.1692698Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.1693294Z 2025-08-26T19:31:41.1693548Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.1694179Z log.addHandler(handler) 2025-08-26T19:31:41.1694644Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.1694952Z 2025-08-26T19:31:41.1694958Z 2025-08-26T19:31:41.1695216Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.1695818Z """ 2025-08-26T19:31:41.1696347Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.1697020Z """ 2025-08-26T19:31:41.1697400Z if not GITHUB_OUTPUT: 2025-08-26T19:31:41.1698562Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.1699768Z log.warning( 2025-08-26T19:31:41.1700680Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.1701853Z ) 2025-08-26T19:31:41.1711966Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.1712649Z return 2025-08-26T19:31:41.1712906Z 2025-08-26T19:31:41.1713341Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.1714025Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.1714672Z f.write(f"{key}={value}\n") 2025-08-26T19:31:41.1715053Z 2025-08-26T19:31:41.1715059Z 2025-08-26T19:31:41.1715401Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.1716131Z return frozenset( 2025-08-26T19:31:41.1716800Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.1717597Z ) 2025-08-26T19:31:41.1717809Z 2025-08-26T19:31:41.1717817Z 2025-08-26T19:31:41.1718020Z def parse_args() -> Any: 2025-08-26T19:31:41.1718642Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.1719626Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.1720515Z parser.add_argument( 2025-08-26T19:31:41.1721023Z "--github-issue-repo", 2025-08-26T19:31:41.1721741Z type=str, 2025-08-26T19:31:41.1722193Z required=False, 2025-08-26T19:31:41.1722684Z default="pytorch/test-infra", 2025-08-26T19:31:41.1723281Z help="GitHub repo to get the issue", 2025-08-26T19:31:41.1723844Z ) 2025-08-26T19:31:41.1724254Z parser.add_argument( 2025-08-26T19:31:41.1724738Z "--github-repo", 2025-08-26T19:31:41.1725219Z type=str, 2025-08-26T19:31:41.1725652Z required=True, 2025-08-26T19:31:41.1726173Z help="GitHub repo where CI is running", 2025-08-26T19:31:41.1726760Z ) 2025-08-26T19:31:41.1727173Z parser.add_argument( 2025-08-26T19:31:41.1727856Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.1728601Z ) 2025-08-26T19:31:41.1729011Z parser.add_argument( 2025-08-26T19:31:41.1729701Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.1730486Z ) 2025-08-26T19:31:41.1730897Z parser.add_argument( 2025-08-26T19:31:41.1732070Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.1732853Z ) 2025-08-26T19:31:41.1733258Z parser.add_argument( 2025-08-26T19:31:41.1733971Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.1734789Z ) 2025-08-26T19:31:41.1735193Z parser.add_argument( 2025-08-26T19:31:41.1735683Z "--github-ref-type", 2025-08-26T19:31:41.1736180Z type=str, 2025-08-26T19:31:41.1736609Z required=True, 2025-08-26T19:31:41.1794229Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.1795029Z ) 2025-08-26T19:31:41.1795514Z parser.add_argument( 2025-08-26T19:31:41.1796087Z "--eligible-experiments", 2025-08-26T19:31:41.1796732Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.1797384Z required=False, 2025-08-26T19:31:41.1797904Z default="", 2025-08-26T19:31:41.1799014Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.1800233Z ) 2025-08-26T19:31:41.1800692Z parser.add_argument( 2025-08-26T19:31:41.1801368Z "--opt-out-experiments", 2025-08-26T19:31:41.1802003Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.1802652Z required=False, 2025-08-26T19:31:41.1803182Z default="", 2025-08-26T19:31:41.1803662Z help=( 2025-08-26T19:31:41.1804512Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.1805988Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.1807081Z ), 2025-08-26T19:31:41.1807520Z ) 2025-08-26T19:31:41.1807965Z parser.add_argument( 2025-08-26T19:31:41.1808516Z "--pr-number", 2025-08-26T19:31:41.1809023Z type=str, 2025-08-26T19:31:41.1809525Z required=False, 2025-08-26T19:31:41.1810038Z default="", 2025-08-26T19:31:41.1810801Z help="the optional PR number where this is run", 2025-08-26T19:31:41.1811613Z ) 2025-08-26T19:31:41.1811848Z 2025-08-26T19:31:41.1812069Z return parser.parse_args() 2025-08-26T19:31:41.1812422Z 2025-08-26T19:31:41.1812428Z 2025-08-26T19:31:41.1812911Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.1813799Z auth = Auth.Token(github_token) 2025-08-26T19:31:41.1814397Z return Github(auth=auth) 2025-08-26T19:31:41.1814744Z 2025-08-26T19:31:41.1814750Z 2025-08-26T19:31:41.1815288Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.1816249Z repo = gh.get_repo(repo) 2025-08-26T19:31:41.1816825Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.1817258Z 2025-08-26T19:31:41.1817265Z 2025-08-26T19:31:41.1817481Z def get_potential_pr_author( 2025-08-26T19:31:41.1818240Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.1819040Z ) -> str: 2025-08-26T19:31:41.1819633Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.1820517Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.1821467Z # embedded in the tag name: ciflow// 2025-08-26T19:31:41.1821935Z 2025-08-26T19:31:41.1822155Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.1822524Z 2025-08-26T19:31:41.1822814Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.1823511Z split_tag = ref_name.split("/") 2025-08-26T19:31:41.1824065Z if ( 2025-08-26T19:31:41.1824498Z len(split_tag) == 3 2025-08-26T19:31:41.1825022Z and split_tag[0] == "ciflow" 2025-08-26T19:31:41.1825603Z and split_tag[2].isnumeric() 2025-08-26T19:31:41.1826149Z ): 2025-08-26T19:31:41.1826574Z pr_number = split_tag[2] 2025-08-26T19:31:41.1827246Z try: 2025-08-26T19:31:41.1827724Z repository = gh.get_repo(repo) 2025-08-26T19:31:41.1828392Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.1829058Z except Exception as e: 2025-08-26T19:31:41.1829628Z raise Exception( # noqa: TRY002 2025-08-26T19:31:41.1830354Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.1831169Z ) from e 2025-08-26T19:31:41.1831749Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.1832513Z # In all other cases, return the original input username 2025-08-26T19:31:41.1833161Z return username 2025-08-26T19:31:41.1833420Z 2025-08-26T19:31:41.1833427Z 2025-08-26T19:31:41.1833667Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.1834253Z """ 2025-08-26T19:31:41.1834955Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.1835841Z """ 2025-08-26T19:31:41.1836424Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.1837005Z 2025-08-26T19:31:41.1837011Z 2025-08-26T19:31:41.1837220Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.1837764Z try: 2025-08-26T19:31:41.1838174Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.1838733Z return data 2025-08-26T19:31:41.1839176Z except yaml.YAMLError: 2025-08-26T19:31:41.1839695Z log.exception("Error loading YAML") 2025-08-26T19:31:41.1840252Z raise 2025-08-26T19:31:41.1840488Z 2025-08-26T19:31:41.1840494Z 2025-08-26T19:31:41.1840950Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.1841881Z """ 2025-08-26T19:31:41.1842561Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.1843237Z 2025-08-26T19:31:41.1843751Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.1844590Z and the text below is the list of opted in users. 2025-08-26T19:31:41.1845038Z 2025-08-26T19:31:41.1845447Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.1846224Z """ 2025-08-26T19:31:41.1846698Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.1847358Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.1848016Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.1848674Z else: 2025-08-26T19:31:41.1849084Z return "", rollout_state 2025-08-26T19:31:41.1849417Z 2025-08-26T19:31:41.1849425Z 2025-08-26T19:31:41.1849649Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.1850198Z """ 2025-08-26T19:31:41.1850761Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.1851605Z """ 2025-08-26T19:31:41.1851838Z 2025-08-26T19:31:41.1851846Z 2025-08-26T19:31:41.1852228Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.1852957Z """ 2025-08-26T19:31:41.1853738Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.1854517Z 2025-08-26T19:31:41.1855229Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.1856338Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.1857086Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.1857621Z 2025-08-26T19:31:41.1857629Z 2025-08-26T19:31:41.1857806Z """ 2025-08-26T19:31:41.1858199Z optins = UserOptins() 2025-08-26T19:31:41.1858731Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.1859342Z user = user.strip("\r\n\t -") 2025-08-26T19:31:41.1859937Z if not user or not user.startswith("@"): 2025-08-26T19:31:41.1860715Z # Not a valid user. Skip 2025-08-26T19:31:41.1861358Z continue 2025-08-26T19:31:41.1861619Z 2025-08-26T19:31:41.1861793Z if user: 2025-08-26T19:31:41.1862265Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.1863025Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.1863573Z 2025-08-26T19:31:41.1863755Z return optins 2025-08-26T19:31:41.1864005Z 2025-08-26T19:31:41.1864022Z 2025-08-26T19:31:41.1864328Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.1864987Z """ 2025-08-26T19:31:41.1865410Z Check if the experiment name is valid. 2025-08-26T19:31:41.1865973Z A valid name: 2025-08-26T19:31:41.1866664Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.1867720Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.1868536Z - Cannot contain spaces 2025-08-26T19:31:41.1869043Z """ 2025-08-26T19:31:41.1869253Z 2025-08-26T19:31:41.1869532Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.1870295Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.1870765Z 2025-08-26T19:31:41.1870933Z if valid: 2025-08-26T19:31:41.1871430Z return True 2025-08-26T19:31:41.1871676Z 2025-08-26T19:31:41.1871855Z log.error( 2025-08-26T19:31:41.1873424Z 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-08-26T19:31:41.1875105Z ) 2025-08-26T19:31:41.1875472Z return False 2025-08-26T19:31:41.1875724Z 2025-08-26T19:31:41.1875730Z 2025-08-26T19:31:41.1876044Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.1876698Z """ 2025-08-26T19:31:41.1877451Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.1878228Z """ 2025-08-26T19:31:41.1878591Z try: 2025-08-26T19:31:41.1878982Z if settings_text: 2025-08-26T19:31:41.1879753Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.1880598Z # for easy reading 2025-08-26T19:31:41.1881584Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.1882531Z # the backtick character in shell commands. 2025-08-26T19:31:41.1883170Z backtick = chr(96) # backtick character 2025-08-26T19:31:41.1883865Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.1884569Z settings = load_yaml(settings_text) 2025-08-26T19:31:41.1884956Z 2025-08-26T19:31:41.1885395Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.1886207Z experiments = {} 2025-08-26T19:31:41.1886520Z 2025-08-26T19:31:41.1886922Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.1887729Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.1888934Z # 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-08-26T19:31:41.1890056Z continue 2025-08-26T19:31:41.1890362Z 2025-08-26T19:31:41.1890550Z valid_settings = {} 2025-08-26T19:31:41.1891528Z for setting in exp_settings: 2025-08-26T19:31:41.1892165Z if setting not in Experiment._fields: 2025-08-26T19:31:41.1892746Z log.warning( 2025-08-26T19:31:41.1893497Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.1894435Z ) 2025-08-26T19:31:41.1894880Z else: 2025-08-26T19:31:41.1895427Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.1895877Z 2025-08-26T19:31:41.1896166Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.1896843Z return Settings(experiments) 2025-08-26T19:31:41.1897217Z 2025-08-26T19:31:41.1897401Z except Exception: 2025-08-26T19:31:41.1897895Z log.exception("Failed to parse settings") 2025-08-26T19:31:41.1898303Z 2025-08-26T19:31:41.1898488Z return Settings() 2025-08-26T19:31:41.1898755Z 2025-08-26T19:31:41.1898762Z 2025-08-26T19:31:41.1899016Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.1899618Z """ 2025-08-26T19:31:41.1900059Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.1900506Z 2025-08-26T19:31:41.1900875Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.1901817Z and the text below is the list of opted in users. 2025-08-26T19:31:41.1902255Z 2025-08-26T19:31:41.1902694Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.1903515Z """ 2025-08-26T19:31:41.1904092Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.1904900Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.1905330Z 2025-08-26T19:31:41.1905336Z 2025-08-26T19:31:41.1905588Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.1906182Z """ 2025-08-26T19:31:41.1906597Z Parse users from the rollout state. 2025-08-26T19:31:41.1906975Z 2025-08-26T19:31:41.1907138Z """ 2025-08-26T19:31:41.1907693Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.1908468Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.1908915Z 2025-08-26T19:31:41.1908923Z 2025-08-26T19:31:41.1909502Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.1910310Z """ 2025-08-26T19:31:41.1910745Z Check if a user is opted into an experiment 2025-08-26T19:31:41.1911424Z """ 2025-08-26T19:31:41.1911906Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.1912349Z 2025-08-26T19:31:41.1912356Z 2025-08-26T19:31:41.1912808Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.1913601Z """ 2025-08-26T19:31:41.1914082Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.1914692Z """ 2025-08-26T19:31:41.1915222Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.1915944Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.1916618Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.1917258Z return False 2025-08-26T19:31:41.1917535Z 2025-08-26T19:31:41.1917831Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.1918471Z log.warning( 2025-08-26T19:31:41.1919323Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.1920267Z ) 2025-08-26T19:31:41.1920483Z 2025-08-26T19:31:41.1920661Z return True 2025-08-26T19:31:41.1920908Z 2025-08-26T19:31:41.1920914Z 2025-08-26T19:31:41.1921196Z def get_runner_prefix( 2025-08-26T19:31:41.1921658Z rollout_state: str, 2025-08-26T19:31:41.1922137Z workflow_requestors: Iterable[str], 2025-08-26T19:31:41.1922683Z branch: str, 2025-08-26T19:31:41.1923186Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.1923883Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.1924502Z is_canary: bool = False, 2025-08-26T19:31:41.1924990Z ) -> str: 2025-08-26T19:31:41.1925560Z settings = parse_settings(rollout_state) 2025-08-26T19:31:41.1926185Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.1926579Z 2025-08-26T19:31:41.1926771Z fleet_prefix = "" 2025-08-26T19:31:41.1927211Z prefixes = [] 2025-08-26T19:31:41.1927879Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.1928888Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.1929658Z log.info( 2025-08-26T19:31:41.1930377Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.1931306Z ) 2025-08-26T19:31:41.1931710Z continue 2025-08-26T19:31:41.1931968Z 2025-08-26T19:31:41.1932163Z if opt_out_experiments: 2025-08-26T19:31:41.1932723Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.1933404Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.1934040Z log.info( 2025-08-26T19:31:41.1935032Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.1936096Z ) 2025-08-26T19:31:41.1936506Z continue 2025-08-26T19:31:41.1936788Z 2025-08-26T19:31:41.1936984Z if eligible_experiments: 2025-08-26T19:31:41.1937563Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.1938230Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.1938824Z log.info( 2025-08-26T19:31:41.1939807Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.1940703Z ) 2025-08-26T19:31:41.1941219Z continue 2025-08-26T19:31:41.1941715Z elif not experiment_settings.default: 2025-08-26T19:31:41.1942278Z log.info( 2025-08-26T19:31:41.1943111Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.1943912Z ) 2025-08-26T19:31:41.1944295Z continue 2025-08-26T19:31:41.1944304Z 2025-08-26T19:31:41.1944597Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.1944780Z opted_out_users = [ 2025-08-26T19:31:41.1944949Z requestor 2025-08-26T19:31:41.1945166Z for requestor in workflow_requestors 2025-08-26T19:31:41.1945486Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.1945653Z ] 2025-08-26T19:31:41.1945661Z 2025-08-26T19:31:41.1945842Z if opted_out_users: 2025-08-26T19:31:41.1946022Z log.info( 2025-08-26T19:31:41.1946414Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.1946579Z ) 2025-08-26T19:31:41.1946756Z continue 2025-08-26T19:31:41.1946770Z 2025-08-26T19:31:41.1947061Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.1947248Z opted_in_users = [ 2025-08-26T19:31:41.1947420Z requestor 2025-08-26T19:31:41.1947645Z for requestor in workflow_requestors 2025-08-26T19:31:41.1947952Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.1948118Z ] 2025-08-26T19:31:41.1948127Z 2025-08-26T19:31:41.1948303Z enabled = False 2025-08-26T19:31:41.1948486Z if opted_in_users: 2025-08-26T19:31:41.1948656Z log.info( 2025-08-26T19:31:41.1949032Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.1949196Z ) 2025-08-26T19:31:41.1949375Z enabled = True 2025-08-26T19:31:41.1949382Z 2025-08-26T19:31:41.1949602Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.1950096Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.1950553Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.1950731Z log.info( 2025-08-26T19:31:41.1951493Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.1951662Z ) 2025-08-26T19:31:41.1951842Z enabled = True 2025-08-26T19:31:41.1951851Z 2025-08-26T19:31:41.1952027Z if enabled: 2025-08-26T19:31:41.1952221Z label = experiment_name 2025-08-26T19:31:41.1952452Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.1952915Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.1953201Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.1953538Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.1953722Z if is_canary: 2025-08-26T19:31:41.1953929Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.1954114Z fleet_prefix = label 2025-08-26T19:31:41.1954279Z else: 2025-08-26T19:31:41.1954478Z prefixes.append(label) 2025-08-26T19:31:41.1954487Z 2025-08-26T19:31:41.1954671Z if len(prefixes) > 1: 2025-08-26T19:31:41.1954842Z log.error( 2025-08-26T19:31:41.1955746Z 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-08-26T19:31:41.1955909Z ) 2025-08-26T19:31:41.1956110Z prefixes = prefixes[:1] 2025-08-26T19:31:41.1956118Z 2025-08-26T19:31:41.1956311Z # Fleet always comes first 2025-08-26T19:31:41.1956502Z if fleet_prefix: 2025-08-26T19:31:41.1956711Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.1956725Z 2025-08-26T19:31:41.1957106Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.1957117Z 2025-08-26T19:31:41.1957124Z 2025-08-26T19:31:41.1957611Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.1957782Z """ 2025-08-26T19:31:41.1958197Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.1958205Z 2025-08-26T19:31:41.1958619Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.1958788Z """ 2025-08-26T19:31:41.1958988Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.1959208Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.1959491Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.1959499Z 2025-08-26T19:31:41.1959505Z 2025-08-26T19:31:41.1959924Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.1960134Z for _ in range(num_retries): 2025-08-26T19:31:41.1960314Z try: 2025-08-26T19:31:41.1960568Z req = Request(url=url, headers=headers) 2025-08-26T19:31:41.1960876Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.1961174Z return json.loads(content) 2025-08-26T19:31:41.1961369Z except Exception as e: 2025-08-26T19:31:41.1961618Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.1961626Z 2025-08-26T19:31:41.1962032Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.1962202Z return {} 2025-08-26T19:31:41.1962210Z 2025-08-26T19:31:41.1962216Z 2025-08-26T19:31:41.1962378Z @cache 2025-08-26T19:31:41.1962835Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.1963004Z """ 2025-08-26T19:31:41.1963204Z Dynamically get PR information 2025-08-26T19:31:41.1963371Z """ 2025-08-26T19:31:41.1963825Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.1963995Z headers = { 2025-08-26T19:31:41.1964228Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.1964457Z "Authorization": f"token {github_token}", 2025-08-26T19:31:41.1964625Z } 2025-08-26T19:31:41.1964863Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.1965083Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.1965272Z headers=headers, 2025-08-26T19:31:41.1965438Z ) 2025-08-26T19:31:41.1965446Z 2025-08-26T19:31:41.1965630Z if not json_response: 2025-08-26T19:31:41.1965937Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.1966108Z return {} 2025-08-26T19:31:41.1966115Z 2025-08-26T19:31:41.1966301Z return json_response 2025-08-26T19:31:41.1966308Z 2025-08-26T19:31:41.1966315Z 2025-08-26T19:31:41.1966739Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.1966919Z """ 2025-08-26T19:31:41.1967262Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.1967437Z """ 2025-08-26T19:31:41.1967735Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.1967903Z return { 2025-08-26T19:31:41.1968288Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.1968468Z } 2025-08-26T19:31:41.1968475Z 2025-08-26T19:31:41.1968481Z 2025-08-26T19:31:41.1968657Z def main() -> None: 2025-08-26T19:31:41.1968839Z args = parse_args() 2025-08-26T19:31:41.1968846Z 2025-08-26T19:31:41.1969082Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.1969089Z 2025-08-26T19:31:41.1969289Z # Check if the PR is opt-out 2025-08-26T19:31:41.1969471Z if args.pr_number: 2025-08-26T19:31:41.1969886Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.1970203Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.1970383Z log.info( 2025-08-26T19:31:41.1970837Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.1971013Z ) 2025-08-26T19:31:41.1971460Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.1971636Z sys.exit() 2025-08-26T19:31:41.1971645Z 2025-08-26T19:31:41.1971816Z try: 2025-08-26T19:31:41.1972058Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.1972381Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.1972555Z ) 2025-08-26T19:31:41.1972563Z 2025-08-26T19:31:41.1972777Z username = get_potential_pr_author( 2025-08-26T19:31:41.1972968Z args.github_token, 2025-08-26T19:31:41.1973153Z args.github_repo, 2025-08-26T19:31:41.1973343Z args.github_actor, 2025-08-26T19:31:41.1973543Z args.github_ref_type, 2025-08-26T19:31:41.1973740Z args.github_branch, 2025-08-26T19:31:41.1973917Z ) 2025-08-26T19:31:41.1973925Z 2025-08-26T19:31:41.1974217Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.1974225Z 2025-08-26T19:31:41.1974446Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.1974643Z rollout_state, 2025-08-26T19:31:41.1974861Z (args.github_issue_owner, username), 2025-08-26T19:31:41.1975047Z args.github_branch, 2025-08-26T19:31:41.1975247Z args.eligible_experiments, 2025-08-26T19:31:41.1975454Z args.opt_out_experiments, 2025-08-26T19:31:41.1975630Z is_canary, 2025-08-26T19:31:41.1975797Z ) 2025-08-26T19:31:41.1975805Z 2025-08-26T19:31:41.1975997Z except Exception as e: 2025-08-26T19:31:41.1976173Z log.error( 2025-08-26T19:31:41.1976628Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.1976938Z ) 2025-08-26T19:31:41.1976959Z 2025-08-26T19:31:41.1977302Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.1977310Z 2025-08-26T19:31:41.1977317Z 2025-08-26T19:31:41.1977498Z if __name__ == "__main__": 2025-08-26T19:31:41.1977669Z main() 2025-08-26T19:31:41.1977686Z 2025-08-26T19:31:41.2071682Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.2072666Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.2114451Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.2115018Z env: 2025-08-26T19:31:41.2115732Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.2116235Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.2116768Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.2117383Z ISSUE_OWNER: 2025-08-26T19:31:41.2117863Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.2118392Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:41.2118930Z PR_NUMBER: 2025-08-26T19:31:41.2119384Z ##[endgroup] 2025-08-26T19:31:42.4747677Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:43.0279680Z Collecting urllib3==1.26.18 2025-08-26T19:31:43.0620468Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:43.0839172Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-08-26T19:31:43.1096735Z Collecting PyGithub==2.3.0 2025-08-26T19:31:43.1133174Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:43.1591795Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:43.1635498Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-26T19:31:43.1676432Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:43.1693004Z 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-08-26T19:31:43.1707448Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:43.2007945Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:43.2041803Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:43.2268742Z 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-08-26T19:31:43.3541829Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.3586781Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:43.4903497Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:43.4946206Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-26T19:31:43.5182477Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.5217830Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:43.5445150Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:43.5507048Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 33.5 MB/s eta 0:00:00 2025-08-26T19:31:43.5545626Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:43.5621967Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 61.8 MB/s eta 0:00:00 2025-08-26T19:31:43.5659655Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-26T19:31:43.5747607Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 123.9 MB/s eta 0:00:00 2025-08-26T19:31:43.5780127Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:43.5835497Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:43.5898335Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 104.8 MB/s eta 0:00:00 2025-08-26T19:31:43.5936924Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-26T19:31:43.5978563Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 32.2 MB/s eta 0:00:00 2025-08-26T19:31:43.6039706Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:43.6086321Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 35.8 MB/s eta 0:00:00 2025-08-26T19:31:43.9068984Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:44.4433016Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-26T19:31:44.5364095Z ##[group]Run curr_branch="main" 2025-08-26T19:31:44.5364451Z curr_branch="main" 2025-08-26T19:31:44.5364732Z curr_ref_type="branch" 2025-08-26T19:31:44.5365096Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:44.5365425Z  2025-08-26T19:31:44.5365669Z python3 runner_determinator.py \ 2025-08-26T19:31:44.5366026Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:44.5366384Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:44.5366720Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:44.5367063Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:44.5367435Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:44.5367795Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:44.5368152Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:44.5368536Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:44.5369007Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:44.5369376Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:44.5414692Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:44.5414993Z env: 2025-08-26T19:31:44.5415613Z GITHUB_TOKEN: *** 2025-08-26T19:31:44.5415879Z ISSUE_NUMBER: 5132 2025-08-26T19:31:44.5416158Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:44.5416486Z ISSUE_OWNER: 2025-08-26T19:31:44.5416731Z CHECK_EXPERIMENTS: 2025-08-26T19:31:44.5417003Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:44.5417265Z PR_NUMBER: 2025-08-26T19:31:44.5417493Z ##[endgroup] 2025-08-26T19:31:44.5478991Z Current branch is 'main' 2025-08-26T19:31:46.0106026Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:46.0107241Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:46.0108290Z INFO : Setting output: label-type='' 2025-08-26T19:31:46.0444386Z Evaluate and set job outputs 2025-08-26T19:31:46.0451886Z Cleaning up orphan processes