2025-07-17T06:33:19.3752507Z Current runner version: '2.326.0' 2025-07-17T06:33:19.3787136Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.3788434Z Hosted Compute Agent 2025-07-17T06:33:19.3789521Z Version: 20250711.363 2025-07-17T06:33:19.3790501Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.3791808Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.3792848Z ##[endgroup] 2025-07-17T06:33:19.3793854Z ##[group]Operating System 2025-07-17T06:33:19.3795010Z Ubuntu 2025-07-17T06:33:19.3795974Z 24.04.2 2025-07-17T06:33:19.3796712Z LTS 2025-07-17T06:33:19.3797605Z ##[endgroup] 2025-07-17T06:33:19.3798409Z ##[group]Runner Image 2025-07-17T06:33:19.3799450Z Image: ubuntu-24.04 2025-07-17T06:33:19.3800394Z Version: 20250710.1.0 2025-07-17T06:33:19.3802199Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.3805215Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.3806926Z ##[endgroup] 2025-07-17T06:33:19.3809419Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.3812316Z Contents: read 2025-07-17T06:33:19.3813338Z Metadata: read 2025-07-17T06:33:19.3814199Z Packages: read 2025-07-17T06:33:19.3815291Z ##[endgroup] 2025-07-17T06:33:19.3818470Z Secret source: Actions 2025-07-17T06:33:19.3819824Z Prepare workflow directory 2025-07-17T06:33:19.4572712Z Prepare all required actions 2025-07-17T06:33:19.4655204Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.4662500Z ##[group] Inputs 2025-07-17T06:33:19.4663501Z check_experiments: 2025-07-17T06:33:19.4664365Z opt_out_experiments: 2025-07-17T06:33:19.4665507Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.4666548Z issue_owner: 2025-07-17T06:33:19.4667470Z curr_branch: main 2025-07-17T06:33:19.4668476Z curr_ref_type: branch 2025-07-17T06:33:19.4669474Z issue_number: 5132 2025-07-17T06:33:19.4670474Z ##[endgroup] 2025-07-17T06:33:19.4671427Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:19.5453326Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:19.5455935Z cat < runner_determinator.py 2025-07-17T06:33:19.5456595Z # flake8: noqa: G004 2025-07-17T06:33:19.5457140Z  2025-07-17T06:33:19.5457891Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.5458956Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.5459937Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.5460681Z  2025-07-17T06:33:19.5461192Z """ 2025-07-17T06:33:19.5461903Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.5463155Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.5464385Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.5465628Z of which runners should be used to run which job. 2025-07-17T06:33:19.5466350Z  2025-07-17T06:33:19.5467038Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.5468025Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.5469040Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.5469905Z list, defined. 2025-07-17T06:33:19.5470424Z  2025-07-17T06:33:19.5471376Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.5472465Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.5473391Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.5474400Z  2025-07-17T06:33:19.5475265Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.5476259Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.5477182Z experiments which the user could be opted in to. 2025-07-17T06:33:19.5477809Z  2025-07-17T06:33:19.5478299Z The user list has the following rules: 2025-07-17T06:33:19.5478901Z  2025-07-17T06:33:19.5479571Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.5480486Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.5481398Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.5482064Z  2025-07-17T06:33:19.5482477Z Example config: 2025-07-17T06:33:19.5483106Z  # A list of experiments that can be opted into. 2025-07-17T06:33:19.5483922Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.5484796Z  # Expected syntax is: 2025-07-17T06:33:19.5485630Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.5486688Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.5487526Z  2025-07-17T06:33:19.5487927Z  experiments: 2025-07-17T06:33:19.5488532Z  lf: 2025-07-17T06:33:19.5488991Z  rollout_percent: 25 2025-07-17T06:33:19.5489563Z  all_branches: false 2025-07-17T06:33:19.5490195Z  default: true 2025-07-17T06:33:19.5490695Z  --- 2025-07-17T06:33:19.5491142Z  2025-07-17T06:33:19.5491643Z  # Opt-ins: 2025-07-17T06:33:19.5492358Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.5493452Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.5494410Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.5495509Z  # Experiments should be from the above list. 2025-07-17T06:33:19.5496144Z  2025-07-17T06:33:19.5496679Z  @User1,-lf,split_build 2025-07-17T06:33:19.5497231Z  @User2,lf 2025-07-17T06:33:19.5497758Z  @User3,split_build 2025-07-17T06:33:19.5498291Z """ 2025-07-17T06:33:19.5498770Z  2025-07-17T06:33:19.5499258Z import json 2025-07-17T06:33:19.5499772Z import logging 2025-07-17T06:33:19.5500370Z import os 2025-07-17T06:33:19.5500847Z import random 2025-07-17T06:33:19.5501400Z import re 2025-07-17T06:33:19.5501907Z import sys 2025-07-17T06:33:19.5502442Z from argparse import ArgumentParser 2025-07-17T06:33:19.5503147Z from collections.abc import Iterable 2025-07-17T06:33:19.5503773Z from functools import cache 2025-07-17T06:33:19.5504376Z from logging import LogRecord 2025-07-17T06:33:19.5505128Z from typing import Any, NamedTuple 2025-07-17T06:33:19.5505945Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.5506658Z  2025-07-17T06:33:19.5507109Z import yaml 2025-07-17T06:33:19.5507754Z from github import Auth, Github 2025-07-17T06:33:19.5508384Z from github.Issue import Issue 2025-07-17T06:33:19.5508993Z  2025-07-17T06:33:19.5509550Z  2025-07-17T06:33:19.5510132Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.5510944Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.5511950Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.5512999Z  2025-07-17T06:33:19.5513505Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.5514267Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.5515045Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.5515731Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.5516401Z  2025-07-17T06:33:19.5516870Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.5517466Z  2025-07-17T06:33:19.5517924Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.5518568Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.5519080Z  2025-07-17T06:33:19.5519535Z  2025-07-17T06:33:19.5520022Z class Experiment(NamedTuple): 2025-07-17T06:33:19.5520596Z  rollout_perc: float = ( 2025-07-17T06:33:19.5521413Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.5522197Z  ) 2025-07-17T06:33:19.5522687Z  all_branches: bool = ( 2025-07-17T06:33:19.5586814Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.5587703Z  ) 2025-07-17T06:33:19.5588107Z  default: bool = ( 2025-07-17T06:33:19.5588747Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.5589432Z  ) 2025-07-17T06:33:19.5589800Z  2025-07-17T06:33:19.5590167Z  # Add more fields as needed 2025-07-17T06:33:19.5590691Z  2025-07-17T06:33:19.5591041Z  2025-07-17T06:33:19.5591411Z class Settings(NamedTuple): 2025-07-17T06:33:19.5591907Z  """ 2025-07-17T06:33:19.5592404Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:19.5593064Z  """ 2025-07-17T06:33:19.5593479Z  2025-07-17T06:33:19.5593887Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.5594431Z  2025-07-17T06:33:19.5595088Z  2025-07-17T06:33:19.5595532Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.5596224Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.5596834Z  2025-07-17T06:33:19.5597178Z  COLORS = { 2025-07-17T06:33:19.5597624Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.5598177Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.5598709Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.5599256Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.5599797Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.5600298Z  } 2025-07-17T06:33:19.5600659Z  2025-07-17T06:33:19.5601085Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.5601893Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.5602741Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.5603402Z  return super().format(record) 2025-07-17T06:33:19.5603925Z  2025-07-17T06:33:19.5604262Z  2025-07-17T06:33:19.5604782Z handler = logging.StreamHandler() 2025-07-17T06:33:19.5605571Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.5606391Z  2025-07-17T06:33:19.5606899Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.5607537Z log.addHandler(handler) 2025-07-17T06:33:19.5608035Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.5608553Z  2025-07-17T06:33:19.5608922Z  2025-07-17T06:33:19.5609382Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.5609993Z  """ 2025-07-17T06:33:19.5610539Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.5611356Z  """ 2025-07-17T06:33:19.5611746Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:19.5612863Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.5614041Z  log.warning( 2025-07-17T06:33:19.5615225Z  "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:19.5616213Z  ) 2025-07-17T06:33:19.5616676Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.5617244Z  return 2025-07-17T06:33:19.5617650Z  2025-07-17T06:33:19.5618038Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.5618648Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.5619247Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:19.5619764Z  2025-07-17T06:33:19.5620103Z  2025-07-17T06:33:19.5620618Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.5621292Z  return frozenset( 2025-07-17T06:33:19.5621951Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.5622659Z  ) 2025-07-17T06:33:19.5623016Z  2025-07-17T06:33:19.5623348Z  2025-07-17T06:33:19.5623721Z def parse_args() -> Any: 2025-07-17T06:33:19.5624351Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.5625570Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.5626381Z  parser.add_argument( 2025-07-17T06:33:19.5626883Z  "--github-issue-repo", 2025-07-17T06:33:19.5627390Z  type=str, 2025-07-17T06:33:19.5627848Z  required=False, 2025-07-17T06:33:19.5628495Z  default="pytorch/test-infra", 2025-07-17T06:33:19.5629096Z  help="GitHub repo to get the issue", 2025-07-17T06:33:19.5629633Z  ) 2025-07-17T06:33:19.5630013Z  parser.add_argument( 2025-07-17T06:33:19.5630499Z  "--github-repo", 2025-07-17T06:33:19.5630974Z  type=str, 2025-07-17T06:33:19.5631434Z  required=True, 2025-07-17T06:33:19.5631951Z  help="GitHub repo where CI is running", 2025-07-17T06:33:19.5632504Z  ) 2025-07-17T06:33:19.5632895Z  parser.add_argument( 2025-07-17T06:33:19.5633572Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.5634259Z  ) 2025-07-17T06:33:19.5634767Z  parser.add_argument( 2025-07-17T06:33:19.5635467Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.5636195Z  ) 2025-07-17T06:33:19.5636591Z  parser.add_argument( 2025-07-17T06:33:19.5637285Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.5638019Z  ) 2025-07-17T06:33:19.5638403Z  parser.add_argument( 2025-07-17T06:33:19.5639148Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.5639965Z  ) 2025-07-17T06:33:19.5640401Z  parser.add_argument( 2025-07-17T06:33:19.5640895Z  "--github-ref-type", 2025-07-17T06:33:19.5641393Z  type=str, 2025-07-17T06:33:19.5641840Z  required=True, 2025-07-17T06:33:19.5642388Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.5642959Z  ) 2025-07-17T06:33:19.5643353Z  parser.add_argument( 2025-07-17T06:33:19.5643995Z  "--eligible-experiments", 2025-07-17T06:33:19.5644680Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.5645246Z  required=False, 2025-07-17T06:33:19.5645717Z  default="", 2025-07-17T06:33:19.5646620Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.5647601Z  ) 2025-07-17T06:33:19.5647996Z  parser.add_argument( 2025-07-17T06:33:19.5648507Z  "--opt-out-experiments", 2025-07-17T06:33:19.5649066Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:19.5649619Z  required=False, 2025-07-17T06:33:19.5650087Z  default="", 2025-07-17T06:33:19.5650532Z  help=( 2025-07-17T06:33:19.5651245Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.5652475Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.5653407Z  ), 2025-07-17T06:33:19.5653835Z  ) 2025-07-17T06:33:19.5654236Z  parser.add_argument( 2025-07-17T06:33:19.5654981Z  "--pr-number", 2025-07-17T06:33:19.5655458Z  type=str, 2025-07-17T06:33:19.5655898Z  required=False, 2025-07-17T06:33:19.5656372Z  default="", 2025-07-17T06:33:19.5656906Z  help="the optional PR number where this is run", 2025-07-17T06:33:19.5657498Z  ) 2025-07-17T06:33:19.5657856Z  2025-07-17T06:33:19.5658232Z  return parser.parse_args() 2025-07-17T06:33:19.5658739Z  2025-07-17T06:33:19.5659066Z  2025-07-17T06:33:19.5659673Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.5660632Z  auth = Auth.Token(github_token) 2025-07-17T06:33:19.5661195Z  return Github(auth=auth) 2025-07-17T06:33:19.5661674Z  2025-07-17T06:33:19.5662013Z  2025-07-17T06:33:19.5662669Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.5663506Z  repo = gh.get_repo(repo) 2025-07-17T06:33:19.5664098Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.5664754Z  2025-07-17T06:33:19.5665093Z  2025-07-17T06:33:19.5665461Z def get_potential_pr_author( 2025-07-17T06:33:19.5666212Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.5666916Z ) -> str: 2025-07-17T06:33:19.5667468Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.5668361Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.5669167Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:19.5669770Z  2025-07-17T06:33:19.5670149Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.5670682Z  2025-07-17T06:33:19.5671169Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.5671834Z  split_tag = ref_name.split("/") 2025-07-17T06:33:19.5672376Z  if ( 2025-07-17T06:33:19.5672816Z  len(split_tag) == 3 2025-07-17T06:33:19.5673395Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:19.5674000Z  and split_tag[2].isnumeric() 2025-07-17T06:33:19.5674517Z  ): 2025-07-17T06:33:19.5675045Z  pr_number = split_tag[2] 2025-07-17T06:33:19.5675567Z  try: 2025-07-17T06:33:19.5676044Z  repository = gh.get_repo(repo) 2025-07-17T06:33:19.5676833Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.5677480Z  except Exception as e: 2025-07-17T06:33:19.5678040Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:19.5678750Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.5679427Z  ) from e 2025-07-17T06:33:19.5680026Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.5680798Z  # In all other cases, return the original input username 2025-07-17T06:33:19.5681459Z  return username 2025-07-17T06:33:19.5681937Z  2025-07-17T06:33:19.5682317Z  2025-07-17T06:33:19.5682793Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.5683348Z  """ 2025-07-17T06:33:19.5684028Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.5684973Z  """ 2025-07-17T06:33:19.5685547Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.5686246Z  2025-07-17T06:33:19.5686580Z  2025-07-17T06:33:19.5686967Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.5687487Z  try: 2025-07-17T06:33:19.5687904Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.5688449Z  return data 2025-07-17T06:33:19.5688912Z  except yaml.YAMLError: 2025-07-17T06:33:19.5689448Z  log.exception("Error loading YAML") 2025-07-17T06:33:19.5689984Z  raise 2025-07-17T06:33:19.5690383Z  2025-07-17T06:33:19.5690708Z  2025-07-17T06:33:19.5691322Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.5692100Z  """ 2025-07-17T06:33:19.5692862Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.5693696Z  2025-07-17T06:33:19.5694283Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.5695335Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.5695967Z  2025-07-17T06:33:19.5696601Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.5697375Z  """ 2025-07-17T06:33:19.5697849Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.5698481Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.5699163Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.5699785Z  else: 2025-07-17T06:33:19.5700185Z  return "", rollout_state 2025-07-17T06:33:19.5700703Z  2025-07-17T06:33:19.5701033Z  2025-07-17T06:33:19.5701440Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.5701977Z  """ 2025-07-17T06:33:19.5702517Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.5703191Z  """ 2025-07-17T06:33:19.5703539Z  2025-07-17T06:33:19.5703870Z  2025-07-17T06:33:19.5704400Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.5705578Z  """ 2025-07-17T06:33:19.5706323Z  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:19.5707191Z  2025-07-17T06:33:19.5708083Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.5709283Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.5710244Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.5710908Z  2025-07-17T06:33:19.5711234Z  2025-07-17T06:33:19.5711560Z  """ 2025-07-17T06:33:19.5711935Z  optins = UserOptins() 2025-07-17T06:33:19.5712480Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.5713062Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:19.5713652Z  if not user or not user.startswith("@"): 2025-07-17T06:33:19.5714228Z  # Not a valid user. Skip 2025-07-17T06:33:19.5714869Z  continue 2025-07-17T06:33:19.5715294Z  2025-07-17T06:33:19.5715625Z  if user: 2025-07-17T06:33:19.5716109Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.5716829Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.5717492Z  2025-07-17T06:33:19.5717835Z  return optins 2025-07-17T06:33:19.5718255Z  2025-07-17T06:33:19.5718573Z  2025-07-17T06:33:19.5719066Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.5719705Z  """ 2025-07-17T06:33:19.5720120Z  Check if the experiment name is valid. 2025-07-17T06:33:19.5720676Z  A valid name: 2025-07-17T06:33:19.5721354Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.5722330Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.5723062Z  - Cannot contain spaces 2025-07-17T06:33:19.5723550Z  """ 2025-07-17T06:33:19.5723903Z  2025-07-17T06:33:19.5724361Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.5725233Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.5725969Z  2025-07-17T06:33:19.5726317Z  if valid: 2025-07-17T06:33:19.5726724Z  return True 2025-07-17T06:33:19.5727151Z  2025-07-17T06:33:19.5727487Z  log.error( 2025-07-17T06:33:19.5728935Z  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:19.5730560Z  ) 2025-07-17T06:33:19.5730923Z  return False 2025-07-17T06:33:19.5731330Z  2025-07-17T06:33:19.5731649Z  2025-07-17T06:33:19.5732169Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.5732834Z  """ 2025-07-17T06:33:19.5733434Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.5734187Z  """ 2025-07-17T06:33:19.5734538Z  try: 2025-07-17T06:33:19.5735193Z  if settings_text: 2025-07-17T06:33:19.5735966Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.5736795Z  # for easy reading 2025-07-17T06:33:19.5737728Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.5738779Z  # the backtick character in shell commands. 2025-07-17T06:33:19.5739414Z  backtick = chr(96) # backtick character 2025-07-17T06:33:19.5740118Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.5740824Z  settings = load_yaml(settings_text) 2025-07-17T06:33:19.5741346Z  2025-07-17T06:33:19.5742139Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.5742914Z  experiments = {} 2025-07-17T06:33:19.5743377Z  2025-07-17T06:33:19.5743935Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.5744872Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.5745989Z  # 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:19.5747092Z  continue 2025-07-17T06:33:19.5747561Z  2025-07-17T06:33:19.5747934Z  valid_settings = {} 2025-07-17T06:33:19.5748487Z  for setting in exp_settings: 2025-07-17T06:33:19.5749090Z  if setting not in Experiment._fields: 2025-07-17T06:33:19.5749685Z  log.warning( 2025-07-17T06:33:19.5750446Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.5751192Z  ) 2025-07-17T06:33:19.5751656Z  else: 2025-07-17T06:33:19.5752219Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.5752805Z  2025-07-17T06:33:19.5753286Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.5753955Z  return Settings(experiments) 2025-07-17T06:33:19.5754467Z  2025-07-17T06:33:19.5754924Z  except Exception: 2025-07-17T06:33:19.5755453Z  log.exception("Failed to parse settings") 2025-07-17T06:33:19.5756007Z  2025-07-17T06:33:19.5756355Z  return Settings() 2025-07-17T06:33:19.5756792Z  2025-07-17T06:33:19.5757123Z  2025-07-17T06:33:19.5757694Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.5758299Z  """ 2025-07-17T06:33:19.5758754Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.5759327Z  2025-07-17T06:33:19.5759863Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.5760667Z  and the text below is the list of opted in users. 2025-07-17T06:33:19.5761229Z  2025-07-17T06:33:19.5761822Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.5762578Z  """ 2025-07-17T06:33:19.5763158Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.5764003Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.5764679Z  2025-07-17T06:33:19.5765018Z  2025-07-17T06:33:19.5765473Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.5766064Z  """ 2025-07-17T06:33:19.5766478Z  Parse users from the rollout state. 2025-07-17T06:33:19.5767017Z  2025-07-17T06:33:19.5767342Z  """ 2025-07-17T06:33:19.5767899Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.5768697Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.5769255Z  2025-07-17T06:33:19.5769576Z  2025-07-17T06:33:19.5770197Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.5770975Z  """ 2025-07-17T06:33:19.5771421Z  Check if a user is opted into an experiment 2025-07-17T06:33:19.5771977Z  """ 2025-07-17T06:33:19.5772459Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.5773179Z  2025-07-17T06:33:19.5773508Z  2025-07-17T06:33:19.5774136Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.5775190Z  """ 2025-07-17T06:33:19.5775672Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.5776280Z  """ 2025-07-17T06:33:19.5776810Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.5777542Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.5778223Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.5778846Z  return False 2025-07-17T06:33:19.5779278Z  2025-07-17T06:33:19.5779732Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.5780355Z  log.warning( 2025-07-17T06:33:19.5781202Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.5782116Z  ) 2025-07-17T06:33:19.5782483Z  2025-07-17T06:33:19.5782825Z  return True 2025-07-17T06:33:19.5783224Z  2025-07-17T06:33:19.5783546Z  2025-07-17T06:33:19.5783904Z def get_runner_prefix( 2025-07-17T06:33:19.5784369Z  rollout_state: str, 2025-07-17T06:33:19.5785170Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:19.5785714Z  branch: str, 2025-07-17T06:33:19.5786247Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.5786960Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.5787568Z  is_canary: bool = False, 2025-07-17T06:33:19.5788057Z ) -> str: 2025-07-17T06:33:19.5788500Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:19.5789110Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.5789652Z  2025-07-17T06:33:19.5790139Z  fleet_prefix = "" 2025-07-17T06:33:19.5790610Z  prefixes = [] 2025-07-17T06:33:19.5791300Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.5792293Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.5793035Z  log.info( 2025-07-17T06:33:19.5793760Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.5794540Z  ) 2025-07-17T06:33:19.5795057Z  continue 2025-07-17T06:33:19.5795486Z  2025-07-17T06:33:19.5795852Z  if opt_out_experiments: 2025-07-17T06:33:19.5796482Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.5797153Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.5797775Z  log.info( 2025-07-17T06:33:19.5798735Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.5799749Z  ) 2025-07-17T06:33:19.5800182Z  continue 2025-07-17T06:33:19.5800852Z  2025-07-17T06:33:19.5801400Z  if eligible_experiments: 2025-07-17T06:33:19.5802359Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.5803247Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.5803831Z  log.info( 2025-07-17T06:33:19.5804868Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.5805753Z  ) 2025-07-17T06:33:19.5806356Z  continue 2025-07-17T06:33:19.5806889Z  elif not experiment_settings.default: 2025-07-17T06:33:19.5807440Z  log.info( 2025-07-17T06:33:19.5808134Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.5808911Z  ) 2025-07-17T06:33:19.5809317Z  continue 2025-07-17T06:33:19.5809745Z  2025-07-17T06:33:19.5810261Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.5810940Z  opted_out_users = [ 2025-07-17T06:33:19.5811468Z  requestor 2025-07-17T06:33:19.5811965Z  for requestor in workflow_requestors 2025-07-17T06:33:19.5812665Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.5813314Z  ] 2025-07-17T06:33:19.5813684Z  2025-07-17T06:33:19.5814034Z  if opted_out_users: 2025-07-17T06:33:19.5814520Z  log.info( 2025-07-17T06:33:19.5815428Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.5816155Z  ) 2025-07-17T06:33:19.5816575Z  continue 2025-07-17T06:33:19.5816999Z  2025-07-17T06:33:19.5817464Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.5818089Z  opted_in_users = [ 2025-07-17T06:33:19.5818575Z  requestor 2025-07-17T06:33:19.5819075Z  for requestor in workflow_requestors 2025-07-17T06:33:19.5819765Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.5820400Z  ] 2025-07-17T06:33:19.5820779Z  2025-07-17T06:33:19.5821130Z  enabled = False 2025-07-17T06:33:19.5821616Z  if opted_in_users: 2025-07-17T06:33:19.5822241Z  log.info( 2025-07-17T06:33:19.5822894Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.5823596Z  ) 2025-07-17T06:33:19.5824018Z  enabled = True 2025-07-17T06:33:19.5824482Z  2025-07-17T06:33:19.5825120Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.5825964Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.5826939Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.5827610Z  log.info( 2025-07-17T06:33:19.5828517Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.5829486Z  ) 2025-07-17T06:33:19.5829932Z  enabled = True 2025-07-17T06:33:19.5830418Z  2025-07-17T06:33:19.5830767Z  if enabled: 2025-07-17T06:33:19.5831237Z  label = experiment_name 2025-07-17T06:33:19.5831816Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.5832658Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.5833576Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.5834351Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.5835137Z  if is_canary: 2025-07-17T06:33:19.5835673Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.5836247Z  fleet_prefix = label 2025-07-17T06:33:19.5836904Z  else: 2025-07-17T06:33:19.5837377Z  prefixes.append(label) 2025-07-17T06:33:19.5837941Z  2025-07-17T06:33:19.5838326Z  if len(prefixes) > 1: 2025-07-17T06:33:19.5838800Z  log.error( 2025-07-17T06:33:19.5839880Z  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:19.5841044Z  ) 2025-07-17T06:33:19.5841449Z  prefixes = prefixes[:1] 2025-07-17T06:33:19.5841979Z  2025-07-17T06:33:19.5842343Z  # Fleet always comes first 2025-07-17T06:33:19.5842892Z  if fleet_prefix: 2025-07-17T06:33:19.5843378Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.5843900Z  2025-07-17T06:33:19.5844353Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.5845200Z  2025-07-17T06:33:19.5845530Z  2025-07-17T06:33:19.5846161Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.5846953Z  """ 2025-07-17T06:33:19.5847555Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.5848281Z  2025-07-17T06:33:19.5848852Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.5849576Z  """ 2025-07-17T06:33:19.5849982Z  gh = get_gh_client(github_token) 2025-07-17T06:33:19.5850567Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.5851245Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.5851864Z  2025-07-17T06:33:19.5852187Z  2025-07-17T06:33:19.5852787Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.5853709Z  for _ in range(num_retries): 2025-07-17T06:33:19.5854268Z  try: 2025-07-17T06:33:19.5854998Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:19.5855732Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.5856405Z  return json.loads(content) 2025-07-17T06:33:19.5856947Z  except Exception as e: 2025-07-17T06:33:19.5857536Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.5858103Z  2025-07-17T06:33:19.5858705Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.5859448Z  return {} 2025-07-17T06:33:19.5859843Z  2025-07-17T06:33:19.5860171Z  2025-07-17T06:33:19.5860499Z @cache 2025-07-17T06:33:19.5861158Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.5861948Z  """ 2025-07-17T06:33:19.5862353Z  Dynamically get PR information 2025-07-17T06:33:19.5862872Z  """ 2025-07-17T06:33:19.5863381Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.5864067Z  headers = { 2025-07-17T06:33:19.5864765Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.5865517Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:19.5866059Z  } 2025-07-17T06:33:19.5866530Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.5867225Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.5867782Z  headers=headers, 2025-07-17T06:33:19.5868249Z  ) 2025-07-17T06:33:19.5868595Z  2025-07-17T06:33:19.5868957Z  if not json_response: 2025-07-17T06:33:19.5869713Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.5870327Z  return {} 2025-07-17T06:33:19.5870745Z  2025-07-17T06:33:19.5871108Z  return json_response 2025-07-17T06:33:19.5871552Z  2025-07-17T06:33:19.5871874Z  2025-07-17T06:33:19.5872457Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.5873162Z  """ 2025-07-17T06:33:19.5873876Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.5874525Z  """ 2025-07-17T06:33:19.5875135Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.5875840Z  return { 2025-07-17T06:33:19.5876449Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.5877183Z  } 2025-07-17T06:33:19.5877536Z  2025-07-17T06:33:19.5877887Z  2025-07-17T06:33:19.5878237Z def main() -> None: 2025-07-17T06:33:19.5878733Z  args = parse_args() 2025-07-17T06:33:19.5879173Z  2025-07-17T06:33:19.5879618Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.5880145Z  2025-07-17T06:33:19.5880508Z  # Check if the PR is opt-out 2025-07-17T06:33:19.5881024Z  if args.pr_number: 2025-07-17T06:33:19.5881700Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.5882443Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.5882944Z  log.info( 2025-07-17T06:33:19.5883651Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.5884394Z  ) 2025-07-17T06:33:19.5885066Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.5885735Z  sys.exit() 2025-07-17T06:33:19.5886284Z  2025-07-17T06:33:19.5886638Z  try: 2025-07-17T06:33:19.5887091Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.5887801Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.5888420Z  ) 2025-07-17T06:33:19.5888775Z  2025-07-17T06:33:19.5889167Z  username = get_potential_pr_author( 2025-07-17T06:33:19.5889695Z  args.github_token, 2025-07-17T06:33:19.5890199Z  args.github_repo, 2025-07-17T06:33:19.5890683Z  args.github_actor, 2025-07-17T06:33:19.5891188Z  args.github_ref_type, 2025-07-17T06:33:19.5891714Z  args.github_branch, 2025-07-17T06:33:19.5892194Z  ) 2025-07-17T06:33:19.5892576Z  2025-07-17T06:33:19.5893071Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.5893658Z  2025-07-17T06:33:19.5894071Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.5894819Z  rollout_state, 2025-07-17T06:33:19.5895429Z  (args.github_issue_owner, username), 2025-07-17T06:33:19.5895965Z  args.github_branch, 2025-07-17T06:33:19.5896488Z  args.eligible_experiments, 2025-07-17T06:33:19.5897029Z  args.opt_out_experiments, 2025-07-17T06:33:19.5897530Z  is_canary, 2025-07-17T06:33:19.5897964Z  ) 2025-07-17T06:33:19.5898330Z  2025-07-17T06:33:19.5898693Z  except Exception as e: 2025-07-17T06:33:19.5899162Z  log.error( 2025-07-17T06:33:19.5899856Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.5900731Z  ) 2025-07-17T06:33:19.5901101Z  2025-07-17T06:33:19.5901632Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.5902263Z  2025-07-17T06:33:19.5902600Z  2025-07-17T06:33:19.5902948Z if __name__ == "__main__": 2025-07-17T06:33:19.5903491Z  main() 2025-07-17T06:33:19.5903864Z  2025-07-17T06:33:19.5904197Z EOF 2025-07-17T06:33:19.5904538Z  2025-07-17T06:33:19.5905133Z cat runner_determinator.py 2025-07-17T06:33:19.6151153Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.6151891Z env: 2025-07-17T06:33:19.6152502Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.6152900Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.6153320Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.6153795Z ISSUE_OWNER: 2025-07-17T06:33:19.6154164Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.6154743Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.6155177Z PR_NUMBER: 2025-07-17T06:33:19.6155529Z ##[endgroup] 2025-07-17T06:33:19.6370152Z # flake8: noqa: G004 2025-07-17T06:33:19.6370475Z 2025-07-17T06:33:19.6370904Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:19.6371849Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:19.6372636Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:19.6373052Z 2025-07-17T06:33:19.6373205Z """ 2025-07-17T06:33:19.6373747Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:19.6374776Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:19.6375689Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:19.6376473Z of which runners should be used to run which job. 2025-07-17T06:33:19.6376851Z 2025-07-17T06:33:19.6377223Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:19.6378260Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:19.6379111Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:19.6379764Z list, defined. 2025-07-17T06:33:19.6379981Z 2025-07-17T06:33:19.6380374Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:19.6381225Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:19.6382013Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:19.6382430Z 2025-07-17T06:33:19.6382778Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:19.6383614Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:19.6384313Z experiments which the user could be opted in to. 2025-07-17T06:33:19.6384904Z 2025-07-17T06:33:19.6385126Z The user list has the following rules: 2025-07-17T06:33:19.6385480Z 2025-07-17T06:33:19.6385787Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:19.6386594Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:19.6387313Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:19.6387690Z 2025-07-17T06:33:19.6387856Z Example config: 2025-07-17T06:33:19.6388286Z # A list of experiments that can be opted into. 2025-07-17T06:33:19.6388920Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:19.6389508Z # Expected syntax is: 2025-07-17T06:33:19.6390118Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:19.6391037Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:19.6391617Z 2025-07-17T06:33:19.6391782Z experiments: 2025-07-17T06:33:19.6392160Z lf: 2025-07-17T06:33:19.6392516Z rollout_percent: 25 2025-07-17T06:33:19.6393111Z all_branches: false 2025-07-17T06:33:19.6393541Z default: true 2025-07-17T06:33:19.6393935Z --- 2025-07-17T06:33:19.6394123Z 2025-07-17T06:33:19.6394277Z # Opt-ins: 2025-07-17T06:33:19.6395078Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:19.6395907Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:19.6396647Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:19.6397311Z # Experiments should be from the above list. 2025-07-17T06:33:19.6397671Z 2025-07-17T06:33:19.6397844Z @User1,-lf,split_build 2025-07-17T06:33:19.6398261Z @User2,lf 2025-07-17T06:33:19.6398615Z @User3,split_build 2025-07-17T06:33:19.6399002Z """ 2025-07-17T06:33:19.6399181Z 2025-07-17T06:33:19.6399338Z import json 2025-07-17T06:33:19.6399688Z import logging 2025-07-17T06:33:19.6400050Z import os 2025-07-17T06:33:19.6400398Z import random 2025-07-17T06:33:19.6400758Z import re 2025-07-17T06:33:19.6401094Z import sys 2025-07-17T06:33:19.6401469Z from argparse import ArgumentParser 2025-07-17T06:33:19.6401973Z from collections.abc import Iterable 2025-07-17T06:33:19.6402461Z from functools import cache 2025-07-17T06:33:19.6402900Z from logging import LogRecord 2025-07-17T06:33:19.6403363Z from typing import Any, NamedTuple 2025-07-17T06:33:19.6403868Z from urllib.request import Request, urlopen 2025-07-17T06:33:19.6404224Z 2025-07-17T06:33:19.6404376Z import yaml 2025-07-17T06:33:19.6404971Z from github import Auth, Github 2025-07-17T06:33:19.6405453Z from github.Issue import Issue 2025-07-17T06:33:19.6405744Z 2025-07-17T06:33:19.6405750Z 2025-07-17T06:33:19.6405964Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:19.6406614Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:19.6407428Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:19.6407957Z 2025-07-17T06:33:19.6408180Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:19.6408866Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:19.6409363Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:19.6409894Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:19.6410271Z 2025-07-17T06:33:19.6410465Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:19.6410784Z 2025-07-17T06:33:19.6410959Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:19.6411393Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:19.6411658Z 2025-07-17T06:33:19.6411665Z 2025-07-17T06:33:19.6411841Z class Experiment(NamedTuple): 2025-07-17T06:33:19.6412289Z rollout_perc: float = ( 2025-07-17T06:33:19.6412882Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:19.6413529Z ) 2025-07-17T06:33:19.6413877Z all_branches: bool = ( 2025-07-17T06:33:19.6414466Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:19.6415381Z ) 2025-07-17T06:33:19.6415722Z default: bool = ( 2025-07-17T06:33:19.6416274Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:19.6416890Z ) 2025-07-17T06:33:19.6417074Z 2025-07-17T06:33:19.6417243Z # Add more fields as needed 2025-07-17T06:33:19.6417526Z 2025-07-17T06:33:19.6417532Z 2025-07-17T06:33:19.6417711Z class Settings(NamedTuple): 2025-07-17T06:33:19.6418123Z """ 2025-07-17T06:33:19.6418565Z Settings for the experiments that can be opted into. 2025-07-17T06:33:19.6419104Z """ 2025-07-17T06:33:19.6419287Z 2025-07-17T06:33:19.6419492Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:19.6419829Z 2025-07-17T06:33:19.6419836Z 2025-07-17T06:33:19.6420035Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:19.6420631Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:19.6421036Z 2025-07-17T06:33:19.6421198Z COLORS = { 2025-07-17T06:33:19.6421572Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:19.6422197Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:19.6422664Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:19.6423137Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:19.6423591Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:19.6424038Z } 2025-07-17T06:33:19.6424217Z 2025-07-17T06:33:19.6424417Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:19.6425344Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:19.6426080Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:19.6426619Z return super().format(record) 2025-07-17T06:33:19.6426929Z 2025-07-17T06:33:19.6426937Z 2025-07-17T06:33:19.6427126Z handler = logging.StreamHandler() 2025-07-17T06:33:19.6427777Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:19.6428303Z 2025-07-17T06:33:19.6428539Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:19.6429090Z log.addHandler(handler) 2025-07-17T06:33:19.6429514Z log.setLevel(logging.INFO) 2025-07-17T06:33:19.6429774Z 2025-07-17T06:33:19.6429781Z 2025-07-17T06:33:19.6430021Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:19.6430546Z """ 2025-07-17T06:33:19.6431009Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:19.6431591Z """ 2025-07-17T06:33:19.6431928Z if not GITHUB_OUTPUT: 2025-07-17T06:33:19.6432920Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:19.6433963Z log.warning( 2025-07-17T06:33:19.6434930Z "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:19.6435796Z ) 2025-07-17T06:33:19.6445516Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:19.6446098Z return 2025-07-17T06:33:19.6446336Z 2025-07-17T06:33:19.6446694Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:19.6447268Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:19.6447820Z f.write(f"{key}={value}\n") 2025-07-17T06:33:19.6448125Z 2025-07-17T06:33:19.6448132Z 2025-07-17T06:33:19.6448432Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:19.6449029Z return frozenset( 2025-07-17T06:33:19.6449609Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:19.6450254Z ) 2025-07-17T06:33:19.6450440Z 2025-07-17T06:33:19.6450447Z 2025-07-17T06:33:19.6450620Z def parse_args() -> Any: 2025-07-17T06:33:19.6451143Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:19.6451968Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:19.6452708Z parser.add_argument( 2025-07-17T06:33:19.6453137Z "--github-issue-repo", 2025-07-17T06:33:19.6453580Z type=str, 2025-07-17T06:33:19.6453971Z required=False, 2025-07-17T06:33:19.6454478Z default="pytorch/test-infra", 2025-07-17T06:33:19.6455234Z help="GitHub repo to get the issue", 2025-07-17T06:33:19.6455719Z ) 2025-07-17T06:33:19.6456063Z parser.add_argument( 2025-07-17T06:33:19.6456487Z "--github-repo", 2025-07-17T06:33:19.6456879Z type=str, 2025-07-17T06:33:19.6457249Z required=True, 2025-07-17T06:33:19.6457675Z help="GitHub repo where CI is running", 2025-07-17T06:33:19.6458171Z ) 2025-07-17T06:33:19.6458514Z parser.add_argument( 2025-07-17T06:33:19.6459079Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:19.6459712Z ) 2025-07-17T06:33:19.6460055Z parser.add_argument( 2025-07-17T06:33:19.6460652Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:19.6461288Z ) 2025-07-17T06:33:19.6461784Z parser.add_argument( 2025-07-17T06:33:19.6462380Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:19.6463037Z ) 2025-07-17T06:33:19.6463600Z parser.add_argument( 2025-07-17T06:33:19.6464224Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:19.6465065Z ) 2025-07-17T06:33:19.6465409Z parser.add_argument( 2025-07-17T06:33:19.6465832Z "--github-ref-type", 2025-07-17T06:33:19.6466254Z type=str, 2025-07-17T06:33:19.6466626Z required=True, 2025-07-17T06:33:19.6467074Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:19.6467591Z ) 2025-07-17T06:33:19.6467919Z parser.add_argument( 2025-07-17T06:33:19.6468345Z "--eligible-experiments", 2025-07-17T06:33:19.6468823Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.6469310Z required=False, 2025-07-17T06:33:19.6469704Z default="", 2025-07-17T06:33:19.6470509Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:19.6471385Z ) 2025-07-17T06:33:19.6471723Z parser.add_argument( 2025-07-17T06:33:19.6472146Z "--opt-out-experiments", 2025-07-17T06:33:19.6472616Z type=_str_comma_separated_to_set, 2025-07-17T06:33:19.6473106Z required=False, 2025-07-17T06:33:19.6473493Z default="", 2025-07-17T06:33:19.6473858Z help=( 2025-07-17T06:33:19.6474480Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:19.6475723Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:19.6476510Z ), 2025-07-17T06:33:19.6476845Z ) 2025-07-17T06:33:19.6477189Z parser.add_argument( 2025-07-17T06:33:19.6477608Z "--pr-number", 2025-07-17T06:33:19.6477997Z type=str, 2025-07-17T06:33:19.6478368Z required=False, 2025-07-17T06:33:19.6478769Z default="", 2025-07-17T06:33:19.6479344Z help="the optional PR number where this is run", 2025-07-17T06:33:19.6479876Z ) 2025-07-17T06:33:19.6480056Z 2025-07-17T06:33:19.6480280Z return parser.parse_args() 2025-07-17T06:33:19.6480569Z 2025-07-17T06:33:19.6480576Z 2025-07-17T06:33:19.6480949Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.6481665Z auth = Auth.Token(github_token) 2025-07-17T06:33:19.6482129Z return Github(auth=auth) 2025-07-17T06:33:19.6482409Z 2025-07-17T06:33:19.6482415Z 2025-07-17T06:33:19.6482834Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:19.6483587Z repo = gh.get_repo(repo) 2025-07-17T06:33:19.6484049Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:19.6484390Z 2025-07-17T06:33:19.6484396Z 2025-07-17T06:33:19.6484733Z def get_potential_pr_author( 2025-07-17T06:33:19.6531784Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:19.6532640Z ) -> str: 2025-07-17T06:33:19.6533157Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:19.6533920Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:19.6534730Z # embedded in the tag name: ciflow// 2025-07-17T06:33:19.6535283Z 2025-07-17T06:33:19.6535474Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.6535794Z 2025-07-17T06:33:19.6536058Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:19.6536642Z split_tag = ref_name.split("/") 2025-07-17T06:33:19.6537129Z if ( 2025-07-17T06:33:19.6537489Z len(split_tag) == 3 2025-07-17T06:33:19.6537942Z and split_tag[0] == "ciflow" 2025-07-17T06:33:19.6538449Z and split_tag[2].isnumeric() 2025-07-17T06:33:19.6538913Z ): 2025-07-17T06:33:19.6539476Z pr_number = split_tag[2] 2025-07-17T06:33:19.6539937Z try: 2025-07-17T06:33:19.6540345Z repository = gh.get_repo(repo) 2025-07-17T06:33:19.6540915Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:19.6541482Z except Exception as e: 2025-07-17T06:33:19.6541961Z raise Exception( # noqa: TRY002 2025-07-17T06:33:19.6542590Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:19.6543177Z ) from e 2025-07-17T06:33:19.6543688Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:19.6544359Z # In all other cases, return the original input username 2025-07-17T06:33:19.6545049Z return username 2025-07-17T06:33:19.6545267Z 2025-07-17T06:33:19.6545274Z 2025-07-17T06:33:19.6545490Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:19.6545986Z """ 2025-07-17T06:33:19.6546591Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:19.6547313Z """ 2025-07-17T06:33:19.6547832Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:19.6548322Z 2025-07-17T06:33:19.6548329Z 2025-07-17T06:33:19.6548518Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:19.6548975Z try: 2025-07-17T06:33:19.6549337Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:19.6549803Z return data 2025-07-17T06:33:19.6550191Z except yaml.YAMLError: 2025-07-17T06:33:19.6550634Z log.exception("Error loading YAML") 2025-07-17T06:33:19.6551114Z raise 2025-07-17T06:33:19.6551313Z 2025-07-17T06:33:19.6551319Z 2025-07-17T06:33:19.6551708Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:19.6552395Z """ 2025-07-17T06:33:19.6552979Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:19.6553540Z 2025-07-17T06:33:19.6553988Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.6554806Z and the text below is the list of opted in users. 2025-07-17T06:33:19.6555185Z 2025-07-17T06:33:19.6555539Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:19.6556189Z """ 2025-07-17T06:33:19.6556596Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:19.6557160Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:19.6557725Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:19.6558263Z else: 2025-07-17T06:33:19.6558615Z return "", rollout_state 2025-07-17T06:33:19.6558899Z 2025-07-17T06:33:19.6558906Z 2025-07-17T06:33:19.6559092Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:19.6559562Z """ 2025-07-17T06:33:19.6560042Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:19.6560638Z """ 2025-07-17T06:33:19.6560823Z 2025-07-17T06:33:19.6560829Z 2025-07-17T06:33:19.6561164Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:19.6561764Z """ 2025-07-17T06:33:19.6562425Z 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:19.6563058Z 2025-07-17T06:33:19.6563646Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:19.6564662Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:19.6565303Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:19.6565753Z 2025-07-17T06:33:19.6565759Z 2025-07-17T06:33:19.6565907Z """ 2025-07-17T06:33:19.6566250Z optins = UserOptins() 2025-07-17T06:33:19.6566695Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:19.6567204Z user = user.strip("\r\n\t -") 2025-07-17T06:33:19.6567830Z if not user or not user.startswith("@"): 2025-07-17T06:33:19.6568353Z # Not a valid user. Skip 2025-07-17T06:33:19.6568793Z continue 2025-07-17T06:33:19.6569027Z 2025-07-17T06:33:19.6569177Z if user: 2025-07-17T06:33:19.6569580Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:19.6570228Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:19.6570681Z 2025-07-17T06:33:19.6570845Z return optins 2025-07-17T06:33:19.6571060Z 2025-07-17T06:33:19.6571067Z 2025-07-17T06:33:19.6571336Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:19.6571897Z """ 2025-07-17T06:33:19.6572251Z Check if the experiment name is valid. 2025-07-17T06:33:19.6572740Z A valid name: 2025-07-17T06:33:19.6573331Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:19.6574198Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:19.6575075Z - Cannot contain spaces 2025-07-17T06:33:19.6575518Z """ 2025-07-17T06:33:19.6575706Z 2025-07-17T06:33:19.6575955Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:19.6576601Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:19.6577019Z 2025-07-17T06:33:19.6577164Z if valid: 2025-07-17T06:33:19.6577511Z return True 2025-07-17T06:33:19.6577744Z 2025-07-17T06:33:19.6577893Z log.error( 2025-07-17T06:33:19.6579239Z 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:19.6580696Z ) 2025-07-17T06:33:19.6581027Z return False 2025-07-17T06:33:19.6581239Z 2025-07-17T06:33:19.6581245Z 2025-07-17T06:33:19.6581537Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:19.6582111Z """ 2025-07-17T06:33:19.6582789Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:19.6583461Z """ 2025-07-17T06:33:19.6583787Z try: 2025-07-17T06:33:19.6584123Z if settings_text: 2025-07-17T06:33:19.6584904Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:19.6585640Z # for easy reading 2025-07-17T06:33:19.6586363Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:19.6587187Z # the backtick character in shell commands. 2025-07-17T06:33:19.6587746Z backtick = chr(96) # backtick character 2025-07-17T06:33:19.6588365Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:19.6588978Z settings = load_yaml(settings_text) 2025-07-17T06:33:19.6589320Z 2025-07-17T06:33:19.6589705Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:19.6590412Z experiments = {} 2025-07-17T06:33:19.6590688Z 2025-07-17T06:33:19.6591050Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:19.6591762Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:19.6592782Z # 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:19.6593742Z continue 2025-07-17T06:33:19.6594006Z 2025-07-17T06:33:19.6594175Z valid_settings = {} 2025-07-17T06:33:19.6594739Z for setting in exp_settings: 2025-07-17T06:33:19.6595271Z if setting not in Experiment._fields: 2025-07-17T06:33:19.6595773Z log.warning( 2025-07-17T06:33:19.6596428Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:19.6597212Z ) 2025-07-17T06:33:19.6597612Z else: 2025-07-17T06:33:19.6598086Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:19.6598478Z 2025-07-17T06:33:19.6598731Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:19.6599315Z return Settings(experiments) 2025-07-17T06:33:19.6599633Z 2025-07-17T06:33:19.6599794Z except Exception: 2025-07-17T06:33:19.6600234Z log.exception("Failed to parse settings") 2025-07-17T06:33:19.6600587Z 2025-07-17T06:33:19.6600747Z return Settings() 2025-07-17T06:33:19.6600984Z 2025-07-17T06:33:19.6600991Z 2025-07-17T06:33:19.6601221Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:19.6601738Z """ 2025-07-17T06:33:19.6602138Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:19.6602503Z 2025-07-17T06:33:19.6602837Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:19.6603531Z and the text below is the list of opted in users. 2025-07-17T06:33:19.6603902Z 2025-07-17T06:33:19.6604286Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:19.6605061Z """ 2025-07-17T06:33:19.6605573Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.6606263Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:19.6606630Z 2025-07-17T06:33:19.6606636Z 2025-07-17T06:33:19.6606868Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:19.6607378Z """ 2025-07-17T06:33:19.6607731Z Parse users from the rollout state. 2025-07-17T06:33:19.6608053Z 2025-07-17T06:33:19.6608201Z """ 2025-07-17T06:33:19.6608695Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:19.6609374Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:19.6609744Z 2025-07-17T06:33:19.6609750Z 2025-07-17T06:33:19.6610253Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.6610935Z """ 2025-07-17T06:33:19.6611310Z Check if a user is opted into an experiment 2025-07-17T06:33:19.6611800Z """ 2025-07-17T06:33:19.6612222Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:19.6612607Z 2025-07-17T06:33:19.6612613Z 2025-07-17T06:33:19.6612996Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:19.6613682Z """ 2025-07-17T06:33:19.6614115Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:19.6614761Z """ 2025-07-17T06:33:19.6615353Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:19.6615980Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:19.6616576Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:19.6617131Z return False 2025-07-17T06:33:19.6617370Z 2025-07-17T06:33:19.6617626Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:19.6618167Z log.warning( 2025-07-17T06:33:19.6618900Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:19.6619724Z ) 2025-07-17T06:33:19.6619909Z 2025-07-17T06:33:19.6620059Z return True 2025-07-17T06:33:19.6620269Z 2025-07-17T06:33:19.6620280Z 2025-07-17T06:33:19.6620441Z def get_runner_prefix( 2025-07-17T06:33:19.6620834Z rollout_state: str, 2025-07-17T06:33:19.6621267Z workflow_requestors: Iterable[str], 2025-07-17T06:33:19.6621739Z branch: str, 2025-07-17T06:33:19.6622193Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.6622804Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:19.6623344Z is_canary: bool = False, 2025-07-17T06:33:19.6623757Z ) -> str: 2025-07-17T06:33:19.6624273Z settings = parse_settings(rollout_state) 2025-07-17T06:33:19.6625309Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:19.6625651Z 2025-07-17T06:33:19.6625812Z fleet_prefix = "" 2025-07-17T06:33:19.6626197Z prefixes = [] 2025-07-17T06:33:19.6626774Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:19.6627637Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:19.6628286Z log.info( 2025-07-17T06:33:19.6628908Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:19.6629606Z ) 2025-07-17T06:33:19.6629950Z continue 2025-07-17T06:33:19.6630178Z 2025-07-17T06:33:19.6630349Z if opt_out_experiments: 2025-07-17T06:33:19.6630830Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:19.6631417Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:19.6631950Z log.info( 2025-07-17T06:33:19.6632810Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:19.6633702Z ) 2025-07-17T06:33:19.6634055Z continue 2025-07-17T06:33:19.6634297Z 2025-07-17T06:33:19.6634478Z if eligible_experiments: 2025-07-17T06:33:19.6635089Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:19.6635672Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:19.6636175Z log.info( 2025-07-17T06:33:19.6636890Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:19.6637654Z ) 2025-07-17T06:33:19.6638011Z continue 2025-07-17T06:33:19.6638452Z elif not experiment_settings.default: 2025-07-17T06:33:19.6638938Z log.info( 2025-07-17T06:33:19.6639664Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:19.6640342Z ) 2025-07-17T06:33:19.6640689Z continue 2025-07-17T06:33:19.6640919Z 2025-07-17T06:33:19.6641182Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:19.6641750Z opted_out_users = [ 2025-07-17T06:33:19.6642158Z requestor 2025-07-17T06:33:19.6642569Z for requestor in workflow_requestors 2025-07-17T06:33:19.6643191Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.6643757Z ] 2025-07-17T06:33:19.6643953Z 2025-07-17T06:33:19.6644118Z if opted_out_users: 2025-07-17T06:33:19.6644529Z log.info( 2025-07-17T06:33:19.6645196Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:19.6645828Z ) 2025-07-17T06:33:19.6646180Z continue 2025-07-17T06:33:19.6646407Z 2025-07-17T06:33:19.6646659Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:19.6647214Z opted_in_users = [ 2025-07-17T06:33:19.6647619Z requestor 2025-07-17T06:33:19.6648033Z for requestor in workflow_requestors 2025-07-17T06:33:19.6648650Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:19.6649206Z ] 2025-07-17T06:33:19.6649390Z 2025-07-17T06:33:19.6649543Z enabled = False 2025-07-17T06:33:19.6649933Z if opted_in_users: 2025-07-17T06:33:19.6650330Z log.info( 2025-07-17T06:33:19.6650878Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:19.6651493Z ) 2025-07-17T06:33:19.6651845Z enabled = True 2025-07-17T06:33:19.6652105Z 2025-07-17T06:33:19.6652308Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:19.6653070Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:19.6654084Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:19.6654829Z log.info( 2025-07-17T06:33:19.6655734Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:19.6656572Z ) 2025-07-17T06:33:19.6656939Z enabled = True 2025-07-17T06:33:19.6657213Z 2025-07-17T06:33:19.6657363Z if enabled: 2025-07-17T06:33:19.6657748Z label = experiment_name 2025-07-17T06:33:19.6658251Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:19.6659015Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:19.6659823Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:19.6660529Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:19.6661144Z if is_canary: 2025-07-17T06:33:19.6661590Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:19.6662093Z fleet_prefix = label 2025-07-17T06:33:19.6662535Z else: 2025-07-17T06:33:19.6662923Z prefixes.append(label) 2025-07-17T06:33:19.6663235Z 2025-07-17T06:33:19.6663408Z if len(prefixes) > 1: 2025-07-17T06:33:19.6663805Z log.error( 2025-07-17T06:33:19.6664858Z 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:19.6665870Z ) 2025-07-17T06:33:19.6666222Z prefixes = prefixes[:1] 2025-07-17T06:33:19.6666498Z 2025-07-17T06:33:19.6666671Z # Fleet always comes first 2025-07-17T06:33:19.6667105Z if fleet_prefix: 2025-07-17T06:33:19.6667505Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:19.6667836Z 2025-07-17T06:33:19.6668200Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:19.6668586Z 2025-07-17T06:33:19.6668592Z 2025-07-17T06:33:19.6669013Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:19.6669715Z """ 2025-07-17T06:33:19.6670250Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:19.6670765Z 2025-07-17T06:33:19.6671125Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:19.6671769Z """ 2025-07-17T06:33:19.6672133Z gh = get_gh_client(github_token) 2025-07-17T06:33:19.6672618Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:19.6673197Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:19.6673599Z 2025-07-17T06:33:19.6673606Z 2025-07-17T06:33:19.6673978Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:19.6674776Z for _ in range(num_retries): 2025-07-17T06:33:19.6675216Z try: 2025-07-17T06:33:19.6675605Z req = Request(url=url, headers=headers) 2025-07-17T06:33:19.6676224Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:19.6676806Z return json.loads(content) 2025-07-17T06:33:19.6677283Z except Exception as e: 2025-07-17T06:33:19.6677779Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:19.6678155Z 2025-07-17T06:33:19.6678502Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:19.6679141Z return {} 2025-07-17T06:33:19.6679344Z 2025-07-17T06:33:19.6679350Z 2025-07-17T06:33:19.6679494Z @cache 2025-07-17T06:33:19.6680065Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:19.6680773Z """ 2025-07-17T06:33:19.6681137Z Dynamically get PR information 2025-07-17T06:33:19.6681704Z """ 2025-07-17T06:33:19.6682168Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:19.6682730Z headers = { 2025-07-17T06:33:19.6683142Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:19.6683690Z "Authorization": f"token {github_token}", 2025-07-17T06:33:19.6684175Z } 2025-07-17T06:33:19.6684653Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:19.6685212Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:19.6685709Z headers=headers, 2025-07-17T06:33:19.6686095Z ) 2025-07-17T06:33:19.6686273Z 2025-07-17T06:33:19.6686444Z if not json_response: 2025-07-17T06:33:19.6686957Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:19.6687518Z return {} 2025-07-17T06:33:19.6687726Z 2025-07-17T06:33:19.6687890Z return json_response 2025-07-17T06:33:19.6688144Z 2025-07-17T06:33:19.6688151Z 2025-07-17T06:33:19.6688528Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:19.6689202Z """ 2025-07-17T06:33:19.6689680Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:19.6690270Z """ 2025-07-17T06:33:19.6690704Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:19.6691261Z return { 2025-07-17T06:33:19.6691787Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:19.6692430Z } 2025-07-17T06:33:19.6692609Z 2025-07-17T06:33:19.6692615Z 2025-07-17T06:33:19.6692779Z def main() -> None: 2025-07-17T06:33:19.6693157Z args = parse_args() 2025-07-17T06:33:19.6693394Z 2025-07-17T06:33:19.6693601Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:19.6693953Z 2025-07-17T06:33:19.6694127Z # Check if the PR is opt-out 2025-07-17T06:33:19.6694689Z if args.pr_number: 2025-07-17T06:33:19.6695407Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:19.6696234Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:19.6696691Z log.info( 2025-07-17T06:33:19.6697318Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:19.6698015Z ) 2025-07-17T06:33:19.6698512Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.6699123Z sys.exit() 2025-07-17T06:33:19.6699356Z 2025-07-17T06:33:19.6699506Z try: 2025-07-17T06:33:19.6699901Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:19.6700545Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:19.6701130Z ) 2025-07-17T06:33:19.6701312Z 2025-07-17T06:33:19.6701503Z username = get_potential_pr_author( 2025-07-17T06:33:19.6701991Z args.github_token, 2025-07-17T06:33:19.6702432Z args.github_repo, 2025-07-17T06:33:19.6702860Z args.github_actor, 2025-07-17T06:33:19.6703304Z args.github_ref_type, 2025-07-17T06:33:19.6703751Z args.github_branch, 2025-07-17T06:33:19.6704159Z ) 2025-07-17T06:33:19.6704338Z 2025-07-17T06:33:19.6704720Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:19.6705140Z 2025-07-17T06:33:19.6705340Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:19.6705847Z rollout_state, 2025-07-17T06:33:19.6706285Z (args.github_issue_owner, username), 2025-07-17T06:33:19.6706794Z args.github_branch, 2025-07-17T06:33:19.6707240Z args.eligible_experiments, 2025-07-17T06:33:19.6707733Z args.opt_out_experiments, 2025-07-17T06:33:19.6708188Z is_canary, 2025-07-17T06:33:19.6708561Z ) 2025-07-17T06:33:19.6708744Z 2025-07-17T06:33:19.6708909Z except Exception as e: 2025-07-17T06:33:19.6709317Z log.error( 2025-07-17T06:33:19.6709924Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:19.6710737Z ) 2025-07-17T06:33:19.6710918Z 2025-07-17T06:33:19.6711226Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:19.6711673Z 2025-07-17T06:33:19.6711679Z 2025-07-17T06:33:19.6711839Z if __name__ == "__main__": 2025-07-17T06:33:19.6712239Z main() 2025-07-17T06:33:19.6712424Z 2025-07-17T06:33:19.6798865Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.6799707Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:19.6827067Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:19.6827505Z env: 2025-07-17T06:33:19.6828056Z GITHUB_TOKEN: *** 2025-07-17T06:33:19.6828440Z ISSUE_NUMBER: 5132 2025-07-17T06:33:19.6828850Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:19.6829314Z ISSUE_OWNER: 2025-07-17T06:33:19.6829671Z CHECK_EXPERIMENTS: 2025-07-17T06:33:19.6830069Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:19.6830462Z PR_NUMBER: 2025-07-17T06:33:19.6830807Z ##[endgroup] 2025-07-17T06:33:20.0414555Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:20.3490649Z Collecting urllib3==1.26.18 2025-07-17T06:33:20.6102634Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:20.6307115Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-07-17T06:33:20.6564954Z Collecting PyGithub==2.3.0 2025-07-17T06:33:20.6631371Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:20.7079269Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:20.7146638Z 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:20.7191006Z 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:20.7208704Z 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:20.7224209Z 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:20.7515476Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:20.7582261Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:20.7804835Z 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:20.8950952Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:20.9020094Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.0078765Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.0147551Z 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:21.0359234Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.0425807Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.0681766Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.0778751Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 17.0 MB/s eta 0:00:00 2025-07-17T06:33:21.0848022Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.1027491Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 21.3 MB/s eta 0:00:00 2025-07-17T06:33:21.1097172Z 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:21.1200214Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 95.5 MB/s eta 0:00:00 2025-07-17T06:33:21.1266923Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.1357321Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.1416661Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 110.8 MB/s eta 0:00:00 2025-07-17T06:33:21.1483566Z 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:21.1520962Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 36.7 MB/s eta 0:00:00 2025-07-17T06:33:21.1588189Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.1656407Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 20.7 MB/s eta 0:00:00 2025-07-17T06:33:21.4507545Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:21.9756463Z 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:22.0472371Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.0472768Z curr_branch="main" 2025-07-17T06:33:22.0473029Z curr_ref_type="branch" 2025-07-17T06:33:22.0473328Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.0473623Z  2025-07-17T06:33:22.0473872Z python3 runner_determinator.py \ 2025-07-17T06:33:22.0474203Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.0474530Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.0475094Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.0475398Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.0475723Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.0476037Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.0476369Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.0476720Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.0477244Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.0477582Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.0506170Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.0506442Z env: 2025-07-17T06:33:22.0507054Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.0507293Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.0507538Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.0507818Z ISSUE_OWNER: 2025-07-17T06:33:22.0508046Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.0508285Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.0508522Z PR_NUMBER: 2025-07-17T06:33:22.0508740Z ##[endgroup] 2025-07-17T06:33:22.0555989Z Current branch is 'main' 2025-07-17T06:33:23.3022745Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:23.3023921Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:23.3025098Z INFO : Setting output: label-type='' 2025-07-17T06:33:23.3331245Z Evaluate and set job outputs 2025-07-17T06:33:23.3338670Z Cleaning up orphan processes