2025-07-17T06:33:20.2653367Z Current runner version: '2.326.0' 2025-07-17T06:33:20.2678109Z ##[group]Runner Image Provisioner 2025-07-17T06:33:20.2679108Z Hosted Compute Agent 2025-07-17T06:33:20.2679627Z Version: 20250711.363 2025-07-17T06:33:20.2680207Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:20.2680939Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:20.2681545Z ##[endgroup] 2025-07-17T06:33:20.2682086Z ##[group]Operating System 2025-07-17T06:33:20.2682684Z Ubuntu 2025-07-17T06:33:20.2683185Z 24.04.2 2025-07-17T06:33:20.2683622Z LTS 2025-07-17T06:33:20.2684128Z ##[endgroup] 2025-07-17T06:33:20.2684587Z ##[group]Runner Image 2025-07-17T06:33:20.2685164Z Image: ubuntu-24.04 2025-07-17T06:33:20.2685670Z Version: 20250710.1.0 2025-07-17T06:33:20.2686740Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:20.2688419Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:20.2689493Z ##[endgroup] 2025-07-17T06:33:20.2690578Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:20.2692773Z Contents: read 2025-07-17T06:33:20.2693341Z Metadata: read 2025-07-17T06:33:20.2694061Z ##[endgroup] 2025-07-17T06:33:20.2696490Z Secret source: Actions 2025-07-17T06:33:20.2697418Z Prepare workflow directory 2025-07-17T06:33:20.3287532Z Prepare all required actions 2025-07-17T06:33:20.3344978Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:20.3350235Z ##[group] Inputs 2025-07-17T06:33:20.3351003Z check_experiments: 2025-07-17T06:33:20.3351586Z opt_out_experiments: lf 2025-07-17T06:33:20.3352134Z triggering_actor: pytorchmergebot 2025-07-17T06:33:20.3352832Z issue_owner: 2025-07-17T06:33:20.3353339Z curr_branch: main 2025-07-17T06:33:20.3353851Z curr_ref_type: branch 2025-07-17T06:33:20.3354578Z issue_number: 5132 2025-07-17T06:33:20.3355092Z ##[endgroup] 2025-07-17T06:33:20.3355763Z Complete job name: unit-test / get-label-type / runner-determinator 2025-07-17T06:33:21.0464465Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:21.0467096Z cat < runner_determinator.py 2025-07-17T06:33:21.0468051Z # flake8: noqa: G004 2025-07-17T06:33:21.0468763Z  2025-07-17T06:33:21.0469667Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:21.0471093Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:21.0472262Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:21.0473101Z  2025-07-17T06:33:21.0473597Z """ 2025-07-17T06:33:21.0474487Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:21.0475597Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:21.0476967Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:21.0478510Z of which runners should be used to run which job. 2025-07-17T06:33:21.0479390Z  2025-07-17T06:33:21.0480161Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:21.0481428Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:21.0482683Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:21.0483603Z list, defined. 2025-07-17T06:33:21.0484291Z  2025-07-17T06:33:21.0485036Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:21.0486210Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:21.0487380Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:21.0488387Z  2025-07-17T06:33:21.0489480Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:21.0490668Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:21.0491675Z experiments which the user could be opted in to. 2025-07-17T06:33:21.0492414Z  2025-07-17T06:33:21.0493098Z The user list has the following rules: 2025-07-17T06:33:21.0493822Z  2025-07-17T06:33:21.0494593Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:21.0495782Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:21.0496770Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:21.0497531Z  2025-07-17T06:33:21.0498373Z Example config: 2025-07-17T06:33:21.0499071Z  # A list of experiments that can be opted into. 2025-07-17T06:33:21.0500018Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:21.0500898Z  # Expected syntax is: 2025-07-17T06:33:21.0501824Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:21.0503069Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:21.0504050Z  2025-07-17T06:33:21.0504614Z  experiments: 2025-07-17T06:33:21.0505227Z  lf: 2025-07-17T06:33:21.0505849Z  rollout_percent: 25 2025-07-17T06:33:21.0506525Z  all_branches: false 2025-07-17T06:33:21.0507210Z  default: true 2025-07-17T06:33:21.0507975Z  --- 2025-07-17T06:33:21.0508541Z  2025-07-17T06:33:21.0509136Z  # Opt-ins: 2025-07-17T06:33:21.0510284Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:21.0600531Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:21.0602282Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:21.0603724Z  # Experiments should be from the above list. 2025-07-17T06:33:21.0604506Z  2025-07-17T06:33:21.0604993Z  @User1,-lf,split_build 2025-07-17T06:33:21.0605591Z  @User2,lf 2025-07-17T06:33:21.0606117Z  @User3,split_build 2025-07-17T06:33:21.0606677Z """ 2025-07-17T06:33:21.0607134Z  2025-07-17T06:33:21.0607576Z import json 2025-07-17T06:33:21.0608327Z import logging 2025-07-17T06:33:21.0608867Z import os 2025-07-17T06:33:21.0609368Z import random 2025-07-17T06:33:21.0609870Z import re 2025-07-17T06:33:21.0610353Z import sys 2025-07-17T06:33:21.0610893Z from argparse import ArgumentParser 2025-07-17T06:33:21.0611639Z from collections.abc import Iterable 2025-07-17T06:33:21.0612305Z from functools import cache 2025-07-17T06:33:21.0612908Z from logging import LogRecord 2025-07-17T06:33:21.0613543Z from typing import Any, NamedTuple 2025-07-17T06:33:21.0614221Z from urllib.request import Request, urlopen 2025-07-17T06:33:21.0614875Z  2025-07-17T06:33:21.0615322Z import yaml 2025-07-17T06:33:21.0615846Z from github import Auth, Github 2025-07-17T06:33:21.0616473Z from github.Issue import Issue 2025-07-17T06:33:21.0617055Z  2025-07-17T06:33:21.0617480Z  2025-07-17T06:33:21.0618168Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:21.0619015Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:21.0620066Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:21.0620898Z  2025-07-17T06:33:21.0621678Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:21.0622379Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:21.0623045Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:21.0623761Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:21.0624404Z  2025-07-17T06:33:21.0624889Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:21.0625509Z  2025-07-17T06:33:21.0625972Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:21.0626561Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:21.0627116Z  2025-07-17T06:33:21.0627546Z  2025-07-17T06:33:21.0628211Z class Experiment(NamedTuple): 2025-07-17T06:33:21.0628836Z  rollout_perc: float = ( 2025-07-17T06:33:21.0629646Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:21.0630444Z  ) 2025-07-17T06:33:21.0630929Z  all_branches: bool = ( 2025-07-17T06:33:21.0631738Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:21.0632526Z  ) 2025-07-17T06:33:21.0633000Z  default: bool = ( 2025-07-17T06:33:21.0633718Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:21.0634475Z  ) 2025-07-17T06:33:21.0634922Z  2025-07-17T06:33:21.0635393Z  # Add more fields as needed 2025-07-17T06:33:21.0635978Z  2025-07-17T06:33:21.0636406Z  2025-07-17T06:33:21.0636873Z class Settings(NamedTuple): 2025-07-17T06:33:21.0637440Z  """ 2025-07-17T06:33:21.0638260Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:21.0638986Z  """ 2025-07-17T06:33:21.0639456Z  2025-07-17T06:33:21.0639958Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:21.0640605Z  2025-07-17T06:33:21.0641207Z  2025-07-17T06:33:21.0641725Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:21.0642495Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:21.0643191Z  2025-07-17T06:33:21.0643632Z  COLORS = { 2025-07-17T06:33:21.0644168Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:21.0644793Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:21.0645423Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:21.0646056Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:21.0646681Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:21.0647267Z  } 2025-07-17T06:33:21.0647724Z  2025-07-17T06:33:21.0648688Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:21.0649595Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:21.0650563Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:21.0651267Z  return super().format(record) 2025-07-17T06:33:21.0651863Z  2025-07-17T06:33:21.0652293Z  2025-07-17T06:33:21.0652779Z handler = logging.StreamHandler() 2025-07-17T06:33:21.0653641Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:21.0654485Z  2025-07-17T06:33:21.0655046Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:21.0655767Z log.addHandler(handler) 2025-07-17T06:33:21.0656340Z log.setLevel(logging.INFO) 2025-07-17T06:33:21.0656906Z  2025-07-17T06:33:21.0657336Z  2025-07-17T06:33:21.0658163Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:21.0658898Z  """ 2025-07-17T06:33:21.0659539Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:21.0660465Z  """ 2025-07-17T06:33:21.0660949Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:21.0662182Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:21.0663457Z  log.warning( 2025-07-17T06:33:21.0664463Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:21.0665526Z  ) 2025-07-17T06:33:21.0666083Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:21.0666746Z  return 2025-07-17T06:33:21.0667247Z  2025-07-17T06:33:21.0667742Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:21.0668645Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:21.0669341Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:21.0669949Z  2025-07-17T06:33:21.0670380Z  2025-07-17T06:33:21.0670998Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:21.0671782Z  return frozenset( 2025-07-17T06:33:21.0672553Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:21.0673355Z  ) 2025-07-17T06:33:21.0673816Z  2025-07-17T06:33:21.0674252Z  2025-07-17T06:33:21.0674706Z def parse_args() -> Any: 2025-07-17T06:33:21.0675431Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:21.0676433Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:21.0677336Z  parser.add_argument( 2025-07-17T06:33:21.0678136Z  "--github-issue-repo", 2025-07-17T06:33:21.0678767Z  type=str, 2025-07-17T06:33:21.0679328Z  required=False, 2025-07-17T06:33:21.0680060Z  default="pytorch/test-infra", 2025-07-17T06:33:21.0680751Z  help="GitHub repo to get the issue", 2025-07-17T06:33:21.0681375Z  ) 2025-07-17T06:33:21.0681858Z  parser.add_argument( 2025-07-17T06:33:21.0682436Z  "--github-repo", 2025-07-17T06:33:21.0683004Z  type=str, 2025-07-17T06:33:21.0683529Z  required=True, 2025-07-17T06:33:21.0684142Z  help="GitHub repo where CI is running", 2025-07-17T06:33:21.0684777Z  ) 2025-07-17T06:33:21.0685250Z  parser.add_argument( 2025-07-17T06:33:21.0686006Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:21.0686774Z  ) 2025-07-17T06:33:21.0687257Z  parser.add_argument( 2025-07-17T06:33:21.0688208Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:21.0689032Z  ) 2025-07-17T06:33:21.0689509Z  parser.add_argument( 2025-07-17T06:33:21.0690294Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:21.0691107Z  ) 2025-07-17T06:33:21.0691588Z  parser.add_argument( 2025-07-17T06:33:21.0692404Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:21.0693227Z  ) 2025-07-17T06:33:21.0693734Z  parser.add_argument( 2025-07-17T06:33:21.0694326Z  "--github-ref-type", 2025-07-17T06:33:21.0694912Z  type=str, 2025-07-17T06:33:21.0695446Z  required=True, 2025-07-17T06:33:21.0696095Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:21.0696760Z  ) 2025-07-17T06:33:21.0697245Z  parser.add_argument( 2025-07-17T06:33:21.0698192Z  "--eligible-experiments", 2025-07-17T06:33:21.0698893Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:21.0699529Z  required=False, 2025-07-17T06:33:21.0700083Z  default="", 2025-07-17T06:33:21.0701086Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:21.0702137Z  ) 2025-07-17T06:33:21.0702618Z  parser.add_argument( 2025-07-17T06:33:21.0703205Z  "--opt-out-experiments", 2025-07-17T06:33:21.0703847Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:21.0704480Z  required=False, 2025-07-17T06:33:21.0705025Z  default="", 2025-07-17T06:33:21.0705563Z  help=( 2025-07-17T06:33:21.0706376Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:21.0707654Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:21.0708819Z  ), 2025-07-17T06:33:21.0709300Z  ) 2025-07-17T06:33:21.0709774Z  parser.add_argument( 2025-07-17T06:33:21.0710339Z  "--pr-number", 2025-07-17T06:33:21.0710894Z  type=str, 2025-07-17T06:33:21.0711427Z  required=False, 2025-07-17T06:33:21.0711976Z  default="", 2025-07-17T06:33:21.0712587Z  help="the optional PR number where this is run", 2025-07-17T06:33:21.0713258Z  ) 2025-07-17T06:33:21.0713699Z  2025-07-17T06:33:21.0714165Z  return parser.parse_args() 2025-07-17T06:33:21.0714748Z  2025-07-17T06:33:21.0715170Z  2025-07-17T06:33:21.0715874Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:21.0716911Z  auth = Auth.Token(github_token) 2025-07-17T06:33:21.0717597Z  return Github(auth=auth) 2025-07-17T06:33:21.0718486Z  2025-07-17T06:33:21.0718923Z  2025-07-17T06:33:21.0719705Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:21.0720632Z  repo = gh.get_repo(repo) 2025-07-17T06:33:21.0721266Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:21.0721907Z  2025-07-17T06:33:21.0722350Z  2025-07-17T06:33:21.0722820Z def get_potential_pr_author( 2025-07-17T06:33:21.0723611Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:21.0724393Z ) -> str: 2025-07-17T06:33:21.0725048Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:21.0726009Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:21.0726904Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:21.0727597Z  2025-07-17T06:33:21.0728827Z  gh = get_gh_client(github_token) 2025-07-17T06:33:21.0729456Z  2025-07-17T06:33:21.0730033Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:21.0730792Z  split_tag = ref_name.split("/") 2025-07-17T06:33:21.0731410Z  if ( 2025-07-17T06:33:21.0731916Z  len(split_tag) == 3 2025-07-17T06:33:21.0732544Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:21.0733195Z  and split_tag[2].isnumeric() 2025-07-17T06:33:21.0733808Z  ): 2025-07-17T06:33:21.0734315Z  pr_number = split_tag[2] 2025-07-17T06:33:21.0734917Z  try: 2025-07-17T06:33:21.0735482Z  repository = gh.get_repo(repo) 2025-07-17T06:33:21.0736391Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:21.0737122Z  except Exception as e: 2025-07-17T06:33:21.0737771Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:21.0738693Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:21.0739446Z  ) from e 2025-07-17T06:33:21.0740126Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:21.0740967Z  # In all other cases, return the original input username 2025-07-17T06:33:21.0741663Z  return username 2025-07-17T06:33:21.0742186Z  2025-07-17T06:33:21.0742605Z  2025-07-17T06:33:21.0743125Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:21.0743759Z  """ 2025-07-17T06:33:21.0744538Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:21.0745451Z  """ 2025-07-17T06:33:21.0746111Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:21.0746893Z  2025-07-17T06:33:21.0747322Z  2025-07-17T06:33:21.0747805Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:21.0748515Z  try: 2025-07-17T06:33:21.0749029Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:21.0749645Z  return data 2025-07-17T06:33:21.0750227Z  except yaml.YAMLError: 2025-07-17T06:33:21.0750850Z  log.exception("Error loading YAML") 2025-07-17T06:33:21.0751465Z  raise 2025-07-17T06:33:21.0751948Z  2025-07-17T06:33:21.0752364Z  2025-07-17T06:33:21.0753080Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:21.0753937Z  """ 2025-07-17T06:33:21.0754831Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:21.0755721Z  2025-07-17T06:33:21.0756355Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:21.0757248Z  and the text below is the list of opted in users. 2025-07-17T06:33:21.0758065Z  2025-07-17T06:33:21.0758758Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:21.0759574Z  """ 2025-07-17T06:33:21.0760132Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:21.0760939Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:21.0761835Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:21.0762543Z  else: 2025-07-17T06:33:21.0763037Z  return "", rollout_state 2025-07-17T06:33:21.0763613Z  2025-07-17T06:33:21.0764034Z  2025-07-17T06:33:21.0764530Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:21.0765154Z  """ 2025-07-17T06:33:21.0765787Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:21.0766545Z  """ 2025-07-17T06:33:21.0766986Z  2025-07-17T06:33:21.0767407Z  2025-07-17T06:33:21.0768245Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:21.0769023Z  """ 2025-07-17T06:33:21.0769855Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:21.0770806Z  2025-07-17T06:33:21.0771717Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:21.0772852Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:21.0773797Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:21.0774530Z  2025-07-17T06:33:21.0774953Z  2025-07-17T06:33:21.0775369Z  """ 2025-07-17T06:33:21.0775844Z  optins = UserOptins() 2025-07-17T06:33:21.0776468Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:21.0777140Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:21.0777985Z  if not user or not user.startswith("@"): 2025-07-17T06:33:21.0778670Z  # Not a valid user. Skip 2025-07-17T06:33:21.0779307Z  continue 2025-07-17T06:33:21.0779817Z  2025-07-17T06:33:21.0780257Z  if user: 2025-07-17T06:33:21.0780827Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:21.0781632Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:21.0782390Z  2025-07-17T06:33:21.0782824Z  return optins 2025-07-17T06:33:21.0783326Z  2025-07-17T06:33:21.0783743Z  2025-07-17T06:33:21.0784332Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:21.0785051Z  """ 2025-07-17T06:33:21.0785566Z  Check if the experiment name is valid. 2025-07-17T06:33:21.0786196Z  A valid name: 2025-07-17T06:33:21.0786975Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:21.0788145Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:21.0788965Z  - Cannot contain spaces 2025-07-17T06:33:21.0789544Z  """ 2025-07-17T06:33:21.0789985Z  2025-07-17T06:33:21.0790533Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:21.0791373Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:21.0792304Z  2025-07-17T06:33:21.0792879Z  if valid: 2025-07-17T06:33:21.0793376Z  return True 2025-07-17T06:33:21.0793886Z  2025-07-17T06:33:21.0794321Z  log.error( 2025-07-17T06:33:21.0795928Z  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-07-17T06:33:21.0797661Z  ) 2025-07-17T06:33:21.0798289Z  return False 2025-07-17T06:33:21.0798800Z  2025-07-17T06:33:21.0799239Z  2025-07-17T06:33:21.0799851Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:21.0800592Z  """ 2025-07-17T06:33:21.0801296Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:21.0802141Z  """ 2025-07-17T06:33:21.0802602Z  try: 2025-07-17T06:33:21.0803085Z  if settings_text: 2025-07-17T06:33:21.0803944Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:21.0804860Z  # for easy reading 2025-07-17T06:33:21.0805789Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:21.0806801Z  # the backtick character in shell commands. 2025-07-17T06:33:21.0807517Z  backtick = chr(96) # backtick character 2025-07-17T06:33:21.0808440Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:21.0809223Z  settings = load_yaml(settings_text) 2025-07-17T06:33:21.0809832Z  2025-07-17T06:33:21.0810516Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:21.0811518Z  experiments = {} 2025-07-17T06:33:21.0812080Z  2025-07-17T06:33:21.0812736Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:21.0813611Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:21.0814838Z  # 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-07-17T06:33:21.0816003Z  continue 2025-07-17T06:33:21.0816555Z  2025-07-17T06:33:21.0817016Z  valid_settings = {} 2025-07-17T06:33:21.0817652Z  for setting in exp_settings: 2025-07-17T06:33:21.0818448Z  if setting not in Experiment._fields: 2025-07-17T06:33:21.0819121Z  log.warning( 2025-07-17T06:33:21.0819971Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:21.0820789Z  ) 2025-07-17T06:33:21.0821328Z  else: 2025-07-17T06:33:21.0821973Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:21.0822647Z  2025-07-17T06:33:21.0823204Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:21.0823951Z  return Settings(experiments) 2025-07-17T06:33:21.0824556Z  2025-07-17T06:33:21.0825006Z  except Exception: 2025-07-17T06:33:21.0825617Z  log.exception("Failed to parse settings") 2025-07-17T06:33:21.0826258Z  2025-07-17T06:33:21.0826693Z  return Settings() 2025-07-17T06:33:21.0827214Z  2025-07-17T06:33:21.0827637Z  2025-07-17T06:33:21.0828505Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:21.0829202Z  """ 2025-07-17T06:33:21.0829747Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:21.0830399Z  2025-07-17T06:33:21.0831037Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:21.0831911Z  and the text below is the list of opted in users. 2025-07-17T06:33:21.0832560Z  2025-07-17T06:33:21.0833247Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:21.0834077Z  """ 2025-07-17T06:33:21.0834746Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:21.0835631Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:21.0836278Z  2025-07-17T06:33:21.0836700Z  2025-07-17T06:33:21.0837241Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:21.0838044Z  """ 2025-07-17T06:33:21.0838555Z  Parse users from the rollout state. 2025-07-17T06:33:21.0839168Z  2025-07-17T06:33:21.0839584Z  """ 2025-07-17T06:33:21.0840238Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:21.0841104Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:21.0841751Z  2025-07-17T06:33:21.0842177Z  2025-07-17T06:33:21.0842887Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:21.0843753Z  """ 2025-07-17T06:33:21.0844276Z  Check if a user is opted into an experiment 2025-07-17T06:33:21.0844911Z  """ 2025-07-17T06:33:21.0845483Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:21.0846154Z  2025-07-17T06:33:21.0846714Z  2025-07-17T06:33:21.0847432Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:21.0848410Z  """ 2025-07-17T06:33:21.0848980Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:21.0849657Z  """ 2025-07-17T06:33:21.0850296Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:21.0851105Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:21.0851867Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:21.0852577Z  return False 2025-07-17T06:33:21.0853091Z  2025-07-17T06:33:21.0853640Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:21.0854348Z  log.warning( 2025-07-17T06:33:21.0855294Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:21.0856301Z  ) 2025-07-17T06:33:21.0856762Z  2025-07-17T06:33:21.0857191Z  return True 2025-07-17T06:33:21.0857686Z  2025-07-17T06:33:21.0858205Z  2025-07-17T06:33:21.0858656Z def get_runner_prefix( 2025-07-17T06:33:21.0859219Z  rollout_state: str, 2025-07-17T06:33:21.0859814Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:21.0860430Z  branch: str, 2025-07-17T06:33:21.0861058Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:21.0861853Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:21.0862541Z  is_canary: bool = False, 2025-07-17T06:33:21.0863111Z ) -> str: 2025-07-17T06:33:21.0863642Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:21.0864342Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:21.0864973Z  2025-07-17T06:33:21.0865536Z  fleet_prefix = "" 2025-07-17T06:33:21.0866085Z  prefixes = [] 2025-07-17T06:33:21.0866845Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:21.0868013Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:21.0868886Z  log.info( 2025-07-17T06:33:21.0869707Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:21.0870558Z  ) 2025-07-17T06:33:21.0871075Z  continue 2025-07-17T06:33:21.0871588Z  2025-07-17T06:33:21.0872046Z  if opt_out_experiments: 2025-07-17T06:33:21.0872709Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:21.0873472Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:21.0874187Z  log.info( 2025-07-17T06:33:21.0875276Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:21.0876358Z  ) 2025-07-17T06:33:21.0876880Z  continue 2025-07-17T06:33:21.0877407Z  2025-07-17T06:33:21.0877971Z  if eligible_experiments: 2025-07-17T06:33:21.0878666Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:21.0879411Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:21.0880068Z  log.info( 2025-07-17T06:33:21.0880967Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:21.0881903Z  ) 2025-07-17T06:33:21.0882549Z  continue 2025-07-17T06:33:21.0883164Z  elif not experiment_settings.default: 2025-07-17T06:33:21.0883795Z  log.info( 2025-07-17T06:33:21.0884580Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:21.0885413Z  ) 2025-07-17T06:33:21.0885897Z  continue 2025-07-17T06:33:21.0886412Z  2025-07-17T06:33:21.0886956Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:21.0887676Z  opted_out_users = [ 2025-07-17T06:33:21.0888361Z  requestor 2025-07-17T06:33:21.0888945Z  for requestor in workflow_requestors 2025-07-17T06:33:21.0889723Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:21.0890454Z  ] 2025-07-17T06:33:21.0890917Z  2025-07-17T06:33:21.0891366Z  if opted_out_users: 2025-07-17T06:33:21.0891960Z  log.info( 2025-07-17T06:33:21.0892711Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:21.0893519Z  ) 2025-07-17T06:33:21.0894009Z  continue 2025-07-17T06:33:21.0894524Z  2025-07-17T06:33:21.0895084Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:21.0895792Z  opted_in_users = [ 2025-07-17T06:33:21.0896372Z  requestor 2025-07-17T06:33:21.0896953Z  for requestor in workflow_requestors 2025-07-17T06:33:21.0897735Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:21.0898561Z  ] 2025-07-17T06:33:21.0899021Z  2025-07-17T06:33:21.0899464Z  enabled = False 2025-07-17T06:33:21.0900023Z  if opted_in_users: 2025-07-17T06:33:21.0900711Z  log.info( 2025-07-17T06:33:21.0901450Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:21.0902235Z  ) 2025-07-17T06:33:21.0902726Z  enabled = True 2025-07-17T06:33:21.0903277Z  2025-07-17T06:33:21.0903780Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:21.0904732Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:21.0905792Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:21.0906547Z  log.info( 2025-07-17T06:33:21.0907550Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:21.0908688Z  ) 2025-07-17T06:33:21.0909236Z  enabled = True 2025-07-17T06:33:21.0909796Z  2025-07-17T06:33:21.0910223Z  if enabled: 2025-07-17T06:33:21.0910779Z  label = experiment_name 2025-07-17T06:33:21.0911435Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:21.0912370Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:21.0913366Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:21.0914247Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:21.0915016Z  if is_canary: 2025-07-17T06:33:21.0915628Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:21.0916283Z  fleet_prefix = label 2025-07-17T06:33:21.0916869Z  else: 2025-07-17T06:33:21.0917564Z  prefixes.append(label) 2025-07-17T06:33:21.0918274Z  2025-07-17T06:33:21.0918727Z  if len(prefixes) > 1: 2025-07-17T06:33:21.0919381Z  log.error( 2025-07-17T06:33:21.0920686Z  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-07-17T06:33:21.0921936Z  ) 2025-07-17T06:33:21.0922431Z  prefixes = prefixes[:1] 2025-07-17T06:33:21.0923009Z  2025-07-17T06:33:21.0923465Z  # Fleet always comes first 2025-07-17T06:33:21.0924051Z  if fleet_prefix: 2025-07-17T06:33:21.0924636Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:21.0925237Z  2025-07-17T06:33:21.0925777Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:21.0926445Z  2025-07-17T06:33:21.0926889Z  2025-07-17T06:33:21.0927626Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:21.0928621Z  """ 2025-07-17T06:33:21.0929316Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:21.0930122Z  2025-07-17T06:33:21.0930794Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:21.0931594Z  """ 2025-07-17T06:33:21.0932083Z  gh = get_gh_client(github_token) 2025-07-17T06:33:21.0932746Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:21.0933497Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:21.0934191Z  2025-07-17T06:33:21.0934604Z  2025-07-17T06:33:21.0935297Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:21.0936315Z  for _ in range(num_retries): 2025-07-17T06:33:21.0936917Z  try: 2025-07-17T06:33:21.0937457Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:21.0938340Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:21.0939098Z  return json.loads(content) 2025-07-17T06:33:21.0939725Z  except Exception as e: 2025-07-17T06:33:21.0940384Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:21.0941033Z  2025-07-17T06:33:21.0941694Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:21.0942513Z  return {} 2025-07-17T06:33:21.0943006Z  2025-07-17T06:33:21.0943433Z  2025-07-17T06:33:21.0943856Z @cache 2025-07-17T06:33:21.0944596Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:21.0945466Z  """ 2025-07-17T06:33:21.0945965Z  Dynamically get PR information 2025-07-17T06:33:21.0946546Z  """ 2025-07-17T06:33:21.0947158Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:21.0948002Z  headers = { 2025-07-17T06:33:21.0948604Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:21.0949315Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:21.0949963Z  } 2025-07-17T06:33:21.0950508Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:21.0951222Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:21.0951856Z  headers=headers, 2025-07-17T06:33:21.0952390Z  ) 2025-07-17T06:33:21.0952837Z  2025-07-17T06:33:21.0953283Z  if not json_response: 2025-07-17T06:33:21.0953978Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:21.0955202Z  return {} 2025-07-17T06:33:21.0955711Z  2025-07-17T06:33:21.0956160Z  return json_response 2025-07-17T06:33:21.0956695Z  2025-07-17T06:33:21.0957120Z  2025-07-17T06:33:21.0957804Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:21.0958802Z  """ 2025-07-17T06:33:21.0959442Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:21.0960192Z  """ 2025-07-17T06:33:21.0960782Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:21.0961493Z  return { 2025-07-17T06:33:21.0962194Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:21.0962986Z  } 2025-07-17T06:33:21.0963434Z  2025-07-17T06:33:21.0963872Z  2025-07-17T06:33:21.0964322Z def main() -> None: 2025-07-17T06:33:21.0964865Z  args = parse_args() 2025-07-17T06:33:21.0965399Z  2025-07-17T06:33:21.0965907Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:21.0966537Z  2025-07-17T06:33:21.0966996Z  # Check if the PR is opt-out 2025-07-17T06:33:21.0967593Z  if args.pr_number: 2025-07-17T06:33:21.0968493Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:21.0969343Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:21.0969942Z  log.info( 2025-07-17T06:33:21.0970762Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:21.0971626Z  ) 2025-07-17T06:33:21.0972303Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:21.0973082Z  sys.exit() 2025-07-17T06:33:21.0973726Z  2025-07-17T06:33:21.0974163Z  try: 2025-07-17T06:33:21.0974718Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:21.0975537Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:21.0976281Z  ) 2025-07-17T06:33:21.0976737Z  2025-07-17T06:33:21.0977211Z  username = get_potential_pr_author( 2025-07-17T06:33:21.0977950Z  args.github_token, 2025-07-17T06:33:21.0978550Z  args.github_repo, 2025-07-17T06:33:21.0979140Z  args.github_actor, 2025-07-17T06:33:21.0979749Z  args.github_ref_type, 2025-07-17T06:33:21.0980361Z  args.github_branch, 2025-07-17T06:33:21.0980929Z  ) 2025-07-17T06:33:21.0981388Z  2025-07-17T06:33:21.0981962Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:21.0982670Z  2025-07-17T06:33:21.0983166Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:21.0983811Z  rollout_state, 2025-07-17T06:33:21.0984418Z  (args.github_issue_owner, username), 2025-07-17T06:33:21.0985063Z  args.github_branch, 2025-07-17T06:33:21.0985676Z  args.eligible_experiments, 2025-07-17T06:33:21.0986329Z  args.opt_out_experiments, 2025-07-17T06:33:21.0986938Z  is_canary, 2025-07-17T06:33:21.0987473Z  ) 2025-07-17T06:33:21.0988026Z  2025-07-17T06:33:21.0988484Z  except Exception as e: 2025-07-17T06:33:21.0989052Z  log.error( 2025-07-17T06:33:21.0989854Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:21.0990859Z  ) 2025-07-17T06:33:21.0991321Z  2025-07-17T06:33:21.0991941Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:21.0992703Z  2025-07-17T06:33:21.0993126Z  2025-07-17T06:33:21.0993565Z if __name__ == "__main__": 2025-07-17T06:33:21.0994126Z  main() 2025-07-17T06:33:21.0994599Z  2025-07-17T06:33:21.0995021Z EOF 2025-07-17T06:33:21.0995460Z  2025-07-17T06:33:21.0995913Z cat runner_determinator.py 2025-07-17T06:33:21.1406701Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:21.1407623Z env: 2025-07-17T06:33:21.1408691Z GITHUB_TOKEN: *** 2025-07-17T06:33:21.1409192Z ISSUE_NUMBER: 5132 2025-07-17T06:33:21.1409718Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:21.1410305Z ISSUE_OWNER: 2025-07-17T06:33:21.1410780Z CHECK_EXPERIMENTS: 2025-07-17T06:33:21.1411285Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:21.1411803Z PR_NUMBER: 2025-07-17T06:33:21.1412281Z ##[endgroup] 2025-07-17T06:33:21.1620036Z # flake8: noqa: G004 2025-07-17T06:33:21.1620409Z 2025-07-17T06:33:21.1620859Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:21.1621832Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:21.1622644Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:21.1623096Z 2025-07-17T06:33:21.1623258Z """ 2025-07-17T06:33:21.1623836Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:21.1624738Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:21.1625690Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:21.1626532Z of which runners should be used to run which job. 2025-07-17T06:33:21.1626948Z 2025-07-17T06:33:21.1627345Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:21.1628810Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:21.1629753Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:21.1630475Z list, defined. 2025-07-17T06:33:21.1630705Z 2025-07-17T06:33:21.1631079Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:21.1632031Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:21.1632871Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:21.1633333Z 2025-07-17T06:33:21.1633710Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:21.1634602Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:21.1635341Z experiments which the user could be opted in to. 2025-07-17T06:33:21.1635751Z 2025-07-17T06:33:21.1635962Z The user list has the following rules: 2025-07-17T06:33:21.1636315Z 2025-07-17T06:33:21.1636652Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:21.1637533Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:21.1638606Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:21.1639016Z 2025-07-17T06:33:21.1639195Z Example config: 2025-07-17T06:33:21.1639668Z # A list of experiments that can be opted into. 2025-07-17T06:33:21.1640351Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:21.1641000Z # Expected syntax is: 2025-07-17T06:33:21.1641675Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:21.1642672Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:21.1643294Z 2025-07-17T06:33:21.1643480Z experiments: 2025-07-17T06:33:21.1643876Z lf: 2025-07-17T06:33:21.1644277Z rollout_percent: 25 2025-07-17T06:33:21.1644917Z all_branches: false 2025-07-17T06:33:21.1645384Z default: true 2025-07-17T06:33:21.1645798Z --- 2025-07-17T06:33:21.1646006Z 2025-07-17T06:33:21.1646173Z # Opt-ins: 2025-07-17T06:33:21.1646770Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:21.1647672Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:21.1648797Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:21.1649470Z # Experiments should be from the above list. 2025-07-17T06:33:21.1649858Z 2025-07-17T06:33:21.1650055Z @User1,-lf,split_build 2025-07-17T06:33:21.1650494Z @User2,lf 2025-07-17T06:33:21.1650890Z @User3,split_build 2025-07-17T06:33:21.1651306Z """ 2025-07-17T06:33:21.1651507Z 2025-07-17T06:33:21.1651679Z import json 2025-07-17T06:33:21.1652056Z import logging 2025-07-17T06:33:21.1652453Z import os 2025-07-17T06:33:21.1652821Z import random 2025-07-17T06:33:21.1653212Z import re 2025-07-17T06:33:21.1653588Z import sys 2025-07-17T06:33:21.1654012Z from argparse import ArgumentParser 2025-07-17T06:33:21.1654563Z from collections.abc import Iterable 2025-07-17T06:33:21.1655093Z from functools import cache 2025-07-17T06:33:21.1655576Z from logging import LogRecord 2025-07-17T06:33:21.1656073Z from typing import Any, NamedTuple 2025-07-17T06:33:21.1656620Z from urllib.request import Request, urlopen 2025-07-17T06:33:21.1657000Z 2025-07-17T06:33:21.1657170Z import yaml 2025-07-17T06:33:21.1657570Z from github import Auth, Github 2025-07-17T06:33:21.1658289Z from github.Issue import Issue 2025-07-17T06:33:21.1658611Z 2025-07-17T06:33:21.1658620Z 2025-07-17T06:33:21.1658847Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:21.1659551Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:21.1660449Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:21.1661023Z 2025-07-17T06:33:21.1661271Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:21.1661996Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:21.1662539Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:21.1663103Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:21.1663468Z 2025-07-17T06:33:21.1663672Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:21.1664016Z 2025-07-17T06:33:21.1664225Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:21.1664699Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:21.1664987Z 2025-07-17T06:33:21.1665000Z 2025-07-17T06:33:21.1665194Z class Experiment(NamedTuple): 2025-07-17T06:33:21.1665690Z rollout_perc: float = ( 2025-07-17T06:33:21.1666348Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:21.1667032Z ) 2025-07-17T06:33:21.1667411Z all_branches: bool = ( 2025-07-17T06:33:21.1668247Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:21.1668941Z ) 2025-07-17T06:33:21.1669324Z default: bool = ( 2025-07-17T06:33:21.1669904Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:21.1670561Z ) 2025-07-17T06:33:21.1670759Z 2025-07-17T06:33:21.1670948Z # Add more fields as needed 2025-07-17T06:33:21.1671256Z 2025-07-17T06:33:21.1671264Z 2025-07-17T06:33:21.1671454Z class Settings(NamedTuple): 2025-07-17T06:33:21.1671906Z """ 2025-07-17T06:33:21.1672355Z Settings for the experiments that can be opted into. 2025-07-17T06:33:21.1672941Z """ 2025-07-17T06:33:21.1673137Z 2025-07-17T06:33:21.1673351Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:21.1673719Z 2025-07-17T06:33:21.1673732Z 2025-07-17T06:33:21.1673942Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:21.1674573Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:21.1675011Z 2025-07-17T06:33:21.1675178Z COLORS = { 2025-07-17T06:33:21.1675578Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:21.1676230Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:21.1676751Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:21.1677265Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:21.1677762Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:21.1678492Z } 2025-07-17T06:33:21.1678696Z 2025-07-17T06:33:21.1678922Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:21.1679688Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:21.1680480Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:21.1681067Z return super().format(record) 2025-07-17T06:33:21.1681408Z 2025-07-17T06:33:21.1681417Z 2025-07-17T06:33:21.1681616Z handler = logging.StreamHandler() 2025-07-17T06:33:21.1682335Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:21.1682897Z 2025-07-17T06:33:21.1683153Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:21.1683764Z log.addHandler(handler) 2025-07-17T06:33:21.1684224Z log.setLevel(logging.INFO) 2025-07-17T06:33:21.1684520Z 2025-07-17T06:33:21.1684527Z 2025-07-17T06:33:21.1684781Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:21.1685352Z """ 2025-07-17T06:33:21.1685859Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:21.1686503Z """ 2025-07-17T06:33:21.1686882Z if not GITHUB_OUTPUT: 2025-07-17T06:33:21.1688217Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:21.1689381Z log.warning( 2025-07-17T06:33:21.1690265Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:21.1691229Z ) 2025-07-17T06:33:21.1701246Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:21.1701870Z return 2025-07-17T06:33:21.1702113Z 2025-07-17T06:33:21.1702511Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:21.1703146Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:21.1703734Z f.write(f"{key}={value}\n") 2025-07-17T06:33:21.1704075Z 2025-07-17T06:33:21.1704083Z 2025-07-17T06:33:21.1704402Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:21.1705058Z return frozenset( 2025-07-17T06:33:21.1705683Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:21.1706434Z ) 2025-07-17T06:33:21.1706643Z 2025-07-17T06:33:21.1706650Z 2025-07-17T06:33:21.1706834Z def parse_args() -> Any: 2025-07-17T06:33:21.1707437Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:21.1708598Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:21.1709395Z parser.add_argument( 2025-07-17T06:33:21.1709873Z "--github-issue-repo", 2025-07-17T06:33:21.1710377Z type=str, 2025-07-17T06:33:21.1710789Z required=False, 2025-07-17T06:33:21.1711247Z default="pytorch/test-infra", 2025-07-17T06:33:21.1711798Z help="GitHub repo to get the issue", 2025-07-17T06:33:21.1712314Z ) 2025-07-17T06:33:21.1712690Z parser.add_argument( 2025-07-17T06:33:21.1713150Z "--github-repo", 2025-07-17T06:33:21.1713593Z type=str, 2025-07-17T06:33:21.1713998Z required=True, 2025-07-17T06:33:21.1714465Z help="GitHub repo where CI is running", 2025-07-17T06:33:21.1714992Z ) 2025-07-17T06:33:21.1715370Z parser.add_argument( 2025-07-17T06:33:21.1715989Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:21.1716656Z ) 2025-07-17T06:33:21.1717034Z parser.add_argument( 2025-07-17T06:33:21.1717658Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:21.1718596Z ) 2025-07-17T06:33:21.1718979Z parser.add_argument( 2025-07-17T06:33:21.1719813Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:21.1720519Z ) 2025-07-17T06:33:21.1720895Z parser.add_argument( 2025-07-17T06:33:21.1721568Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:21.1722304Z ) 2025-07-17T06:33:21.1722694Z parser.add_argument( 2025-07-17T06:33:21.1723144Z "--github-ref-type", 2025-07-17T06:33:21.1723604Z type=str, 2025-07-17T06:33:21.1773842Z required=True, 2025-07-17T06:33:21.1774479Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:21.1775080Z ) 2025-07-17T06:33:21.1775473Z parser.add_argument( 2025-07-17T06:33:21.1775958Z "--eligible-experiments", 2025-07-17T06:33:21.1776478Z type=_str_comma_separated_to_set, 2025-07-17T06:33:21.1777015Z required=False, 2025-07-17T06:33:21.1777440Z default="", 2025-07-17T06:33:21.1778602Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:21.1779619Z ) 2025-07-17T06:33:21.1779999Z parser.add_argument( 2025-07-17T06:33:21.1780469Z "--opt-out-experiments", 2025-07-17T06:33:21.1780998Z type=_str_comma_separated_to_set, 2025-07-17T06:33:21.1781533Z required=False, 2025-07-17T06:33:21.1781953Z default="", 2025-07-17T06:33:21.1782358Z help=( 2025-07-17T06:33:21.1783043Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:21.1784207Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:21.1785050Z ), 2025-07-17T06:33:21.1785419Z ) 2025-07-17T06:33:21.1785795Z parser.add_argument( 2025-07-17T06:33:21.1786241Z "--pr-number", 2025-07-17T06:33:21.1786661Z type=str, 2025-07-17T06:33:21.1787056Z required=False, 2025-07-17T06:33:21.1787488Z default="", 2025-07-17T06:33:21.1788344Z help="the optional PR number where this is run", 2025-07-17T06:33:21.1788959Z ) 2025-07-17T06:33:21.1789163Z 2025-07-17T06:33:21.1789359Z return parser.parse_args() 2025-07-17T06:33:21.1789686Z 2025-07-17T06:33:21.1789693Z 2025-07-17T06:33:21.1790105Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:21.1790880Z auth = Auth.Token(github_token) 2025-07-17T06:33:21.1791387Z return Github(auth=auth) 2025-07-17T06:33:21.1791683Z 2025-07-17T06:33:21.1791691Z 2025-07-17T06:33:21.1792158Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:21.1792966Z repo = gh.get_repo(repo) 2025-07-17T06:33:21.1793472Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:21.1793840Z 2025-07-17T06:33:21.1793848Z 2025-07-17T06:33:21.1794037Z def get_potential_pr_author( 2025-07-17T06:33:21.1794711Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:21.1795401Z ) -> str: 2025-07-17T06:33:21.1795933Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:21.1796755Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:21.1797505Z # embedded in the tag name: ciflow// 2025-07-17T06:33:21.1798113Z 2025-07-17T06:33:21.1798321Z gh = get_gh_client(github_token) 2025-07-17T06:33:21.1798663Z 2025-07-17T06:33:21.1798937Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:21.1799569Z split_tag = ref_name.split("/") 2025-07-17T06:33:21.1800088Z if ( 2025-07-17T06:33:21.1800476Z len(split_tag) == 3 2025-07-17T06:33:21.1800964Z and split_tag[0] == "ciflow" 2025-07-17T06:33:21.1801498Z and split_tag[2].isnumeric() 2025-07-17T06:33:21.1802006Z ): 2025-07-17T06:33:21.1802398Z pr_number = split_tag[2] 2025-07-17T06:33:21.1803250Z try: 2025-07-17T06:33:21.1803684Z repository = gh.get_repo(repo) 2025-07-17T06:33:21.1804311Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:21.1804924Z except Exception as e: 2025-07-17T06:33:21.1805454Z raise Exception( # noqa: TRY002 2025-07-17T06:33:21.1806180Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:21.1806830Z ) from e 2025-07-17T06:33:21.1807377Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:21.1808292Z # In all other cases, return the original input username 2025-07-17T06:33:21.1808904Z return username 2025-07-17T06:33:21.1809156Z 2025-07-17T06:33:21.1809162Z 2025-07-17T06:33:21.1809397Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:21.1809943Z """ 2025-07-17T06:33:21.1810597Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:21.1811389Z """ 2025-07-17T06:33:21.1811975Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:21.1812500Z 2025-07-17T06:33:21.1812508Z 2025-07-17T06:33:21.1812715Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:21.1813225Z try: 2025-07-17T06:33:21.1813614Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:21.1814131Z return data 2025-07-17T06:33:21.1814558Z except yaml.YAMLError: 2025-07-17T06:33:21.1815044Z log.exception("Error loading YAML") 2025-07-17T06:33:21.1815580Z raise 2025-07-17T06:33:21.1815802Z 2025-07-17T06:33:21.1815809Z 2025-07-17T06:33:21.1816239Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:21.1816997Z """ 2025-07-17T06:33:21.1817623Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:21.1818513Z 2025-07-17T06:33:21.1819044Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:21.1819846Z and the text below is the list of opted in users. 2025-07-17T06:33:21.1820258Z 2025-07-17T06:33:21.1820654Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:21.1821365Z """ 2025-07-17T06:33:21.1821806Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:21.1822444Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:21.1823053Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:21.1823669Z else: 2025-07-17T06:33:21.1824053Z return "", rollout_state 2025-07-17T06:33:21.1824367Z 2025-07-17T06:33:21.1824375Z 2025-07-17T06:33:21.1824583Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:21.1825100Z """ 2025-07-17T06:33:21.1825624Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:21.1826285Z """ 2025-07-17T06:33:21.1826496Z 2025-07-17T06:33:21.1826504Z 2025-07-17T06:33:21.1826851Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:21.1827519Z """ 2025-07-17T06:33:21.1828462Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:21.1829205Z 2025-07-17T06:33:21.1829845Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:21.1830860Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:21.1831545Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:21.1832040Z 2025-07-17T06:33:21.1832047Z 2025-07-17T06:33:21.1832217Z """ 2025-07-17T06:33:21.1832595Z optins = UserOptins() 2025-07-17T06:33:21.1833099Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:21.1833667Z user = user.strip("\r\n\t -") 2025-07-17T06:33:21.1834223Z if not user or not user.startswith("@"): 2025-07-17T06:33:21.1834963Z # Not a valid user. Skip 2025-07-17T06:33:21.1835464Z continue 2025-07-17T06:33:21.1835713Z 2025-07-17T06:33:21.1835881Z if user: 2025-07-17T06:33:21.1836324Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:21.1837039Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:21.1837536Z 2025-07-17T06:33:21.1837717Z return optins 2025-07-17T06:33:21.1838089Z 2025-07-17T06:33:21.1838097Z 2025-07-17T06:33:21.1838423Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:21.1839039Z """ 2025-07-17T06:33:21.1839445Z Check if the experiment name is valid. 2025-07-17T06:33:21.1839976Z A valid name: 2025-07-17T06:33:21.1840606Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:21.1841594Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:21.1842347Z - Cannot contain spaces 2025-07-17T06:33:21.1842810Z """ 2025-07-17T06:33:21.1843014Z 2025-07-17T06:33:21.1843289Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:21.1844001Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:21.1844457Z 2025-07-17T06:33:21.1844623Z if valid: 2025-07-17T06:33:21.1845004Z return True 2025-07-17T06:33:21.1845246Z 2025-07-17T06:33:21.1845416Z log.error( 2025-07-17T06:33:21.1846900Z 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-07-17T06:33:21.1848625Z ) 2025-07-17T06:33:21.1848996Z return False 2025-07-17T06:33:21.1849231Z 2025-07-17T06:33:21.1849239Z 2025-07-17T06:33:21.1849553Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:21.1850189Z """ 2025-07-17T06:33:21.1850940Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:21.1851691Z """ 2025-07-17T06:33:21.1852052Z try: 2025-07-17T06:33:21.1852434Z if settings_text: 2025-07-17T06:33:21.1853175Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:21.1853975Z # for easy reading 2025-07-17T06:33:21.1854778Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:21.1855671Z # the backtick character in shell commands. 2025-07-17T06:33:21.1856286Z backtick = chr(96) # backtick character 2025-07-17T06:33:21.1856951Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:21.1857642Z settings = load_yaml(settings_text) 2025-07-17T06:33:21.1858248Z 2025-07-17T06:33:21.1858691Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:21.1859489Z experiments = {} 2025-07-17T06:33:21.1859804Z 2025-07-17T06:33:21.1860371Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:21.1861164Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:21.1862299Z # 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-07-17T06:33:21.1863377Z continue 2025-07-17T06:33:21.1863672Z 2025-07-17T06:33:21.1863859Z valid_settings = {} 2025-07-17T06:33:21.1864393Z for setting in exp_settings: 2025-07-17T06:33:21.1864974Z if setting not in Experiment._fields: 2025-07-17T06:33:21.1865550Z log.warning( 2025-07-17T06:33:21.1866271Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:21.1867178Z ) 2025-07-17T06:33:21.1867620Z else: 2025-07-17T06:33:21.1868272Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:21.1868703Z 2025-07-17T06:33:21.1868985Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:21.1869630Z return Settings(experiments) 2025-07-17T06:33:21.1869994Z 2025-07-17T06:33:21.1870170Z except Exception: 2025-07-17T06:33:21.1870657Z log.exception("Failed to parse settings") 2025-07-17T06:33:21.1871065Z 2025-07-17T06:33:21.1871248Z return Settings() 2025-07-17T06:33:21.1871506Z 2025-07-17T06:33:21.1871514Z 2025-07-17T06:33:21.1871772Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:21.1872359Z """ 2025-07-17T06:33:21.1872804Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:21.1873213Z 2025-07-17T06:33:21.1873571Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:21.1874354Z and the text below is the list of opted in users. 2025-07-17T06:33:21.1874765Z 2025-07-17T06:33:21.1875182Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:21.1875931Z """ 2025-07-17T06:33:21.1876488Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:21.1877249Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:21.1877649Z 2025-07-17T06:33:21.1877662Z 2025-07-17T06:33:21.1878013Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:21.1878597Z """ 2025-07-17T06:33:21.1878993Z Parse users from the rollout state. 2025-07-17T06:33:21.1879348Z 2025-07-17T06:33:21.1879511Z """ 2025-07-17T06:33:21.1880044Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:21.1880806Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:21.1881222Z 2025-07-17T06:33:21.1881229Z 2025-07-17T06:33:21.1881779Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:21.1882565Z """ 2025-07-17T06:33:21.1882985Z Check if a user is opted into an experiment 2025-07-17T06:33:21.1883528Z """ 2025-07-17T06:33:21.1883990Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:21.1884425Z 2025-07-17T06:33:21.1884432Z 2025-07-17T06:33:21.1884861Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:21.1885629Z """ 2025-07-17T06:33:21.1886090Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:21.1886686Z """ 2025-07-17T06:33:21.1887194Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:21.1888063Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:21.1888728Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:21.1889363Z return False 2025-07-17T06:33:21.1889618Z 2025-07-17T06:33:21.1889911Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:21.1890522Z log.warning( 2025-07-17T06:33:21.1891337Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:21.1892234Z ) 2025-07-17T06:33:21.1892444Z 2025-07-17T06:33:21.1892619Z return True 2025-07-17T06:33:21.1892852Z 2025-07-17T06:33:21.1892859Z 2025-07-17T06:33:21.1893043Z def get_runner_prefix( 2025-07-17T06:33:21.1893493Z rollout_state: str, 2025-07-17T06:33:21.1893967Z workflow_requestors: Iterable[str], 2025-07-17T06:33:21.1894494Z branch: str, 2025-07-17T06:33:21.1894991Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:21.1895664Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:21.1896266Z is_canary: bool = False, 2025-07-17T06:33:21.1896726Z ) -> str: 2025-07-17T06:33:21.1897293Z settings = parse_settings(rollout_state) 2025-07-17T06:33:21.1898523Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:21.1898967Z 2025-07-17T06:33:21.1899152Z fleet_prefix = "" 2025-07-17T06:33:21.1899586Z prefixes = [] 2025-07-17T06:33:21.1900222Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:21.1901197Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:21.1901920Z log.info( 2025-07-17T06:33:21.1902605Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:21.1903375Z ) 2025-07-17T06:33:21.1903768Z continue 2025-07-17T06:33:21.1904015Z 2025-07-17T06:33:21.1904217Z if opt_out_experiments: 2025-07-17T06:33:21.1904761Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:21.1905416Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:21.1906058Z log.info( 2025-07-17T06:33:21.1907019Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:21.1908116Z ) 2025-07-17T06:33:21.1908526Z continue 2025-07-17T06:33:21.1908795Z 2025-07-17T06:33:21.1908984Z if eligible_experiments: 2025-07-17T06:33:21.1909587Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:21.1910231Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:21.1910798Z log.info( 2025-07-17T06:33:21.1911592Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:21.1912441Z ) 2025-07-17T06:33:21.1912848Z continue 2025-07-17T06:33:21.1913323Z elif not experiment_settings.default: 2025-07-17T06:33:21.1913869Z log.info( 2025-07-17T06:33:21.1914692Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:21.1915460Z ) 2025-07-17T06:33:21.1915851Z continue 2025-07-17T06:33:21.1916106Z 2025-07-17T06:33:21.1916391Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:21.1917021Z opted_out_users = [ 2025-07-17T06:33:21.1917473Z requestor 2025-07-17T06:33:21.1918041Z for requestor in workflow_requestors 2025-07-17T06:33:21.1918722Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:21.1919365Z ] 2025-07-17T06:33:21.1919570Z 2025-07-17T06:33:21.1919757Z if opted_out_users: 2025-07-17T06:33:21.1920217Z log.info( 2025-07-17T06:33:21.1920846Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:21.1921556Z ) 2025-07-17T06:33:21.1921938Z continue 2025-07-17T06:33:21.1922206Z 2025-07-17T06:33:21.1922500Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:21.1923138Z opted_in_users = [ 2025-07-17T06:33:21.1923585Z requestor 2025-07-17T06:33:21.1924050Z for requestor in workflow_requestors 2025-07-17T06:33:21.1924725Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:21.1925354Z ] 2025-07-17T06:33:21.1925563Z 2025-07-17T06:33:21.1925743Z enabled = False 2025-07-17T06:33:21.1926180Z if opted_in_users: 2025-07-17T06:33:21.1926627Z log.info( 2025-07-17T06:33:21.1927237Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:21.1928029Z ) 2025-07-17T06:33:21.1928419Z enabled = True 2025-07-17T06:33:21.1928705Z 2025-07-17T06:33:21.1928932Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:21.1929790Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:21.1930887Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:21.1931559Z log.info( 2025-07-17T06:33:21.1932433Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:21.1933392Z ) 2025-07-17T06:33:21.1933806Z enabled = True 2025-07-17T06:33:21.1934114Z 2025-07-17T06:33:21.1934286Z if enabled: 2025-07-17T06:33:21.1934723Z label = experiment_name 2025-07-17T06:33:21.1935280Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:21.1936148Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:21.1937043Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:21.1937932Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:21.1938620Z if is_canary: 2025-07-17T06:33:21.1939126Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:21.1939694Z fleet_prefix = label 2025-07-17T06:33:21.1940198Z else: 2025-07-17T06:33:21.1940628Z prefixes.append(label) 2025-07-17T06:33:21.1940979Z 2025-07-17T06:33:21.1941167Z if len(prefixes) > 1: 2025-07-17T06:33:21.1941621Z log.error( 2025-07-17T06:33:21.1942679Z 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-07-17T06:33:21.1943830Z ) 2025-07-17T06:33:21.1944233Z prefixes = prefixes[:1] 2025-07-17T06:33:21.1944556Z 2025-07-17T06:33:21.1944748Z # Fleet always comes first 2025-07-17T06:33:21.1945223Z if fleet_prefix: 2025-07-17T06:33:21.1945677Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:21.1946059Z 2025-07-17T06:33:21.1946491Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:21.1946923Z 2025-07-17T06:33:21.1946931Z 2025-07-17T06:33:21.1947385Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:21.1948444Z """ 2025-07-17T06:33:21.1949340Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:21.1949934Z 2025-07-17T06:33:21.1950342Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:21.1951076Z """ 2025-07-17T06:33:21.1951469Z gh = get_gh_client(github_token) 2025-07-17T06:33:21.1952030Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:21.1952673Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:21.1953136Z 2025-07-17T06:33:21.1953144Z 2025-07-17T06:33:21.1953556Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:21.1954349Z for _ in range(num_retries): 2025-07-17T06:33:21.1954841Z try: 2025-07-17T06:33:21.1955275Z req = Request(url=url, headers=headers) 2025-07-17T06:33:21.1955940Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:21.1956802Z return json.loads(content) 2025-07-17T06:33:21.1957343Z except Exception as e: 2025-07-17T06:33:21.1958014Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:21.1958433Z 2025-07-17T06:33:21.1958821Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:21.1959539Z return {} 2025-07-17T06:33:21.1959763Z 2025-07-17T06:33:21.1959770Z 2025-07-17T06:33:21.1959943Z @cache 2025-07-17T06:33:21.1960571Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:21.1961341Z """ 2025-07-17T06:33:21.1961735Z Dynamically get PR information 2025-07-17T06:33:21.1962229Z """ 2025-07-17T06:33:21.1962913Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:21.1963558Z headers = { 2025-07-17T06:33:21.1964025Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:21.1964639Z "Authorization": f"token {github_token}", 2025-07-17T06:33:21.1965191Z } 2025-07-17T06:33:21.1965621Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:21.1966242Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:21.1966791Z headers=headers, 2025-07-17T06:33:21.1967229Z ) 2025-07-17T06:33:21.1967430Z 2025-07-17T06:33:21.1967620Z if not json_response: 2025-07-17T06:33:21.1968313Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:21.1968946Z return {} 2025-07-17T06:33:21.1969182Z 2025-07-17T06:33:21.1969367Z return json_response 2025-07-17T06:33:21.1969647Z 2025-07-17T06:33:21.1969654Z 2025-07-17T06:33:21.1970068Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:21.1970814Z """ 2025-07-17T06:33:21.1971351Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:21.1972017Z """ 2025-07-17T06:33:21.1972512Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:21.1973125Z return { 2025-07-17T06:33:21.1973732Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:21.1974451Z } 2025-07-17T06:33:21.1974652Z 2025-07-17T06:33:21.1974659Z 2025-07-17T06:33:21.1974839Z def main() -> None: 2025-07-17T06:33:21.1975306Z args = parse_args() 2025-07-17T06:33:21.1975582Z 2025-07-17T06:33:21.1975813Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:21.1976212Z 2025-07-17T06:33:21.1976410Z # Check if the PR is opt-out 2025-07-17T06:33:21.1976900Z if args.pr_number: 2025-07-17T06:33:21.1977554Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:21.1978564Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:21.1979084Z log.info( 2025-07-17T06:33:21.1979791Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:21.1980563Z ) 2025-07-17T06:33:21.1981112Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:21.1981786Z sys.exit() 2025-07-17T06:33:21.1982051Z 2025-07-17T06:33:21.1982212Z try: 2025-07-17T06:33:21.1982652Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:21.1983367Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:21.1984017Z ) 2025-07-17T06:33:21.1984223Z 2025-07-17T06:33:21.1984432Z username = get_potential_pr_author( 2025-07-17T06:33:21.1984982Z args.github_token, 2025-07-17T06:33:21.1985467Z args.github_repo, 2025-07-17T06:33:21.1985950Z args.github_actor, 2025-07-17T06:33:21.1986452Z args.github_ref_type, 2025-07-17T06:33:21.1986957Z args.github_branch, 2025-07-17T06:33:21.1987435Z ) 2025-07-17T06:33:21.1987650Z 2025-07-17T06:33:21.1988046Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:21.1988505Z 2025-07-17T06:33:21.1988730Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:21.1989292Z rollout_state, 2025-07-17T06:33:21.1989779Z (args.github_issue_owner, username), 2025-07-17T06:33:21.1990331Z args.github_branch, 2025-07-17T06:33:21.1990835Z args.eligible_experiments, 2025-07-17T06:33:21.1991372Z args.opt_out_experiments, 2025-07-17T06:33:21.1991887Z is_canary, 2025-07-17T06:33:21.1992303Z ) 2025-07-17T06:33:21.1992509Z 2025-07-17T06:33:21.1992701Z except Exception as e: 2025-07-17T06:33:21.1993163Z log.error( 2025-07-17T06:33:21.1993837Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:21.1994869Z ) 2025-07-17T06:33:21.1995078Z 2025-07-17T06:33:21.1995412Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:21.1995923Z 2025-07-17T06:33:21.1995931Z 2025-07-17T06:33:21.1996112Z if __name__ == "__main__": 2025-07-17T06:33:21.1996558Z main() 2025-07-17T06:33:21.1996767Z 2025-07-17T06:33:21.2091300Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:21.2092217Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:21.2120795Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:21.2121333Z env: 2025-07-17T06:33:21.2121982Z GITHUB_TOKEN: *** 2025-07-17T06:33:21.2122400Z ISSUE_NUMBER: 5132 2025-07-17T06:33:21.2122857Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:21.2123381Z ISSUE_OWNER: 2025-07-17T06:33:21.2123788Z CHECK_EXPERIMENTS: 2025-07-17T06:33:21.2124226Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:21.2124686Z PR_NUMBER: 2025-07-17T06:33:21.2125065Z ##[endgroup] 2025-07-17T06:33:22.3277371Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:23.2988722Z Collecting urllib3==1.26.18 2025-07-17T06:33:23.3323305Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:23.3562228Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-07-17T06:33:23.3771891Z Collecting PyGithub==2.3.0 2025-07-17T06:33:23.3819211Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:23.4242602Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:23.4272995Z 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-07-17T06:33:23.4323701Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:23.4341916Z 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-07-17T06:33:23.4357003Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:23.4612272Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:23.4647102Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:23.4900999Z 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-07-17T06:33:23.5993774Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:23.6026117Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:23.7206427Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:23.7244210Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:23.7440077Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:23.7472712Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:23.7710257Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:23.7785300Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 24.6 MB/s eta 0:00:00 2025-07-17T06:33:23.7831240Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:23.7935740Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 40.6 MB/s eta 0:00:00 2025-07-17T06:33:23.7994362Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:23.8113879Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 83.4 MB/s eta 0:00:00 2025-07-17T06:33:23.8192972Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:23.8319554Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:23.8411092Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 68.0 MB/s eta 0:00:00 2025-07-17T06:33:23.8447000Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:23.8502254Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 20.6 MB/s eta 0:00:00 2025-07-17T06:33:23.8540122Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:23.8608743Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 20.5 MB/s eta 0:00:00 2025-07-17T06:33:24.1898203Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:24.7438580Z 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.2 2025-07-17T06:33:24.8398607Z ##[group]Run curr_branch="main" 2025-07-17T06:33:24.8398949Z curr_branch="main" 2025-07-17T06:33:24.8399199Z curr_ref_type="branch" 2025-07-17T06:33:24.8399449Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:24.8399700Z  2025-07-17T06:33:24.8399895Z python3 runner_determinator.py \ 2025-07-17T06:33:24.8400177Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:24.8400449Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:24.8400710Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:24.8400976Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:24.8401259Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:24.8401532Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:24.8401802Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:24.8402097Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:24.8402466Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:24.8402754Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:24.8433342Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:24.8433575Z env: 2025-07-17T06:33:24.8434168Z GITHUB_TOKEN: *** 2025-07-17T06:33:24.8434367Z ISSUE_NUMBER: 5132 2025-07-17T06:33:24.8434575Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:24.8434804Z ISSUE_OWNER: 2025-07-17T06:33:24.8434984Z CHECK_EXPERIMENTS: 2025-07-17T06:33:24.8435175Z OPT_OUT_EXPERIMENTS: lf 2025-07-17T06:33:24.8435372Z PR_NUMBER: 2025-07-17T06:33:24.8435534Z ##[endgroup] 2025-07-17T06:33:24.8486908Z Current branch is 'main' 2025-07-17T06:33:26.4500170Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-07-17T06:33:26.4501781Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:26.4503038Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:26.4505675Z INFO : Setting output: label-type='' 2025-07-17T06:33:26.4848620Z Evaluate and set job outputs 2025-07-17T06:33:26.4855518Z Cleaning up orphan processes