2025-07-17T06:38:20.4126489Z Current runner version: '2.326.0' 2025-07-17T06:38:20.4150366Z ##[group]Runner Image Provisioner 2025-07-17T06:38:20.4151243Z Hosted Compute Agent 2025-07-17T06:38:20.4151755Z Version: 20250711.363 2025-07-17T06:38:20.4152413Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:38:20.4153076Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:38:20.4153697Z ##[endgroup] 2025-07-17T06:38:20.4154233Z ##[group]Operating System 2025-07-17T06:38:20.4154905Z Ubuntu 2025-07-17T06:38:20.4155367Z 24.04.2 2025-07-17T06:38:20.4155855Z LTS 2025-07-17T06:38:20.4156340Z ##[endgroup] 2025-07-17T06:38:20.4156822Z ##[group]Runner Image 2025-07-17T06:38:20.4157369Z Image: ubuntu-24.04 2025-07-17T06:38:20.4158324Z Version: 20250710.1.0 2025-07-17T06:38:20.4159318Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:38:20.4160849Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:38:20.4161798Z ##[endgroup] 2025-07-17T06:38:20.4162805Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:38:20.4164955Z Contents: read 2025-07-17T06:38:20.4165502Z Metadata: read 2025-07-17T06:38:20.4166014Z ##[endgroup] 2025-07-17T06:38:20.4168580Z Secret source: Actions 2025-07-17T06:38:20.4169476Z Prepare workflow directory 2025-07-17T06:38:20.4686905Z Prepare all required actions 2025-07-17T06:38:20.4742240Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:38:20.4747675Z ##[group] Inputs 2025-07-17T06:38:20.4748349Z check_experiments: 2025-07-17T06:38:20.4748901Z opt_out_experiments: 2025-07-17T06:38:20.4749560Z triggering_actor: pytorchmergebot 2025-07-17T06:38:20.4750146Z issue_owner: 2025-07-17T06:38:20.4750679Z curr_branch: main 2025-07-17T06:38:20.4751237Z curr_ref_type: branch 2025-07-17T06:38:20.4751900Z issue_number: 5132 2025-07-17T06:38:20.4752379Z ##[endgroup] 2025-07-17T06:38:20.4753116Z Complete job name: before-test / get-label-type / runner-determinator 2025-07-17T06:38:21.1875078Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:38:21.1878748Z cat < runner_determinator.py 2025-07-17T06:38:21.1879897Z # flake8: noqa: G004 2025-07-17T06:38:21.1880857Z  2025-07-17T06:38:21.1882212Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:38:21.1883981Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:38:21.1885622Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:38:21.1886931Z  2025-07-17T06:38:21.1887872Z """ 2025-07-17T06:38:21.1889220Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:38:21.1891181Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:38:21.1893497Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:38:21.1895348Z of which runners should be used to run which job. 2025-07-17T06:38:21.1896601Z  2025-07-17T06:38:21.1898063Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:38:21.1899935Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:38:21.1901876Z settings are considered to be empty with only the second part, the user 2025-07-17T06:38:21.1903405Z list, defined. 2025-07-17T06:38:21.1904361Z  2025-07-17T06:38:21.1905558Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:38:21.1907652Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:38:21.1909430Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:38:21.1910842Z  2025-07-17T06:38:21.1912389Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:38:21.1914354Z The user list is also a comma separated list of additional features or 2025-07-17T06:38:21.1916123Z experiments which the user could be opted in to. 2025-07-17T06:38:21.1917319Z  2025-07-17T06:38:21.1918270Z The user list has the following rules: 2025-07-17T06:38:21.1919367Z  2025-07-17T06:38:21.1920417Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:38:21.1922089Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:38:21.1923744Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:38:21.1925070Z  2025-07-17T06:38:21.1926039Z Example config: 2025-07-17T06:38:21.1927004Z  # A list of experiments that can be opted into. 2025-07-17T06:38:21.1928941Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:38:21.1930206Z  # Expected syntax is: 2025-07-17T06:38:21.1931556Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:38:21.1933603Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:38:21.1935247Z  2025-07-17T06:38:21.1935984Z  experiments: 2025-07-17T06:38:21.1936951Z  lf: 2025-07-17T06:38:21.1937987Z  rollout_percent: 25 2025-07-17T06:38:21.1938917Z  all_branches: false 2025-07-17T06:38:21.1939893Z  default: true 2025-07-17T06:38:21.1940764Z  --- 2025-07-17T06:38:21.1941504Z  2025-07-17T06:38:21.2023664Z  # Opt-ins: 2025-07-17T06:38:21.2024528Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:38:21.2025738Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:38:21.2026648Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:38:21.2027409Z  # Experiments should be from the above list. 2025-07-17T06:38:21.2028198Z  2025-07-17T06:38:21.2028616Z  @User1,-lf,split_build 2025-07-17T06:38:21.2029137Z  @User2,lf 2025-07-17T06:38:21.2029600Z  @User3,split_build 2025-07-17T06:38:21.2030085Z """ 2025-07-17T06:38:21.2030479Z  2025-07-17T06:38:21.2030861Z import json 2025-07-17T06:38:21.2031304Z import logging 2025-07-17T06:38:21.2031743Z import os 2025-07-17T06:38:21.2032173Z import random 2025-07-17T06:38:21.2032609Z import re 2025-07-17T06:38:21.2033022Z import sys 2025-07-17T06:38:21.2033495Z from argparse import ArgumentParser 2025-07-17T06:38:21.2034180Z from collections.abc import Iterable 2025-07-17T06:38:21.2034774Z from functools import cache 2025-07-17T06:38:21.2035545Z from logging import LogRecord 2025-07-17T06:38:21.2036495Z from typing import Any, NamedTuple 2025-07-17T06:38:21.2037645Z from urllib.request import Request, urlopen 2025-07-17T06:38:21.2038623Z  2025-07-17T06:38:21.2039246Z import yaml 2025-07-17T06:38:21.2039992Z from github import Auth, Github 2025-07-17T06:38:21.2040921Z from github.Issue import Issue 2025-07-17T06:38:21.2041782Z  2025-07-17T06:38:21.2042371Z  2025-07-17T06:38:21.2043117Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:38:21.2044421Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:38:21.2046060Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:38:21.2046977Z  2025-07-17T06:38:21.2047817Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:38:21.2048468Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:38:21.2049075Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:38:21.2049731Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:38:21.2050301Z  2025-07-17T06:38:21.2050736Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:38:21.2051274Z  2025-07-17T06:38:21.2051678Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:38:21.2052205Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:38:21.2052711Z  2025-07-17T06:38:21.2053085Z  2025-07-17T06:38:21.2053512Z class Experiment(NamedTuple): 2025-07-17T06:38:21.2054072Z  rollout_perc: float = ( 2025-07-17T06:38:21.2054816Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:38:21.2055560Z  ) 2025-07-17T06:38:21.2055985Z  all_branches: bool = ( 2025-07-17T06:38:21.2056711Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:38:21.2057521Z  ) 2025-07-17T06:38:21.2058082Z  default: bool = ( 2025-07-17T06:38:21.2058743Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:38:21.2059442Z  ) 2025-07-17T06:38:21.2059837Z  2025-07-17T06:38:21.2060240Z  # Add more fields as needed 2025-07-17T06:38:21.2060754Z  2025-07-17T06:38:21.2061121Z  2025-07-17T06:38:21.2061520Z class Settings(NamedTuple): 2025-07-17T06:38:21.2062033Z  """ 2025-07-17T06:38:21.2062569Z  Settings for the experiments that can be opted into. 2025-07-17T06:38:21.2063188Z  """ 2025-07-17T06:38:21.2063587Z  2025-07-17T06:38:21.2064033Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:38:21.2064610Z  2025-07-17T06:38:21.2065134Z  2025-07-17T06:38:21.2065600Z class ColorFormatter(logging.Formatter): 2025-07-17T06:38:21.2066311Z  """Color codes the log messages based on the log level""" 2025-07-17T06:38:21.2066947Z  2025-07-17T06:38:21.2067337Z  COLORS = { 2025-07-17T06:38:21.2068256Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:38:21.2069207Z  "ERROR": "\033[31m", # Red 2025-07-17T06:38:21.2070135Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:38:21.2071061Z  "INFO": "\033[0m", # Reset 2025-07-17T06:38:21.2071978Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:38:21.2072840Z  } 2025-07-17T06:38:21.2073473Z  2025-07-17T06:38:21.2074210Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:38:21.2075604Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:38:21.2077051Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:38:21.2078252Z  return super().format(record) 2025-07-17T06:38:21.2078959Z  2025-07-17T06:38:21.2079334Z  2025-07-17T06:38:21.2079761Z handler = logging.StreamHandler() 2025-07-17T06:38:21.2080549Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:38:21.2081306Z  2025-07-17T06:38:21.2081806Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:38:21.2082468Z log.addHandler(handler) 2025-07-17T06:38:21.2082989Z log.setLevel(logging.INFO) 2025-07-17T06:38:21.2083481Z  2025-07-17T06:38:21.2083847Z  2025-07-17T06:38:21.2084337Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:38:21.2084954Z  """ 2025-07-17T06:38:21.2085563Z  Defines outputs of the github action that invokes this script 2025-07-17T06:38:21.2086414Z  """ 2025-07-17T06:38:21.2086837Z  if not GITHUB_OUTPUT: 2025-07-17T06:38:21.2088103Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:38:21.2089301Z  log.warning( 2025-07-17T06:38:21.2090259Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:38:21.2091258Z  ) 2025-07-17T06:38:21.2092088Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:38:21.2093081Z  return 2025-07-17T06:38:21.2093790Z  2025-07-17T06:38:21.2094479Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:38:21.2095547Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:38:21.2096590Z  f.write(f"{key}={value}\n") 2025-07-17T06:38:21.2097629Z  2025-07-17T06:38:21.2098250Z  2025-07-17T06:38:21.2099179Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:38:21.2100386Z  return frozenset( 2025-07-17T06:38:21.2101555Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:38:21.2102304Z  ) 2025-07-17T06:38:21.2102705Z  2025-07-17T06:38:21.2103082Z  2025-07-17T06:38:21.2103479Z def parse_args() -> Any: 2025-07-17T06:38:21.2104151Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:38:21.2105101Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:38:21.2106317Z  parser.add_argument( 2025-07-17T06:38:21.2107255Z  "--github-issue-repo", 2025-07-17T06:38:21.2108513Z  type=str, 2025-07-17T06:38:21.2109320Z  required=False, 2025-07-17T06:38:21.2110398Z  default="pytorch/test-infra", 2025-07-17T06:38:21.2111344Z  help="GitHub repo to get the issue", 2025-07-17T06:38:21.2111913Z  ) 2025-07-17T06:38:21.2112359Z  parser.add_argument( 2025-07-17T06:38:21.2112877Z  "--github-repo", 2025-07-17T06:38:21.2113390Z  type=str, 2025-07-17T06:38:21.2113878Z  required=True, 2025-07-17T06:38:21.2114438Z  help="GitHub repo where CI is running", 2025-07-17T06:38:21.2115008Z  ) 2025-07-17T06:38:21.2115428Z  parser.add_argument( 2025-07-17T06:38:21.2116127Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:38:21.2116829Z  ) 2025-07-17T06:38:21.2117251Z  parser.add_argument( 2025-07-17T06:38:21.2118101Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:38:21.2118833Z  ) 2025-07-17T06:38:21.2119266Z  parser.add_argument( 2025-07-17T06:38:21.2120010Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:38:21.2120764Z  ) 2025-07-17T06:38:21.2121188Z  parser.add_argument( 2025-07-17T06:38:21.2121949Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:38:21.2122716Z  ) 2025-07-17T06:38:21.2123163Z  parser.add_argument( 2025-07-17T06:38:21.2123694Z  "--github-ref-type", 2025-07-17T06:38:21.2124230Z  type=str, 2025-07-17T06:38:21.2124715Z  required=True, 2025-07-17T06:38:21.2125317Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:38:21.2125916Z  ) 2025-07-17T06:38:21.2126351Z  parser.add_argument( 2025-07-17T06:38:21.2127040Z  "--eligible-experiments", 2025-07-17T06:38:21.2127850Z  type=_str_comma_separated_to_set, 2025-07-17T06:38:21.2128429Z  required=False, 2025-07-17T06:38:21.2128930Z  default="", 2025-07-17T06:38:21.2129881Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:38:21.2130855Z  ) 2025-07-17T06:38:21.2131278Z  parser.add_argument( 2025-07-17T06:38:21.2131818Z  "--opt-out-experiments", 2025-07-17T06:38:21.2132399Z  type=_str_comma_separated_to_set, 2025-07-17T06:38:21.2132970Z  required=False, 2025-07-17T06:38:21.2133468Z  default="", 2025-07-17T06:38:21.2133947Z  help=( 2025-07-17T06:38:21.2134710Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:38:21.2135923Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:38:21.2136808Z  ), 2025-07-17T06:38:21.2137220Z  ) 2025-07-17T06:38:21.2137772Z  parser.add_argument( 2025-07-17T06:38:21.2138289Z  "--pr-number", 2025-07-17T06:38:21.2138790Z  type=str, 2025-07-17T06:38:21.2139266Z  required=False, 2025-07-17T06:38:21.2139766Z  default="", 2025-07-17T06:38:21.2140335Z  help="the optional PR number where this is run", 2025-07-17T06:38:21.2140948Z  ) 2025-07-17T06:38:21.2141348Z  2025-07-17T06:38:21.2141766Z  return parser.parse_args() 2025-07-17T06:38:21.2142297Z  2025-07-17T06:38:21.2142671Z  2025-07-17T06:38:21.2143326Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:38:21.2144314Z  auth = Auth.Token(github_token) 2025-07-17T06:38:21.2145143Z  return Github(auth=auth) 2025-07-17T06:38:21.2146014Z  2025-07-17T06:38:21.2146634Z  2025-07-17T06:38:21.2148015Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:38:21.2149539Z  repo = gh.get_repo(repo) 2025-07-17T06:38:21.2150534Z  return repo.get_issue(number=issue_num) 2025-07-17T06:38:21.2151509Z  2025-07-17T06:38:21.2152123Z  2025-07-17T06:38:21.2152795Z def get_potential_pr_author( 2025-07-17T06:38:21.2154068Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:38:21.2155351Z ) -> str: 2025-07-17T06:38:21.2156062Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:38:21.2156955Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:38:21.2157971Z  # embedded in the tag name: ciflow// 2025-07-17T06:38:21.2158602Z  2025-07-17T06:38:21.2159029Z  gh = get_gh_client(github_token) 2025-07-17T06:38:21.2159574Z  2025-07-17T06:38:21.2160094Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:38:21.2160782Z  split_tag = ref_name.split("/") 2025-07-17T06:38:21.2161348Z  if ( 2025-07-17T06:38:21.2161809Z  len(split_tag) == 3 2025-07-17T06:38:21.2162384Z  and split_tag[0] == "ciflow" 2025-07-17T06:38:21.2162979Z  and split_tag[2].isnumeric() 2025-07-17T06:38:21.2163534Z  ): 2025-07-17T06:38:21.2164003Z  pr_number = split_tag[2] 2025-07-17T06:38:21.2164556Z  try: 2025-07-17T06:38:21.2165071Z  repository = gh.get_repo(repo) 2025-07-17T06:38:21.2165910Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:38:21.2166590Z  except Exception as e: 2025-07-17T06:38:21.2167185Z  raise Exception( # noqa: TRY002 2025-07-17T06:38:21.2168431Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:38:21.2169166Z  ) from e 2025-07-17T06:38:21.2169798Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:38:21.2170560Z  # In all other cases, return the original input username 2025-07-17T06:38:21.2171191Z  return username 2025-07-17T06:38:21.2171657Z  2025-07-17T06:38:21.2172023Z  2025-07-17T06:38:21.2172489Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:38:21.2173063Z  """ 2025-07-17T06:38:21.2173784Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:38:21.2174640Z  """ 2025-07-17T06:38:21.2175247Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:38:21.2175961Z  2025-07-17T06:38:21.2176329Z  2025-07-17T06:38:21.2176760Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:38:21.2177303Z  try: 2025-07-17T06:38:21.2177900Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:38:21.2178552Z  return data 2025-07-17T06:38:21.2179377Z  except yaml.YAMLError: 2025-07-17T06:38:21.2180324Z  log.exception("Error loading YAML") 2025-07-17T06:38:21.2181260Z  raise 2025-07-17T06:38:21.2181959Z  2025-07-17T06:38:21.2182555Z  2025-07-17T06:38:21.2183674Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:38:21.2185048Z  """ 2025-07-17T06:38:21.2186488Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:38:21.2188031Z  2025-07-17T06:38:21.2189000Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:21.2190081Z  and the text below is the list of opted in users. 2025-07-17T06:38:21.2190679Z  2025-07-17T06:38:21.2191301Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:38:21.2192044Z  """ 2025-07-17T06:38:21.2192540Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:38:21.2193287Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:38:21.2194140Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:38:21.2194772Z  else: 2025-07-17T06:38:21.2195216Z  return "", rollout_state 2025-07-17T06:38:21.2195737Z  2025-07-17T06:38:21.2196113Z  2025-07-17T06:38:21.2196554Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:38:21.2197107Z  """ 2025-07-17T06:38:21.2197828Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:38:21.2198514Z  """ 2025-07-17T06:38:21.2198899Z  2025-07-17T06:38:21.2199263Z  2025-07-17T06:38:21.2199829Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:38:21.2200531Z  """ 2025-07-17T06:38:21.2201302Z  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:38:21.2202155Z  2025-07-17T06:38:21.2203001Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:38:21.2204036Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:38:21.2204964Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:38:21.2205657Z  2025-07-17T06:38:21.2206021Z  2025-07-17T06:38:21.2206382Z  """ 2025-07-17T06:38:21.2206797Z  optins = UserOptins() 2025-07-17T06:38:21.2207359Z  for user in user_optin_text.split("\n"): 2025-07-17T06:38:21.2208069Z  user = user.strip("\r\n\t -") 2025-07-17T06:38:21.2208674Z  if not user or not user.startswith("@"): 2025-07-17T06:38:21.2209279Z  # Not a valid user. Skip 2025-07-17T06:38:21.2209816Z  continue 2025-07-17T06:38:21.2210298Z  2025-07-17T06:38:21.2210671Z  if user: 2025-07-17T06:38:21.2211179Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:38:21.2211916Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:38:21.2212595Z  2025-07-17T06:38:21.2212973Z  return optins 2025-07-17T06:38:21.2213418Z  2025-07-17T06:38:21.2213775Z  2025-07-17T06:38:21.2214304Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:38:21.2214955Z  """ 2025-07-17T06:38:21.2215402Z  Check if the experiment name is valid. 2025-07-17T06:38:21.2215964Z  A valid name: 2025-07-17T06:38:21.2216673Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:38:21.2217749Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:38:21.2218501Z  - Cannot contain spaces 2025-07-17T06:38:21.2219015Z  """ 2025-07-17T06:38:21.2219403Z  2025-07-17T06:38:21.2219896Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:38:21.2220671Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:38:21.2221583Z  2025-07-17T06:38:21.2222063Z  if valid: 2025-07-17T06:38:21.2222736Z  return True 2025-07-17T06:38:21.2223513Z  2025-07-17T06:38:21.2224192Z  log.error( 2025-07-17T06:38:21.2225768Z  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:38:21.2227358Z  ) 2025-07-17T06:38:21.2227882Z  return False 2025-07-17T06:38:21.2228346Z  2025-07-17T06:38:21.2228711Z  2025-07-17T06:38:21.2229272Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:38:21.2229970Z  """ 2025-07-17T06:38:21.2230633Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:38:21.2231405Z  """ 2025-07-17T06:38:21.2231802Z  try: 2025-07-17T06:38:21.2232219Z  if settings_text: 2025-07-17T06:38:21.2233023Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:38:21.2233862Z  # for easy reading 2025-07-17T06:38:21.2234739Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:38:21.2235680Z  # the backtick character in shell commands. 2025-07-17T06:38:21.2236346Z  backtick = chr(96) # backtick character 2025-07-17T06:38:21.2237094Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:38:21.2237933Z  settings = load_yaml(settings_text) 2025-07-17T06:38:21.2238496Z  2025-07-17T06:38:21.2239140Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:38:21.2240103Z  experiments = {} 2025-07-17T06:38:21.2240602Z  2025-07-17T06:38:21.2241211Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:38:21.2242038Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:38:21.2243236Z  # 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:38:21.2244708Z  continue 2025-07-17T06:38:21.2245217Z  2025-07-17T06:38:21.2245624Z  valid_settings = {} 2025-07-17T06:38:21.2246212Z  for setting in exp_settings: 2025-07-17T06:38:21.2246831Z  if setting not in Experiment._fields: 2025-07-17T06:38:21.2247562Z  log.warning( 2025-07-17T06:38:21.2248366Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:38:21.2249133Z  ) 2025-07-17T06:38:21.2249628Z  else: 2025-07-17T06:38:21.2250211Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:38:21.2250828Z  2025-07-17T06:38:21.2251338Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:38:21.2252035Z  return Settings(experiments) 2025-07-17T06:38:21.2252573Z  2025-07-17T06:38:21.2252969Z  except Exception: 2025-07-17T06:38:21.2253527Z  log.exception("Failed to parse settings") 2025-07-17T06:38:21.2254117Z  2025-07-17T06:38:21.2254506Z  return Settings() 2025-07-17T06:38:21.2254973Z  2025-07-17T06:38:21.2255340Z  2025-07-17T06:38:21.2255967Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:38:21.2256613Z  """ 2025-07-17T06:38:21.2257116Z  Parse settings, if any, from the rollout state. 2025-07-17T06:38:21.2257822Z  2025-07-17T06:38:21.2258415Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:21.2259243Z  and the text below is the list of opted in users. 2025-07-17T06:38:21.2259843Z  2025-07-17T06:38:21.2260485Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:38:21.2261266Z  """ 2025-07-17T06:38:21.2261893Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:21.2262732Z  return parse_settings_from_text(settings_text) 2025-07-17T06:38:21.2263320Z  2025-07-17T06:38:21.2263684Z  2025-07-17T06:38:21.2264186Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:38:21.2264794Z  """ 2025-07-17T06:38:21.2265249Z  Parse users from the rollout state. 2025-07-17T06:38:21.2265800Z  2025-07-17T06:38:21.2266172Z  """ 2025-07-17T06:38:21.2266776Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:21.2267748Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:38:21.2268348Z  2025-07-17T06:38:21.2268714Z  2025-07-17T06:38:21.2269389Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:21.2270184Z  """ 2025-07-17T06:38:21.2270676Z  Check if a user is opted into an experiment 2025-07-17T06:38:21.2271251Z  """ 2025-07-17T06:38:21.2271776Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:38:21.2272399Z  2025-07-17T06:38:21.2272897Z  2025-07-17T06:38:21.2273594Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:21.2274402Z  """ 2025-07-17T06:38:21.2274934Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:38:21.2275564Z  """ 2025-07-17T06:38:21.2276140Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:38:21.2276890Z  experiment_optout = "-" + experiment_name 2025-07-17T06:38:21.2277723Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:38:21.2278373Z  return False 2025-07-17T06:38:21.2278831Z  2025-07-17T06:38:21.2279333Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:38:21.2279995Z  log.warning( 2025-07-17T06:38:21.2280896Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:38:21.2281834Z  ) 2025-07-17T06:38:21.2282238Z  2025-07-17T06:38:21.2282627Z  return True 2025-07-17T06:38:21.2283068Z  2025-07-17T06:38:21.2283440Z  2025-07-17T06:38:21.2283833Z def get_runner_prefix( 2025-07-17T06:38:21.2284375Z  rollout_state: str, 2025-07-17T06:38:21.2284913Z  workflow_requestors: Iterable[str], 2025-07-17T06:38:21.2285473Z  branch: str, 2025-07-17T06:38:21.2286090Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:21.2286836Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:21.2287574Z  is_canary: bool = False, 2025-07-17T06:38:21.2288107Z ) -> str: 2025-07-17T06:38:21.2288592Z  settings = parse_settings(rollout_state) 2025-07-17T06:38:21.2289245Z  user_optins = parse_users(rollout_state) 2025-07-17T06:38:21.2289814Z  2025-07-17T06:38:21.2290382Z  fleet_prefix = "" 2025-07-17T06:38:21.2290885Z  prefixes = [] 2025-07-17T06:38:21.2291614Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:38:21.2292635Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:38:21.2293404Z  log.info( 2025-07-17T06:38:21.2294164Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:38:21.2294970Z  ) 2025-07-17T06:38:21.2295408Z  continue 2025-07-17T06:38:21.2295867Z  2025-07-17T06:38:21.2296282Z  if opt_out_experiments: 2025-07-17T06:38:21.2296907Z  if experiment_name in opt_out_experiments: 2025-07-17T06:38:21.2297716Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:38:21.2298373Z  log.info( 2025-07-17T06:38:21.2299385Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:38:21.2300415Z  ) 2025-07-17T06:38:21.2300875Z  continue 2025-07-17T06:38:21.2301358Z  2025-07-17T06:38:21.2301777Z  if eligible_experiments: 2025-07-17T06:38:21.2302411Z  if experiment_name not in eligible_experiments: 2025-07-17T06:38:21.2303109Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:38:21.2303703Z  log.info( 2025-07-17T06:38:21.2304572Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:38:21.2305460Z  ) 2025-07-17T06:38:21.2306056Z  continue 2025-07-17T06:38:21.2306617Z  elif not experiment_settings.default: 2025-07-17T06:38:21.2307192Z  log.info( 2025-07-17T06:38:21.2308089Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:38:21.2308871Z  ) 2025-07-17T06:38:21.2309310Z  continue 2025-07-17T06:38:21.2309763Z  2025-07-17T06:38:21.2310283Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:38:21.2310955Z  opted_out_users = [ 2025-07-17T06:38:21.2311477Z  requestor 2025-07-17T06:38:21.2312024Z  for requestor in workflow_requestors 2025-07-17T06:38:21.2312763Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:38:21.2313445Z  ] 2025-07-17T06:38:21.2313858Z  2025-07-17T06:38:21.2314276Z  if opted_out_users: 2025-07-17T06:38:21.2314802Z  log.info( 2025-07-17T06:38:21.2315508Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:38:21.2316253Z  ) 2025-07-17T06:38:21.2316695Z  continue 2025-07-17T06:38:21.2317161Z  2025-07-17T06:38:21.2317792Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:38:21.2318495Z  opted_in_users = [ 2025-07-17T06:38:21.2319030Z  requestor 2025-07-17T06:38:21.2319571Z  for requestor in workflow_requestors 2025-07-17T06:38:21.2320315Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:38:21.2320983Z  ] 2025-07-17T06:38:21.2321391Z  2025-07-17T06:38:21.2321779Z  enabled = False 2025-07-17T06:38:21.2322316Z  if opted_in_users: 2025-07-17T06:38:21.2322965Z  log.info( 2025-07-17T06:38:21.2323683Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:38:21.2324426Z  ) 2025-07-17T06:38:21.2324870Z  enabled = True 2025-07-17T06:38:21.2325363Z  2025-07-17T06:38:21.2325813Z  elif experiment_settings.rollout_perc: 2025-07-17T06:38:21.2326720Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:38:21.2327863Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:38:21.2328577Z  log.info( 2025-07-17T06:38:21.2329557Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:38:21.2330542Z  ) 2025-07-17T06:38:21.2331040Z  enabled = True 2025-07-17T06:38:21.2331553Z  2025-07-17T06:38:21.2331940Z  if enabled: 2025-07-17T06:38:21.2332442Z  label = experiment_name 2025-07-17T06:38:21.2333073Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:38:21.2333980Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:38:21.2334935Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:38:21.2335772Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:38:21.2336492Z  if is_canary: 2025-07-17T06:38:21.2337055Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:38:21.2337794Z  fleet_prefix = label 2025-07-17T06:38:21.2338344Z  else: 2025-07-17T06:38:21.2339036Z  prefixes.append(label) 2025-07-17T06:38:21.2339585Z  2025-07-17T06:38:21.2339988Z  if len(prefixes) > 1: 2025-07-17T06:38:21.2340500Z  log.error( 2025-07-17T06:38:21.2341655Z  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:38:21.2342859Z  ) 2025-07-17T06:38:21.2343301Z  prefixes = prefixes[:1] 2025-07-17T06:38:21.2343824Z  2025-07-17T06:38:21.2344223Z  # Fleet always comes first 2025-07-17T06:38:21.2344773Z  if fleet_prefix: 2025-07-17T06:38:21.2345293Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:38:21.2345850Z  2025-07-17T06:38:21.2346344Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:38:21.2346959Z  2025-07-17T06:38:21.2347328Z  2025-07-17T06:38:21.2348132Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:38:21.2348968Z  """ 2025-07-17T06:38:21.2349622Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:38:21.2350375Z  2025-07-17T06:38:21.2351002Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:38:21.2351756Z  """ 2025-07-17T06:38:21.2352206Z  gh = get_gh_client(github_token) 2025-07-17T06:38:21.2352813Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:38:21.2353531Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:38:21.2354165Z  2025-07-17T06:38:21.2354545Z  2025-07-17T06:38:21.2355189Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:38:21.2356169Z  for _ in range(num_retries): 2025-07-17T06:38:21.2356711Z  try: 2025-07-17T06:38:21.2357205Z  req = Request(url=url, headers=headers) 2025-07-17T06:38:21.2358034Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:38:21.2358734Z  return json.loads(content) 2025-07-17T06:38:21.2359310Z  except Exception as e: 2025-07-17T06:38:21.2359936Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:38:21.2360530Z  2025-07-17T06:38:21.2361159Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:38:21.2361932Z  return {} 2025-07-17T06:38:21.2362365Z  2025-07-17T06:38:21.2362721Z  2025-07-17T06:38:21.2363091Z @cache 2025-07-17T06:38:21.2363786Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:38:21.2364609Z  """ 2025-07-17T06:38:21.2365065Z  Dynamically get PR information 2025-07-17T06:38:21.2365600Z  """ 2025-07-17T06:38:21.2366162Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:38:21.2366831Z  headers = { 2025-07-17T06:38:21.2367367Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:38:21.2368130Z  "Authorization": f"token {github_token}", 2025-07-17T06:38:21.2368709Z  } 2025-07-17T06:38:21.2369202Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:38:21.2369868Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:38:21.2370450Z  headers=headers, 2025-07-17T06:38:21.2370941Z  ) 2025-07-17T06:38:21.2371333Z  2025-07-17T06:38:21.2371723Z  if not json_response: 2025-07-17T06:38:21.2372380Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:38:21.2373200Z  return {} 2025-07-17T06:38:21.2373659Z  2025-07-17T06:38:21.2374054Z  return json_response 2025-07-17T06:38:21.2374542Z  2025-07-17T06:38:21.2374911Z  2025-07-17T06:38:21.2375544Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:38:21.2376332Z  """ 2025-07-17T06:38:21.2376938Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:38:21.2377751Z  """ 2025-07-17T06:38:21.2378295Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:38:21.2378959Z  return { 2025-07-17T06:38:21.2379618Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:38:21.2380356Z  } 2025-07-17T06:38:21.2380750Z  2025-07-17T06:38:21.2381123Z  2025-07-17T06:38:21.2381516Z def main() -> None: 2025-07-17T06:38:21.2382007Z  args = parse_args() 2025-07-17T06:38:21.2382491Z  2025-07-17T06:38:21.2382943Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:38:21.2383528Z  2025-07-17T06:38:21.2383956Z  # Check if the PR is opt-out 2025-07-17T06:38:21.2384503Z  if args.pr_number: 2025-07-17T06:38:21.2385255Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:38:21.2386108Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:38:21.2386666Z  log.info( 2025-07-17T06:38:21.2387538Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:38:21.2388362Z  ) 2025-07-17T06:38:21.2388990Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:21.2389727Z  sys.exit() 2025-07-17T06:38:21.2390337Z  2025-07-17T06:38:21.2390723Z  try: 2025-07-17T06:38:21.2391229Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:38:21.2392000Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:38:21.2392694Z  ) 2025-07-17T06:38:21.2393102Z  2025-07-17T06:38:21.2393534Z  username = get_potential_pr_author( 2025-07-17T06:38:21.2394121Z  args.github_token, 2025-07-17T06:38:21.2394667Z  args.github_repo, 2025-07-17T06:38:21.2395202Z  args.github_actor, 2025-07-17T06:38:21.2395751Z  args.github_ref_type, 2025-07-17T06:38:21.2396310Z  args.github_branch, 2025-07-17T06:38:21.2396826Z  ) 2025-07-17T06:38:21.2397228Z  2025-07-17T06:38:21.2398166Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:38:21.2398990Z  2025-07-17T06:38:21.2399457Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:38:21.2400055Z  rollout_state, 2025-07-17T06:38:21.2400626Z  (args.github_issue_owner, username), 2025-07-17T06:38:21.2401211Z  args.github_branch, 2025-07-17T06:38:21.2401788Z  args.eligible_experiments, 2025-07-17T06:38:21.2402385Z  args.opt_out_experiments, 2025-07-17T06:38:21.2402941Z  is_canary, 2025-07-17T06:38:21.2403426Z  ) 2025-07-17T06:38:21.2403829Z  2025-07-17T06:38:21.2404233Z  except Exception as e: 2025-07-17T06:38:21.2404767Z  log.error( 2025-07-17T06:38:21.2405552Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:38:21.2406536Z  ) 2025-07-17T06:38:21.2406950Z  2025-07-17T06:38:21.2407648Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:21.2408357Z  2025-07-17T06:38:21.2408727Z  2025-07-17T06:38:21.2409113Z if __name__ == "__main__": 2025-07-17T06:38:21.2409612Z  main() 2025-07-17T06:38:21.2410029Z  2025-07-17T06:38:21.2410400Z EOF 2025-07-17T06:38:21.2410772Z  2025-07-17T06:38:21.2411180Z cat runner_determinator.py 2025-07-17T06:38:21.3379156Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:21.3380006Z env: 2025-07-17T06:38:21.3380715Z GITHUB_TOKEN: *** 2025-07-17T06:38:21.3381142Z ISSUE_NUMBER: 5132 2025-07-17T06:38:21.3381603Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:21.3382123Z ISSUE_OWNER: 2025-07-17T06:38:21.3382539Z CHECK_EXPERIMENTS: 2025-07-17T06:38:21.3382981Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:21.3383424Z PR_NUMBER: 2025-07-17T06:38:21.3383835Z ##[endgroup] 2025-07-17T06:38:21.3586762Z # flake8: noqa: G004 2025-07-17T06:38:21.3587109Z 2025-07-17T06:38:21.3587897Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:38:21.3588869Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:38:21.3589658Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:38:21.3590105Z 2025-07-17T06:38:21.3590266Z """ 2025-07-17T06:38:21.3590841Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:38:21.3591718Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:38:21.3592631Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:38:21.3593438Z of which runners should be used to run which job. 2025-07-17T06:38:21.3593843Z 2025-07-17T06:38:21.3594235Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:38:21.3595336Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:38:21.3596262Z settings are considered to be empty with only the second part, the user 2025-07-17T06:38:21.3596974Z list, defined. 2025-07-17T06:38:21.3597214Z 2025-07-17T06:38:21.3597925Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:38:21.3598936Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:38:21.3599775Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:38:21.3600236Z 2025-07-17T06:38:21.3600610Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:38:21.3601479Z The user list is also a comma separated list of additional features or 2025-07-17T06:38:21.3602221Z experiments which the user could be opted in to. 2025-07-17T06:38:21.3602627Z 2025-07-17T06:38:21.3602837Z The user list has the following rules: 2025-07-17T06:38:21.3603181Z 2025-07-17T06:38:21.3603519Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:38:21.3604386Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:38:21.3605149Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:38:21.3605552Z 2025-07-17T06:38:21.3605723Z Example config: 2025-07-17T06:38:21.3606170Z # A list of experiments that can be opted into. 2025-07-17T06:38:21.3606859Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:38:21.3607694Z # Expected syntax is: 2025-07-17T06:38:21.3608388Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:38:21.3609369Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:38:21.3609977Z 2025-07-17T06:38:21.3610151Z experiments: 2025-07-17T06:38:21.3610551Z lf: 2025-07-17T06:38:21.3610926Z rollout_percent: 25 2025-07-17T06:38:21.3611580Z all_branches: false 2025-07-17T06:38:21.3612039Z default: true 2025-07-17T06:38:21.3612461Z --- 2025-07-17T06:38:21.3612666Z 2025-07-17T06:38:21.3612832Z # Opt-ins: 2025-07-17T06:38:21.3613407Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:38:21.3614290Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:38:21.3615057Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:38:21.3615712Z # Experiments should be from the above list. 2025-07-17T06:38:21.3616091Z 2025-07-17T06:38:21.3616279Z @User1,-lf,split_build 2025-07-17T06:38:21.3616729Z @User2,lf 2025-07-17T06:38:21.3617125Z @User3,split_build 2025-07-17T06:38:21.3617754Z """ 2025-07-17T06:38:21.3617991Z 2025-07-17T06:38:21.3618223Z import json 2025-07-17T06:38:21.3618601Z import logging 2025-07-17T06:38:21.3618990Z import os 2025-07-17T06:38:21.3619361Z import random 2025-07-17T06:38:21.3619745Z import re 2025-07-17T06:38:21.3620112Z import sys 2025-07-17T06:38:21.3620522Z from argparse import ArgumentParser 2025-07-17T06:38:21.3621052Z from collections.abc import Iterable 2025-07-17T06:38:21.3621579Z from functools import cache 2025-07-17T06:38:21.3622051Z from logging import LogRecord 2025-07-17T06:38:21.3622560Z from typing import Any, NamedTuple 2025-07-17T06:38:21.3623100Z from urllib.request import Request, urlopen 2025-07-17T06:38:21.3623469Z 2025-07-17T06:38:21.3623637Z import yaml 2025-07-17T06:38:21.3624033Z from github import Auth, Github 2025-07-17T06:38:21.3624517Z from github.Issue import Issue 2025-07-17T06:38:21.3624829Z 2025-07-17T06:38:21.3624837Z 2025-07-17T06:38:21.3625058Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:38:21.3625751Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:38:21.3626615Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:38:21.3627165Z 2025-07-17T06:38:21.3627402Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:38:21.3628357Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:38:21.3628910Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:38:21.3629465Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:38:21.3629834Z 2025-07-17T06:38:21.3630038Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:38:21.3630374Z 2025-07-17T06:38:21.3630563Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:38:21.3631033Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:38:21.3631317Z 2025-07-17T06:38:21.3631324Z 2025-07-17T06:38:21.3631522Z class Experiment(NamedTuple): 2025-07-17T06:38:21.3632013Z rollout_perc: float = ( 2025-07-17T06:38:21.3632660Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:38:21.3633335Z ) 2025-07-17T06:38:21.3633717Z all_branches: bool = ( 2025-07-17T06:38:21.3634334Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:38:21.3635018Z ) 2025-07-17T06:38:21.3635388Z default: bool = ( 2025-07-17T06:38:21.3635961Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:38:21.3636618Z ) 2025-07-17T06:38:21.3636813Z 2025-07-17T06:38:21.3636994Z # Add more fields as needed 2025-07-17T06:38:21.3637299Z 2025-07-17T06:38:21.3637306Z 2025-07-17T06:38:21.3637613Z class Settings(NamedTuple): 2025-07-17T06:38:21.3638061Z """ 2025-07-17T06:38:21.3638513Z Settings for the experiments that can be opted into. 2025-07-17T06:38:21.3639083Z """ 2025-07-17T06:38:21.3639283Z 2025-07-17T06:38:21.3639487Z experiments: dict[str, Experiment] = {} 2025-07-17T06:38:21.3639852Z 2025-07-17T06:38:21.3639860Z 2025-07-17T06:38:21.3640070Z class ColorFormatter(logging.Formatter): 2025-07-17T06:38:21.3640695Z """Color codes the log messages based on the log level""" 2025-07-17T06:38:21.3641128Z 2025-07-17T06:38:21.3641300Z COLORS = { 2025-07-17T06:38:21.3641704Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:38:21.3642348Z "ERROR": "\033[31m", # Red 2025-07-17T06:38:21.3642839Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:38:21.3643358Z "INFO": "\033[0m", # Reset 2025-07-17T06:38:21.3643848Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:38:21.3644326Z } 2025-07-17T06:38:21.3644526Z 2025-07-17T06:38:21.3644755Z def format(self, record: LogRecord) -> str: 2025-07-17T06:38:21.3645494Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:38:21.3646277Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:38:21.3646854Z return super().format(record) 2025-07-17T06:38:21.3647202Z 2025-07-17T06:38:21.3647209Z 2025-07-17T06:38:21.3647409Z handler = logging.StreamHandler() 2025-07-17T06:38:21.3648243Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:38:21.3648801Z 2025-07-17T06:38:21.3649045Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:38:21.3649652Z log.addHandler(handler) 2025-07-17T06:38:21.3650102Z log.setLevel(logging.INFO) 2025-07-17T06:38:21.3650402Z 2025-07-17T06:38:21.3650410Z 2025-07-17T06:38:21.3650656Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:38:21.3651217Z """ 2025-07-17T06:38:21.3651729Z Defines outputs of the github action that invokes this script 2025-07-17T06:38:21.3652373Z """ 2025-07-17T06:38:21.3652737Z if not GITHUB_OUTPUT: 2025-07-17T06:38:21.3653811Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:38:21.3654920Z log.warning( 2025-07-17T06:38:21.3655805Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:38:21.3656736Z ) 2025-07-17T06:38:21.3666694Z print(f"::set-output name={key}::{value}") 2025-07-17T06:38:21.3667320Z return 2025-07-17T06:38:21.3667755Z 2025-07-17T06:38:21.3668190Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:38:21.3668805Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:38:21.3669391Z f.write(f"{key}={value}\n") 2025-07-17T06:38:21.3669721Z 2025-07-17T06:38:21.3669737Z 2025-07-17T06:38:21.3670048Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:38:21.3670683Z return frozenset( 2025-07-17T06:38:21.3671300Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:38:21.3671986Z ) 2025-07-17T06:38:21.3672193Z 2025-07-17T06:38:21.3672201Z 2025-07-17T06:38:21.3672386Z def parse_args() -> Any: 2025-07-17T06:38:21.3672956Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:38:21.3673813Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:38:21.3674587Z parser.add_argument( 2025-07-17T06:38:21.3675047Z "--github-issue-repo", 2025-07-17T06:38:21.3675520Z type=str, 2025-07-17T06:38:21.3675919Z required=False, 2025-07-17T06:38:21.3676374Z default="pytorch/test-infra", 2025-07-17T06:38:21.3676906Z help="GitHub repo to get the issue", 2025-07-17T06:38:21.3677538Z ) 2025-07-17T06:38:21.3677921Z parser.add_argument( 2025-07-17T06:38:21.3678375Z "--github-repo", 2025-07-17T06:38:21.3678815Z type=str, 2025-07-17T06:38:21.3679228Z required=True, 2025-07-17T06:38:21.3679705Z help="GitHub repo where CI is running", 2025-07-17T06:38:21.3680231Z ) 2025-07-17T06:38:21.3680605Z parser.add_argument( 2025-07-17T06:38:21.3681213Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:38:21.3681875Z ) 2025-07-17T06:38:21.3682246Z parser.add_argument( 2025-07-17T06:38:21.3682868Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:38:21.3683549Z ) 2025-07-17T06:38:21.3683914Z parser.add_argument( 2025-07-17T06:38:21.3684719Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:38:21.3685411Z ) 2025-07-17T06:38:21.3685789Z parser.add_argument( 2025-07-17T06:38:21.3686454Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:38:21.3687211Z ) 2025-07-17T06:38:21.3687709Z parser.add_argument( 2025-07-17T06:38:21.3688215Z "--github-ref-type", 2025-07-17T06:38:21.3738929Z type=str, 2025-07-17T06:38:21.3739451Z required=True, 2025-07-17T06:38:21.3739999Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:38:21.3740581Z ) 2025-07-17T06:38:21.3740978Z parser.add_argument( 2025-07-17T06:38:21.3741465Z "--eligible-experiments", 2025-07-17T06:38:21.3742014Z type=_str_comma_separated_to_set, 2025-07-17T06:38:21.3742551Z required=False, 2025-07-17T06:38:21.3742991Z default="", 2025-07-17T06:38:21.3743892Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:38:21.3744846Z ) 2025-07-17T06:38:21.3745240Z parser.add_argument( 2025-07-17T06:38:21.3745715Z "--opt-out-experiments", 2025-07-17T06:38:21.3746248Z type=_str_comma_separated_to_set, 2025-07-17T06:38:21.3746795Z required=False, 2025-07-17T06:38:21.3747231Z default="", 2025-07-17T06:38:21.3747751Z help=( 2025-07-17T06:38:21.3748452Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:38:21.3749638Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:38:21.3750489Z ), 2025-07-17T06:38:21.3750864Z ) 2025-07-17T06:38:21.3751236Z parser.add_argument( 2025-07-17T06:38:21.3751694Z "--pr-number", 2025-07-17T06:38:21.3752117Z type=str, 2025-07-17T06:38:21.3752539Z required=False, 2025-07-17T06:38:21.3752979Z default="", 2025-07-17T06:38:21.3753647Z help="the optional PR number where this is run", 2025-07-17T06:38:21.3754252Z ) 2025-07-17T06:38:21.3754463Z 2025-07-17T06:38:21.3754663Z return parser.parse_args() 2025-07-17T06:38:21.3754982Z 2025-07-17T06:38:21.3754990Z 2025-07-17T06:38:21.3755418Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:38:21.3756201Z auth = Auth.Token(github_token) 2025-07-17T06:38:21.3756737Z return Github(auth=auth) 2025-07-17T06:38:21.3757049Z 2025-07-17T06:38:21.3757056Z 2025-07-17T06:38:21.3757640Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:38:21.3758487Z repo = gh.get_repo(repo) 2025-07-17T06:38:21.3759015Z return repo.get_issue(number=issue_num) 2025-07-17T06:38:21.3759393Z 2025-07-17T06:38:21.3759400Z 2025-07-17T06:38:21.3759600Z def get_potential_pr_author( 2025-07-17T06:38:21.3760288Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:38:21.3760994Z ) -> str: 2025-07-17T06:38:21.3761535Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:38:21.3762374Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:38:21.3763141Z # embedded in the tag name: ciflow// 2025-07-17T06:38:21.3763572Z 2025-07-17T06:38:21.3763780Z gh = get_gh_client(github_token) 2025-07-17T06:38:21.3764124Z 2025-07-17T06:38:21.3764410Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:38:21.3765061Z split_tag = ref_name.split("/") 2025-07-17T06:38:21.3765578Z if ( 2025-07-17T06:38:21.3765987Z len(split_tag) == 3 2025-07-17T06:38:21.3766496Z and split_tag[0] == "ciflow" 2025-07-17T06:38:21.3767044Z and split_tag[2].isnumeric() 2025-07-17T06:38:21.3767673Z ): 2025-07-17T06:38:21.3768077Z pr_number = split_tag[2] 2025-07-17T06:38:21.3768729Z try: 2025-07-17T06:38:21.3769180Z repository = gh.get_repo(repo) 2025-07-17T06:38:21.3769813Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:38:21.3770433Z except Exception as e: 2025-07-17T06:38:21.3770967Z raise Exception( # noqa: TRY002 2025-07-17T06:38:21.3771653Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:38:21.3772321Z ) from e 2025-07-17T06:38:21.3772881Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:38:21.3773605Z # In all other cases, return the original input username 2025-07-17T06:38:21.3774233Z return username 2025-07-17T06:38:21.3774499Z 2025-07-17T06:38:21.3774507Z 2025-07-17T06:38:21.3774739Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:38:21.3775293Z """ 2025-07-17T06:38:21.3775956Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:38:21.3776761Z """ 2025-07-17T06:38:21.3777329Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:38:21.3777979Z 2025-07-17T06:38:21.3777987Z 2025-07-17T06:38:21.3778199Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:38:21.3778707Z try: 2025-07-17T06:38:21.3779105Z data = yaml.safe_load(yaml_text) 2025-07-17T06:38:21.3779634Z return data 2025-07-17T06:38:21.3780058Z except yaml.YAMLError: 2025-07-17T06:38:21.3780561Z log.exception("Error loading YAML") 2025-07-17T06:38:21.3781085Z raise 2025-07-17T06:38:21.3781314Z 2025-07-17T06:38:21.3781322Z 2025-07-17T06:38:21.3781760Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:38:21.3782530Z """ 2025-07-17T06:38:21.3783170Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:38:21.3783802Z 2025-07-17T06:38:21.3784291Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:21.3785093Z and the text below is the list of opted in users. 2025-07-17T06:38:21.3785523Z 2025-07-17T06:38:21.3785935Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:38:21.3786664Z """ 2025-07-17T06:38:21.3787128Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:38:21.3787887Z if len(rollout_state_parts) >= 2: 2025-07-17T06:38:21.3788514Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:38:21.3789124Z else: 2025-07-17T06:38:21.3789525Z return "", rollout_state 2025-07-17T06:38:21.3789850Z 2025-07-17T06:38:21.3789858Z 2025-07-17T06:38:21.3790073Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:38:21.3790593Z """ 2025-07-17T06:38:21.3791135Z Dictionary of users with a list of features they have opted into 2025-07-17T06:38:21.3791808Z """ 2025-07-17T06:38:21.3792028Z 2025-07-17T06:38:21.3792035Z 2025-07-17T06:38:21.3792390Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:38:21.3793069Z """ 2025-07-17T06:38:21.3793805Z 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:38:21.3794519Z 2025-07-17T06:38:21.3795153Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:38:21.3796192Z - Example line: "@User1,lf,split_build" 2025-07-17T06:38:21.3796897Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:38:21.3797402Z 2025-07-17T06:38:21.3797419Z 2025-07-17T06:38:21.3797730Z """ 2025-07-17T06:38:21.3798123Z optins = UserOptins() 2025-07-17T06:38:21.3798709Z for user in user_optin_text.split("\n"): 2025-07-17T06:38:21.3799281Z user = user.strip("\r\n\t -") 2025-07-17T06:38:21.3799852Z if not user or not user.startswith("@"): 2025-07-17T06:38:21.3800592Z # Not a valid user. Skip 2025-07-17T06:38:21.3801099Z continue 2025-07-17T06:38:21.3801357Z 2025-07-17T06:38:21.3801530Z if user: 2025-07-17T06:38:21.3801984Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:38:21.3802705Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:38:21.3803213Z 2025-07-17T06:38:21.3803385Z return optins 2025-07-17T06:38:21.3803636Z 2025-07-17T06:38:21.3803643Z 2025-07-17T06:38:21.3803934Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:38:21.3804561Z """ 2025-07-17T06:38:21.3804971Z Check if the experiment name is valid. 2025-07-17T06:38:21.3805511Z A valid name: 2025-07-17T06:38:21.3806163Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:38:21.3807158Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:38:21.3808035Z - Cannot contain spaces 2025-07-17T06:38:21.3808519Z """ 2025-07-17T06:38:21.3808729Z 2025-07-17T06:38:21.3809002Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:38:21.3809728Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:38:21.3810186Z 2025-07-17T06:38:21.3810365Z if valid: 2025-07-17T06:38:21.3810761Z return True 2025-07-17T06:38:21.3811007Z 2025-07-17T06:38:21.3811185Z log.error( 2025-07-17T06:38:21.3812695Z 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:38:21.3814300Z ) 2025-07-17T06:38:21.3814678Z return False 2025-07-17T06:38:21.3814927Z 2025-07-17T06:38:21.3814935Z 2025-07-17T06:38:21.3815250Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:38:21.3815908Z """ 2025-07-17T06:38:21.3816646Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:38:21.3817422Z """ 2025-07-17T06:38:21.3817894Z try: 2025-07-17T06:38:21.3818288Z if settings_text: 2025-07-17T06:38:21.3819060Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:38:21.3819883Z # for easy reading 2025-07-17T06:38:21.3820714Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:38:21.3821639Z # the backtick character in shell commands. 2025-07-17T06:38:21.3822277Z backtick = chr(96) # backtick character 2025-07-17T06:38:21.3822961Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:38:21.3823666Z settings = load_yaml(settings_text) 2025-07-17T06:38:21.3824064Z 2025-07-17T06:38:21.3824498Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:38:21.3825294Z experiments = {} 2025-07-17T06:38:21.3825608Z 2025-07-17T06:38:21.3826008Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:38:21.3826811Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:38:21.3828085Z # 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:38:21.3829223Z continue 2025-07-17T06:38:21.3829528Z 2025-07-17T06:38:21.3829721Z valid_settings = {} 2025-07-17T06:38:21.3830264Z for setting in exp_settings: 2025-07-17T06:38:21.3830866Z if setting not in Experiment._fields: 2025-07-17T06:38:21.3831445Z log.warning( 2025-07-17T06:38:21.3832189Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:38:21.3833094Z ) 2025-07-17T06:38:21.3833533Z else: 2025-07-17T06:38:21.3834070Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:38:21.3834508Z 2025-07-17T06:38:21.3834802Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:38:21.3835460Z return Settings(experiments) 2025-07-17T06:38:21.3835835Z 2025-07-17T06:38:21.3836017Z except Exception: 2025-07-17T06:38:21.3836514Z log.exception("Failed to parse settings") 2025-07-17T06:38:21.3836924Z 2025-07-17T06:38:21.3837105Z return Settings() 2025-07-17T06:38:21.3837371Z 2025-07-17T06:38:21.3837379Z 2025-07-17T06:38:21.3837797Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:38:21.3838394Z """ 2025-07-17T06:38:21.3838861Z Parse settings, if any, from the rollout state. 2025-07-17T06:38:21.3839283Z 2025-07-17T06:38:21.3839653Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:38:21.3840456Z and the text below is the list of opted in users. 2025-07-17T06:38:21.3840879Z 2025-07-17T06:38:21.3841302Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:38:21.3842078Z """ 2025-07-17T06:38:21.3842656Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:21.3843716Z return parse_settings_from_text(settings_text) 2025-07-17T06:38:21.3844477Z 2025-07-17T06:38:21.3844495Z 2025-07-17T06:38:21.3844807Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:38:21.3845404Z """ 2025-07-17T06:38:21.3845816Z Parse users from the rollout state. 2025-07-17T06:38:21.3846188Z 2025-07-17T06:38:21.3846351Z """ 2025-07-17T06:38:21.3846911Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:38:21.3847856Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:38:21.3848303Z 2025-07-17T06:38:21.3848310Z 2025-07-17T06:38:21.3848921Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:21.3849731Z """ 2025-07-17T06:38:21.3850192Z Check if a user is opted into an experiment 2025-07-17T06:38:21.3850759Z """ 2025-07-17T06:38:21.3851230Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:38:21.3851676Z 2025-07-17T06:38:21.3851684Z 2025-07-17T06:38:21.3852124Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:38:21.3852905Z """ 2025-07-17T06:38:21.3853380Z Check if a user explicitly opted out of an experiment 2025-07-17T06:38:21.3853986Z """ 2025-07-17T06:38:21.3854505Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:38:21.3855214Z experiment_optout = "-" + experiment_name 2025-07-17T06:38:21.3855892Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:38:21.3856528Z return False 2025-07-17T06:38:21.3856800Z 2025-07-17T06:38:21.3857250Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:38:21.3858153Z log.warning( 2025-07-17T06:38:21.3859018Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:38:21.3859930Z ) 2025-07-17T06:38:21.3860153Z 2025-07-17T06:38:21.3860325Z return True 2025-07-17T06:38:21.3860572Z 2025-07-17T06:38:21.3860580Z 2025-07-17T06:38:21.3860772Z def get_runner_prefix( 2025-07-17T06:38:21.3861233Z rollout_state: str, 2025-07-17T06:38:21.3861724Z workflow_requestors: Iterable[str], 2025-07-17T06:38:21.3862264Z branch: str, 2025-07-17T06:38:21.3862781Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:21.3863477Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:38:21.3864102Z is_canary: bool = False, 2025-07-17T06:38:21.3864707Z ) -> str: 2025-07-17T06:38:21.3865604Z settings = parse_settings(rollout_state) 2025-07-17T06:38:21.3866234Z user_optins = parse_users(rollout_state) 2025-07-17T06:38:21.3866633Z 2025-07-17T06:38:21.3866816Z fleet_prefix = "" 2025-07-17T06:38:21.3867271Z prefixes = [] 2025-07-17T06:38:21.3868095Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:38:21.3869079Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:38:21.3869812Z log.info( 2025-07-17T06:38:21.3870510Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:38:21.3871293Z ) 2025-07-17T06:38:21.3871675Z continue 2025-07-17T06:38:21.3871927Z 2025-07-17T06:38:21.3872133Z if opt_out_experiments: 2025-07-17T06:38:21.3872684Z if experiment_name in opt_out_experiments: 2025-07-17T06:38:21.3873551Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:38:21.3874379Z log.info( 2025-07-17T06:38:21.3875306Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:38:21.3876279Z ) 2025-07-17T06:38:21.3876675Z continue 2025-07-17T06:38:21.3876947Z 2025-07-17T06:38:21.3877136Z if eligible_experiments: 2025-07-17T06:38:21.3877914Z if experiment_name not in eligible_experiments: 2025-07-17T06:38:21.3878570Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:38:21.3879124Z log.info( 2025-07-17T06:38:21.3879890Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:38:21.3880720Z ) 2025-07-17T06:38:21.3881115Z continue 2025-07-17T06:38:21.3881582Z elif not experiment_settings.default: 2025-07-17T06:38:21.3882137Z log.info( 2025-07-17T06:38:21.3882939Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:38:21.3883701Z ) 2025-07-17T06:38:21.3884075Z continue 2025-07-17T06:38:21.3884318Z 2025-07-17T06:38:21.3884597Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:38:21.3885206Z opted_out_users = [ 2025-07-17T06:38:21.3885655Z requestor 2025-07-17T06:38:21.3886102Z for requestor in workflow_requestors 2025-07-17T06:38:21.3886759Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:38:21.3887385Z ] 2025-07-17T06:38:21.3887750Z 2025-07-17T06:38:21.3887932Z if opted_out_users: 2025-07-17T06:38:21.3888387Z log.info( 2025-07-17T06:38:21.3889007Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:38:21.3889712Z ) 2025-07-17T06:38:21.3890083Z continue 2025-07-17T06:38:21.3890337Z 2025-07-17T06:38:21.3890613Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:38:21.3891212Z opted_in_users = [ 2025-07-17T06:38:21.3891657Z requestor 2025-07-17T06:38:21.3892101Z for requestor in workflow_requestors 2025-07-17T06:38:21.3892752Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:38:21.3893366Z ] 2025-07-17T06:38:21.3893570Z 2025-07-17T06:38:21.3893742Z enabled = False 2025-07-17T06:38:21.3894172Z if opted_in_users: 2025-07-17T06:38:21.3894602Z log.info( 2025-07-17T06:38:21.3895200Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:38:21.3895880Z ) 2025-07-17T06:38:21.3896269Z enabled = True 2025-07-17T06:38:21.3896546Z 2025-07-17T06:38:21.3896762Z elif experiment_settings.rollout_perc: 2025-07-17T06:38:21.3897726Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:38:21.3898859Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:38:21.3899533Z log.info( 2025-07-17T06:38:21.3900398Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:38:21.3901337Z ) 2025-07-17T06:38:21.3901754Z enabled = True 2025-07-17T06:38:21.3902052Z 2025-07-17T06:38:21.3902220Z if enabled: 2025-07-17T06:38:21.3902643Z label = experiment_name 2025-07-17T06:38:21.3903200Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:38:21.3904021Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:38:21.3904899Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:38:21.3905655Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:38:21.3906362Z if is_canary: 2025-07-17T06:38:21.3906860Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:38:21.3907693Z fleet_prefix = label 2025-07-17T06:38:21.3908440Z else: 2025-07-17T06:38:21.3908861Z prefixes.append(label) 2025-07-17T06:38:21.3909217Z 2025-07-17T06:38:21.3909406Z if len(prefixes) > 1: 2025-07-17T06:38:21.3909848Z log.error( 2025-07-17T06:38:21.3910881Z 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:38:21.3911994Z ) 2025-07-17T06:38:21.3912400Z prefixes = prefixes[:1] 2025-07-17T06:38:21.3912710Z 2025-07-17T06:38:21.3912898Z # Fleet always comes first 2025-07-17T06:38:21.3913362Z if fleet_prefix: 2025-07-17T06:38:21.3913827Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:38:21.3914191Z 2025-07-17T06:38:21.3914601Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:38:21.3915028Z 2025-07-17T06:38:21.3915035Z 2025-07-17T06:38:21.3915476Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:38:21.3916256Z """ 2025-07-17T06:38:21.3916837Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:38:21.3917406Z 2025-07-17T06:38:21.3918094Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:38:21.3918829Z """ 2025-07-17T06:38:21.3919216Z gh = get_gh_client(github_token) 2025-07-17T06:38:21.3919755Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:38:21.3920383Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:38:21.3920826Z 2025-07-17T06:38:21.3920834Z 2025-07-17T06:38:21.3921229Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:38:21.3921994Z for _ in range(num_retries): 2025-07-17T06:38:21.3922480Z try: 2025-07-17T06:38:21.3922928Z req = Request(url=url, headers=headers) 2025-07-17T06:38:21.3923589Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:38:21.3924254Z return json.loads(content) 2025-07-17T06:38:21.3924769Z except Exception as e: 2025-07-17T06:38:21.3925308Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:38:21.3925711Z 2025-07-17T06:38:21.3926085Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:38:21.3926802Z return {} 2025-07-17T06:38:21.3927019Z 2025-07-17T06:38:21.3927027Z 2025-07-17T06:38:21.3927197Z @cache 2025-07-17T06:38:21.3928303Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:38:21.3929078Z """ 2025-07-17T06:38:21.3929470Z Dynamically get PR information 2025-07-17T06:38:21.3929955Z """ 2025-07-17T06:38:21.3930878Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:38:21.3931500Z headers = { 2025-07-17T06:38:21.3931947Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:38:21.3932552Z "Authorization": f"token {github_token}", 2025-07-17T06:38:21.3933083Z } 2025-07-17T06:38:21.3933502Z json_response: dict[str, Any] = download_json( 2025-07-17T06:38:21.3934110Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:38:21.3934669Z headers=headers, 2025-07-17T06:38:21.3935320Z ) 2025-07-17T06:38:21.3935596Z 2025-07-17T06:38:21.3935783Z if not json_response: 2025-07-17T06:38:21.3936386Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:38:21.3937030Z return {} 2025-07-17T06:38:21.3937275Z 2025-07-17T06:38:21.3937564Z return json_response 2025-07-17T06:38:21.3937850Z 2025-07-17T06:38:21.3937859Z 2025-07-17T06:38:21.3938262Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:38:21.3938996Z """ 2025-07-17T06:38:21.3939521Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:38:21.3940163Z """ 2025-07-17T06:38:21.3940839Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:38:21.3941463Z return { 2025-07-17T06:38:21.3942041Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:38:21.3942728Z } 2025-07-17T06:38:21.3942931Z 2025-07-17T06:38:21.3942939Z 2025-07-17T06:38:21.3943110Z def main() -> None: 2025-07-17T06:38:21.3943532Z args = parse_args() 2025-07-17T06:38:21.3943794Z 2025-07-17T06:38:21.3944010Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:38:21.3944391Z 2025-07-17T06:38:21.3944579Z # Check if the PR is opt-out 2025-07-17T06:38:21.3945057Z if args.pr_number: 2025-07-17T06:38:21.3945698Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:38:21.3946597Z if OPT_OUT_LABEL in labels: 2025-07-17T06:38:21.3947110Z log.info( 2025-07-17T06:38:21.3947960Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:38:21.3948724Z ) 2025-07-17T06:38:21.3949276Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:21.3949942Z sys.exit() 2025-07-17T06:38:21.3950203Z 2025-07-17T06:38:21.3950366Z try: 2025-07-17T06:38:21.3950796Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:38:21.3951493Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:38:21.3952125Z ) 2025-07-17T06:38:21.3952326Z 2025-07-17T06:38:21.3952532Z username = get_potential_pr_author( 2025-07-17T06:38:21.3953077Z args.github_token, 2025-07-17T06:38:21.3953554Z args.github_repo, 2025-07-17T06:38:21.3954029Z args.github_actor, 2025-07-17T06:38:21.3954534Z args.github_ref_type, 2025-07-17T06:38:21.3955036Z args.github_branch, 2025-07-17T06:38:21.3955487Z ) 2025-07-17T06:38:21.3955700Z 2025-07-17T06:38:21.3955977Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:38:21.3956423Z 2025-07-17T06:38:21.3956645Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:38:21.3957190Z rollout_state, 2025-07-17T06:38:21.3957909Z (args.github_issue_owner, username), 2025-07-17T06:38:21.3958480Z args.github_branch, 2025-07-17T06:38:21.3958977Z args.eligible_experiments, 2025-07-17T06:38:21.3959506Z args.opt_out_experiments, 2025-07-17T06:38:21.3960007Z is_canary, 2025-07-17T06:38:21.3960413Z ) 2025-07-17T06:38:21.3960624Z 2025-07-17T06:38:21.3960812Z except Exception as e: 2025-07-17T06:38:21.3961270Z log.error( 2025-07-17T06:38:21.3961934Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:38:21.3962863Z ) 2025-07-17T06:38:21.3963073Z 2025-07-17T06:38:21.3963404Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:38:21.3963901Z 2025-07-17T06:38:21.3963908Z 2025-07-17T06:38:21.3964089Z if __name__ == "__main__": 2025-07-17T06:38:21.3964521Z main() 2025-07-17T06:38:21.3964731Z 2025-07-17T06:38:21.4053698Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:38:21.4054613Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:38:21.4082972Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:21.4083446Z env: 2025-07-17T06:38:21.4084040Z GITHUB_TOKEN: *** 2025-07-17T06:38:21.4084466Z ISSUE_NUMBER: 5132 2025-07-17T06:38:21.4084915Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:21.4085410Z ISSUE_OWNER: 2025-07-17T06:38:21.4085825Z CHECK_EXPERIMENTS: 2025-07-17T06:38:21.4086257Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:21.4086725Z PR_NUMBER: 2025-07-17T06:38:21.4087104Z ##[endgroup] 2025-07-17T06:38:22.4193719Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:38:23.2155696Z Collecting urllib3==1.26.18 2025-07-17T06:38:23.2703063Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:38:23.2938330Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.1 MB/s eta 0:00:00 2025-07-17T06:38:23.3244943Z Collecting PyGithub==2.3.0 2025-07-17T06:38:23.3351958Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:38:23.3855426Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:38:23.3954039Z 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:38:23.4001930Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:38:23.4017856Z 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:38:23.4032434Z 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:38:23.4364844Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:38:23.4462679Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:38:23.4694337Z 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:38:23.5951677Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:38:23.6052814Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:38:23.7149020Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:38:23.7259401Z 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:38:23.7515702Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:38:23.7613157Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:38:23.7918602Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:38:23.8091999Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.6 MB/s eta 0:00:00 2025-07-17T06:38:23.8202890Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:38:23.8542734Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 10.7 MB/s eta 0:00:00 2025-07-17T06:38:23.8639698Z 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:38:23.9274766Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 13.7 MB/s eta 0:00:00 2025-07-17T06:38:23.9372653Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:38:23.9502716Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:38:23.9802061Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 16.6 MB/s eta 0:00:00 2025-07-17T06:38:23.9902956Z 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:38:23.9969310Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 15.7 MB/s eta 0:00:00 2025-07-17T06:38:24.0067423Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:38:24.0148928Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 16.4 MB/s eta 0:00:00 2025-07-17T06:38:24.3255719Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:38:24.8618929Z 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:38:24.9382583Z ##[group]Run curr_branch="main" 2025-07-17T06:38:24.9382888Z curr_branch="main" 2025-07-17T06:38:24.9383134Z curr_ref_type="branch" 2025-07-17T06:38:24.9383387Z echo "Current branch is '$curr_branch'" 2025-07-17T06:38:24.9383648Z  2025-07-17T06:38:24.9383829Z python3 runner_determinator.py \ 2025-07-17T06:38:24.9384114Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:38:24.9384389Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:38:24.9384673Z  --github-branch "$curr_branch" \ 2025-07-17T06:38:24.9384951Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:38:24.9385247Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:38:24.9385532Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:38:24.9385799Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:38:24.9386098Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:38:24.9386455Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:38:24.9386744Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:38:24.9415194Z shell: /usr/bin/bash -e {0} 2025-07-17T06:38:24.9415420Z env: 2025-07-17T06:38:24.9415875Z GITHUB_TOKEN: *** 2025-07-17T06:38:24.9416069Z ISSUE_NUMBER: 5132 2025-07-17T06:38:24.9416272Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:38:24.9416507Z ISSUE_OWNER: 2025-07-17T06:38:24.9416679Z CHECK_EXPERIMENTS: 2025-07-17T06:38:24.9416874Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:38:24.9417074Z PR_NUMBER: 2025-07-17T06:38:24.9417236Z ##[endgroup] 2025-07-17T06:38:24.9464686Z Current branch is 'main' 2025-07-17T06:38:26.4321133Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:38:26.4322361Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:38:26.4323078Z INFO : Setting output: label-type='' 2025-07-17T06:38:26.4630180Z Evaluate and set job outputs 2025-07-17T06:38:26.4636754Z Cleaning up orphan processes