2025-01-24T00:45:45.1737935Z Current runner version: '2.321.0' 2025-01-24T00:45:45.1762877Z ##[group]Operating System 2025-01-24T00:45:45.1763759Z Ubuntu 2025-01-24T00:45:45.1764269Z 24.04.1 2025-01-24T00:45:45.1764731Z LTS 2025-01-24T00:45:45.1765520Z ##[endgroup] 2025-01-24T00:45:45.1766108Z ##[group]Runner Image 2025-01-24T00:45:45.1766632Z Image: ubuntu-24.04 2025-01-24T00:45:45.1767243Z Version: 20250120.5.0 2025-01-24T00:45:45.1768299Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250120.5/images/ubuntu/Ubuntu2404-Readme.md 2025-01-24T00:45:45.1769631Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250120.5 2025-01-24T00:45:45.1770610Z ##[endgroup] 2025-01-24T00:45:45.1771148Z ##[group]Runner Image Provisioner 2025-01-24T00:45:45.1771686Z 2.0.417.1 2025-01-24T00:45:45.1772223Z ##[endgroup] 2025-01-24T00:45:45.1773295Z ##[group]GITHUB_TOKEN Permissions 2025-01-24T00:45:45.1775110Z Contents: read 2025-01-24T00:45:45.1775941Z Metadata: read 2025-01-24T00:45:45.1776698Z Packages: read 2025-01-24T00:45:45.1777285Z ##[endgroup] 2025-01-24T00:45:45.1780464Z Secret source: Actions 2025-01-24T00:45:45.1781489Z Prepare workflow directory 2025-01-24T00:45:45.2278315Z Prepare all required actions 2025-01-24T00:45:45.2334058Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (b2c89bc115123aea8e075e882ee121537ec92f89) 2025-01-24T00:45:45.2339704Z ##[group] Inputs 2025-01-24T00:45:45.2340313Z check_experiments: 2025-01-24T00:45:45.2341030Z triggering_actor: pytorch-bot[bot] 2025-01-24T00:45:45.2341627Z issue_owner: 2025-01-24T00:45:45.2342156Z curr_branch: ciflow/trunk/145539 2025-01-24T00:45:45.2342860Z curr_ref_type: tag 2025-01-24T00:45:45.2343351Z issue_number: 5132 2025-01-24T00:45:45.2343866Z ##[endgroup] 2025-01-24T00:45:45.2344556Z Complete job name: get-label-type / runner-determinator 2025-01-24T00:45:45.3088785Z ##[group]Run cat < runner_determinator.py 2025-01-24T00:45:45.3090669Z cat < runner_determinator.py 2025-01-24T00:45:45.3091262Z # flake8: noqa: G004 2025-01-24T00:45:45.3091711Z  2025-01-24T00:45:45.3092361Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:45.3093326Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:45.3094184Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:45.3094818Z  2025-01-24T00:45:45.3095164Z """ 2025-01-24T00:45:45.3096126Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:45.3097051Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:45.3098033Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:45.3098883Z of which runners should be used to run which job. 2025-01-24T00:45:45.3099464Z  2025-01-24T00:45:45.3100078Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:45.3100993Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:45.3101902Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:45.3102610Z list, defined. 2025-01-24T00:45:45.3103014Z  2025-01-24T00:45:45.3103585Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:45.3104650Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:45.3105808Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:45.3106624Z  2025-01-24T00:45:45.3107575Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:45.3109131Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:45.3110849Z experiments which the user could be opted in to. 2025-01-24T00:45:45.3111731Z  2025-01-24T00:45:45.3112310Z The user list has the following rules: 2025-01-24T00:45:45.3113063Z  2025-01-24T00:45:45.3113823Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:45.3115169Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:45.3116662Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:45.3117278Z  2025-01-24T00:45:45.3117679Z Example config: 2025-01-24T00:45:45.3118202Z  # A list of experiments that can be opted into. 2025-01-24T00:45:45.3118924Z  # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:45.3119580Z  # Expected syntax is: 2025-01-24T00:45:45.3120273Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:45.3121295Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:45.3122085Z  2025-01-24T00:45:45.3122437Z  experiments: 2025-01-24T00:45:45.3122881Z  lf: 2025-01-24T00:45:45.3123285Z  rollout_percent: 25 2025-01-24T00:45:45.3123780Z  all_branches: false 2025-01-24T00:45:45.3124269Z  default: true 2025-01-24T00:45:45.3124784Z  --- 2025-01-24T00:45:45.3125637Z  2025-01-24T00:45:45.3126250Z  # Opt-ins: 2025-01-24T00:45:45.3127385Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:45.3128935Z  # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:45.3129776Z  # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:45.3130628Z  # Experiments should be from the above list. 2025-01-24T00:45:45.3131191Z  2025-01-24T00:45:45.3131570Z  @User1,-lf,split_build 2025-01-24T00:45:45.3132058Z  @User2,lf 2025-01-24T00:45:45.3132490Z  @User3,split_build 2025-01-24T00:45:45.3132938Z """ 2025-01-24T00:45:45.3133300Z  2025-01-24T00:45:45.3133655Z import json 2025-01-24T00:45:45.3134067Z import logging 2025-01-24T00:45:45.3134493Z import os 2025-01-24T00:45:45.3134888Z import random 2025-01-24T00:45:45.3135479Z import re 2025-01-24T00:45:45.3135885Z import sys 2025-01-24T00:45:45.3136400Z from argparse import ArgumentParser 2025-01-24T00:45:45.3136956Z from functools import lru_cache 2025-01-24T00:45:45.3137483Z from logging import LogRecord 2025-01-24T00:45:45.3138239Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:45.3139061Z from urllib.request import Request, urlopen 2025-01-24T00:45:45.3139612Z  2025-01-24T00:45:45.3139973Z import yaml 2025-01-24T00:45:45.3140402Z from github import Auth, Github 2025-01-24T00:45:45.3140934Z from github.Issue import Issue 2025-01-24T00:45:45.3141425Z  2025-01-24T00:45:45.3141770Z  2025-01-24T00:45:45.3142202Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:45.3142952Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:45.3143843Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:45.3144567Z  2025-01-24T00:45:45.3145014Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:45.3145861Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:45.3146433Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:45.3147238Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:45.3147771Z  2025-01-24T00:45:45.3148191Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:45.3148703Z  2025-01-24T00:45:45.3149077Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:45.3149577Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:45.3150068Z  2025-01-24T00:45:45.3150411Z  2025-01-24T00:45:45.3150804Z class Experiment(NamedTuple): 2025-01-24T00:45:45.3151328Z  rollout_perc: float = ( 2025-01-24T00:45:45.3152024Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:45.3152704Z  ) 2025-01-24T00:45:45.3153095Z  all_branches: bool = ( 2025-01-24T00:45:45.3153784Z  False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:45.3154465Z  ) 2025-01-24T00:45:45.3154854Z  default: bool = ( 2025-01-24T00:45:45.3155659Z  True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:45.3156315Z  ) 2025-01-24T00:45:45.3156680Z  2025-01-24T00:45:45.3157056Z  # Add more fields as needed 2025-01-24T00:45:45.3157539Z  2025-01-24T00:45:45.3157904Z  2025-01-24T00:45:45.3158274Z class Settings(NamedTuple): 2025-01-24T00:45:45.3158755Z  """ 2025-01-24T00:45:45.3159253Z  Settings for the experiments that can be opted into. 2025-01-24T00:45:45.3159847Z  """ 2025-01-24T00:45:45.3160216Z  2025-01-24T00:45:45.3160633Z  experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:45.3161159Z  2025-01-24T00:45:45.3161573Z  2025-01-24T00:45:45.3162141Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:45.3162819Z  """Color codes the log messages based on the log level""" 2025-01-24T00:45:45.3163436Z  2025-01-24T00:45:45.3163790Z  COLORS = { 2025-01-24T00:45:45.3164236Z  "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:45.3164773Z  "ERROR": "\033[31m", # Red 2025-01-24T00:45:45.3165477Z  "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:45.3166040Z  "INFO": "\033[0m", # Reset 2025-01-24T00:45:45.3166571Z  "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:45.3167063Z  } 2025-01-24T00:45:45.3167423Z  2025-01-24T00:45:45.3167864Z  def format(self, record: LogRecord) -> str: 2025-01-24T00:45:45.3168782Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:45.3169820Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:45.3170536Z  return super().format(record) 2025-01-24T00:45:45.3171046Z  2025-01-24T00:45:45.3171397Z  2025-01-24T00:45:45.3171803Z handler = logging.StreamHandler() 2025-01-24T00:45:45.3172582Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:45.3173326Z  2025-01-24T00:45:45.3173803Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:45.3174429Z log.addHandler(handler) 2025-01-24T00:45:45.3174917Z log.setLevel(logging.INFO) 2025-01-24T00:45:45.3175644Z  2025-01-24T00:45:45.3176005Z  2025-01-24T00:45:45.3176481Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:45.3177079Z  """ 2025-01-24T00:45:45.3177633Z  Defines outputs of the github action that invokes this script 2025-01-24T00:45:45.3178275Z  """ 2025-01-24T00:45:45.3178673Z  if not GITHUB_OUTPUT: 2025-01-24T00:45:45.3179877Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:45.3181164Z  log.warning( 2025-01-24T00:45:45.3182057Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:45:45.3182994Z  ) 2025-01-24T00:45:45.3183465Z  print(f"::set-output name={key}::{value}") 2025-01-24T00:45:45.3184024Z  return 2025-01-24T00:45:45.3184437Z  2025-01-24T00:45:45.3184836Z  with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:45.3185646Z  log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:45.3186302Z  f.write(f"{key}={value}\n") 2025-01-24T00:45:45.3186844Z  2025-01-24T00:45:45.3187353Z  2025-01-24T00:45:45.3187885Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:45.3188556Z  return frozenset( 2025-01-24T00:45:45.3189549Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:45.3190667Z  ) 2025-01-24T00:45:45.3191271Z  2025-01-24T00:45:45.3191822Z  2025-01-24T00:45:45.3192411Z def parse_args() -> Any: 2025-01-24T00:45:45.3193463Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:45.3194781Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:45.3195849Z  parser.add_argument( 2025-01-24T00:45:45.3196356Z  "--github-issue-repo", 2025-01-24T00:45:45.3196869Z  type=str, 2025-01-24T00:45:45.3197320Z  required=False, 2025-01-24T00:45:45.3198009Z  default="pytorch/test-infra", 2025-01-24T00:45:45.3198610Z  help="GitHub repo to get the issue", 2025-01-24T00:45:45.3199139Z  ) 2025-01-24T00:45:45.3199537Z  parser.add_argument( 2025-01-24T00:45:45.3200025Z  "--github-repo", 2025-01-24T00:45:45.3200501Z  type=str, 2025-01-24T00:45:45.3200937Z  required=True, 2025-01-24T00:45:45.3201455Z  help="GitHub repo where CI is running", 2025-01-24T00:45:45.3201993Z  ) 2025-01-24T00:45:45.3202383Z  parser.add_argument( 2025-01-24T00:45:45.3203053Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:45.3203774Z  ) 2025-01-24T00:45:45.3204164Z  parser.add_argument( 2025-01-24T00:45:45.3204855Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:45.3205810Z  ) 2025-01-24T00:45:45.3206211Z  parser.add_argument( 2025-01-24T00:45:45.3206915Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:45.3207627Z  ) 2025-01-24T00:45:45.3208056Z  parser.add_argument( 2025-01-24T00:45:45.3208772Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:45.3209502Z  ) 2025-01-24T00:45:45.3209885Z  parser.add_argument( 2025-01-24T00:45:45.3210648Z  "--github-ref-type", 2025-01-24T00:45:45.3211512Z  type=str, 2025-01-24T00:45:45.3212328Z  required=True, 2025-01-24T00:45:45.3213322Z  help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:45.3214156Z  ) 2025-01-24T00:45:45.3214553Z  parser.add_argument( 2025-01-24T00:45:45.3215069Z  "--eligible-experiments", 2025-01-24T00:45:45.3215913Z  type=_str_comma_separated_to_set, 2025-01-24T00:45:45.3216468Z  required=False, 2025-01-24T00:45:45.3216939Z  default="", 2025-01-24T00:45:45.3218035Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:45.3218971Z  ) 2025-01-24T00:45:45.3219369Z  parser.add_argument( 2025-01-24T00:45:45.3219869Z  "--pr-number", 2025-01-24T00:45:45.3220327Z  type=str, 2025-01-24T00:45:45.3220768Z  required=False, 2025-01-24T00:45:45.3221231Z  default="", 2025-01-24T00:45:45.3221761Z  help="the optional PR number where this is run", 2025-01-24T00:45:45.3222337Z  ) 2025-01-24T00:45:45.3222702Z  2025-01-24T00:45:45.3223088Z  return parser.parse_args() 2025-01-24T00:45:45.3223678Z  2025-01-24T00:45:45.3224277Z  2025-01-24T00:45:45.3225023Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:45.3226264Z  auth = Auth.Token(github_token) 2025-01-24T00:45:45.3227171Z  return Github(auth=auth) 2025-01-24T00:45:45.3227666Z  2025-01-24T00:45:45.3228006Z  2025-01-24T00:45:45.3228516Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:45.3229187Z  repo = gh.get_repo(repo) 2025-01-24T00:45:45.3229734Z  return repo.get_issue(number=issue_num) 2025-01-24T00:45:45.3230264Z  2025-01-24T00:45:45.3230618Z  2025-01-24T00:45:45.3230991Z def get_potential_pr_author( 2025-01-24T00:45:45.3231676Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:45.3232362Z ) -> str: 2025-01-24T00:45:45.3232918Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:45.3233906Z  # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:45.3234698Z  # embedded in the tag name: ciflow// 2025-01-24T00:45:45.3235467Z  2025-01-24T00:45:45.3235870Z  gh = get_gh_client(github_token) 2025-01-24T00:45:45.3236386Z  2025-01-24T00:45:45.3236871Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:45.3237529Z  split_tag = ref_name.split("/") 2025-01-24T00:45:45.3238054Z  if ( 2025-01-24T00:45:45.3238473Z  len(split_tag) == 3 2025-01-24T00:45:45.3238995Z  and split_tag[0] == "ciflow" 2025-01-24T00:45:45.3239550Z  and split_tag[2].isnumeric() 2025-01-24T00:45:45.3240062Z  ): 2025-01-24T00:45:45.3240482Z  pr_number = split_tag[2] 2025-01-24T00:45:45.3240987Z  try: 2025-01-24T00:45:45.3241468Z  repository = gh.get_repo(repo) 2025-01-24T00:45:45.3242106Z  pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:45.3242748Z  except Exception as e: 2025-01-24T00:45:45.3243306Z  raise Exception( # noqa: TRY002 2025-01-24T00:45:45.3244012Z  f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:45.3244671Z  ) from e 2025-01-24T00:45:45.3245161Z  return pull.user.login 2025-01-24T00:45:45.3245983Z  # In all other cases, return the original input username 2025-01-24T00:45:45.3246587Z  return username 2025-01-24T00:45:45.3247024Z  2025-01-24T00:45:45.3247363Z  2025-01-24T00:45:45.3247786Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:45.3248334Z  """ 2025-01-24T00:45:45.3249021Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:45.3249808Z  """ 2025-01-24T00:45:45.3250530Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:45.3251212Z  2025-01-24T00:45:45.3251551Z  2025-01-24T00:45:45.3251943Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:45.3252457Z  try: 2025-01-24T00:45:45.3252880Z  data = yaml.safe_load(yaml_text) 2025-01-24T00:45:45.3253400Z  return data 2025-01-24T00:45:45.3253857Z  except yaml.YAMLError: 2025-01-24T00:45:45.3254379Z  log.exception("Error loading YAML") 2025-01-24T00:45:45.3254906Z  raise 2025-01-24T00:45:45.3255505Z  2025-01-24T00:45:45.3255861Z  2025-01-24T00:45:45.3256489Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:45.3257246Z  """ 2025-01-24T00:45:45.3257896Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:45.3258654Z  2025-01-24T00:45:45.3259206Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:45.3259971Z  and the text below is the list of opted in users. 2025-01-24T00:45:45.3260528Z  2025-01-24T00:45:45.3261098Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:45.3261805Z  """ 2025-01-24T00:45:45.3262282Z  rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:45.3262900Z  if len(rollout_state_parts) >= 2: 2025-01-24T00:45:45.3263529Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:45.3264128Z  else: 2025-01-24T00:45:45.3264683Z  return "", rollout_state 2025-01-24T00:45:45.3265164Z  2025-01-24T00:45:45.3265700Z  2025-01-24T00:45:45.3266106Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:45.3266635Z  """ 2025-01-24T00:45:45.3267197Z  Dictionary of users with a list of features they have opted into 2025-01-24T00:45:45.3267850Z  """ 2025-01-24T00:45:45.3268206Z  2025-01-24T00:45:45.3268542Z  2025-01-24T00:45:45.3269078Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:45.3269733Z  """ 2025-01-24T00:45:45.3270469Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:45:45.3271314Z  2025-01-24T00:45:45.3272115Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:45.3273113Z  - Example line: "@User1,lf,split_build" 2025-01-24T00:45:45.3273808Z  - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:45.3274452Z  2025-01-24T00:45:45.3274786Z  2025-01-24T00:45:45.3275124Z  """ 2025-01-24T00:45:45.3275702Z  optins = UserOptins() 2025-01-24T00:45:45.3276230Z  for user in user_optin_text.split("\n"): 2025-01-24T00:45:45.3276805Z  user = user.strip("\r\n\t -") 2025-01-24T00:45:45.3277386Z  if not user or not user.startswith("@"): 2025-01-24T00:45:45.3277942Z  # Not a valid user. Skip 2025-01-24T00:45:45.3278445Z  continue 2025-01-24T00:45:45.3278868Z  2025-01-24T00:45:45.3279205Z  if user: 2025-01-24T00:45:45.3279681Z  usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:45.3280402Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:45.3281046Z  2025-01-24T00:45:45.3281397Z  return optins 2025-01-24T00:45:45.3281958Z  2025-01-24T00:45:45.3282287Z  2025-01-24T00:45:45.3282792Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:45.3283411Z  """ 2025-01-24T00:45:45.3283843Z  Check if the experiment name is valid. 2025-01-24T00:45:45.3284386Z  A valid name: 2025-01-24T00:45:45.3285516Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:45.3287047Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:45.3288284Z  - Cannot contain spaces 2025-01-24T00:45:45.3289188Z  """ 2025-01-24T00:45:45.3289659Z  2025-01-24T00:45:45.3290142Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:45.3290881Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:45.3291484Z  2025-01-24T00:45:45.3291840Z  if valid: 2025-01-24T00:45:45.3292254Z  return True 2025-01-24T00:45:45.3292674Z  2025-01-24T00:45:45.3293023Z  log.error( 2025-01-24T00:45:45.3294472Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-01-24T00:45:45.3296288Z  ) 2025-01-24T00:45:45.3296662Z  return False 2025-01-24T00:45:45.3297070Z  2025-01-24T00:45:45.3297412Z  2025-01-24T00:45:45.3297926Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:45.3298568Z  """ 2025-01-24T00:45:45.3299357Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:45.3300088Z  """ 2025-01-24T00:45:45.3300459Z  try: 2025-01-24T00:45:45.3300853Z  if settings_text: 2025-01-24T00:45:45.3301617Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:45.3302419Z  # for easy reading 2025-01-24T00:45:45.3303263Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:45.3304166Z  # the backtick character in shell commands. 2025-01-24T00:45:45.3304793Z  backtick = chr(96) # backtick character 2025-01-24T00:45:45.3305680Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:45.3306370Z  settings = load_yaml(settings_text) 2025-01-24T00:45:45.3306880Z  2025-01-24T00:45:45.3307488Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:45.3308238Z  experiments = {} 2025-01-24T00:45:45.3308703Z  2025-01-24T00:45:45.3309264Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:45.3310034Z  if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:45.3311137Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-01-24T00:45:45.3312169Z  continue 2025-01-24T00:45:45.3312631Z  2025-01-24T00:45:45.3312997Z  valid_settings = {} 2025-01-24T00:45:45.3313540Z  for setting in exp_settings: 2025-01-24T00:45:45.3314135Z  if setting not in Experiment._fields: 2025-01-24T00:45:45.3314708Z  log.warning( 2025-01-24T00:45:45.3315686Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:45.3316603Z  ) 2025-01-24T00:45:45.3317067Z  else: 2025-01-24T00:45:45.3317613Z  valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:45.3318179Z  2025-01-24T00:45:45.3318655Z  experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:45.3319298Z  return Settings(experiments) 2025-01-24T00:45:45.3319809Z  2025-01-24T00:45:45.3320167Z  except Exception: 2025-01-24T00:45:45.3320686Z  log.exception("Failed to parse settings") 2025-01-24T00:45:45.3321221Z  2025-01-24T00:45:45.3321572Z  return Settings() 2025-01-24T00:45:45.3322004Z  2025-01-24T00:45:45.3322341Z  2025-01-24T00:45:45.3322802Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:45.3323380Z  """ 2025-01-24T00:45:45.3323851Z  Parse settings, if any, from the rollout state. 2025-01-24T00:45:45.3324409Z  2025-01-24T00:45:45.3324950Z  If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:45.3325831Z  and the text below is the list of opted in users. 2025-01-24T00:45:45.3326396Z  2025-01-24T00:45:45.3327028Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:45.3327764Z  """ 2025-01-24T00:45:45.3328348Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:45.3329129Z  return parse_settings_from_text(settings_text) 2025-01-24T00:45:45.3329690Z  2025-01-24T00:45:45.3330146Z  2025-01-24T00:45:45.3330601Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:45.3331176Z  """ 2025-01-24T00:45:45.3331602Z  Parse users from the rollout state. 2025-01-24T00:45:45.3332107Z  2025-01-24T00:45:45.3332449Z  """ 2025-01-24T00:45:45.3333017Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:45.3333774Z  return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:45.3334325Z  2025-01-24T00:45:45.3334663Z  2025-01-24T00:45:45.3335473Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:45.3336401Z  """ 2025-01-24T00:45:45.3336853Z  Check if a user is opted into an experiment 2025-01-24T00:45:45.3337387Z  """ 2025-01-24T00:45:45.3337886Z  return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:45.3338475Z  2025-01-24T00:45:45.3338807Z  2025-01-24T00:45:45.3339438Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:45.3340203Z  """ 2025-01-24T00:45:45.3340694Z  Check if a user explicitly opted out of an experiment 2025-01-24T00:45:45.3341268Z  """ 2025-01-24T00:45:45.3341801Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:45.3342509Z  experiment_optout = "-" + experiment_name 2025-01-24T00:45:45.3343163Z  if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:45.3343766Z  return False 2025-01-24T00:45:45.3344195Z  2025-01-24T00:45:45.3344654Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:45.3345367Z  log.warning( 2025-01-24T00:45:45.3346205Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:45.3347065Z  ) 2025-01-24T00:45:45.3347580Z  2025-01-24T00:45:45.3347939Z  return True 2025-01-24T00:45:45.3348341Z  2025-01-24T00:45:45.3348678Z  2025-01-24T00:45:45.3349039Z def get_runner_prefix( 2025-01-24T00:45:45.3349700Z  rollout_state: str, 2025-01-24T00:45:45.3350433Z  workflow_requestors: Iterable[str], 2025-01-24T00:45:45.3350970Z  branch: str, 2025-01-24T00:45:45.3351507Z  eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:45.3352117Z  is_canary: bool = False, 2025-01-24T00:45:45.3352595Z ) -> str: 2025-01-24T00:45:45.3353046Z  settings = parse_settings(rollout_state) 2025-01-24T00:45:45.3353644Z  user_optins = parse_users(rollout_state) 2025-01-24T00:45:45.3354169Z  2025-01-24T00:45:45.3354522Z  fleet_prefix = "" 2025-01-24T00:45:45.3354972Z  prefixes = [] 2025-01-24T00:45:45.3355987Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:45.3356949Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:45.3357668Z  log.info( 2025-01-24T00:45:45.3358383Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:45.3359126Z  ) 2025-01-24T00:45:45.3359532Z  continue 2025-01-24T00:45:45.3359966Z  2025-01-24T00:45:45.3360336Z  if eligible_experiments: 2025-01-24T00:45:45.3360935Z  if experiment_name not in eligible_experiments: 2025-01-24T00:45:45.3361597Z  exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:45.3362303Z  log.info( 2025-01-24T00:45:45.3363124Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:45.3363952Z  ) 2025-01-24T00:45:45.3364381Z  continue 2025-01-24T00:45:45.3364891Z  elif not experiment_settings.default: 2025-01-24T00:45:45.3365528Z  log.info( 2025-01-24T00:45:45.3366243Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:45.3366971Z  ) 2025-01-24T00:45:45.3367368Z  continue 2025-01-24T00:45:45.3367792Z  2025-01-24T00:45:45.3368249Z  # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:45.3368870Z  opted_out_users = [ 2025-01-24T00:45:45.3369344Z  requestor 2025-01-24T00:45:45.3369840Z  for requestor in workflow_requestors 2025-01-24T00:45:45.3370525Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:45.3371154Z  ] 2025-01-24T00:45:45.3371523Z  2025-01-24T00:45:45.3371881Z  if opted_out_users: 2025-01-24T00:45:45.3372356Z  log.info( 2025-01-24T00:45:45.3373002Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:45.3373691Z  ) 2025-01-24T00:45:45.3374092Z  continue 2025-01-24T00:45:45.3374505Z  2025-01-24T00:45:45.3374967Z  # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:45.3375921Z  opted_in_users = [ 2025-01-24T00:45:45.3376393Z  requestor 2025-01-24T00:45:45.3376887Z  for requestor in workflow_requestors 2025-01-24T00:45:45.3377572Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:45.3378191Z  ] 2025-01-24T00:45:45.3378702Z  2025-01-24T00:45:45.3379057Z  enabled = False 2025-01-24T00:45:45.3379517Z  if opted_in_users: 2025-01-24T00:45:45.3379990Z  log.info( 2025-01-24T00:45:45.3380621Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:45.3381303Z  ) 2025-01-24T00:45:45.3381712Z  enabled = True 2025-01-24T00:45:45.3382160Z  2025-01-24T00:45:45.3382567Z  elif experiment_settings.rollout_perc: 2025-01-24T00:45:45.3383400Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:45.3384336Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:45.3384998Z  log.info( 2025-01-24T00:45:45.3386242Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:45.3387170Z  ) 2025-01-24T00:45:45.3387612Z  enabled = True 2025-01-24T00:45:45.3388082Z  2025-01-24T00:45:45.3388437Z  if enabled: 2025-01-24T00:45:45.3388901Z  label = experiment_name 2025-01-24T00:45:45.3389472Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:45.3390314Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:45.3391188Z  # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:45.3392124Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:45.3392790Z  if is_canary: 2025-01-24T00:45:45.3393503Z  label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:45.3394272Z  fleet_prefix = label 2025-01-24T00:45:45.3394769Z  else: 2025-01-24T00:45:45.3395239Z  prefixes.append(label) 2025-01-24T00:45:45.3396062Z  2025-01-24T00:45:45.3396422Z  if len(prefixes) > 1: 2025-01-24T00:45:45.3396897Z  log.error( 2025-01-24T00:45:45.3397952Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-01-24T00:45:45.3399034Z  ) 2025-01-24T00:45:45.3399443Z  prefixes = prefixes[:1] 2025-01-24T00:45:45.3399925Z  2025-01-24T00:45:45.3400288Z  # Fleet always comes first 2025-01-24T00:45:45.3400793Z  if fleet_prefix: 2025-01-24T00:45:45.3401274Z  prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:45.3401777Z  2025-01-24T00:45:45.3402230Z  return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:45.3402844Z  2025-01-24T00:45:45.3403177Z  2025-01-24T00:45:45.3403816Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:45.3404582Z  """ 2025-01-24T00:45:45.3405182Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:45.3405980Z  2025-01-24T00:45:45.3406560Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:45.3407256Z  """ 2025-01-24T00:45:45.3407661Z  gh = get_gh_client(github_token) 2025-01-24T00:45:45.3408227Z  issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:45.3408889Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:45.3409484Z  2025-01-24T00:45:45.3409824Z  2025-01-24T00:45:45.3410570Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:45.3411323Z  for _ in range(num_retries): 2025-01-24T00:45:45.3411804Z  try: 2025-01-24T00:45:45.3412311Z  req = Request(url=url, headers=headers) 2025-01-24T00:45:45.3412976Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:45.3413624Z  return json.loads(content) 2025-01-24T00:45:45.3414174Z  except Exception as e: 2025-01-24T00:45:45.3414740Z  log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:45.3415476Z  2025-01-24T00:45:45.3416202Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:45.3416920Z  return {} 2025-01-24T00:45:45.3417324Z  2025-01-24T00:45:45.3417660Z  2025-01-24T00:45:45.3418022Z @lru_cache(maxsize=None) 2025-01-24T00:45:45.3418759Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:45.3419504Z  """ 2025-01-24T00:45:45.3419914Z  Dynamically get PR information 2025-01-24T00:45:45.3420407Z  """ 2025-01-24T00:45:45.3420926Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:45.3421543Z  headers = { 2025-01-24T00:45:45.3422041Z  "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:45.3422664Z  "Authorization": f"token {github_token}", 2025-01-24T00:45:45.3423186Z  } 2025-01-24T00:45:45.3423637Z  json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:45.3424379Z  url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:45.3424926Z  headers=headers, 2025-01-24T00:45:45.3425493Z  ) 2025-01-24T00:45:45.3425852Z  2025-01-24T00:45:45.3426204Z  if not json_response: 2025-01-24T00:45:45.3426812Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:45.3427475Z  return {} 2025-01-24T00:45:45.3427881Z  2025-01-24T00:45:45.3428242Z  return json_response 2025-01-24T00:45:45.3428688Z  2025-01-24T00:45:45.3429017Z  2025-01-24T00:45:45.3429611Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:45.3430333Z  """ 2025-01-24T00:45:45.3430872Z  Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:45.3431516Z  """ 2025-01-24T00:45:45.3432017Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:45.3432675Z  return { 2025-01-24T00:45:45.3433293Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:45.3433985Z  } 2025-01-24T00:45:45.3434344Z  2025-01-24T00:45:45.3434677Z  2025-01-24T00:45:45.3435023Z def main() -> None: 2025-01-24T00:45:45.3435572Z  args = parse_args() 2025-01-24T00:45:45.3436015Z  2025-01-24T00:45:45.3436434Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:45.3436969Z  2025-01-24T00:45:45.3437336Z  # Check if the PR is opt-out 2025-01-24T00:45:45.3437838Z  if args.pr_number: 2025-01-24T00:45:45.3438534Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:45.3439272Z  if OPT_OUT_LABEL in labels: 2025-01-24T00:45:45.3439783Z  log.info( 2025-01-24T00:45:45.3440507Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:45.3441395Z  ) 2025-01-24T00:45:45.3441981Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:45.3442657Z  sys.exit() 2025-01-24T00:45:45.3443081Z  2025-01-24T00:45:45.3443425Z  try: 2025-01-24T00:45:45.3443888Z  rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:45.3444594Z  args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:45.3445236Z  ) 2025-01-24T00:45:45.3445711Z  2025-01-24T00:45:45.3446094Z  username = get_potential_pr_author( 2025-01-24T00:45:45.3446628Z  args.github_token, 2025-01-24T00:45:45.3447129Z  args.github_repo, 2025-01-24T00:45:45.3447622Z  args.github_actor, 2025-01-24T00:45:45.3448133Z  args.github_ref_type, 2025-01-24T00:45:45.3448648Z  args.github_branch, 2025-01-24T00:45:45.3449127Z  ) 2025-01-24T00:45:45.3449505Z  2025-01-24T00:45:45.3449974Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:45.3450574Z  2025-01-24T00:45:45.3450986Z  runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:45.3451544Z  rollout_state, 2025-01-24T00:45:45.3452060Z  (args.github_issue_owner, username), 2025-01-24T00:45:45.3452612Z  args.github_branch, 2025-01-24T00:45:45.3453143Z  args.eligible_experiments, 2025-01-24T00:45:45.3453657Z  is_canary, 2025-01-24T00:45:45.3454093Z  ) 2025-01-24T00:45:45.3454471Z  2025-01-24T00:45:45.3454831Z  except Exception as e: 2025-01-24T00:45:45.3455528Z  log.error( 2025-01-24T00:45:45.3456261Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:45.3457011Z  ) 2025-01-24T00:45:45.3457386Z  2025-01-24T00:45:45.3457913Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:45.3458561Z  2025-01-24T00:45:45.3458897Z  2025-01-24T00:45:45.3459285Z if __name__ == "__main__": 2025-01-24T00:45:45.3459744Z  main() 2025-01-24T00:45:45.3460124Z  2025-01-24T00:45:45.3460459Z EOF 2025-01-24T00:45:45.3460982Z  2025-01-24T00:45:45.3461453Z cat runner_determinator.py 2025-01-24T00:45:45.3666791Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:45.3667914Z env: 2025-01-24T00:45:45.3668869Z GITHUB_TOKEN: *** 2025-01-24T00:45:45.3669307Z ISSUE_NUMBER: 5132 2025-01-24T00:45:45.3669752Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:45.3670240Z ISSUE_OWNER: 2025-01-24T00:45:45.3670628Z CHECK_EXPERIMENTS: 2025-01-24T00:45:45.3671032Z PR_NUMBER: 2025-01-24T00:45:45.3671396Z ##[endgroup] 2025-01-24T00:45:45.3881462Z # flake8: noqa: G004 2025-01-24T00:45:45.3881783Z 2025-01-24T00:45:45.3882206Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-01-24T00:45:45.3883123Z # must be kept in sync. You can do it easily by running the following command: 2025-01-24T00:45:45.3883882Z # python .github/scripts/update_runner_determinator.py 2025-01-24T00:45:45.3884296Z 2025-01-24T00:45:45.3884450Z """ 2025-01-24T00:45:45.3884987Z This runner determinator is used to determine which set of runners to run a 2025-01-24T00:45:45.3886121Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-01-24T00:45:45.3887001Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-01-24T00:45:45.3887804Z of which runners should be used to run which job. 2025-01-24T00:45:45.3888199Z 2025-01-24T00:45:45.3888559Z The configuration has two parts, the settings and a list of opted-in users, 2025-01-24T00:45:45.3949176Z separated by a line containing "---". If the line is not present, the 2025-01-24T00:45:45.3950963Z settings are considered to be empty with only the second part, the user 2025-01-24T00:45:45.3952269Z list, defined. 2025-01-24T00:45:45.3952668Z 2025-01-24T00:45:45.3953293Z The first part is a YAML block that defines the rollout settings. This can be 2025-01-24T00:45:45.3954904Z used to define any settings that are needed to determine which runners to use. 2025-01-24T00:45:45.3956600Z It's fields are defined by the RolloutSettings class below. 2025-01-24T00:45:45.3957399Z 2025-01-24T00:45:45.3958077Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-01-24T00:45:45.3959671Z The user list is also a comma separated list of additional features or 2025-01-24T00:45:45.3960910Z experiments which the user could be opted in to. 2025-01-24T00:45:45.3961628Z 2025-01-24T00:45:45.3961995Z The user list has the following rules: 2025-01-24T00:45:45.3962621Z 2025-01-24T00:45:45.3963150Z - Users are GitHub usernames, which must start with the @ prefix 2025-01-24T00:45:45.3964640Z - Each user is also a comma-separated list of features/experiments to enable 2025-01-24T00:45:45.3966192Z - A "#" prefix opts the user out of all experiments 2025-01-24T00:45:45.3966909Z 2025-01-24T00:45:45.3967212Z Example config: 2025-01-24T00:45:45.3967975Z # A list of experiments that can be opted into. 2025-01-24T00:45:45.3969503Z # This defines the behavior they'll induce when opted into. 2025-01-24T00:45:45.3970589Z # Expected syntax is: 2025-01-24T00:45:45.3971722Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-01-24T00:45:45.3973384Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-01-24T00:45:45.3974679Z 2025-01-24T00:45:45.3974984Z experiments: 2025-01-24T00:45:45.3975838Z lf: 2025-01-24T00:45:45.3976465Z rollout_percent: 25 2025-01-24T00:45:45.3977215Z all_branches: false 2025-01-24T00:45:45.3977975Z default: true 2025-01-24T00:45:45.3978697Z --- 2025-01-24T00:45:45.3979063Z 2025-01-24T00:45:45.3979358Z # Opt-ins: 2025-01-24T00:45:45.3980413Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-01-24T00:45:45.3981910Z # and specifying experiments to enable in a comma-separated list. 2025-01-24T00:45:45.3983076Z # To always opt out of an experiment, prefix it with a "-". 2025-01-24T00:45:45.3984427Z # Experiments should be from the above list. 2025-01-24T00:45:45.3985062Z 2025-01-24T00:45:45.3985589Z @User1,-lf,split_build 2025-01-24T00:45:45.3986417Z @User2,lf 2025-01-24T00:45:45.3987075Z @User3,split_build 2025-01-24T00:45:45.3987775Z """ 2025-01-24T00:45:45.3988119Z 2025-01-24T00:45:45.3988474Z import json 2025-01-24T00:45:45.3989147Z import logging 2025-01-24T00:45:45.3989743Z import os 2025-01-24T00:45:45.3990273Z import random 2025-01-24T00:45:45.3990909Z import re 2025-01-24T00:45:45.3991552Z import sys 2025-01-24T00:45:45.3992291Z from argparse import ArgumentParser 2025-01-24T00:45:45.3993153Z from functools import lru_cache 2025-01-24T00:45:45.3994037Z from logging import LogRecord 2025-01-24T00:45:45.3995226Z from typing import Any, Dict, FrozenSet, Iterable, List, NamedTuple, Set, Tuple 2025-01-24T00:45:45.3996782Z from urllib.request import Request, urlopen 2025-01-24T00:45:45.3997433Z 2025-01-24T00:45:45.3997750Z import yaml 2025-01-24T00:45:45.3998434Z from github import Auth, Github 2025-01-24T00:45:45.3999291Z from github.Issue import Issue 2025-01-24T00:45:45.3999816Z 2025-01-24T00:45:45.3999827Z 2025-01-24T00:45:45.4000220Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-01-24T00:45:45.4001498Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-01-24T00:45:45.4002971Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-01-24T00:45:45.4003975Z 2025-01-24T00:45:45.4004703Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-01-24T00:45:45.4005995Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-01-24T00:45:45.4006904Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-01-24T00:45:45.4007821Z OPT_OUT_LABEL = "no-runner-experiments" 2025-01-24T00:45:45.4008424Z 2025-01-24T00:45:45.4008756Z SETTING_EXPERIMENTS = "experiments" 2025-01-24T00:45:45.4009315Z 2025-01-24T00:45:45.4009627Z LF_FLEET_EXPERIMENT = "lf" 2025-01-24T00:45:45.4010418Z CANARY_FLEET_SUFFIX = ".c" 2025-01-24T00:45:45.4010890Z 2025-01-24T00:45:45.4010900Z 2025-01-24T00:45:45.4011222Z class Experiment(NamedTuple): 2025-01-24T00:45:45.4012045Z rollout_perc: float = ( 2025-01-24T00:45:45.4013126Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-01-24T00:45:45.4014273Z ) 2025-01-24T00:45:45.4014903Z all_branches: bool = ( 2025-01-24T00:45:45.4016187Z False # If True, the experiment is also enabled on the exception branches 2025-01-24T00:45:45.4017363Z ) 2025-01-24T00:45:45.4017962Z default: bool = ( 2025-01-24T00:45:45.4018988Z True # If True, the experiment is enabled by default for all queries 2025-01-24T00:45:45.4020148Z ) 2025-01-24T00:45:45.4020497Z 2025-01-24T00:45:45.4020788Z # Add more fields as needed 2025-01-24T00:45:45.4021286Z 2025-01-24T00:45:45.4021297Z 2025-01-24T00:45:45.4021654Z class Settings(NamedTuple): 2025-01-24T00:45:45.4022378Z """ 2025-01-24T00:45:45.4023090Z Settings for the experiments that can be opted into. 2025-01-24T00:45:45.4024083Z """ 2025-01-24T00:45:45.4024422Z 2025-01-24T00:45:45.4024775Z experiments: Dict[str, Experiment] = {} 2025-01-24T00:45:45.4026083Z 2025-01-24T00:45:45.4026093Z 2025-01-24T00:45:45.4026445Z class ColorFormatter(logging.Formatter): 2025-01-24T00:45:45.4027467Z """Color codes the log messages based on the log level""" 2025-01-24T00:45:45.4028448Z 2025-01-24T00:45:45.4028776Z COLORS = { 2025-01-24T00:45:45.4029449Z "WARNING": "\033[33m", # Yellow 2025-01-24T00:45:45.4030286Z "ERROR": "\033[31m", # Red 2025-01-24T00:45:45.4031077Z "CRITICAL": "\033[31m", # Red 2025-01-24T00:45:45.4031921Z "INFO": "\033[0m", # Reset 2025-01-24T00:45:45.4032734Z "DEBUG": "\033[0m", # Reset 2025-01-24T00:45:45.4033497Z } 2025-01-24T00:45:45.4033804Z 2025-01-24T00:45:45.4034153Z def format(self, record: LogRecord) -> str: 2025-01-24T00:45:45.4035576Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-01-24T00:45:45.4036915Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-01-24T00:45:45.4037860Z return super().format(record) 2025-01-24T00:45:45.4038441Z 2025-01-24T00:45:45.4038450Z 2025-01-24T00:45:45.4038803Z handler = logging.StreamHandler() 2025-01-24T00:45:45.4039986Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-01-24T00:45:45.4041189Z 2025-01-24T00:45:45.4041447Z log = logging.getLogger(os.path.basename(__file__)) 2025-01-24T00:45:45.4042034Z log.addHandler(handler) 2025-01-24T00:45:45.4042460Z log.setLevel(logging.INFO) 2025-01-24T00:45:45.4042736Z 2025-01-24T00:45:45.4042744Z 2025-01-24T00:45:45.4042979Z def set_github_output(key: str, value: str) -> None: 2025-01-24T00:45:45.4043513Z """ 2025-01-24T00:45:45.4043994Z Defines outputs of the github action that invokes this script 2025-01-24T00:45:45.4044588Z """ 2025-01-24T00:45:45.4044933Z if not GITHUB_OUTPUT: 2025-01-24T00:45:45.4046190Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-01-24T00:45:45.4047269Z log.warning( 2025-01-24T00:45:45.4048072Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-01-24T00:45:45.4048951Z ) 2025-01-24T00:45:45.4059072Z print(f"::set-output name={key}::{value}") 2025-01-24T00:45:45.4059651Z return 2025-01-24T00:45:45.4060072Z 2025-01-24T00:45:45.4060266Z with open(GITHUB_OUTPUT, "a") as f: 2025-01-24T00:45:45.4060806Z log.info(f"Setting output: {key}='{value}'") 2025-01-24T00:45:45.4061341Z f.write(f"{key}={value}\n") 2025-01-24T00:45:45.4061646Z 2025-01-24T00:45:45.4061659Z 2025-01-24T00:45:45.4061945Z def _str_comma_separated_to_set(value: str) -> FrozenSet[str]: 2025-01-24T00:45:45.4062551Z return frozenset( 2025-01-24T00:45:45.4063123Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-01-24T00:45:45.4063772Z ) 2025-01-24T00:45:45.4063951Z 2025-01-24T00:45:45.4063957Z 2025-01-24T00:45:45.4064131Z def parse_args() -> Any: 2025-01-24T00:45:45.4064639Z parser = ArgumentParser("Get dynamic rollout settings") 2025-01-24T00:45:45.4065719Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-01-24T00:45:45.4066479Z parser.add_argument( 2025-01-24T00:45:45.4066901Z "--github-issue-repo", 2025-01-24T00:45:45.4067342Z type=str, 2025-01-24T00:45:45.4067717Z required=False, 2025-01-24T00:45:45.4068128Z default="pytorch/test-infra", 2025-01-24T00:45:45.4068627Z help="GitHub repo to get the issue", 2025-01-24T00:45:45.4069113Z ) 2025-01-24T00:45:45.4069449Z parser.add_argument( 2025-01-24T00:45:45.4069860Z "--github-repo", 2025-01-24T00:45:45.4070250Z type=str, 2025-01-24T00:45:45.4070617Z required=True, 2025-01-24T00:45:45.4071046Z help="GitHub repo where CI is running", 2025-01-24T00:45:45.4071534Z ) 2025-01-24T00:45:45.4071875Z parser.add_argument( 2025-01-24T00:45:45.4072434Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-01-24T00:45:45.4073042Z ) 2025-01-24T00:45:45.4073386Z parser.add_argument( 2025-01-24T00:45:45.4074093Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-01-24T00:45:45.4074734Z ) 2025-01-24T00:45:45.4075077Z parser.add_argument( 2025-01-24T00:45:45.4075901Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-01-24T00:45:45.4076552Z ) 2025-01-24T00:45:45.4076894Z parser.add_argument( 2025-01-24T00:45:45.4077504Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-01-24T00:45:45.4078167Z ) 2025-01-24T00:45:45.4078498Z parser.add_argument( 2025-01-24T00:45:45.4078919Z "--github-ref-type", 2025-01-24T00:45:45.4079352Z type=str, 2025-01-24T00:45:45.4079717Z required=True, 2025-01-24T00:45:45.4080163Z help="Current GitHub ref type, branch or tag", 2025-01-24T00:45:45.4080677Z ) 2025-01-24T00:45:45.4081013Z parser.add_argument( 2025-01-24T00:45:45.4081438Z "--eligible-experiments", 2025-01-24T00:45:45.4081912Z type=_str_comma_separated_to_set, 2025-01-24T00:45:45.4082399Z required=False, 2025-01-24T00:45:45.4082781Z default="", 2025-01-24T00:45:45.4083571Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-01-24T00:45:45.4084449Z ) 2025-01-24T00:45:45.4084788Z parser.add_argument( 2025-01-24T00:45:45.4085190Z "--pr-number", 2025-01-24T00:45:45.4085753Z type=str, 2025-01-24T00:45:45.4086117Z required=False, 2025-01-24T00:45:45.4086501Z default="", 2025-01-24T00:45:45.4086932Z help="the optional PR number where this is run", 2025-01-24T00:45:45.4087448Z ) 2025-01-24T00:45:45.4087634Z 2025-01-24T00:45:45.4087809Z return parser.parse_args() 2025-01-24T00:45:45.4088095Z 2025-01-24T00:45:45.4088102Z 2025-01-24T00:45:45.4088323Z def get_gh_client(github_token: str) -> Github: 2025-01-24T00:45:45.4088865Z auth = Auth.Token(github_token) 2025-01-24T00:45:45.4089340Z return Github(auth=auth) 2025-01-24T00:45:45.4089628Z 2025-01-24T00:45:45.4089634Z 2025-01-24T00:45:45.4089908Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: 2025-01-24T00:45:45.4090652Z repo = gh.get_repo(repo) 2025-01-24T00:45:45.4091110Z return repo.get_issue(number=issue_num) 2025-01-24T00:45:45.4091456Z 2025-01-24T00:45:45.4091463Z 2025-01-24T00:45:45.4091635Z def get_potential_pr_author( 2025-01-24T00:45:45.4092236Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-01-24T00:45:45.4092868Z ) -> str: 2025-01-24T00:45:45.4093356Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-01-24T00:45:45.4094108Z # Fetch the actual username from the original PR. The PR number is 2025-01-24T00:45:45.4094807Z # embedded in the tag name: ciflow// 2025-01-24T00:45:45.4095193Z 2025-01-24T00:45:45.4095608Z gh = get_gh_client(github_token) 2025-01-24T00:45:45.4095939Z 2025-01-24T00:45:45.4096193Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-01-24T00:45:45.4096783Z split_tag = ref_name.split("/") 2025-01-24T00:45:45.4097251Z if ( 2025-01-24T00:45:45.4097619Z len(split_tag) == 3 2025-01-24T00:45:45.4098075Z and split_tag[0] == "ciflow" 2025-01-24T00:45:45.4098563Z and split_tag[2].isnumeric() 2025-01-24T00:45:45.4099038Z ): 2025-01-24T00:45:45.4099394Z pr_number = split_tag[2] 2025-01-24T00:45:45.4099833Z try: 2025-01-24T00:45:45.4100232Z repository = gh.get_repo(repo) 2025-01-24T00:45:45.4100801Z pull = repository.get_pull(number=int(pr_number)) 2025-01-24T00:45:45.4101352Z except Exception as e: 2025-01-24T00:45:45.4101834Z raise Exception( # noqa: TRY002 2025-01-24T00:45:45.4102468Z f"issue with pull request {pr_number} from repo {repository}" 2025-01-24T00:45:45.4103059Z ) from e 2025-01-24T00:45:45.4103599Z return pull.user.login 2025-01-24T00:45:45.4104148Z # In all other cases, return the original input username 2025-01-24T00:45:45.4104707Z return username 2025-01-24T00:45:45.4104941Z 2025-01-24T00:45:45.4104947Z 2025-01-24T00:45:45.4105153Z def is_exception_branch(branch: str) -> bool: 2025-01-24T00:45:45.4105888Z """ 2025-01-24T00:45:45.4106495Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-01-24T00:45:45.4107227Z """ 2025-01-24T00:45:45.4107741Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-01-24T00:45:45.4108233Z 2025-01-24T00:45:45.4108239Z 2025-01-24T00:45:45.4108425Z def load_yaml(yaml_text: str) -> Any: 2025-01-24T00:45:45.4108884Z try: 2025-01-24T00:45:45.4109239Z data = yaml.safe_load(yaml_text) 2025-01-24T00:45:45.4109699Z return data 2025-01-24T00:45:45.4110084Z except yaml.YAMLError: 2025-01-24T00:45:45.4110542Z log.exception("Error loading YAML") 2025-01-24T00:45:45.4111026Z raise 2025-01-24T00:45:45.4111226Z 2025-01-24T00:45:45.4111233Z 2025-01-24T00:45:45.4111620Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> Tuple[str, str]: 2025-01-24T00:45:45.4112325Z """ 2025-01-24T00:45:45.4112905Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-01-24T00:45:45.4113462Z 2025-01-24T00:45:45.4113782Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:45.4114477Z and the text below is the list of opted in users. 2025-01-24T00:45:45.4114857Z 2025-01-24T00:45:45.4115204Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-01-24T00:45:45.4116250Z """ 2025-01-24T00:45:45.4116657Z rollout_state_parts = rollout_state.split("---") 2025-01-24T00:45:45.4117214Z if len(rollout_state_parts) >= 2: 2025-01-24T00:45:45.4117764Z return rollout_state_parts[0], rollout_state_parts[1] 2025-01-24T00:45:45.4118317Z else: 2025-01-24T00:45:45.4118666Z return "", rollout_state 2025-01-24T00:45:45.4118949Z 2025-01-24T00:45:45.4118955Z 2025-01-24T00:45:45.4119275Z class UserOptins(Dict[str, List[str]]): 2025-01-24T00:45:45.4119755Z """ 2025-01-24T00:45:45.4120234Z Dictionary of users with a list of features they have opted into 2025-01-24T00:45:45.4120828Z """ 2025-01-24T00:45:45.4121015Z 2025-01-24T00:45:45.4121021Z 2025-01-24T00:45:45.4121334Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-01-24T00:45:45.4121983Z """ 2025-01-24T00:45:45.4122638Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-01-24T00:45:45.4123289Z 2025-01-24T00:45:45.4123869Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-01-24T00:45:45.4124794Z - Example line: "@User1,lf,split_build" 2025-01-24T00:45:45.4125676Z - A "#" prefix indicates the user is opted out of all experiments 2025-01-24T00:45:45.4126142Z 2025-01-24T00:45:45.4126149Z 2025-01-24T00:45:45.4126298Z """ 2025-01-24T00:45:45.4126650Z optins = UserOptins() 2025-01-24T00:45:45.4127101Z for user in user_optin_text.split("\n"): 2025-01-24T00:45:45.4127611Z user = user.strip("\r\n\t -") 2025-01-24T00:45:45.4128113Z if not user or not user.startswith("@"): 2025-01-24T00:45:45.4128631Z # Not a valid user. Skip 2025-01-24T00:45:45.4129070Z continue 2025-01-24T00:45:45.4129299Z 2025-01-24T00:45:45.4129445Z if user: 2025-01-24T00:45:45.4129850Z usr_name = user.split(",")[0].strip("@") 2025-01-24T00:45:45.4130489Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-01-24T00:45:45.4130954Z 2025-01-24T00:45:45.4131112Z return optins 2025-01-24T00:45:45.4131327Z 2025-01-24T00:45:45.4131333Z 2025-01-24T00:45:45.4131600Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-01-24T00:45:45.4132287Z """ 2025-01-24T00:45:45.4132661Z Check if the experiment name is valid. 2025-01-24T00:45:45.4133149Z A valid name: 2025-01-24T00:45:45.4133738Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-01-24T00:45:45.4134620Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-01-24T00:45:45.4135630Z - Cannot contain spaces 2025-01-24T00:45:45.4136063Z """ 2025-01-24T00:45:45.4136250Z 2025-01-24T00:45:45.4136500Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-01-24T00:45:45.4137143Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-01-24T00:45:45.4137552Z 2025-01-24T00:45:45.4137701Z if valid: 2025-01-24T00:45:45.4138058Z return True 2025-01-24T00:45:45.4138274Z 2025-01-24T00:45:45.4138429Z log.error( 2025-01-24T00:45:45.4139803Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-01-24T00:45:45.4141273Z ) 2025-01-24T00:45:45.4141604Z return False 2025-01-24T00:45:45.4141817Z 2025-01-24T00:45:45.4141823Z 2025-01-24T00:45:45.4142103Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-01-24T00:45:45.4142674Z """ 2025-01-24T00:45:45.4143220Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-01-24T00:45:45.4143890Z """ 2025-01-24T00:45:45.4144216Z try: 2025-01-24T00:45:45.4144554Z if settings_text: 2025-01-24T00:45:45.4145222Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-01-24T00:45:45.4146166Z # for easy reading 2025-01-24T00:45:45.4146903Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-01-24T00:45:45.4147734Z # the backtick character in shell commands. 2025-01-24T00:45:45.4148308Z backtick = chr(96) # backtick character 2025-01-24T00:45:45.4149085Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-01-24T00:45:45.4149702Z settings = load_yaml(settings_text) 2025-01-24T00:45:45.4150044Z 2025-01-24T00:45:45.4150421Z # For now we just load experiments. We can expand this if/when we add more settings 2025-01-24T00:45:45.4151123Z experiments = {} 2025-01-24T00:45:45.4151392Z 2025-01-24T00:45:45.4151730Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-01-24T00:45:45.4152432Z if not is_valid_experiment_name(exp_name): 2025-01-24T00:45:45.4153482Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-01-24T00:45:45.4154456Z continue 2025-01-24T00:45:45.4154720Z 2025-01-24T00:45:45.4154892Z valid_settings = {} 2025-01-24T00:45:45.4155592Z for setting in exp_settings: 2025-01-24T00:45:45.4156143Z if setting not in Experiment._fields: 2025-01-24T00:45:45.4156651Z log.warning( 2025-01-24T00:45:45.4157291Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-01-24T00:45:45.4157964Z ) 2025-01-24T00:45:45.4158355Z else: 2025-01-24T00:45:45.4158825Z valid_settings[setting] = exp_settings[setting] 2025-01-24T00:45:45.4159228Z 2025-01-24T00:45:45.4159483Z experiments[exp_name] = Experiment(**valid_settings) 2025-01-24T00:45:45.4160076Z return Settings(experiments) 2025-01-24T00:45:45.4160406Z 2025-01-24T00:45:45.4160565Z except Exception: 2025-01-24T00:45:45.4160999Z log.exception("Failed to parse settings") 2025-01-24T00:45:45.4161356Z 2025-01-24T00:45:45.4161649Z return Settings() 2025-01-24T00:45:45.4161892Z 2025-01-24T00:45:45.4161899Z 2025-01-24T00:45:45.4162130Z def parse_settings(rollout_state: str) -> Settings: 2025-01-24T00:45:45.4162661Z """ 2025-01-24T00:45:45.4163053Z Parse settings, if any, from the rollout state. 2025-01-24T00:45:45.4163426Z 2025-01-24T00:45:45.4163748Z If the issue body contains "---" then the text above that is the settings 2025-01-24T00:45:45.4164452Z and the text below is the list of opted in users. 2025-01-24T00:45:45.4164825Z 2025-01-24T00:45:45.4165204Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-01-24T00:45:45.4166002Z """ 2025-01-24T00:45:45.4166542Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:45.4167254Z return parse_settings_from_text(settings_text) 2025-01-24T00:45:45.4167624Z 2025-01-24T00:45:45.4167630Z 2025-01-24T00:45:45.4167863Z def parse_users(rollout_state: str) -> UserOptins: 2025-01-24T00:45:45.4168378Z """ 2025-01-24T00:45:45.4168737Z Parse users from the rollout state. 2025-01-24T00:45:45.4169072Z 2025-01-24T00:45:45.4169225Z """ 2025-01-24T00:45:45.4169707Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-01-24T00:45:45.4170393Z return parse_user_opt_in_from_text(users_text) 2025-01-24T00:45:45.4170760Z 2025-01-24T00:45:45.4170766Z 2025-01-24T00:45:45.4171152Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:45.4171832Z """ 2025-01-24T00:45:45.4172212Z Check if a user is opted into an experiment 2025-01-24T00:45:45.4172714Z """ 2025-01-24T00:45:45.4173117Z return experiment_name in user_optins.get(user, []) 2025-01-24T00:45:45.4173511Z 2025-01-24T00:45:45.4173517Z 2025-01-24T00:45:45.4173902Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-01-24T00:45:45.4174597Z """ 2025-01-24T00:45:45.4175010Z Check if a user explicitly opted out of an experiment 2025-01-24T00:45:45.4175652Z """ 2025-01-24T00:45:45.4176115Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-01-24T00:45:45.4176880Z experiment_optout = "-" + experiment_name 2025-01-24T00:45:45.4177468Z if experiment_optout not in user_optins.get(user, []): 2025-01-24T00:45:45.4178014Z return False 2025-01-24T00:45:45.4178240Z 2025-01-24T00:45:45.4178484Z if is_user_opted_in(user, user_optins, experiment_name): 2025-01-24T00:45:45.4179032Z log.warning( 2025-01-24T00:45:45.4179777Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-01-24T00:45:45.4180595Z ) 2025-01-24T00:45:45.4180787Z 2025-01-24T00:45:45.4180939Z return True 2025-01-24T00:45:45.4181152Z 2025-01-24T00:45:45.4181168Z 2025-01-24T00:45:45.4181330Z def get_runner_prefix( 2025-01-24T00:45:45.4181728Z rollout_state: str, 2025-01-24T00:45:45.4182154Z workflow_requestors: Iterable[str], 2025-01-24T00:45:45.4182632Z branch: str, 2025-01-24T00:45:45.4183072Z eligible_experiments: FrozenSet[str] = frozenset(), 2025-01-24T00:45:45.4183635Z is_canary: bool = False, 2025-01-24T00:45:45.4184058Z ) -> str: 2025-01-24T00:45:45.4184432Z settings = parse_settings(rollout_state) 2025-01-24T00:45:45.4184959Z user_optins = parse_users(rollout_state) 2025-01-24T00:45:45.4185416Z 2025-01-24T00:45:45.4185589Z fleet_prefix = "" 2025-01-24T00:45:45.4185974Z prefixes = [] 2025-01-24T00:45:45.4186544Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-01-24T00:45:45.4187407Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-01-24T00:45:45.4188056Z log.info( 2025-01-24T00:45:45.4188678Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-01-24T00:45:45.4189375Z ) 2025-01-24T00:45:45.4189831Z continue 2025-01-24T00:45:45.4190063Z 2025-01-24T00:45:45.4190235Z if eligible_experiments: 2025-01-24T00:45:45.4190757Z if experiment_name not in eligible_experiments: 2025-01-24T00:45:45.4191332Z exp_list = ", ".join(eligible_experiments) 2025-01-24T00:45:45.4191839Z log.info( 2025-01-24T00:45:45.4192553Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-01-24T00:45:45.4193324Z ) 2025-01-24T00:45:45.4193679Z continue 2025-01-24T00:45:45.4194106Z elif not experiment_settings.default: 2025-01-24T00:45:45.4194590Z log.info( 2025-01-24T00:45:45.4195204Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-01-24T00:45:45.4195982Z ) 2025-01-24T00:45:45.4196316Z continue 2025-01-24T00:45:45.4196544Z 2025-01-24T00:45:45.4196801Z # Is any workflow_requestor opted out to this experiment? 2025-01-24T00:45:45.4197374Z opted_out_users = [ 2025-01-24T00:45:45.4197781Z requestor 2025-01-24T00:45:45.4198196Z for requestor in workflow_requestors 2025-01-24T00:45:45.4198820Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-01-24T00:45:45.4199396Z ] 2025-01-24T00:45:45.4199585Z 2025-01-24T00:45:45.4199752Z if opted_out_users: 2025-01-24T00:45:45.4200168Z log.info( 2025-01-24T00:45:45.4200735Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-01-24T00:45:45.4201372Z ) 2025-01-24T00:45:45.4201714Z continue 2025-01-24T00:45:45.4201938Z 2025-01-24T00:45:45.4202190Z # Is any workflow_requestor opted in to this experiment? 2025-01-24T00:45:45.4202751Z opted_in_users = [ 2025-01-24T00:45:45.4203173Z requestor 2025-01-24T00:45:45.4203594Z for requestor in workflow_requestors 2025-01-24T00:45:45.4204202Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-01-24T00:45:45.4204774Z ] 2025-01-24T00:45:45.4205088Z 2025-01-24T00:45:45.4205349Z enabled = False 2025-01-24T00:45:45.4205755Z if opted_in_users: 2025-01-24T00:45:45.4206166Z log.info( 2025-01-24T00:45:45.4206705Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-01-24T00:45:45.4207334Z ) 2025-01-24T00:45:45.4207690Z enabled = True 2025-01-24T00:45:45.4207946Z 2025-01-24T00:45:45.4208149Z elif experiment_settings.rollout_perc: 2025-01-24T00:45:45.4208912Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-01-24T00:45:45.4209768Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-01-24T00:45:45.4210363Z log.info( 2025-01-24T00:45:45.4211170Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-01-24T00:45:45.4212029Z ) 2025-01-24T00:45:45.4212402Z enabled = True 2025-01-24T00:45:45.4212673Z 2025-01-24T00:45:45.4212824Z if enabled: 2025-01-24T00:45:45.4213207Z label = experiment_name 2025-01-24T00:45:45.4213708Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-01-24T00:45:45.4214469Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-01-24T00:45:45.4215366Z # - If it's enabled, then we always list it's prefix first 2025-01-24T00:45:45.4216066Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-01-24T00:45:45.4216666Z if is_canary: 2025-01-24T00:45:45.4217112Z label += CANARY_FLEET_SUFFIX 2025-01-24T00:45:45.4217610Z fleet_prefix = label 2025-01-24T00:45:45.4218172Z else: 2025-01-24T00:45:45.4218562Z prefixes.append(label) 2025-01-24T00:45:45.4218884Z 2025-01-24T00:45:45.4219063Z if len(prefixes) > 1: 2025-01-24T00:45:45.4219461Z log.error( 2025-01-24T00:45:45.4220416Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-01-24T00:45:45.4221448Z ) 2025-01-24T00:45:45.4221831Z prefixes = prefixes[:1] 2025-01-24T00:45:45.4222119Z 2025-01-24T00:45:45.4222291Z # Fleet always comes first 2025-01-24T00:45:45.4222728Z if fleet_prefix: 2025-01-24T00:45:45.4223135Z prefixes.insert(0, fleet_prefix) 2025-01-24T00:45:45.4223471Z 2025-01-24T00:45:45.4223694Z return ".".join(prefixes) + "." if prefixes else "" 2025-01-24T00:45:45.4224079Z 2025-01-24T00:45:45.4224091Z 2025-01-24T00:45:45.4224505Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-01-24T00:45:45.4225224Z """ 2025-01-24T00:45:45.4225853Z Gets the first comment of the issue, which contains the desired rollout state. 2025-01-24T00:45:45.4226381Z 2025-01-24T00:45:45.4226738Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-01-24T00:45:45.4227390Z """ 2025-01-24T00:45:45.4227734Z gh = get_gh_client(github_token) 2025-01-24T00:45:45.4228225Z issue = get_issue(gh, repo, issue_num) 2025-01-24T00:45:45.4228807Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-01-24T00:45:45.4229218Z 2025-01-24T00:45:45.4229224Z 2025-01-24T00:45:45.4229594Z def download_json(url: str, headers: Dict[str, str], num_retries: int = 3) -> Any: 2025-01-24T00:45:45.4230283Z for _ in range(num_retries): 2025-01-24T00:45:45.4230720Z try: 2025-01-24T00:45:45.4231108Z req = Request(url=url, headers=headers) 2025-01-24T00:45:45.4231732Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-01-24T00:45:45.4232331Z return json.loads(content) 2025-01-24T00:45:45.4232812Z except Exception as e: 2025-01-24T00:45:45.4233306Z log.warning(f"Could not download {url}: {e}") 2025-01-24T00:45:45.4233809Z 2025-01-24T00:45:45.4234165Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-01-24T00:45:45.4234823Z return {} 2025-01-24T00:45:45.4235029Z 2025-01-24T00:45:45.4235035Z 2025-01-24T00:45:45.4235200Z @lru_cache(maxsize=None) 2025-01-24T00:45:45.4235951Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> Dict[str, Any]: 2025-01-24T00:45:45.4236642Z """ 2025-01-24T00:45:45.4236997Z Dynamically get PR information 2025-01-24T00:45:45.4237443Z """ 2025-01-24T00:45:45.4237881Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-01-24T00:45:45.4238458Z headers = { 2025-01-24T00:45:45.4238871Z "Accept": "application/vnd.github.v3+json", 2025-01-24T00:45:45.4239431Z "Authorization": f"token {github_token}", 2025-01-24T00:45:45.4239922Z } 2025-01-24T00:45:45.4240301Z json_response: Dict[str, Any] = download_json( 2025-01-24T00:45:45.4240852Z url=f"{github_api}/issues/{pr_number}", 2025-01-24T00:45:45.4241353Z headers=headers, 2025-01-24T00:45:45.4241743Z ) 2025-01-24T00:45:45.4241921Z 2025-01-24T00:45:45.4242086Z if not json_response: 2025-01-24T00:45:45.4242608Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-01-24T00:45:45.4243173Z return {} 2025-01-24T00:45:45.4243380Z 2025-01-24T00:45:45.4243541Z return json_response 2025-01-24T00:45:45.4243797Z 2025-01-24T00:45:45.4243804Z 2025-01-24T00:45:45.4244169Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> Set[str]: 2025-01-24T00:45:45.4244841Z """ 2025-01-24T00:45:45.4245407Z Dynamically get the latest list of labels from the pull request 2025-01-24T00:45:45.4246062Z """ 2025-01-24T00:45:45.4246661Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-01-24T00:45:45.4247226Z return { 2025-01-24T00:45:45.4247749Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-01-24T00:45:45.4248395Z } 2025-01-24T00:45:45.4248572Z 2025-01-24T00:45:45.4248578Z 2025-01-24T00:45:45.4248735Z def main() -> None: 2025-01-24T00:45:45.4249117Z args = parse_args() 2025-01-24T00:45:45.4249361Z 2025-01-24T00:45:45.4249567Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-01-24T00:45:45.4249919Z 2025-01-24T00:45:45.4250094Z # Check if the PR is opt-out 2025-01-24T00:45:45.4250538Z if args.pr_number: 2025-01-24T00:45:45.4251135Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-01-24T00:45:45.4251822Z if OPT_OUT_LABEL in labels: 2025-01-24T00:45:45.4252272Z log.info( 2025-01-24T00:45:45.4252900Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-01-24T00:45:45.4253610Z ) 2025-01-24T00:45:45.4254106Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:45.4254734Z sys.exit() 2025-01-24T00:45:45.4254965Z 2025-01-24T00:45:45.4255117Z try: 2025-01-24T00:45:45.4255608Z rollout_state = get_rollout_state_from_issue( 2025-01-24T00:45:45.4256260Z args.github_token, args.github_issue_repo, args.github_issue 2025-01-24T00:45:45.4256843Z ) 2025-01-24T00:45:45.4257030Z 2025-01-24T00:45:45.4257214Z username = get_potential_pr_author( 2025-01-24T00:45:45.4257716Z args.github_token, 2025-01-24T00:45:45.4258151Z args.github_repo, 2025-01-24T00:45:45.4258582Z args.github_actor, 2025-01-24T00:45:45.4259022Z args.github_ref_type, 2025-01-24T00:45:45.4259473Z args.github_branch, 2025-01-24T00:45:45.4259892Z ) 2025-01-24T00:45:45.4260077Z 2025-01-24T00:45:45.4260348Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-01-24T00:45:45.4260766Z 2025-01-24T00:45:45.4260974Z runner_label_prefix = get_runner_prefix( 2025-01-24T00:45:45.4261471Z rollout_state, 2025-01-24T00:45:45.4262069Z (args.github_issue_owner, username), 2025-01-24T00:45:45.4262577Z args.github_branch, 2025-01-24T00:45:45.4263021Z args.eligible_experiments, 2025-01-24T00:45:45.4263480Z is_canary, 2025-01-24T00:45:45.4263851Z ) 2025-01-24T00:45:45.4264040Z 2025-01-24T00:45:45.4264208Z except Exception as e: 2025-01-24T00:45:45.4264614Z log.error( 2025-01-24T00:45:45.4265213Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-01-24T00:45:45.4266022Z ) 2025-01-24T00:45:45.4266213Z 2025-01-24T00:45:45.4266512Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-01-24T00:45:45.4266972Z 2025-01-24T00:45:45.4266979Z 2025-01-24T00:45:45.4267146Z if __name__ == "__main__": 2025-01-24T00:45:45.4267545Z main() 2025-01-24T00:45:45.4267739Z 2025-01-24T00:45:45.4354235Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:45.4355087Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-01-24T00:45:45.4383266Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:45.4383720Z env: 2025-01-24T00:45:45.4384277Z GITHUB_TOKEN: *** 2025-01-24T00:45:45.4384673Z ISSUE_NUMBER: 5132 2025-01-24T00:45:45.4385090Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:45.4385700Z ISSUE_OWNER: 2025-01-24T00:45:45.4386077Z CHECK_EXPERIMENTS: 2025-01-24T00:45:45.4386467Z PR_NUMBER: 2025-01-24T00:45:45.4386823Z ##[endgroup] 2025-01-24T00:45:45.7961731Z Defaulting to user installation because normal site-packages is not writeable 2025-01-24T00:45:46.1646378Z Collecting urllib3==1.26.18 2025-01-24T00:45:46.2261251Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-01-24T00:45:46.2517984Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.3 MB/s eta 0:00:00 2025-01-24T00:45:46.2783323Z Collecting PyGithub==2.3.0 2025-01-24T00:45:46.2902876Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-01-24T00:45:46.3421525Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-01-24T00:45:46.3497087Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-01-24T00:45:46.3542907Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-01-24T00:45:46.3560786Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-01-24T00:45:46.3575686Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-01-24T00:45:46.3875238Z Collecting Deprecated (from PyGithub==2.3.0) 2025-01-24T00:45:46.4065648Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl.metadata (5.5 kB) 2025-01-24T00:45:46.4303456Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-01-24T00:45:46.5494294Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:46.5610620Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-01-24T00:45:46.6768003Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-01-24T00:45:46.6853905Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-01-24T00:45:46.7086783Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-01-24T00:45:46.7170679Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-01-24T00:45:46.7452990Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-01-24T00:45:46.7608212Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.0 MB/s eta 0:00:00 2025-01-24T00:45:46.7714847Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-01-24T00:45:46.7965856Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 14.8 MB/s eta 0:00:00 2025-01-24T00:45:46.8050181Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-01-24T00:45:46.8526601Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 18.6 MB/s eta 0:00:00 2025-01-24T00:45:46.8613038Z Downloading Deprecated-1.2.15-py2.py3-none-any.whl (9.9 kB) 2025-01-24T00:45:46.8710495Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-01-24T00:45:46.8925562Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 23.7 MB/s eta 0:00:00 2025-01-24T00:45:46.9019042Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-01-24T00:45:46.9059791Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 31.4 MB/s eta 0:00:00 2025-01-24T00:45:46.9131819Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-01-24T00:45:46.9191449Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 25.6 MB/s eta 0:00:00 2025-01-24T00:45:47.2070280Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-01-24T00:45:47.7358044Z Successfully installed Deprecated-1.2.15 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-01-24T00:45:47.8146882Z ##[group]Run curr_branch="ciflow/trunk/145539" 2025-01-24T00:45:47.8147300Z curr_branch="ciflow/trunk/145539" 2025-01-24T00:45:47.8147600Z curr_ref_type="tag" 2025-01-24T00:45:47.8147883Z echo "Current branch is '$curr_branch'" 2025-01-24T00:45:47.8148181Z  2025-01-24T00:45:47.8148418Z python3 runner_determinator.py \ 2025-01-24T00:45:47.8148736Z  --github-token "$GITHUB_TOKEN" \ 2025-01-24T00:45:47.8149044Z  --github-issue "$ISSUE_NUMBER" \ 2025-01-24T00:45:47.8149341Z  --github-branch "$curr_branch" \ 2025-01-24T00:45:47.8149663Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-01-24T00:45:47.8149996Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-01-24T00:45:47.8150328Z  --github-ref-type "$curr_ref_type" \ 2025-01-24T00:45:47.8150642Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-01-24T00:45:47.8151087Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-01-24T00:45:47.8151453Z  --pr-number "${PR_NUMBER}" 2025-01-24T00:45:47.8179709Z shell: /usr/bin/bash -e {0} 2025-01-24T00:45:47.8179989Z env: 2025-01-24T00:45:47.8180643Z GITHUB_TOKEN: *** 2025-01-24T00:45:47.8180891Z ISSUE_NUMBER: 5132 2025-01-24T00:45:47.8181141Z TRIGGERING_ACTOR: pytorch-bot[bot] 2025-01-24T00:45:47.8181425Z ISSUE_OWNER: 2025-01-24T00:45:47.8181654Z CHECK_EXPERIMENTS: 2025-01-24T00:45:47.8181882Z PR_NUMBER: 2025-01-24T00:45:47.8182092Z ##[endgroup] 2025-01-24T00:45:47.8229928Z Current branch is 'ciflow/trunk/145539' 2025-01-24T00:45:50.2664369Z INFO : Based on rollout percentage of 55%, enabling experiment lf. 2025-01-24T00:45:50.2665807Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-01-24T00:45:50.2666506Z INFO : Setting output: label-type='lf.' 2025-01-24T00:45:50.2982578Z Evaluate and set job outputs 2025-01-24T00:45:50.2989620Z Set output 'label-type' 2025-01-24T00:45:50.2991450Z Cleaning up orphan processes