2025-03-14T03:51:42.5436836Z Current runner version: '2.322.0' 2025-03-14T03:51:42.5462826Z ##[group]Operating System 2025-03-14T03:51:42.5463606Z Ubuntu 2025-03-14T03:51:42.5464059Z 24.04.2 2025-03-14T03:51:42.5464661Z LTS 2025-03-14T03:51:42.5465131Z ##[endgroup] 2025-03-14T03:51:42.5465702Z ##[group]Runner Image 2025-03-14T03:51:42.5466282Z Image: ubuntu-24.04 2025-03-14T03:51:42.5466765Z Version: 20250309.1.0 2025-03-14T03:51:42.5467845Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:51:42.5469252Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:51:42.5470171Z ##[endgroup] 2025-03-14T03:51:42.5471036Z ##[group]Runner Image Provisioner 2025-03-14T03:51:42.5471660Z 2.0.422.1 2025-03-14T03:51:42.5472123Z ##[endgroup] 2025-03-14T03:51:42.5473207Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:51:42.5475198Z Contents: read 2025-03-14T03:51:42.5475834Z Metadata: read 2025-03-14T03:51:42.5476517Z ##[endgroup] 2025-03-14T03:51:42.5479756Z Secret source: Actions 2025-03-14T03:51:42.5480925Z Prepare workflow directory 2025-03-14T03:51:42.5984149Z Prepare all required actions 2025-03-14T03:51:42.6038531Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:51:42.6044050Z ##[group] Inputs 2025-03-14T03:51:42.6044649Z check_experiments: 2025-03-14T03:51:42.6045376Z triggering_actor: pytorchmergebot 2025-03-14T03:51:42.6046006Z issue_owner: 2025-03-14T03:51:42.6046469Z curr_branch: main 2025-03-14T03:51:42.6047088Z curr_ref_type: branch 2025-03-14T03:51:42.6047639Z issue_number: 5132 2025-03-14T03:51:42.6048204Z ##[endgroup] 2025-03-14T03:51:42.6048850Z Complete job name: get-label-type / runner-determinator 2025-03-14T03:51:43.2768685Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:51:43.2770685Z cat < runner_determinator.py 2025-03-14T03:51:43.2771351Z # flake8: noqa: G004 2025-03-14T03:51:43.2771889Z  2025-03-14T03:51:43.2772637Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.2773731Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.2774686Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.2775400Z  2025-03-14T03:51:43.2775798Z """ 2025-03-14T03:51:43.2776482Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.2777512Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.2778623Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.2779631Z of which runners should be used to run which job. 2025-03-14T03:51:43.2780284Z  2025-03-14T03:51:43.2781079Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.2782175Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.2783207Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.2784041Z list, defined. 2025-03-14T03:51:43.2784516Z  2025-03-14T03:51:43.2785158Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.2786257Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.2787264Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.2787986Z  2025-03-14T03:51:43.2788642Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.2789690Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.2790683Z experiments which the user could be opted in to. 2025-03-14T03:51:43.2791703Z  2025-03-14T03:51:43.2792182Z The user list has the following rules: 2025-03-14T03:51:43.2792806Z  2025-03-14T03:51:43.2793441Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.2794473Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.2795412Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.2796094Z  2025-03-14T03:51:43.2796627Z Example config: 2025-03-14T03:51:43.2797227Z  # A list of experiments that can be opted into. 2025-03-14T03:51:43.2798042Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.2798799Z  # Expected syntax is: 2025-03-14T03:51:43.2799596Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.2801045Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.2801979Z  2025-03-14T03:51:43.2802393Z  experiments: 2025-03-14T03:51:43.2802893Z  lf: 2025-03-14T03:51:43.2803363Z  rollout_percent: 25 2025-03-14T03:51:43.2803943Z  all_branches: false 2025-03-14T03:51:43.2804508Z  default: true 2025-03-14T03:51:43.2805025Z  --- 2025-03-14T03:51:43.2805455Z  2025-03-14T03:51:43.2805868Z  # Opt-ins: 2025-03-14T03:51:43.2806579Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.2807807Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.2808760Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.2809570Z  # Experiments should be from the above list. 2025-03-14T03:51:43.2810212Z  2025-03-14T03:51:43.2810794Z  @User1,-lf,split_build 2025-03-14T03:51:43.2811356Z  @User2,lf 2025-03-14T03:51:43.2811848Z  @User3,split_build 2025-03-14T03:51:43.2812445Z """ 2025-03-14T03:51:43.2812918Z  2025-03-14T03:51:43.2813386Z import json 2025-03-14T03:51:43.2813921Z import logging 2025-03-14T03:51:43.2814473Z import os 2025-03-14T03:51:43.2814987Z import random 2025-03-14T03:51:43.2815476Z import re 2025-03-14T03:51:43.2815915Z import sys 2025-03-14T03:51:43.2816425Z from argparse import ArgumentParser 2025-03-14T03:51:43.2817112Z from collections.abc import Iterable 2025-03-14T03:51:43.2817758Z from functools import cache 2025-03-14T03:51:43.2818351Z from logging import LogRecord 2025-03-14T03:51:43.2818972Z from typing import Any, NamedTuple 2025-03-14T03:51:43.2819666Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.2820306Z  2025-03-14T03:51:43.2820833Z import yaml 2025-03-14T03:51:43.2821342Z from github import Auth, Github 2025-03-14T03:51:43.2821958Z from github.Issue import Issue 2025-03-14T03:51:43.2822531Z  2025-03-14T03:51:43.2822930Z  2025-03-14T03:51:43.2823431Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.2824276Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.2825307Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.2826136Z  2025-03-14T03:51:43.2826651Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.2827358Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.2828009Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.2828701Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.2829497Z  2025-03-14T03:51:43.2829958Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.2830657Z  2025-03-14T03:51:43.2831089Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.2831660Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.2832203Z  2025-03-14T03:51:43.2832607Z  2025-03-14T03:51:43.2833079Z class Experiment(NamedTuple): 2025-03-14T03:51:43.2833681Z  rollout_perc: float = ( 2025-03-14T03:51:43.2834501Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.2835360Z  ) 2025-03-14T03:51:43.2835865Z  all_branches: bool = ( 2025-03-14T03:51:43.2836701Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.2837545Z  ) 2025-03-14T03:51:43.2837994Z  default: bool = ( 2025-03-14T03:51:43.2838711Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.2839481Z  ) 2025-03-14T03:51:43.2840054Z  2025-03-14T03:51:43.2840938Z  # Add more fields as needed 2025-03-14T03:51:43.2841547Z  2025-03-14T03:51:43.2841945Z  2025-03-14T03:51:43.2842385Z class Settings(NamedTuple): 2025-03-14T03:51:43.2842947Z  """ 2025-03-14T03:51:43.2843521Z  Settings for the experiments that can be opted into. 2025-03-14T03:51:43.2844217Z  """ 2025-03-14T03:51:43.2844643Z  2025-03-14T03:51:43.2845118Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.2845738Z  2025-03-14T03:51:43.2846292Z  2025-03-14T03:51:43.2846794Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.2847573Z  """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.2848293Z  2025-03-14T03:51:43.2848706Z  COLORS = { 2025-03-14T03:51:43.2849228Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.2849858Z  "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.2850616Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.2851243Z  "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.2851861Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.2852431Z  } 2025-03-14T03:51:43.2852857Z  2025-03-14T03:51:43.2853361Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.2854269Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.2855206Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.2855910Z  return super().format(record) 2025-03-14T03:51:43.2856492Z  2025-03-14T03:51:43.2856893Z  2025-03-14T03:51:43.2857356Z handler = logging.StreamHandler() 2025-03-14T03:51:43.2858218Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.2859100Z  2025-03-14T03:51:43.2859628Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.2860342Z log.addHandler(handler) 2025-03-14T03:51:43.2861007Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.2861561Z  2025-03-14T03:51:43.2861969Z  2025-03-14T03:51:43.2862510Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.2863200Z  """ 2025-03-14T03:51:43.2863823Z  Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.2864596Z  """ 2025-03-14T03:51:43.2865057Z  if not GITHUB_OUTPUT: 2025-03-14T03:51:43.2866324Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.2867812Z  log.warning( 2025-03-14T03:51:43.2868817Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.2869917Z  ) 2025-03-14T03:51:43.2870544Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.2871200Z  return 2025-03-14T03:51:43.2871757Z  2025-03-14T03:51:43.2872214Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.2872923Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.2873609Z  f.write(f"{key}={value}\n") 2025-03-14T03:51:43.2874195Z  2025-03-14T03:51:43.2874597Z  2025-03-14T03:51:43.2875189Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.2875976Z  return frozenset( 2025-03-14T03:51:43.2876732Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.2877538Z  ) 2025-03-14T03:51:43.2878033Z  2025-03-14T03:51:43.2878433Z  2025-03-14T03:51:43.2878857Z def parse_args() -> Any: 2025-03-14T03:51:43.2879554Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.2880680Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.2881607Z  parser.add_argument( 2025-03-14T03:51:43.2882177Z  "--github-issue-repo", 2025-03-14T03:51:43.2882782Z  type=str, 2025-03-14T03:51:43.2883308Z  required=False, 2025-03-14T03:51:43.2884019Z  default="pytorch/test-infra", 2025-03-14T03:51:43.2884704Z  help="GitHub repo to get the issue", 2025-03-14T03:51:43.2885320Z  ) 2025-03-14T03:51:43.2885770Z  parser.add_argument( 2025-03-14T03:51:43.2886335Z  "--github-repo", 2025-03-14T03:51:43.2886877Z  type=str, 2025-03-14T03:51:43.2887395Z  required=True, 2025-03-14T03:51:43.2887993Z  help="GitHub repo where CI is running", 2025-03-14T03:51:43.2888619Z  ) 2025-03-14T03:51:43.2889070Z  parser.add_argument( 2025-03-14T03:51:43.2889815Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.2890710Z  ) 2025-03-14T03:51:43.2891156Z  parser.add_argument( 2025-03-14T03:51:43.2891935Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.2892744Z  ) 2025-03-14T03:51:43.2893194Z  parser.add_argument( 2025-03-14T03:51:43.2893977Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.2894806Z  ) 2025-03-14T03:51:43.2895254Z  parser.add_argument( 2025-03-14T03:51:43.2896057Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.2896905Z  ) 2025-03-14T03:51:43.2897343Z  parser.add_argument( 2025-03-14T03:51:43.2897906Z  "--github-ref-type", 2025-03-14T03:51:43.2898475Z  type=str, 2025-03-14T03:51:43.2898984Z  required=True, 2025-03-14T03:51:43.2899599Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.2900251Z  ) 2025-03-14T03:51:43.2900800Z  parser.add_argument( 2025-03-14T03:51:43.2901384Z  "--eligible-experiments", 2025-03-14T03:51:43.2902037Z  type=_str_comma_separated_to_set, 2025-03-14T03:51:43.2902675Z  required=False, 2025-03-14T03:51:43.2903204Z  default="", 2025-03-14T03:51:43.2904347Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.2905453Z  ) 2025-03-14T03:51:43.2905899Z  parser.add_argument( 2025-03-14T03:51:43.2906463Z  "--pr-number", 2025-03-14T03:51:43.2906995Z  type=str, 2025-03-14T03:51:43.2907500Z  required=False, 2025-03-14T03:51:43.2908036Z  default="", 2025-03-14T03:51:43.2908641Z  help="the optional PR number where this is run", 2025-03-14T03:51:43.2909303Z  ) 2025-03-14T03:51:43.2909726Z  2025-03-14T03:51:43.2910157Z  return parser.parse_args() 2025-03-14T03:51:43.2910826Z  2025-03-14T03:51:43.2911233Z  2025-03-14T03:51:43.2911950Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.2912885Z  auth = Auth.Token(github_token) 2025-03-14T03:51:43.2913521Z  return Github(auth=auth) 2025-03-14T03:51:43.2914082Z  2025-03-14T03:51:43.2914477Z  2025-03-14T03:51:43.2915227Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.2916196Z  repo = gh.get_repo(repo) 2025-03-14T03:51:43.2916820Z  return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.2917436Z  2025-03-14T03:51:43.2917832Z  2025-03-14T03:51:43.2918273Z def get_potential_pr_author( 2025-03-14T03:51:43.2919055Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.2919865Z ) -> str: 2025-03-14T03:51:43.2920719Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.2921716Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.2922887Z  # embedded in the tag name: ciflow// 2025-03-14T03:51:43.2923603Z  2025-03-14T03:51:43.2924054Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.2924637Z  2025-03-14T03:51:43.2925187Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.2925952Z  split_tag = ref_name.split("/") 2025-03-14T03:51:43.2926546Z  if ( 2025-03-14T03:51:43.2927028Z  len(split_tag) == 3 2025-03-14T03:51:43.2927639Z  and split_tag[0] == "ciflow" 2025-03-14T03:51:43.2928280Z  and split_tag[2].isnumeric() 2025-03-14T03:51:43.2928875Z  ): 2025-03-14T03:51:43.2929374Z  pr_number = split_tag[2] 2025-03-14T03:51:43.2929954Z  try: 2025-03-14T03:51:43.2930594Z  repository = gh.get_repo(repo) 2025-03-14T03:51:43.2931330Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.2932069Z  except Exception as e: 2025-03-14T03:51:43.2932715Z  raise Exception( # noqa: TRY002 2025-03-14T03:51:43.2933511Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.2934284Z  ) from e 2025-03-14T03:51:43.2934942Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.2935775Z  # In all other cases, return the original input username 2025-03-14T03:51:43.2936484Z  return username 2025-03-14T03:51:43.2936978Z  2025-03-14T03:51:43.2937362Z  2025-03-14T03:51:43.2937851Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.2938478Z  """ 2025-03-14T03:51:43.2939236Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.2940292Z  """ 2025-03-14T03:51:43.2941032Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.2941813Z  2025-03-14T03:51:43.2942200Z  2025-03-14T03:51:43.2942654Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.2943238Z  try: 2025-03-14T03:51:43.2943708Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.2944315Z  return data 2025-03-14T03:51:43.2944823Z  except yaml.YAMLError: 2025-03-14T03:51:43.2945436Z  log.exception("Error loading YAML") 2025-03-14T03:51:43.2946040Z  raise 2025-03-14T03:51:43.2946492Z  2025-03-14T03:51:43.2946879Z  2025-03-14T03:51:43.2947588Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.2948478Z  """ 2025-03-14T03:51:43.2949203Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.2950106Z  2025-03-14T03:51:43.2950817Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.2951718Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.2952363Z  2025-03-14T03:51:43.2953021Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.2953825Z  """ 2025-03-14T03:51:43.2954365Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.2955060Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.2955932Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.2956647Z  else: 2025-03-14T03:51:43.2957111Z  return "", rollout_state 2025-03-14T03:51:43.2957664Z  2025-03-14T03:51:43.2958053Z  2025-03-14T03:51:43.2958516Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.2959122Z  """ 2025-03-14T03:51:43.2959743Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.2960606Z  """ 2025-03-14T03:51:43.2961022Z  2025-03-14T03:51:43.2961402Z  2025-03-14T03:51:43.2962016Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.2962796Z  """ 2025-03-14T03:51:43.2963624Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:51:43.2964613Z  2025-03-14T03:51:43.2965540Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.2966711Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.2967514Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.2968265Z  2025-03-14T03:51:43.2968656Z  2025-03-14T03:51:43.2969041Z  """ 2025-03-14T03:51:43.2969480Z  optins = UserOptins() 2025-03-14T03:51:43.2970091Z  for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.2970848Z  user = user.strip("\r\n\t -") 2025-03-14T03:51:43.2971521Z  if not user or not user.startswith("@"): 2025-03-14T03:51:43.2972179Z  # Not a valid user. Skip 2025-03-14T03:51:43.2972764Z  continue 2025-03-14T03:51:43.2973258Z  2025-03-14T03:51:43.2973655Z  if user: 2025-03-14T03:51:43.2974211Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.2975017Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.2975768Z  2025-03-14T03:51:43.2976322Z  return optins 2025-03-14T03:51:43.2976810Z  2025-03-14T03:51:43.2977199Z  2025-03-14T03:51:43.2977769Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.2978487Z  """ 2025-03-14T03:51:43.2978979Z  Check if the experiment name is valid. 2025-03-14T03:51:43.2979604Z  A valid name: 2025-03-14T03:51:43.2980392Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.2981586Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.2982440Z  - Cannot contain spaces 2025-03-14T03:51:43.2982997Z  """ 2025-03-14T03:51:43.2983424Z  2025-03-14T03:51:43.2983953Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.2984791Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.2985520Z  2025-03-14T03:51:43.2985915Z  if valid: 2025-03-14T03:51:43.2986397Z  return True 2025-03-14T03:51:43.2986882Z  2025-03-14T03:51:43.2987277Z  log.error( 2025-03-14T03:51:43.2988889Z  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-03-14T03:51:43.2990920Z  ) 2025-03-14T03:51:43.2991352Z  return False 2025-03-14T03:51:43.2991823Z  2025-03-14T03:51:43.2992205Z  2025-03-14T03:51:43.2992933Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.2993699Z  """ 2025-03-14T03:51:43.2994380Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.2995213Z  """ 2025-03-14T03:51:43.2995638Z  try: 2025-03-14T03:51:43.2996077Z  if settings_text: 2025-03-14T03:51:43.2996932Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.2997858Z  # for easy reading 2025-03-14T03:51:43.2998788Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.2999847Z  # the backtick character in shell commands. 2025-03-14T03:51:43.3000680Z  backtick = chr(96) # backtick character 2025-03-14T03:51:43.3001472Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.3002274Z  settings = load_yaml(settings_text) 2025-03-14T03:51:43.3002880Z  2025-03-14T03:51:43.3003555Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.3004424Z  experiments = {} 2025-03-14T03:51:43.3004958Z  2025-03-14T03:51:43.3005592Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.3006486Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.3007721Z  # 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-03-14T03:51:43.3008932Z  continue 2025-03-14T03:51:43.3009456Z  2025-03-14T03:51:43.3009885Z  valid_settings = {} 2025-03-14T03:51:43.3010611Z  for setting in exp_settings: 2025-03-14T03:51:43.3011299Z  if setting not in Experiment._fields: 2025-03-14T03:51:43.3011963Z  log.warning( 2025-03-14T03:51:43.3012934Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.3013766Z  ) 2025-03-14T03:51:43.3014298Z  else: 2025-03-14T03:51:43.3014935Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.3015612Z  2025-03-14T03:51:43.3016153Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.3017135Z  return Settings(experiments) 2025-03-14T03:51:43.3017737Z  2025-03-14T03:51:43.3018162Z  except Exception: 2025-03-14T03:51:43.3018770Z  log.exception("Failed to parse settings") 2025-03-14T03:51:43.3019406Z  2025-03-14T03:51:43.3019817Z  return Settings() 2025-03-14T03:51:43.3020313Z  2025-03-14T03:51:43.3020814Z  2025-03-14T03:51:43.3021340Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.3022012Z  """ 2025-03-14T03:51:43.3022546Z  Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.3023199Z  2025-03-14T03:51:43.3023814Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.3024724Z  and the text below is the list of opted in users. 2025-03-14T03:51:43.3025382Z  2025-03-14T03:51:43.3026060Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.3026914Z  """ 2025-03-14T03:51:43.3027844Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.3028919Z  return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.3029581Z  2025-03-14T03:51:43.3029967Z  2025-03-14T03:51:43.3030592Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.3031279Z  """ 2025-03-14T03:51:43.3031757Z  Parse users from the rollout state. 2025-03-14T03:51:43.3032343Z  2025-03-14T03:51:43.3032743Z  """ 2025-03-14T03:51:43.3033376Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.3034256Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.3034895Z  2025-03-14T03:51:43.3035287Z  2025-03-14T03:51:43.3035985Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.3036865Z  """ 2025-03-14T03:51:43.3037376Z  Check if a user is opted into an experiment 2025-03-14T03:51:43.3038004Z  """ 2025-03-14T03:51:43.3038556Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.3039232Z  2025-03-14T03:51:43.3039618Z  2025-03-14T03:51:43.3040314Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.3041310Z  """ 2025-03-14T03:51:43.3041870Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.3042552Z  """ 2025-03-14T03:51:43.3043171Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.3043991Z  experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.3044741Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.3045447Z  return False 2025-03-14T03:51:43.3045937Z  2025-03-14T03:51:43.3046473Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.3047174Z  log.warning( 2025-03-14T03:51:43.3048105Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.3049269Z  ) 2025-03-14T03:51:43.3049695Z  2025-03-14T03:51:43.3050090Z  return True 2025-03-14T03:51:43.3050656Z  2025-03-14T03:51:43.3051043Z  2025-03-14T03:51:43.3051449Z def get_runner_prefix( 2025-03-14T03:51:43.3051984Z  rollout_state: str, 2025-03-14T03:51:43.3052563Z  workflow_requestors: Iterable[str], 2025-03-14T03:51:43.3053178Z  branch: str, 2025-03-14T03:51:43.3053788Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.3054482Z  is_canary: bool = False, 2025-03-14T03:51:43.3055031Z ) -> str: 2025-03-14T03:51:43.3055548Z  settings = parse_settings(rollout_state) 2025-03-14T03:51:43.3056238Z  user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.3056836Z  2025-03-14T03:51:43.3057244Z  fleet_prefix = "" 2025-03-14T03:51:43.3057768Z  prefixes = [] 2025-03-14T03:51:43.3058525Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.3059615Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.3060542Z  log.info( 2025-03-14T03:51:43.3061344Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.3062224Z  ) 2025-03-14T03:51:43.3062696Z  continue 2025-03-14T03:51:43.3063186Z  2025-03-14T03:51:43.3063622Z  if eligible_experiments: 2025-03-14T03:51:43.3064427Z  if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.3065213Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.3065870Z  log.info( 2025-03-14T03:51:43.3066785Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.3067756Z  ) 2025-03-14T03:51:43.3068258Z  continue 2025-03-14T03:51:43.3068856Z  elif not experiment_settings.default: 2025-03-14T03:51:43.3069474Z  log.info( 2025-03-14T03:51:43.3070259Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.3071262Z  ) 2025-03-14T03:51:43.3071729Z  continue 2025-03-14T03:51:43.3072216Z  2025-03-14T03:51:43.3072760Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.3073491Z  opted_out_users = [ 2025-03-14T03:51:43.3074045Z  requestor 2025-03-14T03:51:43.3074619Z  for requestor in workflow_requestors 2025-03-14T03:51:43.3075424Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.3076154Z  ] 2025-03-14T03:51:43.3076579Z  2025-03-14T03:51:43.3076998Z  if opted_out_users: 2025-03-14T03:51:43.3077557Z  log.info( 2025-03-14T03:51:43.3078298Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.3079100Z  ) 2025-03-14T03:51:43.3079556Z  continue 2025-03-14T03:51:43.3080032Z  2025-03-14T03:51:43.3080673Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.3081397Z  opted_in_users = [ 2025-03-14T03:51:43.3081957Z  requestor 2025-03-14T03:51:43.3082533Z  for requestor in workflow_requestors 2025-03-14T03:51:43.3083305Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.3084195Z  ] 2025-03-14T03:51:43.3084621Z  2025-03-14T03:51:43.3085031Z  enabled = False 2025-03-14T03:51:43.3085569Z  if opted_in_users: 2025-03-14T03:51:43.3086101Z  log.info( 2025-03-14T03:51:43.3086833Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.3087619Z  ) 2025-03-14T03:51:43.3088098Z  enabled = True 2025-03-14T03:51:43.3088617Z  2025-03-14T03:51:43.3089082Z  elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.3090070Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.3091268Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.3092032Z  log.info( 2025-03-14T03:51:43.3093046Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.3094119Z  ) 2025-03-14T03:51:43.3094620Z  enabled = True 2025-03-14T03:51:43.3095155Z  2025-03-14T03:51:43.3095563Z  if enabled: 2025-03-14T03:51:43.3096105Z  label = experiment_name 2025-03-14T03:51:43.3096771Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.3097723Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.3098859Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.3099753Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.3100618Z  if is_canary: 2025-03-14T03:51:43.3101226Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.3101871Z  fleet_prefix = label 2025-03-14T03:51:43.3102452Z  else: 2025-03-14T03:51:43.3103016Z  prefixes.append(label) 2025-03-14T03:51:43.3103603Z  2025-03-14T03:51:43.3104019Z  if len(prefixes) > 1: 2025-03-14T03:51:43.3104560Z  log.error( 2025-03-14T03:51:43.3105729Z  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-03-14T03:51:43.3106999Z  ) 2025-03-14T03:51:43.3107463Z  prefixes = prefixes[:1] 2025-03-14T03:51:43.3108022Z  2025-03-14T03:51:43.3108454Z  # Fleet always comes first 2025-03-14T03:51:43.3109028Z  if fleet_prefix: 2025-03-14T03:51:43.3109579Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.3110173Z  2025-03-14T03:51:43.3110785Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.3111463Z  2025-03-14T03:51:43.3111855Z  2025-03-14T03:51:43.3112573Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.3113487Z  """ 2025-03-14T03:51:43.3114159Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.3114987Z  2025-03-14T03:51:43.3115640Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.3116468Z  """ 2025-03-14T03:51:43.3116947Z  gh = get_gh_client(github_token) 2025-03-14T03:51:43.3117601Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.3118347Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.3119178Z  2025-03-14T03:51:43.3119567Z  2025-03-14T03:51:43.3120243Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.3121231Z  for _ in range(num_retries): 2025-03-14T03:51:43.3121804Z  try: 2025-03-14T03:51:43.3122321Z  req = Request(url=url, headers=headers) 2025-03-14T03:51:43.3123081Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.3123835Z  return json.loads(content) 2025-03-14T03:51:43.3124459Z  except Exception as e: 2025-03-14T03:51:43.3125114Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.3125760Z  2025-03-14T03:51:43.3126410Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.3127234Z  return {} 2025-03-14T03:51:43.3127696Z  2025-03-14T03:51:43.3128080Z  2025-03-14T03:51:43.3128463Z @cache 2025-03-14T03:51:43.3129185Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.3130063Z  """ 2025-03-14T03:51:43.3130637Z  Dynamically get PR information 2025-03-14T03:51:43.3199549Z  """ 2025-03-14T03:51:43.3200219Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.3201299Z  headers = { 2025-03-14T03:51:43.3201880Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.3202609Z  "Authorization": f"token {github_token}", 2025-03-14T03:51:43.3203244Z  } 2025-03-14T03:51:43.3203963Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.3204696Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.3205327Z  headers=headers, 2025-03-14T03:51:43.3205852Z  ) 2025-03-14T03:51:43.3206257Z  2025-03-14T03:51:43.3206665Z  if not json_response: 2025-03-14T03:51:43.3207363Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.3208101Z  return {} 2025-03-14T03:51:43.3208581Z  2025-03-14T03:51:43.3208982Z  return json_response 2025-03-14T03:51:43.3209502Z  2025-03-14T03:51:43.3209883Z  2025-03-14T03:51:43.3210671Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.3211533Z  """ 2025-03-14T03:51:43.3212146Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.3212910Z  """ 2025-03-14T03:51:43.3213490Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.3214203Z  return { 2025-03-14T03:51:43.3214877Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.3215674Z  } 2025-03-14T03:51:43.3216079Z  2025-03-14T03:51:43.3216463Z  2025-03-14T03:51:43.3216870Z def main() -> None: 2025-03-14T03:51:43.3217387Z  args = parse_args() 2025-03-14T03:51:43.3217891Z  2025-03-14T03:51:43.3218370Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.3218990Z  2025-03-14T03:51:43.3219409Z  # Check if the PR is opt-out 2025-03-14T03:51:43.3219995Z  if args.pr_number: 2025-03-14T03:51:43.3220975Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.3221868Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.3222462Z  log.info( 2025-03-14T03:51:43.3223271Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.3224337Z  ) 2025-03-14T03:51:43.3224997Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.3225782Z  sys.exit() 2025-03-14T03:51:43.3226279Z  2025-03-14T03:51:43.3226672Z  try: 2025-03-14T03:51:43.3227196Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.3228015Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.3228759Z  ) 2025-03-14T03:51:43.3229172Z  2025-03-14T03:51:43.3229620Z  username = get_potential_pr_author( 2025-03-14T03:51:43.3230254Z  args.github_token, 2025-03-14T03:51:43.3231100Z  args.github_repo, 2025-03-14T03:51:43.3231706Z  args.github_actor, 2025-03-14T03:51:43.3232297Z  args.github_ref_type, 2025-03-14T03:51:43.3232916Z  args.github_branch, 2025-03-14T03:51:43.3233483Z  ) 2025-03-14T03:51:43.3233918Z  2025-03-14T03:51:43.3234452Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.3235153Z  2025-03-14T03:51:43.3235612Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.3236248Z  rollout_state, 2025-03-14T03:51:43.3236836Z  (args.github_issue_owner, username), 2025-03-14T03:51:43.3237480Z  args.github_branch, 2025-03-14T03:51:43.3238082Z  args.eligible_experiments, 2025-03-14T03:51:43.3238675Z  is_canary, 2025-03-14T03:51:43.3239314Z  ) 2025-03-14T03:51:43.3239748Z  2025-03-14T03:51:43.3240159Z  except Exception as e: 2025-03-14T03:51:43.3241308Z  log.error( 2025-03-14T03:51:43.3242099Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.3243001Z  ) 2025-03-14T03:51:43.3243417Z  2025-03-14T03:51:43.3243994Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.3244747Z  2025-03-14T03:51:43.3245114Z  2025-03-14T03:51:43.3245509Z if __name__ == "__main__": 2025-03-14T03:51:43.3246030Z  main() 2025-03-14T03:51:43.3246451Z  2025-03-14T03:51:43.3246825Z EOF 2025-03-14T03:51:43.3247213Z  2025-03-14T03:51:43.3247622Z cat runner_determinator.py 2025-03-14T03:51:43.3657568Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.3658492Z env: 2025-03-14T03:51:43.3659324Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.3659795Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.3660288Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.3661219Z ISSUE_OWNER: 2025-03-14T03:51:43.3661664Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.3662133Z PR_NUMBER: 2025-03-14T03:51:43.3662541Z ##[endgroup] 2025-03-14T03:51:43.3881754Z # flake8: noqa: G004 2025-03-14T03:51:43.3882115Z 2025-03-14T03:51:43.3882563Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:43.3883527Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:43.3884354Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:43.3884799Z 2025-03-14T03:51:43.3884966Z """ 2025-03-14T03:51:43.3885558Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:43.3886444Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:43.3887402Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:43.3888293Z of which runners should be used to run which job. 2025-03-14T03:51:43.3888728Z 2025-03-14T03:51:43.3889158Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:43.3890354Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:43.3891534Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:43.3892247Z list, defined. 2025-03-14T03:51:43.3892490Z 2025-03-14T03:51:43.3892861Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:43.3893820Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:43.3894663Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:43.3895119Z 2025-03-14T03:51:43.3895505Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:43.3896397Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:43.3897141Z experiments which the user could be opted in to. 2025-03-14T03:51:43.3897556Z 2025-03-14T03:51:43.3897773Z The user list has the following rules: 2025-03-14T03:51:43.3898140Z 2025-03-14T03:51:43.3898460Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:43.3899344Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:43.3900121Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:43.3900751Z 2025-03-14T03:51:43.3900957Z Example config: 2025-03-14T03:51:43.3901418Z # A list of experiments that can be opted into. 2025-03-14T03:51:43.3902101Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:43.3902740Z # Expected syntax is: 2025-03-14T03:51:43.3903390Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:43.3904534Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:43.3905171Z 2025-03-14T03:51:43.3905346Z experiments: 2025-03-14T03:51:43.3905753Z lf: 2025-03-14T03:51:43.3906151Z rollout_percent: 25 2025-03-14T03:51:43.3906627Z all_branches: false 2025-03-14T03:51:43.3907087Z default: true 2025-03-14T03:51:43.3907504Z --- 2025-03-14T03:51:43.3907719Z 2025-03-14T03:51:43.3907892Z # Opt-ins: 2025-03-14T03:51:43.3908493Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:43.3909378Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:43.3910165Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:43.3911495Z # Experiments should be from the above list. 2025-03-14T03:51:43.3911910Z 2025-03-14T03:51:43.3912099Z @User1,-lf,split_build 2025-03-14T03:51:43.3912568Z @User2,lf 2025-03-14T03:51:43.3912982Z @User3,split_build 2025-03-14T03:51:43.3913400Z """ 2025-03-14T03:51:43.3913597Z 2025-03-14T03:51:43.3913764Z import json 2025-03-14T03:51:43.3914151Z import logging 2025-03-14T03:51:43.3914554Z import os 2025-03-14T03:51:43.3914934Z import random 2025-03-14T03:51:43.3915319Z import re 2025-03-14T03:51:43.3915683Z import sys 2025-03-14T03:51:43.3916100Z from argparse import ArgumentParser 2025-03-14T03:51:43.3916640Z from collections.abc import Iterable 2025-03-14T03:51:43.3917175Z from functools import cache 2025-03-14T03:51:43.3917665Z from logging import LogRecord 2025-03-14T03:51:43.3918165Z from typing import Any, NamedTuple 2025-03-14T03:51:43.3918715Z from urllib.request import Request, urlopen 2025-03-14T03:51:43.3919105Z 2025-03-14T03:51:43.3919273Z import yaml 2025-03-14T03:51:43.3919725Z from github import Auth, Github 2025-03-14T03:51:43.3920248Z from github.Issue import Issue 2025-03-14T03:51:43.3920820Z 2025-03-14T03:51:43.3920829Z 2025-03-14T03:51:43.3921094Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:43.3921821Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:43.3922714Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:43.3923465Z 2025-03-14T03:51:43.3923709Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:43.3924306Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:43.3924832Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:43.3925408Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:43.3925795Z 2025-03-14T03:51:43.3926002Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:43.3926354Z 2025-03-14T03:51:43.3926551Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:43.3927033Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:43.3927328Z 2025-03-14T03:51:43.3927335Z 2025-03-14T03:51:43.3927539Z class Experiment(NamedTuple): 2025-03-14T03:51:43.3928044Z rollout_perc: float = ( 2025-03-14T03:51:43.3928706Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:43.3929410Z ) 2025-03-14T03:51:43.3929800Z all_branches: bool = ( 2025-03-14T03:51:43.3930622Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:43.3931341Z ) 2025-03-14T03:51:43.3931712Z default: bool = ( 2025-03-14T03:51:43.3932304Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:43.3932972Z ) 2025-03-14T03:51:43.3933178Z 2025-03-14T03:51:43.3933373Z # Add more fields as needed 2025-03-14T03:51:43.3933684Z 2025-03-14T03:51:43.3933691Z 2025-03-14T03:51:43.3933892Z class Settings(NamedTuple): 2025-03-14T03:51:43.3934355Z """ 2025-03-14T03:51:43.3934819Z Settings for the experiments that can be opted into. 2025-03-14T03:51:43.3935418Z """ 2025-03-14T03:51:43.3935628Z 2025-03-14T03:51:43.3935850Z experiments: dict[str, Experiment] = {} 2025-03-14T03:51:43.3936228Z 2025-03-14T03:51:43.3936236Z 2025-03-14T03:51:43.3936597Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:43.3937254Z """Color codes the log messages based on the log level""" 2025-03-14T03:51:43.3937700Z 2025-03-14T03:51:43.3937869Z COLORS = { 2025-03-14T03:51:43.3938288Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:43.3938816Z "ERROR": "\033[31m", # Red 2025-03-14T03:51:43.3939328Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:43.3939844Z "INFO": "\033[0m", # Reset 2025-03-14T03:51:43.3940341Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:43.3941039Z } 2025-03-14T03:51:43.3941251Z 2025-03-14T03:51:43.3941484Z def format(self, record: LogRecord) -> str: 2025-03-14T03:51:43.3942268Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:43.3943076Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:43.3943680Z return super().format(record) 2025-03-14T03:51:43.3944025Z 2025-03-14T03:51:43.3944032Z 2025-03-14T03:51:43.3944248Z handler = logging.StreamHandler() 2025-03-14T03:51:43.3944982Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:43.3945579Z 2025-03-14T03:51:43.3945835Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:43.3946450Z log.addHandler(handler) 2025-03-14T03:51:43.3946911Z log.setLevel(logging.INFO) 2025-03-14T03:51:43.3947206Z 2025-03-14T03:51:43.3947212Z 2025-03-14T03:51:43.3947478Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:43.3948057Z """ 2025-03-14T03:51:43.3948586Z Defines outputs of the github action that invokes this script 2025-03-14T03:51:43.3949241Z """ 2025-03-14T03:51:43.3949628Z if not GITHUB_OUTPUT: 2025-03-14T03:51:43.3950892Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:43.3952041Z log.warning( 2025-03-14T03:51:43.3952927Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-14T03:51:43.3953882Z ) 2025-03-14T03:51:43.3963736Z print(f"::set-output name={key}::{value}") 2025-03-14T03:51:43.3964597Z return 2025-03-14T03:51:43.3964838Z 2025-03-14T03:51:43.3965044Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:43.3965647Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:43.3966240Z f.write(f"{key}={value}\n") 2025-03-14T03:51:43.3966580Z 2025-03-14T03:51:43.3966587Z 2025-03-14T03:51:43.3966903Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:43.3967568Z return frozenset( 2025-03-14T03:51:43.3968201Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:43.3968896Z ) 2025-03-14T03:51:43.3969108Z 2025-03-14T03:51:43.3969116Z 2025-03-14T03:51:43.3969308Z def parse_args() -> Any: 2025-03-14T03:51:43.3969874Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:43.3971003Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:43.3971844Z parser.add_argument( 2025-03-14T03:51:43.3972322Z "--github-issue-repo", 2025-03-14T03:51:43.3972801Z type=str, 2025-03-14T03:51:43.3973212Z required=False, 2025-03-14T03:51:43.3973687Z default="pytorch/test-infra", 2025-03-14T03:51:43.3974242Z help="GitHub repo to get the issue", 2025-03-14T03:51:43.3974780Z ) 2025-03-14T03:51:43.3975157Z parser.add_argument( 2025-03-14T03:51:43.3975625Z "--github-repo", 2025-03-14T03:51:43.3976071Z type=str, 2025-03-14T03:51:43.3976482Z required=True, 2025-03-14T03:51:43.3976956Z help="GitHub repo where CI is running", 2025-03-14T03:51:43.3977496Z ) 2025-03-14T03:51:43.3977870Z parser.add_argument( 2025-03-14T03:51:43.3978491Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:43.3979309Z ) 2025-03-14T03:51:43.3979699Z parser.add_argument( 2025-03-14T03:51:43.3980357Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:43.3981322Z ) 2025-03-14T03:51:43.3981710Z parser.add_argument( 2025-03-14T03:51:43.3982362Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:43.3983068Z ) 2025-03-14T03:51:43.3983449Z parser.add_argument( 2025-03-14T03:51:43.3984114Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:43.3984849Z ) 2025-03-14T03:51:43.3985226Z parser.add_argument( 2025-03-14T03:51:43.3985678Z "--github-ref-type", 2025-03-14T03:51:43.3986143Z type=str, 2025-03-14T03:51:43.3986555Z required=True, 2025-03-14T03:51:43.3987055Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:43.3987617Z ) 2025-03-14T03:51:43.3987992Z parser.add_argument( 2025-03-14T03:51:43.3988474Z "--eligible-experiments", 2025-03-14T03:51:43.3989005Z type=_str_comma_separated_to_set, 2025-03-14T03:51:43.3989543Z required=False, 2025-03-14T03:51:43.3989992Z default="", 2025-03-14T03:51:43.3990999Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:43.3991952Z ) 2025-03-14T03:51:43.3992336Z parser.add_argument( 2025-03-14T03:51:43.3992783Z "--pr-number", 2025-03-14T03:51:43.3993203Z type=str, 2025-03-14T03:51:43.3993624Z required=False, 2025-03-14T03:51:43.3994058Z default="", 2025-03-14T03:51:43.3994556Z help="the optional PR number where this is run", 2025-03-14T03:51:43.3995127Z ) 2025-03-14T03:51:43.3995334Z 2025-03-14T03:51:43.3995534Z return parser.parse_args() 2025-03-14T03:51:43.3995858Z 2025-03-14T03:51:43.3995865Z 2025-03-14T03:51:43.3996282Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.3997055Z auth = Auth.Token(github_token) 2025-03-14T03:51:43.3997579Z return Github(auth=auth) 2025-03-14T03:51:43.3997885Z 2025-03-14T03:51:43.3998034Z 2025-03-14T03:51:43.3998522Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:43.3999352Z repo = gh.get_repo(repo) 2025-03-14T03:51:43.3999872Z return repo.get_issue(number=issue_num) 2025-03-14T03:51:43.4000247Z 2025-03-14T03:51:43.4000253Z 2025-03-14T03:51:43.4000560Z def get_potential_pr_author( 2025-03-14T03:51:43.4001224Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:43.4001917Z ) -> str: 2025-03-14T03:51:43.4002446Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:43.4003257Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:43.4004009Z # embedded in the tag name: ciflow// 2025-03-14T03:51:43.4004437Z 2025-03-14T03:51:43.4004638Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.4004983Z 2025-03-14T03:51:43.4005253Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:43.4005896Z split_tag = ref_name.split("/") 2025-03-14T03:51:43.4006407Z if ( 2025-03-14T03:51:43.4006808Z len(split_tag) == 3 2025-03-14T03:51:43.4007296Z and split_tag[0] == "ciflow" 2025-03-14T03:51:43.4007833Z and split_tag[2].isnumeric() 2025-03-14T03:51:43.4008339Z ): 2025-03-14T03:51:43.4008727Z pr_number = split_tag[2] 2025-03-14T03:51:43.4009223Z try: 2025-03-14T03:51:43.4009651Z repository = gh.get_repo(repo) 2025-03-14T03:51:43.4010274Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:43.4010996Z except Exception as e: 2025-03-14T03:51:43.4011538Z raise Exception( # noqa: TRY002 2025-03-14T03:51:43.4012352Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:43.4013018Z ) from e 2025-03-14T03:51:43.4013563Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:43.4014278Z # In all other cases, return the original input username 2025-03-14T03:51:43.4014887Z return username 2025-03-14T03:51:43.4015135Z 2025-03-14T03:51:43.4015142Z 2025-03-14T03:51:43.4015372Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:43.4015909Z """ 2025-03-14T03:51:43.4016558Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:43.4017343Z """ 2025-03-14T03:51:43.4018145Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:43.4018845Z 2025-03-14T03:51:43.4018852Z 2025-03-14T03:51:43.4019069Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:43.4019616Z try: 2025-03-14T03:51:43.4020021Z data = yaml.safe_load(yaml_text) 2025-03-14T03:51:43.4020655Z return data 2025-03-14T03:51:43.4021087Z except yaml.YAMLError: 2025-03-14T03:51:43.4021588Z log.exception("Error loading YAML") 2025-03-14T03:51:43.4022118Z raise 2025-03-14T03:51:43.4022337Z 2025-03-14T03:51:43.4022344Z 2025-03-14T03:51:43.4022765Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:43.4023519Z """ 2025-03-14T03:51:43.4024145Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:43.4024775Z 2025-03-14T03:51:43.4025128Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.4025895Z and the text below is the list of opted in users. 2025-03-14T03:51:43.4026312Z 2025-03-14T03:51:43.4026697Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:43.4027406Z """ 2025-03-14T03:51:43.4027862Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:43.4028473Z if len(rollout_state_parts) >= 2: 2025-03-14T03:51:43.4029080Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:43.4029847Z else: 2025-03-14T03:51:43.4030231Z return "", rollout_state 2025-03-14T03:51:43.4030682Z 2025-03-14T03:51:43.4030688Z 2025-03-14T03:51:43.4030894Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:43.4031416Z """ 2025-03-14T03:51:43.4031948Z Dictionary of users with a list of features they have opted into 2025-03-14T03:51:43.4032606Z """ 2025-03-14T03:51:43.4032806Z 2025-03-14T03:51:43.4032813Z 2025-03-14T03:51:43.4033154Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:43.4033821Z """ 2025-03-14T03:51:43.4034552Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-14T03:51:43.4035255Z 2025-03-14T03:51:43.4035898Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:43.4036905Z - Example line: "@User1,lf,split_build" 2025-03-14T03:51:43.4037598Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:43.4038091Z 2025-03-14T03:51:43.4038097Z 2025-03-14T03:51:43.4038264Z """ 2025-03-14T03:51:43.4038641Z optins = UserOptins() 2025-03-14T03:51:43.4039136Z for user in user_optin_text.split("\n"): 2025-03-14T03:51:43.4039700Z user = user.strip("\r\n\t -") 2025-03-14T03:51:43.4040256Z if not user or not user.startswith("@"): 2025-03-14T03:51:43.4040927Z # Not a valid user. Skip 2025-03-14T03:51:43.4041421Z continue 2025-03-14T03:51:43.4041678Z 2025-03-14T03:51:43.4041838Z if user: 2025-03-14T03:51:43.4042291Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:43.4043010Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:43.4043676Z 2025-03-14T03:51:43.4043871Z return optins 2025-03-14T03:51:43.4044122Z 2025-03-14T03:51:43.4044128Z 2025-03-14T03:51:43.4044429Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:43.4045042Z """ 2025-03-14T03:51:43.4045456Z Check if the experiment name is valid. 2025-03-14T03:51:43.4045996Z A valid name: 2025-03-14T03:51:43.4046645Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:43.4047603Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:43.4048331Z - Cannot contain spaces 2025-03-14T03:51:43.4048804Z """ 2025-03-14T03:51:43.4049016Z 2025-03-14T03:51:43.4049283Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:43.4050010Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:43.4050568Z 2025-03-14T03:51:43.4050742Z if valid: 2025-03-14T03:51:43.4051141Z return True 2025-03-14T03:51:43.4051392Z 2025-03-14T03:51:43.4051559Z log.error( 2025-03-14T03:51:43.4053039Z 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-03-14T03:51:43.4054633Z ) 2025-03-14T03:51:43.4054998Z return False 2025-03-14T03:51:43.4055235Z 2025-03-14T03:51:43.4055242Z 2025-03-14T03:51:43.4055552Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:43.4056186Z """ 2025-03-14T03:51:43.4056786Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:43.4057518Z """ 2025-03-14T03:51:43.4057883Z try: 2025-03-14T03:51:43.4058262Z if settings_text: 2025-03-14T03:51:43.4059002Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:43.4059818Z # for easy reading 2025-03-14T03:51:43.4060721Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:43.4061805Z # the backtick character in shell commands. 2025-03-14T03:51:43.4062424Z backtick = chr(96) # backtick character 2025-03-14T03:51:43.4063105Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:43.4063774Z settings = load_yaml(settings_text) 2025-03-14T03:51:43.4064154Z 2025-03-14T03:51:43.4064565Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:43.4065333Z experiments = {} 2025-03-14T03:51:43.4065642Z 2025-03-14T03:51:43.4066002Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:43.4066770Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:43.4067898Z # 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-03-14T03:51:43.4068954Z continue 2025-03-14T03:51:43.4069256Z 2025-03-14T03:51:43.4069440Z valid_settings = {} 2025-03-14T03:51:43.4069974Z for setting in exp_settings: 2025-03-14T03:51:43.4070654Z if setting not in Experiment._fields: 2025-03-14T03:51:43.4071226Z log.warning( 2025-03-14T03:51:43.4071945Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:43.4072672Z ) 2025-03-14T03:51:43.4073116Z else: 2025-03-14T03:51:43.4073644Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:43.4074073Z 2025-03-14T03:51:43.4074352Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:43.4075143Z return Settings(experiments) 2025-03-14T03:51:43.4075529Z 2025-03-14T03:51:43.4075707Z except Exception: 2025-03-14T03:51:43.4076195Z log.exception("Failed to parse settings") 2025-03-14T03:51:43.4076619Z 2025-03-14T03:51:43.4076798Z return Settings() 2025-03-14T03:51:43.4077071Z 2025-03-14T03:51:43.4077078Z 2025-03-14T03:51:43.4077332Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:43.4077911Z """ 2025-03-14T03:51:43.4078350Z Parse settings, if any, from the rollout state. 2025-03-14T03:51:43.4078763Z 2025-03-14T03:51:43.4079116Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:43.4080145Z and the text below is the list of opted in users. 2025-03-14T03:51:43.4080703Z 2025-03-14T03:51:43.4081156Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:43.4081913Z """ 2025-03-14T03:51:43.4082492Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.4083279Z return parse_settings_from_text(settings_text) 2025-03-14T03:51:43.4083688Z 2025-03-14T03:51:43.4083694Z 2025-03-14T03:51:43.4083944Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:43.4084523Z """ 2025-03-14T03:51:43.4084921Z Parse users from the rollout state. 2025-03-14T03:51:43.4085285Z 2025-03-14T03:51:43.4085452Z """ 2025-03-14T03:51:43.4085990Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:43.4086734Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:43.4087141Z 2025-03-14T03:51:43.4087147Z 2025-03-14T03:51:43.4087566Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.4088325Z """ 2025-03-14T03:51:43.4088753Z Check if a user is opted into an experiment 2025-03-14T03:51:43.4089298Z """ 2025-03-14T03:51:43.4089754Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:43.4090181Z 2025-03-14T03:51:43.4090187Z 2025-03-14T03:51:43.4090712Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:43.4091483Z """ 2025-03-14T03:51:43.4092113Z Check if a user explicitly opted out of an experiment 2025-03-14T03:51:43.4092703Z """ 2025-03-14T03:51:43.4093205Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:43.4093905Z experiment_optout = "-" + experiment_name 2025-03-14T03:51:43.4094555Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:43.4095164Z return False 2025-03-14T03:51:43.4095420Z 2025-03-14T03:51:43.4095693Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:43.4096302Z log.warning( 2025-03-14T03:51:43.4097114Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:43.4097998Z ) 2025-03-14T03:51:43.4098215Z 2025-03-14T03:51:43.4098382Z return True 2025-03-14T03:51:43.4098621Z 2025-03-14T03:51:43.4098629Z 2025-03-14T03:51:43.4098808Z def get_runner_prefix( 2025-03-14T03:51:43.4099253Z rollout_state: str, 2025-03-14T03:51:43.4099725Z workflow_requestors: Iterable[str], 2025-03-14T03:51:43.4100242Z branch: str, 2025-03-14T03:51:43.4100849Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:43.4101459Z is_canary: bool = False, 2025-03-14T03:51:43.4101923Z ) -> str: 2025-03-14T03:51:43.4102347Z settings = parse_settings(rollout_state) 2025-03-14T03:51:43.4102930Z user_optins = parse_users(rollout_state) 2025-03-14T03:51:43.4103313Z 2025-03-14T03:51:43.4103491Z fleet_prefix = "" 2025-03-14T03:51:43.4103925Z prefixes = [] 2025-03-14T03:51:43.4104560Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:43.4105514Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:43.4106362Z log.info( 2025-03-14T03:51:43.4107056Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:43.4107819Z ) 2025-03-14T03:51:43.4108209Z continue 2025-03-14T03:51:43.4108457Z 2025-03-14T03:51:43.4108655Z if eligible_experiments: 2025-03-14T03:51:43.4109214Z if experiment_name not in eligible_experiments: 2025-03-14T03:51:43.4109851Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:43.4110509Z log.info( 2025-03-14T03:51:43.4111310Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:43.4112163Z ) 2025-03-14T03:51:43.4112569Z continue 2025-03-14T03:51:43.4113043Z elif not experiment_settings.default: 2025-03-14T03:51:43.4113582Z log.info( 2025-03-14T03:51:43.4114262Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:43.4115021Z ) 2025-03-14T03:51:43.4115408Z continue 2025-03-14T03:51:43.4115660Z 2025-03-14T03:51:43.4115950Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:43.4116583Z opted_out_users = [ 2025-03-14T03:51:43.4117040Z requestor 2025-03-14T03:51:43.4117498Z for requestor in workflow_requestors 2025-03-14T03:51:43.4118180Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.4118820Z ] 2025-03-14T03:51:43.4119030Z 2025-03-14T03:51:43.4119211Z if opted_out_users: 2025-03-14T03:51:43.4119723Z log.info( 2025-03-14T03:51:43.4120351Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:43.4121154Z ) 2025-03-14T03:51:43.4121540Z continue 2025-03-14T03:51:43.4121786Z 2025-03-14T03:51:43.4122067Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:43.4122690Z opted_in_users = [ 2025-03-14T03:51:43.4123139Z requestor 2025-03-14T03:51:43.4123596Z for requestor in workflow_requestors 2025-03-14T03:51:43.4124414Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:43.4125048Z ] 2025-03-14T03:51:43.4125265Z 2025-03-14T03:51:43.4125439Z enabled = False 2025-03-14T03:51:43.4125887Z if opted_in_users: 2025-03-14T03:51:43.4126338Z log.info( 2025-03-14T03:51:43.4126952Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:43.4127638Z ) 2025-03-14T03:51:43.4128030Z enabled = True 2025-03-14T03:51:43.4128328Z 2025-03-14T03:51:43.4128549Z elif experiment_settings.rollout_perc: 2025-03-14T03:51:43.4129401Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:43.4130340Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:43.4131110Z log.info( 2025-03-14T03:51:43.4131996Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:43.4132943Z ) 2025-03-14T03:51:43.4133357Z enabled = True 2025-03-14T03:51:43.4133659Z 2025-03-14T03:51:43.4133834Z if enabled: 2025-03-14T03:51:43.4134264Z label = experiment_name 2025-03-14T03:51:43.4134816Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:43.4135653Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:43.4136539Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:43.4137429Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:43.4138117Z if is_canary: 2025-03-14T03:51:43.4138618Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:43.4139166Z fleet_prefix = label 2025-03-14T03:51:43.4139341Z else: 2025-03-14T03:51:43.4139545Z prefixes.append(label) 2025-03-14T03:51:43.4139554Z 2025-03-14T03:51:43.4139745Z if len(prefixes) > 1: 2025-03-14T03:51:43.4139914Z log.error( 2025-03-14T03:51:43.4140826Z 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-03-14T03:51:43.4140999Z ) 2025-03-14T03:51:43.4141188Z prefixes = prefixes[:1] 2025-03-14T03:51:43.4141196Z 2025-03-14T03:51:43.4141397Z # Fleet always comes first 2025-03-14T03:51:43.4141574Z if fleet_prefix: 2025-03-14T03:51:43.4141784Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:43.4141792Z 2025-03-14T03:51:43.4142059Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:43.4142068Z 2025-03-14T03:51:43.4142074Z 2025-03-14T03:51:43.4142533Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:43.4142695Z """ 2025-03-14T03:51:43.4143093Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:43.4143101Z 2025-03-14T03:51:43.4143491Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:43.4143655Z """ 2025-03-14T03:51:43.4143855Z gh = get_gh_client(github_token) 2025-03-14T03:51:43.4144071Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:43.4144363Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:43.4144371Z 2025-03-14T03:51:43.4144378Z 2025-03-14T03:51:43.4144777Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:43.4144975Z for _ in range(num_retries): 2025-03-14T03:51:43.4145143Z try: 2025-03-14T03:51:43.4145363Z req = Request(url=url, headers=headers) 2025-03-14T03:51:43.4145658Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:43.4145990Z return json.loads(content) 2025-03-14T03:51:43.4146187Z except Exception as e: 2025-03-14T03:51:43.4146428Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:43.4146436Z 2025-03-14T03:51:43.4146820Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:43.4146992Z return {} 2025-03-14T03:51:43.4147000Z 2025-03-14T03:51:43.4147007Z 2025-03-14T03:51:43.4147167Z @cache 2025-03-14T03:51:43.4147600Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:43.4147766Z """ 2025-03-14T03:51:43.4147969Z Dynamically get PR information 2025-03-14T03:51:43.4148131Z """ 2025-03-14T03:51:43.4148435Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:43.4148611Z headers = { 2025-03-14T03:51:43.4148836Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:43.4149054Z "Authorization": f"token {github_token}", 2025-03-14T03:51:43.4149219Z } 2025-03-14T03:51:43.4149455Z json_response: dict[str, Any] = download_json( 2025-03-14T03:51:43.4149670Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:43.4149853Z headers=headers, 2025-03-14T03:51:43.4150019Z ) 2025-03-14T03:51:43.4150027Z 2025-03-14T03:51:43.4150211Z if not json_response: 2025-03-14T03:51:43.4150609Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:43.4150784Z return {} 2025-03-14T03:51:43.4150793Z 2025-03-14T03:51:43.4150970Z return json_response 2025-03-14T03:51:43.4150984Z 2025-03-14T03:51:43.4150991Z 2025-03-14T03:51:43.4151393Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:43.4151678Z """ 2025-03-14T03:51:43.4152030Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:43.4152195Z """ 2025-03-14T03:51:43.4152490Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:43.4152664Z return { 2025-03-14T03:51:43.4153032Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:43.4153201Z } 2025-03-14T03:51:43.4153208Z 2025-03-14T03:51:43.4153216Z 2025-03-14T03:51:43.4153395Z def main() -> None: 2025-03-14T03:51:43.4153580Z args = parse_args() 2025-03-14T03:51:43.4153589Z 2025-03-14T03:51:43.4153810Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:43.4153817Z 2025-03-14T03:51:43.4154016Z # Check if the PR is opt-out 2025-03-14T03:51:43.4154197Z if args.pr_number: 2025-03-14T03:51:43.4154601Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:43.4154801Z if OPT_OUT_LABEL in labels: 2025-03-14T03:51:43.4154972Z log.info( 2025-03-14T03:51:43.4155425Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:43.4155591Z ) 2025-03-14T03:51:43.4155933Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.4156108Z sys.exit() 2025-03-14T03:51:43.4156115Z 2025-03-14T03:51:43.4156284Z try: 2025-03-14T03:51:43.4156521Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:43.4156830Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:43.4156999Z ) 2025-03-14T03:51:43.4157007Z 2025-03-14T03:51:43.4157216Z username = get_potential_pr_author( 2025-03-14T03:51:43.4157408Z args.github_token, 2025-03-14T03:51:43.4157595Z args.github_repo, 2025-03-14T03:51:43.4157783Z args.github_actor, 2025-03-14T03:51:43.4157979Z args.github_ref_type, 2025-03-14T03:51:43.4158169Z args.github_branch, 2025-03-14T03:51:43.4158337Z ) 2025-03-14T03:51:43.4158345Z 2025-03-14T03:51:43.4158622Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:43.4158773Z 2025-03-14T03:51:43.4159004Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:43.4159185Z rollout_state, 2025-03-14T03:51:43.4159394Z (args.github_issue_owner, username), 2025-03-14T03:51:43.4159583Z args.github_branch, 2025-03-14T03:51:43.4159780Z args.eligible_experiments, 2025-03-14T03:51:43.4159959Z is_canary, 2025-03-14T03:51:43.4160123Z ) 2025-03-14T03:51:43.4160131Z 2025-03-14T03:51:43.4160325Z except Exception as e: 2025-03-14T03:51:43.4160592Z log.error( 2025-03-14T03:51:43.4161035Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:43.4161206Z ) 2025-03-14T03:51:43.4161214Z 2025-03-14T03:51:43.4161558Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:43.4161566Z 2025-03-14T03:51:43.4161573Z 2025-03-14T03:51:43.4161756Z if __name__ == "__main__": 2025-03-14T03:51:43.4161928Z main() 2025-03-14T03:51:43.4161936Z 2025-03-14T03:51:43.4249788Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.4250187Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:43.4296357Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:43.4296526Z env: 2025-03-14T03:51:43.4296989Z GITHUB_TOKEN: *** 2025-03-14T03:51:43.4297175Z ISSUE_NUMBER: 5132 2025-03-14T03:51:43.4297378Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:43.4297554Z ISSUE_OWNER: 2025-03-14T03:51:43.4297732Z CHECK_EXPERIMENTS: 2025-03-14T03:51:43.4297907Z PR_NUMBER: 2025-03-14T03:51:43.4298078Z ##[endgroup] 2025-03-14T03:51:43.7808714Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:51:44.1609876Z Collecting urllib3==1.26.18 2025-03-14T03:51:44.1982104Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:51:44.2211769Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-03-14T03:51:44.2451871Z Collecting PyGithub==2.3.0 2025-03-14T03:51:44.2485939Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:51:44.2917615Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:51:44.2953174Z 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-03-14T03:51:44.2997378Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-14T03:51:44.3016871Z 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-03-14T03:51:44.3033545Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-14T03:51:44.3310314Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:51:44.3322065Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:51:44.3551946Z 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-03-14T03:51:44.4678169Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:44.4715992Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:51:44.5913748Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:51:44.5952647Z 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-03-14T03:51:44.6141454Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:44.6176111Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:51:44.6408150Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:51:44.6475696Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.8 MB/s eta 0:00:00 2025-03-14T03:51:44.6509794Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:51:44.6575656Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 70.7 MB/s eta 0:00:00 2025-03-14T03:51:44.6630071Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-03-14T03:51:44.6715690Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 123.3 MB/s eta 0:00:00 2025-03-14T03:51:44.6753653Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:51:44.6810371Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:51:44.6875870Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 94.9 MB/s eta 0:00:00 2025-03-14T03:51:44.6910075Z 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-03-14T03:51:44.6950908Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 30.5 MB/s eta 0:00:00 2025-03-14T03:51:44.6982383Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:51:44.7031362Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 33.9 MB/s eta 0:00:00 2025-03-14T03:51:45.0062945Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:51:45.5375967Z 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-03-14T03:51:45.6137569Z ##[group]Run curr_branch="main" 2025-03-14T03:51:45.6137962Z curr_branch="main" 2025-03-14T03:51:45.6138247Z curr_ref_type="branch" 2025-03-14T03:51:45.6138563Z echo "Current branch is '$curr_branch'" 2025-03-14T03:51:45.6138890Z  2025-03-14T03:51:45.6139141Z python3 runner_determinator.py \ 2025-03-14T03:51:45.6139491Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:51:45.6139829Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:51:45.6140193Z  --github-branch "$curr_branch" \ 2025-03-14T03:51:45.6140775Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:51:45.6141129Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:51:45.6141472Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:51:45.6141821Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:51:45.6142232Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:51:45.6142635Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:51:45.6190987Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:45.6191269Z env: 2025-03-14T03:51:45.6191940Z GITHUB_TOKEN: *** 2025-03-14T03:51:45.6192238Z ISSUE_NUMBER: 5132 2025-03-14T03:51:45.6192506Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:45.6192808Z ISSUE_OWNER: 2025-03-14T03:51:45.6193048Z CHECK_EXPERIMENTS: 2025-03-14T03:51:45.6193294Z PR_NUMBER: 2025-03-14T03:51:45.6193530Z ##[endgroup] 2025-03-14T03:51:45.6259611Z Current branch is 'main' 2025-03-14T03:51:47.3736409Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:51:47.3737729Z INFO : Setting output: label-type='' 2025-03-14T03:51:47.4043664Z Evaluate and set job outputs 2025-03-14T03:51:47.4050777Z Cleaning up orphan processes