2025-08-14T20:43:46.8790366Z Current runner version: '2.327.1' 2025-08-14T20:43:46.8816685Z ##[group]Runner Image Provisioner 2025-08-14T20:43:46.8817558Z Hosted Compute Agent 2025-08-14T20:43:46.8818091Z Version: 20250812.370 2025-08-14T20:43:46.8818681Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:46.8819414Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:46.8820386Z ##[endgroup] 2025-08-14T20:43:46.8820926Z ##[group]Operating System 2025-08-14T20:43:46.8821564Z Ubuntu 2025-08-14T20:43:46.8822009Z 24.04.2 2025-08-14T20:43:46.8822509Z LTS 2025-08-14T20:43:46.8823041Z ##[endgroup] 2025-08-14T20:43:46.8823511Z ##[group]Runner Image 2025-08-14T20:43:46.8824083Z Image: ubuntu-24.04 2025-08-14T20:43:46.8824585Z Version: 20250804.2.0 2025-08-14T20:43:46.8825591Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:46.8827126Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:46.8828064Z ##[endgroup] 2025-08-14T20:43:46.8829103Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:46.8831428Z Contents: read 2025-08-14T20:43:46.8831988Z Metadata: read 2025-08-14T20:43:46.8832855Z ##[endgroup] 2025-08-14T20:43:46.8835256Z Secret source: Actions 2025-08-14T20:43:46.8836167Z Prepare workflow directory 2025-08-14T20:43:46.9334898Z Prepare all required actions 2025-08-14T20:43:46.9393249Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:46.9398404Z ##[group] Inputs 2025-08-14T20:43:46.9398999Z check_experiments: 2025-08-14T20:43:46.9399848Z opt_out_experiments: lf 2025-08-14T20:43:46.9400435Z triggering_actor: pytorchmergebot 2025-08-14T20:43:46.9401036Z issue_owner: 2025-08-14T20:43:46.9401492Z curr_branch: main 2025-08-14T20:43:46.9402134Z curr_ref_type: branch 2025-08-14T20:43:46.9402758Z issue_number: 5132 2025-08-14T20:43:46.9403278Z ##[endgroup] 2025-08-14T20:43:46.9404047Z Complete job name: unit-test / get-label-type / runner-determinator 2025-08-14T20:43:47.4636213Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.4638698Z cat < runner_determinator.py 2025-08-14T20:43:47.4639454Z # flake8: noqa: G004 2025-08-14T20:43:47.4640271Z  2025-08-14T20:43:47.4641098Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.4642274Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.4643265Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.4644013Z  2025-08-14T20:43:47.4644436Z """ 2025-08-14T20:43:47.4645265Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.4646322Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.4647570Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.4648567Z of which runners should be used to run which job. 2025-08-14T20:43:47.4649271Z  2025-08-14T20:43:47.4650199Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.4651266Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.4652317Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.4653240Z list, defined. 2025-08-14T20:43:47.4653742Z  2025-08-14T20:43:47.4654446Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.4655529Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.4656567Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.4657318Z  2025-08-14T20:43:47.4658483Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.4659876Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.4660811Z experiments which the user could be opted in to. 2025-08-14T20:43:47.4661556Z  2025-08-14T20:43:47.4662067Z The user list has the following rules: 2025-08-14T20:43:47.4662712Z  2025-08-14T20:43:47.4663466Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.4664499Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.4665433Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.4666070Z  2025-08-14T20:43:47.4666617Z Example config: 2025-08-14T20:43:47.4667223Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.4668089Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.4668950Z  # Expected syntax is: 2025-08-14T20:43:47.4669867Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.4670978Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.4748418Z  2025-08-14T20:43:47.4748872Z  experiments: 2025-08-14T20:43:47.4749381Z  lf: 2025-08-14T20:43:47.4750105Z  rollout_percent: 25 2025-08-14T20:43:47.4750655Z  all_branches: false 2025-08-14T20:43:47.4751167Z  default: true 2025-08-14T20:43:47.4751634Z  --- 2025-08-14T20:43:47.4752035Z  2025-08-14T20:43:47.4752435Z  # Opt-ins: 2025-08-14T20:43:47.4753144Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.4754449Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.4755348Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.4756090Z  # Experiments should be from the above list. 2025-08-14T20:43:47.4756671Z  2025-08-14T20:43:47.4757081Z  @User1,-lf,split_build 2025-08-14T20:43:47.4757594Z  @User2,lf 2025-08-14T20:43:47.4758054Z  @User3,split_build 2025-08-14T20:43:47.4758534Z """ 2025-08-14T20:43:47.4758918Z  2025-08-14T20:43:47.4759296Z import json 2025-08-14T20:43:47.4759909Z import logging 2025-08-14T20:43:47.4760352Z import os 2025-08-14T20:43:47.4760777Z import random 2025-08-14T20:43:47.4761217Z import re 2025-08-14T20:43:47.4761632Z import sys 2025-08-14T20:43:47.4762122Z from argparse import ArgumentParser 2025-08-14T20:43:47.4762801Z from collections.abc import Iterable 2025-08-14T20:43:47.4763401Z from functools import cache 2025-08-14T20:43:47.4763949Z from logging import LogRecord 2025-08-14T20:43:47.4764518Z from typing import Any, NamedTuple 2025-08-14T20:43:47.4765153Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.4765755Z  2025-08-14T20:43:47.4766144Z import yaml 2025-08-14T20:43:47.4766619Z from github import Auth, Github 2025-08-14T20:43:47.4767198Z from github.Issue import Issue 2025-08-14T20:43:47.4767727Z  2025-08-14T20:43:47.4768097Z  2025-08-14T20:43:47.4768564Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.4769343Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.4770636Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.4771395Z  2025-08-14T20:43:47.4772070Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.4772708Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.4773316Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.4773976Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.4774545Z  2025-08-14T20:43:47.4774987Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.4775530Z  2025-08-14T20:43:47.4775941Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.4776469Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.4776968Z  2025-08-14T20:43:47.4777335Z  2025-08-14T20:43:47.4777755Z class Experiment(NamedTuple): 2025-08-14T20:43:47.4778313Z  rollout_perc: float = ( 2025-08-14T20:43:47.4779062Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.4779929Z  ) 2025-08-14T20:43:47.4780356Z  all_branches: bool = ( 2025-08-14T20:43:47.4781113Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.4781857Z  ) 2025-08-14T20:43:47.4782277Z  default: bool = ( 2025-08-14T20:43:47.4783046Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.4783743Z  ) 2025-08-14T20:43:47.4784134Z  2025-08-14T20:43:47.4784539Z  # Add more fields as needed 2025-08-14T20:43:47.4785343Z  2025-08-14T20:43:47.4785801Z  2025-08-14T20:43:47.4786215Z class Settings(NamedTuple): 2025-08-14T20:43:47.4786731Z  """ 2025-08-14T20:43:47.4787282Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.4787927Z  """ 2025-08-14T20:43:47.4788326Z  2025-08-14T20:43:47.4788769Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.4789350Z  2025-08-14T20:43:47.4790122Z  2025-08-14T20:43:47.4790598Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.4791324Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.4791961Z  2025-08-14T20:43:47.4792344Z  COLORS = { 2025-08-14T20:43:47.4792831Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.4793406Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.4793973Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.4794545Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.4795106Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.4795629Z  } 2025-08-14T20:43:47.4796024Z  2025-08-14T20:43:47.4796480Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.4797317Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.4798180Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.4798818Z  return super().format(record) 2025-08-14T20:43:47.4799368Z  2025-08-14T20:43:47.4799904Z  2025-08-14T20:43:47.4800335Z handler = logging.StreamHandler() 2025-08-14T20:43:47.4801141Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.4801919Z  2025-08-14T20:43:47.4802422Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.4803081Z log.addHandler(handler) 2025-08-14T20:43:47.4803606Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.4804115Z  2025-08-14T20:43:47.4804502Z  2025-08-14T20:43:47.4805001Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.4805627Z  """ 2025-08-14T20:43:47.4806207Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.4807050Z  """ 2025-08-14T20:43:47.4807470Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.4808634Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.4809956Z  log.warning( 2025-08-14T20:43:47.4810924Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.4811924Z  ) 2025-08-14T20:43:47.4812426Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.4813015Z  return 2025-08-14T20:43:47.4813455Z  2025-08-14T20:43:47.4813885Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.4814534Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.4815178Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.4815725Z  2025-08-14T20:43:47.4816118Z  2025-08-14T20:43:47.4816716Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.4817443Z  return frozenset( 2025-08-14T20:43:47.4818145Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.4818884Z  ) 2025-08-14T20:43:47.4819285Z  2025-08-14T20:43:47.4819760Z  2025-08-14T20:43:47.4820159Z def parse_args() -> Any: 2025-08-14T20:43:47.4820841Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.4821807Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.4822644Z  parser.add_argument( 2025-08-14T20:43:47.4823189Z  "--github-issue-repo", 2025-08-14T20:43:47.4823730Z  type=str, 2025-08-14T20:43:47.4824226Z  required=False, 2025-08-14T20:43:47.4824896Z  default="pytorch/test-infra", 2025-08-14T20:43:47.4825534Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.4826112Z  ) 2025-08-14T20:43:47.4826540Z  parser.add_argument( 2025-08-14T20:43:47.4827068Z  "--github-repo", 2025-08-14T20:43:47.4827574Z  type=str, 2025-08-14T20:43:47.4828058Z  required=True, 2025-08-14T20:43:47.4828618Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.4829200Z  ) 2025-08-14T20:43:47.4829850Z  parser.add_argument( 2025-08-14T20:43:47.4830583Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.4831309Z  ) 2025-08-14T20:43:47.4831734Z  parser.add_argument( 2025-08-14T20:43:47.4832468Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.4833267Z  ) 2025-08-14T20:43:47.4833708Z  parser.add_argument( 2025-08-14T20:43:47.4834447Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.4835201Z  ) 2025-08-14T20:43:47.4835642Z  parser.add_argument( 2025-08-14T20:43:47.4836410Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.4837197Z  ) 2025-08-14T20:43:47.4837652Z  parser.add_argument( 2025-08-14T20:43:47.4838189Z  "--github-ref-type", 2025-08-14T20:43:47.4838719Z  type=str, 2025-08-14T20:43:47.4839211Z  required=True, 2025-08-14T20:43:47.4839980Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.4840596Z  ) 2025-08-14T20:43:47.4841030Z  parser.add_argument( 2025-08-14T20:43:47.4841730Z  "--eligible-experiments", 2025-08-14T20:43:47.4842336Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4842925Z  required=False, 2025-08-14T20:43:47.4843431Z  default="", 2025-08-14T20:43:47.4844397Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.4845398Z  ) 2025-08-14T20:43:47.4845829Z  parser.add_argument( 2025-08-14T20:43:47.4846375Z  "--opt-out-experiments", 2025-08-14T20:43:47.4846967Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.4847549Z  required=False, 2025-08-14T20:43:47.4848053Z  default="", 2025-08-14T20:43:47.4848534Z  help=( 2025-08-14T20:43:47.4849303Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.4850866Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.4851768Z  ), 2025-08-14T20:43:47.4852191Z  ) 2025-08-14T20:43:47.4852630Z  parser.add_argument( 2025-08-14T20:43:47.4853151Z  "--pr-number", 2025-08-14T20:43:47.4853654Z  type=str, 2025-08-14T20:43:47.4854146Z  required=False, 2025-08-14T20:43:47.4854652Z  default="", 2025-08-14T20:43:47.4855231Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.4855847Z  ) 2025-08-14T20:43:47.4856253Z  2025-08-14T20:43:47.4856673Z  return parser.parse_args() 2025-08-14T20:43:47.4857214Z  2025-08-14T20:43:47.4857591Z  2025-08-14T20:43:47.4858258Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.4859237Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.4859960Z  return Github(auth=auth) 2025-08-14T20:43:47.4860489Z  2025-08-14T20:43:47.4860872Z  2025-08-14T20:43:47.4861600Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.4862489Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.4863097Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.4863685Z  2025-08-14T20:43:47.4864068Z  2025-08-14T20:43:47.4864485Z def get_potential_pr_author( 2025-08-14T20:43:47.4865239Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.4865985Z ) -> str: 2025-08-14T20:43:47.4866590Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.4867502Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.4868356Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.4868988Z  2025-08-14T20:43:47.4869434Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.4870214Z  2025-08-14T20:43:47.4870753Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.4871457Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.4872029Z  if ( 2025-08-14T20:43:47.4872497Z  len(split_tag) == 3 2025-08-14T20:43:47.4873074Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.4873680Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.4874226Z  ): 2025-08-14T20:43:47.4874705Z  pr_number = split_tag[2] 2025-08-14T20:43:47.4875253Z  try: 2025-08-14T20:43:47.4875776Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.4876626Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.4877316Z  except Exception as e: 2025-08-14T20:43:47.4877918Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.4878665Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.4879383Z  ) from e 2025-08-14T20:43:47.4880188Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.4880979Z  # In all other cases, return the original input username 2025-08-14T20:43:47.4881640Z  return username 2025-08-14T20:43:47.4882115Z  2025-08-14T20:43:47.4882499Z  2025-08-14T20:43:47.4882971Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.4883571Z  """ 2025-08-14T20:43:47.4884304Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.4885163Z  """ 2025-08-14T20:43:47.4885782Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.4886513Z  2025-08-14T20:43:47.4886899Z  2025-08-14T20:43:47.4887333Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.4887903Z  try: 2025-08-14T20:43:47.4888366Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.4888947Z  return data 2025-08-14T20:43:47.4889453Z  except yaml.YAMLError: 2025-08-14T20:43:47.4890141Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.4890719Z  raise 2025-08-14T20:43:47.4891168Z  2025-08-14T20:43:47.4891553Z  2025-08-14T20:43:47.4892232Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.4893041Z  """ 2025-08-14T20:43:47.4893883Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.4894709Z  2025-08-14T20:43:47.4895303Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.4896166Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.4896789Z  2025-08-14T20:43:47.4897417Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.4898186Z  """ 2025-08-14T20:43:47.4898705Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.4899386Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.4900177Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.4901093Z  else: 2025-08-14T20:43:47.4901549Z  return "", rollout_state 2025-08-14T20:43:47.4902085Z  2025-08-14T20:43:47.4902468Z  2025-08-14T20:43:47.4902913Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.4903491Z  """ 2025-08-14T20:43:47.4904088Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.4904804Z  """ 2025-08-14T20:43:47.4905195Z  2025-08-14T20:43:47.4905566Z  2025-08-14T20:43:47.4906149Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.4906868Z  """ 2025-08-14T20:43:47.4907670Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.4908564Z  2025-08-14T20:43:47.4909439Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.4910763Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.4911687Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.4912381Z  2025-08-14T20:43:47.4912752Z  2025-08-14T20:43:47.4913126Z  """ 2025-08-14T20:43:47.4913548Z  optins = UserOptins() 2025-08-14T20:43:47.4914125Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.4914755Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.4915406Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.4916033Z  # Not a valid user. Skip 2025-08-14T20:43:47.4916582Z  continue 2025-08-14T20:43:47.4917124Z  2025-08-14T20:43:47.4917503Z  if user: 2025-08-14T20:43:47.4918031Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.4918790Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.4919640Z  2025-08-14T20:43:47.4920057Z  return optins 2025-08-14T20:43:47.4920517Z  2025-08-14T20:43:47.4920887Z  2025-08-14T20:43:47.4921441Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.4922114Z  """ 2025-08-14T20:43:47.4922583Z  Check if the experiment name is valid. 2025-08-14T20:43:47.4923170Z  A valid name: 2025-08-14T20:43:47.4923909Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.4924926Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.4925713Z  - Cannot contain spaces 2025-08-14T20:43:47.4926235Z  """ 2025-08-14T20:43:47.4926636Z  2025-08-14T20:43:47.4927142Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.4927941Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.4928733Z  2025-08-14T20:43:47.4929395Z  if valid: 2025-08-14T20:43:47.4930321Z  return True 2025-08-14T20:43:47.4930784Z  2025-08-14T20:43:47.4931181Z  log.error( 2025-08-14T20:43:47.4932759Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.4934429Z  ) 2025-08-14T20:43:47.4934839Z  return False 2025-08-14T20:43:47.4935294Z  2025-08-14T20:43:47.4935672Z  2025-08-14T20:43:47.4936241Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.4936937Z  """ 2025-08-14T20:43:47.4937600Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.4938395Z  """ 2025-08-14T20:43:47.4938807Z  try: 2025-08-14T20:43:47.4939242Z  if settings_text: 2025-08-14T20:43:47.4940489Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.4941363Z  # for easy reading 2025-08-14T20:43:47.4942262Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.4943232Z  # the backtick character in shell commands. 2025-08-14T20:43:47.4943916Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.4944671Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.4945412Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.4945979Z  2025-08-14T20:43:47.4946646Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.4947620Z  experiments = {} 2025-08-14T20:43:47.4948125Z  2025-08-14T20:43:47.4948745Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.4949692Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.4950884Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.4951997Z  continue 2025-08-14T20:43:47.4952504Z  2025-08-14T20:43:47.4952922Z  valid_settings = {} 2025-08-14T20:43:47.4953508Z  for setting in exp_settings: 2025-08-14T20:43:47.4954147Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.4954781Z  log.warning( 2025-08-14T20:43:47.4955578Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.4956343Z  ) 2025-08-14T20:43:47.4956838Z  else: 2025-08-14T20:43:47.4957439Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.4958062Z  2025-08-14T20:43:47.4958583Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.4959288Z  return Settings(experiments) 2025-08-14T20:43:47.4959935Z  2025-08-14T20:43:47.4960338Z  except Exception: 2025-08-14T20:43:47.4960908Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.4961497Z  2025-08-14T20:43:47.4961893Z  return Settings() 2025-08-14T20:43:47.4962374Z  2025-08-14T20:43:47.4962756Z  2025-08-14T20:43:47.4963391Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.4964033Z  """ 2025-08-14T20:43:47.4964543Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.4965152Z  2025-08-14T20:43:47.4965747Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.4966591Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.4967203Z  2025-08-14T20:43:47.4967849Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.4968644Z  """ 2025-08-14T20:43:47.4969268Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.4970223Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.4970817Z  2025-08-14T20:43:47.4971192Z  2025-08-14T20:43:47.4971704Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.4972331Z  """ 2025-08-14T20:43:47.4972786Z  Parse users from the rollout state. 2025-08-14T20:43:47.4973338Z  2025-08-14T20:43:47.4973718Z  """ 2025-08-14T20:43:47.4974323Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.4975146Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.4975741Z  2025-08-14T20:43:47.4976113Z  2025-08-14T20:43:47.4976791Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.4977599Z  """ 2025-08-14T20:43:47.4978089Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.4978673Z  """ 2025-08-14T20:43:47.4979210Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.4979927Z  2025-08-14T20:43:47.4980430Z  2025-08-14T20:43:47.4981116Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.4981931Z  """ 2025-08-14T20:43:47.4982462Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.4983093Z  """ 2025-08-14T20:43:47.4983679Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.4984445Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.4985165Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.4985818Z  return False 2025-08-14T20:43:47.4986288Z  2025-08-14T20:43:47.4986805Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.4987452Z  log.warning( 2025-08-14T20:43:47.4988366Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.4989300Z  ) 2025-08-14T20:43:47.4989812Z  2025-08-14T20:43:47.4990199Z  return True 2025-08-14T20:43:47.4990653Z  2025-08-14T20:43:47.4991028Z  2025-08-14T20:43:47.4991421Z def get_runner_prefix( 2025-08-14T20:43:47.4991935Z  rollout_state: str, 2025-08-14T20:43:47.4992477Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.4993063Z  branch: str, 2025-08-14T20:43:47.4993644Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.4994409Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.4995052Z  is_canary: bool = False, 2025-08-14T20:43:47.4995574Z ) -> str: 2025-08-14T20:43:47.4996078Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.4996731Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.4997309Z  2025-08-14T20:43:47.4997822Z  fleet_prefix = "" 2025-08-14T20:43:47.4998332Z  prefixes = [] 2025-08-14T20:43:47.4999053Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.5000180Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.5000963Z  log.info( 2025-08-14T20:43:47.5001729Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.5002540Z  ) 2025-08-14T20:43:47.5003002Z  continue 2025-08-14T20:43:47.5003465Z  2025-08-14T20:43:47.5003879Z  if opt_out_experiments: 2025-08-14T20:43:47.5004498Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.5005218Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.5005873Z  log.info( 2025-08-14T20:43:47.5006895Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.5007921Z  ) 2025-08-14T20:43:47.5008394Z  continue 2025-08-14T20:43:47.5008882Z  2025-08-14T20:43:47.5009297Z  if eligible_experiments: 2025-08-14T20:43:47.5010043Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.5010785Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.5011399Z  log.info( 2025-08-14T20:43:47.5012264Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.5013156Z  ) 2025-08-14T20:43:47.5013773Z  continue 2025-08-14T20:43:47.5014337Z  elif not experiment_settings.default: 2025-08-14T20:43:47.5014927Z  log.info( 2025-08-14T20:43:47.5015674Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.5016459Z  ) 2025-08-14T20:43:47.5016937Z  continue 2025-08-14T20:43:47.5017401Z  2025-08-14T20:43:47.5017922Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.5018590Z  opted_out_users = [ 2025-08-14T20:43:47.5019126Z  requestor 2025-08-14T20:43:47.5019768Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5020516Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5021195Z  ] 2025-08-14T20:43:47.5021614Z  2025-08-14T20:43:47.5022019Z  if opted_out_users: 2025-08-14T20:43:47.5022566Z  log.info( 2025-08-14T20:43:47.5023282Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.5024038Z  ) 2025-08-14T20:43:47.5024493Z  continue 2025-08-14T20:43:47.5024947Z  2025-08-14T20:43:47.5025472Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.5026138Z  opted_in_users = [ 2025-08-14T20:43:47.5026681Z  requestor 2025-08-14T20:43:47.5027237Z  for requestor in workflow_requestors 2025-08-14T20:43:47.5027981Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.5028659Z  ] 2025-08-14T20:43:47.5029069Z  2025-08-14T20:43:47.5029563Z  enabled = False 2025-08-14T20:43:47.5030087Z  if opted_in_users: 2025-08-14T20:43:47.5030734Z  log.info( 2025-08-14T20:43:47.5031446Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.5032177Z  ) 2025-08-14T20:43:47.5032639Z  enabled = True 2025-08-14T20:43:47.5033140Z  2025-08-14T20:43:47.5033599Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.5034499Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.5035531Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.5036244Z  log.info( 2025-08-14T20:43:47.5037207Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.5038192Z  ) 2025-08-14T20:43:47.5038682Z  enabled = True 2025-08-14T20:43:47.5039203Z  2025-08-14T20:43:47.5039689Z  if enabled: 2025-08-14T20:43:47.5040206Z  label = experiment_name 2025-08-14T20:43:47.5040830Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.5041726Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.5042671Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.5043502Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.5044229Z  if is_canary: 2025-08-14T20:43:47.5044803Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.5045404Z  fleet_prefix = label 2025-08-14T20:43:47.5045957Z  else: 2025-08-14T20:43:47.5046595Z  prefixes.append(label) 2025-08-14T20:43:47.5047150Z  2025-08-14T20:43:47.5047554Z  if len(prefixes) > 1: 2025-08-14T20:43:47.5048071Z  log.error( 2025-08-14T20:43:47.5049212Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.5050494Z  ) 2025-08-14T20:43:47.5050952Z  prefixes = prefixes[:1] 2025-08-14T20:43:47.5051481Z  2025-08-14T20:43:47.5051898Z  # Fleet always comes first 2025-08-14T20:43:47.5052445Z  if fleet_prefix: 2025-08-14T20:43:47.5052975Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.5053536Z  2025-08-14T20:43:47.5054043Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.5054665Z  2025-08-14T20:43:47.5055049Z  2025-08-14T20:43:47.5055764Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.5056596Z  """ 2025-08-14T20:43:47.5057257Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.5058017Z  2025-08-14T20:43:47.5058655Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.5059421Z  """ 2025-08-14T20:43:47.5059970Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.5060600Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.5061320Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.5061973Z  2025-08-14T20:43:47.5062338Z  2025-08-14T20:43:47.5062997Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.5063953Z  for _ in range(num_retries): 2025-08-14T20:43:47.5064494Z  try: 2025-08-14T20:43:47.5065002Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:47.5065732Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.5066448Z  return json.loads(content) 2025-08-14T20:43:47.5067035Z  except Exception as e: 2025-08-14T20:43:47.5067664Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.5068264Z  2025-08-14T20:43:47.5068896Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.5069854Z  return {} 2025-08-14T20:43:47.5070299Z  2025-08-14T20:43:47.5070676Z  2025-08-14T20:43:47.5071054Z @cache 2025-08-14T20:43:47.5071759Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.5072588Z  """ 2025-08-14T20:43:47.5073048Z  Dynamically get PR information 2025-08-14T20:43:47.5073597Z  """ 2025-08-14T20:43:47.5074159Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.5074841Z  headers = { 2025-08-14T20:43:47.5075377Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.5076059Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:47.5076637Z  } 2025-08-14T20:43:47.5077139Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.5077815Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.5078411Z  headers=headers, 2025-08-14T20:43:47.5078915Z  ) 2025-08-14T20:43:47.5079304Z  2025-08-14T20:43:47.5079812Z  if not json_response: 2025-08-14T20:43:47.5080469Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.5081302Z  return {} 2025-08-14T20:43:47.5081763Z  2025-08-14T20:43:47.5082165Z  return json_response 2025-08-14T20:43:47.5082670Z  2025-08-14T20:43:47.5083039Z  2025-08-14T20:43:47.5083687Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.5084478Z  """ 2025-08-14T20:43:47.5085076Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.5085779Z  """ 2025-08-14T20:43:47.5086334Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.5087001Z  return { 2025-08-14T20:43:47.5087662Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.5088406Z  } 2025-08-14T20:43:47.5088793Z  2025-08-14T20:43:47.5089185Z  2025-08-14T20:43:47.5089674Z def main() -> None: 2025-08-14T20:43:47.5090181Z  args = parse_args() 2025-08-14T20:43:47.5090668Z  2025-08-14T20:43:47.5091138Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.5091726Z  2025-08-14T20:43:47.5092140Z  # Check if the PR is opt-out 2025-08-14T20:43:47.5092703Z  if args.pr_number: 2025-08-14T20:43:47.5093452Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.5094276Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.5094829Z  log.info( 2025-08-14T20:43:47.5095621Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.5096448Z  ) 2025-08-14T20:43:47.5097089Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5097828Z  sys.exit() 2025-08-14T20:43:47.5098420Z  2025-08-14T20:43:47.5098812Z  try: 2025-08-14T20:43:47.5099311Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.5100205Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.5100908Z  ) 2025-08-14T20:43:47.5101314Z  2025-08-14T20:43:47.5101754Z  username = get_potential_pr_author( 2025-08-14T20:43:47.5102358Z  args.github_token, 2025-08-14T20:43:47.5102909Z  args.github_repo, 2025-08-14T20:43:47.5103453Z  args.github_actor, 2025-08-14T20:43:47.5104014Z  args.github_ref_type, 2025-08-14T20:43:47.5104568Z  args.github_branch, 2025-08-14T20:43:47.5105094Z  ) 2025-08-14T20:43:47.5105519Z  2025-08-14T20:43:47.5106047Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.5106712Z  2025-08-14T20:43:47.5107166Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.5107777Z  rollout_state, 2025-08-14T20:43:47.5108342Z  (args.github_issue_owner, username), 2025-08-14T20:43:47.5108951Z  args.github_branch, 2025-08-14T20:43:47.5109628Z  args.eligible_experiments, 2025-08-14T20:43:47.5110240Z  args.opt_out_experiments, 2025-08-14T20:43:47.5110807Z  is_canary, 2025-08-14T20:43:47.5111285Z  ) 2025-08-14T20:43:47.5111693Z  2025-08-14T20:43:47.5112098Z  except Exception as e: 2025-08-14T20:43:47.5112632Z  log.error( 2025-08-14T20:43:47.5113393Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.5114334Z  ) 2025-08-14T20:43:47.5114754Z  2025-08-14T20:43:47.5115338Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.5116056Z  2025-08-14T20:43:47.5116429Z  2025-08-14T20:43:47.5116860Z if __name__ == "__main__": 2025-08-14T20:43:47.5117374Z  main() 2025-08-14T20:43:47.5117796Z  2025-08-14T20:43:47.5118166Z EOF 2025-08-14T20:43:47.5118556Z  2025-08-14T20:43:47.5118961Z cat runner_determinator.py 2025-08-14T20:43:47.5486199Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.5487057Z env: 2025-08-14T20:43:47.5487821Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.5488253Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.5488714Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.5489220Z ISSUE_OWNER: 2025-08-14T20:43:47.5489853Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.5490307Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:47.5490751Z PR_NUMBER: 2025-08-14T20:43:47.5491159Z ##[endgroup] 2025-08-14T20:43:47.5708048Z # flake8: noqa: G004 2025-08-14T20:43:47.5708401Z 2025-08-14T20:43:47.5708835Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.5710138Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.5710980Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.5711431Z 2025-08-14T20:43:47.5711600Z """ 2025-08-14T20:43:47.5712181Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.5713060Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.5713959Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.5714767Z of which runners should be used to run which job. 2025-08-14T20:43:47.5715162Z 2025-08-14T20:43:47.5715544Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.5716645Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.5717548Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.5718248Z list, defined. 2025-08-14T20:43:47.5718479Z 2025-08-14T20:43:47.5718845Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.5720374Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.5721240Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.5721681Z 2025-08-14T20:43:47.5722052Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.5722913Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.5723650Z experiments which the user could be opted in to. 2025-08-14T20:43:47.5724054Z 2025-08-14T20:43:47.5724254Z The user list has the following rules: 2025-08-14T20:43:47.5724603Z 2025-08-14T20:43:47.5724932Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.5725797Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.5726566Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.5726961Z 2025-08-14T20:43:47.5727138Z Example config: 2025-08-14T20:43:47.5727586Z # A list of experiments that can be opted into. 2025-08-14T20:43:47.5728265Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.5728889Z # Expected syntax is: 2025-08-14T20:43:47.5729717Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.5730779Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.5731391Z 2025-08-14T20:43:47.5731558Z experiments: 2025-08-14T20:43:47.5731949Z lf: 2025-08-14T20:43:47.5732324Z rollout_percent: 25 2025-08-14T20:43:47.5732965Z all_branches: false 2025-08-14T20:43:47.5733411Z default: true 2025-08-14T20:43:47.5733823Z --- 2025-08-14T20:43:47.5734021Z 2025-08-14T20:43:47.5734185Z # Opt-ins: 2025-08-14T20:43:47.5734773Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.5735632Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.5736421Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.5737078Z # Experiments should be from the above list. 2025-08-14T20:43:47.5737458Z 2025-08-14T20:43:47.5737642Z @User1,-lf,split_build 2025-08-14T20:43:47.5738093Z @User2,lf 2025-08-14T20:43:47.5738473Z @User3,split_build 2025-08-14T20:43:47.5738885Z """ 2025-08-14T20:43:47.5739077Z 2025-08-14T20:43:47.5739238Z import json 2025-08-14T20:43:47.5739967Z import logging 2025-08-14T20:43:47.5740363Z import os 2025-08-14T20:43:47.5740729Z import random 2025-08-14T20:43:47.5741100Z import re 2025-08-14T20:43:47.5741476Z import sys 2025-08-14T20:43:47.5741889Z from argparse import ArgumentParser 2025-08-14T20:43:47.5742427Z from collections.abc import Iterable 2025-08-14T20:43:47.5742954Z from functools import cache 2025-08-14T20:43:47.5743425Z from logging import LogRecord 2025-08-14T20:43:47.5743921Z from typing import Any, NamedTuple 2025-08-14T20:43:47.5744453Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.5744828Z 2025-08-14T20:43:47.5744993Z import yaml 2025-08-14T20:43:47.5745380Z from github import Auth, Github 2025-08-14T20:43:47.5745868Z from github.Issue import Issue 2025-08-14T20:43:47.5746180Z 2025-08-14T20:43:47.5746187Z 2025-08-14T20:43:47.5746416Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.5747100Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.5748010Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.5748566Z 2025-08-14T20:43:47.5748803Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.5749741Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.5750329Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.5750889Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.5751248Z 2025-08-14T20:43:47.5751456Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.5751793Z 2025-08-14T20:43:47.5751984Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.5752449Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.5752733Z 2025-08-14T20:43:47.5752740Z 2025-08-14T20:43:47.5752935Z class Experiment(NamedTuple): 2025-08-14T20:43:47.5753419Z rollout_perc: float = ( 2025-08-14T20:43:47.5754057Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.5754745Z ) 2025-08-14T20:43:47.5755120Z all_branches: bool = ( 2025-08-14T20:43:47.5755747Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.5756431Z ) 2025-08-14T20:43:47.5756794Z default: bool = ( 2025-08-14T20:43:47.5757377Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.5758015Z ) 2025-08-14T20:43:47.5758212Z 2025-08-14T20:43:47.5758394Z # Add more fields as needed 2025-08-14T20:43:47.5758695Z 2025-08-14T20:43:47.5758703Z 2025-08-14T20:43:47.5758895Z class Settings(NamedTuple): 2025-08-14T20:43:47.5759330Z """ 2025-08-14T20:43:47.5759997Z Settings for the experiments that can be opted into. 2025-08-14T20:43:47.5760571Z """ 2025-08-14T20:43:47.5760764Z 2025-08-14T20:43:47.5760978Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.5761341Z 2025-08-14T20:43:47.5761348Z 2025-08-14T20:43:47.5761557Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.5762180Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.5762611Z 2025-08-14T20:43:47.5762779Z COLORS = { 2025-08-14T20:43:47.5763172Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.5763830Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.5764329Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.5764831Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.5765310Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.5765793Z } 2025-08-14T20:43:47.5765983Z 2025-08-14T20:43:47.5766204Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.5766961Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.5767738Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.5768315Z return super().format(record) 2025-08-14T20:43:47.5768658Z 2025-08-14T20:43:47.5768665Z 2025-08-14T20:43:47.5768870Z handler = logging.StreamHandler() 2025-08-14T20:43:47.5769870Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.5770443Z 2025-08-14T20:43:47.5770691Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.5771276Z log.addHandler(handler) 2025-08-14T20:43:47.5771723Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.5772003Z 2025-08-14T20:43:47.5772009Z 2025-08-14T20:43:47.5772268Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.5772827Z """ 2025-08-14T20:43:47.5773328Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.5773948Z """ 2025-08-14T20:43:47.5774315Z if not GITHUB_OUTPUT: 2025-08-14T20:43:47.5775378Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.5776506Z log.warning( 2025-08-14T20:43:47.5777360Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.5778271Z ) 2025-08-14T20:43:47.5788195Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.5788810Z return 2025-08-14T20:43:47.5789054Z 2025-08-14T20:43:47.5789451Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.5790334Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.5790911Z f.write(f"{key}={value}\n") 2025-08-14T20:43:47.5791240Z 2025-08-14T20:43:47.5791247Z 2025-08-14T20:43:47.5791562Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.5792194Z return frozenset( 2025-08-14T20:43:47.5792831Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.5793526Z ) 2025-08-14T20:43:47.5793730Z 2025-08-14T20:43:47.5793738Z 2025-08-14T20:43:47.5793931Z def parse_args() -> Any: 2025-08-14T20:43:47.5794480Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.5795375Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.5796167Z parser.add_argument( 2025-08-14T20:43:47.5796637Z "--github-issue-repo", 2025-08-14T20:43:47.5797123Z type=str, 2025-08-14T20:43:47.5797536Z required=False, 2025-08-14T20:43:47.5798007Z default="pytorch/test-infra", 2025-08-14T20:43:47.5798550Z help="GitHub repo to get the issue", 2025-08-14T20:43:47.5799075Z ) 2025-08-14T20:43:47.5799447Z parser.add_argument( 2025-08-14T20:43:47.5800132Z "--github-repo", 2025-08-14T20:43:47.5800576Z type=str, 2025-08-14T20:43:47.5800994Z required=True, 2025-08-14T20:43:47.5801481Z help="GitHub repo where CI is running", 2025-08-14T20:43:47.5802023Z ) 2025-08-14T20:43:47.5802403Z parser.add_argument( 2025-08-14T20:43:47.5803020Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.5803694Z ) 2025-08-14T20:43:47.5804061Z parser.add_argument( 2025-08-14T20:43:47.5804703Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.5805382Z ) 2025-08-14T20:43:47.5805761Z parser.add_argument( 2025-08-14T20:43:47.5806564Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.5807265Z ) 2025-08-14T20:43:47.5807628Z parser.add_argument( 2025-08-14T20:43:47.5808292Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.5809013Z ) 2025-08-14T20:43:47.5809378Z parser.add_argument( 2025-08-14T20:43:47.5810074Z "--github-ref-type", 2025-08-14T20:43:47.5810540Z type=str, 2025-08-14T20:43:47.5810947Z required=True, 2025-08-14T20:43:47.5811451Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.5862334Z ) 2025-08-14T20:43:47.5863153Z parser.add_argument( 2025-08-14T20:43:47.5863968Z "--eligible-experiments", 2025-08-14T20:43:47.5864519Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.5865049Z required=False, 2025-08-14T20:43:47.5865469Z default="", 2025-08-14T20:43:47.5866343Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.5867266Z ) 2025-08-14T20:43:47.5867636Z parser.add_argument( 2025-08-14T20:43:47.5868102Z "--opt-out-experiments", 2025-08-14T20:43:47.5868624Z type=_str_comma_separated_to_set, 2025-08-14T20:43:47.5869147Z required=False, 2025-08-14T20:43:47.5869791Z default="", 2025-08-14T20:43:47.5870217Z help=( 2025-08-14T20:43:47.5870888Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.5872030Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.5872879Z ), 2025-08-14T20:43:47.5873237Z ) 2025-08-14T20:43:47.5873616Z parser.add_argument( 2025-08-14T20:43:47.5874061Z "--pr-number", 2025-08-14T20:43:47.5874474Z type=str, 2025-08-14T20:43:47.5874867Z required=False, 2025-08-14T20:43:47.5875298Z default="", 2025-08-14T20:43:47.5875946Z help="the optional PR number where this is run", 2025-08-14T20:43:47.5876535Z ) 2025-08-14T20:43:47.5876730Z 2025-08-14T20:43:47.5876930Z return parser.parse_args() 2025-08-14T20:43:47.5877234Z 2025-08-14T20:43:47.5877241Z 2025-08-14T20:43:47.5877644Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5878395Z auth = Auth.Token(github_token) 2025-08-14T20:43:47.5878898Z return Github(auth=auth) 2025-08-14T20:43:47.5879195Z 2025-08-14T20:43:47.5879201Z 2025-08-14T20:43:47.5879828Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.5880630Z repo = gh.get_repo(repo) 2025-08-14T20:43:47.5881128Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.5881487Z 2025-08-14T20:43:47.5881494Z 2025-08-14T20:43:47.5881691Z def get_potential_pr_author( 2025-08-14T20:43:47.5882340Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.5883015Z ) -> str: 2025-08-14T20:43:47.5883523Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.5884330Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.5885059Z # embedded in the tag name: ciflow// 2025-08-14T20:43:47.5885477Z 2025-08-14T20:43:47.5885667Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.5885997Z 2025-08-14T20:43:47.5886276Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.5886889Z split_tag = ref_name.split("/") 2025-08-14T20:43:47.5887386Z if ( 2025-08-14T20:43:47.5887774Z len(split_tag) == 3 2025-08-14T20:43:47.5888251Z and split_tag[0] == "ciflow" 2025-08-14T20:43:47.5888770Z and split_tag[2].isnumeric() 2025-08-14T20:43:47.5889269Z ): 2025-08-14T20:43:47.5889862Z pr_number = split_tag[2] 2025-08-14T20:43:47.5890570Z try: 2025-08-14T20:43:47.5891006Z repository = gh.get_repo(repo) 2025-08-14T20:43:47.5891616Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.5892229Z except Exception as e: 2025-08-14T20:43:47.5892741Z raise Exception( # noqa: TRY002 2025-08-14T20:43:47.5893408Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.5894043Z ) from e 2025-08-14T20:43:47.5894583Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.5895281Z # In all other cases, return the original input username 2025-08-14T20:43:47.5895857Z return username 2025-08-14T20:43:47.5896095Z 2025-08-14T20:43:47.5896102Z 2025-08-14T20:43:47.5896332Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.5896855Z """ 2025-08-14T20:43:47.5897488Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.5898259Z """ 2025-08-14T20:43:47.5898803Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.5899315Z 2025-08-14T20:43:47.5899321Z 2025-08-14T20:43:47.5899710Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.5900204Z try: 2025-08-14T20:43:47.5900594Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.5901095Z return data 2025-08-14T20:43:47.5901512Z except yaml.YAMLError: 2025-08-14T20:43:47.5901982Z log.exception("Error loading YAML") 2025-08-14T20:43:47.5902489Z raise 2025-08-14T20:43:47.5902703Z 2025-08-14T20:43:47.5902711Z 2025-08-14T20:43:47.5903122Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.5903860Z """ 2025-08-14T20:43:47.5904489Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.5905081Z 2025-08-14T20:43:47.5905564Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5906326Z and the text below is the list of opted in users. 2025-08-14T20:43:47.5906728Z 2025-08-14T20:43:47.5907102Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.5907805Z """ 2025-08-14T20:43:47.5908240Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.5908847Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.5909452Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.5910242Z else: 2025-08-14T20:43:47.5910633Z return "", rollout_state 2025-08-14T20:43:47.5910944Z 2025-08-14T20:43:47.5910952Z 2025-08-14T20:43:47.5911155Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.5911671Z """ 2025-08-14T20:43:47.5912186Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.5912833Z """ 2025-08-14T20:43:47.5913043Z 2025-08-14T20:43:47.5913051Z 2025-08-14T20:43:47.5913403Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.5914054Z """ 2025-08-14T20:43:47.5914762Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.5915437Z 2025-08-14T20:43:47.5916047Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.5917039Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.5917715Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.5918194Z 2025-08-14T20:43:47.5918201Z 2025-08-14T20:43:47.5918359Z """ 2025-08-14T20:43:47.5918743Z optins = UserOptins() 2025-08-14T20:43:47.5919227Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.5919956Z user = user.strip("\r\n\t -") 2025-08-14T20:43:47.5920498Z if not user or not user.startswith("@"): 2025-08-14T20:43:47.5921205Z # Not a valid user. Skip 2025-08-14T20:43:47.5921688Z continue 2025-08-14T20:43:47.5921943Z 2025-08-14T20:43:47.5922109Z if user: 2025-08-14T20:43:47.5922550Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.5923240Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.5923729Z 2025-08-14T20:43:47.5923907Z return optins 2025-08-14T20:43:47.5924143Z 2025-08-14T20:43:47.5924152Z 2025-08-14T20:43:47.5924441Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.5925042Z """ 2025-08-14T20:43:47.5925435Z Check if the experiment name is valid. 2025-08-14T20:43:47.5925947Z A valid name: 2025-08-14T20:43:47.5926581Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.5927517Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.5928257Z - Cannot contain spaces 2025-08-14T20:43:47.5928708Z """ 2025-08-14T20:43:47.5928911Z 2025-08-14T20:43:47.5929175Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.5930096Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.5930547Z 2025-08-14T20:43:47.5930709Z if valid: 2025-08-14T20:43:47.5931088Z return True 2025-08-14T20:43:47.5931328Z 2025-08-14T20:43:47.5931490Z log.error( 2025-08-14T20:43:47.5932938Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:43:47.5934471Z ) 2025-08-14T20:43:47.5934826Z return False 2025-08-14T20:43:47.5935057Z 2025-08-14T20:43:47.5935064Z 2025-08-14T20:43:47.5935373Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.5936000Z """ 2025-08-14T20:43:47.5936740Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.5937465Z """ 2025-08-14T20:43:47.5937820Z try: 2025-08-14T20:43:47.5938193Z if settings_text: 2025-08-14T20:43:47.5938930Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.5940264Z # for easy reading 2025-08-14T20:43:47.5941070Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.5941954Z # the backtick character in shell commands. 2025-08-14T20:43:47.5942556Z backtick = chr(96) # backtick character 2025-08-14T20:43:47.5943222Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.5943883Z settings = load_yaml(settings_text) 2025-08-14T20:43:47.5944254Z 2025-08-14T20:43:47.5944675Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.5945448Z experiments = {} 2025-08-14T20:43:47.5945741Z 2025-08-14T20:43:47.5946130Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.5946902Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.5948057Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:43:47.5949104Z continue 2025-08-14T20:43:47.5949387Z 2025-08-14T20:43:47.5949692Z valid_settings = {} 2025-08-14T20:43:47.5950231Z for setting in exp_settings: 2025-08-14T20:43:47.5950804Z if setting not in Experiment._fields: 2025-08-14T20:43:47.5951355Z log.warning( 2025-08-14T20:43:47.5952066Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.5953100Z ) 2025-08-14T20:43:47.5953527Z else: 2025-08-14T20:43:47.5954046Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.5954474Z 2025-08-14T20:43:47.5954753Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.5955389Z return Settings(experiments) 2025-08-14T20:43:47.5955739Z 2025-08-14T20:43:47.5955914Z except Exception: 2025-08-14T20:43:47.5956392Z log.exception("Failed to parse settings") 2025-08-14T20:43:47.5956778Z 2025-08-14T20:43:47.5956951Z return Settings() 2025-08-14T20:43:47.5957213Z 2025-08-14T20:43:47.5957219Z 2025-08-14T20:43:47.5957464Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.5958024Z """ 2025-08-14T20:43:47.5958454Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.5958862Z 2025-08-14T20:43:47.5959221Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.5960095Z and the text below is the list of opted in users. 2025-08-14T20:43:47.5960504Z 2025-08-14T20:43:47.5960910Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.5961662Z """ 2025-08-14T20:43:47.5962219Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5962978Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.5963375Z 2025-08-14T20:43:47.5963382Z 2025-08-14T20:43:47.5963626Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.5964183Z """ 2025-08-14T20:43:47.5964569Z Parse users from the rollout state. 2025-08-14T20:43:47.5964927Z 2025-08-14T20:43:47.5965081Z """ 2025-08-14T20:43:47.5965599Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.5966330Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.5966742Z 2025-08-14T20:43:47.5966749Z 2025-08-14T20:43:47.5967294Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5968037Z """ 2025-08-14T20:43:47.5968456Z Check if a user is opted into an experiment 2025-08-14T20:43:47.5968991Z """ 2025-08-14T20:43:47.5969446Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.5969982Z 2025-08-14T20:43:47.5969989Z 2025-08-14T20:43:47.5970410Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.5971171Z """ 2025-08-14T20:43:47.5971635Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.5972208Z """ 2025-08-14T20:43:47.5972708Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.5973387Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.5974027Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.5974626Z return False 2025-08-14T20:43:47.5974899Z 2025-08-14T20:43:47.5975183Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.5975788Z log.warning( 2025-08-14T20:43:47.5976597Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.5977484Z ) 2025-08-14T20:43:47.5977689Z 2025-08-14T20:43:47.5977859Z return True 2025-08-14T20:43:47.5978091Z 2025-08-14T20:43:47.5978104Z 2025-08-14T20:43:47.5978286Z def get_runner_prefix( 2025-08-14T20:43:47.5978724Z rollout_state: str, 2025-08-14T20:43:47.5979198Z workflow_requestors: Iterable[str], 2025-08-14T20:43:47.5979820Z branch: str, 2025-08-14T20:43:47.5980327Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5980998Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.5981589Z is_canary: bool = False, 2025-08-14T20:43:47.5982057Z ) -> str: 2025-08-14T20:43:47.5982629Z settings = parse_settings(rollout_state) 2025-08-14T20:43:47.5983221Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.5983592Z 2025-08-14T20:43:47.5983773Z fleet_prefix = "" 2025-08-14T20:43:47.5984204Z prefixes = [] 2025-08-14T20:43:47.5984832Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.5985782Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.5986511Z log.info( 2025-08-14T20:43:47.5987187Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.5987947Z ) 2025-08-14T20:43:47.5988336Z continue 2025-08-14T20:43:47.5988588Z 2025-08-14T20:43:47.5988777Z if opt_out_experiments: 2025-08-14T20:43:47.5989314Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.5990079Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.5990683Z log.info( 2025-08-14T20:43:47.5991612Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.5992597Z ) 2025-08-14T20:43:47.5992991Z continue 2025-08-14T20:43:47.5993265Z 2025-08-14T20:43:47.5993461Z if eligible_experiments: 2025-08-14T20:43:47.5994017Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.5994656Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.5995223Z log.info( 2025-08-14T20:43:47.5995999Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.5996846Z ) 2025-08-14T20:43:47.5997243Z continue 2025-08-14T20:43:47.5997723Z elif not experiment_settings.default: 2025-08-14T20:43:47.5998254Z log.info( 2025-08-14T20:43:47.5999040Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.5999888Z ) 2025-08-14T20:43:47.6000274Z continue 2025-08-14T20:43:47.6000282Z 2025-08-14T20:43:47.6000564Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.6000752Z opted_out_users = [ 2025-08-14T20:43:47.6000925Z requestor 2025-08-14T20:43:47.6001139Z for requestor in workflow_requestors 2025-08-14T20:43:47.6001447Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6001616Z ] 2025-08-14T20:43:47.6001624Z 2025-08-14T20:43:47.6001804Z if opted_out_users: 2025-08-14T20:43:47.6001976Z log.info( 2025-08-14T20:43:47.6002359Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.6002520Z ) 2025-08-14T20:43:47.6002683Z continue 2025-08-14T20:43:47.6002696Z 2025-08-14T20:43:47.6002984Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.6003167Z opted_in_users = [ 2025-08-14T20:43:47.6003336Z requestor 2025-08-14T20:43:47.6003551Z for requestor in workflow_requestors 2025-08-14T20:43:47.6003857Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.6004014Z ] 2025-08-14T20:43:47.6004021Z 2025-08-14T20:43:47.6004195Z enabled = False 2025-08-14T20:43:47.6004384Z if opted_in_users: 2025-08-14T20:43:47.6004555Z log.info( 2025-08-14T20:43:47.6004915Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.6005083Z ) 2025-08-14T20:43:47.6005262Z enabled = True 2025-08-14T20:43:47.6005269Z 2025-08-14T20:43:47.6005494Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.6005957Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.6006400Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.6006580Z log.info( 2025-08-14T20:43:47.6007174Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.6007344Z ) 2025-08-14T20:43:47.6007526Z enabled = True 2025-08-14T20:43:47.6007534Z 2025-08-14T20:43:47.6007702Z if enabled: 2025-08-14T20:43:47.6007897Z label = experiment_name 2025-08-14T20:43:47.6008123Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:47.6008561Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:47.6008831Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:47.6009155Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:47.6009336Z if is_canary: 2025-08-14T20:43:47.6009640Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:47.6009836Z fleet_prefix = label 2025-08-14T20:43:47.6009999Z else: 2025-08-14T20:43:47.6010197Z prefixes.append(label) 2025-08-14T20:43:47.6010206Z 2025-08-14T20:43:47.6010391Z if len(prefixes) > 1: 2025-08-14T20:43:47.6010556Z log.error( 2025-08-14T20:43:47.6011370Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:43:47.6011533Z ) 2025-08-14T20:43:47.6011729Z prefixes = prefixes[:1] 2025-08-14T20:43:47.6011737Z 2025-08-14T20:43:47.6011928Z # Fleet always comes first 2025-08-14T20:43:47.6012104Z if fleet_prefix: 2025-08-14T20:43:47.6012320Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:47.6012334Z 2025-08-14T20:43:47.6012707Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:47.6012718Z 2025-08-14T20:43:47.6012724Z 2025-08-14T20:43:47.6013182Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:47.6013354Z """ 2025-08-14T20:43:47.6013753Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:47.6013761Z 2025-08-14T20:43:47.6014150Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:47.6014317Z """ 2025-08-14T20:43:47.6014515Z gh = get_gh_client(github_token) 2025-08-14T20:43:47.6014723Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:47.6015015Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:47.6015023Z 2025-08-14T20:43:47.6015029Z 2025-08-14T20:43:47.6015434Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:47.6015632Z for _ in range(num_retries): 2025-08-14T20:43:47.6015801Z try: 2025-08-14T20:43:47.6016030Z req = Request(url=url, headers=headers) 2025-08-14T20:43:47.6016318Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:47.6016516Z return json.loads(content) 2025-08-14T20:43:47.6016723Z except Exception as e: 2025-08-14T20:43:47.6016965Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:47.6016974Z 2025-08-14T20:43:47.6017358Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:47.6017529Z return {} 2025-08-14T20:43:47.6017537Z 2025-08-14T20:43:47.6017545Z 2025-08-14T20:43:47.6017702Z @cache 2025-08-14T20:43:47.6018135Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:47.6018300Z """ 2025-08-14T20:43:47.6018499Z Dynamically get PR information 2025-08-14T20:43:47.6018659Z """ 2025-08-14T20:43:47.6019085Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:47.6019263Z headers = { 2025-08-14T20:43:47.6019600Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:47.6019828Z "Authorization": f"token {github_token}", 2025-08-14T20:43:47.6019993Z } 2025-08-14T20:43:47.6020227Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:47.6020443Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:47.6020623Z headers=headers, 2025-08-14T20:43:47.6020789Z ) 2025-08-14T20:43:47.6020797Z 2025-08-14T20:43:47.6020981Z if not json_response: 2025-08-14T20:43:47.6021275Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:47.6021446Z return {} 2025-08-14T20:43:47.6021453Z 2025-08-14T20:43:47.6021632Z return json_response 2025-08-14T20:43:47.6021641Z 2025-08-14T20:43:47.6021648Z 2025-08-14T20:43:47.6022050Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:47.6022231Z """ 2025-08-14T20:43:47.6022567Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:47.6022732Z """ 2025-08-14T20:43:47.6023018Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:47.6023192Z return { 2025-08-14T20:43:47.6023553Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:47.6023711Z } 2025-08-14T20:43:47.6023719Z 2025-08-14T20:43:47.6023727Z 2025-08-14T20:43:47.6023908Z def main() -> None: 2025-08-14T20:43:47.6024090Z args = parse_args() 2025-08-14T20:43:47.6024098Z 2025-08-14T20:43:47.6024321Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:47.6024329Z 2025-08-14T20:43:47.6024533Z # Check if the PR is opt-out 2025-08-14T20:43:47.6024711Z if args.pr_number: 2025-08-14T20:43:47.6025106Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:47.6025423Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:47.6025598Z log.info( 2025-08-14T20:43:47.6026042Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:47.6026206Z ) 2025-08-14T20:43:47.6026547Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6026719Z sys.exit() 2025-08-14T20:43:47.6026727Z 2025-08-14T20:43:47.6026888Z try: 2025-08-14T20:43:47.6027134Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:47.6027445Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:47.6027609Z ) 2025-08-14T20:43:47.6027617Z 2025-08-14T20:43:47.6027829Z username = get_potential_pr_author( 2025-08-14T20:43:47.6028013Z args.github_token, 2025-08-14T20:43:47.6028199Z args.github_repo, 2025-08-14T20:43:47.6028382Z args.github_actor, 2025-08-14T20:43:47.6028590Z args.github_ref_type, 2025-08-14T20:43:47.6028780Z args.github_branch, 2025-08-14T20:43:47.6028942Z ) 2025-08-14T20:43:47.6028950Z 2025-08-14T20:43:47.6029246Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:47.6029255Z 2025-08-14T20:43:47.6029571Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:47.6029755Z rollout_state, 2025-08-14T20:43:47.6029974Z (args.github_issue_owner, username), 2025-08-14T20:43:47.6030157Z args.github_branch, 2025-08-14T20:43:47.6030357Z args.eligible_experiments, 2025-08-14T20:43:47.6030609Z args.opt_out_experiments, 2025-08-14T20:43:47.6030903Z is_canary, 2025-08-14T20:43:47.6031156Z ) 2025-08-14T20:43:47.6031559Z 2025-08-14T20:43:47.6031905Z except Exception as e: 2025-08-14T20:43:47.6032693Z log.error( 2025-08-14T20:43:47.6033895Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:47.6035543Z ) 2025-08-14T20:43:47.6036001Z 2025-08-14T20:43:47.6036620Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:47.6037581Z 2025-08-14T20:43:47.6037596Z 2025-08-14T20:43:47.6037915Z if __name__ == "__main__": 2025-08-14T20:43:47.6038706Z main() 2025-08-14T20:43:47.6039074Z 2025-08-14T20:43:47.6138902Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6139984Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:47.6181098Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:47.6181569Z env: 2025-08-14T20:43:47.6182184Z GITHUB_TOKEN: *** 2025-08-14T20:43:47.6182594Z ISSUE_NUMBER: 5132 2025-08-14T20:43:47.6183026Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:47.6183512Z ISSUE_OWNER: 2025-08-14T20:43:47.6183904Z CHECK_EXPERIMENTS: 2025-08-14T20:43:47.6184323Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:47.6184774Z PR_NUMBER: 2025-08-14T20:43:47.6185141Z ##[endgroup] 2025-08-14T20:43:48.9529974Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.5723831Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.6126951Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.6360900Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-08-14T20:43:49.6581928Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.6623394Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.7070716Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:49.7118552Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:43:49.7166578Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:49.7183845Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:43:49.7198748Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:49.7451934Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:49.7499837Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:49.7726200Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:43:49.8897138Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:49.8937778Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:50.0072829Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:50.0119349Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:43:50.0331303Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.0379699Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:50.0628019Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.0701205Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 25.3 MB/s eta 0:00:00 2025-08-14T20:43:50.0759937Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.0826076Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 70.8 MB/s eta 0:00:00 2025-08-14T20:43:50.0879392Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.1019357Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 68.1 MB/s eta 0:00:00 2025-08-14T20:43:50.1064864Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.1157835Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.1270442Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 48.9 MB/s eta 0:00:00 2025-08-14T20:43:50.1317883Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:50.1357615Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.1 MB/s eta 0:00:00 2025-08-14T20:43:50.1416068Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:50.1457295Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 42.4 MB/s eta 0:00:00 2025-08-14T20:43:50.4323540Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:50.9637033Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:43:51.0484432Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.0484739Z curr_branch="main" 2025-08-14T20:43:51.0484961Z curr_ref_type="branch" 2025-08-14T20:43:51.0485243Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.0485498Z  2025-08-14T20:43:51.0485695Z python3 runner_determinator.py \ 2025-08-14T20:43:51.0485977Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.0486247Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.0486505Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.0486769Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.0487054Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.0487327Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.0487598Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.0487889Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.0488256Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.0488539Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.0530462Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.0530689Z env: 2025-08-14T20:43:51.0531239Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.0531438Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.0531653Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.0531886Z ISSUE_OWNER: 2025-08-14T20:43:51.0532066Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.0532257Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:43:51.0532452Z PR_NUMBER: 2025-08-14T20:43:51.0532622Z ##[endgroup] 2025-08-14T20:43:51.0591315Z Current branch is 'main' 2025-08-14T20:43:52.5359901Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-08-14T20:43:52.5361234Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.5362126Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.5362780Z INFO : Setting output: label-type='' 2025-08-14T20:43:52.5679883Z Evaluate and set job outputs 2025-08-14T20:43:52.5686798Z Cleaning up orphan processes