2024-12-17T23:28:38.0866595Z Current runner version: '2.321.0' 2024-12-17T23:28:38.0891683Z ##[group]Operating System 2024-12-17T23:28:38.0892484Z Ubuntu 2024-12-17T23:28:38.0893151Z 22.04.5 2024-12-17T23:28:38.0893734Z LTS 2024-12-17T23:28:38.0894255Z ##[endgroup] 2024-12-17T23:28:38.0894952Z ##[group]Runner Image 2024-12-17T23:28:38.0895614Z Image: ubuntu-22.04 2024-12-17T23:28:38.0896179Z Version: 20241211.1.0 2024-12-17T23:28:38.0897374Z Included Software: https://github.com/actions/runner-images/blob/ubuntu22/20241211.1/images/ubuntu/Ubuntu2204-Readme.md 2024-12-17T23:28:38.0898859Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu22%2F20241211.1 2024-12-17T23:28:38.0900170Z ##[endgroup] 2024-12-17T23:28:38.0900853Z ##[group]Runner Image Provisioner 2024-12-17T23:28:38.0901520Z 2.0.404.1 2024-12-17T23:28:38.0902046Z ##[endgroup] 2024-12-17T23:28:38.0904403Z ##[group]GITHUB_TOKEN Permissions 2024-12-17T23:28:38.0906449Z Actions: read 2024-12-17T23:28:38.0907346Z Attestations: read 2024-12-17T23:28:38.0907990Z Checks: read 2024-12-17T23:28:38.0908628Z Contents: read 2024-12-17T23:28:38.0909183Z Deployments: read 2024-12-17T23:28:38.0909762Z Discussions: read 2024-12-17T23:28:38.0910360Z Issues: read 2024-12-17T23:28:38.0910899Z Metadata: read 2024-12-17T23:28:38.0911451Z Packages: read 2024-12-17T23:28:38.0912058Z Pages: read 2024-12-17T23:28:38.0912598Z PullRequests: read 2024-12-17T23:28:38.0913193Z RepositoryProjects: read 2024-12-17T23:28:38.0913862Z SecurityEvents: read 2024-12-17T23:28:38.0914436Z Statuses: read 2024-12-17T23:28:38.0914992Z ##[endgroup] 2024-12-17T23:28:38.0917871Z Secret source: Actions 2024-12-17T23:28:38.0918648Z Prepare workflow directory 2024-12-17T23:28:38.1405088Z Prepare all required actions 2024-12-17T23:28:38.1460375Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/release/2.6 (0cdf8b1d09254cfda66191d1bd01e3041c3c76f7) 2024-12-17T23:28:38.1465547Z ##[group] Inputs 2024-12-17T23:28:38.1466216Z check_experiments: 2024-12-17T23:28:38.1466852Z triggering_actor: malfet 2024-12-17T23:28:38.1467591Z issue_owner: 2024-12-17T23:28:38.1468194Z curr_branch: release/2.6 2024-12-17T23:28:38.1468796Z curr_ref_type: branch 2024-12-17T23:28:38.1469458Z issue_number: 5132 2024-12-17T23:28:38.1470061Z ##[endgroup] 2024-12-17T23:28:38.1470699Z Complete job name: get-label-type / runner-determinator 2024-12-17T23:28:38.2128424Z ##[group]Run cat < runner_determinator.py 2024-12-17T23:28:38.2130867Z cat < runner_determinator.py 2024-12-17T23:28:38.2131613Z # flake8: noqa: G004 2024-12-17T23:28:38.2132197Z  2024-12-17T23:28:38.2133080Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2024-12-17T23:28:38.2134298Z # must be kept in sync. You can do it easily by running the following command: 2024-12-17T23:28:38.2135299Z # python .github/scripts/update_runner_determinator.py 2024-12-17T23:28:38.2136099Z  2024-12-17T23:28:38.2136656Z """ 2024-12-17T23:28:38.2137419Z This runner determinator is used to determine which set of runners to run a 2024-12-17T23:28:38.2138522Z GitHub job on. It uses the first comment of a GitHub issue (by default 2024-12-17T23:28:38.2140029Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2024-12-17T23:28:38.2141143Z of which runners should be used to run which job. 2024-12-17T23:28:38.2141873Z  2024-12-17T23:28:38.2142625Z The configuration has two parts, the settings and a list of opted-in users, 2024-12-17T23:28:38.2143779Z separated by a line containing "---". If the line is not present, the 2024-12-17T23:28:38.2144863Z settings are considered to be empty with only the second part, the user 2024-12-17T23:28:38.2145735Z list, defined. 2024-12-17T23:28:38.2146348Z  2024-12-17T23:28:38.2147077Z The first part is a YAML block that defines the rollout settings. This can be 2024-12-17T23:28:38.2148789Z used to define any settings that are needed to determine which runners to use. 2024-12-17T23:28:38.2149938Z It's fields are defined by the RolloutSettings class below. 2024-12-17T23:28:38.2150743Z  2024-12-17T23:28:38.2151469Z The second part is a list of users who are explicitly opted in to the LF fleet. 2024-12-17T23:28:38.2152614Z The user list is also a comma separated list of additional features or 2024-12-17T23:28:38.2153575Z experiments which the user could be opted in to. 2024-12-17T23:28:38.2154263Z  2024-12-17T23:28:38.2154887Z The user list has the following rules: 2024-12-17T23:28:38.2155578Z  2024-12-17T23:28:38.2156208Z - Users are GitHub usernames, which must start with the @ prefix 2024-12-17T23:28:38.2157302Z - Each user is also a comma-separated list of features/experiments to enable 2024-12-17T23:28:38.2158284Z - A "#" prefix opts the user out of all experiments 2024-12-17T23:28:38.2159034Z  2024-12-17T23:28:38.2159559Z Example config: 2024-12-17T23:28:38.2160259Z  # A list of experiments that can be opted into. 2024-12-17T23:28:38.2161144Z  # This defines the behavior they'll induce when opted into. 2024-12-17T23:28:38.2161991Z  # Expected syntax is: 2024-12-17T23:28:38.2162881Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2024-12-17T23:28:38.2164077Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2024-12-17T23:28:38.2165034Z  2024-12-17T23:28:38.2165570Z  experiments: 2024-12-17T23:28:38.2166169Z  lf: 2024-12-17T23:28:38.2166749Z  rollout_percent: 25 2024-12-17T23:28:38.2167440Z  all_branches: false 2024-12-17T23:28:38.2168122Z  default: true 2024-12-17T23:28:38.2168753Z  --- 2024-12-17T23:28:38.2169326Z  2024-12-17T23:28:38.2169828Z  # Opt-ins: 2024-12-17T23:28:38.2170684Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2024-12-17T23:28:38.2171969Z  # and specifying experiments to enable in a comma-separated list. 2024-12-17T23:28:38.2172962Z  # To always opt out of an experiment, prefix it with a "-". 2024-12-17T23:28:38.2173914Z  # Experiments should be from the above list. 2024-12-17T23:28:38.2174591Z  2024-12-17T23:28:38.2175158Z  @User1,-lf,split_build 2024-12-17T23:28:38.2175890Z  @User2,lf 2024-12-17T23:28:38.2176486Z  @User3,split_build 2024-12-17T23:28:38.2177056Z """ 2024-12-17T23:28:38.2177643Z  2024-12-17T23:28:38.2178155Z import json 2024-12-17T23:28:38.2178678Z import logging 2024-12-17T23:28:38.2179616Z import os 2024-12-17T23:28:38.2180329Z import random 2024-12-17T23:28:38.2180864Z import re 2024-12-17T23:28:38.2181547Z import sys 2024-12-17T23:28:38.2182159Z from argparse import ArgumentParser 2024-12-17T23:28:38.2182842Z from functools import lru_cache 2024-12-17T23:28:38.2183639Z from logging import LogRecord 2024-12-17T23:28:38.2184577Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2024-12-17T23:28:38.2185548Z from urllib.request import Request, urlopen 2024-12-17T23:28:38.2186313Z  2024-12-17T23:28:38.2186824Z import yaml 2024-12-17T23:28:38.2187392Z from github import Auth, Github 2024-12-17T23:28:38.2188149Z from github.Issue import Issue 2024-12-17T23:28:38.2188784Z  2024-12-17T23:28:38.2189260Z  2024-12-17T23:28:38.2189915Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2024-12-17T23:28:38.2191066Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2024-12-17T23:28:38.2192097Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2024-12-17T23:28:38.2193060Z  2024-12-17T23:28:38.2193679Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2024-12-17T23:28:38.2194429Z GH_OUTPUT_KEY_AMI = "runner-ami" 2024-12-17T23:28:38.2195202Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2024-12-17T23:28:38.2195972Z OPT_OUT_LABEL = "no-runner-experiments" 2024-12-17T23:28:38.2196636Z  2024-12-17T23:28:38.2197232Z SETTING_EXPERIMENTS = "experiments" 2024-12-17T23:28:38.2197914Z  2024-12-17T23:28:38.2198420Z LF_FLEET_EXPERIMENT = "lf" 2024-12-17T23:28:38.2199116Z CANARY_FLEET_SUFFIX = ".c" 2024-12-17T23:28:38.2199755Z  2024-12-17T23:28:38.2200232Z  2024-12-17T23:28:38.2200832Z class Experiment(NamedTuple): 2024-12-17T23:28:38.2201519Z  rollout_perc: float = ( 2024-12-17T23:28:38.2202361Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2024-12-17T23:28:38.2203275Z  ) 2024-12-17T23:28:38.2203827Z  all_branches: bool = ( 2024-12-17T23:28:38.2204658Z  False # If True, the experiment is also enabled on the exception branches 2024-12-17T23:28:38.2205577Z  ) 2024-12-17T23:28:38.2206114Z  default: bool = ( 2024-12-17T23:28:38.2206885Z  True # If True, the experiment is enabled by default for all queries 2024-12-17T23:28:38.2207762Z  ) 2024-12-17T23:28:38.2208275Z  2024-12-17T23:28:38.2208780Z  # Add more fields as needed 2024-12-17T23:28:38.2209502Z  2024-12-17T23:28:38.2209994Z  2024-12-17T23:28:38.2210516Z class Settings(NamedTuple): 2024-12-17T23:28:38.2211197Z  """ 2024-12-17T23:28:38.2211859Z  Settings for the experiments that can be opted into. 2024-12-17T23:28:38.2212647Z  """ 2024-12-17T23:28:38.2213222Z  2024-12-17T23:28:38.2213794Z  experiments: Dict[str, Experiment] = {} 2024-12-17T23:28:38.2214500Z  2024-12-17T23:28:38.2215034Z  2024-12-17T23:28:38.2215792Z class ColorFormatter(logging.Formatter): 2024-12-17T23:28:38.2216637Z  """Color codes the log messages based on the log level""" 2024-12-17T23:28:38.2217502Z  2024-12-17T23:28:38.2218001Z  COLORS = { 2024-12-17T23:28:38.2218581Z  "WARNING": "\033[33m", # Yellow 2024-12-17T23:28:38.2220068Z  "ERROR": "\033[31m", # Red 2024-12-17T23:28:38.2220746Z  "CRITICAL": "\033[31m", # Red 2024-12-17T23:28:38.2221434Z  "INFO": "\033[0m", # Reset 2024-12-17T23:28:38.2222204Z  "DEBUG": "\033[0m", # Reset 2024-12-17T23:28:38.2222826Z  } 2024-12-17T23:28:38.2223359Z  2024-12-17T23:28:38.2224042Z  def format(self, record: LogRecord) -> str: 2024-12-17T23:28:38.2224964Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2024-12-17T23:28:38.2225975Z  record.msg = f"{log_color}{record.msg}\033[0m" 2024-12-17T23:28:38.2226858Z  return super().format(record) 2024-12-17T23:28:38.2227514Z  2024-12-17T23:28:38.2227994Z  2024-12-17T23:28:38.2228620Z handler = logging.StreamHandler() 2024-12-17T23:28:38.2229535Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2024-12-17T23:28:38.2230427Z  2024-12-17T23:28:38.2231135Z log = logging.getLogger(os.path.basename(__file__)) 2024-12-17T23:28:38.2231928Z log.addHandler(handler) 2024-12-17T23:28:38.2232523Z log.setLevel(logging.INFO) 2024-12-17T23:28:38.2233238Z  2024-12-17T23:28:38.2234009Z  2024-12-17T23:28:38.2234597Z def set_github_output(key: str, value: str) -> None: 2024-12-17T23:28:38.2235484Z  """ 2024-12-17T23:28:38.2236193Z  Defines outputs of the github action that invokes this script 2024-12-17T23:28:38.2237146Z  """ 2024-12-17T23:28:38.2238123Z  if not GITHUB_OUTPUT: 2024-12-17T23:28:38.2239635Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2024-12-17T23:28:38.2240996Z  log.warning( 2024-12-17T23:28:38.2242073Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2024-12-17T23:28:38.2243273Z  ) 2024-12-17T23:28:38.2243916Z  print(f"::set-output name={key}::{value}") 2024-12-17T23:28:38.2244592Z  return 2024-12-17T23:28:38.2245270Z  2024-12-17T23:28:38.2245846Z  with open(GITHUB_OUTPUT, "a") as f: 2024-12-17T23:28:38.2246560Z  log.info(f"Setting output: {key}='{value}'") 2024-12-17T23:28:38.2247405Z  f.write(f"{key}={value}\n") 2024-12-17T23:28:38.2248078Z  2024-12-17T23:28:38.2248524Z  2024-12-17T23:28:38.2249291Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2024-12-17T23:28:38.2250140Z  return frozenset( 2024-12-17T23:28:38.2250915Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2024-12-17T23:28:38.2252012Z  ) 2024-12-17T23:28:38.2252558Z  2024-12-17T23:28:38.2253000Z  2024-12-17T23:28:38.2253665Z def parse_args() -> Any: 2024-12-17T23:28:38.2254438Z  parser = ArgumentParser("Get dynamic rollout settings") 2024-12-17T23:28:38.2255456Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2024-12-17T23:28:38.2256531Z  parser.add_argument( 2024-12-17T23:28:38.2257182Z  "--github-issue-repo", 2024-12-17T23:28:38.2257879Z  type=str, 2024-12-17T23:28:38.2258471Z  required=False, 2024-12-17T23:28:38.2259485Z  default="pytorch/test-infra", 2024-12-17T23:28:38.2260369Z  help="GitHub repo to get the issue", 2024-12-17T23:28:38.2261029Z  ) 2024-12-17T23:28:38.2261564Z  parser.add_argument( 2024-12-17T23:28:38.2262293Z  "--github-repo", 2024-12-17T23:28:38.2262901Z  type=str, 2024-12-17T23:28:38.2263483Z  required=True, 2024-12-17T23:28:38.2264224Z  help="GitHub repo where CI is running", 2024-12-17T23:28:38.2264890Z  ) 2024-12-17T23:28:38.2265417Z  parser.add_argument( 2024-12-17T23:28:38.2266299Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2024-12-17T23:28:38.2267116Z  ) 2024-12-17T23:28:38.2267653Z  parser.add_argument( 2024-12-17T23:28:38.2268557Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2024-12-17T23:28:38.2269427Z  ) 2024-12-17T23:28:38.2269982Z  parser.add_argument( 2024-12-17T23:28:38.2270872Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2024-12-17T23:28:38.2271753Z  ) 2024-12-17T23:28:38.2272582Z  parser.add_argument( 2024-12-17T23:28:38.2273711Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2024-12-17T23:28:38.2274673Z  ) 2024-12-17T23:28:38.2275226Z  parser.add_argument( 2024-12-17T23:28:38.2275887Z  "--github-ref-type", 2024-12-17T23:28:38.2276564Z  type=str, 2024-12-17T23:28:38.2277379Z  required=True, 2024-12-17T23:28:38.2278189Z  help="Current GitHub ref type, branch or tag", 2024-12-17T23:28:38.2278909Z  ) 2024-12-17T23:28:38.2279457Z  parser.add_argument( 2024-12-17T23:28:38.2280189Z  "--eligible-experiments", 2024-12-17T23:28:38.2280891Z  type=_str_comma_separated_to_set, 2024-12-17T23:28:38.2281586Z  required=False, 2024-12-17T23:28:38.2282302Z  default="", 2024-12-17T23:28:38.2283362Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2024-12-17T23:28:38.2284460Z  ) 2024-12-17T23:28:38.2285076Z  parser.add_argument( 2024-12-17T23:28:38.2285676Z  "--pr-number", 2024-12-17T23:28:38.2286300Z  type=str, 2024-12-17T23:28:38.2286979Z  required=False, 2024-12-17T23:28:38.2287556Z  default="", 2024-12-17T23:28:38.2288269Z  help="the optional PR number where this is run", 2024-12-17T23:28:38.2289083Z  ) 2024-12-17T23:28:38.2289562Z  2024-12-17T23:28:38.2290108Z  return parser.parse_args() 2024-12-17T23:28:38.2290895Z  2024-12-17T23:28:38.2291357Z  2024-12-17T23:28:38.2291943Z def get_gh_client(github_token: str) -> Github: 2024-12-17T23:28:38.2292809Z  auth = Auth.Token(github_token) 2024-12-17T23:28:38.2293457Z  return Github(auth=auth) 2024-12-17T23:28:38.2294082Z  2024-12-17T23:28:38.2294643Z  2024-12-17T23:28:38.2295278Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2024-12-17T23:28:38.2296163Z  repo = gh.get_repo(repo) 2024-12-17T23:28:38.2297024Z  return repo.get_issue(number=issue_num) 2024-12-17T23:28:38.2297666Z  2024-12-17T23:28:38.2298151Z  2024-12-17T23:28:38.2298765Z def get_potential_pr_author( 2024-12-17T23:28:38.2299877Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2024-12-17T23:28:38.2300681Z ) -> str: 2024-12-17T23:28:38.2301484Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2024-12-17T23:28:38.2302656Z  # Fetch the actual username from the original PR. The PR number is 2024-12-17T23:28:38.2303569Z  # embedded in the tag name: ciflow// 2024-12-17T23:28:38.2304413Z  2024-12-17T23:28:38.2304986Z  gh = get_gh_client(github_token) 2024-12-17T23:28:38.2305595Z  2024-12-17T23:28:38.2306318Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2024-12-17T23:28:38.2307158Z  split_tag = ref_name.split("/") 2024-12-17T23:28:38.2307782Z  if ( 2024-12-17T23:28:38.2308506Z  len(split_tag) == 3 2024-12-17T23:28:38.2309191Z  and split_tag[0] == "ciflow" 2024-12-17T23:28:38.2309951Z  and split_tag[2].isnumeric() 2024-12-17T23:28:38.2310610Z  ): 2024-12-17T23:28:38.2311181Z  pr_number = split_tag[2] 2024-12-17T23:28:38.2311891Z  try: 2024-12-17T23:28:38.2312527Z  repository = gh.get_repo(repo) 2024-12-17T23:28:38.2313340Z  pull = repository.get_pull(number=int(pr_number)) 2024-12-17T23:28:38.2314196Z  except Exception as e: 2024-12-17T23:28:38.2314905Z  raise Exception( # noqa: TRY002 2024-12-17T23:28:38.2315756Z  f"issue with pull request {pr_number} from repo {repository}" 2024-12-17T23:28:38.2316608Z  ) from e 2024-12-17T23:28:38.2317256Z  return pull.user.login 2024-12-17T23:28:38.2318032Z  # In all other cases, return the original input username 2024-12-17T23:28:38.2319025Z  return username 2024-12-17T23:28:38.2319590Z  2024-12-17T23:28:38.2320072Z  2024-12-17T23:28:38.2320718Z def is_exception_branch(branch: str) -> bool: 2024-12-17T23:28:38.2321406Z  """ 2024-12-17T23:28:38.2322248Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2024-12-17T23:28:38.2323255Z  """ 2024-12-17T23:28:38.2324017Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2024-12-17T23:28:38.2324841Z  2024-12-17T23:28:38.2325377Z  2024-12-17T23:28:38.2325935Z def load_yaml(yaml_text: str) -> Any: 2024-12-17T23:28:38.2326598Z  try: 2024-12-17T23:28:38.2327235Z  data = yaml.safe_load(yaml_text) 2024-12-17T23:28:38.2327923Z  return data 2024-12-17T23:28:38.2328510Z  except yaml.YAMLError: 2024-12-17T23:28:38.2329257Z  log.exception("Error loading YAML") 2024-12-17T23:28:38.2329972Z  raise 2024-12-17T23:28:38.2330507Z  2024-12-17T23:28:38.2331042Z  2024-12-17T23:28:38.2331859Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2024-12-17T23:28:38.2332742Z  """ 2024-12-17T23:28:38.2333611Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2024-12-17T23:28:38.2334615Z  2024-12-17T23:28:38.2335286Z  If the issue body contains "---" then the text above that is the settings 2024-12-17T23:28:38.2336284Z  and the text below is the list of opted in users. 2024-12-17T23:28:38.2337039Z  2024-12-17T23:28:38.2337788Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2024-12-17T23:28:38.2338676Z  """ 2024-12-17T23:28:38.2339606Z  rollout_state_parts = rollout_state.split("---") 2024-12-17T23:28:38.2340437Z  if len(rollout_state_parts) >= 2: 2024-12-17T23:28:38.2341269Z  return rollout_state_parts[0], rollout_state_parts[1] 2024-12-17T23:28:38.2342067Z  else: 2024-12-17T23:28:38.2342780Z  return "", rollout_state 2024-12-17T23:28:38.2343469Z  2024-12-17T23:28:38.2343966Z  2024-12-17T23:28:38.2344506Z class UserOptins(Dict[str, List[str]]): 2024-12-17T23:28:38.2345217Z  """ 2024-12-17T23:28:38.2345934Z  Dictionary of users with a list of features they have opted into 2024-12-17T23:28:38.2346736Z  """ 2024-12-17T23:28:38.2347291Z  2024-12-17T23:28:38.2347798Z  2024-12-17T23:28:38.2348517Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2024-12-17T23:28:38.2349373Z  """ 2024-12-17T23:28:38.2350295Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2024-12-17T23:28:38.2351320Z  2024-12-17T23:28:38.2352369Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2024-12-17T23:28:38.2353522Z  - Example line: "@User1,lf,split_build" 2024-12-17T23:28:38.2354404Z  - A "#" prefix indicates the user is opted out of all experiments 2024-12-17T23:28:38.2355258Z  2024-12-17T23:28:38.2355699Z  2024-12-17T23:28:38.2356202Z  """ 2024-12-17T23:28:38.2356798Z  optins = UserOptins() 2024-12-17T23:28:38.2357446Z  for user in user_optin_text.split("\n"): 2024-12-17T23:28:38.2358189Z  user = user.strip("\r\n\t -") 2024-12-17T23:28:38.2358987Z  if not user or not user.startswith("@"): 2024-12-17T23:28:38.2359684Z  # Not a valid user. Skip 2024-12-17T23:28:38.2360522Z  continue 2024-12-17T23:28:38.2361545Z  2024-12-17T23:28:38.2362021Z  if user: 2024-12-17T23:28:38.2362682Z  usr_name = user.split(",")[0].strip("@") 2024-12-17T23:28:38.2363669Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2024-12-17T23:28:38.2364484Z  2024-12-17T23:28:38.2364970Z  return optins 2024-12-17T23:28:38.2365622Z  2024-12-17T23:28:38.2366120Z  2024-12-17T23:28:38.2366738Z def is_valid_experiment_name(experiment_name: str) -> bool: 2024-12-17T23:28:38.2367584Z  """ 2024-12-17T23:28:38.2368760Z  Check if the experiment name is valid. 2024-12-17T23:28:38.2369702Z  A valid name: 2024-12-17T23:28:38.2370663Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2024-12-17T23:28:38.2371797Z  - The special characters "_" & "-" shouldn't be the first or last characters 2024-12-17T23:28:38.2372745Z  - Cannot contain spaces 2024-12-17T23:28:38.2373473Z  """ 2024-12-17T23:28:38.2374028Z  2024-12-17T23:28:38.2374588Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2024-12-17T23:28:38.2375576Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2024-12-17T23:28:38.2376350Z  2024-12-17T23:28:38.2376883Z  if valid: 2024-12-17T23:28:38.2377425Z  return True 2024-12-17T23:28:38.2378008Z  2024-12-17T23:28:38.2378439Z  log.error( 2024-12-17T23:28:38.2380560Z  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." 2024-12-17T23:28:38.2382283Z  ) 2024-12-17T23:28:38.2382871Z  return False 2024-12-17T23:28:38.2383425Z  2024-12-17T23:28:38.2383913Z  2024-12-17T23:28:38.2384628Z def parse_settings_from_text(settings_text: str) -> Settings: 2024-12-17T23:28:38.2385433Z  """ 2024-12-17T23:28:38.2386388Z  Parse the experiments from the issue body into a list of ExperimentSettings 2024-12-17T23:28:38.2387363Z  """ 2024-12-17T23:28:38.2387854Z  try: 2024-12-17T23:28:38.2388378Z  if settings_text: 2024-12-17T23:28:38.2389367Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2024-12-17T23:28:38.2390338Z  # for easy reading 2024-12-17T23:28:38.2391291Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2024-12-17T23:28:38.2392424Z  # the backtick character in shell commands. 2024-12-17T23:28:38.2393242Z  backtick = chr(96) # backtick character 2024-12-17T23:28:38.2394042Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2024-12-17T23:28:38.2394948Z  settings = load_yaml(settings_text) 2024-12-17T23:28:38.2395629Z  2024-12-17T23:28:38.2396350Z  # For now we just load experiments. We can expand this if/when we add more settings 2024-12-17T23:28:38.2397321Z  experiments = {} 2024-12-17T23:28:38.2397948Z  2024-12-17T23:28:38.2398668Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2024-12-17T23:28:38.2399605Z  if not is_valid_experiment_name(exp_name): 2024-12-17T23:28:38.2400904Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2024-12-17T23:28:38.2402292Z  continue 2024-12-17T23:28:38.2402928Z  2024-12-17T23:28:38.2403498Z  valid_settings = {} 2024-12-17T23:28:38.2404194Z  for setting in exp_settings: 2024-12-17T23:28:38.2405007Z  if setting not in Experiment._fields: 2024-12-17T23:28:38.2405720Z  log.warning( 2024-12-17T23:28:38.2406616Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2024-12-17T23:28:38.2407548Z  ) 2024-12-17T23:28:38.2408140Z  else: 2024-12-17T23:28:38.2408850Z  valid_settings[setting] = exp_settings[setting] 2024-12-17T23:28:38.2409642Z  2024-12-17T23:28:38.2410252Z  experiments[exp_name] = Experiment(**valid_settings) 2024-12-17T23:28:38.2411062Z  return Settings(experiments) 2024-12-17T23:28:38.2411822Z  2024-12-17T23:28:38.2412291Z  except Exception: 2024-12-17T23:28:38.2412963Z  log.exception("Failed to parse settings") 2024-12-17T23:28:38.2413732Z  2024-12-17T23:28:38.2414202Z  return Settings() 2024-12-17T23:28:38.2414785Z  2024-12-17T23:28:38.2415338Z  2024-12-17T23:28:38.2415917Z def parse_settings(rollout_state: str) -> Settings: 2024-12-17T23:28:38.2416647Z  """ 2024-12-17T23:28:38.2417336Z  Parse settings, if any, from the rollout state. 2024-12-17T23:28:38.2418044Z  2024-12-17T23:28:38.2418693Z  If the issue body contains "---" then the text above that is the settings 2024-12-17T23:28:38.2419882Z  and the text below is the list of opted in users. 2024-12-17T23:28:38.2420602Z  2024-12-17T23:28:38.2421328Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2024-12-17T23:28:38.2422346Z  """ 2024-12-17T23:28:38.2423095Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:28:38.2424033Z  return parse_settings_from_text(settings_text) 2024-12-17T23:28:38.2424815Z  2024-12-17T23:28:38.2425460Z  2024-12-17T23:28:38.2426063Z def parse_users(rollout_state: str) -> UserOptins: 2024-12-17T23:28:38.2426876Z  """ 2024-12-17T23:28:38.2427456Z  Parse users from the rollout state. 2024-12-17T23:28:38.2428082Z  2024-12-17T23:28:38.2428638Z  """ 2024-12-17T23:28:38.2429382Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:28:38.2430302Z  return parse_user_opt_in_from_text(users_text) 2024-12-17T23:28:38.2431051Z  2024-12-17T23:28:38.2431541Z  2024-12-17T23:28:38.2432307Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:28:38.2433289Z  """ 2024-12-17T23:28:38.2433937Z  Check if a user is opted into an experiment 2024-12-17T23:28:38.2434629Z  """ 2024-12-17T23:28:38.2435329Z  return experiment_name in user_optins.get(user, []) 2024-12-17T23:28:38.2436089Z  2024-12-17T23:28:38.2436569Z  2024-12-17T23:28:38.2437430Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:28:38.2438378Z  """ 2024-12-17T23:28:38.2439008Z  Check if a user explicitly opted out of an experiment 2024-12-17T23:28:38.2439826Z  """ 2024-12-17T23:28:38.2440511Z  # if the experiment is prefixed with a "-", then it's an opt-out 2024-12-17T23:28:38.2441362Z  experiment_optout = "-" + experiment_name 2024-12-17T23:28:38.2442273Z  if experiment_optout not in user_optins.get(user, []): 2024-12-17T23:28:38.2443173Z  return False 2024-12-17T23:28:38.2443738Z  2024-12-17T23:28:38.2444471Z  if is_user_opted_in(user, user_optins, experiment_name): 2024-12-17T23:28:38.2445203Z  log.warning( 2024-12-17T23:28:38.2446227Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2024-12-17T23:28:38.2447357Z  ) 2024-12-17T23:28:38.2447842Z  2024-12-17T23:28:38.2448333Z  return True 2024-12-17T23:28:38.2448962Z  2024-12-17T23:28:38.2449401Z  2024-12-17T23:28:38.2449902Z def get_runner_prefix( 2024-12-17T23:28:38.2450611Z  rollout_state: str, 2024-12-17T23:28:38.2451228Z  workflow_requestors: Iterable[str], 2024-12-17T23:28:38.2451907Z  branch: str, 2024-12-17T23:28:38.2452678Z  eligible_experiments: FrozenSet[str] = frozenset(), 2024-12-17T23:28:38.2453427Z  is_canary: bool = False, 2024-12-17T23:28:38.2454055Z ) -> str: 2024-12-17T23:28:38.2454748Z  settings = parse_settings(rollout_state) 2024-12-17T23:28:38.2455506Z  user_optins = parse_users(rollout_state) 2024-12-17T23:28:38.2456175Z  2024-12-17T23:28:38.2456767Z  fleet_prefix = "" 2024-12-17T23:28:38.2457351Z  prefixes = [] 2024-12-17T23:28:38.2458175Z  for experiment_name, experiment_settings in settings.experiments.items(): 2024-12-17T23:28:38.2460074Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2024-12-17T23:28:38.2461015Z  log.info( 2024-12-17T23:28:38.2461844Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2024-12-17T23:28:38.2462860Z  ) 2024-12-17T23:28:38.2463495Z  continue 2024-12-17T23:28:38.2464100Z  2024-12-17T23:28:38.2464654Z  if eligible_experiments: 2024-12-17T23:28:38.2465411Z  if experiment_name not in eligible_experiments: 2024-12-17T23:28:38.2466240Z  exp_list = ", ".join(eligible_experiments) 2024-12-17T23:28:38.2467154Z  log.info( 2024-12-17T23:28:38.2468149Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2024-12-17T23:28:38.2469233Z  ) 2024-12-17T23:28:38.2469778Z  continue 2024-12-17T23:28:38.2470439Z  elif not experiment_settings.default: 2024-12-17T23:28:38.2471205Z  log.info( 2024-12-17T23:28:38.2472062Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2024-12-17T23:28:38.2472952Z  ) 2024-12-17T23:28:38.2473616Z  continue 2024-12-17T23:28:38.2474163Z  2024-12-17T23:28:38.2474789Z  # Is any workflow_requestor opted out to this experiment? 2024-12-17T23:28:38.2475646Z  opted_out_users = [ 2024-12-17T23:28:38.2476247Z  requestor 2024-12-17T23:28:38.2476914Z  for requestor in workflow_requestors 2024-12-17T23:28:38.2477835Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2024-12-17T23:28:38.2478622Z  ] 2024-12-17T23:28:38.2479118Z  2024-12-17T23:28:38.2479701Z  if opted_out_users: 2024-12-17T23:28:38.2480338Z  log.info( 2024-12-17T23:28:38.2481136Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2024-12-17T23:28:38.2482058Z  ) 2024-12-17T23:28:38.2482632Z  continue 2024-12-17T23:28:38.2483182Z  2024-12-17T23:28:38.2484031Z  # Is any workflow_requestor opted in to this experiment? 2024-12-17T23:28:38.2484820Z  opted_in_users = [ 2024-12-17T23:28:38.2485403Z  requestor 2024-12-17T23:28:38.2486117Z  for requestor in workflow_requestors 2024-12-17T23:28:38.2486987Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2024-12-17T23:28:38.2487729Z  ] 2024-12-17T23:28:38.2488330Z  2024-12-17T23:28:38.2488845Z  enabled = False 2024-12-17T23:28:38.2489422Z  if opted_in_users: 2024-12-17T23:28:38.2490108Z  log.info( 2024-12-17T23:28:38.2490931Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2024-12-17T23:28:38.2491723Z  ) 2024-12-17T23:28:38.2492355Z  enabled = True 2024-12-17T23:28:38.2492951Z  2024-12-17T23:28:38.2493502Z  elif experiment_settings.rollout_perc: 2024-12-17T23:28:38.2494573Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2024-12-17T23:28:38.2495683Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2024-12-17T23:28:38.2496475Z  log.info( 2024-12-17T23:28:38.2497617Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2024-12-17T23:28:38.2498687Z  ) 2024-12-17T23:28:38.2499395Z  enabled = True 2024-12-17T23:28:38.2500111Z  2024-12-17T23:28:38.2500609Z  if enabled: 2024-12-17T23:28:38.2501206Z  label = experiment_name 2024-12-17T23:28:38.2502030Z  if experiment_name == LF_FLEET_EXPERIMENT: 2024-12-17T23:28:38.2502997Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2024-12-17T23:28:38.2504062Z  # - If it's enabled, then we always list it's prefix first 2024-12-17T23:28:38.2505239Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2024-12-17T23:28:38.2506043Z  if is_canary: 2024-12-17T23:28:38.2506840Z  label += CANARY_FLEET_SUFFIX 2024-12-17T23:28:38.2507635Z  fleet_prefix = label 2024-12-17T23:28:38.2508308Z  else: 2024-12-17T23:28:38.2508871Z  prefixes.append(label) 2024-12-17T23:28:38.2509610Z  2024-12-17T23:28:38.2510128Z  if len(prefixes) > 1: 2024-12-17T23:28:38.2510690Z  log.error( 2024-12-17T23:28:38.2512001Z  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:])}" 2024-12-17T23:28:38.2513295Z  ) 2024-12-17T23:28:38.2513802Z  prefixes = prefixes[:1] 2024-12-17T23:28:38.2514514Z  2024-12-17T23:28:38.2515041Z  # Fleet always comes first 2024-12-17T23:28:38.2515645Z  if fleet_prefix: 2024-12-17T23:28:38.2516356Z  prefixes.insert(0, fleet_prefix) 2024-12-17T23:28:38.2517033Z  2024-12-17T23:28:38.2517585Z  return ".".join(prefixes) + "." if prefixes else "" 2024-12-17T23:28:38.2518408Z  2024-12-17T23:28:38.2518886Z  2024-12-17T23:28:38.2519628Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2024-12-17T23:28:38.2520649Z  """ 2024-12-17T23:28:38.2521433Z  Gets the first comment of the issue, which contains the desired rollout state. 2024-12-17T23:28:38.2522354Z  2024-12-17T23:28:38.2523265Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2024-12-17T23:28:38.2524134Z  """ 2024-12-17T23:28:38.2524765Z  gh = get_gh_client(github_token) 2024-12-17T23:28:38.2525468Z  issue = get_issue(gh, repo, issue_num) 2024-12-17T23:28:38.2526293Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2024-12-17T23:28:38.2527114Z  2024-12-17T23:28:38.2527577Z  2024-12-17T23:28:38.2528334Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2024-12-17T23:28:38.2529316Z  for _ in range(num_retries): 2024-12-17T23:28:38.2529945Z  try: 2024-12-17T23:28:38.2530554Z  req = Request(url=url, headers=headers) 2024-12-17T23:28:38.2531454Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2024-12-17T23:28:38.2532286Z  return json.loads(content) 2024-12-17T23:28:38.2532958Z  except Exception as e: 2024-12-17T23:28:38.2533764Z  log.warning(f"Could not download {url}: {e}") 2024-12-17T23:28:38.2534531Z  2024-12-17T23:28:38.2535244Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2024-12-17T23:28:38.2536177Z  return {} 2024-12-17T23:28:38.2536739Z  2024-12-17T23:28:38.2537195Z  2024-12-17T23:28:38.2537741Z @lru_cache(maxsize=None) 2024-12-17T23:28:38.2538658Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2024-12-17T23:28:38.2539953Z  """ 2024-12-17T23:28:38.2540590Z  Dynamically get PR information 2024-12-17T23:28:38.2541270Z  """ 2024-12-17T23:28:38.2541926Z  github_api = f"https://api.github.com/repos/{github_repo}" 2024-12-17T23:28:38.2542772Z  headers = { 2024-12-17T23:28:38.2543467Z  "Accept": "application/vnd.github.v3+json", 2024-12-17T23:28:38.2544220Z  "Authorization": f"token {github_token}", 2024-12-17T23:28:38.2544959Z  } 2024-12-17T23:28:38.2545596Z  json_response: Dict[str, Any] = download_json( 2024-12-17T23:28:38.2546527Z  url=f"{github_api}/issues/{pr_number}", 2024-12-17T23:28:38.2547267Z  headers=headers, 2024-12-17T23:28:38.2547906Z  ) 2024-12-17T23:28:38.2548409Z  2024-12-17T23:28:38.2548929Z  if not json_response: 2024-12-17T23:28:38.2549729Z  log.warning(f"Failed to get the labels for #{pr_number}") 2024-12-17T23:28:38.2550507Z  return {} 2024-12-17T23:28:38.2551076Z  2024-12-17T23:28:38.2551613Z  return json_response 2024-12-17T23:28:38.2552210Z  2024-12-17T23:28:38.2552709Z  2024-12-17T23:28:38.2553477Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2024-12-17T23:28:38.2554365Z  """ 2024-12-17T23:28:38.2555096Z  Dynamically get the latest list of labels from the pull request 2024-12-17T23:28:38.2555926Z  """ 2024-12-17T23:28:38.2556581Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2024-12-17T23:28:38.2557375Z  return { 2024-12-17T23:28:38.2558168Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2024-12-17T23:28:38.2559027Z  } 2024-12-17T23:28:38.2559537Z  2024-12-17T23:28:38.2560035Z  2024-12-17T23:28:38.2560547Z def main() -> None: 2024-12-17T23:28:38.2561159Z  args = parse_args() 2024-12-17T23:28:38.2561777Z  2024-12-17T23:28:38.2562366Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2024-12-17T23:28:38.2563065Z  2024-12-17T23:28:38.2563594Z  # Check if the PR is opt-out 2024-12-17T23:28:38.2564427Z  if args.pr_number: 2024-12-17T23:28:38.2565356Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2024-12-17T23:28:38.2566257Z  if OPT_OUT_LABEL in labels: 2024-12-17T23:28:38.2566911Z  log.info( 2024-12-17T23:28:38.2567865Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2024-12-17T23:28:38.2568790Z  ) 2024-12-17T23:28:38.2569527Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:28:38.2570431Z  sys.exit() 2024-12-17T23:28:38.2571003Z  2024-12-17T23:28:38.2571487Z  try: 2024-12-17T23:28:38.2572166Z  rollout_state = get_rollout_state_from_issue( 2024-12-17T23:28:38.2573042Z  args.github_token, args.github_issue_repo, args.github_issue 2024-12-17T23:28:38.2573849Z  ) 2024-12-17T23:28:38.2574472Z  2024-12-17T23:28:38.2574984Z  username = get_potential_pr_author( 2024-12-17T23:28:38.2575676Z  args.github_token, 2024-12-17T23:28:38.2576417Z  args.github_repo, 2024-12-17T23:28:38.2577068Z  args.github_actor, 2024-12-17T23:28:38.2577688Z  args.github_ref_type, 2024-12-17T23:28:38.2578427Z  args.github_branch, 2024-12-17T23:28:38.2579053Z  ) 2024-12-17T23:28:38.2579663Z  2024-12-17T23:28:38.2580385Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2024-12-17T23:28:38.2581144Z  2024-12-17T23:28:38.2581666Z  runner_label_prefix = get_runner_prefix( 2024-12-17T23:28:38.2582467Z  rollout_state, 2024-12-17T23:28:38.2583138Z  (args.github_issue_owner, username), 2024-12-17T23:28:38.2583816Z  args.github_branch, 2024-12-17T23:28:38.2584593Z  args.eligible_experiments, 2024-12-17T23:28:38.2585261Z  is_canary, 2024-12-17T23:28:38.2585822Z  ) 2024-12-17T23:28:38.2586402Z  2024-12-17T23:28:38.2586913Z  except Exception as e: 2024-12-17T23:28:38.2587665Z  log.error( 2024-12-17T23:28:38.2588619Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2024-12-17T23:28:38.2589558Z  ) 2024-12-17T23:28:38.2590045Z  2024-12-17T23:28:38.2590800Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:28:38.2591631Z  2024-12-17T23:28:38.2592063Z  2024-12-17T23:28:38.2592626Z if __name__ == "__main__": 2024-12-17T23:28:38.2593252Z  main() 2024-12-17T23:28:38.2593743Z  2024-12-17T23:28:38.2594282Z EOF 2024-12-17T23:28:38.2594803Z  2024-12-17T23:28:38.2595273Z cat runner_determinator.py 2024-12-17T23:28:38.3344151Z shell: /usr/bin/bash -e {0} 2024-12-17T23:28:38.3345162Z env: 2024-12-17T23:28:38.3345996Z GITHUB_TOKEN: *** 2024-12-17T23:28:38.3346618Z ISSUE_NUMBER: 5132 2024-12-17T23:28:38.3347225Z TRIGGERING_ACTOR: malfet 2024-12-17T23:28:38.3347838Z ISSUE_OWNER: 2024-12-17T23:28:38.3348407Z CHECK_EXPERIMENTS: 2024-12-17T23:28:38.3348999Z PR_NUMBER: 2024-12-17T23:28:38.3349530Z ##[endgroup] 2024-12-17T23:28:38.3578579Z # flake8: noqa: G004 2024-12-17T23:28:38.3579003Z 2024-12-17T23:28:38.3579799Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2024-12-17T23:28:38.3581128Z # must be kept in sync. You can do it easily by running the following command: 2024-12-17T23:28:38.3582021Z # python .github/scripts/update_runner_determinator.py 2024-12-17T23:28:38.3582538Z 2024-12-17T23:28:38.3582723Z """ 2024-12-17T23:28:38.3583812Z This runner determinator is used to determine which set of runners to run a 2024-12-17T23:28:38.3584800Z GitHub job on. It uses the first comment of a GitHub issue (by default 2024-12-17T23:28:38.3585777Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2024-12-17T23:28:38.3586852Z of which runners should be used to run which job. 2024-12-17T23:28:38.3587307Z 2024-12-17T23:28:38.3587763Z The configuration has two parts, the settings and a list of opted-in users, 2024-12-17T23:28:38.3588717Z separated by a line containing "---". If the line is not present, the 2024-12-17T23:28:38.3589810Z settings are considered to be empty with only the second part, the user 2024-12-17T23:28:38.3591310Z list, defined. 2024-12-17T23:28:38.3591622Z 2024-12-17T23:28:38.3592060Z The first part is a YAML block that defines the rollout settings. This can be 2024-12-17T23:28:38.3593126Z used to define any settings that are needed to determine which runners to use. 2024-12-17T23:28:38.3594197Z It's fields are defined by the RolloutSettings class below. 2024-12-17T23:28:38.3594694Z 2024-12-17T23:28:38.3595145Z The second part is a list of users who are explicitly opted in to the LF fleet. 2024-12-17T23:28:38.3596112Z The user list is also a comma separated list of additional features or 2024-12-17T23:28:38.3597070Z experiments which the user could be opted in to. 2024-12-17T23:28:38.3597549Z 2024-12-17T23:28:38.3597844Z The user list has the following rules: 2024-12-17T23:28:38.3598251Z 2024-12-17T23:28:38.3598616Z - Users are GitHub usernames, which must start with the @ prefix 2024-12-17T23:28:38.3599705Z - Each user is also a comma-separated list of features/experiments to enable 2024-12-17T23:28:38.3600623Z - A "#" prefix opts the user out of all experiments 2024-12-17T23:28:38.3601074Z 2024-12-17T23:28:38.3601382Z Example config: 2024-12-17T23:28:38.3601953Z # A list of experiments that can be opted into. 2024-12-17T23:28:38.3602763Z # This defines the behavior they'll induce when opted into. 2024-12-17T23:28:38.3603651Z # Expected syntax is: 2024-12-17T23:28:38.3604453Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2024-12-17T23:28:38.3605585Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2024-12-17T23:28:38.3606245Z 2024-12-17T23:28:38.3606733Z experiments: 2024-12-17T23:28:38.3607290Z lf: 2024-12-17T23:28:38.3607809Z rollout_percent: 25 2024-12-17T23:28:38.3608443Z all_branches: false 2024-12-17T23:28:38.3609015Z default: true 2024-12-17T23:28:38.3609538Z --- 2024-12-17T23:28:38.3609784Z 2024-12-17T23:28:38.3610077Z # Opt-ins: 2024-12-17T23:28:38.3610778Z # Users can opt into the LF fleet by adding their GitHub username to this list 2024-12-17T23:28:38.3611772Z # and specifying experiments to enable in a comma-separated list. 2024-12-17T23:28:38.3612724Z # To always opt out of an experiment, prefix it with a "-". 2024-12-17T23:28:38.3613510Z # Experiments should be from the above list. 2024-12-17T23:28:38.3613975Z 2024-12-17T23:28:38.3614197Z @User1,-lf,split_build 2024-12-17T23:28:38.3614806Z @User2,lf 2024-12-17T23:28:38.3615306Z @User3,split_build 2024-12-17T23:28:38.3615841Z """ 2024-12-17T23:28:38.3616066Z 2024-12-17T23:28:38.3616379Z import json 2024-12-17T23:28:38.3616853Z import logging 2024-12-17T23:28:38.3617356Z import os 2024-12-17T23:28:38.3617903Z import random 2024-12-17T23:28:38.3618373Z import re 2024-12-17T23:28:38.3618845Z import sys 2024-12-17T23:28:38.3619793Z from argparse import ArgumentParser 2024-12-17T23:28:38.3620507Z from functools import lru_cache 2024-12-17T23:28:38.3621125Z from logging import LogRecord 2024-12-17T23:28:38.3622014Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2024-12-17T23:28:38.3622920Z from urllib.request import Request, urlopen 2024-12-17T23:28:38.3623390Z 2024-12-17T23:28:38.3623599Z import yaml 2024-12-17T23:28:38.3624176Z from github import Auth, Github 2024-12-17T23:28:38.3624968Z from github.Issue import Issue 2024-12-17T23:28:38.3625371Z 2024-12-17T23:28:38.3625378Z 2024-12-17T23:28:38.3625635Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2024-12-17T23:28:38.3626500Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2024-12-17T23:28:38.3627520Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2024-12-17T23:28:38.3628134Z 2024-12-17T23:28:38.3628404Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2024-12-17T23:28:38.3629146Z GH_OUTPUT_KEY_AMI = "runner-ami" 2024-12-17T23:28:38.3629811Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2024-12-17T23:28:38.3630454Z OPT_OUT_LABEL = "no-runner-experiments" 2024-12-17T23:28:38.3630875Z 2024-12-17T23:28:38.3631171Z SETTING_EXPERIMENTS = "experiments" 2024-12-17T23:28:38.3631571Z 2024-12-17T23:28:38.3631854Z LF_FLEET_EXPERIMENT = "lf" 2024-12-17T23:28:38.3632394Z CANARY_FLEET_SUFFIX = ".c" 2024-12-17T23:28:38.3632739Z 2024-12-17T23:28:38.3632756Z 2024-12-17T23:28:38.3633053Z class Experiment(NamedTuple): 2024-12-17T23:28:38.3633680Z rollout_perc: float = ( 2024-12-17T23:28:38.3634404Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2024-12-17T23:28:38.3635251Z ) 2024-12-17T23:28:38.3635765Z all_branches: bool = ( 2024-12-17T23:28:38.3636478Z False # If True, the experiment is also enabled on the exception branches 2024-12-17T23:28:38.3637324Z ) 2024-12-17T23:28:38.3637831Z default: bool = ( 2024-12-17T23:28:38.3638473Z True # If True, the experiment is enabled by default for all queries 2024-12-17T23:28:38.3639283Z ) 2024-12-17T23:28:38.3639551Z 2024-12-17T23:28:38.3639816Z # Add more fields as needed 2024-12-17T23:28:38.3640165Z 2024-12-17T23:28:38.3640172Z 2024-12-17T23:28:38.3640428Z class Settings(NamedTuple): 2024-12-17T23:28:38.3640999Z """ 2024-12-17T23:28:38.3641601Z Settings for the experiments that can be opted into. 2024-12-17T23:28:38.3642295Z """ 2024-12-17T23:28:38.3642514Z 2024-12-17T23:28:38.3642846Z experiments: Dict[str, Experiment] = {} 2024-12-17T23:28:38.3643310Z 2024-12-17T23:28:38.3643316Z 2024-12-17T23:28:38.3643573Z class ColorFormatter(logging.Formatter): 2024-12-17T23:28:38.3644306Z """Color codes the log messages based on the log level""" 2024-12-17T23:28:38.3644960Z 2024-12-17T23:28:38.3645257Z COLORS = { 2024-12-17T23:28:38.3645809Z "WARNING": "\033[33m", # Yellow 2024-12-17T23:28:38.3646453Z "ERROR": "\033[31m", # Red 2024-12-17T23:28:38.3647082Z "CRITICAL": "\033[31m", # Red 2024-12-17T23:28:38.3647726Z "INFO": "\033[0m", # Reset 2024-12-17T23:28:38.3648336Z "DEBUG": "\033[0m", # Reset 2024-12-17T23:28:38.3648932Z } 2024-12-17T23:28:38.3649221Z 2024-12-17T23:28:38.3649475Z def format(self, record: LogRecord) -> str: 2024-12-17T23:28:38.3650359Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2024-12-17T23:28:38.3651301Z record.msg = f"{log_color}{record.msg}\033[0m" 2024-12-17T23:28:38.3652046Z return super().format(record) 2024-12-17T23:28:38.3652483Z 2024-12-17T23:28:38.3652490Z 2024-12-17T23:28:38.3652725Z handler = logging.StreamHandler() 2024-12-17T23:28:38.3653619Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2024-12-17T23:28:38.3654230Z 2024-12-17T23:28:38.3654566Z log = logging.getLogger(os.path.basename(__file__)) 2024-12-17T23:28:38.3655295Z log.addHandler(handler) 2024-12-17T23:28:38.3655926Z log.setLevel(logging.INFO) 2024-12-17T23:28:38.3656262Z 2024-12-17T23:28:38.3656270Z 2024-12-17T23:28:38.3656574Z def set_github_output(key: str, value: str) -> None: 2024-12-17T23:28:38.3657257Z """ 2024-12-17T23:28:38.3657948Z Defines outputs of the github action that invokes this script 2024-12-17T23:28:38.3658681Z """ 2024-12-17T23:28:38.3659156Z if not GITHUB_OUTPUT: 2024-12-17T23:28:38.3660730Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2024-12-17T23:28:38.3662177Z log.warning( 2024-12-17T23:28:38.3663150Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2024-12-17T23:28:38.3664288Z ) 2024-12-17T23:28:38.3674639Z print(f"::set-output name={key}::{value}") 2024-12-17T23:28:38.3675347Z return 2024-12-17T23:28:38.3675750Z 2024-12-17T23:28:38.3676030Z with open(GITHUB_OUTPUT, "a") as f: 2024-12-17T23:28:38.3676729Z log.info(f"Setting output: {key}='{value}'") 2024-12-17T23:28:38.3677376Z f.write(f"{key}={value}\n") 2024-12-17T23:28:38.3677842Z 2024-12-17T23:28:38.3677851Z 2024-12-17T23:28:38.3678242Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2024-12-17T23:28:38.3679011Z return frozenset( 2024-12-17T23:28:38.3679704Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2024-12-17T23:28:38.3680623Z ) 2024-12-17T23:28:38.3680864Z 2024-12-17T23:28:38.3680872Z 2024-12-17T23:28:38.3681129Z def parse_args() -> Any: 2024-12-17T23:28:38.3681778Z parser = ArgumentParser("Get dynamic rollout settings") 2024-12-17T23:28:38.3682853Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2024-12-17T23:28:38.3683750Z parser.add_argument( 2024-12-17T23:28:38.3684300Z "--github-issue-repo", 2024-12-17T23:28:38.3684971Z type=str, 2024-12-17T23:28:38.3685484Z required=False, 2024-12-17T23:28:38.3686006Z default="pytorch/test-infra", 2024-12-17T23:28:38.3686742Z help="GitHub repo to get the issue", 2024-12-17T23:28:38.3687365Z ) 2024-12-17T23:28:38.3687834Z parser.add_argument( 2024-12-17T23:28:38.3688463Z "--github-repo", 2024-12-17T23:28:38.3689007Z type=str, 2024-12-17T23:28:38.3689499Z required=True, 2024-12-17T23:28:38.3690158Z help="GitHub repo where CI is running", 2024-12-17T23:28:38.3690807Z ) 2024-12-17T23:28:38.3691276Z parser.add_argument( 2024-12-17T23:28:38.3692063Z "--github-issue", type=int, required=True, help="GitHub issue number" 2024-12-17T23:28:38.3692845Z ) 2024-12-17T23:28:38.3693306Z parser.add_argument( 2024-12-17T23:28:38.3694306Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2024-12-17T23:28:38.3695145Z ) 2024-12-17T23:28:38.3695593Z parser.add_argument( 2024-12-17T23:28:38.3696423Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2024-12-17T23:28:38.3697256Z ) 2024-12-17T23:28:38.3697694Z parser.add_argument( 2024-12-17T23:28:38.3698530Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2024-12-17T23:28:38.3699699Z ) 2024-12-17T23:28:38.3700194Z parser.add_argument( 2024-12-17T23:28:38.3700862Z "--github-ref-type", 2024-12-17T23:28:38.3701482Z type=str, 2024-12-17T23:28:38.3701967Z required=True, 2024-12-17T23:28:38.3702652Z help="Current GitHub ref type, branch or tag", 2024-12-17T23:28:38.3703316Z ) 2024-12-17T23:28:38.3703757Z parser.add_argument( 2024-12-17T23:28:38.3704405Z "--eligible-experiments", 2024-12-17T23:28:38.3705035Z type=_str_comma_separated_to_set, 2024-12-17T23:28:38.3705641Z required=False, 2024-12-17T23:28:38.3706262Z default="", 2024-12-17T23:28:38.3707237Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2024-12-17T23:28:38.3708256Z ) 2024-12-17T23:28:38.3708813Z parser.add_argument( 2024-12-17T23:28:38.3709358Z "--pr-number", 2024-12-17T23:28:38.3709838Z type=str, 2024-12-17T23:28:38.3710431Z required=False, 2024-12-17T23:28:38.3710969Z default="", 2024-12-17T23:28:38.3711519Z help="the optional PR number where this is run", 2024-12-17T23:28:38.3712281Z ) 2024-12-17T23:28:38.3712720Z 2024-12-17T23:28:38.3712990Z return parser.parse_args() 2024-12-17T23:28:38.3713360Z 2024-12-17T23:28:38.3713367Z 2024-12-17T23:28:38.3713656Z def get_gh_client(github_token: str) -> Github: 2024-12-17T23:28:38.3714413Z auth = Auth.Token(github_token) 2024-12-17T23:28:38.3715029Z return Github(auth=auth) 2024-12-17T23:28:38.3715386Z 2024-12-17T23:28:38.3715394Z 2024-12-17T23:28:38.3715752Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2024-12-17T23:28:38.3716561Z repo = gh.get_repo(repo) 2024-12-17T23:28:38.3717189Z return repo.get_issue(number=issue_num) 2024-12-17T23:28:38.3717594Z 2024-12-17T23:28:38.3717601Z 2024-12-17T23:28:38.3717849Z def get_potential_pr_author( 2024-12-17T23:28:38.3718646Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2024-12-17T23:28:38.3719470Z ) -> str: 2024-12-17T23:28:38.3720096Z # If the trigger was a new tag added by a bot, this is a ciflow case 2024-12-17T23:28:38.3721087Z # Fetch the actual username from the original PR. The PR number is 2024-12-17T23:28:38.3721984Z # embedded in the tag name: ciflow// 2024-12-17T23:28:38.3722438Z 2024-12-17T23:28:38.3722688Z gh = get_gh_client(github_token) 2024-12-17T23:28:38.3723145Z 2024-12-17T23:28:38.3723528Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2024-12-17T23:28:38.3724255Z split_tag = ref_name.split("/") 2024-12-17T23:28:38.3724858Z if ( 2024-12-17T23:28:38.3725471Z len(split_tag) == 3 2024-12-17T23:28:38.3726030Z and split_tag[0] == "ciflow" 2024-12-17T23:28:38.3726655Z and split_tag[2].isnumeric() 2024-12-17T23:28:38.3727368Z ): 2024-12-17T23:28:38.3727841Z pr_number = split_tag[2] 2024-12-17T23:28:38.3728422Z try: 2024-12-17T23:28:38.3729083Z repository = gh.get_repo(repo) 2024-12-17T23:28:38.3729795Z pull = repository.get_pull(number=int(pr_number)) 2024-12-17T23:28:38.3730520Z except Exception as e: 2024-12-17T23:28:38.3731281Z raise Exception( # noqa: TRY002 2024-12-17T23:28:38.3732057Z f"issue with pull request {pr_number} from repo {repository}" 2024-12-17T23:28:38.3732811Z ) from e 2024-12-17T23:28:38.3733484Z return pull.user.login 2024-12-17T23:28:38.3734303Z # In all other cases, return the original input username 2024-12-17T23:28:38.3735028Z return username 2024-12-17T23:28:38.3735394Z 2024-12-17T23:28:38.3735401Z 2024-12-17T23:28:38.3735725Z def is_exception_branch(branch: str) -> bool: 2024-12-17T23:28:38.3736354Z """ 2024-12-17T23:28:38.3737425Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2024-12-17T23:28:38.3738483Z """ 2024-12-17T23:28:38.3739119Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2024-12-17T23:28:38.3740204Z 2024-12-17T23:28:38.3740213Z 2024-12-17T23:28:38.3740458Z def load_yaml(yaml_text: str) -> Any: 2024-12-17T23:28:38.3741204Z try: 2024-12-17T23:28:38.3741721Z data = yaml.safe_load(yaml_text) 2024-12-17T23:28:38.3742304Z return data 2024-12-17T23:28:38.3742921Z except yaml.YAMLError: 2024-12-17T23:28:38.3743482Z log.exception("Error loading YAML") 2024-12-17T23:28:38.3744131Z raise 2024-12-17T23:28:38.3744515Z 2024-12-17T23:28:38.3744522Z 2024-12-17T23:28:38.3745001Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2024-12-17T23:28:38.3745885Z """ 2024-12-17T23:28:38.3746570Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2024-12-17T23:28:38.3747357Z 2024-12-17T23:28:38.3747746Z If the issue body contains "---" then the text above that is the settings 2024-12-17T23:28:38.3748639Z and the text below is the list of opted in users. 2024-12-17T23:28:38.3749097Z 2024-12-17T23:28:38.3749508Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2024-12-17T23:28:38.3750677Z """ 2024-12-17T23:28:38.3751241Z rollout_state_parts = rollout_state.split("---") 2024-12-17T23:28:38.3751912Z if len(rollout_state_parts) >= 2: 2024-12-17T23:28:38.3753257Z return rollout_state_parts[0], rollout_state_parts[1] 2024-12-17T23:28:38.3753995Z else: 2024-12-17T23:28:38.3754498Z return "", rollout_state 2024-12-17T23:28:38.3755035Z 2024-12-17T23:28:38.3755044Z 2024-12-17T23:28:38.3755293Z class UserOptins(Dict[str, List[str]]): 2024-12-17T23:28:38.3755923Z """ 2024-12-17T23:28:38.3756625Z Dictionary of users with a list of features they have opted into 2024-12-17T23:28:38.3757440Z """ 2024-12-17T23:28:38.3757713Z 2024-12-17T23:28:38.3757720Z 2024-12-17T23:28:38.3758111Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2024-12-17T23:28:38.3758942Z """ 2024-12-17T23:28:38.3759779Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2024-12-17T23:28:38.3760561Z 2024-12-17T23:28:38.3761230Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2024-12-17T23:28:38.3762435Z - Example line: "@User1,lf,split_build" 2024-12-17T23:28:38.3763237Z - A "#" prefix indicates the user is opted out of all experiments 2024-12-17T23:28:38.3763805Z 2024-12-17T23:28:38.3763812Z 2024-12-17T23:28:38.3764010Z """ 2024-12-17T23:28:38.3764569Z optins = UserOptins() 2024-12-17T23:28:38.3765200Z for user in user_optin_text.split("\n"): 2024-12-17T23:28:38.3765842Z user = user.strip("\r\n\t -") 2024-12-17T23:28:38.3766589Z if not user or not user.startswith("@"): 2024-12-17T23:28:38.3767284Z # Not a valid user. Skip 2024-12-17T23:28:38.3767873Z continue 2024-12-17T23:28:38.3768197Z 2024-12-17T23:28:38.3768525Z if user: 2024-12-17T23:28:38.3769153Z usr_name = user.split(",")[0].strip("@") 2024-12-17T23:28:38.3769974Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2024-12-17T23:28:38.3770554Z 2024-12-17T23:28:38.3770896Z return optins 2024-12-17T23:28:38.3771196Z 2024-12-17T23:28:38.3771202Z 2024-12-17T23:28:38.3771567Z def is_valid_experiment_name(experiment_name: str) -> bool: 2024-12-17T23:28:38.3772466Z """ 2024-12-17T23:28:38.3773275Z Check if the experiment name is valid. 2024-12-17T23:28:38.3773986Z A valid name: 2024-12-17T23:28:38.3774746Z - Contains only alphanumeric characters and the special characters "_" & "-" 2024-12-17T23:28:38.3775853Z - The special characters "_" & "-" shouldn't be the first or last characters 2024-12-17T23:28:38.3777206Z - Cannot contain spaces 2024-12-17T23:28:38.3777882Z """ 2024-12-17T23:28:38.3778149Z 2024-12-17T23:28:38.3778543Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2024-12-17T23:28:38.3780336Z valid = bool(re.match(valid_char_regex, experiment_name)) 2024-12-17T23:28:38.3780931Z 2024-12-17T23:28:38.3781175Z if valid: 2024-12-17T23:28:38.3781731Z return True 2024-12-17T23:28:38.3782086Z 2024-12-17T23:28:38.3782297Z log.error( 2024-12-17T23:28:38.3783904Z 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." 2024-12-17T23:28:38.3785731Z ) 2024-12-17T23:28:38.3786192Z return False 2024-12-17T23:28:38.3786505Z 2024-12-17T23:28:38.3786512Z 2024-12-17T23:28:38.3786864Z def parse_settings_from_text(settings_text: str) -> Settings: 2024-12-17T23:28:38.3787692Z """ 2024-12-17T23:28:38.3788376Z Parse the experiments from the issue body into a list of ExperimentSettings 2024-12-17T23:28:38.3789234Z """ 2024-12-17T23:28:38.3789805Z try: 2024-12-17T23:28:38.3790255Z if settings_text: 2024-12-17T23:28:38.3791070Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2024-12-17T23:28:38.3792536Z # for easy reading 2024-12-17T23:28:38.3793435Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2024-12-17T23:28:38.3794429Z # the backtick character in shell commands. 2024-12-17T23:28:38.3795249Z backtick = chr(96) # backtick character 2024-12-17T23:28:38.3795989Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2024-12-17T23:28:38.3796741Z settings = load_yaml(settings_text) 2024-12-17T23:28:38.3797285Z 2024-12-17T23:28:38.3797743Z # For now we just load experiments. We can expand this if/when we add more settings 2024-12-17T23:28:38.3798602Z experiments = {} 2024-12-17T23:28:38.3798940Z 2024-12-17T23:28:38.3799336Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2024-12-17T23:28:38.3800304Z if not is_valid_experiment_name(exp_name): 2024-12-17T23:28:38.3801524Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2024-12-17T23:28:38.3802645Z continue 2024-12-17T23:28:38.3803090Z 2024-12-17T23:28:38.3803323Z valid_settings = {} 2024-12-17T23:28:38.3803953Z for setting in exp_settings: 2024-12-17T23:28:38.3804694Z if setting not in Experiment._fields: 2024-12-17T23:28:38.3805368Z log.warning( 2024-12-17T23:28:38.3806219Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2024-12-17T23:28:38.3807099Z ) 2024-12-17T23:28:38.3807629Z else: 2024-12-17T23:28:38.3808264Z valid_settings[setting] = exp_settings[setting] 2024-12-17T23:28:38.3808728Z 2024-12-17T23:28:38.3809142Z experiments[exp_name] = Experiment(**valid_settings) 2024-12-17T23:28:38.3809868Z return Settings(experiments) 2024-12-17T23:28:38.3810314Z 2024-12-17T23:28:38.3810529Z except Exception: 2024-12-17T23:28:38.3811171Z log.exception("Failed to parse settings") 2024-12-17T23:28:38.3811621Z 2024-12-17T23:28:38.3811984Z return Settings() 2024-12-17T23:28:38.3812347Z 2024-12-17T23:28:38.3812354Z 2024-12-17T23:28:38.3812640Z def parse_settings(rollout_state: str) -> Settings: 2024-12-17T23:28:38.3813381Z """ 2024-12-17T23:28:38.3813916Z Parse settings, if any, from the rollout state. 2024-12-17T23:28:38.3814402Z 2024-12-17T23:28:38.3814783Z If the issue body contains "---" then the text above that is the settings 2024-12-17T23:28:38.3815808Z and the text below is the list of opted in users. 2024-12-17T23:28:38.3816265Z 2024-12-17T23:28:38.3816768Z If it doesn't contain "---" then the settings are empty and the default values are used. 2024-12-17T23:28:38.3817683Z """ 2024-12-17T23:28:38.3818614Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:28:38.3820389Z return parse_settings_from_text(settings_text) 2024-12-17T23:28:38.3821155Z 2024-12-17T23:28:38.3821166Z 2024-12-17T23:28:38.3821898Z def parse_users(rollout_state: str) -> UserOptins: 2024-12-17T23:28:38.3823163Z """ 2024-12-17T23:28:38.3823940Z Parse users from the rollout state. 2024-12-17T23:28:38.3824345Z 2024-12-17T23:28:38.3824691Z """ 2024-12-17T23:28:38.3825320Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2024-12-17T23:28:38.3826215Z return parse_user_opt_in_from_text(users_text) 2024-12-17T23:28:38.3826651Z 2024-12-17T23:28:38.3826658Z 2024-12-17T23:28:38.3827250Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:28:38.3828122Z """ 2024-12-17T23:28:38.3828655Z Check if a user is opted into an experiment 2024-12-17T23:28:38.3829802Z """ 2024-12-17T23:28:38.3830355Z return experiment_name in user_optins.get(user, []) 2024-12-17T23:28:38.3830936Z 2024-12-17T23:28:38.3830943Z 2024-12-17T23:28:38.3831409Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2024-12-17T23:28:38.3832357Z """ 2024-12-17T23:28:38.3832936Z Check if a user explicitly opted out of an experiment 2024-12-17T23:28:38.3833596Z """ 2024-12-17T23:28:38.3834299Z # if the experiment is prefixed with a "-", then it's an opt-out 2024-12-17T23:28:38.3835094Z experiment_optout = "-" + experiment_name 2024-12-17T23:28:38.3835802Z if experiment_optout not in user_optins.get(user, []): 2024-12-17T23:28:38.3836606Z return False 2024-12-17T23:28:38.3836902Z 2024-12-17T23:28:38.3837245Z if is_user_opted_in(user, user_optins, experiment_name): 2024-12-17T23:28:38.3837942Z log.warning( 2024-12-17T23:28:38.3838943Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2024-12-17T23:28:38.3839946Z ) 2024-12-17T23:28:38.3840197Z 2024-12-17T23:28:38.3840406Z return True 2024-12-17T23:28:38.3840789Z 2024-12-17T23:28:38.3840795Z 2024-12-17T23:28:38.3841029Z def get_runner_prefix( 2024-12-17T23:28:38.3841584Z rollout_state: str, 2024-12-17T23:28:38.3842126Z workflow_requestors: Iterable[str], 2024-12-17T23:28:38.3842850Z branch: str, 2024-12-17T23:28:38.3843453Z eligible_experiments: FrozenSet[str] = frozenset(), 2024-12-17T23:28:38.3844140Z is_canary: bool = False, 2024-12-17T23:28:38.3844792Z ) -> str: 2024-12-17T23:28:38.3845325Z settings = parse_settings(rollout_state) 2024-12-17T23:28:38.3845991Z user_optins = parse_users(rollout_state) 2024-12-17T23:28:38.3846492Z 2024-12-17T23:28:38.3846807Z fleet_prefix = "" 2024-12-17T23:28:38.3847813Z prefixes = [] 2024-12-17T23:28:38.3849215Z for experiment_name, experiment_settings in settings.experiments.items(): 2024-12-17T23:28:38.3850728Z if not experiment_settings.all_branches and is_exception_branch(branch): 2024-12-17T23:28:38.3851574Z log.info( 2024-12-17T23:28:38.3852373Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2024-12-17T23:28:38.3853380Z ) 2024-12-17T23:28:38.3854090Z continue 2024-12-17T23:28:38.3854390Z 2024-12-17T23:28:38.3854810Z if eligible_experiments: 2024-12-17T23:28:38.3855486Z if experiment_name not in eligible_experiments: 2024-12-17T23:28:38.3856231Z exp_list = ", ".join(eligible_experiments) 2024-12-17T23:28:38.3856967Z log.info( 2024-12-17T23:28:38.3857860Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2024-12-17T23:28:38.3858847Z ) 2024-12-17T23:28:38.3860516Z continue 2024-12-17T23:28:38.3861179Z elif not experiment_settings.default: 2024-12-17T23:28:38.3861858Z log.info( 2024-12-17T23:28:38.3862745Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2024-12-17T23:28:38.3863668Z ) 2024-12-17T23:28:38.3864161Z continue 2024-12-17T23:28:38.3864457Z 2024-12-17T23:28:38.3864930Z # Is any workflow_requestor opted out to this experiment? 2024-12-17T23:28:38.3865637Z opted_out_users = [ 2024-12-17T23:28:38.3866200Z requestor 2024-12-17T23:28:38.3866865Z for requestor in workflow_requestors 2024-12-17T23:28:38.3867619Z if is_user_opted_out(requestor, user_optins, experiment_name) 2024-12-17T23:28:38.3868376Z ] 2024-12-17T23:28:38.3868723Z 2024-12-17T23:28:38.3868958Z if opted_out_users: 2024-12-17T23:28:38.3869488Z log.info( 2024-12-17T23:28:38.3870221Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2024-12-17T23:28:38.3871118Z ) 2024-12-17T23:28:38.3871831Z continue 2024-12-17T23:28:38.3872136Z 2024-12-17T23:28:38.3872468Z # Is any workflow_requestor opted in to this experiment? 2024-12-17T23:28:38.3873284Z opted_in_users = [ 2024-12-17T23:28:38.3873847Z requestor 2024-12-17T23:28:38.3874404Z for requestor in workflow_requestors 2024-12-17T23:28:38.3875259Z if is_user_opted_in(requestor, user_optins, experiment_name) 2024-12-17T23:28:38.3875995Z ] 2024-12-17T23:28:38.3876259Z 2024-12-17T23:28:38.3876469Z enabled = False 2024-12-17T23:28:38.3877082Z if opted_in_users: 2024-12-17T23:28:38.3877657Z log.info( 2024-12-17T23:28:38.3878341Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2024-12-17T23:28:38.3879207Z ) 2024-12-17T23:28:38.3879719Z enabled = True 2024-12-17T23:28:38.3880047Z 2024-12-17T23:28:38.3880303Z elif experiment_settings.rollout_perc: 2024-12-17T23:28:38.3881329Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2024-12-17T23:28:38.3882400Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2024-12-17T23:28:38.3883138Z log.info( 2024-12-17T23:28:38.3884202Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2024-12-17T23:28:38.3885258Z ) 2024-12-17T23:28:38.3885739Z enabled = True 2024-12-17T23:28:38.3886176Z 2024-12-17T23:28:38.3886403Z if enabled: 2024-12-17T23:28:38.3886946Z label = experiment_name 2024-12-17T23:28:38.3887591Z if experiment_name == LF_FLEET_EXPERIMENT: 2024-12-17T23:28:38.3888643Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2024-12-17T23:28:38.3889647Z # - If it's enabled, then we always list it's prefix first 2024-12-17T23:28:38.3890508Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2024-12-17T23:28:38.3891820Z if is_canary: 2024-12-17T23:28:38.3892451Z label += CANARY_FLEET_SUFFIX 2024-12-17T23:28:38.3893110Z fleet_prefix = label 2024-12-17T23:28:38.3893941Z else: 2024-12-17T23:28:38.3894524Z prefixes.append(label) 2024-12-17T23:28:38.3894914Z 2024-12-17T23:28:38.3895158Z if len(prefixes) > 1: 2024-12-17T23:28:38.3895775Z log.error( 2024-12-17T23:28:38.3896935Z 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:])}" 2024-12-17T23:28:38.3898153Z ) 2024-12-17T23:28:38.3898716Z prefixes = prefixes[:1] 2024-12-17T23:28:38.3899140Z 2024-12-17T23:28:38.3899611Z # Fleet always comes first 2024-12-17T23:28:38.3900210Z if fleet_prefix: 2024-12-17T23:28:38.3900862Z prefixes.insert(0, fleet_prefix) 2024-12-17T23:28:38.3901326Z 2024-12-17T23:28:38.3901614Z return ".".join(prefixes) + "." if prefixes else "" 2024-12-17T23:28:38.3902105Z 2024-12-17T23:28:38.3902112Z 2024-12-17T23:28:38.3902577Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2024-12-17T23:28:38.3903576Z """ 2024-12-17T23:28:38.3904232Z Gets the first comment of the issue, which contains the desired rollout state. 2024-12-17T23:28:38.3904865Z 2024-12-17T23:28:38.3905270Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2024-12-17T23:28:38.3906189Z """ 2024-12-17T23:28:38.3906649Z gh = get_gh_client(github_token) 2024-12-17T23:28:38.3907284Z issue = get_issue(gh, repo, issue_num) 2024-12-17T23:28:38.3908143Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2024-12-17T23:28:38.3908625Z 2024-12-17T23:28:38.3908632Z 2024-12-17T23:28:38.3909104Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2024-12-17T23:28:38.3910109Z for _ in range(num_retries): 2024-12-17T23:28:38.3910811Z try: 2024-12-17T23:28:38.3911350Z req = Request(url=url, headers=headers) 2024-12-17T23:28:38.3912100Z content = urlopen(req, timeout=5).read().decode("utf-8") 2024-12-17T23:28:38.3912938Z return json.loads(content) 2024-12-17T23:28:38.3913574Z except Exception as e: 2024-12-17T23:28:38.3914186Z log.warning(f"Could not download {url}: {e}") 2024-12-17T23:28:38.3914759Z 2024-12-17T23:28:38.3915177Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2024-12-17T23:28:38.3915995Z return {} 2024-12-17T23:28:38.3916270Z 2024-12-17T23:28:38.3916277Z 2024-12-17T23:28:38.3916485Z @lru_cache(maxsize=None) 2024-12-17T23:28:38.3917429Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2024-12-17T23:28:38.3918313Z """ 2024-12-17T23:28:38.3918767Z Dynamically get PR information 2024-12-17T23:28:38.3919451Z """ 2024-12-17T23:28:38.3920068Z github_api = f"https://api.github.com/repos/{github_repo}" 2024-12-17T23:28:38.3920750Z headers = { 2024-12-17T23:28:38.3921398Z "Accept": "application/vnd.github.v3+json", 2024-12-17T23:28:38.3922139Z "Authorization": f"token {github_token}", 2024-12-17T23:28:38.3922732Z } 2024-12-17T23:28:38.3923342Z json_response: Dict[str, Any] = download_json( 2024-12-17T23:28:38.3924076Z url=f"{github_api}/issues/{pr_number}", 2024-12-17T23:28:38.3924674Z headers=headers, 2024-12-17T23:28:38.3925308Z ) 2024-12-17T23:28:38.3925564Z 2024-12-17T23:28:38.3925821Z if not json_response: 2024-12-17T23:28:38.3926432Z log.warning(f"Failed to get the labels for #{pr_number}") 2024-12-17T23:28:38.3927273Z return {} 2024-12-17T23:28:38.3927570Z 2024-12-17T23:28:38.3927826Z return json_response 2024-12-17T23:28:38.3928149Z 2024-12-17T23:28:38.3928158Z 2024-12-17T23:28:38.3928756Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2024-12-17T23:28:38.3929600Z """ 2024-12-17T23:28:38.3930229Z Dynamically get the latest list of labels from the pull request 2024-12-17T23:28:38.3931050Z """ 2024-12-17T23:28:38.3931792Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2024-12-17T23:28:38.3932533Z return { 2024-12-17T23:28:38.3933295Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2024-12-17T23:28:38.3934119Z } 2024-12-17T23:28:38.3934397Z 2024-12-17T23:28:38.3934404Z 2024-12-17T23:28:38.3934615Z def main() -> None: 2024-12-17T23:28:38.3935222Z args = parse_args() 2024-12-17T23:28:38.3935552Z 2024-12-17T23:28:38.3935816Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2024-12-17T23:28:38.3936278Z 2024-12-17T23:28:38.3936503Z # Check if the PR is opt-out 2024-12-17T23:28:38.3937182Z if args.pr_number: 2024-12-17T23:28:38.3937931Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2024-12-17T23:28:38.3938835Z if OPT_OUT_LABEL in labels: 2024-12-17T23:28:38.3939731Z log.info( 2024-12-17T23:28:38.3940555Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2024-12-17T23:28:38.3941448Z ) 2024-12-17T23:28:38.3942184Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:28:38.3942984Z sys.exit() 2024-12-17T23:28:38.3943285Z 2024-12-17T23:28:38.3943487Z try: 2024-12-17T23:28:38.3944103Z rollout_state = get_rollout_state_from_issue( 2024-12-17T23:28:38.3944954Z args.github_token, args.github_issue_repo, args.github_issue 2024-12-17T23:28:38.3945684Z ) 2024-12-17T23:28:38.3945952Z 2024-12-17T23:28:38.3946265Z username = get_potential_pr_author( 2024-12-17T23:28:38.3946938Z args.github_token, 2024-12-17T23:28:38.3947503Z args.github_repo, 2024-12-17T23:28:38.3948332Z args.github_actor, 2024-12-17T23:28:38.3948957Z args.github_ref_type, 2024-12-17T23:28:38.3949528Z args.github_branch, 2024-12-17T23:28:38.3950143Z ) 2024-12-17T23:28:38.3950404Z 2024-12-17T23:28:38.3950792Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2024-12-17T23:28:38.3951290Z 2024-12-17T23:28:38.3951544Z runner_label_prefix = get_runner_prefix( 2024-12-17T23:28:38.3952259Z rollout_state, 2024-12-17T23:28:38.3952886Z (args.github_issue_owner, username), 2024-12-17T23:28:38.3953505Z args.github_branch, 2024-12-17T23:28:38.3954162Z args.eligible_experiments, 2024-12-17T23:28:38.3954865Z is_canary, 2024-12-17T23:28:38.3955356Z ) 2024-12-17T23:28:38.3955622Z 2024-12-17T23:28:38.3955913Z except Exception as e: 2024-12-17T23:28:38.3956515Z log.error( 2024-12-17T23:28:38.3957266Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2024-12-17T23:28:38.3958208Z ) 2024-12-17T23:28:38.3958490Z 2024-12-17T23:28:38.3958899Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2024-12-17T23:28:38.3959442Z 2024-12-17T23:28:38.3959449Z 2024-12-17T23:28:38.3959701Z if __name__ == "__main__": 2024-12-17T23:28:38.3960283Z main() 2024-12-17T23:28:38.3960603Z 2024-12-17T23:28:38.4055399Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2024-12-17T23:28:38.4056459Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2024-12-17T23:28:38.4113541Z shell: /usr/bin/bash -e {0} 2024-12-17T23:28:38.4114154Z env: 2024-12-17T23:28:38.4114881Z GITHUB_TOKEN: *** 2024-12-17T23:28:38.4115469Z ISSUE_NUMBER: 5132 2024-12-17T23:28:38.4116037Z TRIGGERING_ACTOR: malfet 2024-12-17T23:28:38.4116587Z ISSUE_OWNER: 2024-12-17T23:28:38.4117125Z CHECK_EXPERIMENTS: 2024-12-17T23:28:38.4117668Z PR_NUMBER: 2024-12-17T23:28:38.4118178Z ##[endgroup] 2024-12-17T23:28:38.9554340Z Defaulting to user installation because normal site-packages is not writeable 2024-12-17T23:28:39.4470975Z Collecting urllib3==1.26.18 2024-12-17T23:28:39.5076741Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2024-12-17T23:28:39.5464974Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 KB 5.1 MB/s eta 0:00:00 2024-12-17T23:28:39.5813077Z Collecting PyGithub==2.3.0 2024-12-17T23:28:39.5921215Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2024-12-17T23:28:39.6309187Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 KB 9.4 MB/s eta 0:00:00 2024-12-17T23:28:39.6851645Z Collecting typing-extensions>=4.0.0 2024-12-17T23:28:39.6953118Z Downloading typing_extensions-4.12.2-py3-none-any.whl (37 kB) 2024-12-17T23:28:39.7003743Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.25.1) 2024-12-17T23:28:39.7466094Z Collecting pynacl>=1.4.0 2024-12-17T23:28:39.7574877Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2024-12-17T23:28:39.8313221Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 KB 11.8 MB/s eta 0:00:00 2024-12-17T23:28:39.8642491Z Collecting Deprecated 2024-12-17T23:28:39.8749646Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2024-12-17T23:28:39.9105570Z Collecting pyjwt[crypto]>=2.4.0 2024-12-17T23:28:39.9211564Z Downloading PyJWT-2.10.1-py3-none-any.whl (22 kB) 2024-12-17T23:28:39.9348234Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (3.4.8) 2024-12-17T23:28:40.1738622Z Collecting cffi>=1.4.1 2024-12-17T23:28:40.1841424Z Downloading cffi-1.17.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (446 kB) 2024-12-17T23:28:40.2145763Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 446.2/446.2 KB 15.4 MB/s eta 0:00:00 2024-12-17T23:28:40.4704437Z Collecting wrapt<2,>=1.10 2024-12-17T23:28:40.4819663Z Downloading wrapt-1.17.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (82 kB) 2024-12-17T23:28:40.4885152Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.7/82.7 KB 18.3 MB/s eta 0:00:00 2024-12-17T23:28:40.5221247Z Collecting pycparser 2024-12-17T23:28:40.5341493Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2024-12-17T23:28:40.5418659Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 KB 21.9 MB/s eta 0:00:00 2024-12-17T23:28:40.7316427Z Installing collected packages: wrapt, urllib3, typing-extensions, pyjwt, pycparser, Deprecated, cffi, pynacl, PyGithub 2024-12-17T23:28:41.2046345Z Successfully installed Deprecated-1.2.15 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pyjwt-2.10.1 pynacl-1.5.0 typing-extensions-4.12.2 urllib3-1.26.18 wrapt-1.17.0 2024-12-17T23:28:41.2752593Z ##[group]Run curr_branch="release/2.6" 2024-12-17T23:28:41.2754043Z curr_branch="release/2.6" 2024-12-17T23:28:41.2755412Z curr_ref_type="branch" 2024-12-17T23:28:41.2756722Z echo "Current branch is '$curr_branch'" 2024-12-17T23:28:41.2758044Z  2024-12-17T23:28:41.2759096Z python3 runner_determinator.py \ 2024-12-17T23:28:41.2760451Z  --github-token "$GITHUB_TOKEN" \ 2024-12-17T23:28:41.2761802Z  --github-issue "$ISSUE_NUMBER" \ 2024-12-17T23:28:41.2763261Z  --github-branch "$curr_branch" \ 2024-12-17T23:28:41.2764627Z  --github-actor "$TRIGGERING_ACTOR" \ 2024-12-17T23:28:41.2766011Z  --github-issue-owner "$ISSUE_OWNER" \ 2024-12-17T23:28:41.2767531Z  --github-ref-type "$curr_ref_type" \ 2024-12-17T23:28:41.2768938Z  --github-repo "$GITHUB_REPOSITORY" \ 2024-12-17T23:28:41.2770503Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2024-12-17T23:28:41.2772187Z  --pr-number "${PR_NUMBER}" 2024-12-17T23:28:41.2833065Z shell: /usr/bin/bash -e {0} 2024-12-17T23:28:41.2834134Z env: 2024-12-17T23:28:41.2835568Z GITHUB_TOKEN: *** 2024-12-17T23:28:41.2836651Z ISSUE_NUMBER: 5132 2024-12-17T23:28:41.2837665Z TRIGGERING_ACTOR: malfet 2024-12-17T23:28:41.2838674Z ISSUE_OWNER: 2024-12-17T23:28:41.2839668Z CHECK_EXPERIMENTS: 2024-12-17T23:28:41.2840652Z PR_NUMBER: 2024-12-17T23:28:41.2841482Z ##[endgroup] 2024-12-17T23:28:41.2927643Z Current branch is 'release/2.6' 2024-12-17T23:28:42.9728973Z INFO : Based on rollout percentage of 95%, enabling experiment lf. 2024-12-17T23:28:42.9730453Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2024-12-17T23:28:42.9732076Z INFO : Setting output: label-type='lf.' 2024-12-17T23:28:43.0008385Z Evaluate and set job outputs 2024-12-17T23:28:43.0014940Z Set output 'label-type' 2024-12-17T23:28:43.0017021Z Cleaning up orphan processes