2025-03-14T03:51:41.7353966Z Current runner version: '2.322.0' 2025-03-14T03:51:41.7378285Z ##[group]Operating System 2025-03-14T03:51:41.7379277Z Ubuntu 2025-03-14T03:51:41.7379769Z 24.04.2 2025-03-14T03:51:41.7380257Z LTS 2025-03-14T03:51:41.7380754Z ##[endgroup] 2025-03-14T03:51:41.7381311Z ##[group]Runner Image 2025-03-14T03:51:41.7381873Z Image: ubuntu-24.04 2025-03-14T03:51:41.7382441Z Version: 20250309.1.0 2025-03-14T03:51:41.7383434Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250309.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-14T03:51:41.7384805Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250309.1 2025-03-14T03:51:41.7385771Z ##[endgroup] 2025-03-14T03:51:41.7386299Z ##[group]Runner Image Provisioner 2025-03-14T03:51:41.7386879Z 2.0.422.1 2025-03-14T03:51:41.7387407Z ##[endgroup] 2025-03-14T03:51:41.7388419Z ##[group]GITHUB_TOKEN Permissions 2025-03-14T03:51:41.7390576Z Contents: read 2025-03-14T03:51:41.7391138Z Metadata: read 2025-03-14T03:51:41.7391924Z ##[endgroup] 2025-03-14T03:51:41.7394913Z Secret source: Actions 2025-03-14T03:51:41.7395818Z Prepare workflow directory 2025-03-14T03:51:41.7884645Z Prepare all required actions 2025-03-14T03:51:41.7939278Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (aed0b7a742a2d7b7901790622829cbd2135049a4) 2025-03-14T03:51:41.7944078Z ##[group] Inputs 2025-03-14T03:51:41.7944772Z check_experiments: 2025-03-14T03:51:41.7945414Z triggering_actor: pytorchmergebot 2025-03-14T03:51:41.7946056Z issue_owner: 2025-03-14T03:51:41.7946600Z curr_branch: main 2025-03-14T03:51:41.7947166Z curr_ref_type: branch 2025-03-14T03:51:41.7947715Z issue_number: 5132 2025-03-14T03:51:41.7948316Z ##[endgroup] 2025-03-14T03:51:41.7949377Z Complete job name: before-test / get-label-type / runner-determinator 2025-03-14T03:51:42.3914618Z ##[group]Run cat < runner_determinator.py 2025-03-14T03:51:42.3916395Z cat < runner_determinator.py 2025-03-14T03:51:42.3917020Z # flake8: noqa: G004 2025-03-14T03:51:42.3917545Z  2025-03-14T03:51:42.3918278Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:42.3919500Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:42.3920387Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:42.3921079Z  2025-03-14T03:51:42.3921478Z """ 2025-03-14T03:51:42.3922161Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:42.3923156Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:42.3924228Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:42.3925186Z of which runners should be used to run which job. 2025-03-14T03:51:42.3925815Z  2025-03-14T03:51:42.3926475Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:42.3927803Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:42.3928923Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:42.3929698Z list, defined. 2025-03-14T03:51:42.3930166Z  2025-03-14T03:51:42.3930798Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:42.3931830Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:42.3932783Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:42.3933455Z  2025-03-14T03:51:42.3934115Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:42.3935089Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:42.3936180Z experiments which the user could be opted in to. 2025-03-14T03:51:42.3936813Z  2025-03-14T03:51:42.3937288Z The user list has the following rules: 2025-03-14T03:51:42.3937890Z  2025-03-14T03:51:42.3938760Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:42.3939879Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:42.3940776Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:42.3941403Z  2025-03-14T03:51:42.3941946Z Example config: 2025-03-14T03:51:42.3942528Z  # A list of experiments that can be opted into. 2025-03-14T03:51:42.3943305Z  # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:42.3944031Z  # Expected syntax is: 2025-03-14T03:51:42.3944799Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:42.3945879Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:42.3946709Z  2025-03-14T03:51:42.3947129Z  experiments: 2025-03-14T03:51:42.3947607Z  lf: 2025-03-14T03:51:42.3948072Z  rollout_percent: 25 2025-03-14T03:51:42.3948746Z  all_branches: false 2025-03-14T03:51:42.3949300Z  default: true 2025-03-14T03:51:42.3949799Z  --- 2025-03-14T03:51:42.3950234Z  2025-03-14T03:51:42.3950644Z  # Opt-ins: 2025-03-14T03:51:42.3951340Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:42.3952492Z  # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:42.3953391Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:42.3954166Z  # Experiments should be from the above list. 2025-03-14T03:51:42.3954777Z  2025-03-14T03:51:42.3955193Z  @User1,-lf,split_build 2025-03-14T03:51:42.3955729Z  @User2,lf 2025-03-14T03:51:42.3956210Z  @User3,split_build 2025-03-14T03:51:42.3956732Z """ 2025-03-14T03:51:42.3957149Z  2025-03-14T03:51:42.3957563Z import json 2025-03-14T03:51:42.3958088Z import logging 2025-03-14T03:51:42.3958675Z import os 2025-03-14T03:51:42.3959143Z import random 2025-03-14T03:51:42.3959612Z import re 2025-03-14T03:51:42.3960063Z import sys 2025-03-14T03:51:42.3960584Z from argparse import ArgumentParser 2025-03-14T03:51:42.3961223Z from collections.abc import Iterable 2025-03-14T03:51:42.3961849Z from functools import cache 2025-03-14T03:51:42.3962419Z from logging import LogRecord 2025-03-14T03:51:42.3963012Z from typing import Any, NamedTuple 2025-03-14T03:51:42.3963675Z from urllib.request import Request, urlopen 2025-03-14T03:51:42.3964280Z  2025-03-14T03:51:42.3964692Z import yaml 2025-03-14T03:51:42.3965184Z from github import Auth, Github 2025-03-14T03:51:42.3965775Z from github.Issue import Issue 2025-03-14T03:51:42.3966318Z  2025-03-14T03:51:42.3966709Z  2025-03-14T03:51:42.3967200Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:42.3968005Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:42.3969081Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:42.3969866Z  2025-03-14T03:51:42.3970371Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:42.3971055Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:42.3971685Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:42.3972520Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:42.3973106Z  2025-03-14T03:51:42.3973559Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:42.3974135Z  2025-03-14T03:51:42.3974559Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:42.3975120Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:42.3975645Z  2025-03-14T03:51:42.3976039Z  2025-03-14T03:51:42.3976506Z class Experiment(NamedTuple): 2025-03-14T03:51:42.3977079Z  rollout_perc: float = ( 2025-03-14T03:51:42.3977852Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:42.3978833Z  ) 2025-03-14T03:51:42.3979339Z  all_branches: bool = ( 2025-03-14T03:51:42.3980109Z  False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:42.3980908Z  ) 2025-03-14T03:51:42.3981360Z  default: bool = ( 2025-03-14T03:51:42.3982069Z  True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:42.3982791Z  ) 2025-03-14T03:51:42.3983209Z  2025-03-14T03:51:42.3983635Z  # Add more fields as needed 2025-03-14T03:51:42.3984197Z  2025-03-14T03:51:42.3984593Z  2025-03-14T03:51:42.3985024Z class Settings(NamedTuple): 2025-03-14T03:51:42.3985562Z  """ 2025-03-14T03:51:42.3986130Z  Settings for the experiments that can be opted into. 2025-03-14T03:51:42.3986788Z  """ 2025-03-14T03:51:42.3987251Z  2025-03-14T03:51:42.3987723Z  experiments: dict[str, Experiment] = {} 2025-03-14T03:51:42.3988310Z  2025-03-14T03:51:42.3989078Z  2025-03-14T03:51:42.3989587Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:42.3990326Z  """Color codes the log messages based on the log level""" 2025-03-14T03:51:42.3990996Z  2025-03-14T03:51:42.3991401Z  COLORS = { 2025-03-14T03:51:42.3991901Z  "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:42.3992502Z  "ERROR": "\033[31m", # Red 2025-03-14T03:51:42.3993080Z  "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:42.3993672Z  "INFO": "\033[0m", # Reset 2025-03-14T03:51:42.3994280Z  "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:42.3994822Z  } 2025-03-14T03:51:42.3995235Z  2025-03-14T03:51:42.3995726Z  def format(self, record: LogRecord) -> str: 2025-03-14T03:51:42.3996605Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:42.3997490Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:42.3998160Z  return super().format(record) 2025-03-14T03:51:42.3998834Z  2025-03-14T03:51:42.3999236Z  2025-03-14T03:51:42.3999687Z handler = logging.StreamHandler() 2025-03-14T03:51:42.4000533Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:42.4001331Z  2025-03-14T03:51:42.4001854Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:42.4002532Z log.addHandler(handler) 2025-03-14T03:51:42.4003079Z log.setLevel(logging.INFO) 2025-03-14T03:51:42.4003609Z  2025-03-14T03:51:42.4004011Z  2025-03-14T03:51:42.4004532Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:42.4005193Z  """ 2025-03-14T03:51:42.4005808Z  Defines outputs of the github action that invokes this script 2025-03-14T03:51:42.4006544Z  """ 2025-03-14T03:51:42.4006999Z  if not GITHUB_OUTPUT: 2025-03-14T03:51:42.4008210Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:42.4009664Z  log.warning( 2025-03-14T03:51:42.4010650Z  "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:42.4011667Z  ) 2025-03-14T03:51:42.4012184Z  print(f"::set-output name={key}::{value}") 2025-03-14T03:51:42.4012809Z  return 2025-03-14T03:51:42.4013275Z  2025-03-14T03:51:42.4013725Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:42.4014396Z  log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:42.4015057Z  f.write(f"{key}={value}\n") 2025-03-14T03:51:42.4015620Z  2025-03-14T03:51:42.4016031Z  2025-03-14T03:51:42.4016610Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:42.4017357Z  return frozenset( 2025-03-14T03:51:42.4018094Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:42.4019121Z  ) 2025-03-14T03:51:42.4019553Z  2025-03-14T03:51:42.4019944Z  2025-03-14T03:51:42.4020386Z def parse_args() -> Any: 2025-03-14T03:51:42.4021059Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:42.4022042Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:42.4022903Z  parser.add_argument( 2025-03-14T03:51:42.4023465Z  "--github-issue-repo", 2025-03-14T03:51:42.4024038Z  type=str, 2025-03-14T03:51:42.4024548Z  required=False, 2025-03-14T03:51:42.4025255Z  default="pytorch/test-infra", 2025-03-14T03:51:42.4025907Z  help="GitHub repo to get the issue", 2025-03-14T03:51:42.4026493Z  ) 2025-03-14T03:51:42.4026943Z  parser.add_argument( 2025-03-14T03:51:42.4027481Z  "--github-repo", 2025-03-14T03:51:42.4028010Z  type=str, 2025-03-14T03:51:42.4028512Z  required=True, 2025-03-14T03:51:42.4029219Z  help="GitHub repo where CI is running", 2025-03-14T03:51:42.4029838Z  ) 2025-03-14T03:51:42.4030285Z  parser.add_argument( 2025-03-14T03:51:42.4031020Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:42.4031763Z  ) 2025-03-14T03:51:42.4032209Z  parser.add_argument( 2025-03-14T03:51:42.4032966Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:42.4033734Z  ) 2025-03-14T03:51:42.4034188Z  parser.add_argument( 2025-03-14T03:51:42.4034956Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:42.4035734Z  ) 2025-03-14T03:51:42.4036179Z  parser.add_argument( 2025-03-14T03:51:42.4036970Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:42.4037761Z  ) 2025-03-14T03:51:42.4038197Z  parser.add_argument( 2025-03-14T03:51:42.4038835Z  "--github-ref-type", 2025-03-14T03:51:42.4039373Z  type=str, 2025-03-14T03:51:42.4039877Z  required=True, 2025-03-14T03:51:42.4040485Z  help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:42.4041101Z  ) 2025-03-14T03:51:42.4041547Z  parser.add_argument( 2025-03-14T03:51:42.4042106Z  "--eligible-experiments", 2025-03-14T03:51:42.4042718Z  type=_str_comma_separated_to_set, 2025-03-14T03:51:42.4043322Z  required=False, 2025-03-14T03:51:42.4043836Z  default="", 2025-03-14T03:51:42.4044956Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:42.4045975Z  ) 2025-03-14T03:51:42.4046421Z  parser.add_argument( 2025-03-14T03:51:42.4046953Z  "--pr-number", 2025-03-14T03:51:42.4047470Z  type=str, 2025-03-14T03:51:42.4047961Z  required=False, 2025-03-14T03:51:42.4048486Z  default="", 2025-03-14T03:51:42.4049176Z  help="the optional PR number where this is run", 2025-03-14T03:51:42.4049817Z  ) 2025-03-14T03:51:42.4050241Z  2025-03-14T03:51:42.4050675Z  return parser.parse_args() 2025-03-14T03:51:42.4051224Z  2025-03-14T03:51:42.4051622Z  2025-03-14T03:51:42.4052333Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:42.4053207Z  auth = Auth.Token(github_token) 2025-03-14T03:51:42.4053817Z  return Github(auth=auth) 2025-03-14T03:51:42.4054356Z  2025-03-14T03:51:42.4054743Z  2025-03-14T03:51:42.4055492Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:42.4056398Z  repo = gh.get_repo(repo) 2025-03-14T03:51:42.4057004Z  return repo.get_issue(number=issue_num) 2025-03-14T03:51:42.4057604Z  2025-03-14T03:51:42.4057998Z  2025-03-14T03:51:42.4058424Z def get_potential_pr_author( 2025-03-14T03:51:42.4059469Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:42.4060252Z ) -> str: 2025-03-14T03:51:42.4061021Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:42.4061959Z  # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:42.4062831Z  # embedded in the tag name: ciflow// 2025-03-14T03:51:42.4063486Z  2025-03-14T03:51:42.4063940Z  gh = get_gh_client(github_token) 2025-03-14T03:51:42.4064517Z  2025-03-14T03:51:42.4065062Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:42.4065784Z  split_tag = ref_name.split("/") 2025-03-14T03:51:42.4066364Z  if ( 2025-03-14T03:51:42.4066842Z  len(split_tag) == 3 2025-03-14T03:51:42.4067429Z  and split_tag[0] == "ciflow" 2025-03-14T03:51:42.4068048Z  and split_tag[2].isnumeric() 2025-03-14T03:51:42.4068816Z  ): 2025-03-14T03:51:42.4069322Z  pr_number = split_tag[2] 2025-03-14T03:51:42.4069883Z  try: 2025-03-14T03:51:42.4070415Z  repository = gh.get_repo(repo) 2025-03-14T03:51:42.4071137Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:42.4071836Z  except Exception as e: 2025-03-14T03:51:42.4072455Z  raise Exception( # noqa: TRY002 2025-03-14T03:51:42.4073223Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:42.4073951Z  ) from e 2025-03-14T03:51:42.4074603Z  return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:42.4075409Z  # In all other cases, return the original input username 2025-03-14T03:51:42.4076086Z  return username 2025-03-14T03:51:42.4076573Z  2025-03-14T03:51:42.4076950Z  2025-03-14T03:51:42.4077439Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:42.4078042Z  """ 2025-03-14T03:51:42.4078921Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:42.4079920Z  """ 2025-03-14T03:51:42.4080560Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:42.4081291Z  2025-03-14T03:51:42.4081675Z  2025-03-14T03:51:42.4082115Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:42.4082687Z  try: 2025-03-14T03:51:42.4083155Z  data = yaml.safe_load(yaml_text) 2025-03-14T03:51:42.4083724Z  return data 2025-03-14T03:51:42.4084232Z  except yaml.YAMLError: 2025-03-14T03:51:42.4084823Z  log.exception("Error loading YAML") 2025-03-14T03:51:42.4085415Z  raise 2025-03-14T03:51:42.4085866Z  2025-03-14T03:51:42.4086249Z  2025-03-14T03:51:42.4086984Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:42.4087818Z  """ 2025-03-14T03:51:42.4088645Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:42.4089503Z  2025-03-14T03:51:42.4090123Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:42.4090986Z  and the text below is the list of opted in users. 2025-03-14T03:51:42.4091613Z  2025-03-14T03:51:42.4092264Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:42.4093064Z  """ 2025-03-14T03:51:42.4093603Z  rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:42.4094280Z  if len(rollout_state_parts) >= 2: 2025-03-14T03:51:42.4095120Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:42.4095809Z  else: 2025-03-14T03:51:42.4096273Z  return "", rollout_state 2025-03-14T03:51:42.4096812Z  2025-03-14T03:51:42.4097200Z  2025-03-14T03:51:42.4097656Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:42.4098240Z  """ 2025-03-14T03:51:42.4098988Z  Dictionary of users with a list of features they have opted into 2025-03-14T03:51:42.4099711Z  """ 2025-03-14T03:51:42.4100128Z  2025-03-14T03:51:42.4100510Z  2025-03-14T03:51:42.4101115Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:42.4101858Z  """ 2025-03-14T03:51:42.4102679Z  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:42.4103604Z  2025-03-14T03:51:42.4104531Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:42.4105658Z  - Example line: "@User1,lf,split_build" 2025-03-14T03:51:42.4106476Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:42.4107183Z  2025-03-14T03:51:42.4107574Z  2025-03-14T03:51:42.4107961Z  """ 2025-03-14T03:51:42.4108400Z  optins = UserOptins() 2025-03-14T03:51:42.4109105Z  for user in user_optin_text.split("\n"): 2025-03-14T03:51:42.4109751Z  user = user.strip("\r\n\t -") 2025-03-14T03:51:42.4110402Z  if not user or not user.startswith("@"): 2025-03-14T03:51:42.4111042Z  # Not a valid user. Skip 2025-03-14T03:51:42.4111603Z  continue 2025-03-14T03:51:42.4112081Z  2025-03-14T03:51:42.4112484Z  if user: 2025-03-14T03:51:42.4113026Z  usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:42.4113811Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:42.4114532Z  2025-03-14T03:51:42.4115101Z  return optins 2025-03-14T03:51:42.4115579Z  2025-03-14T03:51:42.4115971Z  2025-03-14T03:51:42.4116544Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:42.4117241Z  """ 2025-03-14T03:51:42.4117723Z  Check if the experiment name is valid. 2025-03-14T03:51:42.4118337Z  A valid name: 2025-03-14T03:51:42.4119221Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:42.4120282Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:42.4121085Z  - Cannot contain spaces 2025-03-14T03:51:42.4121622Z  """ 2025-03-14T03:51:42.4122049Z  2025-03-14T03:51:42.4122587Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:42.4123389Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:42.4124089Z  2025-03-14T03:51:42.4124499Z  if valid: 2025-03-14T03:51:42.4124966Z  return True 2025-03-14T03:51:42.4125445Z  2025-03-14T03:51:42.4125849Z  log.error( 2025-03-14T03:51:42.4127450Z  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:42.4129232Z  ) 2025-03-14T03:51:42.4129660Z  return False 2025-03-14T03:51:42.4130124Z  2025-03-14T03:51:42.4130514Z  2025-03-14T03:51:42.4131230Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:42.4131956Z  """ 2025-03-14T03:51:42.4132652Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:42.4133441Z  """ 2025-03-14T03:51:42.4133855Z  try: 2025-03-14T03:51:42.4134293Z  if settings_text: 2025-03-14T03:51:42.4135144Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:42.4136025Z  # for easy reading 2025-03-14T03:51:42.4136943Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:42.4137941Z  # the backtick character in shell commands. 2025-03-14T03:51:42.4138741Z  backtick = chr(96) # backtick character 2025-03-14T03:51:42.4139519Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:42.4140280Z  settings = load_yaml(settings_text) 2025-03-14T03:51:42.4140863Z  2025-03-14T03:51:42.4141540Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:42.4142368Z  experiments = {} 2025-03-14T03:51:42.4142900Z  2025-03-14T03:51:42.4143542Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:42.4144396Z  if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:42.4145615Z  # 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:42.4146741Z  continue 2025-03-14T03:51:42.4147255Z  2025-03-14T03:51:42.4147701Z  valid_settings = {} 2025-03-14T03:51:42.4148317Z  for setting in exp_settings: 2025-03-14T03:51:42.4149067Z  if setting not in Experiment._fields: 2025-03-14T03:51:42.4149715Z  log.warning( 2025-03-14T03:51:42.4150658Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:42.4151441Z  ) 2025-03-14T03:51:42.4151958Z  else: 2025-03-14T03:51:42.4152589Z  valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:42.4153231Z  2025-03-14T03:51:42.4153773Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:42.4154503Z  return Settings(experiments) 2025-03-14T03:51:42.4155076Z  2025-03-14T03:51:42.4155493Z  except Exception: 2025-03-14T03:51:42.4156086Z  log.exception("Failed to parse settings") 2025-03-14T03:51:42.4156696Z  2025-03-14T03:51:42.4157111Z  return Settings() 2025-03-14T03:51:42.4157594Z  2025-03-14T03:51:42.4157991Z  2025-03-14T03:51:42.4158522Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:42.4159268Z  """ 2025-03-14T03:51:42.4159804Z  Parse settings, if any, from the rollout state. 2025-03-14T03:51:42.4160423Z  2025-03-14T03:51:42.4161043Z  If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:42.4161922Z  and the text below is the list of opted in users. 2025-03-14T03:51:42.4162551Z  2025-03-14T03:51:42.4163229Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:42.4164040Z  """ 2025-03-14T03:51:42.4164692Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:42.4165755Z  return parse_settings_from_text(settings_text) 2025-03-14T03:51:42.4166400Z  2025-03-14T03:51:42.4166789Z  2025-03-14T03:51:42.4167309Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:42.4167951Z  """ 2025-03-14T03:51:42.4168431Z  Parse users from the rollout state. 2025-03-14T03:51:42.4169112Z  2025-03-14T03:51:42.4169506Z  """ 2025-03-14T03:51:42.4170139Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:42.4170971Z  return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:42.4171586Z  2025-03-14T03:51:42.4171970Z  2025-03-14T03:51:42.4172672Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:42.4173503Z  """ 2025-03-14T03:51:42.4174008Z  Check if a user is opted into an experiment 2025-03-14T03:51:42.4174621Z  """ 2025-03-14T03:51:42.4175173Z  return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:42.4175819Z  2025-03-14T03:51:42.4176212Z  2025-03-14T03:51:42.4176920Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:42.4177757Z  """ 2025-03-14T03:51:42.4178316Z  Check if a user explicitly opted out of an experiment 2025-03-14T03:51:42.4179069Z  """ 2025-03-14T03:51:42.4179684Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:42.4180478Z  experiment_optout = "-" + experiment_name 2025-03-14T03:51:42.4181210Z  if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:42.4181881Z  return False 2025-03-14T03:51:42.4182355Z  2025-03-14T03:51:42.4182890Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:42.4183565Z  log.warning( 2025-03-14T03:51:42.4184494Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:42.4185583Z  ) 2025-03-14T03:51:42.4186002Z  2025-03-14T03:51:42.4186402Z  return True 2025-03-14T03:51:42.4186897Z  2025-03-14T03:51:42.4187286Z  2025-03-14T03:51:42.4187711Z def get_runner_prefix( 2025-03-14T03:51:42.4188239Z  rollout_state: str, 2025-03-14T03:51:42.4188901Z  workflow_requestors: Iterable[str], 2025-03-14T03:51:42.4189491Z  branch: str, 2025-03-14T03:51:42.4190092Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:42.4190765Z  is_canary: bool = False, 2025-03-14T03:51:42.4191301Z ) -> str: 2025-03-14T03:51:42.4191820Z  settings = parse_settings(rollout_state) 2025-03-14T03:51:42.4192486Z  user_optins = parse_users(rollout_state) 2025-03-14T03:51:42.4193075Z  2025-03-14T03:51:42.4193479Z  fleet_prefix = "" 2025-03-14T03:51:42.4193988Z  prefixes = [] 2025-03-14T03:51:42.4194727Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:42.4195774Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:42.4196564Z  log.info( 2025-03-14T03:51:42.4197357Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:42.4198198Z  ) 2025-03-14T03:51:42.4198755Z  continue 2025-03-14T03:51:42.4199247Z  2025-03-14T03:51:42.4199678Z  if eligible_experiments: 2025-03-14T03:51:42.4200474Z  if experiment_name not in eligible_experiments: 2025-03-14T03:51:42.4201221Z  exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:42.4201850Z  log.info( 2025-03-14T03:51:42.4202766Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:42.4203687Z  ) 2025-03-14T03:51:42.4204258Z  continue 2025-03-14T03:51:42.4204851Z  elif not experiment_settings.default: 2025-03-14T03:51:42.4205458Z  log.info( 2025-03-14T03:51:42.4206242Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:42.4207060Z  ) 2025-03-14T03:51:42.4207521Z  continue 2025-03-14T03:51:42.4208000Z  2025-03-14T03:51:42.4208649Z  # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:42.4209353Z  opted_out_users = [ 2025-03-14T03:51:42.4209907Z  requestor 2025-03-14T03:51:42.4210469Z  for requestor in workflow_requestors 2025-03-14T03:51:42.4211247Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:42.4211961Z  ] 2025-03-14T03:51:42.4212379Z  2025-03-14T03:51:42.4212797Z  if opted_out_users: 2025-03-14T03:51:42.4213333Z  log.info( 2025-03-14T03:51:42.4214064Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:42.4214851Z  ) 2025-03-14T03:51:42.4215312Z  continue 2025-03-14T03:51:42.4215787Z  2025-03-14T03:51:42.4216321Z  # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:42.4217011Z  opted_in_users = [ 2025-03-14T03:51:42.4217547Z  requestor 2025-03-14T03:51:42.4218109Z  for requestor in workflow_requestors 2025-03-14T03:51:42.4218957Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:42.4219788Z  ] 2025-03-14T03:51:42.4220219Z  2025-03-14T03:51:42.4220632Z  enabled = False 2025-03-14T03:51:42.4221165Z  if opted_in_users: 2025-03-14T03:51:42.4221694Z  log.info( 2025-03-14T03:51:42.4222416Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:42.4223175Z  ) 2025-03-14T03:51:42.4223655Z  enabled = True 2025-03-14T03:51:42.4224173Z  2025-03-14T03:51:42.4224649Z  elif experiment_settings.rollout_perc: 2025-03-14T03:51:42.4225630Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:42.4226676Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:42.4227426Z  log.info( 2025-03-14T03:51:42.4228439Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:42.4229553Z  ) 2025-03-14T03:51:42.4230060Z  enabled = True 2025-03-14T03:51:42.4230591Z  2025-03-14T03:51:42.4230995Z  if enabled: 2025-03-14T03:51:42.4231514Z  label = experiment_name 2025-03-14T03:51:42.4232169Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:42.4233119Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:42.4234264Z  # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:42.4235135Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:42.4235884Z  if is_canary: 2025-03-14T03:51:42.4236503Z  label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:42.4237140Z  fleet_prefix = label 2025-03-14T03:51:42.4237710Z  else: 2025-03-14T03:51:42.4238235Z  prefixes.append(label) 2025-03-14T03:51:42.4238908Z  2025-03-14T03:51:42.4239331Z  if len(prefixes) > 1: 2025-03-14T03:51:42.4239870Z  log.error( 2025-03-14T03:51:42.4241052Z  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:42.4242265Z  ) 2025-03-14T03:51:42.4242731Z  prefixes = prefixes[:1] 2025-03-14T03:51:42.4243296Z  2025-03-14T03:51:42.4243750Z  # Fleet always comes first 2025-03-14T03:51:42.4244310Z  if fleet_prefix: 2025-03-14T03:51:42.4244863Z  prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:42.4245442Z  2025-03-14T03:51:42.4245953Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:42.4246644Z  2025-03-14T03:51:42.4247031Z  2025-03-14T03:51:42.4247746Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:42.4248702Z  """ 2025-03-14T03:51:42.4249381Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:42.4250168Z  2025-03-14T03:51:42.4250818Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:42.4251598Z  """ 2025-03-14T03:51:42.4252076Z  gh = get_gh_client(github_token) 2025-03-14T03:51:42.4252719Z  issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:42.4253448Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:42.4254250Z  2025-03-14T03:51:42.4254643Z  2025-03-14T03:51:42.4255313Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:42.4256161Z  for _ in range(num_retries): 2025-03-14T03:51:42.4256709Z  try: 2025-03-14T03:51:42.4257226Z  req = Request(url=url, headers=headers) 2025-03-14T03:51:42.4257987Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:42.4258821Z  return json.loads(content) 2025-03-14T03:51:42.4259428Z  except Exception as e: 2025-03-14T03:51:42.4260067Z  log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:42.4260692Z  2025-03-14T03:51:42.4261345Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:42.4262139Z  return {} 2025-03-14T03:51:42.4262599Z  2025-03-14T03:51:42.4262985Z  2025-03-14T03:51:42.4333273Z @cache 2025-03-14T03:51:42.4334150Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:42.4335096Z  """ 2025-03-14T03:51:42.4335640Z  Dynamically get PR information 2025-03-14T03:51:42.4336240Z  """ 2025-03-14T03:51:42.4336823Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:42.4337522Z  headers = { 2025-03-14T03:51:42.4338082Z  "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:42.4339052Z  "Authorization": f"token {github_token}", 2025-03-14T03:51:42.4339662Z  } 2025-03-14T03:51:42.4340367Z  json_response: dict[str, Any] = download_json( 2025-03-14T03:51:42.4341085Z  url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:42.4341708Z  headers=headers, 2025-03-14T03:51:42.4342224Z  ) 2025-03-14T03:51:42.4342628Z  2025-03-14T03:51:42.4343029Z  if not json_response: 2025-03-14T03:51:42.4343692Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:42.4344391Z  return {} 2025-03-14T03:51:42.4344866Z  2025-03-14T03:51:42.4345282Z  return json_response 2025-03-14T03:51:42.4345780Z  2025-03-14T03:51:42.4346162Z  2025-03-14T03:51:42.4346813Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:42.4347605Z  """ 2025-03-14T03:51:42.4348216Z  Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:42.4349041Z  """ 2025-03-14T03:51:42.4349605Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:42.4350268Z  return { 2025-03-14T03:51:42.4350936Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:42.4351673Z  } 2025-03-14T03:51:42.4352074Z  2025-03-14T03:51:42.4352446Z  2025-03-14T03:51:42.4352851Z def main() -> None: 2025-03-14T03:51:42.4353341Z  args = parse_args() 2025-03-14T03:51:42.4353832Z  2025-03-14T03:51:42.4354304Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:42.4354898Z  2025-03-14T03:51:42.4355322Z  # Check if the PR is opt-out 2025-03-14T03:51:42.4355881Z  if args.pr_number: 2025-03-14T03:51:42.4356651Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:42.4357485Z  if OPT_OUT_LABEL in labels: 2025-03-14T03:51:42.4358046Z  log.info( 2025-03-14T03:51:42.4359086Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:42.4360087Z  ) 2025-03-14T03:51:42.4360745Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:42.4361492Z  sys.exit() 2025-03-14T03:51:42.4361972Z  2025-03-14T03:51:42.4362356Z  try: 2025-03-14T03:51:42.4362879Z  rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:42.4363671Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:42.4364353Z  ) 2025-03-14T03:51:42.4364768Z  2025-03-14T03:51:42.4365224Z  username = get_potential_pr_author( 2025-03-14T03:51:42.4365825Z  args.github_token, 2025-03-14T03:51:42.4366405Z  args.github_repo, 2025-03-14T03:51:42.4366966Z  args.github_actor, 2025-03-14T03:51:42.4367534Z  args.github_ref_type, 2025-03-14T03:51:42.4368095Z  args.github_branch, 2025-03-14T03:51:42.4369159Z  ) 2025-03-14T03:51:42.4369604Z  2025-03-14T03:51:42.4370158Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:42.4370817Z  2025-03-14T03:51:42.4371280Z  runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:42.4371892Z  rollout_state, 2025-03-14T03:51:42.4372465Z  (args.github_issue_owner, username), 2025-03-14T03:51:42.4373066Z  args.github_branch, 2025-03-14T03:51:42.4373644Z  args.eligible_experiments, 2025-03-14T03:51:42.4374210Z  is_canary, 2025-03-14T03:51:42.4374828Z  ) 2025-03-14T03:51:42.4375247Z  2025-03-14T03:51:42.4375655Z  except Exception as e: 2025-03-14T03:51:42.4376175Z  log.error( 2025-03-14T03:51:42.4376943Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:42.4377739Z  ) 2025-03-14T03:51:42.4378151Z  2025-03-14T03:51:42.4378842Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:42.4379547Z  2025-03-14T03:51:42.4379923Z  2025-03-14T03:51:42.4380319Z if __name__ == "__main__": 2025-03-14T03:51:42.4380825Z  main() 2025-03-14T03:51:42.4381249Z  2025-03-14T03:51:42.4381626Z EOF 2025-03-14T03:51:42.4382017Z  2025-03-14T03:51:42.4382430Z cat runner_determinator.py 2025-03-14T03:51:42.4695668Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:42.4696550Z env: 2025-03-14T03:51:42.4697413Z GITHUB_TOKEN: *** 2025-03-14T03:51:42.4697863Z ISSUE_NUMBER: 5132 2025-03-14T03:51:42.4698345Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:42.4699059Z ISSUE_OWNER: 2025-03-14T03:51:42.4699506Z CHECK_EXPERIMENTS: 2025-03-14T03:51:42.4699954Z PR_NUMBER: 2025-03-14T03:51:42.4700356Z ##[endgroup] 2025-03-14T03:51:42.4919218Z # flake8: noqa: G004 2025-03-14T03:51:42.4919589Z 2025-03-14T03:51:42.4920045Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-14T03:51:42.4921017Z # must be kept in sync. You can do it easily by running the following command: 2025-03-14T03:51:42.4921834Z # python .github/scripts/update_runner_determinator.py 2025-03-14T03:51:42.4922279Z 2025-03-14T03:51:42.4922450Z """ 2025-03-14T03:51:42.4923043Z This runner determinator is used to determine which set of runners to run a 2025-03-14T03:51:42.4923956Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-14T03:51:42.4924918Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-14T03:51:42.4925768Z of which runners should be used to run which job. 2025-03-14T03:51:42.4926186Z 2025-03-14T03:51:42.4926822Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-14T03:51:42.4927744Z separated by a line containing "---". If the line is not present, the 2025-03-14T03:51:42.4928874Z settings are considered to be empty with only the second part, the user 2025-03-14T03:51:42.4929614Z list, defined. 2025-03-14T03:51:42.4929869Z 2025-03-14T03:51:42.4930244Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-14T03:51:42.4931195Z used to define any settings that are needed to determine which runners to use. 2025-03-14T03:51:42.4932043Z It's fields are defined by the RolloutSettings class below. 2025-03-14T03:51:42.4932506Z 2025-03-14T03:51:42.4932896Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-14T03:51:42.4933793Z The user list is also a comma separated list of additional features or 2025-03-14T03:51:42.4934539Z experiments which the user could be opted in to. 2025-03-14T03:51:42.4934954Z 2025-03-14T03:51:42.4935169Z The user list has the following rules: 2025-03-14T03:51:42.4935529Z 2025-03-14T03:51:42.4935858Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-14T03:51:42.4936749Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-14T03:51:42.4937521Z - A "#" prefix opts the user out of all experiments 2025-03-14T03:51:42.4937921Z 2025-03-14T03:51:42.4938103Z Example config: 2025-03-14T03:51:42.4938698Z # A list of experiments that can be opted into. 2025-03-14T03:51:42.4939405Z # This defines the behavior they'll induce when opted into. 2025-03-14T03:51:42.4940050Z # Expected syntax is: 2025-03-14T03:51:42.4940713Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-14T03:51:42.4941871Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-14T03:51:42.4942504Z 2025-03-14T03:51:42.4942684Z experiments: 2025-03-14T03:51:42.4943097Z lf: 2025-03-14T03:51:42.4943503Z rollout_percent: 25 2025-03-14T03:51:42.4943982Z all_branches: false 2025-03-14T03:51:42.4944448Z default: true 2025-03-14T03:51:42.4944875Z --- 2025-03-14T03:51:42.4945096Z 2025-03-14T03:51:42.4945272Z # Opt-ins: 2025-03-14T03:51:42.4945868Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-14T03:51:42.4946765Z # and specifying experiments to enable in a comma-separated list. 2025-03-14T03:51:42.4947553Z # To always opt out of an experiment, prefix it with a "-". 2025-03-14T03:51:42.4948214Z # Experiments should be from the above list. 2025-03-14T03:51:42.4948722Z 2025-03-14T03:51:42.4948918Z @User1,-lf,split_build 2025-03-14T03:51:42.4949373Z @User2,lf 2025-03-14T03:51:42.4949787Z @User3,split_build 2025-03-14T03:51:42.4950221Z """ 2025-03-14T03:51:42.4950420Z 2025-03-14T03:51:42.4950592Z import json 2025-03-14T03:51:42.4950983Z import logging 2025-03-14T03:51:42.4951386Z import os 2025-03-14T03:51:42.4951766Z import random 2025-03-14T03:51:42.4952164Z import re 2025-03-14T03:51:42.4952546Z import sys 2025-03-14T03:51:42.4952982Z from argparse import ArgumentParser 2025-03-14T03:51:42.4953541Z from collections.abc import Iterable 2025-03-14T03:51:42.4954086Z from functools import cache 2025-03-14T03:51:42.4954583Z from logging import LogRecord 2025-03-14T03:51:42.4955095Z from typing import Any, NamedTuple 2025-03-14T03:51:42.4955657Z from urllib.request import Request, urlopen 2025-03-14T03:51:42.4956038Z 2025-03-14T03:51:42.4956217Z import yaml 2025-03-14T03:51:42.4956648Z from github import Auth, Github 2025-03-14T03:51:42.4957168Z from github.Issue import Issue 2025-03-14T03:51:42.4957492Z 2025-03-14T03:51:42.4957498Z 2025-03-14T03:51:42.4957737Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-14T03:51:42.4958448Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-14T03:51:42.4959596Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-14T03:51:42.4960320Z 2025-03-14T03:51:42.4960560Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-14T03:51:42.4961163Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-14T03:51:42.4961689Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-14T03:51:42.4962273Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-14T03:51:42.4962643Z 2025-03-14T03:51:42.4962857Z SETTING_EXPERIMENTS = "experiments" 2025-03-14T03:51:42.4963201Z 2025-03-14T03:51:42.4963407Z LF_FLEET_EXPERIMENT = "lf" 2025-03-14T03:51:42.4963884Z CANARY_FLEET_SUFFIX = ".c" 2025-03-14T03:51:42.4964190Z 2025-03-14T03:51:42.4964197Z 2025-03-14T03:51:42.4964402Z class Experiment(NamedTuple): 2025-03-14T03:51:42.4964899Z rollout_perc: float = ( 2025-03-14T03:51:42.4965558Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-14T03:51:42.4966264Z ) 2025-03-14T03:51:42.4966641Z all_branches: bool = ( 2025-03-14T03:51:42.4967289Z False # If True, the experiment is also enabled on the exception branches 2025-03-14T03:51:42.4967987Z ) 2025-03-14T03:51:42.4968370Z default: bool = ( 2025-03-14T03:51:42.4969126Z True # If True, the experiment is enabled by default for all queries 2025-03-14T03:51:42.4969795Z ) 2025-03-14T03:51:42.4970007Z 2025-03-14T03:51:42.4970194Z # Add more fields as needed 2025-03-14T03:51:42.4970512Z 2025-03-14T03:51:42.4970520Z 2025-03-14T03:51:42.4970717Z class Settings(NamedTuple): 2025-03-14T03:51:42.4971178Z """ 2025-03-14T03:51:42.4971654Z Settings for the experiments that can be opted into. 2025-03-14T03:51:42.4972244Z """ 2025-03-14T03:51:42.4972460Z 2025-03-14T03:51:42.4972680Z experiments: dict[str, Experiment] = {} 2025-03-14T03:51:42.4973062Z 2025-03-14T03:51:42.4973069Z 2025-03-14T03:51:42.4973413Z class ColorFormatter(logging.Formatter): 2025-03-14T03:51:42.4974073Z """Color codes the log messages based on the log level""" 2025-03-14T03:51:42.4974517Z 2025-03-14T03:51:42.4974695Z COLORS = { 2025-03-14T03:51:42.4975125Z "WARNING": "\033[33m", # Yellow 2025-03-14T03:51:42.4975645Z "ERROR": "\033[31m", # Red 2025-03-14T03:51:42.4976168Z "CRITICAL": "\033[31m", # Red 2025-03-14T03:51:42.4976686Z "INFO": "\033[0m", # Reset 2025-03-14T03:51:42.4977199Z "DEBUG": "\033[0m", # Reset 2025-03-14T03:51:42.4977690Z } 2025-03-14T03:51:42.4977896Z 2025-03-14T03:51:42.4978120Z def format(self, record: LogRecord) -> str: 2025-03-14T03:51:42.4978994Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-14T03:51:42.4979797Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-14T03:51:42.4980396Z return super().format(record) 2025-03-14T03:51:42.4980763Z 2025-03-14T03:51:42.4980770Z 2025-03-14T03:51:42.4980985Z handler = logging.StreamHandler() 2025-03-14T03:51:42.4981721Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-14T03:51:42.4982291Z 2025-03-14T03:51:42.4982550Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-14T03:51:42.4983155Z log.addHandler(handler) 2025-03-14T03:51:42.4983624Z log.setLevel(logging.INFO) 2025-03-14T03:51:42.4983921Z 2025-03-14T03:51:42.4983934Z 2025-03-14T03:51:42.4984190Z def set_github_output(key: str, value: str) -> None: 2025-03-14T03:51:42.4984772Z """ 2025-03-14T03:51:42.4985297Z Defines outputs of the github action that invokes this script 2025-03-14T03:51:42.4985944Z """ 2025-03-14T03:51:42.4986335Z if not GITHUB_OUTPUT: 2025-03-14T03:51:42.4987423Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-14T03:51:42.4988668Z log.warning( 2025-03-14T03:51:42.4989557Z "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:42.4990497Z ) 2025-03-14T03:51:42.5000464Z print(f"::set-output name={key}::{value}") 2025-03-14T03:51:42.5001304Z return 2025-03-14T03:51:42.5001543Z 2025-03-14T03:51:42.5001756Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-14T03:51:42.5002349Z log.info(f"Setting output: {key}='{value}'") 2025-03-14T03:51:42.5002929Z f.write(f"{key}={value}\n") 2025-03-14T03:51:42.5003270Z 2025-03-14T03:51:42.5003277Z 2025-03-14T03:51:42.5003598Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-14T03:51:42.5004252Z return frozenset( 2025-03-14T03:51:42.5004886Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-14T03:51:42.5005592Z ) 2025-03-14T03:51:42.5005799Z 2025-03-14T03:51:42.5005806Z 2025-03-14T03:51:42.5006004Z def parse_args() -> Any: 2025-03-14T03:51:42.5006576Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-14T03:51:42.5007495Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-14T03:51:42.5008300Z parser.add_argument( 2025-03-14T03:51:42.5008949Z "--github-issue-repo", 2025-03-14T03:51:42.5009438Z type=str, 2025-03-14T03:51:42.5009854Z required=False, 2025-03-14T03:51:42.5010339Z default="pytorch/test-infra", 2025-03-14T03:51:42.5010908Z help="GitHub repo to get the issue", 2025-03-14T03:51:42.5011443Z ) 2025-03-14T03:51:42.5011834Z parser.add_argument( 2025-03-14T03:51:42.5012293Z "--github-repo", 2025-03-14T03:51:42.5012746Z type=str, 2025-03-14T03:51:42.5013169Z required=True, 2025-03-14T03:51:42.5013652Z help="GitHub repo where CI is running", 2025-03-14T03:51:42.5014185Z ) 2025-03-14T03:51:42.5014565Z parser.add_argument( 2025-03-14T03:51:42.5015195Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-14T03:51:42.5016010Z ) 2025-03-14T03:51:42.5016415Z parser.add_argument( 2025-03-14T03:51:42.5017090Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-14T03:51:42.5017799Z ) 2025-03-14T03:51:42.5018188Z parser.add_argument( 2025-03-14T03:51:42.5018963Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-14T03:51:42.5019689Z ) 2025-03-14T03:51:42.5020081Z parser.add_argument( 2025-03-14T03:51:42.5020755Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-14T03:51:42.5021493Z ) 2025-03-14T03:51:42.5021891Z parser.add_argument( 2025-03-14T03:51:42.5022371Z "--github-ref-type", 2025-03-14T03:51:42.5022850Z type=str, 2025-03-14T03:51:42.5023263Z required=True, 2025-03-14T03:51:42.5023765Z help="Current GitHub ref type, branch or tag", 2025-03-14T03:51:42.5024337Z ) 2025-03-14T03:51:42.5024727Z parser.add_argument( 2025-03-14T03:51:42.5025208Z "--eligible-experiments", 2025-03-14T03:51:42.5025739Z type=_str_comma_separated_to_set, 2025-03-14T03:51:42.5026291Z required=False, 2025-03-14T03:51:42.5026732Z default="", 2025-03-14T03:51:42.5027606Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-14T03:51:42.5028699Z ) 2025-03-14T03:51:42.5029093Z parser.add_argument( 2025-03-14T03:51:42.5029592Z "--pr-number", 2025-03-14T03:51:42.5030048Z type=str, 2025-03-14T03:51:42.5030471Z required=False, 2025-03-14T03:51:42.5030905Z default="", 2025-03-14T03:51:42.5031399Z help="the optional PR number where this is run", 2025-03-14T03:51:42.5031975Z ) 2025-03-14T03:51:42.5032185Z 2025-03-14T03:51:42.5032383Z return parser.parse_args() 2025-03-14T03:51:42.5032703Z 2025-03-14T03:51:42.5032710Z 2025-03-14T03:51:42.5033143Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-14T03:51:42.5033930Z auth = Auth.Token(github_token) 2025-03-14T03:51:42.5034453Z return Github(auth=auth) 2025-03-14T03:51:42.5034763Z 2025-03-14T03:51:42.5034902Z 2025-03-14T03:51:42.5035373Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-14T03:51:42.5036210Z repo = gh.get_repo(repo) 2025-03-14T03:51:42.5036722Z return repo.get_issue(number=issue_num) 2025-03-14T03:51:42.5037095Z 2025-03-14T03:51:42.5037101Z 2025-03-14T03:51:42.5037303Z def get_potential_pr_author( 2025-03-14T03:51:42.5037959Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-14T03:51:42.5038789Z ) -> str: 2025-03-14T03:51:42.5039339Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-14T03:51:42.5040170Z # Fetch the actual username from the original PR. The PR number is 2025-03-14T03:51:42.5040941Z # embedded in the tag name: ciflow// 2025-03-14T03:51:42.5041362Z 2025-03-14T03:51:42.5041567Z gh = get_gh_client(github_token) 2025-03-14T03:51:42.5041907Z 2025-03-14T03:51:42.5042183Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-14T03:51:42.5042824Z split_tag = ref_name.split("/") 2025-03-14T03:51:42.5043350Z if ( 2025-03-14T03:51:42.5043755Z len(split_tag) == 3 2025-03-14T03:51:42.5044255Z and split_tag[0] == "ciflow" 2025-03-14T03:51:42.5044802Z and split_tag[2].isnumeric() 2025-03-14T03:51:42.5045310Z ): 2025-03-14T03:51:42.5045730Z pr_number = split_tag[2] 2025-03-14T03:51:42.5046232Z try: 2025-03-14T03:51:42.5046673Z repository = gh.get_repo(repo) 2025-03-14T03:51:42.5047303Z pull = repository.get_pull(number=int(pr_number)) 2025-03-14T03:51:42.5047919Z except Exception as e: 2025-03-14T03:51:42.5048465Z raise Exception( # noqa: TRY002 2025-03-14T03:51:42.5049428Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-14T03:51:42.5050107Z ) from e 2025-03-14T03:51:42.5050659Z return pull.user.login # type: ignore[no-any-return] 2025-03-14T03:51:42.5051370Z # In all other cases, return the original input username 2025-03-14T03:51:42.5051975Z return username 2025-03-14T03:51:42.5052227Z 2025-03-14T03:51:42.5052234Z 2025-03-14T03:51:42.5052464Z def is_exception_branch(branch: str) -> bool: 2025-03-14T03:51:42.5053019Z """ 2025-03-14T03:51:42.5053679Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-14T03:51:42.5054460Z """ 2025-03-14T03:51:42.5055024Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-14T03:51:42.5055562Z 2025-03-14T03:51:42.5055568Z 2025-03-14T03:51:42.5055769Z def load_yaml(yaml_text: str) -> Any: 2025-03-14T03:51:42.5056289Z try: 2025-03-14T03:51:42.5056700Z data = yaml.safe_load(yaml_text) 2025-03-14T03:51:42.5057230Z return data 2025-03-14T03:51:42.5057654Z except yaml.YAMLError: 2025-03-14T03:51:42.5058154Z log.exception("Error loading YAML") 2025-03-14T03:51:42.5059004Z raise 2025-03-14T03:51:42.5059243Z 2025-03-14T03:51:42.5059252Z 2025-03-14T03:51:42.5059689Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-14T03:51:42.5060451Z """ 2025-03-14T03:51:42.5061088Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-14T03:51:42.5061699Z 2025-03-14T03:51:42.5062054Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:42.5062830Z and the text below is the list of opted in users. 2025-03-14T03:51:42.5063249Z 2025-03-14T03:51:42.5063631Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-14T03:51:42.5064361Z """ 2025-03-14T03:51:42.5064830Z rollout_state_parts = rollout_state.split("---") 2025-03-14T03:51:42.5065442Z if len(rollout_state_parts) >= 2: 2025-03-14T03:51:42.5066064Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-14T03:51:42.5066822Z else: 2025-03-14T03:51:42.5067223Z return "", rollout_state 2025-03-14T03:51:42.5067538Z 2025-03-14T03:51:42.5067545Z 2025-03-14T03:51:42.5067760Z class UserOptins(dict[str, list[str]]): 2025-03-14T03:51:42.5068279Z """ 2025-03-14T03:51:42.5068951Z Dictionary of users with a list of features they have opted into 2025-03-14T03:51:42.5069619Z """ 2025-03-14T03:51:42.5069839Z 2025-03-14T03:51:42.5069847Z 2025-03-14T03:51:42.5070195Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-14T03:51:42.5070867Z """ 2025-03-14T03:51:42.5071602Z 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:42.5072298Z 2025-03-14T03:51:42.5072937Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-14T03:51:42.5073954Z - Example line: "@User1,lf,split_build" 2025-03-14T03:51:42.5074661Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-14T03:51:42.5075156Z 2025-03-14T03:51:42.5075162Z 2025-03-14T03:51:42.5075325Z """ 2025-03-14T03:51:42.5075723Z optins = UserOptins() 2025-03-14T03:51:42.5076263Z for user in user_optin_text.split("\n"): 2025-03-14T03:51:42.5076832Z user = user.strip("\r\n\t -") 2025-03-14T03:51:42.5077393Z if not user or not user.startswith("@"): 2025-03-14T03:51:42.5077963Z # Not a valid user. Skip 2025-03-14T03:51:42.5078466Z continue 2025-03-14T03:51:42.5078851Z 2025-03-14T03:51:42.5079025Z if user: 2025-03-14T03:51:42.5079470Z usr_name = user.split(",")[0].strip("@") 2025-03-14T03:51:42.5080184Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-14T03:51:42.5080831Z 2025-03-14T03:51:42.5081016Z return optins 2025-03-14T03:51:42.5081284Z 2025-03-14T03:51:42.5081292Z 2025-03-14T03:51:42.5081590Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-14T03:51:42.5082219Z """ 2025-03-14T03:51:42.5082635Z Check if the experiment name is valid. 2025-03-14T03:51:42.5083167Z A valid name: 2025-03-14T03:51:42.5083822Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-14T03:51:42.5084775Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-14T03:51:42.5085510Z - Cannot contain spaces 2025-03-14T03:51:42.5085987Z """ 2025-03-14T03:51:42.5086192Z 2025-03-14T03:51:42.5086462Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-14T03:51:42.5087192Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-14T03:51:42.5087655Z 2025-03-14T03:51:42.5087824Z if valid: 2025-03-14T03:51:42.5088229Z return True 2025-03-14T03:51:42.5088475Z 2025-03-14T03:51:42.5088755Z log.error( 2025-03-14T03:51:42.5090232Z 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:42.5091820Z ) 2025-03-14T03:51:42.5092193Z return False 2025-03-14T03:51:42.5092438Z 2025-03-14T03:51:42.5092444Z 2025-03-14T03:51:42.5092757Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-14T03:51:42.5093396Z """ 2025-03-14T03:51:42.5094009Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-14T03:51:42.5094761Z """ 2025-03-14T03:51:42.5095124Z try: 2025-03-14T03:51:42.5095515Z if settings_text: 2025-03-14T03:51:42.5096262Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-14T03:51:42.5097083Z # for easy reading 2025-03-14T03:51:42.5097894Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-14T03:51:42.5099087Z # the backtick character in shell commands. 2025-03-14T03:51:42.5099718Z backtick = chr(96) # backtick character 2025-03-14T03:51:42.5100400Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-14T03:51:42.5101080Z settings = load_yaml(settings_text) 2025-03-14T03:51:42.5101456Z 2025-03-14T03:51:42.5101876Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-14T03:51:42.5102648Z experiments = {} 2025-03-14T03:51:42.5102956Z 2025-03-14T03:51:42.5103323Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-14T03:51:42.5104095Z if not is_valid_experiment_name(exp_name): 2025-03-14T03:51:42.5105494Z # 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:42.5106572Z continue 2025-03-14T03:51:42.5106868Z 2025-03-14T03:51:42.5107066Z valid_settings = {} 2025-03-14T03:51:42.5107602Z for setting in exp_settings: 2025-03-14T03:51:42.5108177Z if setting not in Experiment._fields: 2025-03-14T03:51:42.5108866Z log.warning( 2025-03-14T03:51:42.5109591Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-14T03:51:42.5110328Z ) 2025-03-14T03:51:42.5110774Z else: 2025-03-14T03:51:42.5111301Z valid_settings[setting] = exp_settings[setting] 2025-03-14T03:51:42.5111757Z 2025-03-14T03:51:42.5112046Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-14T03:51:42.5112863Z return Settings(experiments) 2025-03-14T03:51:42.5113242Z 2025-03-14T03:51:42.5113436Z except Exception: 2025-03-14T03:51:42.5113930Z log.exception("Failed to parse settings") 2025-03-14T03:51:42.5114330Z 2025-03-14T03:51:42.5114517Z return Settings() 2025-03-14T03:51:42.5114782Z 2025-03-14T03:51:42.5114789Z 2025-03-14T03:51:42.5115040Z def parse_settings(rollout_state: str) -> Settings: 2025-03-14T03:51:42.5115620Z """ 2025-03-14T03:51:42.5116064Z Parse settings, if any, from the rollout state. 2025-03-14T03:51:42.5116486Z 2025-03-14T03:51:42.5116885Z If the issue body contains "---" then the text above that is the settings 2025-03-14T03:51:42.5117659Z and the text below is the list of opted in users. 2025-03-14T03:51:42.5118069Z 2025-03-14T03:51:42.5118527Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-14T03:51:42.5119385Z """ 2025-03-14T03:51:42.5119958Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:42.5120736Z return parse_settings_from_text(settings_text) 2025-03-14T03:51:42.5121135Z 2025-03-14T03:51:42.5121141Z 2025-03-14T03:51:42.5121411Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-14T03:51:42.5121982Z """ 2025-03-14T03:51:42.5122377Z Parse users from the rollout state. 2025-03-14T03:51:42.5122743Z 2025-03-14T03:51:42.5122907Z """ 2025-03-14T03:51:42.5123460Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-14T03:51:42.5124208Z return parse_user_opt_in_from_text(users_text) 2025-03-14T03:51:42.5124616Z 2025-03-14T03:51:42.5124623Z 2025-03-14T03:51:42.5125055Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:42.5125807Z """ 2025-03-14T03:51:42.5126233Z Check if a user is opted into an experiment 2025-03-14T03:51:42.5126781Z """ 2025-03-14T03:51:42.5127247Z return experiment_name in user_optins.get(user, []) 2025-03-14T03:51:42.5127674Z 2025-03-14T03:51:42.5127681Z 2025-03-14T03:51:42.5128111Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-14T03:51:42.5129132Z """ 2025-03-14T03:51:42.5129601Z Check if a user explicitly opted out of an experiment 2025-03-14T03:51:42.5130186Z """ 2025-03-14T03:51:42.5130712Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-14T03:51:42.5131418Z experiment_optout = "-" + experiment_name 2025-03-14T03:51:42.5132075Z if experiment_optout not in user_optins.get(user, []): 2025-03-14T03:51:42.5132691Z return False 2025-03-14T03:51:42.5132951Z 2025-03-14T03:51:42.5133228Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-14T03:51:42.5133844Z log.warning( 2025-03-14T03:51:42.5134661Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-14T03:51:42.5135568Z ) 2025-03-14T03:51:42.5135788Z 2025-03-14T03:51:42.5135965Z return True 2025-03-14T03:51:42.5136202Z 2025-03-14T03:51:42.5136208Z 2025-03-14T03:51:42.5136397Z def get_runner_prefix( 2025-03-14T03:51:42.5136850Z rollout_state: str, 2025-03-14T03:51:42.5137318Z workflow_requestors: Iterable[str], 2025-03-14T03:51:42.5137845Z branch: str, 2025-03-14T03:51:42.5138339Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-14T03:51:42.5139048Z is_canary: bool = False, 2025-03-14T03:51:42.5139515Z ) -> str: 2025-03-14T03:51:42.5139944Z settings = parse_settings(rollout_state) 2025-03-14T03:51:42.5140538Z user_optins = parse_users(rollout_state) 2025-03-14T03:51:42.5140911Z 2025-03-14T03:51:42.5141099Z fleet_prefix = "" 2025-03-14T03:51:42.5141528Z prefixes = [] 2025-03-14T03:51:42.5142172Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-14T03:51:42.5143128Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-14T03:51:42.5143973Z log.info( 2025-03-14T03:51:42.5144697Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-14T03:51:42.5145478Z ) 2025-03-14T03:51:42.5145856Z continue 2025-03-14T03:51:42.5146119Z 2025-03-14T03:51:42.5146315Z if eligible_experiments: 2025-03-14T03:51:42.5146885Z if experiment_name not in eligible_experiments: 2025-03-14T03:51:42.5147529Z exp_list = ", ".join(eligible_experiments) 2025-03-14T03:51:42.5148103Z log.info( 2025-03-14T03:51:42.5149002Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-14T03:51:42.5149856Z ) 2025-03-14T03:51:42.5150268Z continue 2025-03-14T03:51:42.5150752Z elif not experiment_settings.default: 2025-03-14T03:51:42.5151294Z log.info( 2025-03-14T03:51:42.5151961Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-14T03:51:42.5152711Z ) 2025-03-14T03:51:42.5153100Z continue 2025-03-14T03:51:42.5153357Z 2025-03-14T03:51:42.5153652Z # Is any workflow_requestor opted out to this experiment? 2025-03-14T03:51:42.5154291Z opted_out_users = [ 2025-03-14T03:51:42.5154758Z requestor 2025-03-14T03:51:42.5155219Z for requestor in workflow_requestors 2025-03-14T03:51:42.5155902Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-14T03:51:42.5156550Z ] 2025-03-14T03:51:42.5156764Z 2025-03-14T03:51:42.5156954Z if opted_out_users: 2025-03-14T03:51:42.5157418Z log.info( 2025-03-14T03:51:42.5158037Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-14T03:51:42.5158836Z ) 2025-03-14T03:51:42.5159230Z continue 2025-03-14T03:51:42.5159481Z 2025-03-14T03:51:42.5159771Z # Is any workflow_requestor opted in to this experiment? 2025-03-14T03:51:42.5160398Z opted_in_users = [ 2025-03-14T03:51:42.5160851Z requestor 2025-03-14T03:51:42.5161467Z for requestor in workflow_requestors 2025-03-14T03:51:42.5162140Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-14T03:51:42.5162794Z ] 2025-03-14T03:51:42.5163003Z 2025-03-14T03:51:42.5163190Z enabled = False 2025-03-14T03:51:42.5163636Z if opted_in_users: 2025-03-14T03:51:42.5164094Z log.info( 2025-03-14T03:51:42.5164706Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-14T03:51:42.5165404Z ) 2025-03-14T03:51:42.5165829Z enabled = True 2025-03-14T03:51:42.5166112Z 2025-03-14T03:51:42.5166348Z elif experiment_settings.rollout_perc: 2025-03-14T03:51:42.5167192Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-14T03:51:42.5168142Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-14T03:51:42.5168918Z log.info( 2025-03-14T03:51:42.5169815Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-14T03:51:42.5170771Z ) 2025-03-14T03:51:42.5171190Z enabled = True 2025-03-14T03:51:42.5171498Z 2025-03-14T03:51:42.5171673Z if enabled: 2025-03-14T03:51:42.5172107Z label = experiment_name 2025-03-14T03:51:42.5172669Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-14T03:51:42.5173507Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-14T03:51:42.5174394Z # - If it's enabled, then we always list it's prefix first 2025-03-14T03:51:42.5175285Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-14T03:51:42.5175977Z if is_canary: 2025-03-14T03:51:42.5176493Z label += CANARY_FLEET_SUFFIX 2025-03-14T03:51:42.5177048Z fleet_prefix = label 2025-03-14T03:51:42.5177554Z else: 2025-03-14T03:51:42.5177992Z prefixes.append(label) 2025-03-14T03:51:42.5178368Z 2025-03-14T03:51:42.5178661Z if len(prefixes) > 1: 2025-03-14T03:51:42.5179137Z log.error( 2025-03-14T03:51:42.5180200Z 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:42.5181351Z ) 2025-03-14T03:51:42.5181746Z prefixes = prefixes[:1] 2025-03-14T03:51:42.5182071Z 2025-03-14T03:51:42.5182270Z # Fleet always comes first 2025-03-14T03:51:42.5182759Z if fleet_prefix: 2025-03-14T03:51:42.5183223Z prefixes.insert(0, fleet_prefix) 2025-03-14T03:51:42.5183587Z 2025-03-14T03:51:42.5183856Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-14T03:51:42.5184273Z 2025-03-14T03:51:42.5184279Z 2025-03-14T03:51:42.5184734Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-14T03:51:42.5185527Z """ 2025-03-14T03:51:42.5186117Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-14T03:51:42.5186700Z 2025-03-14T03:51:42.5187095Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-14T03:51:42.5187818Z """ 2025-03-14T03:51:42.5188222Z gh = get_gh_client(github_token) 2025-03-14T03:51:42.5188872Z issue = get_issue(gh, repo, issue_num) 2025-03-14T03:51:42.5189524Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-14T03:51:42.5189981Z 2025-03-14T03:51:42.5189987Z 2025-03-14T03:51:42.5190394Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-14T03:51:42.5191175Z for _ in range(num_retries): 2025-03-14T03:51:42.5191667Z try: 2025-03-14T03:51:42.5192111Z req = Request(url=url, headers=headers) 2025-03-14T03:51:42.5192787Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-14T03:51:42.5193587Z return json.loads(content) 2025-03-14T03:51:42.5194131Z except Exception as e: 2025-03-14T03:51:42.5194684Z log.warning(f"Could not download {url}: {e}") 2025-03-14T03:51:42.5195092Z 2025-03-14T03:51:42.5195487Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-14T03:51:42.5196212Z return {} 2025-03-14T03:51:42.5196447Z 2025-03-14T03:51:42.5196454Z 2025-03-14T03:51:42.5196618Z @cache 2025-03-14T03:51:42.5197249Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-14T03:51:42.5198017Z """ 2025-03-14T03:51:42.5198414Z Dynamically get PR information 2025-03-14T03:51:42.5199027Z """ 2025-03-14T03:51:42.5199527Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-14T03:51:42.5200172Z headers = { 2025-03-14T03:51:42.5200641Z "Accept": "application/vnd.github.v3+json", 2025-03-14T03:51:42.5201263Z "Authorization": f"token {github_token}", 2025-03-14T03:51:42.5202109Z } 2025-03-14T03:51:42.5202794Z json_response: dict[str, Any] = download_json( 2025-03-14T03:51:42.5203502Z url=f"{github_api}/issues/{pr_number}", 2025-03-14T03:51:42.5204062Z headers=headers, 2025-03-14T03:51:42.5204501Z ) 2025-03-14T03:51:42.5204701Z 2025-03-14T03:51:42.5204894Z if not json_response: 2025-03-14T03:51:42.5205466Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-14T03:51:42.5206096Z return {} 2025-03-14T03:51:42.5206342Z 2025-03-14T03:51:42.5206529Z return json_response 2025-03-14T03:51:42.5206811Z 2025-03-14T03:51:42.5206818Z 2025-03-14T03:51:42.5207230Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-14T03:51:42.5208123Z """ 2025-03-14T03:51:42.5208823Z Dynamically get the latest list of labels from the pull request 2025-03-14T03:51:42.5209502Z """ 2025-03-14T03:51:42.5209995Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-14T03:51:42.5210625Z return { 2025-03-14T03:51:42.5211222Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-14T03:51:42.5211939Z } 2025-03-14T03:51:42.5212144Z 2025-03-14T03:51:42.5212151Z 2025-03-14T03:51:42.5212329Z def main() -> None: 2025-03-14T03:51:42.5212765Z args = parse_args() 2025-03-14T03:51:42.5213038Z 2025-03-14T03:51:42.5213267Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-14T03:51:42.5213655Z 2025-03-14T03:51:42.5213857Z # Check if the PR is opt-out 2025-03-14T03:51:42.5214363Z if args.pr_number: 2025-03-14T03:51:42.5215020Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-14T03:51:42.5215796Z if OPT_OUT_LABEL in labels: 2025-03-14T03:51:42.5216304Z log.info( 2025-03-14T03:51:42.5217049Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-14T03:51:42.5217835Z ) 2025-03-14T03:51:42.5218400Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:42.5219394Z sys.exit() 2025-03-14T03:51:42.5219674Z 2025-03-14T03:51:42.5219848Z try: 2025-03-14T03:51:42.5220296Z rollout_state = get_rollout_state_from_issue( 2025-03-14T03:51:42.5221016Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-14T03:51:42.5221663Z ) 2025-03-14T03:51:42.5221873Z 2025-03-14T03:51:42.5222086Z username = get_potential_pr_author( 2025-03-14T03:51:42.5222640Z args.github_token, 2025-03-14T03:51:42.5223128Z args.github_repo, 2025-03-14T03:51:42.5223607Z args.github_actor, 2025-03-14T03:51:42.5224092Z args.github_ref_type, 2025-03-14T03:51:42.5224595Z args.github_branch, 2025-03-14T03:51:42.5225062Z ) 2025-03-14T03:51:42.5225277Z 2025-03-14T03:51:42.5225562Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-14T03:51:42.5226237Z 2025-03-14T03:51:42.5226478Z runner_label_prefix = get_runner_prefix( 2025-03-14T03:51:42.5227049Z rollout_state, 2025-03-14T03:51:42.5227541Z (args.github_issue_owner, username), 2025-03-14T03:51:42.5228102Z args.github_branch, 2025-03-14T03:51:42.5228739Z args.eligible_experiments, 2025-03-14T03:51:42.5229271Z is_canary, 2025-03-14T03:51:42.5229697Z ) 2025-03-14T03:51:42.5229902Z 2025-03-14T03:51:42.5230091Z except Exception as e: 2025-03-14T03:51:42.5230555Z log.error( 2025-03-14T03:51:42.5231241Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-14T03:51:42.5232018Z ) 2025-03-14T03:51:42.5232228Z 2025-03-14T03:51:42.5232575Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-14T03:51:42.5233079Z 2025-03-14T03:51:42.5233087Z 2025-03-14T03:51:42.5233277Z if __name__ == "__main__": 2025-03-14T03:51:42.5233731Z main() 2025-03-14T03:51:42.5233949Z 2025-03-14T03:51:42.5325337Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:42.5326271Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-14T03:51:42.5373549Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:42.5374065Z env: 2025-03-14T03:51:42.5374750Z GITHUB_TOKEN: *** 2025-03-14T03:51:42.5375217Z ISSUE_NUMBER: 5132 2025-03-14T03:51:42.5375694Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:42.5376233Z ISSUE_OWNER: 2025-03-14T03:51:42.5376660Z CHECK_EXPERIMENTS: 2025-03-14T03:51:42.5377118Z PR_NUMBER: 2025-03-14T03:51:42.5377546Z ##[endgroup] 2025-03-14T03:51:42.9147785Z Defaulting to user installation because normal site-packages is not writeable 2025-03-14T03:51:43.2483361Z Collecting urllib3==1.26.18 2025-03-14T03:51:43.2814449Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-14T03:51:43.3033751Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 5.6 MB/s eta 0:00:00 2025-03-14T03:51:43.3227752Z Collecting PyGithub==2.3.0 2025-03-14T03:51:43.3266543Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-14T03:51:43.3674108Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-14T03:51:43.3704811Z 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:43.3750943Z 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:43.3769067Z 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:43.3785464Z 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:43.4021637Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-14T03:51:43.4050279Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-14T03:51:43.4277878Z 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:43.5317766Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:43.5350469Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-14T03:51:43.6364055Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-14T03:51:43.6488765Z 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:43.6666613Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-14T03:51:43.6766608Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-14T03:51:43.7026344Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-14T03:51:43.7082299Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 38.2 MB/s eta 0:00:00 2025-03-14T03:51:43.7115533Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-14T03:51:43.7182735Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 73.0 MB/s eta 0:00:00 2025-03-14T03:51:43.7218134Z 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:43.7306641Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 119.1 MB/s eta 0:00:00 2025-03-14T03:51:43.7335392Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-14T03:51:43.7386796Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-14T03:51:43.7460232Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 81.2 MB/s eta 0:00:00 2025-03-14T03:51:43.7491435Z 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:43.7530925Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 33.0 MB/s eta 0:00:00 2025-03-14T03:51:43.7564119Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-14T03:51:43.7606448Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 42.9 MB/s eta 0:00:00 2025-03-14T03:51:44.0493633Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-14T03:51:44.5958972Z 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:44.6707540Z ##[group]Run curr_branch="main" 2025-03-14T03:51:44.6707888Z curr_branch="main" 2025-03-14T03:51:44.6708126Z curr_ref_type="branch" 2025-03-14T03:51:44.6708395Z echo "Current branch is '$curr_branch'" 2025-03-14T03:51:44.6708845Z  2025-03-14T03:51:44.6709055Z python3 runner_determinator.py \ 2025-03-14T03:51:44.6709366Z  --github-token "$GITHUB_TOKEN" \ 2025-03-14T03:51:44.6709673Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-14T03:51:44.6710007Z  --github-branch "$curr_branch" \ 2025-03-14T03:51:44.6710289Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-14T03:51:44.6710587Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-14T03:51:44.6710877Z  --github-ref-type "$curr_ref_type" \ 2025-03-14T03:51:44.6711174Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-14T03:51:44.6711527Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-14T03:51:44.6711875Z  --pr-number "${PR_NUMBER}" 2025-03-14T03:51:44.6760505Z shell: /usr/bin/bash -e {0} 2025-03-14T03:51:44.6760750Z env: 2025-03-14T03:51:44.6761315Z GITHUB_TOKEN: *** 2025-03-14T03:51:44.6761525Z ISSUE_NUMBER: 5132 2025-03-14T03:51:44.6761746Z TRIGGERING_ACTOR: pytorchmergebot 2025-03-14T03:51:44.6761991Z ISSUE_OWNER: 2025-03-14T03:51:44.6762191Z CHECK_EXPERIMENTS: 2025-03-14T03:51:44.6762388Z PR_NUMBER: 2025-03-14T03:51:44.6762561Z ##[endgroup] 2025-03-14T03:51:44.6827714Z Current branch is 'main' 2025-03-14T03:51:45.8109887Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-03-14T03:51:45.8110798Z INFO : Setting output: label-type='' 2025-03-14T03:51:45.8414556Z Evaluate and set job outputs 2025-03-14T03:51:45.8421829Z Cleaning up orphan processes