2025-04-25T04:10:07.1170875Z Current runner version: '2.323.0' 2025-04-25T04:10:07.1197629Z ##[group]Operating System 2025-04-25T04:10:07.1198414Z Ubuntu 2025-04-25T04:10:07.1198855Z 24.04.2 2025-04-25T04:10:07.1199368Z LTS 2025-04-25T04:10:07.1199823Z ##[endgroup] 2025-04-25T04:10:07.1200328Z ##[group]Runner Image 2025-04-25T04:10:07.1200878Z Image: ubuntu-24.04 2025-04-25T04:10:07.1201471Z Version: 20250420.1.0 2025-04-25T04:10:07.1202486Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250420.1/images/ubuntu/Ubuntu2404-Readme.md 2025-04-25T04:10:07.1203794Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250420.1 2025-04-25T04:10:07.1204735Z ##[endgroup] 2025-04-25T04:10:07.1205203Z ##[group]Runner Image Provisioner 2025-04-25T04:10:07.1205788Z 2.0.422.1 2025-04-25T04:10:07.1206407Z ##[endgroup] 2025-04-25T04:10:07.1207450Z ##[group]GITHUB_TOKEN Permissions 2025-04-25T04:10:07.1209324Z Contents: read 2025-04-25T04:10:07.1209857Z Metadata: read 2025-04-25T04:10:07.1210567Z Packages: read 2025-04-25T04:10:07.1211107Z ##[endgroup] 2025-04-25T04:10:07.1213061Z Secret source: Actions 2025-04-25T04:10:07.1213801Z Prepare workflow directory 2025-04-25T04:10:07.1725294Z Prepare all required actions 2025-04-25T04:10:07.1778878Z Complete job name: get-label-type / runner-determinator 2025-04-25T04:10:07.2366493Z ##[group]Run cat < runner_determinator.py 2025-04-25T04:10:07.2368797Z cat < runner_determinator.py 2025-04-25T04:10:07.2369425Z # flake8: noqa: G004 2025-04-25T04:10:07.2370004Z  2025-04-25T04:10:07.2370723Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-25T04:10:07.2371761Z # must be kept in sync. You can do it easily by running the following command: 2025-04-25T04:10:07.2372729Z # python .github/scripts/update_runner_determinator.py 2025-04-25T04:10:07.2373405Z  2025-04-25T04:10:07.2373837Z """ 2025-04-25T04:10:07.2374585Z This runner determinator is used to determine which set of runners to run a 2025-04-25T04:10:07.2375637Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-25T04:10:07.2376921Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-25T04:10:07.2377968Z of which runners should be used to run which job. 2025-04-25T04:10:07.2378624Z  2025-04-25T04:10:07.2379263Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-25T04:10:07.2380343Z separated by a line containing "---". If the line is not present, the 2025-04-25T04:10:07.2381300Z settings are considered to be empty with only the second part, the user 2025-04-25T04:10:07.2382082Z list, defined. 2025-04-25T04:10:07.2382763Z  2025-04-25T04:10:07.2383393Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-25T04:10:07.2384412Z used to define any settings that are needed to determine which runners to use. 2025-04-25T04:10:07.2385394Z It's fields are defined by the RolloutSettings class below. 2025-04-25T04:10:07.2386099Z  2025-04-25T04:10:07.2386953Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-25T04:10:07.2387969Z The user list is also a comma separated list of additional features or 2025-04-25T04:10:07.2388827Z experiments which the user could be opted in to. 2025-04-25T04:10:07.2389435Z  2025-04-25T04:10:07.2390006Z The user list has the following rules: 2025-04-25T04:10:07.2390580Z  2025-04-25T04:10:07.2391181Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-25T04:10:07.2392229Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-25T04:10:07.2393067Z - A "#" prefix opts the user out of all experiments 2025-04-25T04:10:07.2393934Z  2025-04-25T04:10:07.2394425Z Example config: 2025-04-25T04:10:07.2395028Z  # A list of experiments that can be opted into. 2025-04-25T04:10:07.2395828Z  # This defines the behavior they'll induce when opted into. 2025-04-25T04:10:07.2396731Z  # Expected syntax is: 2025-04-25T04:10:07.2397520Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-25T04:10:07.2398555Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-25T04:10:07.2399466Z  2025-04-25T04:10:07.2399872Z  experiments: 2025-04-25T04:10:07.2400399Z  lf: 2025-04-25T04:10:07.2400954Z  rollout_percent: 25 2025-04-25T04:10:07.2401504Z  all_branches: false 2025-04-25T04:10:07.2402060Z  default: true 2025-04-25T04:10:07.2402617Z  --- 2025-04-25T04:10:07.2403076Z  2025-04-25T04:10:07.2403511Z  # Opt-ins: 2025-04-25T04:10:07.2404279Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-25T04:10:07.2405395Z  # and specifying experiments to enable in a comma-separated list. 2025-04-25T04:10:07.2406384Z  # To always opt out of an experiment, prefix it with a "-". 2025-04-25T04:10:07.2407384Z  # Experiments should be from the above list. 2025-04-25T04:10:07.2407993Z  2025-04-25T04:10:07.2408476Z  @User1,-lf,split_build 2025-04-25T04:10:07.2409100Z  @User2,lf 2025-04-25T04:10:07.2409575Z  @User3,split_build 2025-04-25T04:10:07.2410092Z """ 2025-04-25T04:10:07.2410560Z  2025-04-25T04:10:07.2410996Z import json 2025-04-25T04:10:07.2411486Z import logging 2025-04-25T04:10:07.2412032Z import os 2025-04-25T04:10:07.2412487Z import random 2025-04-25T04:10:07.2412977Z import re 2025-04-25T04:10:07.2413452Z import sys 2025-04-25T04:10:07.2413998Z from argparse import ArgumentParser 2025-04-25T04:10:07.2414682Z from collections.abc import Iterable 2025-04-25T04:10:07.2415324Z from functools import cache 2025-04-25T04:10:07.2416090Z from logging import LogRecord 2025-04-25T04:10:07.2416807Z from typing import Any, NamedTuple 2025-04-25T04:10:07.2417585Z from urllib.request import Request, urlopen 2025-04-25T04:10:07.2418196Z  2025-04-25T04:10:07.2418683Z import yaml 2025-04-25T04:10:07.2419268Z from github import Auth, Github 2025-04-25T04:10:07.2419910Z from github.Issue import Issue 2025-04-25T04:10:07.2420496Z  2025-04-25T04:10:07.2420979Z  2025-04-25T04:10:07.2421476Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-25T04:10:07.2422326Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-25T04:10:07.2423311Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-25T04:10:07.2424125Z  2025-04-25T04:10:07.2424623Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-25T04:10:07.2425341Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-25T04:10:07.2426069Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-25T04:10:07.2427017Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-25T04:10:07.2427734Z  2025-04-25T04:10:07.2428183Z SETTING_EXPERIMENTS = "experiments" 2025-04-25T04:10:07.2428779Z  2025-04-25T04:10:07.2429309Z LF_FLEET_EXPERIMENT = "lf" 2025-04-25T04:10:07.2429864Z CANARY_FLEET_SUFFIX = ".c" 2025-04-25T04:10:07.2430452Z  2025-04-25T04:10:07.2430876Z  2025-04-25T04:10:07.2431391Z class Experiment(NamedTuple): 2025-04-25T04:10:07.2432170Z  rollout_perc: float = ( 2025-04-25T04:10:07.2433010Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-25T04:10:07.2433780Z  ) 2025-04-25T04:10:07.2434288Z  all_branches: bool = ( 2025-04-25T04:10:07.2435132Z  False # If True, the experiment is also enabled on the exception branches 2025-04-25T04:10:07.2435876Z  ) 2025-04-25T04:10:07.2436653Z  default: bool = ( 2025-04-25T04:10:07.2437429Z  True # If True, the experiment is enabled by default for all queries 2025-04-25T04:10:07.2438232Z  ) 2025-04-25T04:10:07.2438649Z  2025-04-25T04:10:07.2439162Z  # Add more fields as needed 2025-04-25T04:10:07.2439747Z  2025-04-25T04:10:07.2440138Z  2025-04-25T04:10:07.2440632Z class Settings(NamedTuple): 2025-04-25T04:10:07.2441179Z  """ 2025-04-25T04:10:07.2441804Z  Settings for the experiments that can be opted into. 2025-04-25T04:10:07.2442490Z  """ 2025-04-25T04:10:07.2442978Z  2025-04-25T04:10:07.2443502Z  experiments: dict[str, Experiment] = {} 2025-04-25T04:10:07.2444106Z  2025-04-25T04:10:07.2444798Z  2025-04-25T04:10:07.2445293Z class ColorFormatter(logging.Formatter): 2025-04-25T04:10:07.2446098Z  """Color codes the log messages based on the log level""" 2025-04-25T04:10:07.2447069Z  2025-04-25T04:10:07.2447524Z  COLORS = { 2025-04-25T04:10:07.2448149Z  "WARNING": "\033[33m", # Yellow 2025-04-25T04:10:07.2448794Z  "ERROR": "\033[31m", # Red 2025-04-25T04:10:07.2449420Z  "CRITICAL": "\033[31m", # Red 2025-04-25T04:10:07.2449994Z  "INFO": "\033[0m", # Reset 2025-04-25T04:10:07.2450674Z  "DEBUG": "\033[0m", # Reset 2025-04-25T04:10:07.2451220Z  } 2025-04-25T04:10:07.2451671Z  2025-04-25T04:10:07.2452306Z  def format(self, record: LogRecord) -> str: 2025-04-25T04:10:07.2453145Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-25T04:10:07.2454064Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-25T04:10:07.2454737Z  return super().format(record) 2025-04-25T04:10:07.2455329Z  2025-04-25T04:10:07.2455712Z  2025-04-25T04:10:07.2456516Z handler = logging.StreamHandler() 2025-04-25T04:10:07.2457377Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-25T04:10:07.2458143Z  2025-04-25T04:10:07.2458774Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-25T04:10:07.2459441Z log.addHandler(handler) 2025-04-25T04:10:07.2460004Z log.setLevel(logging.INFO) 2025-04-25T04:10:07.2460617Z  2025-04-25T04:10:07.2461056Z  2025-04-25T04:10:07.2461612Z def set_github_output(key: str, value: str) -> None: 2025-04-25T04:10:07.2462320Z  """ 2025-04-25T04:10:07.2462988Z  Defines outputs of the github action that invokes this script 2025-04-25T04:10:07.2463667Z  """ 2025-04-25T04:10:07.2464244Z  if not GITHUB_OUTPUT: 2025-04-25T04:10:07.2465405Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-25T04:10:07.2466784Z  log.warning( 2025-04-25T04:10:07.2467838Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-25T04:10:07.2468796Z  ) 2025-04-25T04:10:07.2469385Z  print(f"::set-output name={key}::{value}") 2025-04-25T04:10:07.2470098Z  return 2025-04-25T04:10:07.2470603Z  2025-04-25T04:10:07.2471295Z  with open(GITHUB_OUTPUT, "a") as f: 2025-04-25T04:10:07.2471962Z  log.info(f"Setting output: {key}='{value}'") 2025-04-25T04:10:07.2472639Z  f.write(f"{key}={value}\n") 2025-04-25T04:10:07.2473174Z  2025-04-25T04:10:07.2473703Z  2025-04-25T04:10:07.2474279Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-25T04:10:07.2475020Z  return frozenset( 2025-04-25T04:10:07.2475839Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-25T04:10:07.2476684Z  ) 2025-04-25T04:10:07.2477120Z  2025-04-25T04:10:07.2477619Z  2025-04-25T04:10:07.2478081Z def parse_args() -> Any: 2025-04-25T04:10:07.2478753Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-04-25T04:10:07.2553015Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-25T04:10:07.2554442Z  parser.add_argument( 2025-04-25T04:10:07.2555322Z  "--github-issue-repo", 2025-04-25T04:10:07.2556424Z  type=str, 2025-04-25T04:10:07.2557274Z  required=False, 2025-04-25T04:10:07.2558267Z  default="pytorch/test-infra", 2025-04-25T04:10:07.2558883Z  help="GitHub repo to get the issue", 2025-04-25T04:10:07.2559404Z  ) 2025-04-25T04:10:07.2559798Z  parser.add_argument( 2025-04-25T04:10:07.2560267Z  "--github-repo", 2025-04-25T04:10:07.2560726Z  type=str, 2025-04-25T04:10:07.2561170Z  required=True, 2025-04-25T04:10:07.2561685Z  help="GitHub repo where CI is running", 2025-04-25T04:10:07.2562203Z  ) 2025-04-25T04:10:07.2562585Z  parser.add_argument( 2025-04-25T04:10:07.2563282Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-25T04:10:07.2563958Z  ) 2025-04-25T04:10:07.2564344Z  parser.add_argument( 2025-04-25T04:10:07.2565032Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-25T04:10:07.2565715Z  ) 2025-04-25T04:10:07.2566677Z  parser.add_argument( 2025-04-25T04:10:07.2567401Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-25T04:10:07.2568085Z  ) 2025-04-25T04:10:07.2568513Z  parser.add_argument( 2025-04-25T04:10:07.2569216Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-25T04:10:07.2569932Z  ) 2025-04-25T04:10:07.2570317Z  parser.add_argument( 2025-04-25T04:10:07.2570810Z  "--github-ref-type", 2025-04-25T04:10:07.2571287Z  type=str, 2025-04-25T04:10:07.2571736Z  required=True, 2025-04-25T04:10:07.2572280Z  help="Current GitHub ref type, branch or tag", 2025-04-25T04:10:07.2572833Z  ) 2025-04-25T04:10:07.2573217Z  parser.add_argument( 2025-04-25T04:10:07.2573735Z  "--eligible-experiments", 2025-04-25T04:10:07.2574292Z  type=_str_comma_separated_to_set, 2025-04-25T04:10:07.2574818Z  required=False, 2025-04-25T04:10:07.2575283Z  default="", 2025-04-25T04:10:07.2576315Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-25T04:10:07.2577358Z  ) 2025-04-25T04:10:07.2577741Z  parser.add_argument( 2025-04-25T04:10:07.2578219Z  "--pr-number", 2025-04-25T04:10:07.2578684Z  type=str, 2025-04-25T04:10:07.2579133Z  required=False, 2025-04-25T04:10:07.2579589Z  default="", 2025-04-25T04:10:07.2580276Z  help="the optional PR number where this is run", 2025-04-25T04:10:07.2580830Z  ) 2025-04-25T04:10:07.2581193Z  2025-04-25T04:10:07.2581564Z  return parser.parse_args() 2025-04-25T04:10:07.2582048Z  2025-04-25T04:10:07.2582378Z  2025-04-25T04:10:07.2582983Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-25T04:10:07.2583746Z  auth = Auth.Token(github_token) 2025-04-25T04:10:07.2584268Z  return Github(auth=auth) 2025-04-25T04:10:07.2584739Z  2025-04-25T04:10:07.2585071Z  2025-04-25T04:10:07.2585722Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-25T04:10:07.2587268Z  repo = gh.get_repo(repo) 2025-04-25T04:10:07.2587829Z  return repo.get_issue(number=issue_num) 2025-04-25T04:10:07.2588354Z  2025-04-25T04:10:07.2588744Z  2025-04-25T04:10:07.2589120Z def get_potential_pr_author( 2025-04-25T04:10:07.2589796Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-25T04:10:07.2590475Z ) -> str: 2025-04-25T04:10:07.2591180Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-25T04:10:07.2592036Z  # Fetch the actual username from the original PR. The PR number is 2025-04-25T04:10:07.2592800Z  # embedded in the tag name: ciflow// 2025-04-25T04:10:07.2593364Z  2025-04-25T04:10:07.2593757Z  gh = get_gh_client(github_token) 2025-04-25T04:10:07.2594257Z  2025-04-25T04:10:07.2594738Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-25T04:10:07.2595382Z  split_tag = ref_name.split("/") 2025-04-25T04:10:07.2595910Z  if ( 2025-04-25T04:10:07.2596608Z  len(split_tag) == 3 2025-04-25T04:10:07.2597149Z  and split_tag[0] == "ciflow" 2025-04-25T04:10:07.2597709Z  and split_tag[2].isnumeric() 2025-04-25T04:10:07.2598213Z  ): 2025-04-25T04:10:07.2598647Z  pr_number = split_tag[2] 2025-04-25T04:10:07.2599149Z  try: 2025-04-25T04:10:07.2599626Z  repository = gh.get_repo(repo) 2025-04-25T04:10:07.2600277Z  pull = repository.get_pull(number=int(pr_number)) 2025-04-25T04:10:07.2600902Z  except Exception as e: 2025-04-25T04:10:07.2601456Z  raise Exception( # noqa: TRY002 2025-04-25T04:10:07.2602142Z  f"issue with pull request {pr_number} from repo {repository}" 2025-04-25T04:10:07.2602846Z  ) from e 2025-04-25T04:10:07.2603455Z  return pull.user.login # type: ignore[no-any-return] 2025-04-25T04:10:07.2604189Z  # In all other cases, return the original input username 2025-04-25T04:10:07.2604793Z  return username 2025-04-25T04:10:07.2605216Z  2025-04-25T04:10:07.2605557Z  2025-04-25T04:10:07.2605987Z def is_exception_branch(branch: str) -> bool: 2025-04-25T04:10:07.2606741Z  """ 2025-04-25T04:10:07.2607425Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-25T04:10:07.2608198Z  """ 2025-04-25T04:10:07.2608766Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-25T04:10:07.2609428Z  2025-04-25T04:10:07.2609774Z  2025-04-25T04:10:07.2610158Z def load_yaml(yaml_text: str) -> Any: 2025-04-25T04:10:07.2610678Z  try: 2025-04-25T04:10:07.2611092Z  data = yaml.safe_load(yaml_text) 2025-04-25T04:10:07.2611619Z  return data 2025-04-25T04:10:07.2612219Z  except yaml.YAMLError: 2025-04-25T04:10:07.2612750Z  log.exception("Error loading YAML") 2025-04-25T04:10:07.2613319Z  raise 2025-04-25T04:10:07.2613715Z  2025-04-25T04:10:07.2614055Z  2025-04-25T04:10:07.2614681Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-25T04:10:07.2615473Z  """ 2025-04-25T04:10:07.2616111Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-25T04:10:07.2616988Z  2025-04-25T04:10:07.2617526Z  If the issue body contains "---" then the text above that is the settings 2025-04-25T04:10:07.2618294Z  and the text below is the list of opted in users. 2025-04-25T04:10:07.2618847Z  2025-04-25T04:10:07.2619411Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-25T04:10:07.2620163Z  """ 2025-04-25T04:10:07.2620636Z  rollout_state_parts = rollout_state.split("---") 2025-04-25T04:10:07.2621245Z  if len(rollout_state_parts) >= 2: 2025-04-25T04:10:07.2621998Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-04-25T04:10:07.2622608Z  else: 2025-04-25T04:10:07.2623019Z  return "", rollout_state 2025-04-25T04:10:07.2623529Z  2025-04-25T04:10:07.2623864Z  2025-04-25T04:10:07.2624268Z class UserOptins(dict[str, list[str]]): 2025-04-25T04:10:07.2624796Z  """ 2025-04-25T04:10:07.2625340Z  Dictionary of users with a list of features they have opted into 2025-04-25T04:10:07.2625986Z  """ 2025-04-25T04:10:07.2626517Z  2025-04-25T04:10:07.2626858Z  2025-04-25T04:10:07.2627403Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-25T04:10:07.2628052Z  """ 2025-04-25T04:10:07.2628793Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-25T04:10:07.2629622Z  2025-04-25T04:10:07.2630427Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-25T04:10:07.2631415Z  - Example line: "@User1,lf,split_build" 2025-04-25T04:10:07.2632113Z  - A "#" prefix indicates the user is opted out of all experiments 2025-04-25T04:10:07.2632754Z  2025-04-25T04:10:07.2633086Z  2025-04-25T04:10:07.2633430Z  """ 2025-04-25T04:10:07.2633814Z  optins = UserOptins() 2025-04-25T04:10:07.2634345Z  for user in user_optin_text.split("\n"): 2025-04-25T04:10:07.2634911Z  user = user.strip("\r\n\t -") 2025-04-25T04:10:07.2635495Z  if not user or not user.startswith("@"): 2025-04-25T04:10:07.2636074Z  # Not a valid user. Skip 2025-04-25T04:10:07.2636682Z  continue 2025-04-25T04:10:07.2637111Z  2025-04-25T04:10:07.2637455Z  if user: 2025-04-25T04:10:07.2637940Z  usr_name = user.split(",")[0].strip("@") 2025-04-25T04:10:07.2638646Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-25T04:10:07.2639278Z  2025-04-25T04:10:07.2639638Z  return optins 2025-04-25T04:10:07.2640041Z  2025-04-25T04:10:07.2640374Z  2025-04-25T04:10:07.2640872Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-25T04:10:07.2641476Z  """ 2025-04-25T04:10:07.2641898Z  Check if the experiment name is valid. 2025-04-25T04:10:07.2642424Z  A valid name: 2025-04-25T04:10:07.2643101Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-25T04:10:07.2644178Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-25T04:10:07.2644882Z  - Cannot contain spaces 2025-04-25T04:10:07.2645355Z  """ 2025-04-25T04:10:07.2645722Z  2025-04-25T04:10:07.2646274Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-25T04:10:07.2647117Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-25T04:10:07.2647706Z  2025-04-25T04:10:07.2648083Z  if valid: 2025-04-25T04:10:07.2648490Z  return True 2025-04-25T04:10:07.2648899Z  2025-04-25T04:10:07.2649244Z  log.error( 2025-04-25T04:10:07.2650667Z  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-04-25T04:10:07.2652158Z  ) 2025-04-25T04:10:07.2652518Z  return False 2025-04-25T04:10:07.2652930Z  2025-04-25T04:10:07.2653264Z  2025-04-25T04:10:07.2653914Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-25T04:10:07.2654550Z  """ 2025-04-25T04:10:07.2655149Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-25T04:10:07.2655847Z  """ 2025-04-25T04:10:07.2656296Z  try: 2025-04-25T04:10:07.2656682Z  if settings_text: 2025-04-25T04:10:07.2657426Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-25T04:10:07.2658198Z  # for easy reading 2025-04-25T04:10:07.2659017Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-25T04:10:07.2659897Z  # the backtick character in shell commands. 2025-04-25T04:10:07.2660508Z  backtick = chr(96) # backtick character 2025-04-25T04:10:07.2661210Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-25T04:10:07.2661892Z  settings = load_yaml(settings_text) 2025-04-25T04:10:07.2662399Z  2025-04-25T04:10:07.2662979Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-04-25T04:10:07.2663714Z  experiments = {} 2025-04-25T04:10:07.2664171Z  2025-04-25T04:10:07.2664736Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-25T04:10:07.2665495Z  if not is_valid_experiment_name(exp_name): 2025-04-25T04:10:07.2666730Z  # 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-04-25T04:10:07.2667755Z  continue 2025-04-25T04:10:07.2668201Z  2025-04-25T04:10:07.2668582Z  valid_settings = {} 2025-04-25T04:10:07.2669128Z  for setting in exp_settings: 2025-04-25T04:10:07.2669716Z  if setting not in Experiment._fields: 2025-04-25T04:10:07.2670292Z  log.warning( 2025-04-25T04:10:07.2671022Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-25T04:10:07.2671727Z  ) 2025-04-25T04:10:07.2672174Z  else: 2025-04-25T04:10:07.2672727Z  valid_settings[setting] = exp_settings[setting] 2025-04-25T04:10:07.2673296Z  2025-04-25T04:10:07.2673768Z  experiments[exp_name] = Experiment(**valid_settings) 2025-04-25T04:10:07.2674545Z  return Settings(experiments) 2025-04-25T04:10:07.2675037Z  2025-04-25T04:10:07.2675388Z  except Exception: 2025-04-25T04:10:07.2675904Z  log.exception("Failed to parse settings") 2025-04-25T04:10:07.2676626Z  2025-04-25T04:10:07.2676989Z  return Settings() 2025-04-25T04:10:07.2677410Z  2025-04-25T04:10:07.2677740Z  2025-04-25T04:10:07.2678193Z def parse_settings(rollout_state: str) -> Settings: 2025-04-25T04:10:07.2678769Z  """ 2025-04-25T04:10:07.2679226Z  Parse settings, if any, from the rollout state. 2025-04-25T04:10:07.2679786Z  2025-04-25T04:10:07.2680319Z  If the issue body contains "---" then the text above that is the settings 2025-04-25T04:10:07.2681086Z  and the text below is the list of opted in users. 2025-04-25T04:10:07.2681629Z  2025-04-25T04:10:07.2682227Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-25T04:10:07.2682943Z  """ 2025-04-25T04:10:07.2683519Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:10:07.2684420Z  return parse_settings_from_text(settings_text) 2025-04-25T04:10:07.2684967Z  2025-04-25T04:10:07.2685298Z  2025-04-25T04:10:07.2685752Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-25T04:10:07.2686548Z  """ 2025-04-25T04:10:07.2686979Z  Parse users from the rollout state. 2025-04-25T04:10:07.2687489Z  2025-04-25T04:10:07.2687829Z  """ 2025-04-25T04:10:07.2688384Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:10:07.2689134Z  return parse_user_opt_in_from_text(users_text) 2025-04-25T04:10:07.2689678Z  2025-04-25T04:10:07.2690020Z  2025-04-25T04:10:07.2690635Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:10:07.2691367Z  """ 2025-04-25T04:10:07.2691815Z  Check if a user is opted into an experiment 2025-04-25T04:10:07.2692349Z  """ 2025-04-25T04:10:07.2692835Z  return experiment_name in user_optins.get(user, []) 2025-04-25T04:10:07.2693396Z  2025-04-25T04:10:07.2693726Z  2025-04-25T04:10:07.2694346Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:10:07.2695087Z  """ 2025-04-25T04:10:07.2695570Z  Check if a user explicitly opted out of an experiment 2025-04-25T04:10:07.2696240Z  """ 2025-04-25T04:10:07.2696885Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-25T04:10:07.2697579Z  experiment_optout = "-" + experiment_name 2025-04-25T04:10:07.2698241Z  if experiment_optout not in user_optins.get(user, []): 2025-04-25T04:10:07.2698833Z  return False 2025-04-25T04:10:07.2699248Z  2025-04-25T04:10:07.2699743Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-04-25T04:10:07.2700344Z  log.warning( 2025-04-25T04:10:07.2701162Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-25T04:10:07.2702004Z  ) 2025-04-25T04:10:07.2702377Z  2025-04-25T04:10:07.2702728Z  return True 2025-04-25T04:10:07.2703128Z  2025-04-25T04:10:07.2703464Z  2025-04-25T04:10:07.2703818Z def get_runner_prefix( 2025-04-25T04:10:07.2704289Z  rollout_state: str, 2025-04-25T04:10:07.2704785Z  workflow_requestors: Iterable[str], 2025-04-25T04:10:07.2705303Z  branch: str, 2025-04-25T04:10:07.2705992Z  eligible_experiments: frozenset[str] = frozenset(), 2025-04-25T04:10:07.2706776Z  is_canary: bool = False, 2025-04-25T04:10:07.2707246Z ) -> str: 2025-04-25T04:10:07.2707691Z  settings = parse_settings(rollout_state) 2025-04-25T04:10:07.2708274Z  user_optins = parse_users(rollout_state) 2025-04-25T04:10:07.2708787Z  2025-04-25T04:10:07.2709140Z  fleet_prefix = "" 2025-04-25T04:10:07.2709592Z  prefixes = [] 2025-04-25T04:10:07.2710258Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-25T04:10:07.2711195Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-25T04:10:07.2711893Z  log.info( 2025-04-25T04:10:07.2712593Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-25T04:10:07.2713327Z  ) 2025-04-25T04:10:07.2713726Z  continue 2025-04-25T04:10:07.2714136Z  2025-04-25T04:10:07.2714511Z  if eligible_experiments: 2025-04-25T04:10:07.2715213Z  if experiment_name not in eligible_experiments: 2025-04-25T04:10:07.2715862Z  exp_list = ", ".join(eligible_experiments) 2025-04-25T04:10:07.2716525Z  log.info( 2025-04-25T04:10:07.2717324Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-25T04:10:07.2718134Z  ) 2025-04-25T04:10:07.2718553Z  continue 2025-04-25T04:10:07.2719068Z  elif not experiment_settings.default: 2025-04-25T04:10:07.2719601Z  log.info( 2025-04-25T04:10:07.2720280Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-25T04:10:07.2721032Z  ) 2025-04-25T04:10:07.2721429Z  continue 2025-04-25T04:10:07.2721846Z  2025-04-25T04:10:07.2722308Z  # Is any workflow_requestor opted out to this experiment? 2025-04-25T04:10:07.2722929Z  opted_out_users = [ 2025-04-25T04:10:07.2723397Z  requestor 2025-04-25T04:10:07.2723891Z  for requestor in workflow_requestors 2025-04-25T04:10:07.2724591Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-25T04:10:07.2725209Z  ] 2025-04-25T04:10:07.2725571Z  2025-04-25T04:10:07.2725921Z  if opted_out_users: 2025-04-25T04:10:07.2726489Z  log.info( 2025-04-25T04:10:07.2727136Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-25T04:10:07.2727820Z  ) 2025-04-25T04:10:07.2728232Z  continue 2025-04-25T04:10:07.2728642Z  2025-04-25T04:10:07.2729106Z  # Is any workflow_requestor opted in to this experiment? 2025-04-25T04:10:07.2729709Z  opted_in_users = [ 2025-04-25T04:10:07.2730180Z  requestor 2025-04-25T04:10:07.2730676Z  for requestor in workflow_requestors 2025-04-25T04:10:07.2731343Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-25T04:10:07.2731952Z  ] 2025-04-25T04:10:07.2732315Z  2025-04-25T04:10:07.2732664Z  enabled = False 2025-04-25T04:10:07.2733119Z  if opted_in_users: 2025-04-25T04:10:07.2733585Z  log.info( 2025-04-25T04:10:07.2734207Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-25T04:10:07.2734870Z  ) 2025-04-25T04:10:07.2735411Z  enabled = True 2025-04-25T04:10:07.2735852Z  2025-04-25T04:10:07.2736371Z  elif experiment_settings.rollout_perc: 2025-04-25T04:10:07.2737311Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-25T04:10:07.2738234Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-25T04:10:07.2738876Z  log.info( 2025-04-25T04:10:07.2739756Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-25T04:10:07.2740636Z  ) 2025-04-25T04:10:07.2741067Z  enabled = True 2025-04-25T04:10:07.2741536Z  2025-04-25T04:10:07.2741876Z  if enabled: 2025-04-25T04:10:07.2742335Z  label = experiment_name 2025-04-25T04:10:07.2742906Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-25T04:10:07.2743726Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-25T04:10:07.2744737Z  # - If it's enabled, then we always list it's prefix first 2025-04-25T04:10:07.2745506Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-25T04:10:07.2746314Z  if is_canary: 2025-04-25T04:10:07.2746935Z  label += CANARY_FLEET_SUFFIX 2025-04-25T04:10:07.2747482Z  fleet_prefix = label 2025-04-25T04:10:07.2747988Z  else: 2025-04-25T04:10:07.2748474Z  prefixes.append(label) 2025-04-25T04:10:07.2748969Z  2025-04-25T04:10:07.2749321Z  if len(prefixes) > 1: 2025-04-25T04:10:07.2749795Z  log.error( 2025-04-25T04:10:07.2750841Z  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-04-25T04:10:07.2751911Z  ) 2025-04-25T04:10:07.2752314Z  prefixes = prefixes[:1] 2025-04-25T04:10:07.2752789Z  2025-04-25T04:10:07.2753153Z  # Fleet always comes first 2025-04-25T04:10:07.2753641Z  if fleet_prefix: 2025-04-25T04:10:07.2754121Z  prefixes.insert(0, fleet_prefix) 2025-04-25T04:10:07.2754617Z  2025-04-25T04:10:07.2755064Z  return ".".join(prefixes) + "." if prefixes else "" 2025-04-25T04:10:07.2755631Z  2025-04-25T04:10:07.2755958Z  2025-04-25T04:10:07.2756765Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-25T04:10:07.2757512Z  """ 2025-04-25T04:10:07.2758107Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-04-25T04:10:07.2758807Z  2025-04-25T04:10:07.2759386Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-25T04:10:07.2760079Z  """ 2025-04-25T04:10:07.2760489Z  gh = get_gh_client(github_token) 2025-04-25T04:10:07.2761044Z  issue = get_issue(gh, repo, issue_num) 2025-04-25T04:10:07.2761691Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-25T04:10:07.2762273Z  2025-04-25T04:10:07.2762601Z  2025-04-25T04:10:07.2763214Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-25T04:10:07.2763958Z  for _ in range(num_retries): 2025-04-25T04:10:07.2764433Z  try: 2025-04-25T04:10:07.2764889Z  req = Request(url=url, headers=headers) 2025-04-25T04:10:07.2765551Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-25T04:10:07.2766430Z  return json.loads(content) 2025-04-25T04:10:07.2766950Z  except Exception as e: 2025-04-25T04:10:07.2767519Z  log.warning(f"Could not download {url}: {e}") 2025-04-25T04:10:07.2768079Z  2025-04-25T04:10:07.2768642Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-25T04:10:07.2769345Z  return {} 2025-04-25T04:10:07.2769737Z  2025-04-25T04:10:07.2770066Z  2025-04-25T04:10:07.2770393Z @cache 2025-04-25T04:10:07.2771037Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-25T04:10:07.2771772Z  """ 2025-04-25T04:10:07.2772183Z  Dynamically get PR information 2025-04-25T04:10:07.2772678Z  """ 2025-04-25T04:10:07.2773199Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-25T04:10:07.2773826Z  headers = { 2025-04-25T04:10:07.2774313Z  "Accept": "application/vnd.github.v3+json", 2025-04-25T04:10:07.2774930Z  "Authorization": f"token {github_token}", 2025-04-25T04:10:07.2775453Z  } 2025-04-25T04:10:07.2776029Z  json_response: dict[str, Any] = download_json( 2025-04-25T04:10:07.2776937Z  url=f"{github_api}/issues/{pr_number}", 2025-04-25T04:10:07.2777483Z  headers=headers, 2025-04-25T04:10:07.2777934Z  ) 2025-04-25T04:10:07.2778284Z  2025-04-25T04:10:07.2778644Z  if not json_response: 2025-04-25T04:10:07.2779246Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-25T04:10:07.2779886Z  return {} 2025-04-25T04:10:07.2780373Z  2025-04-25T04:10:07.2780739Z  return json_response 2025-04-25T04:10:07.2781178Z  2025-04-25T04:10:07.2781501Z  2025-04-25T04:10:07.2782093Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-25T04:10:07.2782799Z  """ 2025-04-25T04:10:07.2783343Z  Dynamically get the latest list of labels from the pull request 2025-04-25T04:10:07.2783980Z  """ 2025-04-25T04:10:07.2784480Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-25T04:10:07.2785076Z  return { 2025-04-25T04:10:07.2785664Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-25T04:10:07.2786609Z  } 2025-04-25T04:10:07.2786959Z  2025-04-25T04:10:07.2787282Z  2025-04-25T04:10:07.2787625Z def main() -> None: 2025-04-25T04:10:07.2788065Z  args = parse_args() 2025-04-25T04:10:07.2788503Z  2025-04-25T04:10:07.2788920Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-25T04:10:07.2789452Z  2025-04-25T04:10:07.2789834Z  # Check if the PR is opt-out 2025-04-25T04:10:07.2790335Z  if args.pr_number: 2025-04-25T04:10:07.2791021Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-25T04:10:07.2791768Z  if OPT_OUT_LABEL in labels: 2025-04-25T04:10:07.2792271Z  log.info( 2025-04-25T04:10:07.2793010Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-25T04:10:07.2793756Z  ) 2025-04-25T04:10:07.2794336Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:10:07.2795003Z  sys.exit() 2025-04-25T04:10:07.2795426Z  2025-04-25T04:10:07.2795758Z  try: 2025-04-25T04:10:07.2796304Z  rollout_state = get_rollout_state_from_issue( 2025-04-25T04:10:07.2797025Z  args.github_token, args.github_issue_repo, args.github_issue 2025-04-25T04:10:07.2797804Z  ) 2025-04-25T04:10:07.2798165Z  2025-04-25T04:10:07.2798556Z  username = get_potential_pr_author( 2025-04-25T04:10:07.2799091Z  args.github_token, 2025-04-25T04:10:07.2799598Z  args.github_repo, 2025-04-25T04:10:07.2800084Z  args.github_actor, 2025-04-25T04:10:07.2800594Z  args.github_ref_type, 2025-04-25T04:10:07.2801093Z  args.github_branch, 2025-04-25T04:10:07.2801568Z  ) 2025-04-25T04:10:07.2801939Z  2025-04-25T04:10:07.2802412Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-25T04:10:07.2803007Z  2025-04-25T04:10:07.2803415Z  runner_label_prefix = get_runner_prefix( 2025-04-25T04:10:07.2804078Z  rollout_state, 2025-04-25T04:10:07.2804598Z  (args.github_issue_owner, username), 2025-04-25T04:10:07.2805151Z  args.github_branch, 2025-04-25T04:10:07.2805667Z  args.eligible_experiments, 2025-04-25T04:10:07.2806270Z  is_canary, 2025-04-25T04:10:07.2806835Z  ) 2025-04-25T04:10:07.2807200Z  2025-04-25T04:10:07.2807562Z  except Exception as e: 2025-04-25T04:10:07.2808029Z  log.error( 2025-04-25T04:10:07.2808740Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-25T04:10:07.2809467Z  ) 2025-04-25T04:10:07.2809838Z  2025-04-25T04:10:07.2810364Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:10:07.2810997Z  2025-04-25T04:10:07.2811327Z  2025-04-25T04:10:07.2811680Z if __name__ == "__main__": 2025-04-25T04:10:07.2812136Z  main() 2025-04-25T04:10:07.2812510Z  2025-04-25T04:10:07.2812845Z EOF 2025-04-25T04:10:07.2813187Z  2025-04-25T04:10:07.2813555Z cat runner_determinator.py 2025-04-25T04:10:07.3075554Z shell: /usr/bin/bash -e {0} 2025-04-25T04:10:07.3076578Z env: 2025-04-25T04:10:07.3077434Z GITHUB_TOKEN: *** 2025-04-25T04:10:07.3077876Z ISSUE_NUMBER: 5132 2025-04-25T04:10:07.3078341Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:10:07.3078877Z ISSUE_OWNER: 2025-04-25T04:10:07.3079288Z CHECK_EXPERIMENTS: 2025-04-25T04:10:07.3079727Z PR_NUMBER: 2025-04-25T04:10:07.3080123Z ##[endgroup] 2025-04-25T04:10:07.3341439Z # flake8: noqa: G004 2025-04-25T04:10:07.3341781Z 2025-04-25T04:10:07.3342196Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-04-25T04:10:07.3343125Z # must be kept in sync. You can do it easily by running the following command: 2025-04-25T04:10:07.3343929Z # python .github/scripts/update_runner_determinator.py 2025-04-25T04:10:07.3344397Z 2025-04-25T04:10:07.3344552Z """ 2025-04-25T04:10:07.3345121Z This runner determinator is used to determine which set of runners to run a 2025-04-25T04:10:07.3346079Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-04-25T04:10:07.3347682Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-04-25T04:10:07.3349106Z of which runners should be used to run which job. 2025-04-25T04:10:07.3349807Z 2025-04-25T04:10:07.3350496Z The configuration has two parts, the settings and a list of opted-in users, 2025-04-25T04:10:07.3352081Z separated by a line containing "---". If the line is not present, the 2025-04-25T04:10:07.3353646Z settings are considered to be empty with only the second part, the user 2025-04-25T04:10:07.3354708Z list, defined. 2025-04-25T04:10:07.3355151Z 2025-04-25T04:10:07.3355833Z The first part is a YAML block that defines the rollout settings. This can be 2025-04-25T04:10:07.3357856Z used to define any settings that are needed to determine which runners to use. 2025-04-25T04:10:07.3359805Z It's fields are defined by the RolloutSettings class below. 2025-04-25T04:10:07.3360607Z 2025-04-25T04:10:07.3361289Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-04-25T04:10:07.3362862Z The user list is also a comma separated list of additional features or 2025-04-25T04:10:07.3364155Z experiments which the user could be opted in to. 2025-04-25T04:10:07.3364854Z 2025-04-25T04:10:07.3365182Z The user list has the following rules: 2025-04-25T04:10:07.3365812Z 2025-04-25T04:10:07.3366555Z - Users are GitHub usernames, which must start with the @ prefix 2025-04-25T04:10:07.3367990Z - Each user is also a comma-separated list of features/experiments to enable 2025-04-25T04:10:07.3369272Z - A "#" prefix opts the user out of all experiments 2025-04-25T04:10:07.3369946Z 2025-04-25T04:10:07.3370225Z Example config: 2025-04-25T04:10:07.3370950Z # A list of experiments that can be opted into. 2025-04-25T04:10:07.3372166Z # This defines the behavior they'll induce when opted into. 2025-04-25T04:10:07.3373224Z # Expected syntax is: 2025-04-25T04:10:07.3374370Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-04-25T04:10:07.3376539Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-04-25T04:10:07.3377751Z 2025-04-25T04:10:07.3378064Z experiments: 2025-04-25T04:10:07.3378753Z lf: 2025-04-25T04:10:07.3379406Z rollout_percent: 25 2025-04-25T04:10:07.3380208Z all_branches: false 2025-04-25T04:10:07.3380983Z default: true 2025-04-25T04:10:07.3381709Z --- 2025-04-25T04:10:07.3382076Z 2025-04-25T04:10:07.3382362Z # Opt-ins: 2025-04-25T04:10:07.3383372Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-04-25T04:10:07.3384806Z # and specifying experiments to enable in a comma-separated list. 2025-04-25T04:10:07.3385642Z # To always opt out of an experiment, prefix it with a "-". 2025-04-25T04:10:07.3386585Z # Experiments should be from the above list. 2025-04-25T04:10:07.3386988Z 2025-04-25T04:10:07.3387173Z @User1,-lf,split_build 2025-04-25T04:10:07.3387619Z @User2,lf 2025-04-25T04:10:07.3388016Z @User3,split_build 2025-04-25T04:10:07.3388472Z """ 2025-04-25T04:10:07.3388671Z 2025-04-25T04:10:07.3388831Z import json 2025-04-25T04:10:07.3389502Z import logging 2025-04-25T04:10:07.3389883Z import os 2025-04-25T04:10:07.3390254Z import random 2025-04-25T04:10:07.3390670Z import re 2025-04-25T04:10:07.3391038Z import sys 2025-04-25T04:10:07.3391434Z from argparse import ArgumentParser 2025-04-25T04:10:07.3391969Z from collections.abc import Iterable 2025-04-25T04:10:07.3392493Z from functools import cache 2025-04-25T04:10:07.3392963Z from logging import LogRecord 2025-04-25T04:10:07.3393456Z from typing import Any, NamedTuple 2025-04-25T04:10:07.3393979Z from urllib.request import Request, urlopen 2025-04-25T04:10:07.3394371Z 2025-04-25T04:10:07.3394528Z import yaml 2025-04-25T04:10:07.3394909Z from github import Auth, Github 2025-04-25T04:10:07.3395403Z from github.Issue import Issue 2025-04-25T04:10:07.3395709Z 2025-04-25T04:10:07.3395715Z 2025-04-25T04:10:07.3395933Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-04-25T04:10:07.3396781Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-04-25T04:10:07.3397640Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-04-25T04:10:07.3398190Z 2025-04-25T04:10:07.3398417Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-04-25T04:10:07.3398978Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-04-25T04:10:07.3399484Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-04-25T04:10:07.3400019Z OPT_OUT_LABEL = "no-runner-experiments" 2025-04-25T04:10:07.3400380Z 2025-04-25T04:10:07.3400575Z SETTING_EXPERIMENTS = "experiments" 2025-04-25T04:10:07.3400929Z 2025-04-25T04:10:07.3401112Z LF_FLEET_EXPERIMENT = "lf" 2025-04-25T04:10:07.3401768Z CANARY_FLEET_SUFFIX = ".c" 2025-04-25T04:10:07.3402056Z 2025-04-25T04:10:07.3402062Z 2025-04-25T04:10:07.3402250Z class Experiment(NamedTuple): 2025-04-25T04:10:07.3402748Z rollout_perc: float = ( 2025-04-25T04:10:07.3403385Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-04-25T04:10:07.3404047Z ) 2025-04-25T04:10:07.3404415Z all_branches: bool = ( 2025-04-25T04:10:07.3405028Z False # If True, the experiment is also enabled on the exception branches 2025-04-25T04:10:07.3405692Z ) 2025-04-25T04:10:07.3406050Z default: bool = ( 2025-04-25T04:10:07.3406816Z True # If True, the experiment is enabled by default for all queries 2025-04-25T04:10:07.3407449Z ) 2025-04-25T04:10:07.3407647Z 2025-04-25T04:10:07.3407823Z # Add more fields as needed 2025-04-25T04:10:07.3408129Z 2025-04-25T04:10:07.3408135Z 2025-04-25T04:10:07.3408320Z class Settings(NamedTuple): 2025-04-25T04:10:07.3408756Z """ 2025-04-25T04:10:07.3409217Z Settings for the experiments that can be opted into. 2025-04-25T04:10:07.3409790Z """ 2025-04-25T04:10:07.3410005Z 2025-04-25T04:10:07.3410204Z experiments: dict[str, Experiment] = {} 2025-04-25T04:10:07.3410579Z 2025-04-25T04:10:07.3410585Z 2025-04-25T04:10:07.3410925Z class ColorFormatter(logging.Formatter): 2025-04-25T04:10:07.3411560Z """Color codes the log messages based on the log level""" 2025-04-25T04:10:07.3411992Z 2025-04-25T04:10:07.3412150Z COLORS = { 2025-04-25T04:10:07.3412538Z "WARNING": "\033[33m", # Yellow 2025-04-25T04:10:07.3413050Z "ERROR": "\033[31m", # Red 2025-04-25T04:10:07.3413537Z "CRITICAL": "\033[31m", # Red 2025-04-25T04:10:07.3414042Z "INFO": "\033[0m", # Reset 2025-04-25T04:10:07.3414523Z "DEBUG": "\033[0m", # Reset 2025-04-25T04:10:07.3414991Z } 2025-04-25T04:10:07.3415189Z 2025-04-25T04:10:07.3415404Z def format(self, record: LogRecord) -> str: 2025-04-25T04:10:07.3416423Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-04-25T04:10:07.3417234Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-04-25T04:10:07.3417803Z return super().format(record) 2025-04-25T04:10:07.3418151Z 2025-04-25T04:10:07.3418158Z 2025-04-25T04:10:07.3418351Z handler = logging.StreamHandler() 2025-04-25T04:10:07.3419043Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-04-25T04:10:07.3419589Z 2025-04-25T04:10:07.3419824Z log = logging.getLogger(os.path.basename(__file__)) 2025-04-25T04:10:07.3420398Z log.addHandler(handler) 2025-04-25T04:10:07.3420835Z log.setLevel(logging.INFO) 2025-04-25T04:10:07.3421128Z 2025-04-25T04:10:07.3421133Z 2025-04-25T04:10:07.3421378Z def set_github_output(key: str, value: str) -> None: 2025-04-25T04:10:07.3421931Z """ 2025-04-25T04:10:07.3422418Z Defines outputs of the github action that invokes this script 2025-04-25T04:10:07.3423035Z """ 2025-04-25T04:10:07.3423402Z if not GITHUB_OUTPUT: 2025-04-25T04:10:07.3424425Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-04-25T04:10:07.3425484Z log.warning( 2025-04-25T04:10:07.3426527Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-04-25T04:10:07.3427424Z ) 2025-04-25T04:10:07.3437601Z print(f"::set-output name={key}::{value}") 2025-04-25T04:10:07.3438194Z return 2025-04-25T04:10:07.3438426Z 2025-04-25T04:10:07.3438621Z with open(GITHUB_OUTPUT, "a") as f: 2025-04-25T04:10:07.3439196Z log.info(f"Setting output: {key}='{value}'") 2025-04-25T04:10:07.3439748Z f.write(f"{key}={value}\n") 2025-04-25T04:10:07.3440076Z 2025-04-25T04:10:07.3440083Z 2025-04-25T04:10:07.3440377Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-04-25T04:10:07.3440988Z return frozenset( 2025-04-25T04:10:07.3441785Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-04-25T04:10:07.3442455Z ) 2025-04-25T04:10:07.3442664Z 2025-04-25T04:10:07.3442671Z 2025-04-25T04:10:07.3442847Z def parse_args() -> Any: 2025-04-25T04:10:07.3443406Z parser = ArgumentParser("Get dynamic rollout settings") 2025-04-25T04:10:07.3444245Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-04-25T04:10:07.3445003Z parser.add_argument( 2025-04-25T04:10:07.3445446Z "--github-issue-repo", 2025-04-25T04:10:07.3445899Z type=str, 2025-04-25T04:10:07.3446439Z required=False, 2025-04-25T04:10:07.3446896Z default="pytorch/test-infra", 2025-04-25T04:10:07.3447422Z help="GitHub repo to get the issue", 2025-04-25T04:10:07.3447929Z ) 2025-04-25T04:10:07.3448291Z parser.add_argument( 2025-04-25T04:10:07.3448771Z "--github-repo", 2025-04-25T04:10:07.3449197Z type=str, 2025-04-25T04:10:07.3449598Z required=True, 2025-04-25T04:10:07.3450049Z help="GitHub repo where CI is running", 2025-04-25T04:10:07.3450563Z ) 2025-04-25T04:10:07.3450926Z parser.add_argument( 2025-04-25T04:10:07.3451511Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-04-25T04:10:07.3452270Z ) 2025-04-25T04:10:07.3452631Z parser.add_argument( 2025-04-25T04:10:07.3453236Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-04-25T04:10:07.3453887Z ) 2025-04-25T04:10:07.3454254Z parser.add_argument( 2025-04-25T04:10:07.3454876Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-04-25T04:10:07.3455545Z ) 2025-04-25T04:10:07.3455908Z parser.add_argument( 2025-04-25T04:10:07.3456662Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-04-25T04:10:07.3457352Z ) 2025-04-25T04:10:07.3457709Z parser.add_argument( 2025-04-25T04:10:07.3458151Z "--github-ref-type", 2025-04-25T04:10:07.3458585Z type=str, 2025-04-25T04:10:07.3458971Z required=True, 2025-04-25T04:10:07.3459440Z help="Current GitHub ref type, branch or tag", 2025-04-25T04:10:07.3459974Z ) 2025-04-25T04:10:07.3460328Z parser.add_argument( 2025-04-25T04:10:07.3460783Z "--eligible-experiments", 2025-04-25T04:10:07.3461287Z type=_str_comma_separated_to_set, 2025-04-25T04:10:07.3461797Z required=False, 2025-04-25T04:10:07.3462211Z default="", 2025-04-25T04:10:07.3463029Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-04-25T04:10:07.3463917Z ) 2025-04-25T04:10:07.3464288Z parser.add_argument( 2025-04-25T04:10:07.3464729Z "--pr-number", 2025-04-25T04:10:07.3465139Z type=str, 2025-04-25T04:10:07.3465532Z required=False, 2025-04-25T04:10:07.3465943Z default="", 2025-04-25T04:10:07.3466583Z help="the optional PR number where this is run", 2025-04-25T04:10:07.3467142Z ) 2025-04-25T04:10:07.3467344Z 2025-04-25T04:10:07.3467533Z return parser.parse_args() 2025-04-25T04:10:07.3467849Z 2025-04-25T04:10:07.3467856Z 2025-04-25T04:10:07.3468240Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-04-25T04:10:07.3468970Z auth = Auth.Token(github_token) 2025-04-25T04:10:07.3469466Z return Github(auth=auth) 2025-04-25T04:10:07.3469765Z 2025-04-25T04:10:07.3469771Z 2025-04-25T04:10:07.3470204Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-04-25T04:10:07.3470982Z repo = gh.get_repo(repo) 2025-04-25T04:10:07.3471502Z return repo.get_issue(number=issue_num) 2025-04-25T04:10:07.3471863Z 2025-04-25T04:10:07.3471871Z 2025-04-25T04:10:07.3472045Z def get_potential_pr_author( 2025-04-25T04:10:07.3472673Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-04-25T04:10:07.3473465Z ) -> str: 2025-04-25T04:10:07.3473964Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-04-25T04:10:07.3474779Z # Fetch the actual username from the original PR. The PR number is 2025-04-25T04:10:07.3475514Z # embedded in the tag name: ciflow// 2025-04-25T04:10:07.3475932Z 2025-04-25T04:10:07.3476111Z gh = get_gh_client(github_token) 2025-04-25T04:10:07.3476559Z 2025-04-25T04:10:07.3476811Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-04-25T04:10:07.3477424Z split_tag = ref_name.split("/") 2025-04-25T04:10:07.3477919Z if ( 2025-04-25T04:10:07.3478300Z len(split_tag) == 3 2025-04-25T04:10:07.3478765Z and split_tag[0] == "ciflow" 2025-04-25T04:10:07.3479278Z and split_tag[2].isnumeric() 2025-04-25T04:10:07.3479767Z ): 2025-04-25T04:10:07.3480147Z pr_number = split_tag[2] 2025-04-25T04:10:07.3480629Z try: 2025-04-25T04:10:07.3481058Z repository = gh.get_repo(repo) 2025-04-25T04:10:07.3481670Z pull = repository.get_pull(number=int(pr_number)) 2025-04-25T04:10:07.3482269Z except Exception as e: 2025-04-25T04:10:07.3482778Z raise Exception( # noqa: TRY002 2025-04-25T04:10:07.3483561Z f"issue with pull request {pr_number} from repo {repository}" 2025-04-25T04:10:07.3484197Z ) from e 2025-04-25T04:10:07.3484724Z return pull.user.login # type: ignore[no-any-return] 2025-04-25T04:10:07.3485395Z # In all other cases, return the original input username 2025-04-25T04:10:07.3485967Z return username 2025-04-25T04:10:07.3486314Z 2025-04-25T04:10:07.3486321Z 2025-04-25T04:10:07.3486531Z def is_exception_branch(branch: str) -> bool: 2025-04-25T04:10:07.3487062Z """ 2025-04-25T04:10:07.3487690Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-04-25T04:10:07.3488446Z """ 2025-04-25T04:10:07.3488993Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-04-25T04:10:07.3489503Z 2025-04-25T04:10:07.3489509Z 2025-04-25T04:10:07.3489692Z def load_yaml(yaml_text: str) -> Any: 2025-04-25T04:10:07.3490201Z try: 2025-04-25T04:10:07.3490580Z data = yaml.safe_load(yaml_text) 2025-04-25T04:10:07.3491100Z return data 2025-04-25T04:10:07.3491506Z except yaml.YAMLError: 2025-04-25T04:10:07.3491988Z log.exception("Error loading YAML") 2025-04-25T04:10:07.3492506Z raise 2025-04-25T04:10:07.3492723Z 2025-04-25T04:10:07.3492730Z 2025-04-25T04:10:07.3493120Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-04-25T04:10:07.3493843Z """ 2025-04-25T04:10:07.3494427Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-04-25T04:10:07.3495014Z 2025-04-25T04:10:07.3495342Z If the issue body contains "---" then the text above that is the settings 2025-04-25T04:10:07.3496083Z and the text below is the list of opted in users. 2025-04-25T04:10:07.3496586Z 2025-04-25T04:10:07.3496940Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-04-25T04:10:07.3497629Z """ 2025-04-25T04:10:07.3498059Z rollout_state_parts = rollout_state.split("---") 2025-04-25T04:10:07.3498646Z if len(rollout_state_parts) >= 2: 2025-04-25T04:10:07.3499233Z return rollout_state_parts[0], rollout_state_parts[1] 2025-04-25T04:10:07.3499809Z else: 2025-04-25T04:10:07.3500178Z return "", rollout_state 2025-04-25T04:10:07.3500500Z 2025-04-25T04:10:07.3500506Z 2025-04-25T04:10:07.3500694Z class UserOptins(dict[str, list[str]]): 2025-04-25T04:10:07.3501205Z """ 2025-04-25T04:10:07.3501709Z Dictionary of users with a list of features they have opted into 2025-04-25T04:10:07.3502339Z """ 2025-04-25T04:10:07.3502541Z 2025-04-25T04:10:07.3502548Z 2025-04-25T04:10:07.3502867Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-04-25T04:10:07.3503634Z """ 2025-04-25T04:10:07.3504308Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-04-25T04:10:07.3504980Z 2025-04-25T04:10:07.3505572Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-04-25T04:10:07.3506714Z - Example line: "@User1,lf,split_build" 2025-04-25T04:10:07.3507404Z - A "#" prefix indicates the user is opted out of all experiments 2025-04-25T04:10:07.3507877Z 2025-04-25T04:10:07.3507883Z 2025-04-25T04:10:07.3508027Z """ 2025-04-25T04:10:07.3508391Z optins = UserOptins() 2025-04-25T04:10:07.3508863Z for user in user_optin_text.split("\n"): 2025-04-25T04:10:07.3509411Z user = user.strip("\r\n\t -") 2025-04-25T04:10:07.3509934Z if not user or not user.startswith("@"): 2025-04-25T04:10:07.3510481Z # Not a valid user. Skip 2025-04-25T04:10:07.3510993Z continue 2025-04-25T04:10:07.3511237Z 2025-04-25T04:10:07.3511392Z if user: 2025-04-25T04:10:07.3511818Z usr_name = user.split(",")[0].strip("@") 2025-04-25T04:10:07.3512642Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-04-25T04:10:07.3513139Z 2025-04-25T04:10:07.3513293Z return optins 2025-04-25T04:10:07.3513540Z 2025-04-25T04:10:07.3513547Z 2025-04-25T04:10:07.3513814Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-04-25T04:10:07.3514413Z """ 2025-04-25T04:10:07.3514798Z Check if the experiment name is valid. 2025-04-25T04:10:07.3515309Z A valid name: 2025-04-25T04:10:07.3515920Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-04-25T04:10:07.3516977Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-04-25T04:10:07.3517664Z - Cannot contain spaces 2025-04-25T04:10:07.3518118Z """ 2025-04-25T04:10:07.3518326Z 2025-04-25T04:10:07.3518578Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-04-25T04:10:07.3519256Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-04-25T04:10:07.3566829Z 2025-04-25T04:10:07.3567191Z if valid: 2025-04-25T04:10:07.3567916Z return True 2025-04-25T04:10:07.3568303Z 2025-04-25T04:10:07.3568557Z log.error( 2025-04-25T04:10:07.3570023Z 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-04-25T04:10:07.3571625Z ) 2025-04-25T04:10:07.3571978Z return False 2025-04-25T04:10:07.3572217Z 2025-04-25T04:10:07.3572224Z 2025-04-25T04:10:07.3572526Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-04-25T04:10:07.3573144Z """ 2025-04-25T04:10:07.3573716Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-04-25T04:10:07.3574423Z """ 2025-04-25T04:10:07.3574767Z try: 2025-04-25T04:10:07.3575130Z if settings_text: 2025-04-25T04:10:07.3575839Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-04-25T04:10:07.3576800Z # for easy reading 2025-04-25T04:10:07.3577573Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-04-25T04:10:07.3578420Z # the backtick character in shell commands. 2025-04-25T04:10:07.3579015Z backtick = chr(96) # backtick character 2025-04-25T04:10:07.3579684Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-04-25T04:10:07.3580363Z settings = load_yaml(settings_text) 2025-04-25T04:10:07.3580733Z 2025-04-25T04:10:07.3581130Z # For now we just load experiments. We can expand this if/when we add more settings 2025-04-25T04:10:07.3581869Z experiments = {} 2025-04-25T04:10:07.3582376Z 2025-04-25T04:10:07.3582720Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-04-25T04:10:07.3583452Z if not is_valid_experiment_name(exp_name): 2025-04-25T04:10:07.3584542Z # 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-04-25T04:10:07.3585541Z continue 2025-04-25T04:10:07.3585833Z 2025-04-25T04:10:07.3586006Z valid_settings = {} 2025-04-25T04:10:07.3586757Z for setting in exp_settings: 2025-04-25T04:10:07.3587319Z if setting not in Experiment._fields: 2025-04-25T04:10:07.3587872Z log.warning( 2025-04-25T04:10:07.3588554Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-04-25T04:10:07.3589250Z ) 2025-04-25T04:10:07.3589682Z else: 2025-04-25T04:10:07.3590194Z valid_settings[setting] = exp_settings[setting] 2025-04-25T04:10:07.3590613Z 2025-04-25T04:10:07.3590886Z experiments[exp_name] = Experiment(**valid_settings) 2025-04-25T04:10:07.3591632Z return Settings(experiments) 2025-04-25T04:10:07.3591993Z 2025-04-25T04:10:07.3592164Z except Exception: 2025-04-25T04:10:07.3592627Z log.exception("Failed to parse settings") 2025-04-25T04:10:07.3593015Z 2025-04-25T04:10:07.3593175Z return Settings() 2025-04-25T04:10:07.3593429Z 2025-04-25T04:10:07.3593435Z 2025-04-25T04:10:07.3593678Z def parse_settings(rollout_state: str) -> Settings: 2025-04-25T04:10:07.3594240Z """ 2025-04-25T04:10:07.3594662Z Parse settings, if any, from the rollout state. 2025-04-25T04:10:07.3595053Z 2025-04-25T04:10:07.3595388Z If the issue body contains "---" then the text above that is the settings 2025-04-25T04:10:07.3596292Z and the text below is the list of opted in users. 2025-04-25T04:10:07.3596714Z 2025-04-25T04:10:07.3597136Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-04-25T04:10:07.3597842Z """ 2025-04-25T04:10:07.3598400Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:10:07.3599134Z return parse_settings_from_text(settings_text) 2025-04-25T04:10:07.3599536Z 2025-04-25T04:10:07.3599543Z 2025-04-25T04:10:07.3599778Z def parse_users(rollout_state: str) -> UserOptins: 2025-04-25T04:10:07.3600326Z """ 2025-04-25T04:10:07.3600707Z Parse users from the rollout state. 2025-04-25T04:10:07.3601055Z 2025-04-25T04:10:07.3601214Z """ 2025-04-25T04:10:07.3601726Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-04-25T04:10:07.3602440Z return parse_user_opt_in_from_text(users_text) 2025-04-25T04:10:07.3602833Z 2025-04-25T04:10:07.3602840Z 2025-04-25T04:10:07.3603232Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:10:07.3603946Z """ 2025-04-25T04:10:07.3604339Z Check if a user is opted into an experiment 2025-04-25T04:10:07.3604858Z """ 2025-04-25T04:10:07.3605289Z return experiment_name in user_optins.get(user, []) 2025-04-25T04:10:07.3605735Z 2025-04-25T04:10:07.3605742Z 2025-04-25T04:10:07.3606297Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-04-25T04:10:07.3607033Z """ 2025-04-25T04:10:07.3607472Z Check if a user explicitly opted out of an experiment 2025-04-25T04:10:07.3608048Z """ 2025-04-25T04:10:07.3608529Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-04-25T04:10:07.3609192Z experiment_optout = "-" + experiment_name 2025-04-25T04:10:07.3609797Z if experiment_optout not in user_optins.get(user, []): 2025-04-25T04:10:07.3610377Z return False 2025-04-25T04:10:07.3610628Z 2025-04-25T04:10:07.3610888Z if is_user_opted_in(user, user_optins, experiment_name): 2025-04-25T04:10:07.3611635Z log.warning( 2025-04-25T04:10:07.3612397Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-04-25T04:10:07.3613244Z ) 2025-04-25T04:10:07.3613467Z 2025-04-25T04:10:07.3613621Z return True 2025-04-25T04:10:07.3613852Z 2025-04-25T04:10:07.3613859Z 2025-04-25T04:10:07.3614028Z def get_runner_prefix( 2025-04-25T04:10:07.3614443Z rollout_state: str, 2025-04-25T04:10:07.3614892Z workflow_requestors: Iterable[str], 2025-04-25T04:10:07.3615385Z branch: str, 2025-04-25T04:10:07.3615857Z eligible_experiments: frozenset[str] = frozenset(), 2025-04-25T04:10:07.3616589Z is_canary: bool = False, 2025-04-25T04:10:07.3617034Z ) -> str: 2025-04-25T04:10:07.3617425Z settings = parse_settings(rollout_state) 2025-04-25T04:10:07.3617988Z user_optins = parse_users(rollout_state) 2025-04-25T04:10:07.3618406Z 2025-04-25T04:10:07.3618685Z fleet_prefix = "" 2025-04-25T04:10:07.3619311Z prefixes = [] 2025-04-25T04:10:07.3620347Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-04-25T04:10:07.3622031Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-04-25T04:10:07.3623530Z log.info( 2025-04-25T04:10:07.3624680Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-04-25T04:10:07.3626003Z ) 2025-04-25T04:10:07.3627354Z continue 2025-04-25T04:10:07.3627816Z 2025-04-25T04:10:07.3628139Z if eligible_experiments: 2025-04-25T04:10:07.3629059Z if experiment_name not in eligible_experiments: 2025-04-25T04:10:07.3630150Z exp_list = ", ".join(eligible_experiments) 2025-04-25T04:10:07.3631131Z log.info( 2025-04-25T04:10:07.3632480Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-04-25T04:10:07.3634007Z ) 2025-04-25T04:10:07.3634651Z continue 2025-04-25T04:10:07.3635426Z elif not experiment_settings.default: 2025-04-25T04:10:07.3636502Z log.info( 2025-04-25T04:10:07.3637564Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-04-25T04:10:07.3638829Z ) 2025-04-25T04:10:07.3639461Z continue 2025-04-25T04:10:07.3639886Z 2025-04-25T04:10:07.3640395Z # Is any workflow_requestor opted out to this experiment? 2025-04-25T04:10:07.3641346Z opted_out_users = [ 2025-04-25T04:10:07.3642072Z requestor 2025-04-25T04:10:07.3643422Z for requestor in workflow_requestors 2025-04-25T04:10:07.3644610Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-04-25T04:10:07.3645548Z ] 2025-04-25T04:10:07.3645907Z 2025-04-25T04:10:07.3646394Z if opted_out_users: 2025-04-25T04:10:07.3647214Z log.info( 2025-04-25T04:10:07.3648307Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-04-25T04:10:07.3649527Z ) 2025-04-25T04:10:07.3650201Z continue 2025-04-25T04:10:07.3650641Z 2025-04-25T04:10:07.3651089Z # Is any workflow_requestor opted in to this experiment? 2025-04-25T04:10:07.3652081Z opted_in_users = [ 2025-04-25T04:10:07.3652776Z requestor 2025-04-25T04:10:07.3653507Z for requestor in workflow_requestors 2025-04-25T04:10:07.3654630Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-04-25T04:10:07.3655717Z ] 2025-04-25T04:10:07.3656337Z 2025-04-25T04:10:07.3656629Z enabled = False 2025-04-25T04:10:07.3657347Z if opted_in_users: 2025-04-25T04:10:07.3658081Z log.info( 2025-04-25T04:10:07.3659111Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-04-25T04:10:07.3660603Z ) 2025-04-25T04:10:07.3661291Z enabled = True 2025-04-25T04:10:07.3661791Z 2025-04-25T04:10:07.3662162Z elif experiment_settings.rollout_perc: 2025-04-25T04:10:07.3663640Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-04-25T04:10:07.3665342Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-04-25T04:10:07.3666777Z log.info( 2025-04-25T04:10:07.3668309Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-04-25T04:10:07.3669919Z ) 2025-04-25T04:10:07.3670586Z enabled = True 2025-04-25T04:10:07.3671096Z 2025-04-25T04:10:07.3671462Z if enabled: 2025-04-25T04:10:07.3672241Z label = experiment_name 2025-04-25T04:10:07.3673230Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-04-25T04:10:07.3674670Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-04-25T04:10:07.3676504Z # - If it's enabled, then we always list it's prefix first 2025-04-25T04:10:07.3677668Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-04-25T04:10:07.3678350Z if is_canary: 2025-04-25T04:10:07.3678836Z label += CANARY_FLEET_SUFFIX 2025-04-25T04:10:07.3679389Z fleet_prefix = label 2025-04-25T04:10:07.3679872Z else: 2025-04-25T04:10:07.3680287Z prefixes.append(label) 2025-04-25T04:10:07.3680638Z 2025-04-25T04:10:07.3680821Z if len(prefixes) > 1: 2025-04-25T04:10:07.3681248Z log.error( 2025-04-25T04:10:07.3682660Z 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-04-25T04:10:07.3684619Z ) 2025-04-25T04:10:07.3685325Z prefixes = prefixes[:1] 2025-04-25T04:10:07.3685846Z 2025-04-25T04:10:07.3686376Z # Fleet always comes first 2025-04-25T04:10:07.3687185Z if fleet_prefix: 2025-04-25T04:10:07.3687975Z prefixes.insert(0, fleet_prefix) 2025-04-25T04:10:07.3688605Z 2025-04-25T04:10:07.3689041Z return ".".join(prefixes) + "." if prefixes else "" 2025-04-25T04:10:07.3689778Z 2025-04-25T04:10:07.3689790Z 2025-04-25T04:10:07.3690552Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-04-25T04:10:07.3691885Z """ 2025-04-25T04:10:07.3692946Z Gets the first comment of the issue, which contains the desired rollout state. 2025-04-25T04:10:07.3693967Z 2025-04-25T04:10:07.3694600Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-04-25T04:10:07.3695770Z """ 2025-04-25T04:10:07.3696688Z gh = get_gh_client(github_token) 2025-04-25T04:10:07.3697564Z issue = get_issue(gh, repo, issue_num) 2025-04-25T04:10:07.3698643Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-04-25T04:10:07.3699381Z 2025-04-25T04:10:07.3699392Z 2025-04-25T04:10:07.3700055Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-04-25T04:10:07.3701344Z for _ in range(num_retries): 2025-04-25T04:10:07.3702147Z try: 2025-04-25T04:10:07.3702805Z req = Request(url=url, headers=headers) 2025-04-25T04:10:07.3703881Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-04-25T04:10:07.3704947Z return json.loads(content) 2025-04-25T04:10:07.3705795Z except Exception as e: 2025-04-25T04:10:07.3706868Z log.warning(f"Could not download {url}: {e}") 2025-04-25T04:10:07.3707549Z 2025-04-25T04:10:07.3708156Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-04-25T04:10:07.3709334Z return {} 2025-04-25T04:10:07.3709720Z 2025-04-25T04:10:07.3709730Z 2025-04-25T04:10:07.3709973Z @cache 2025-04-25T04:10:07.3711326Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-04-25T04:10:07.3712596Z """ 2025-04-25T04:10:07.3713221Z Dynamically get PR information 2025-04-25T04:10:07.3714031Z """ 2025-04-25T04:10:07.3714841Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-04-25T04:10:07.3715878Z headers = { 2025-04-25T04:10:07.3716880Z "Accept": "application/vnd.github.v3+json", 2025-04-25T04:10:07.3717886Z "Authorization": f"token {github_token}", 2025-04-25T04:10:07.3718859Z } 2025-04-25T04:10:07.3719636Z json_response: dict[str, Any] = download_json( 2025-04-25T04:10:07.3720690Z url=f"{github_api}/issues/{pr_number}", 2025-04-25T04:10:07.3721637Z headers=headers, 2025-04-25T04:10:07.3722347Z ) 2025-04-25T04:10:07.3722714Z 2025-04-25T04:10:07.3723010Z if not json_response: 2025-04-25T04:10:07.3723920Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-04-25T04:10:07.3725023Z return {} 2025-04-25T04:10:07.3725410Z 2025-04-25T04:10:07.3725691Z return json_response 2025-04-25T04:10:07.3726354Z 2025-04-25T04:10:07.3726366Z 2025-04-25T04:10:07.3727031Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-04-25T04:10:07.3728548Z """ 2025-04-25T04:10:07.3729443Z Dynamically get the latest list of labels from the pull request 2025-04-25T04:10:07.3730535Z """ 2025-04-25T04:10:07.3731363Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-04-25T04:10:07.3732408Z return { 2025-04-25T04:10:07.3733393Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-04-25T04:10:07.3734697Z } 2025-04-25T04:10:07.3735042Z 2025-04-25T04:10:07.3735053Z 2025-04-25T04:10:07.3735350Z def main() -> None: 2025-04-25T04:10:07.3736371Z args = parse_args() 2025-04-25T04:10:07.3736829Z 2025-04-25T04:10:07.3737227Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-04-25T04:10:07.3737933Z 2025-04-25T04:10:07.3738256Z # Check if the PR is opt-out 2025-04-25T04:10:07.3739076Z if args.pr_number: 2025-04-25T04:10:07.3740197Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-04-25T04:10:07.3741493Z if OPT_OUT_LABEL in labels: 2025-04-25T04:10:07.3742367Z log.info( 2025-04-25T04:10:07.3743369Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-04-25T04:10:07.3744529Z ) 2025-04-25T04:10:07.3745383Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:10:07.3746679Z sys.exit() 2025-04-25T04:10:07.3747087Z 2025-04-25T04:10:07.3747344Z try: 2025-04-25T04:10:07.3748049Z rollout_state = get_rollout_state_from_issue( 2025-04-25T04:10:07.3749300Z args.github_token, args.github_issue_repo, args.github_issue 2025-04-25T04:10:07.3750366Z ) 2025-04-25T04:10:07.3750664Z 2025-04-25T04:10:07.3750966Z username = get_potential_pr_author( 2025-04-25T04:10:07.3751823Z args.github_token, 2025-04-25T04:10:07.3752658Z args.github_repo, 2025-04-25T04:10:07.3753414Z args.github_actor, 2025-04-25T04:10:07.3754227Z args.github_ref_type, 2025-04-25T04:10:07.3755099Z args.github_branch, 2025-04-25T04:10:07.3755861Z ) 2025-04-25T04:10:07.3756415Z 2025-04-25T04:10:07.3756873Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-04-25T04:10:07.3757607Z 2025-04-25T04:10:07.3757963Z runner_label_prefix = get_runner_prefix( 2025-04-25T04:10:07.3758945Z rollout_state, 2025-04-25T04:10:07.3759768Z (args.github_issue_owner, username), 2025-04-25T04:10:07.3760695Z args.github_branch, 2025-04-25T04:10:07.3761559Z args.eligible_experiments, 2025-04-25T04:10:07.3762492Z is_canary, 2025-04-25T04:10:07.3763169Z ) 2025-04-25T04:10:07.3763514Z 2025-04-25T04:10:07.3764099Z except Exception as e: 2025-04-25T04:10:07.3764903Z log.error( 2025-04-25T04:10:07.3766077Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-04-25T04:10:07.3767610Z ) 2025-04-25T04:10:07.3768023Z 2025-04-25T04:10:07.3768569Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-04-25T04:10:07.3769422Z 2025-04-25T04:10:07.3769435Z 2025-04-25T04:10:07.3769723Z if __name__ == "__main__": 2025-04-25T04:10:07.3770419Z main() 2025-04-25T04:10:07.3770759Z 2025-04-25T04:10:07.3868471Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-25T04:10:07.3869281Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-04-25T04:10:07.3899771Z shell: /usr/bin/bash -e {0} 2025-04-25T04:10:07.3900198Z env: 2025-04-25T04:10:07.3900746Z GITHUB_TOKEN: *** 2025-04-25T04:10:07.3901121Z ISSUE_NUMBER: 5132 2025-04-25T04:10:07.3901519Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:10:07.3902023Z ISSUE_OWNER: 2025-04-25T04:10:07.3902379Z CHECK_EXPERIMENTS: 2025-04-25T04:10:07.3902754Z PR_NUMBER: 2025-04-25T04:10:07.3903085Z ##[endgroup] 2025-04-25T04:10:08.4954891Z Defaulting to user installation because normal site-packages is not writeable 2025-04-25T04:10:09.0926400Z Collecting urllib3==1.26.18 2025-04-25T04:10:09.1244911Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-04-25T04:10:09.1442281Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.7 MB/s eta 0:00:00 2025-04-25T04:10:09.1652205Z Collecting PyGithub==2.3.0 2025-04-25T04:10:09.1691777Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-04-25T04:10:09.2101698Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-04-25T04:10:09.2132083Z 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-04-25T04:10:09.2188872Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-04-25T04:10:09.2204910Z 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-04-25T04:10:09.2219963Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-04-25T04:10:09.2458533Z Collecting Deprecated (from PyGithub==2.3.0) 2025-04-25T04:10:09.2486644Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-04-25T04:10:09.2721694Z 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-04-25T04:10:09.3807013Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-25T04:10:09.3849862Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-04-25T04:10:09.4979743Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-04-25T04:10:09.5015931Z 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-04-25T04:10:09.5200606Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-04-25T04:10:09.5229244Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-04-25T04:10:09.5449629Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-04-25T04:10:09.5572304Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 13.0 MB/s eta 0:00:00 2025-04-25T04:10:09.5614381Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-04-25T04:10:09.5685542Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 70.8 MB/s eta 0:00:00 2025-04-25T04:10:09.5721185Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-04-25T04:10:09.5829836Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 97.5 MB/s eta 0:00:00 2025-04-25T04:10:09.5861057Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-04-25T04:10:09.5908071Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-04-25T04:10:09.5974092Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 101.3 MB/s eta 0:00:00 2025-04-25T04:10:09.6001559Z 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-04-25T04:10:09.6042573Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 31.1 MB/s eta 0:00:00 2025-04-25T04:10:09.6069009Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-04-25T04:10:09.6111675Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.5 MB/s eta 0:00:00 2025-04-25T04:10:09.9260458Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-04-25T04:10:10.4608241Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-04-25T04:10:10.5426557Z ##[group]Run curr_branch="ciflow/trunk/148893" 2025-04-25T04:10:10.5426950Z curr_branch="ciflow/trunk/148893" 2025-04-25T04:10:10.5427216Z curr_ref_type="tag" 2025-04-25T04:10:10.5427468Z echo "Current branch is '$curr_branch'" 2025-04-25T04:10:10.5427741Z  2025-04-25T04:10:10.5427940Z python3 runner_determinator.py \ 2025-04-25T04:10:10.5428245Z  --github-token "$GITHUB_TOKEN" \ 2025-04-25T04:10:10.5428517Z  --github-issue "$ISSUE_NUMBER" \ 2025-04-25T04:10:10.5428778Z  --github-branch "$curr_branch" \ 2025-04-25T04:10:10.5429039Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-04-25T04:10:10.5429326Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-04-25T04:10:10.5429614Z  --github-ref-type "$curr_ref_type" \ 2025-04-25T04:10:10.5429885Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-04-25T04:10:10.5430231Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-04-25T04:10:10.5430542Z  --pr-number "${PR_NUMBER}" 2025-04-25T04:10:10.5461138Z shell: /usr/bin/bash -e {0} 2025-04-25T04:10:10.5461364Z env: 2025-04-25T04:10:10.5461927Z GITHUB_TOKEN: *** 2025-04-25T04:10:10.5462132Z ISSUE_NUMBER: 5132 2025-04-25T04:10:10.5462336Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-04-25T04:10:10.5462575Z ISSUE_OWNER: 2025-04-25T04:10:10.5462762Z CHECK_EXPERIMENTS: 2025-04-25T04:10:10.5462959Z PR_NUMBER: 2025-04-25T04:10:10.5463129Z ##[endgroup] 2025-04-25T04:10:10.5512407Z Current branch is 'ciflow/trunk/148893' 2025-04-25T04:10:12.6124583Z INFO : Based on rollout percentage of 100%, enabling experiment ephemeral. 2025-04-25T04:10:12.6379065Z INFO : Setting output: label-type='ephemeral.' 2025-04-25T04:10:12.6438574Z Evaluate and set job outputs 2025-04-25T04:10:12.6445306Z Set output 'label-type' 2025-04-25T04:10:12.6447418Z Cleaning up orphan processes