2025-01-24T00:52:28.1075576Z Current runner version: '2.321.0' 2025-01-24T00:52:28.1101993Z ##[group]Operating System 2025-01-24T00:52:28.1103005Z Ubuntu 2025-01-24T00:52:28.1103488Z 24.04.1 2025-01-24T00:52:28.1103996Z LTS 2025-01-24T00:52:28.1104545Z ##[endgroup] 2025-01-24T00:52:28.1105056Z ##[group]Runner Image 2025-01-24T00:52:28.1105661Z Image: ubuntu-24.04 2025-01-24T00:52:28.1106248Z Version: 20250120.5.0 2025-01-24T00:52:28.1107254Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250120.5/images/ubuntu/Ubuntu2404-Readme.md 2025-01-24T00:52:28.1108835Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250120.5 2025-01-24T00:52:28.1109801Z ##[endgroup] 2025-01-24T00:52:28.1110300Z ##[group]Runner Image Provisioner 2025-01-24T00:52:28.1110910Z 2.0.417.1 2025-01-24T00:52:28.1111440Z ##[endgroup] 2025-01-24T00:52:28.1112449Z ##[group]GITHUB_TOKEN Permissions 2025-01-24T00:52:28.1114460Z Contents: read 2025-01-24T00:52:28.1115007Z Metadata: read 2025-01-24T00:52:28.1115725Z ##[endgroup] 2025-01-24T00:52:28.1119074Z Secret source: Actions 2025-01-24T00:52:28.1119814Z Prepare workflow directory 2025-01-24T00:52:28.1606958Z Prepare all required actions 2025-01-24T00:52:28.1661670Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (b2c89bc115123aea8e075e882ee121537ec92f89) 2025-01-24T00:52:28.1666745Z ##[group] Inputs 2025-01-24T00:52:28.1667428Z check_experiments: 2025-01-24T00:52:28.1668194Z triggering_actor: pytorch-bot[bot] 2025-01-24T00:52:28.1668897Z issue_owner: 2025-01-24T00:52:28.1669418Z curr_branch: ciflow/trunk/145539 2025-01-24T00:52:28.1670064Z curr_ref_type: tag 2025-01-24T00:52:28.1670655Z issue_number: 5132 2025-01-24T00:52:28.1671168Z ##[endgroup] 2025-01-24T00:52:28.1671885Z Complete job name: before-test / get-label-type / runner-determinator 2025-01-24T00:52:29.1933834Z ##[group]Run cat < runner_determinator.py 2025-01-24T00:52:29.1936626Z cat < runner_determinator.py 2025-01-24T00:52:29.1938182Z # flake8: noqa: G004 2025-01-24T00:52:29.1939278Z  2025-01-24T00:52:29.1940852Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:52:29.1943234Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:52:29.1945236Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:52:29.1946752Z  2025-01-24T00:52:29.1947585Z """ 2025-01-24T00:52:29.1949253Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:52:29.1951495Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:52:29.1953863Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:52:29.1955953Z of which runners should be used to run which job. 2025-01-24T00:52:29.1957329Z  2025-01-24T00:52:29.1958859Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:52:29.1961120Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:52:29.1963309Z settings are considered to be empty with only the second part, the user 2025-01-24T00:52:29.1965127Z list, defined. 2025-01-24T00:52:29.1966107Z  2025-01-24T00:52:29.1967469Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:52:29.1969852Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:52:29.1971949Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:52:29.1973438Z  2025-01-24T00:52:29.1974843Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:52:29.1977070Z The user list is also a comma separated list of additional features or 2025-01-24T00:52:29.1979375Z experiments which the user could be opted in to. 2025-01-24T00:52:29.1980775Z  2025-01-24T00:52:29.1981736Z The user list has the following rules: 2025-01-24T00:52:29.1982994Z  2025-01-24T00:52:29.1984280Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:52:29.1986458Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:52:29.1988522Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:52:29.1989871Z  2025-01-24T00:52:29.1990842Z Example config: 2025-01-24T00:52:29.1992050Z  # A list of experiments that can be opted into. 2025-01-24T00:52:29.1993778Z  # This defines the behavior they'll induce when opted into. 2025-01-24T00:52:29.1995366Z  # Expected syntax is: 2025-01-24T00:52:29.1997060Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:52:29.1999846Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:52:29.2001758Z  2025-01-24T00:52:29.2002615Z  experiments: 2025-01-24T00:52:29.2003646Z  lf: 2025-01-24T00:52:29.2004615Z  rollout_percent: 25 2025-01-24T00:52:29.2005824Z  all_branches: false 2025-01-24T00:52:29.2006992Z  default: true 2025-01-24T00:52:29.2008178Z  --- 2025-01-24T00:52:29.2009058Z  2025-01-24T00:52:29.2009888Z  # Opt-ins: 2025-01-24T00:52:29.2011459Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:52:29.2013850Z  # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:52:29.2015816Z  # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:52:29.2017482Z  # Experiments should be from the above list. 2025-01-24T00:52:29.2018883Z  2025-01-24T00:52:29.2019717Z  @User1,-lf,split_build 2025-01-24T00:52:29.2020809Z  @User2,lf 2025-01-24T00:52:29.2021769Z  @User3,split_build 2025-01-24T00:52:29.2022791Z """ 2025-01-24T00:52:29.2023598Z  2025-01-24T00:52:29.2024389Z import json 2025-01-24T00:52:29.2025301Z import logging 2025-01-24T00:52:29.2026252Z import os 2025-01-24T00:52:29.2027139Z import random 2025-01-24T00:52:29.2028192Z import re 2025-01-24T00:52:29.2029077Z import sys 2025-01-24T00:52:29.2030081Z from argparse import ArgumentParser 2025-01-24T00:52:29.2031356Z from functools import lru_cache 2025-01-24T00:52:29.2032592Z from logging import LogRecord 2025-01-24T00:52:29.2034337Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:52:29.2036270Z from urllib.request import Request, urlopen 2025-01-24T00:52:29.2037533Z  2025-01-24T00:52:29.2038416Z import yaml 2025-01-24T00:52:29.2039386Z from github import Auth, Github 2025-01-24T00:52:29.2040614Z from github.Issue import Issue 2025-01-24T00:52:29.2041728Z  2025-01-24T00:52:29.2042476Z  2025-01-24T00:52:29.2043442Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:52:29.2045130Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:52:29.2047188Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:52:29.2048939Z  2025-01-24T00:52:29.2049915Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:52:29.2051285Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:52:29.2052586Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:52:29.2053940Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:52:29.2055309Z  2025-01-24T00:52:29.2056192Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:52:29.2057342Z  2025-01-24T00:52:29.2058252Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:52:29.2059370Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:52:29.2060418Z  2025-01-24T00:52:29.2061172Z  2025-01-24T00:52:29.2062002Z class Experiment(NamedTuple): 2025-01-24T00:52:29.2063150Z  rollout_perc: float = ( 2025-01-24T00:52:29.2064746Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:52:29.2066338Z  ) 2025-01-24T00:52:29.2067187Z  all_branches: bool = ( 2025-01-24T00:52:29.2068858Z  False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:52:29.2070459Z  ) 2025-01-24T00:52:29.2071341Z  default: bool = ( 2025-01-24T00:52:29.2072809Z  True # If True, the experiment is enabled by default for all queries 2025-01-24T00:52:29.2074319Z  ) 2025-01-24T00:52:29.2075114Z  2025-01-24T00:52:29.2075946Z  # Add more fields as needed 2025-01-24T00:52:29.2077026Z  2025-01-24T00:52:29.2077778Z  2025-01-24T00:52:29.2078692Z class Settings(NamedTuple): 2025-01-24T00:52:29.2079755Z  """ 2025-01-24T00:52:29.2080874Z  Settings for the experiments that can be opted into. 2025-01-24T00:52:29.2082211Z  """ 2025-01-24T00:52:29.2083000Z  2025-01-24T00:52:29.2083906Z  experiments: Dict[str, Experiment] = {} 2025-01-24T00:52:29.2085088Z  2025-01-24T00:52:29.2085825Z  2025-01-24T00:52:29.2086889Z class ColorFormatter(logging.Formatter): 2025-01-24T00:52:29.2088563Z  """Color codes the log messages based on the log level""" 2025-01-24T00:52:29.2089920Z  2025-01-24T00:52:29.2090682Z  COLORS = { 2025-01-24T00:52:29.2091656Z  "WARNING": "\033[33m", # Yellow 2025-01-24T00:52:29.2092823Z  "ERROR": "\033[31m", # Red 2025-01-24T00:52:29.2093968Z  "CRITICAL": "\033[31m", # Red 2025-01-24T00:52:29.2095140Z  "INFO": "\033[0m", # Reset 2025-01-24T00:52:29.2096277Z  "DEBUG": "\033[0m", # Reset 2025-01-24T00:52:29.2097362Z  } 2025-01-24T00:52:29.2098251Z  2025-01-24T00:52:29.2099176Z  def format(self, record: LogRecord) -> str: 2025-01-24T00:52:29.2100942Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:52:29.2102772Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:52:29.2104118Z  return super().format(record) 2025-01-24T00:52:29.2105236Z  2025-01-24T00:52:29.2105978Z  2025-01-24T00:52:29.2106834Z handler = logging.StreamHandler() 2025-01-24T00:52:29.2108648Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:52:29.2110320Z  2025-01-24T00:52:29.2111371Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:52:29.2112759Z log.addHandler(handler) 2025-01-24T00:52:29.2113840Z log.setLevel(logging.INFO) 2025-01-24T00:52:29.2114884Z  2025-01-24T00:52:29.2115626Z  2025-01-24T00:52:29.2116652Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:52:29.2118052Z  """ 2025-01-24T00:52:29.2119276Z  Defines outputs of the github action that invokes this script 2025-01-24T00:52:29.2120746Z  """ 2025-01-24T00:52:29.2121596Z  if not GITHUB_OUTPUT: 2025-01-24T00:52:29.2124213Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:52:29.2127412Z  log.warning( 2025-01-24T00:52:29.2129599Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:52:29.2131753Z  ) 2025-01-24T00:52:29.2132754Z  print(f"::set-output name={key}::{value}") 2025-01-24T00:52:29.2133988Z  return 2025-01-24T00:52:29.2134939Z  2025-01-24T00:52:29.2135813Z  with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:52:29.2137176Z  log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:52:29.2138586Z  f.write(f"{key}={value}\n") 2025-01-24T00:52:29.2139686Z  2025-01-24T00:52:29.2140428Z  2025-01-24T00:52:29.2141554Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:52:29.2143017Z  return frozenset( 2025-01-24T00:52:29.2144503Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:52:29.2146051Z  ) 2025-01-24T00:52:29.2146819Z  2025-01-24T00:52:29.2147540Z  2025-01-24T00:52:29.2148413Z def parse_args() -> Any: 2025-01-24T00:52:29.2149757Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:52:29.2151763Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:52:29.2153482Z  parser.add_argument( 2025-01-24T00:52:29.2154544Z  "--github-issue-repo", 2025-01-24T00:52:29.2155617Z  type=str, 2025-01-24T00:52:29.2156552Z  required=False, 2025-01-24T00:52:29.2158251Z  default="pytorch/test-infra", 2025-01-24T00:52:29.2159594Z  help="GitHub repo to get the issue", 2025-01-24T00:52:29.2160780Z  ) 2025-01-24T00:52:29.2161651Z  parser.add_argument( 2025-01-24T00:52:29.2162721Z  "--github-repo", 2025-01-24T00:52:29.2163769Z  type=str, 2025-01-24T00:52:29.2164736Z  required=True, 2025-01-24T00:52:29.2165877Z  help="GitHub repo where CI is running", 2025-01-24T00:52:29.2167055Z  ) 2025-01-24T00:52:29.2167929Z  parser.add_argument( 2025-01-24T00:52:29.2169526Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:52:29.2171064Z  ) 2025-01-24T00:52:29.2171918Z  parser.add_argument( 2025-01-24T00:52:29.2173449Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:52:29.2174998Z  ) 2025-01-24T00:52:29.2175845Z  parser.add_argument( 2025-01-24T00:52:29.2177604Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:52:29.2179470Z  ) 2025-01-24T00:52:29.2180305Z  parser.add_argument( 2025-01-24T00:52:29.2181911Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:52:29.2183541Z  ) 2025-01-24T00:52:29.2184380Z  parser.add_argument( 2025-01-24T00:52:29.2185442Z  "--github-ref-type", 2025-01-24T00:52:29.2186523Z  type=str, 2025-01-24T00:52:29.2187476Z  required=True, 2025-01-24T00:52:29.2188813Z  help="Current GitHub ref type, branch or tag", 2025-01-24T00:52:29.2190062Z  ) 2025-01-24T00:52:29.2190883Z  parser.add_argument( 2025-01-24T00:52:29.2191983Z  "--eligible-experiments", 2025-01-24T00:52:29.2193198Z  type=_str_comma_separated_to_set, 2025-01-24T00:52:29.2194365Z  required=False, 2025-01-24T00:52:29.2195367Z  default="", 2025-01-24T00:52:29.2197529Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:52:29.2199750Z  ) 2025-01-24T00:52:29.2200591Z  parser.add_argument( 2025-01-24T00:52:29.2201622Z  "--pr-number", 2025-01-24T00:52:29.2202619Z  type=str, 2025-01-24T00:52:29.2203567Z  required=False, 2025-01-24T00:52:29.2204567Z  default="", 2025-01-24T00:52:29.2205713Z  help="the optional PR number where this is run", 2025-01-24T00:52:29.2206963Z  ) 2025-01-24T00:52:29.2207746Z  2025-01-24T00:52:29.2208643Z  return parser.parse_args() 2025-01-24T00:52:29.2209704Z  2025-01-24T00:52:29.2210448Z  2025-01-24T00:52:29.2211412Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:52:29.2212736Z  auth = Auth.Token(github_token) 2025-01-24T00:52:29.2213896Z  return Github(auth=auth) 2025-01-24T00:52:29.2214928Z  2025-01-24T00:52:29.2215658Z  2025-01-24T00:52:29.2216771Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:52:29.2218306Z  repo = gh.get_repo(repo) 2025-01-24T00:52:29.2219503Z  return repo.get_issue(number=issue_num) 2025-01-24T00:52:29.2220669Z  2025-01-24T00:52:29.2221396Z  2025-01-24T00:52:29.2222203Z def get_potential_pr_author( 2025-01-24T00:52:29.2223726Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:52:29.2225250Z ) -> str: 2025-01-24T00:52:29.2226490Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:52:29.2228576Z  # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:52:29.2230320Z  # embedded in the tag name: ciflow// 2025-01-24T00:52:29.2231623Z  2025-01-24T00:52:29.2232444Z  gh = get_gh_client(github_token) 2025-01-24T00:52:29.2233545Z  2025-01-24T00:52:29.2234582Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:52:29.2235998Z  split_tag = ref_name.split("/") 2025-01-24T00:52:29.2237118Z  if ( 2025-01-24T00:52:29.2238114Z  len(split_tag) == 3 2025-01-24T00:52:29.2239238Z  and split_tag[0] == "ciflow" 2025-01-24T00:52:29.2240438Z  and split_tag[2].isnumeric() 2025-01-24T00:52:29.2241555Z  ): 2025-01-24T00:52:29.2242471Z  pr_number = split_tag[2] 2025-01-24T00:52:29.2243565Z  try: 2025-01-24T00:52:29.2244578Z  repository = gh.get_repo(repo) 2025-01-24T00:52:29.2245991Z  pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:52:29.2247375Z  except Exception as e: 2025-01-24T00:52:29.2248657Z  raise Exception( # noqa: TRY002 2025-01-24T00:52:29.2250187Z  f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:52:29.2251638Z  ) from e 2025-01-24T00:52:29.2252691Z  return pull.user.login 2025-01-24T00:52:29.2254050Z  # In all other cases, return the original input username 2025-01-24T00:52:29.2255372Z  return username 2025-01-24T00:52:29.2256308Z  2025-01-24T00:52:29.2257032Z  2025-01-24T00:52:29.2257947Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:52:29.2259221Z  """ 2025-01-24T00:52:29.2260716Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:52:29.2262432Z  """ 2025-01-24T00:52:29.2263669Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:52:29.2265273Z  2025-01-24T00:52:29.2266001Z  2025-01-24T00:52:29.2266833Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:52:29.2267940Z  try: 2025-01-24T00:52:29.2268920Z  data = yaml.safe_load(yaml_text) 2025-01-24T00:52:29.2270195Z  return data 2025-01-24T00:52:29.2271646Z  except yaml.YAMLError: 2025-01-24T00:52:29.2272801Z  log.exception("Error loading YAML") 2025-01-24T00:52:29.2273945Z  raise 2025-01-24T00:52:29.2274788Z  2025-01-24T00:52:29.2275500Z  2025-01-24T00:52:29.2276830Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:52:29.2278591Z  """ 2025-01-24T00:52:29.2280009Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:52:29.2281676Z  2025-01-24T00:52:29.2282850Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:29.2284552Z  and the text below is the list of opted in users. 2025-01-24T00:52:29.2285779Z  2025-01-24T00:52:29.2287034Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:52:29.2288680Z  """ 2025-01-24T00:52:29.2289686Z  rollout_state_parts = rollout_state.split("---") 2025-01-24T00:52:29.2291009Z  if len(rollout_state_parts) >= 2: 2025-01-24T00:52:29.2292397Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:52:29.2293710Z  else: 2025-01-24T00:52:29.2294784Z  return "", rollout_state 2025-01-24T00:52:29.2295880Z  2025-01-24T00:52:29.2296656Z  2025-01-24T00:52:29.2297551Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:52:29.2298805Z  """ 2025-01-24T00:52:29.2299987Z  Dictionary of users with a list of features they have opted into 2025-01-24T00:52:29.2301394Z  """ 2025-01-24T00:52:29.2302177Z  2025-01-24T00:52:29.2302911Z  2025-01-24T00:52:29.2304069Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:52:29.2305508Z  """ 2025-01-24T00:52:29.2307102Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:52:29.2309033Z  2025-01-24T00:52:29.2310818Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:52:29.2313012Z  - Example line: "@User1,lf,split_build" 2025-01-24T00:52:29.2314523Z  - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:52:29.2315913Z  2025-01-24T00:52:29.2316626Z  2025-01-24T00:52:29.2317348Z  """ 2025-01-24T00:52:29.2318266Z  optins = UserOptins() 2025-01-24T00:52:29.2319405Z  for user in user_optin_text.split("\n"): 2025-01-24T00:52:29.2320645Z  user = user.strip("\r\n\t -") 2025-01-24T00:52:29.2321863Z  if not user or not user.startswith("@"): 2025-01-24T00:52:29.2323094Z  # Not a valid user. Skip 2025-01-24T00:52:29.2324171Z  continue 2025-01-24T00:52:29.2325064Z  2025-01-24T00:52:29.2325804Z  if user: 2025-01-24T00:52:29.2326827Z  usr_name = user.split(",")[0].strip("@") 2025-01-24T00:52:29.2328440Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:52:29.2330123Z  2025-01-24T00:52:29.2331048Z  return optins 2025-01-24T00:52:29.2331962Z  2025-01-24T00:52:29.2332865Z  2025-01-24T00:52:29.2333935Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:52:29.2335267Z  """ 2025-01-24T00:52:29.2336175Z  Check if the experiment name is valid. 2025-01-24T00:52:29.2337316Z  A valid name: 2025-01-24T00:52:29.2338917Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:52:29.2340983Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:52:29.2342543Z  - Cannot contain spaces 2025-01-24T00:52:29.2343590Z  """ 2025-01-24T00:52:29.2344361Z  2025-01-24T00:52:29.2345337Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:52:29.2346899Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:52:29.2348691Z  2025-01-24T00:52:29.2349660Z  if valid: 2025-01-24T00:52:29.2350707Z  return True 2025-01-24T00:52:29.2351642Z  2025-01-24T00:52:29.2352555Z  log.error( 2025-01-24T00:52:29.2355854Z  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-01-24T00:52:29.2359281Z  ) 2025-01-24T00:52:29.2360083Z  return False 2025-01-24T00:52:29.2360951Z  2025-01-24T00:52:29.2361680Z  2025-01-24T00:52:29.2362798Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:52:29.2364166Z  """ 2025-01-24T00:52:29.2365675Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:52:29.2367238Z  """ 2025-01-24T00:52:29.2368142Z  try: 2025-01-24T00:52:29.2368967Z  if settings_text: 2025-01-24T00:52:29.2370599Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:52:29.2372297Z  # for easy reading 2025-01-24T00:52:29.2374058Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:52:29.2376034Z  # the backtick character in shell commands. 2025-01-24T00:52:29.2377359Z  backtick = chr(96) # backtick character 2025-01-24T00:52:29.2379377Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:52:29.2380866Z  settings = load_yaml(settings_text) 2025-01-24T00:52:29.2381990Z  2025-01-24T00:52:29.2383267Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:52:29.2384852Z  experiments = {} 2025-01-24T00:52:29.2385843Z  2025-01-24T00:52:29.2387083Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:52:29.2388843Z  if not is_valid_experiment_name(exp_name): 2025-01-24T00:52:29.2391193Z  # 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-01-24T00:52:29.2393412Z  continue 2025-01-24T00:52:29.2394359Z  2025-01-24T00:52:29.2395139Z  valid_settings = {} 2025-01-24T00:52:29.2396276Z  for setting in exp_settings: 2025-01-24T00:52:29.2397496Z  if setting not in Experiment._fields: 2025-01-24T00:52:29.2398796Z  log.warning( 2025-01-24T00:52:29.2400327Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:52:29.2402038Z  ) 2025-01-24T00:52:29.2402993Z  else: 2025-01-24T00:52:29.2404148Z  valid_settings[setting] = exp_settings[setting] 2025-01-24T00:52:29.2405366Z  2025-01-24T00:52:29.2406371Z  experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:52:29.2407755Z  return Settings(experiments) 2025-01-24T00:52:29.2408926Z  2025-01-24T00:52:29.2409678Z  except Exception: 2025-01-24T00:52:29.2410789Z  log.exception("Failed to parse settings") 2025-01-24T00:52:29.2411939Z  2025-01-24T00:52:29.2412688Z  return Settings() 2025-01-24T00:52:29.2413605Z  2025-01-24T00:52:29.2414333Z  2025-01-24T00:52:29.2415292Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:52:29.2416512Z  """ 2025-01-24T00:52:29.2417488Z  Parse settings, if any, from the rollout state. 2025-01-24T00:52:29.2418784Z  2025-01-24T00:52:29.2419941Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:29.2421571Z  and the text below is the list of opted in users. 2025-01-24T00:52:29.2422747Z  2025-01-24T00:52:29.2424025Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:52:29.2425562Z  """ 2025-01-24T00:52:29.2426780Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:29.2428498Z  return parse_settings_from_text(settings_text) 2025-01-24T00:52:29.2429660Z  2025-01-24T00:52:29.2430594Z  2025-01-24T00:52:29.2431546Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:52:29.2432740Z  """ 2025-01-24T00:52:29.2433600Z  Parse users from the rollout state. 2025-01-24T00:52:29.2434657Z  2025-01-24T00:52:29.2435354Z  """ 2025-01-24T00:52:29.2436529Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:29.2438228Z  return parse_user_opt_in_from_text(users_text) 2025-01-24T00:52:29.2439391Z  2025-01-24T00:52:29.2440083Z  2025-01-24T00:52:29.2441360Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:29.2442907Z  """ 2025-01-24T00:52:29.2443826Z  Check if a user is opted into an experiment 2025-01-24T00:52:29.2444947Z  """ 2025-01-24T00:52:29.2445966Z  return experiment_name in user_optins.get(user, []) 2025-01-24T00:52:29.2447169Z  2025-01-24T00:52:29.2447865Z  2025-01-24T00:52:29.2449263Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:29.2450881Z  """ 2025-01-24T00:52:29.2451888Z  Check if a user explicitly opted out of an experiment 2025-01-24T00:52:29.2453105Z  """ 2025-01-24T00:52:29.2454197Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:52:29.2455663Z  experiment_optout = "-" + experiment_name 2025-01-24T00:52:29.2457037Z  if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:52:29.2458431Z  return False 2025-01-24T00:52:29.2459291Z  2025-01-24T00:52:29.2460252Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:52:29.2461494Z  log.warning( 2025-01-24T00:52:29.2463225Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:52:29.2465061Z  ) 2025-01-24T00:52:29.2465986Z  2025-01-24T00:52:29.2466735Z  return True 2025-01-24T00:52:29.2467576Z  2025-01-24T00:52:29.2468870Z  2025-01-24T00:52:29.2470119Z def get_runner_prefix( 2025-01-24T00:52:29.2471185Z  rollout_state: str, 2025-01-24T00:52:29.2472323Z  workflow_requestors: Iterable[str], 2025-01-24T00:52:29.2473539Z  branch: str, 2025-01-24T00:52:29.2474828Z  eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:52:29.2476278Z  is_canary: bool = False, 2025-01-24T00:52:29.2477289Z ) -> str: 2025-01-24T00:52:29.2478548Z  settings = parse_settings(rollout_state) 2025-01-24T00:52:29.2479977Z  user_optins = parse_users(rollout_state) 2025-01-24T00:52:29.2481074Z  2025-01-24T00:52:29.2481819Z  fleet_prefix = "" 2025-01-24T00:52:29.2482735Z  prefixes = [] 2025-01-24T00:52:29.2484113Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:52:29.2486125Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:52:29.2488135Z  log.info( 2025-01-24T00:52:29.2489734Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:52:29.2491392Z  ) 2025-01-24T00:52:29.2492349Z  continue 2025-01-24T00:52:29.2493320Z  2025-01-24T00:52:29.2494091Z  if eligible_experiments: 2025-01-24T00:52:29.2495302Z  if experiment_name not in eligible_experiments: 2025-01-24T00:52:29.2496673Z  exp_list = ", ".join(eligible_experiments) 2025-01-24T00:52:29.2498187Z  log.info( 2025-01-24T00:52:29.2499935Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:52:29.2501702Z  ) 2025-01-24T00:52:29.2502571Z  continue 2025-01-24T00:52:29.2503641Z  elif not experiment_settings.default: 2025-01-24T00:52:29.2504741Z  log.info( 2025-01-24T00:52:29.2506189Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:52:29.2507717Z  ) 2025-01-24T00:52:29.2508638Z  continue 2025-01-24T00:52:29.2509507Z  2025-01-24T00:52:29.2510486Z  # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:52:29.2511798Z  opted_out_users = [ 2025-01-24T00:52:29.2512785Z  requestor 2025-01-24T00:52:29.2513839Z  for requestor in workflow_requestors 2025-01-24T00:52:29.2515290Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:52:29.2516677Z  ] 2025-01-24T00:52:29.2517448Z  2025-01-24T00:52:29.2518319Z  if opted_out_users: 2025-01-24T00:52:29.2519316Z  log.info( 2025-01-24T00:52:29.2520686Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:52:29.2522119Z  ) 2025-01-24T00:52:29.2522971Z  continue 2025-01-24T00:52:29.2523831Z  2025-01-24T00:52:29.2524785Z  # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:52:29.2526072Z  opted_in_users = [ 2025-01-24T00:52:29.2527043Z  requestor 2025-01-24T00:52:29.2528282Z  for requestor in workflow_requestors 2025-01-24T00:52:29.2529719Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:52:29.2530999Z  ] 2025-01-24T00:52:29.2531757Z  2025-01-24T00:52:29.2532667Z  enabled = False 2025-01-24T00:52:29.2533635Z  if opted_in_users: 2025-01-24T00:52:29.2534589Z  log.info( 2025-01-24T00:52:29.2535912Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:52:29.2537341Z  ) 2025-01-24T00:52:29.2538390Z  enabled = True 2025-01-24T00:52:29.2539329Z  2025-01-24T00:52:29.2540180Z  elif experiment_settings.rollout_perc: 2025-01-24T00:52:29.2541915Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:52:29.2543890Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:52:29.2545237Z  log.info( 2025-01-24T00:52:29.2547088Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:52:29.2549092Z  ) 2025-01-24T00:52:29.2549982Z  enabled = True 2025-01-24T00:52:29.2550971Z  2025-01-24T00:52:29.2551680Z  if enabled: 2025-01-24T00:52:29.2552638Z  label = experiment_name 2025-01-24T00:52:29.2553811Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:52:29.2555521Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:52:29.2557380Z  # - If it's enabled, then we always list it's prefix first 2025-01-24T00:52:29.2559240Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:52:29.2560645Z  if is_canary: 2025-01-24T00:52:29.2561709Z  label += CANARY_FLEET_SUFFIX 2025-01-24T00:52:29.2562877Z  fleet_prefix = label 2025-01-24T00:52:29.2563901Z  else: 2025-01-24T00:52:29.2564839Z  prefixes.append(label) 2025-01-24T00:52:29.2565873Z  2025-01-24T00:52:29.2566605Z  if len(prefixes) > 1: 2025-01-24T00:52:29.2567550Z  log.error( 2025-01-24T00:52:29.2569998Z  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-01-24T00:52:29.2572321Z  ) 2025-01-24T00:52:29.2573156Z  prefixes = prefixes[:1] 2025-01-24T00:52:29.2574150Z  2025-01-24T00:52:29.2574913Z  # Fleet always comes first 2025-01-24T00:52:29.2575931Z  if fleet_prefix: 2025-01-24T00:52:29.2576921Z  prefixes.insert(0, fleet_prefix) 2025-01-24T00:52:29.2578133Z  2025-01-24T00:52:29.2579164Z  return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:52:29.2580397Z  2025-01-24T00:52:29.2581148Z  2025-01-24T00:52:29.2582456Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:52:29.2584029Z  """ 2025-01-24T00:52:29.2585283Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:52:29.2586756Z  2025-01-24T00:52:29.2587936Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:52:29.2589490Z  """ 2025-01-24T00:52:29.2590334Z  gh = get_gh_client(github_token) 2025-01-24T00:52:29.2591476Z  issue = get_issue(gh, repo, issue_num) 2025-01-24T00:52:29.2592835Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:52:29.2594082Z  2025-01-24T00:52:29.2594769Z  2025-01-24T00:52:29.2596147Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:52:29.2597691Z  for _ in range(num_retries): 2025-01-24T00:52:29.2598785Z  try: 2025-01-24T00:52:29.2599741Z  req = Request(url=url, headers=headers) 2025-01-24T00:52:29.2601112Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:52:29.2602435Z  return json.loads(content) 2025-01-24T00:52:29.2603546Z  except Exception as e: 2025-01-24T00:52:29.2604723Z  log.warning(f"Could not download {url}: {e}") 2025-01-24T00:52:29.2605844Z  2025-01-24T00:52:29.2607044Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:52:29.2608759Z  return {} 2025-01-24T00:52:29.2609586Z  2025-01-24T00:52:29.2610279Z  2025-01-24T00:52:29.2611069Z @lru_cache(maxsize=None) 2025-01-24T00:52:29.2612568Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:52:29.2614087Z  """ 2025-01-24T00:52:29.2614936Z  Dynamically get PR information 2025-01-24T00:52:29.2615947Z  """ 2025-01-24T00:52:29.2617011Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:52:29.2618517Z  headers = { 2025-01-24T00:52:29.2619551Z  "Accept": "application/vnd.github.v3+json", 2025-01-24T00:52:29.2620841Z  "Authorization": f"token {github_token}", 2025-01-24T00:52:29.2621940Z  } 2025-01-24T00:52:29.2622875Z  json_response: Dict[str, Any] = download_json( 2025-01-24T00:52:29.2624341Z  url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:52:29.2625485Z  headers=headers, 2025-01-24T00:52:29.2626409Z  ) 2025-01-24T00:52:29.2627163Z  2025-01-24T00:52:29.2701039Z  if not json_response: 2025-01-24T00:52:29.2702500Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:52:29.2703804Z  return {} 2025-01-24T00:52:29.2704665Z  2025-01-24T00:52:29.2705396Z  return json_response 2025-01-24T00:52:29.2706319Z  2025-01-24T00:52:29.2707015Z  2025-01-24T00:52:29.2708352Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:52:29.2709832Z  """ 2025-01-24T00:52:29.2710982Z  Dynamically get the latest list of labels from the pull request 2025-01-24T00:52:29.2712315Z  """ 2025-01-24T00:52:29.2713372Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:52:29.2714647Z  return { 2025-01-24T00:52:29.2715886Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:52:29.2717308Z  } 2025-01-24T00:52:29.2718129Z  2025-01-24T00:52:29.2718830Z  2025-01-24T00:52:29.2719558Z def main() -> None: 2025-01-24T00:52:29.2720473Z  args = parse_args() 2025-01-24T00:52:29.2721381Z  2025-01-24T00:52:29.2722251Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:52:29.2723347Z  2025-01-24T00:52:29.2724107Z  # Check if the PR is opt-out 2025-01-24T00:52:29.2725129Z  if args.pr_number: 2025-01-24T00:52:29.2726541Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:52:29.2728302Z  if OPT_OUT_LABEL in labels: 2025-01-24T00:52:29.2729429Z  log.info( 2025-01-24T00:52:29.2730926Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:52:29.2732466Z  ) 2025-01-24T00:52:29.2733869Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:29.2735227Z  sys.exit() 2025-01-24T00:52:29.2736114Z  2025-01-24T00:52:29.2736801Z  try: 2025-01-24T00:52:29.2737738Z  rollout_state = get_rollout_state_from_issue( 2025-01-24T00:52:29.2739971Z  args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:52:29.2741288Z  ) 2025-01-24T00:52:29.2742057Z  2025-01-24T00:52:29.2742878Z  username = get_potential_pr_author( 2025-01-24T00:52:29.2743996Z  args.github_token, 2025-01-24T00:52:29.2745016Z  args.github_repo, 2025-01-24T00:52:29.2746083Z  args.github_actor, 2025-01-24T00:52:29.2747150Z  args.github_ref_type, 2025-01-24T00:52:29.2748385Z  args.github_branch, 2025-01-24T00:52:29.2749371Z  ) 2025-01-24T00:52:29.2750127Z  2025-01-24T00:52:29.2751187Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:52:29.2752436Z  2025-01-24T00:52:29.2753296Z  runner_label_prefix = get_runner_prefix( 2025-01-24T00:52:29.2754433Z  rollout_state, 2025-01-24T00:52:29.2755499Z  (args.github_issue_owner, username), 2025-01-24T00:52:29.2756611Z  args.github_branch, 2025-01-24T00:52:29.2757671Z  args.eligible_experiments, 2025-01-24T00:52:29.2758914Z  is_canary, 2025-01-24T00:52:29.2759810Z  ) 2025-01-24T00:52:29.2760571Z  2025-01-24T00:52:29.2761328Z  except Exception as e: 2025-01-24T00:52:29.2762464Z  log.error( 2025-01-24T00:52:29.2763911Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:52:29.2765453Z  ) 2025-01-24T00:52:29.2766209Z  2025-01-24T00:52:29.2767264Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:29.2768861Z  2025-01-24T00:52:29.2769551Z  2025-01-24T00:52:29.2770288Z if __name__ == "__main__": 2025-01-24T00:52:29.2771220Z  main() 2025-01-24T00:52:29.2771989Z  2025-01-24T00:52:29.2772674Z EOF 2025-01-24T00:52:29.2773388Z  2025-01-24T00:52:29.2774135Z cat runner_determinator.py 2025-01-24T00:52:29.3214359Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:29.3215581Z env: 2025-01-24T00:52:29.3216811Z GITHUB_TOKEN: *** 2025-01-24T00:52:29.3217611Z ISSUE_NUMBER: 5132 2025-01-24T00:52:29.3218822Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:52:29.3219827Z ISSUE_OWNER: 2025-01-24T00:52:29.3220594Z CHECK_EXPERIMENTS: 2025-01-24T00:52:29.3221428Z PR_NUMBER: 2025-01-24T00:52:29.3222185Z ##[endgroup] 2025-01-24T00:52:29.3427227Z # flake8: noqa: G004 2025-01-24T00:52:29.3427801Z 2025-01-24T00:52:29.3428981Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:52:29.3430858Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:52:29.3432403Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:52:29.3433256Z 2025-01-24T00:52:29.3433555Z """ 2025-01-24T00:52:29.3434670Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:52:29.3436353Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:52:29.3438275Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:52:29.3439870Z of which runners should be used to run which job. 2025-01-24T00:52:29.3440640Z 2025-01-24T00:52:29.3441354Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:52:29.3443347Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:52:29.3445032Z settings are considered to be empty with only the second part, the user 2025-01-24T00:52:29.3446370Z list, defined. 2025-01-24T00:52:29.3446807Z 2025-01-24T00:52:29.3447517Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:52:29.3449500Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:52:29.3451101Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:52:29.3451959Z 2025-01-24T00:52:29.3452661Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:52:29.3454361Z The user list is also a comma separated list of additional features or 2025-01-24T00:52:29.3455775Z experiments which the user could be opted in to. 2025-01-24T00:52:29.3456542Z 2025-01-24T00:52:29.3456926Z The user list has the following rules: 2025-01-24T00:52:29.3457604Z 2025-01-24T00:52:29.3458415Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:52:29.3460070Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:52:29.3461536Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:52:29.3462290Z 2025-01-24T00:52:29.3462623Z Example config: 2025-01-24T00:52:29.3463497Z # A list of experiments that can be opted into. 2025-01-24T00:52:29.3464774Z # This defines the behavior they'll induce when opted into. 2025-01-24T00:52:29.3465966Z # Expected syntax is: 2025-01-24T00:52:29.3467198Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:52:29.3469457Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:52:29.3470827Z 2025-01-24T00:52:29.3471162Z experiments: 2025-01-24T00:52:29.3471923Z lf: 2025-01-24T00:52:29.3472649Z rollout_percent: 25 2025-01-24T00:52:29.3473520Z all_branches: false 2025-01-24T00:52:29.3474397Z default: true 2025-01-24T00:52:29.3475181Z --- 2025-01-24T00:52:29.3475554Z 2025-01-24T00:52:29.3475862Z # Opt-ins: 2025-01-24T00:52:29.3476995Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:52:29.3478850Z # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:52:29.3480315Z # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:52:29.3481560Z # Experiments should be from the above list. 2025-01-24T00:52:29.3482280Z 2025-01-24T00:52:29.3482625Z @User1,-lf,split_build 2025-01-24T00:52:29.3483460Z @User2,lf 2025-01-24T00:52:29.3484194Z @User3,split_build 2025-01-24T00:52:29.3484988Z """ 2025-01-24T00:52:29.3485354Z 2025-01-24T00:52:29.3485676Z import json 2025-01-24T00:52:29.3486385Z import logging 2025-01-24T00:52:29.3487116Z import os 2025-01-24T00:52:29.3487804Z import random 2025-01-24T00:52:29.3488689Z import re 2025-01-24T00:52:29.3489399Z import sys 2025-01-24T00:52:29.3490164Z from argparse import ArgumentParser 2025-01-24T00:52:29.3491154Z from functools import lru_cache 2025-01-24T00:52:29.3492083Z from logging import LogRecord 2025-01-24T00:52:29.3493387Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:52:29.3494897Z from urllib.request import Request, urlopen 2025-01-24T00:52:29.3495603Z 2025-01-24T00:52:29.3495919Z import yaml 2025-01-24T00:52:29.3496674Z from github import Auth, Github 2025-01-24T00:52:29.3497614Z from github.Issue import Issue 2025-01-24T00:52:29.3498407Z 2025-01-24T00:52:29.3498418Z 2025-01-24T00:52:29.3498843Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:52:29.3500159Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:52:29.3501792Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:52:29.3502853Z 2025-01-24T00:52:29.3503293Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:52:29.3504545Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:52:29.3505529Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:52:29.3506576Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:52:29.3507247Z 2025-01-24T00:52:29.3507612Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:52:29.3508483Z 2025-01-24T00:52:29.3508845Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:52:29.3509740Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:52:29.3510277Z 2025-01-24T00:52:29.3510285Z 2025-01-24T00:52:29.3510654Z class Experiment(NamedTuple): 2025-01-24T00:52:29.3511574Z rollout_perc: float = ( 2025-01-24T00:52:29.3512805Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:52:29.3514097Z ) 2025-01-24T00:52:29.3514800Z all_branches: bool = ( 2025-01-24T00:52:29.3516016Z False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:52:29.3517305Z ) 2025-01-24T00:52:29.3518186Z default: bool = ( 2025-01-24T00:52:29.3519314Z True # If True, the experiment is enabled by default for all queries 2025-01-24T00:52:29.3520563Z ) 2025-01-24T00:52:29.3520937Z 2025-01-24T00:52:29.3521283Z # Add more fields as needed 2025-01-24T00:52:29.3521870Z 2025-01-24T00:52:29.3521878Z 2025-01-24T00:52:29.3522231Z class Settings(NamedTuple): 2025-01-24T00:52:29.3523089Z """ 2025-01-24T00:52:29.3523956Z Settings for the experiments that can be opted into. 2025-01-24T00:52:29.3525058Z """ 2025-01-24T00:52:29.3525437Z 2025-01-24T00:52:29.3525831Z experiments: Dict[str, Experiment] = {} 2025-01-24T00:52:29.3526524Z 2025-01-24T00:52:29.3526532Z 2025-01-24T00:52:29.3526932Z class ColorFormatter(logging.Formatter): 2025-01-24T00:52:29.3528306Z """Color codes the log messages based on the log level""" 2025-01-24T00:52:29.3529288Z 2025-01-24T00:52:29.3529616Z COLORS = { 2025-01-24T00:52:29.3530382Z "WARNING": "\033[33m", # Yellow 2025-01-24T00:52:29.3531343Z "ERROR": "\033[31m", # Red 2025-01-24T00:52:29.3532286Z "CRITICAL": "\033[31m", # Red 2025-01-24T00:52:29.3533238Z "INFO": "\033[0m", # Reset 2025-01-24T00:52:29.3534162Z "DEBUG": "\033[0m", # Reset 2025-01-24T00:52:29.3535059Z } 2025-01-24T00:52:29.3535429Z 2025-01-24T00:52:29.3535846Z def format(self, record: LogRecord) -> str: 2025-01-24T00:52:29.3537255Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:52:29.3538948Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:52:29.3540070Z return super().format(record) 2025-01-24T00:52:29.3540718Z 2025-01-24T00:52:29.3540727Z 2025-01-24T00:52:29.3541103Z handler = logging.StreamHandler() 2025-01-24T00:52:29.3542473Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:52:29.3543511Z 2025-01-24T00:52:29.3543984Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:52:29.3545076Z log.addHandler(handler) 2025-01-24T00:52:29.3545929Z log.setLevel(logging.INFO) 2025-01-24T00:52:29.3546478Z 2025-01-24T00:52:29.3546487Z 2025-01-24T00:52:29.3546963Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:52:29.3548260Z """ 2025-01-24T00:52:29.3549242Z Defines outputs of the github action that invokes this script 2025-01-24T00:52:29.3550434Z """ 2025-01-24T00:52:29.3551139Z if not GITHUB_OUTPUT: 2025-01-24T00:52:29.3553191Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:52:29.3555370Z log.warning( 2025-01-24T00:52:29.3556955Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:52:29.3558842Z ) 2025-01-24T00:52:29.3569048Z print(f"::set-output name={key}::{value}") 2025-01-24T00:52:29.3570154Z return 2025-01-24T00:52:29.3570580Z 2025-01-24T00:52:29.3571164Z with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:52:29.3572260Z log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:52:29.3573336Z f.write(f"{key}={value}\n") 2025-01-24T00:52:29.3573944Z 2025-01-24T00:52:29.3573953Z 2025-01-24T00:52:29.3574518Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:52:29.3575712Z return frozenset( 2025-01-24T00:52:29.3576859Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:52:29.3578293Z ) 2025-01-24T00:52:29.3578680Z 2025-01-24T00:52:29.3578689Z 2025-01-24T00:52:29.3579033Z def parse_args() -> Any: 2025-01-24T00:52:29.3580087Z parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:52:29.3581714Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:52:29.3583179Z parser.add_argument( 2025-01-24T00:52:29.3584059Z "--github-issue-repo", 2025-01-24T00:52:29.3584933Z type=str, 2025-01-24T00:52:29.3585709Z required=False, 2025-01-24T00:52:29.3586569Z default="pytorch/test-infra", 2025-01-24T00:52:29.3587577Z help="GitHub repo to get the issue", 2025-01-24T00:52:29.3588634Z ) 2025-01-24T00:52:29.3589335Z parser.add_argument( 2025-01-24T00:52:29.3590178Z "--github-repo", 2025-01-24T00:52:29.3590984Z type=str, 2025-01-24T00:52:29.3591743Z required=True, 2025-01-24T00:52:29.3592605Z help="GitHub repo where CI is running", 2025-01-24T00:52:29.3593594Z ) 2025-01-24T00:52:29.3594282Z parser.add_argument( 2025-01-24T00:52:29.3595448Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:52:29.3596685Z ) 2025-01-24T00:52:29.3597376Z parser.add_argument( 2025-01-24T00:52:29.3598804Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:52:29.3600194Z ) 2025-01-24T00:52:29.3600882Z parser.add_argument( 2025-01-24T00:52:29.3602098Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:52:29.3603412Z ) 2025-01-24T00:52:29.3604102Z parser.add_argument( 2025-01-24T00:52:29.3605336Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:52:29.3606687Z ) 2025-01-24T00:52:29.3607370Z parser.add_argument( 2025-01-24T00:52:29.3608476Z "--github-ref-type", 2025-01-24T00:52:29.3609369Z type=str, 2025-01-24T00:52:29.3610104Z required=True, 2025-01-24T00:52:29.3611017Z help="Current GitHub ref type, branch or tag", 2025-01-24T00:52:29.3612047Z ) 2025-01-24T00:52:29.3612738Z parser.add_argument( 2025-01-24T00:52:29.3613610Z "--eligible-experiments", 2025-01-24T00:52:29.3614592Z type=_str_comma_separated_to_set, 2025-01-24T00:52:29.3615566Z required=False, 2025-01-24T00:52:29.3616350Z default="", 2025-01-24T00:52:29.3617925Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:52:29.3619808Z ) 2025-01-24T00:52:29.3620508Z parser.add_argument( 2025-01-24T00:52:29.3621344Z "--pr-number", 2025-01-24T00:52:29.3622121Z type=str, 2025-01-24T00:52:29.3622858Z required=False, 2025-01-24T00:52:29.3623651Z default="", 2025-01-24T00:52:29.3624539Z help="the optional PR number where this is run", 2025-01-24T00:52:29.3625598Z ) 2025-01-24T00:52:29.3625967Z 2025-01-24T00:52:29.3626335Z return parser.parse_args() 2025-01-24T00:52:29.3626909Z 2025-01-24T00:52:29.3626917Z 2025-01-24T00:52:29.3627334Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:52:29.3628510Z auth = Auth.Token(github_token) 2025-01-24T00:52:29.3629461Z return Github(auth=auth) 2025-01-24T00:52:29.3630026Z 2025-01-24T00:52:29.3630035Z 2025-01-24T00:52:29.3630583Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:52:29.3631771Z repo = gh.get_repo(repo) 2025-01-24T00:52:29.3632866Z return repo.get_issue(number=issue_num) 2025-01-24T00:52:29.3633541Z 2025-01-24T00:52:29.3633549Z 2025-01-24T00:52:29.3633898Z def get_potential_pr_author( 2025-01-24T00:52:29.3635106Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:52:29.3636384Z ) -> str: 2025-01-24T00:52:29.3637334Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:52:29.3638949Z # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:52:29.3640335Z # embedded in the tag name: ciflow// 2025-01-24T00:52:29.3641109Z 2025-01-24T00:52:29.3641460Z gh = get_gh_client(github_token) 2025-01-24T00:52:29.3642089Z 2025-01-24T00:52:29.3642592Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:52:29.3643749Z split_tag = ref_name.split("/") 2025-01-24T00:52:29.3644674Z if ( 2025-01-24T00:52:29.3645406Z len(split_tag) == 3 2025-01-24T00:52:29.3646308Z and split_tag[0] == "ciflow" 2025-01-24T00:52:29.3647278Z and split_tag[2].isnumeric() 2025-01-24T00:52:29.3648298Z ): 2025-01-24T00:52:29.3649013Z pr_number = split_tag[2] 2025-01-24T00:52:29.3649907Z try: 2025-01-24T00:52:29.3650695Z repository = gh.get_repo(repo) 2025-01-24T00:52:29.3651830Z pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:52:29.3652960Z except Exception as e: 2025-01-24T00:52:29.3654377Z raise Exception( # noqa: TRY002 2025-01-24T00:52:29.3655672Z f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:52:29.3656864Z ) from e 2025-01-24T00:52:29.3657894Z return pull.user.login 2025-01-24T00:52:29.3659169Z # In all other cases, return the original input username 2025-01-24T00:52:29.3660274Z return username 2025-01-24T00:52:29.3660728Z 2025-01-24T00:52:29.3660749Z 2025-01-24T00:52:29.3661165Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:52:29.3662164Z """ 2025-01-24T00:52:29.3663340Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:52:29.3664785Z """ 2025-01-24T00:52:29.3665789Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:52:29.3666758Z 2025-01-24T00:52:29.3666768Z 2025-01-24T00:52:29.3667136Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:52:29.3668186Z try: 2025-01-24T00:52:29.3668911Z data = yaml.safe_load(yaml_text) 2025-01-24T00:52:29.3669846Z return data 2025-01-24T00:52:29.3670617Z except yaml.YAMLError: 2025-01-24T00:52:29.3671520Z log.exception("Error loading YAML") 2025-01-24T00:52:29.3672501Z raise 2025-01-24T00:52:29.3672909Z 2025-01-24T00:52:29.3672918Z 2025-01-24T00:52:29.3673670Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:52:29.3675043Z """ 2025-01-24T00:52:29.3676190Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:52:29.3677314Z 2025-01-24T00:52:29.3677948Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:29.3679435Z and the text below is the list of opted in users. 2025-01-24T00:52:29.3680185Z 2025-01-24T00:52:29.3680875Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:52:29.3682171Z """ 2025-01-24T00:52:29.3682986Z rollout_state_parts = rollout_state.split("---") 2025-01-24T00:52:29.3684094Z if len(rollout_state_parts) >= 2: 2025-01-24T00:52:29.3685211Z return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:52:29.3686309Z else: 2025-01-24T00:52:29.3687016Z return "", rollout_state 2025-01-24T00:52:29.3687589Z 2025-01-24T00:52:29.3687598Z 2025-01-24T00:52:29.3688056Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:52:29.3689159Z """ 2025-01-24T00:52:29.3690114Z Dictionary of users with a list of features they have opted into 2025-01-24T00:52:29.3691304Z """ 2025-01-24T00:52:29.3691669Z 2025-01-24T00:52:29.3691678Z 2025-01-24T00:52:29.3692299Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:52:29.3693525Z """ 2025-01-24T00:52:29.3694865Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:52:29.3696160Z 2025-01-24T00:52:29.3697305Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:52:29.3699273Z - Example line: "@User1,lf,split_build" 2025-01-24T00:52:29.3700543Z - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:52:29.3701434Z 2025-01-24T00:52:29.3701443Z 2025-01-24T00:52:29.3701735Z """ 2025-01-24T00:52:29.3702424Z optins = UserOptins() 2025-01-24T00:52:29.3703340Z for user in user_optin_text.split("\n"): 2025-01-24T00:52:29.3704357Z user = user.strip("\r\n\t -") 2025-01-24T00:52:29.3705355Z if not user or not user.startswith("@"): 2025-01-24T00:52:29.3706376Z # Not a valid user. Skip 2025-01-24T00:52:29.3707266Z continue 2025-01-24T00:52:29.3707719Z 2025-01-24T00:52:29.3708106Z if user: 2025-01-24T00:52:29.3708912Z usr_name = user.split(",")[0].strip("@") 2025-01-24T00:52:29.3710180Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:52:29.3711091Z 2025-01-24T00:52:29.3711398Z return optins 2025-01-24T00:52:29.3711832Z 2025-01-24T00:52:29.3711840Z 2025-01-24T00:52:29.3712359Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:52:29.3713591Z """ 2025-01-24T00:52:29.3714337Z Check if the experiment name is valid. 2025-01-24T00:52:29.3715303Z A valid name: 2025-01-24T00:52:29.3716469Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:52:29.3718306Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:52:29.3719650Z - Cannot contain spaces 2025-01-24T00:52:29.3720484Z """ 2025-01-24T00:52:29.3720850Z 2025-01-24T00:52:29.3721321Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:52:29.3722607Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:52:29.3723425Z 2025-01-24T00:52:29.3723718Z if valid: 2025-01-24T00:52:29.3724419Z return True 2025-01-24T00:52:29.3724852Z 2025-01-24T00:52:29.3725156Z log.error( 2025-01-24T00:52:29.3727851Z 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-01-24T00:52:29.3730861Z ) 2025-01-24T00:52:29.3731524Z return False 2025-01-24T00:52:29.3731950Z 2025-01-24T00:52:29.3731959Z 2025-01-24T00:52:29.3732521Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:52:29.3733659Z """ 2025-01-24T00:52:29.3734730Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:52:29.3736049Z """ 2025-01-24T00:52:29.3736688Z try: 2025-01-24T00:52:29.3737366Z if settings_text: 2025-01-24T00:52:29.3739001Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:52:29.3740493Z # for easy reading 2025-01-24T00:52:29.3741974Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:52:29.3743663Z # the backtick character in shell commands. 2025-01-24T00:52:29.3744786Z backtick = chr(96) # backtick character 2025-01-24T00:52:29.3746007Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:52:29.3747408Z settings = load_yaml(settings_text) 2025-01-24T00:52:29.3748206Z 2025-01-24T00:52:29.3748988Z # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:52:29.3750391Z experiments = {} 2025-01-24T00:52:29.3750939Z 2025-01-24T00:52:29.3751596Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:52:29.3752993Z if not is_valid_experiment_name(exp_name): 2025-01-24T00:52:29.3755039Z # 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-01-24T00:52:29.3756991Z continue 2025-01-24T00:52:29.3757522Z 2025-01-24T00:52:29.3757853Z valid_settings = {} 2025-01-24T00:52:29.3758896Z for setting in exp_settings: 2025-01-24T00:52:29.3759946Z if setting not in Experiment._fields: 2025-01-24T00:52:29.3760982Z log.warning( 2025-01-24T00:52:29.3762271Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:52:29.3763600Z ) 2025-01-24T00:52:29.3764389Z else: 2025-01-24T00:52:29.3765327Z valid_settings[setting] = exp_settings[setting] 2025-01-24T00:52:29.3766114Z 2025-01-24T00:52:29.3766615Z experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:52:29.3767788Z return Settings(experiments) 2025-01-24T00:52:29.3768541Z 2025-01-24T00:52:29.3768861Z except Exception: 2025-01-24T00:52:29.3769741Z log.exception("Failed to parse settings") 2025-01-24T00:52:29.3770456Z 2025-01-24T00:52:29.3770910Z return Settings() 2025-01-24T00:52:29.3771394Z 2025-01-24T00:52:29.3771402Z 2025-01-24T00:52:29.3771857Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:52:29.3772904Z """ 2025-01-24T00:52:29.3773695Z Parse settings, if any, from the rollout state. 2025-01-24T00:52:29.3774431Z 2025-01-24T00:52:29.3775071Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:52:29.3776480Z and the text below is the list of opted in users. 2025-01-24T00:52:29.3777223Z 2025-01-24T00:52:29.3778070Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:52:29.3779413Z """ 2025-01-24T00:52:29.3780438Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:29.3781825Z return parse_settings_from_text(settings_text) 2025-01-24T00:52:29.3782560Z 2025-01-24T00:52:29.3782569Z 2025-01-24T00:52:29.3783035Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:52:29.3784080Z """ 2025-01-24T00:52:29.3784804Z Parse users from the rollout state. 2025-01-24T00:52:29.3785449Z 2025-01-24T00:52:29.3785752Z """ 2025-01-24T00:52:29.3786716Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:52:29.3788162Z return parse_user_opt_in_from_text(users_text) 2025-01-24T00:52:29.3788895Z 2025-01-24T00:52:29.3788905Z 2025-01-24T00:52:29.3789661Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:29.3791019Z """ 2025-01-24T00:52:29.3791782Z Check if a user is opted into an experiment 2025-01-24T00:52:29.3792771Z """ 2025-01-24T00:52:29.3793593Z return experiment_name in user_optins.get(user, []) 2025-01-24T00:52:29.3794367Z 2025-01-24T00:52:29.3794377Z 2025-01-24T00:52:29.3795167Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:52:29.3796544Z """ 2025-01-24T00:52:29.3797400Z Check if a user explicitly opted out of an experiment 2025-01-24T00:52:29.3798568Z """ 2025-01-24T00:52:29.3799498Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:52:29.3800900Z experiment_optout = "-" + experiment_name 2025-01-24T00:52:29.3802065Z if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:52:29.3803164Z return False 2025-01-24T00:52:29.3803625Z 2025-01-24T00:52:29.3804116Z if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:52:29.3805225Z log.warning( 2025-01-24T00:52:29.3806693Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:52:29.3808424Z ) 2025-01-24T00:52:29.3808811Z 2025-01-24T00:52:29.3809113Z return True 2025-01-24T00:52:29.3809534Z 2025-01-24T00:52:29.3809548Z 2025-01-24T00:52:29.3809868Z def get_runner_prefix( 2025-01-24T00:52:29.3810666Z rollout_state: str, 2025-01-24T00:52:29.3811523Z workflow_requestors: Iterable[str], 2025-01-24T00:52:29.3812478Z branch: str, 2025-01-24T00:52:29.3813368Z eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:52:29.3814480Z is_canary: bool = False, 2025-01-24T00:52:29.3815312Z ) -> str: 2025-01-24T00:52:29.3816062Z settings = parse_settings(rollout_state) 2025-01-24T00:52:29.3817133Z user_optins = parse_users(rollout_state) 2025-01-24T00:52:29.3817814Z 2025-01-24T00:52:29.3818223Z fleet_prefix = "" 2025-01-24T00:52:29.3818997Z prefixes = [] 2025-01-24T00:52:29.3820148Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:52:29.3821870Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:52:29.3823158Z log.info( 2025-01-24T00:52:29.3824415Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:52:29.3826009Z ) 2025-01-24T00:52:29.3826854Z continue 2025-01-24T00:52:29.3827325Z 2025-01-24T00:52:29.3827666Z if eligible_experiments: 2025-01-24T00:52:29.3828807Z if experiment_name not in eligible_experiments: 2025-01-24T00:52:29.3829988Z exp_list = ", ".join(eligible_experiments) 2025-01-24T00:52:29.3831014Z log.info( 2025-01-24T00:52:29.3832459Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:52:29.3834013Z ) 2025-01-24T00:52:29.3834727Z continue 2025-01-24T00:52:29.3835597Z elif not experiment_settings.default: 2025-01-24T00:52:29.3836571Z log.info( 2025-01-24T00:52:29.3837770Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:52:29.3839237Z ) 2025-01-24T00:52:29.3839929Z continue 2025-01-24T00:52:29.3840386Z 2025-01-24T00:52:29.3840904Z # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:52:29.3842044Z opted_out_users = [ 2025-01-24T00:52:29.3842855Z requestor 2025-01-24T00:52:29.3843697Z for requestor in workflow_requestors 2025-01-24T00:52:29.3844917Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:52:29.3846069Z ] 2025-01-24T00:52:29.3846450Z 2025-01-24T00:52:29.3846777Z if opted_out_users: 2025-01-24T00:52:29.3847606Z log.info( 2025-01-24T00:52:29.3848836Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:52:29.3850127Z ) 2025-01-24T00:52:29.3850824Z continue 2025-01-24T00:52:29.3851272Z 2025-01-24T00:52:29.3851764Z # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:52:29.3852891Z opted_in_users = [ 2025-01-24T00:52:29.3853709Z requestor 2025-01-24T00:52:29.3854544Z for requestor in workflow_requestors 2025-01-24T00:52:29.3855762Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:52:29.3856908Z ] 2025-01-24T00:52:29.3857429Z 2025-01-24T00:52:29.3857747Z enabled = False 2025-01-24T00:52:29.3858653Z if opted_in_users: 2025-01-24T00:52:29.3859476Z log.info( 2025-01-24T00:52:29.3860574Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:52:29.3861847Z ) 2025-01-24T00:52:29.3862563Z enabled = True 2025-01-24T00:52:29.3863084Z 2025-01-24T00:52:29.3863481Z elif experiment_settings.rollout_perc: 2025-01-24T00:52:29.3864991Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:52:29.3866716Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:52:29.3867935Z log.info( 2025-01-24T00:52:29.3869613Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:52:29.3871314Z ) 2025-01-24T00:52:29.3872058Z enabled = True 2025-01-24T00:52:29.3872638Z 2025-01-24T00:52:29.3872937Z if enabled: 2025-01-24T00:52:29.3873703Z label = experiment_name 2025-01-24T00:52:29.3874697Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:52:29.3876185Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:52:29.3877790Z # - If it's enabled, then we always list it's prefix first 2025-01-24T00:52:29.3879273Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:52:29.3880487Z if is_canary: 2025-01-24T00:52:29.3881373Z label += CANARY_FLEET_SUFFIX 2025-01-24T00:52:29.3882362Z fleet_prefix = label 2025-01-24T00:52:29.3883379Z else: 2025-01-24T00:52:29.3884162Z prefixes.append(label) 2025-01-24T00:52:29.3884792Z 2025-01-24T00:52:29.3885130Z if len(prefixes) > 1: 2025-01-24T00:52:29.3885953Z log.error( 2025-01-24T00:52:29.3887860Z 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-01-24T00:52:29.3890048Z ) 2025-01-24T00:52:29.3890747Z prefixes = prefixes[:1] 2025-01-24T00:52:29.3891313Z 2025-01-24T00:52:29.3891653Z # Fleet always comes first 2025-01-24T00:52:29.3892512Z if fleet_prefix: 2025-01-24T00:52:29.3893323Z prefixes.insert(0, fleet_prefix) 2025-01-24T00:52:29.3893983Z 2025-01-24T00:52:29.3894427Z return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:52:29.3895215Z 2025-01-24T00:52:29.3895224Z 2025-01-24T00:52:29.3896028Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:52:29.3897420Z """ 2025-01-24T00:52:29.3898585Z Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:52:29.3899630Z 2025-01-24T00:52:29.3900323Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:52:29.3901611Z """ 2025-01-24T00:52:29.3902313Z gh = get_gh_client(github_token) 2025-01-24T00:52:29.3903288Z issue = get_issue(gh, repo, issue_num) 2025-01-24T00:52:29.3904443Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:52:29.3905250Z 2025-01-24T00:52:29.3905258Z 2025-01-24T00:52:29.3905980Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:52:29.3907365Z for _ in range(num_retries): 2025-01-24T00:52:29.3908320Z try: 2025-01-24T00:52:29.3909092Z req = Request(url=url, headers=headers) 2025-01-24T00:52:29.3910291Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:52:29.3911483Z return json.loads(content) 2025-01-24T00:52:29.3912432Z except Exception as e: 2025-01-24T00:52:29.3913404Z log.warning(f"Could not download {url}: {e}") 2025-01-24T00:52:29.3914280Z 2025-01-24T00:52:29.3914968Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:52:29.3916253Z return {} 2025-01-24T00:52:29.3916664Z 2025-01-24T00:52:29.3916674Z 2025-01-24T00:52:29.3916998Z @lru_cache(maxsize=None) 2025-01-24T00:52:29.3918350Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:52:29.3919706Z """ 2025-01-24T00:52:29.3920426Z Dynamically get PR information 2025-01-24T00:52:29.3921324Z """ 2025-01-24T00:52:29.3922212Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:52:29.3923355Z headers = { 2025-01-24T00:52:29.3924177Z "Accept": "application/vnd.github.v3+json", 2025-01-24T00:52:29.3925275Z "Authorization": f"token {github_token}", 2025-01-24T00:52:29.3926250Z } 2025-01-24T00:52:29.3927028Z json_response: Dict[str, Any] = download_json( 2025-01-24T00:52:29.3928212Z url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:52:29.3929218Z headers=headers, 2025-01-24T00:52:29.3930005Z ) 2025-01-24T00:52:29.3930383Z 2025-01-24T00:52:29.3930712Z if not json_response: 2025-01-24T00:52:29.3931730Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:52:29.3932851Z return {} 2025-01-24T00:52:29.3933274Z 2025-01-24T00:52:29.3933595Z return json_response 2025-01-24T00:52:29.3934102Z 2025-01-24T00:52:29.3934111Z 2025-01-24T00:52:29.3934815Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:52:29.3936148Z """ 2025-01-24T00:52:29.3937089Z Dynamically get the latest list of labels from the pull request 2025-01-24T00:52:29.3938366Z """ 2025-01-24T00:52:29.3939361Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:52:29.3940480Z return { 2025-01-24T00:52:29.3941523Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:52:29.3942811Z } 2025-01-24T00:52:29.3943174Z 2025-01-24T00:52:29.3943183Z 2025-01-24T00:52:29.3943497Z def main() -> None: 2025-01-24T00:52:29.3944254Z args = parse_args() 2025-01-24T00:52:29.3944739Z 2025-01-24T00:52:29.3945160Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:52:29.3945852Z 2025-01-24T00:52:29.3946195Z # Check if the PR is opt-out 2025-01-24T00:52:29.3947080Z if args.pr_number: 2025-01-24T00:52:29.3948365Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:52:29.3949738Z if OPT_OUT_LABEL in labels: 2025-01-24T00:52:29.3950643Z log.info( 2025-01-24T00:52:29.3951872Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:52:29.3953286Z ) 2025-01-24T00:52:29.3954266Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:29.3955475Z sys.exit() 2025-01-24T00:52:29.3955952Z 2025-01-24T00:52:29.3956249Z try: 2025-01-24T00:52:29.3957029Z rollout_state = get_rollout_state_from_issue( 2025-01-24T00:52:29.3958396Z args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:52:29.3959564Z ) 2025-01-24T00:52:29.3959934Z 2025-01-24T00:52:29.3960297Z username = get_potential_pr_author( 2025-01-24T00:52:29.3961275Z args.github_token, 2025-01-24T00:52:29.3962152Z args.github_repo, 2025-01-24T00:52:29.3963009Z args.github_actor, 2025-01-24T00:52:29.3963891Z args.github_ref_type, 2025-01-24T00:52:29.3964790Z args.github_branch, 2025-01-24T00:52:29.3965629Z ) 2025-01-24T00:52:29.3965997Z 2025-01-24T00:52:29.3966521Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:52:29.3967337Z 2025-01-24T00:52:29.3967727Z runner_label_prefix = get_runner_prefix( 2025-01-24T00:52:29.3968819Z rollout_state, 2025-01-24T00:52:29.3969875Z (args.github_issue_owner, username), 2025-01-24T00:52:29.3970869Z args.github_branch, 2025-01-24T00:52:29.3971756Z args.eligible_experiments, 2025-01-24T00:52:29.3972679Z is_canary, 2025-01-24T00:52:29.3973411Z ) 2025-01-24T00:52:29.3973790Z 2025-01-24T00:52:29.3974119Z except Exception as e: 2025-01-24T00:52:29.3974933Z log.error( 2025-01-24T00:52:29.3976131Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:52:29.3977522Z ) 2025-01-24T00:52:29.3977900Z 2025-01-24T00:52:29.3978592Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:52:29.3979487Z 2025-01-24T00:52:29.3979496Z 2025-01-24T00:52:29.3979822Z if __name__ == "__main__": 2025-01-24T00:52:29.3980620Z main() 2025-01-24T00:52:29.3981006Z 2025-01-24T00:52:29.4084249Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:52:29.4085824Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:52:29.4114959Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:29.4115812Z env: 2025-01-24T00:52:29.4116849Z GITHUB_TOKEN: *** 2025-01-24T00:52:29.4117600Z ISSUE_NUMBER: 5132 2025-01-24T00:52:29.4118736Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:52:29.4119682Z ISSUE_OWNER: 2025-01-24T00:52:29.4120464Z CHECK_EXPERIMENTS: 2025-01-24T00:52:29.4121235Z PR_NUMBER: 2025-01-24T00:52:29.4121956Z ##[endgroup] 2025-01-24T00:52:29.7992417Z Defaulting to user installation because normal site-packages is not writeable 2025-01-24T00:52:30.2436302Z Collecting urllib3==1.26.18 2025-01-24T00:52:30.2766805Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-01-24T00:52:30.2973404Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-01-24T00:52:30.3191310Z Collecting PyGithub==2.3.0 2025-01-24T00:52:30.3221731Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-01-24T00:52:30.3685082Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-01-24T00:52:30.3714648Z 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-01-24T00:52:30.3761026Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-01-24T00:52:30.3777664Z 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-01-24T00:52:30.3792963Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-01-24T00:52:30.4031052Z Collecting Deprecated (from PyGithub==2.3.0) 2025-01-24T00:52:30.4056237Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl.metadata (5.5 kB) 2025-01-24T00:52:30.4281634Z 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-01-24T00:52:30.5397602Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:52:30.5426516Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-01-24T00:52:30.6485432Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-01-24T00:52:30.6514570Z 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-01-24T00:52:30.6707944Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:52:30.6737641Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-01-24T00:52:30.6977953Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-01-24T00:52:30.7045784Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 28.1 MB/s eta 0:00:00 2025-01-24T00:52:30.7090921Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-01-24T00:52:30.7149989Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 81.3 MB/s eta 0:00:00 2025-01-24T00:52:30.7180493Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-01-24T00:52:30.7271085Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 116.1 MB/s eta 0:00:00 2025-01-24T00:52:30.7302485Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2025-01-24T00:52:30.7355417Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-01-24T00:52:30.7427183Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 84.4 MB/s eta 0:00:00 2025-01-24T00:52:30.7459479Z 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-01-24T00:52:30.7507087Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 24.9 MB/s eta 0:00:00 2025-01-24T00:52:30.7535262Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-01-24T00:52:30.7580870Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 38.4 MB/s eta 0:00:00 2025-01-24T00:52:31.0496889Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-01-24T00:52:31.5742491Z Successfully installed Deprecated-1.2.15 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-01-24T00:52:31.6547735Z ##[group]Run curr_branch="ciflow/trunk/145539" 2025-01-24T00:52:31.6548598Z curr_branch="ciflow/trunk/145539" 2025-01-24T00:52:31.6549113Z curr_ref_type="tag" 2025-01-24T00:52:31.6549623Z echo "Current branch is '$curr_branch'" 2025-01-24T00:52:31.6550156Z  2025-01-24T00:52:31.6550559Z python3 runner_determinator.py \ 2025-01-24T00:52:31.6551114Z  --github-token "$GITHUB_TOKEN" \ 2025-01-24T00:52:31.6551643Z  --github-issue "$ISSUE_NUMBER" \ 2025-01-24T00:52:31.6552181Z  --github-branch "$curr_branch" \ 2025-01-24T00:52:31.6552756Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-01-24T00:52:31.6553349Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-01-24T00:52:31.6553876Z  --github-ref-type "$curr_ref_type" \ 2025-01-24T00:52:31.6554412Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-01-24T00:52:31.6555044Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-01-24T00:52:31.6555611Z  --pr-number "${PR_NUMBER}" 2025-01-24T00:52:31.6595151Z shell: /usr/bin/bash -e {0} 2025-01-24T00:52:31.6595609Z env: 2025-01-24T00:52:31.6596330Z GITHUB_TOKEN: *** 2025-01-24T00:52:31.6596724Z ISSUE_NUMBER: 5132 2025-01-24T00:52:31.6597165Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:52:31.6597675Z ISSUE_OWNER: 2025-01-24T00:52:31.6598237Z CHECK_EXPERIMENTS: 2025-01-24T00:52:31.6598663Z PR_NUMBER: 2025-01-24T00:52:31.6599043Z ##[endgroup] 2025-01-24T00:52:31.6659945Z Current branch is 'ciflow/trunk/145539' 2025-01-24T00:52:34.7155067Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-01-24T00:52:34.7156103Z INFO : Setting output: label-type='' 2025-01-24T00:52:34.7480631Z Evaluate and set job outputs 2025-01-24T00:52:34.7488261Z Cleaning up orphan processes