2025-03-04T19:52:48.7142811Z Current runner version: '2.322.0' 2025-03-04T19:52:48.7170235Z ##[group]Operating System 2025-03-04T19:52:48.7171061Z Ubuntu 2025-03-04T19:52:48.7171655Z 24.04.2 2025-03-04T19:52:48.7172134Z LTS 2025-03-04T19:52:48.7172617Z ##[endgroup] 2025-03-04T19:52:48.7173444Z ##[group]Runner Image 2025-03-04T19:52:48.7174060Z Image: ubuntu-24.04 2025-03-04T19:52:48.7174577Z Version: 20250223.1.0 2025-03-04T19:52:48.7175700Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250223.1/images/ubuntu/Ubuntu2404-Readme.md 2025-03-04T19:52:48.7177265Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250223.1 2025-03-04T19:52:48.7178191Z ##[endgroup] 2025-03-04T19:52:48.7178831Z ##[group]Runner Image Provisioner 2025-03-04T19:52:48.7179430Z 2.0.422.1 2025-03-04T19:52:48.7179953Z ##[endgroup] 2025-03-04T19:52:48.7181219Z ##[group]GITHUB_TOKEN Permissions 2025-03-04T19:52:48.7183303Z Contents: read 2025-03-04T19:52:48.7184210Z Metadata: read 2025-03-04T19:52:48.7184963Z ##[endgroup] 2025-03-04T19:52:48.7283804Z Secret source: Actions 2025-03-04T19:52:48.7287707Z Prepare workflow directory 2025-03-04T19:52:48.7824172Z Prepare all required actions 2025-03-04T19:52:48.7877949Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (92beda54c8707d476ea8bc193ce79a37653d2e49) 2025-03-04T19:52:48.7882759Z ##[group] Inputs 2025-03-04T19:52:48.7883295Z check_experiments: 2025-03-04T19:52:48.7883797Z triggering_actor: williamwen42 2025-03-04T19:52:48.7884374Z issue_owner: williamwen42 2025-03-04T19:52:48.7884933Z curr_branch: gh/williamwen42/215/head 2025-03-04T19:52:48.7885533Z curr_ref_type: branch 2025-03-04T19:52:48.7886040Z issue_number: 5132 2025-03-04T19:52:48.7886777Z ##[endgroup] 2025-03-04T19:52:48.7887414Z Complete job name: before-test / get-label-type / runner-determinator 2025-03-04T19:52:49.4235776Z ##[group]Run cat < runner_determinator.py 2025-03-04T19:52:49.4237712Z cat < runner_determinator.py 2025-03-04T19:52:49.4238373Z # flake8: noqa: G004 2025-03-04T19:52:49.4238866Z  2025-03-04T19:52:49.4239539Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:52:49.4240550Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:52:49.4241421Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:52:49.4242082Z  2025-03-04T19:52:49.4242492Z """ 2025-03-04T19:52:49.4243147Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:52:49.4244090Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:52:49.4245104Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:52:49.4246002Z of which runners should be used to run which job. 2025-03-04T19:52:49.4246726Z  2025-03-04T19:52:49.4247355Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:52:49.4248319Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:52:49.4249267Z settings are considered to be empty with only the second part, the user 2025-03-04T19:52:49.4250034Z list, defined. 2025-03-04T19:52:49.4250470Z  2025-03-04T19:52:49.4251077Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:52:49.4252061Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:52:49.4252978Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:52:49.4253619Z  2025-03-04T19:52:49.4254230Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:52:49.4255160Z The user list is also a comma separated list of additional features or 2025-03-04T19:52:49.4256224Z experiments which the user could be opted in to. 2025-03-04T19:52:49.4256976Z  2025-03-04T19:52:49.4257461Z The user list has the following rules: 2025-03-04T19:52:49.4258053Z  2025-03-04T19:52:49.4258651Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:52:49.4259579Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:52:49.4260433Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:52:49.4261090Z  2025-03-04T19:52:49.4261619Z Example config: 2025-03-04T19:52:49.4262145Z  # A list of experiments that can be opted into. 2025-03-04T19:52:49.4262901Z  # This defines the behavior they'll induce when opted into. 2025-03-04T19:52:49.4263601Z  # Expected syntax is: 2025-03-04T19:52:49.4264352Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:52:49.4265393Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:52:49.4266207Z  2025-03-04T19:52:49.4266740Z  experiments: 2025-03-04T19:52:49.4267191Z  lf: 2025-03-04T19:52:49.4267602Z  rollout_percent: 25 2025-03-04T19:52:49.4268155Z  all_branches: false 2025-03-04T19:52:49.4268697Z  default: true 2025-03-04T19:52:49.4269153Z  --- 2025-03-04T19:52:49.4269533Z  2025-03-04T19:52:49.4269888Z  # Opt-ins: 2025-03-04T19:52:49.4270545Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:52:49.4271649Z  # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:52:49.4272510Z  # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:52:49.4273256Z  # Experiments should be from the above list. 2025-03-04T19:52:49.4273861Z  2025-03-04T19:52:49.4274246Z  @User1,-lf,split_build 2025-03-04T19:52:49.4274761Z  @User2,lf 2025-03-04T19:52:49.4275199Z  @User3,split_build 2025-03-04T19:52:49.4275708Z """ 2025-03-04T19:52:49.4276148Z  2025-03-04T19:52:49.4276737Z import json 2025-03-04T19:52:49.4277206Z import logging 2025-03-04T19:52:49.4277691Z import os 2025-03-04T19:52:49.4278158Z import random 2025-03-04T19:52:49.4278632Z import re 2025-03-04T19:52:49.4279082Z import sys 2025-03-04T19:52:49.4279582Z from argparse import ArgumentParser 2025-03-04T19:52:49.4280193Z from collections.abc import Iterable 2025-03-04T19:52:49.4280798Z from functools import cache 2025-03-04T19:52:49.4281329Z from logging import LogRecord 2025-03-04T19:52:49.4281919Z from typing import Any, NamedTuple 2025-03-04T19:52:49.4282533Z from urllib.request import Request, urlopen 2025-03-04T19:52:49.4283127Z  2025-03-04T19:52:49.4283507Z import yaml 2025-03-04T19:52:49.4283950Z from github import Auth, Github 2025-03-04T19:52:49.4284522Z from github.Issue import Issue 2025-03-04T19:52:49.4285060Z  2025-03-04T19:52:49.4285448Z  2025-03-04T19:52:49.4285887Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:52:49.4286742Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:52:49.4287681Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:52:49.4288443Z  2025-03-04T19:52:49.4288946Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:52:49.4289593Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:52:49.4290240Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:52:49.4291004Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:52:49.4291595Z  2025-03-04T19:52:49.4291990Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:52:49.4292555Z  2025-03-04T19:52:49.4292992Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:52:49.4293545Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:52:49.4294066Z  2025-03-04T19:52:49.4294456Z  2025-03-04T19:52:49.4294842Z class Experiment(NamedTuple): 2025-03-04T19:52:49.4295378Z  rollout_perc: float = ( 2025-03-04T19:52:49.4296092Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:52:49.4296936Z  ) 2025-03-04T19:52:49.4297382Z  all_branches: bool = ( 2025-03-04T19:52:49.4298109Z  False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:52:49.4298860Z  ) 2025-03-04T19:52:49.4299259Z  default: bool = ( 2025-03-04T19:52:49.4299889Z  True # If True, the experiment is enabled by default for all queries 2025-03-04T19:52:49.4300590Z  ) 2025-03-04T19:52:49.4300989Z  2025-03-04T19:52:49.4301369Z  # Add more fields as needed 2025-03-04T19:52:49.4301868Z  2025-03-04T19:52:49.4302219Z  2025-03-04T19:52:49.4302600Z class Settings(NamedTuple): 2025-03-04T19:52:49.4303139Z  """ 2025-03-04T19:52:49.4303658Z  Settings for the experiments that can be opted into. 2025-03-04T19:52:49.4304293Z  """ 2025-03-04T19:52:49.4304669Z  2025-03-04T19:52:49.4305094Z  experiments: dict[str, Experiment] = {} 2025-03-04T19:52:49.4305639Z  2025-03-04T19:52:49.4306114Z  2025-03-04T19:52:49.4306644Z class ColorFormatter(logging.Formatter): 2025-03-04T19:52:49.4307312Z  """Color codes the log messages based on the log level""" 2025-03-04T19:52:49.4307966Z  2025-03-04T19:52:49.4308340Z  COLORS = { 2025-03-04T19:52:49.4308812Z  "WARNING": "\033[33m", # Yellow 2025-03-04T19:52:49.4309377Z  "ERROR": "\033[31m", # Red 2025-03-04T19:52:49.4309898Z  "CRITICAL": "\033[31m", # Red 2025-03-04T19:52:49.4310477Z  "INFO": "\033[0m", # Reset 2025-03-04T19:52:49.4311053Z  "DEBUG": "\033[0m", # Reset 2025-03-04T19:52:49.4311593Z  } 2025-03-04T19:52:49.4311954Z  2025-03-04T19:52:49.4312391Z  def format(self, record: LogRecord) -> str: 2025-03-04T19:52:49.4313201Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:52:49.4314075Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:52:49.4314719Z  return super().format(record) 2025-03-04T19:52:49.4315237Z  2025-03-04T19:52:49.4315589Z  2025-03-04T19:52:49.4315985Z handler = logging.StreamHandler() 2025-03-04T19:52:49.4316922Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:52:49.4317693Z  2025-03-04T19:52:49.4318202Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:52:49.4318819Z log.addHandler(handler) 2025-03-04T19:52:49.4319304Z log.setLevel(logging.INFO) 2025-03-04T19:52:49.4319796Z  2025-03-04T19:52:49.4320142Z  2025-03-04T19:52:49.4320610Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:52:49.4321242Z  """ 2025-03-04T19:52:49.4321792Z  Defines outputs of the github action that invokes this script 2025-03-04T19:52:49.4322490Z  """ 2025-03-04T19:52:49.4322899Z  if not GITHUB_OUTPUT: 2025-03-04T19:52:49.4324022Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:52:49.4325307Z  log.warning( 2025-03-04T19:52:49.4326245Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:52:49.4327316Z  ) 2025-03-04T19:52:49.4327794Z  print(f"::set-output name={key}::{value}") 2025-03-04T19:52:49.4328368Z  return 2025-03-04T19:52:49.4328785Z  2025-03-04T19:52:49.4329186Z  with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:52:49.4329805Z  log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:52:49.4330407Z  f.write(f"{key}={value}\n") 2025-03-04T19:52:49.4330966Z  2025-03-04T19:52:49.4331377Z  2025-03-04T19:52:49.4331938Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:52:49.4332617Z  return frozenset( 2025-03-04T19:52:49.4333341Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:52:49.4334077Z  ) 2025-03-04T19:52:49.4334484Z  2025-03-04T19:52:49.4334832Z  2025-03-04T19:52:49.4335202Z def parse_args() -> Any: 2025-03-04T19:52:49.4335863Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:52:49.4337229Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:52:49.4338025Z  parser.add_argument( 2025-03-04T19:52:49.4338583Z  "--github-issue-repo", 2025-03-04T19:52:49.4339134Z  type=str, 2025-03-04T19:52:49.4339590Z  required=False, 2025-03-04T19:52:49.4340266Z  default="pytorch/test-infra", 2025-03-04T19:52:49.4340902Z  help="GitHub repo to get the issue", 2025-03-04T19:52:49.4341486Z  ) 2025-03-04T19:52:49.4341931Z  parser.add_argument( 2025-03-04T19:52:49.4342470Z  "--github-repo", 2025-03-04T19:52:49.4342942Z  type=str, 2025-03-04T19:52:49.4343380Z  required=True, 2025-03-04T19:52:49.4343944Z  help="GitHub repo where CI is running", 2025-03-04T19:52:49.4344525Z  ) 2025-03-04T19:52:49.4344927Z  parser.add_argument( 2025-03-04T19:52:49.4345631Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:52:49.4346425Z  ) 2025-03-04T19:52:49.4346826Z  parser.add_argument( 2025-03-04T19:52:49.4347523Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:52:49.4348211Z  ) 2025-03-04T19:52:49.4348606Z  parser.add_argument( 2025-03-04T19:52:49.4349337Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:52:49.4350082Z  ) 2025-03-04T19:52:49.4350509Z  parser.add_argument( 2025-03-04T19:52:49.4351236Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:52:49.4351990Z  ) 2025-03-04T19:52:49.4352413Z  parser.add_argument( 2025-03-04T19:52:49.4352952Z  "--github-ref-type", 2025-03-04T19:52:49.4353462Z  type=str, 2025-03-04T19:52:49.4353904Z  required=True, 2025-03-04T19:52:49.4354496Z  help="Current GitHub ref type, branch or tag", 2025-03-04T19:52:49.4355236Z  ) 2025-03-04T19:52:49.4355643Z  parser.add_argument( 2025-03-04T19:52:49.4356155Z  "--eligible-experiments", 2025-03-04T19:52:49.4356870Z  type=_str_comma_separated_to_set, 2025-03-04T19:52:49.4357423Z  required=False, 2025-03-04T19:52:49.4358168Z  default="", 2025-03-04T19:52:49.4359103Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:52:49.4360038Z  ) 2025-03-04T19:52:49.4360437Z  parser.add_argument( 2025-03-04T19:52:49.4360957Z  "--pr-number", 2025-03-04T19:52:49.4361476Z  type=str, 2025-03-04T19:52:49.4361973Z  required=False, 2025-03-04T19:52:49.4362490Z  default="", 2025-03-04T19:52:49.4363073Z  help="the optional PR number where this is run", 2025-03-04T19:52:49.4363641Z  ) 2025-03-04T19:52:49.4364006Z  2025-03-04T19:52:49.4364386Z  return parser.parse_args() 2025-03-04T19:52:49.4364926Z  2025-03-04T19:52:49.4365276Z  2025-03-04T19:52:49.4365909Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:52:49.4366776Z  auth = Auth.Token(github_token) 2025-03-04T19:52:49.4367366Z  return Github(auth=auth) 2025-03-04T19:52:49.4367902Z  2025-03-04T19:52:49.4368257Z  2025-03-04T19:52:49.4368942Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:52:49.4369750Z  repo = gh.get_repo(repo) 2025-03-04T19:52:49.4370313Z  return repo.get_issue(number=issue_num) 2025-03-04T19:52:49.4370892Z  2025-03-04T19:52:49.4371292Z  2025-03-04T19:52:49.4371682Z def get_potential_pr_author( 2025-03-04T19:52:49.4372396Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:52:49.4373100Z ) -> str: 2025-03-04T19:52:49.4373789Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:52:49.4374665Z  # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:52:49.4375481Z  # embedded in the tag name: ciflow// 2025-03-04T19:52:49.4376113Z  2025-03-04T19:52:49.4376610Z  gh = get_gh_client(github_token) 2025-03-04T19:52:49.4377170Z  2025-03-04T19:52:49.4377685Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:52:49.4378324Z  split_tag = ref_name.split("/") 2025-03-04T19:52:49.4378900Z  if ( 2025-03-04T19:52:49.4379381Z  len(split_tag) == 3 2025-03-04T19:52:49.4379912Z  and split_tag[0] == "ciflow" 2025-03-04T19:52:49.4380464Z  and split_tag[2].isnumeric() 2025-03-04T19:52:49.4381038Z  ): 2025-03-04T19:52:49.4381472Z  pr_number = split_tag[2] 2025-03-04T19:52:49.4381986Z  try: 2025-03-04T19:52:49.4382496Z  repository = gh.get_repo(repo) 2025-03-04T19:52:49.4383191Z  pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:52:49.4383868Z  except Exception as e: 2025-03-04T19:52:49.4384467Z  raise Exception( # noqa: TRY002 2025-03-04T19:52:49.4385184Z  f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:52:49.4385891Z  ) from e 2025-03-04T19:52:49.4386612Z  return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:52:49.4387372Z  # In all other cases, return the original input username 2025-03-04T19:52:49.4387972Z  return username 2025-03-04T19:52:49.4388397Z  2025-03-04T19:52:49.4388746Z  2025-03-04T19:52:49.4389178Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:52:49.4389753Z  """ 2025-03-04T19:52:49.4390449Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:52:49.4391358Z  """ 2025-03-04T19:52:49.4391945Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:52:49.4392610Z  2025-03-04T19:52:49.4392955Z  2025-03-04T19:52:49.4393345Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:52:49.4393866Z  try: 2025-03-04T19:52:49.4394281Z  data = yaml.safe_load(yaml_text) 2025-03-04T19:52:49.4394804Z  return data 2025-03-04T19:52:49.4395264Z  except yaml.YAMLError: 2025-03-04T19:52:49.4395799Z  log.exception("Error loading YAML") 2025-03-04T19:52:49.4396442Z  raise 2025-03-04T19:52:49.4396845Z  2025-03-04T19:52:49.4397184Z  2025-03-04T19:52:49.4397835Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:52:49.4398598Z  """ 2025-03-04T19:52:49.4399265Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:52:49.4399995Z  2025-03-04T19:52:49.4400586Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:52:49.4401365Z  and the text below is the list of opted in users. 2025-03-04T19:52:49.4401929Z  2025-03-04T19:52:49.4402533Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:52:49.4403253Z  """ 2025-03-04T19:52:49.4403730Z  rollout_state_parts = rollout_state.split("---") 2025-03-04T19:52:49.4404386Z  if len(rollout_state_parts) >= 2: 2025-03-04T19:52:49.4405165Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:52:49.4405820Z  else: 2025-03-04T19:52:49.4406282Z  return "", rollout_state 2025-03-04T19:52:49.4406911Z  2025-03-04T19:52:49.4407311Z  2025-03-04T19:52:49.4407817Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:52:49.4408684Z  """ 2025-03-04T19:52:49.4409362Z  Dictionary of users with a list of features they have opted into 2025-03-04T19:52:49.4410074Z  """ 2025-03-04T19:52:49.4410432Z  2025-03-04T19:52:49.4410775Z  2025-03-04T19:52:49.4411319Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:52:49.4412051Z  """ 2025-03-04T19:52:49.4412819Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:52:49.4413654Z  2025-03-04T19:52:49.4414481Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:52:49.4415511Z  - Example line: "@User1,lf,split_build" 2025-03-04T19:52:49.4416219Z  - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:52:49.4417086Z  2025-03-04T19:52:49.4417434Z  2025-03-04T19:52:49.4417780Z  """ 2025-03-04T19:52:49.4418183Z  optins = UserOptins() 2025-03-04T19:52:49.4418720Z  for user in user_optin_text.split("\n"): 2025-03-04T19:52:49.4419311Z  user = user.strip("\r\n\t -") 2025-03-04T19:52:49.4419908Z  if not user or not user.startswith("@"): 2025-03-04T19:52:49.4420505Z  # Not a valid user. Skip 2025-03-04T19:52:49.4421048Z  continue 2025-03-04T19:52:49.4421475Z  2025-03-04T19:52:49.4421832Z  if user: 2025-03-04T19:52:49.4422324Z  usr_name = user.split(",")[0].strip("@") 2025-03-04T19:52:49.4423100Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:52:49.4423994Z  2025-03-04T19:52:49.4424351Z  return optins 2025-03-04T19:52:49.4424778Z  2025-03-04T19:52:49.4425114Z  2025-03-04T19:52:49.4425615Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:52:49.4426240Z  """ 2025-03-04T19:52:49.4426794Z  Check if the experiment name is valid. 2025-03-04T19:52:49.4427387Z  A valid name: 2025-03-04T19:52:49.4428096Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:52:49.4429072Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:52:49.4429835Z  - Cannot contain spaces 2025-03-04T19:52:49.4430325Z  """ 2025-03-04T19:52:49.4430692Z  2025-03-04T19:52:49.4431162Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:52:49.4431906Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:52:49.4432548Z  2025-03-04T19:52:49.4432899Z  if valid: 2025-03-04T19:52:49.4433330Z  return True 2025-03-04T19:52:49.4433758Z  2025-03-04T19:52:49.4434110Z  log.error( 2025-03-04T19:52:49.4435550Z  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-04T19:52:49.4437151Z  ) 2025-03-04T19:52:49.4437528Z  return False 2025-03-04T19:52:49.4437940Z  2025-03-04T19:52:49.4438284Z  2025-03-04T19:52:49.4438945Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:52:49.4439598Z  """ 2025-03-04T19:52:49.4440212Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:52:49.4440944Z  """ 2025-03-04T19:52:49.4441314Z  try: 2025-03-04T19:52:49.4441706Z  if settings_text: 2025-03-04T19:52:49.4442503Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:52:49.4443309Z  # for easy reading 2025-03-04T19:52:49.4444166Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:52:49.4445057Z  # the backtick character in shell commands. 2025-03-04T19:52:49.4445733Z  backtick = chr(96) # backtick character 2025-03-04T19:52:49.4446567Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:52:49.4447270Z  settings = load_yaml(settings_text) 2025-03-04T19:52:49.4447848Z  2025-03-04T19:52:49.4448470Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:52:49.4449256Z  experiments = {} 2025-03-04T19:52:49.4449733Z  2025-03-04T19:52:49.4450317Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:52:49.4451106Z  if not is_valid_experiment_name(exp_name): 2025-03-04T19:52:49.4452202Z  # 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-04T19:52:49.4453230Z  continue 2025-03-04T19:52:49.4453685Z  2025-03-04T19:52:49.4454098Z  valid_settings = {} 2025-03-04T19:52:49.4454648Z  for setting in exp_settings: 2025-03-04T19:52:49.4455245Z  if setting not in Experiment._fields: 2025-03-04T19:52:49.4455971Z  log.warning( 2025-03-04T19:52:49.4457023Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:52:49.4457769Z  ) 2025-03-04T19:52:49.4458265Z  else: 2025-03-04T19:52:49.4458851Z  valid_settings[setting] = exp_settings[setting] 2025-03-04T19:52:49.4459439Z  2025-03-04T19:52:49.4459921Z  experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:52:49.4460589Z  return Settings(experiments) 2025-03-04T19:52:49.4461153Z  2025-03-04T19:52:49.4461522Z  except Exception: 2025-03-04T19:52:49.4462054Z  log.exception("Failed to parse settings") 2025-03-04T19:52:49.4462659Z  2025-03-04T19:52:49.4463051Z  return Settings() 2025-03-04T19:52:49.4463486Z  2025-03-04T19:52:49.4463833Z  2025-03-04T19:52:49.4464298Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:52:49.4464875Z  """ 2025-03-04T19:52:49.4465341Z  Parse settings, if any, from the rollout state. 2025-03-04T19:52:49.4465895Z  2025-03-04T19:52:49.4466574Z  If the issue body contains "---" then the text above that is the settings 2025-03-04T19:52:49.4467377Z  and the text below is the list of opted in users. 2025-03-04T19:52:49.4467957Z  2025-03-04T19:52:49.4468594Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:52:49.4469362Z  """ 2025-03-04T19:52:49.4469964Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:52:49.4470971Z  return parse_settings_from_text(settings_text) 2025-03-04T19:52:49.4471553Z  2025-03-04T19:52:49.4471901Z  2025-03-04T19:52:49.4472371Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:52:49.4472947Z  """ 2025-03-04T19:52:49.4473370Z  Parse users from the rollout state. 2025-03-04T19:52:49.4473890Z  2025-03-04T19:52:49.4474235Z  """ 2025-03-04T19:52:49.4474820Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:52:49.4475580Z  return parse_user_opt_in_from_text(users_text) 2025-03-04T19:52:49.4476144Z  2025-03-04T19:52:49.4476615Z  2025-03-04T19:52:49.4477249Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:52:49.4478044Z  """ 2025-03-04T19:52:49.4478504Z  Check if a user is opted into an experiment 2025-03-04T19:52:49.4479093Z  """ 2025-03-04T19:52:49.4479637Z  return experiment_name in user_optins.get(user, []) 2025-03-04T19:52:49.4480263Z  2025-03-04T19:52:49.4480602Z  2025-03-04T19:52:49.4481233Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:52:49.4481987Z  """ 2025-03-04T19:52:49.4482481Z  Check if a user explicitly opted out of an experiment 2025-03-04T19:52:49.4483087Z  """ 2025-03-04T19:52:49.4483618Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:52:49.4484418Z  experiment_optout = "-" + experiment_name 2025-03-04T19:52:49.4562040Z  if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:52:49.4562833Z  return False 2025-03-04T19:52:49.4563331Z  2025-03-04T19:52:49.4563901Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:52:49.4564580Z  log.warning( 2025-03-04T19:52:49.4565451Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:52:49.4566680Z  ) 2025-03-04T19:52:49.4567067Z  2025-03-04T19:52:49.4567428Z  return True 2025-03-04T19:52:49.4567846Z  2025-03-04T19:52:49.4568176Z  2025-03-04T19:52:49.4568547Z def get_runner_prefix( 2025-03-04T19:52:49.4569081Z  rollout_state: str, 2025-03-04T19:52:49.4569600Z  workflow_requestors: Iterable[str], 2025-03-04T19:52:49.4570182Z  branch: str, 2025-03-04T19:52:49.4570732Z  eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:52:49.4571395Z  is_canary: bool = False, 2025-03-04T19:52:49.4571890Z ) -> str: 2025-03-04T19:52:49.4572359Z  settings = parse_settings(rollout_state) 2025-03-04T19:52:49.4573012Z  user_optins = parse_users(rollout_state) 2025-03-04T19:52:49.4573548Z  2025-03-04T19:52:49.4573911Z  fleet_prefix = "" 2025-03-04T19:52:49.4574413Z  prefixes = [] 2025-03-04T19:52:49.4575122Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:52:49.4576116Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:52:49.4577176Z  log.info( 2025-03-04T19:52:49.4577932Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:52:49.4578728Z  ) 2025-03-04T19:52:49.4579152Z  continue 2025-03-04T19:52:49.4579575Z  2025-03-04T19:52:49.4579959Z  if eligible_experiments: 2025-03-04T19:52:49.4580714Z  if experiment_name not in eligible_experiments: 2025-03-04T19:52:49.4581372Z  exp_list = ", ".join(eligible_experiments) 2025-03-04T19:52:49.4581978Z  log.info( 2025-03-04T19:52:49.4582805Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:52:49.4583674Z  ) 2025-03-04T19:52:49.4584144Z  continue 2025-03-04T19:52:49.4584695Z  elif not experiment_settings.default: 2025-03-04T19:52:49.4585241Z  log.info( 2025-03-04T19:52:49.4585988Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:52:49.4587309Z  ) 2025-03-04T19:52:49.4587721Z  continue 2025-03-04T19:52:49.4588193Z  2025-03-04T19:52:49.4588687Z  # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:52:49.4589350Z  opted_out_users = [ 2025-03-04T19:52:49.4589886Z  requestor 2025-03-04T19:52:49.4590444Z  for requestor in workflow_requestors 2025-03-04T19:52:49.4591181Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:52:49.4591872Z  ] 2025-03-04T19:52:49.4592296Z  2025-03-04T19:52:49.4592716Z  if opted_out_users: 2025-03-04T19:52:49.4593216Z  log.info( 2025-03-04T19:52:49.4593920Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:52:49.4594656Z  ) 2025-03-04T19:52:49.4595117Z  continue 2025-03-04T19:52:49.4595597Z  2025-03-04T19:52:49.4596081Z  # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:52:49.4596824Z  opted_in_users = [ 2025-03-04T19:52:49.4597317Z  requestor 2025-03-04T19:52:49.4597836Z  for requestor in workflow_requestors 2025-03-04T19:52:49.4598567Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:52:49.4599356Z  ] 2025-03-04T19:52:49.4599746Z  2025-03-04T19:52:49.4600113Z  enabled = False 2025-03-04T19:52:49.4600585Z  if opted_in_users: 2025-03-04T19:52:49.4601112Z  log.info( 2025-03-04T19:52:49.4601808Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:52:49.4602824Z  ) 2025-03-04T19:52:49.4603280Z  enabled = True 2025-03-04T19:52:49.4603786Z  2025-03-04T19:52:49.4604201Z  elif experiment_settings.rollout_perc: 2025-03-04T19:52:49.4605100Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:52:49.4606056Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:52:49.4606859Z  log.info( 2025-03-04T19:52:49.4607765Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:52:49.4608713Z  ) 2025-03-04T19:52:49.4609209Z  enabled = True 2025-03-04T19:52:49.4609751Z  2025-03-04T19:52:49.4610167Z  if enabled: 2025-03-04T19:52:49.4610663Z  label = experiment_name 2025-03-04T19:52:49.4611268Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:52:49.4612136Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:52:49.4613190Z  # - If it's enabled, then we always list it's prefix first 2025-03-04T19:52:49.4614032Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:52:49.4614719Z  if is_canary: 2025-03-04T19:52:49.4615299Z  label += CANARY_FLEET_SUFFIX 2025-03-04T19:52:49.4615865Z  fleet_prefix = label 2025-03-04T19:52:49.4616639Z  else: 2025-03-04T19:52:49.4617169Z  prefixes.append(label) 2025-03-04T19:52:49.4617713Z  2025-03-04T19:52:49.4618091Z  if len(prefixes) > 1: 2025-03-04T19:52:49.4618626Z  log.error( 2025-03-04T19:52:49.4619693Z  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-04T19:52:49.4620797Z  ) 2025-03-04T19:52:49.4621211Z  prefixes = prefixes[:1] 2025-03-04T19:52:49.4621754Z  2025-03-04T19:52:49.4622137Z  # Fleet always comes first 2025-03-04T19:52:49.4622697Z  if fleet_prefix: 2025-03-04T19:52:49.4623199Z  prefixes.insert(0, fleet_prefix) 2025-03-04T19:52:49.4623726Z  2025-03-04T19:52:49.4624183Z  return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:52:49.4624811Z  2025-03-04T19:52:49.4625211Z  2025-03-04T19:52:49.4625906Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:52:49.4626827Z  """ 2025-03-04T19:52:49.4627461Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:52:49.4628166Z  2025-03-04T19:52:49.4628770Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:52:49.4629498Z  """ 2025-03-04T19:52:49.4629916Z  gh = get_gh_client(github_token) 2025-03-04T19:52:49.4630528Z  issue = get_issue(gh, repo, issue_num) 2025-03-04T19:52:49.4631188Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:52:49.4631944Z  2025-03-04T19:52:49.4632291Z  2025-03-04T19:52:49.4632913Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:52:49.4633709Z  for _ in range(num_retries): 2025-03-04T19:52:49.4634232Z  try: 2025-03-04T19:52:49.4634696Z  req = Request(url=url, headers=headers) 2025-03-04T19:52:49.4635401Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:52:49.4636100Z  return json.loads(content) 2025-03-04T19:52:49.4636752Z  except Exception as e: 2025-03-04T19:52:49.4637370Z  log.warning(f"Could not download {url}: {e}") 2025-03-04T19:52:49.4637975Z  2025-03-04T19:52:49.4638591Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:52:49.4639312Z  return {} 2025-03-04T19:52:49.4639771Z  2025-03-04T19:52:49.4640119Z  2025-03-04T19:52:49.4640467Z @cache 2025-03-04T19:52:49.4641136Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:52:49.4641911Z  """ 2025-03-04T19:52:49.4642331Z  Dynamically get PR information 2025-03-04T19:52:49.4642877Z  """ 2025-03-04T19:52:49.4643483Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:52:49.4644156Z  headers = { 2025-03-04T19:52:49.4644655Z  "Accept": "application/vnd.github.v3+json", 2025-03-04T19:52:49.4645329Z  "Authorization": f"token {github_token}", 2025-03-04T19:52:49.4645888Z  } 2025-03-04T19:52:49.4646558Z  json_response: dict[str, Any] = download_json( 2025-03-04T19:52:49.4647253Z  url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:52:49.4647863Z  headers=headers, 2025-03-04T19:52:49.4648337Z  ) 2025-03-04T19:52:49.4648710Z  2025-03-04T19:52:49.4649076Z  if not json_response: 2025-03-04T19:52:49.4649707Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:52:49.4650350Z  return {} 2025-03-04T19:52:49.4650771Z  2025-03-04T19:52:49.4651138Z  return json_response 2025-03-04T19:52:49.4651608Z  2025-03-04T19:52:49.4651945Z  2025-03-04T19:52:49.4652554Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:52:49.4653313Z  """ 2025-03-04T19:52:49.4653893Z  Dynamically get the latest list of labels from the pull request 2025-03-04T19:52:49.4654597Z  """ 2025-03-04T19:52:49.4655153Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:52:49.4655784Z  return { 2025-03-04T19:52:49.4656496Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:52:49.4657200Z  } 2025-03-04T19:52:49.4657564Z  2025-03-04T19:52:49.4657901Z  2025-03-04T19:52:49.4658264Z def main() -> None: 2025-03-04T19:52:49.4658718Z  args = parse_args() 2025-03-04T19:52:49.4659170Z  2025-03-04T19:52:49.4659603Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:52:49.4660154Z  2025-03-04T19:52:49.4660538Z  # Check if the PR is opt-out 2025-03-04T19:52:49.4661101Z  if args.pr_number: 2025-03-04T19:52:49.4661815Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:52:49.4662620Z  if OPT_OUT_LABEL in labels: 2025-03-04T19:52:49.4663137Z  log.info( 2025-03-04T19:52:49.4663865Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:52:49.4664796Z  ) 2025-03-04T19:52:49.4665432Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:52:49.4666154Z  sys.exit() 2025-03-04T19:52:49.4666715Z  2025-03-04T19:52:49.4667055Z  try: 2025-03-04T19:52:49.4667526Z  rollout_state = get_rollout_state_from_issue( 2025-03-04T19:52:49.4668275Z  args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:52:49.4668922Z  ) 2025-03-04T19:52:49.4669301Z  2025-03-04T19:52:49.4669715Z  username = get_potential_pr_author( 2025-03-04T19:52:49.4670318Z  args.github_token, 2025-03-04T19:52:49.4670886Z  args.github_repo, 2025-03-04T19:52:49.4671420Z  args.github_actor, 2025-03-04T19:52:49.4671966Z  args.github_ref_type, 2025-03-04T19:52:49.4672547Z  args.github_branch, 2025-03-04T19:52:49.4673041Z  ) 2025-03-04T19:52:49.4673422Z  2025-03-04T19:52:49.4673912Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:52:49.4674560Z  2025-03-04T19:52:49.4674988Z  runner_label_prefix = get_runner_prefix( 2025-03-04T19:52:49.4675580Z  rollout_state, 2025-03-04T19:52:49.4676116Z  (args.github_issue_owner, username), 2025-03-04T19:52:49.4676769Z  args.github_branch, 2025-03-04T19:52:49.4677309Z  args.eligible_experiments, 2025-03-04T19:52:49.4677856Z  is_canary, 2025-03-04T19:52:49.4678439Z  ) 2025-03-04T19:52:49.4678817Z  2025-03-04T19:52:49.4679190Z  except Exception as e: 2025-03-04T19:52:49.4679725Z  log.error( 2025-03-04T19:52:49.4680470Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:52:49.4681227Z  ) 2025-03-04T19:52:49.4681597Z  2025-03-04T19:52:49.4682156Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:52:49.4682851Z  2025-03-04T19:52:49.4683249Z  2025-03-04T19:52:49.4683666Z if __name__ == "__main__": 2025-03-04T19:52:49.4684132Z  main() 2025-03-04T19:52:49.4684522Z  2025-03-04T19:52:49.4684865Z EOF 2025-03-04T19:52:49.4685222Z  2025-03-04T19:52:49.4685604Z cat runner_determinator.py 2025-03-04T19:52:49.5053522Z shell: /usr/bin/bash -e {0} 2025-03-04T19:52:49.5054337Z env: 2025-03-04T19:52:49.5055052Z GITHUB_TOKEN: *** 2025-03-04T19:52:49.5055461Z ISSUE_NUMBER: 5132 2025-03-04T19:52:49.5055888Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:52:49.5056716Z ISSUE_OWNER: williamwen42 2025-03-04T19:52:49.5057220Z CHECK_EXPERIMENTS: 2025-03-04T19:52:49.5057629Z PR_NUMBER: 148205 2025-03-04T19:52:49.5058005Z ##[endgroup] 2025-03-04T19:52:49.5274036Z # flake8: noqa: G004 2025-03-04T19:52:49.5274355Z 2025-03-04T19:52:49.5274799Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-03-04T19:52:49.5275750Z # must be kept in sync. You can do it easily by running the following command: 2025-03-04T19:52:49.5276801Z # python .github/scripts/update_runner_determinator.py 2025-03-04T19:52:49.5277273Z 2025-03-04T19:52:49.5277427Z """ 2025-03-04T19:52:49.5278001Z This runner determinator is used to determine which set of runners to run a 2025-03-04T19:52:49.5278868Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-03-04T19:52:49.5279786Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-03-04T19:52:49.5280575Z of which runners should be used to run which job. 2025-03-04T19:52:49.5281205Z 2025-03-04T19:52:49.5281592Z The configuration has two parts, the settings and a list of opted-in users, 2025-03-04T19:52:49.5282468Z separated by a line containing "---". If the line is not present, the 2025-03-04T19:52:49.5283335Z settings are considered to be empty with only the second part, the user 2025-03-04T19:52:49.5284001Z list, defined. 2025-03-04T19:52:49.5284217Z 2025-03-04T19:52:49.5284586Z The first part is a YAML block that defines the rollout settings. This can be 2025-03-04T19:52:49.5285492Z used to define any settings that are needed to determine which runners to use. 2025-03-04T19:52:49.5286504Z It's fields are defined by the RolloutSettings class below. 2025-03-04T19:52:49.5286972Z 2025-03-04T19:52:49.5287330Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-03-04T19:52:49.5288204Z The user list is also a comma separated list of additional features or 2025-03-04T19:52:49.5288941Z experiments which the user could be opted in to. 2025-03-04T19:52:49.5289355Z 2025-03-04T19:52:49.5289556Z The user list has the following rules: 2025-03-04T19:52:49.5289905Z 2025-03-04T19:52:49.5290220Z - Users are GitHub usernames, which must start with the @ prefix 2025-03-04T19:52:49.5291068Z - Each user is also a comma-separated list of features/experiments to enable 2025-03-04T19:52:49.5291827Z - A "#" prefix opts the user out of all experiments 2025-03-04T19:52:49.5292229Z 2025-03-04T19:52:49.5292422Z Example config: 2025-03-04T19:52:49.5292861Z # A list of experiments that can be opted into. 2025-03-04T19:52:49.5293540Z # This defines the behavior they'll induce when opted into. 2025-03-04T19:52:49.5294182Z # Expected syntax is: 2025-03-04T19:52:49.5294837Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-03-04T19:52:49.5295947Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-03-04T19:52:49.5296830Z 2025-03-04T19:52:49.5297005Z experiments: 2025-03-04T19:52:49.5297388Z lf: 2025-03-04T19:52:49.5297750Z rollout_percent: 25 2025-03-04T19:52:49.5298189Z all_branches: false 2025-03-04T19:52:49.5298610Z default: true 2025-03-04T19:52:49.5298994Z --- 2025-03-04T19:52:49.5299185Z 2025-03-04T19:52:49.5299339Z # Opt-ins: 2025-03-04T19:52:49.5299913Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-03-04T19:52:49.5300764Z # and specifying experiments to enable in a comma-separated list. 2025-03-04T19:52:49.5301500Z # To always opt out of an experiment, prefix it with a "-". 2025-03-04T19:52:49.5302169Z # Experiments should be from the above list. 2025-03-04T19:52:49.5302535Z 2025-03-04T19:52:49.5302703Z @User1,-lf,split_build 2025-03-04T19:52:49.5303114Z @User2,lf 2025-03-04T19:52:49.5303479Z @User3,split_build 2025-03-04T19:52:49.5303866Z """ 2025-03-04T19:52:49.5304046Z 2025-03-04T19:52:49.5304203Z import json 2025-03-04T19:52:49.5304555Z import logging 2025-03-04T19:52:49.5304911Z import os 2025-03-04T19:52:49.5305251Z import random 2025-03-04T19:52:49.5305602Z import re 2025-03-04T19:52:49.5305930Z import sys 2025-03-04T19:52:49.5306498Z from argparse import ArgumentParser 2025-03-04T19:52:49.5307056Z from collections.abc import Iterable 2025-03-04T19:52:49.5307549Z from functools import cache 2025-03-04T19:52:49.5307994Z from logging import LogRecord 2025-03-04T19:52:49.5308449Z from typing import Any, NamedTuple 2025-03-04T19:52:49.5308960Z from urllib.request import Request, urlopen 2025-03-04T19:52:49.5309335Z 2025-03-04T19:52:49.5309492Z import yaml 2025-03-04T19:52:49.5309862Z from github import Auth, Github 2025-03-04T19:52:49.5310317Z from github.Issue import Issue 2025-03-04T19:52:49.5310596Z 2025-03-04T19:52:49.5310603Z 2025-03-04T19:52:49.5310814Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-03-04T19:52:49.5311481Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-03-04T19:52:49.5312304Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-03-04T19:52:49.5312991Z 2025-03-04T19:52:49.5313204Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-03-04T19:52:49.5313796Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-03-04T19:52:49.5314283Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-03-04T19:52:49.5314834Z OPT_OUT_LABEL = "no-runner-experiments" 2025-03-04T19:52:49.5315190Z 2025-03-04T19:52:49.5315397Z SETTING_EXPERIMENTS = "experiments" 2025-03-04T19:52:49.5315738Z 2025-03-04T19:52:49.5315938Z LF_FLEET_EXPERIMENT = "lf" 2025-03-04T19:52:49.5316548Z CANARY_FLEET_SUFFIX = ".c" 2025-03-04T19:52:49.5316823Z 2025-03-04T19:52:49.5316829Z 2025-03-04T19:52:49.5317013Z class Experiment(NamedTuple): 2025-03-04T19:52:49.5317465Z rollout_perc: float = ( 2025-03-04T19:52:49.5318060Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-03-04T19:52:49.5318755Z ) 2025-03-04T19:52:49.5319162Z all_branches: bool = ( 2025-03-04T19:52:49.5319800Z False # If True, the experiment is also enabled on the exception branches 2025-03-04T19:52:49.5320445Z ) 2025-03-04T19:52:49.5320777Z default: bool = ( 2025-03-04T19:52:49.5321311Z True # If True, the experiment is enabled by default for all queries 2025-03-04T19:52:49.5321948Z ) 2025-03-04T19:52:49.5322128Z 2025-03-04T19:52:49.5322303Z # Add more fields as needed 2025-03-04T19:52:49.5322583Z 2025-03-04T19:52:49.5322589Z 2025-03-04T19:52:49.5322767Z class Settings(NamedTuple): 2025-03-04T19:52:49.5323175Z """ 2025-03-04T19:52:49.5323602Z Settings for the experiments that can be opted into. 2025-03-04T19:52:49.5324168Z """ 2025-03-04T19:52:49.5324351Z 2025-03-04T19:52:49.5324556Z experiments: dict[str, Experiment] = {} 2025-03-04T19:52:49.5324908Z 2025-03-04T19:52:49.5324914Z 2025-03-04T19:52:49.5325241Z class ColorFormatter(logging.Formatter): 2025-03-04T19:52:49.5325925Z """Color codes the log messages based on the log level""" 2025-03-04T19:52:49.5326668Z 2025-03-04T19:52:49.5326946Z COLORS = { 2025-03-04T19:52:49.5327333Z "WARNING": "\033[33m", # Yellow 2025-03-04T19:52:49.5327845Z "ERROR": "\033[31m", # Red 2025-03-04T19:52:49.5328355Z "CRITICAL": "\033[31m", # Red 2025-03-04T19:52:49.5328878Z "INFO": "\033[0m", # Reset 2025-03-04T19:52:49.5329347Z "DEBUG": "\033[0m", # Reset 2025-03-04T19:52:49.5329818Z } 2025-03-04T19:52:49.5330002Z 2025-03-04T19:52:49.5330204Z def format(self, record: LogRecord) -> str: 2025-03-04T19:52:49.5330948Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-03-04T19:52:49.5331719Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-03-04T19:52:49.5332308Z return super().format(record) 2025-03-04T19:52:49.5332627Z 2025-03-04T19:52:49.5332634Z 2025-03-04T19:52:49.5332818Z handler = logging.StreamHandler() 2025-03-04T19:52:49.5333480Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-03-04T19:52:49.5334016Z 2025-03-04T19:52:49.5334241Z log = logging.getLogger(os.path.basename(__file__)) 2025-03-04T19:52:49.5334839Z log.addHandler(handler) 2025-03-04T19:52:49.5335311Z log.setLevel(logging.INFO) 2025-03-04T19:52:49.5335600Z 2025-03-04T19:52:49.5335606Z 2025-03-04T19:52:49.5335862Z def set_github_output(key: str, value: str) -> None: 2025-03-04T19:52:49.5336604Z """ 2025-03-04T19:52:49.5337101Z Defines outputs of the github action that invokes this script 2025-03-04T19:52:49.5337742Z """ 2025-03-04T19:52:49.5338082Z if not GITHUB_OUTPUT: 2025-03-04T19:52:49.5339107Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-03-04T19:52:49.5340164Z log.warning( 2025-03-04T19:52:49.5340990Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-03-04T19:52:49.5341888Z ) 2025-03-04T19:52:49.5352064Z print(f"::set-output name={key}::{value}") 2025-03-04T19:52:49.5352708Z return 2025-03-04T19:52:49.5352943Z 2025-03-04T19:52:49.5353128Z with open(GITHUB_OUTPUT, "a") as f: 2025-03-04T19:52:49.5353746Z log.info(f"Setting output: {key}='{value}'") 2025-03-04T19:52:49.5354321Z f.write(f"{key}={value}\n") 2025-03-04T19:52:49.5354624Z 2025-03-04T19:52:49.5354631Z 2025-03-04T19:52:49.5354954Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-03-04T19:52:49.5355561Z return frozenset( 2025-03-04T19:52:49.5356152Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-03-04T19:52:49.5356999Z ) 2025-03-04T19:52:49.5357193Z 2025-03-04T19:52:49.5357200Z 2025-03-04T19:52:49.5357374Z def parse_args() -> Any: 2025-03-04T19:52:49.5357950Z parser = ArgumentParser("Get dynamic rollout settings") 2025-03-04T19:52:49.5358809Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-03-04T19:52:49.5359552Z parser.add_argument( 2025-03-04T19:52:49.5359972Z "--github-issue-repo", 2025-03-04T19:52:49.5360404Z type=str, 2025-03-04T19:52:49.5360782Z required=False, 2025-03-04T19:52:49.5361207Z default="pytorch/test-infra", 2025-03-04T19:52:49.5361756Z help="GitHub repo to get the issue", 2025-03-04T19:52:49.5362239Z ) 2025-03-04T19:52:49.5362586Z parser.add_argument( 2025-03-04T19:52:49.5363004Z "--github-repo", 2025-03-04T19:52:49.5363403Z type=str, 2025-03-04T19:52:49.5363771Z required=True, 2025-03-04T19:52:49.5364198Z help="GitHub repo where CI is running", 2025-03-04T19:52:49.5364742Z ) 2025-03-04T19:52:49.5365121Z parser.add_argument( 2025-03-04T19:52:49.5365887Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-03-04T19:52:49.5366651Z ) 2025-03-04T19:52:49.5366987Z parser.add_argument( 2025-03-04T19:52:49.5367592Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-03-04T19:52:49.5368242Z ) 2025-03-04T19:52:49.5368585Z parser.add_argument( 2025-03-04T19:52:49.5369213Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-03-04T19:52:49.5369911Z ) 2025-03-04T19:52:49.5370296Z parser.add_argument( 2025-03-04T19:52:49.5370928Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-03-04T19:52:49.5371651Z ) 2025-03-04T19:52:49.5372033Z parser.add_argument( 2025-03-04T19:52:49.5372453Z "--github-ref-type", 2025-03-04T19:52:49.5372882Z type=str, 2025-03-04T19:52:49.5373287Z required=True, 2025-03-04T19:52:49.5373741Z help="Current GitHub ref type, branch or tag", 2025-03-04T19:52:49.5374288Z ) 2025-03-04T19:52:49.5374642Z parser.add_argument( 2025-03-04T19:52:49.5375076Z "--eligible-experiments", 2025-03-04T19:52:49.5375602Z type=_str_comma_separated_to_set, 2025-03-04T19:52:49.5376113Z required=False, 2025-03-04T19:52:49.5376872Z default="", 2025-03-04T19:52:49.5377958Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-03-04T19:52:49.5378893Z ) 2025-03-04T19:52:49.5379297Z parser.add_argument( 2025-03-04T19:52:49.5379717Z "--pr-number", 2025-03-04T19:52:49.5380100Z type=str, 2025-03-04T19:52:49.5380473Z required=False, 2025-03-04T19:52:49.5380862Z default="", 2025-03-04T19:52:49.5381310Z help="the optional PR number where this is run", 2025-03-04T19:52:49.5381859Z ) 2025-03-04T19:52:49.5382039Z 2025-03-04T19:52:49.5382215Z return parser.parse_args() 2025-03-04T19:52:49.5382540Z 2025-03-04T19:52:49.5382546Z 2025-03-04T19:52:49.5382951Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-03-04T19:52:49.5383708Z auth = Auth.Token(github_token) 2025-03-04T19:52:49.5384196Z return Github(auth=auth) 2025-03-04T19:52:49.5384642Z 2025-03-04T19:52:49.5384649Z 2025-03-04T19:52:49.5385104Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-03-04T19:52:49.5385855Z repo = gh.get_repo(repo) 2025-03-04T19:52:49.5386559Z return repo.get_issue(number=issue_num) 2025-03-04T19:52:49.5386968Z 2025-03-04T19:52:49.5386974Z 2025-03-04T19:52:49.5387172Z def get_potential_pr_author( 2025-03-04T19:52:49.5387777Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-03-04T19:52:49.5388421Z ) -> str: 2025-03-04T19:52:49.5388926Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-03-04T19:52:49.5389694Z # Fetch the actual username from the original PR. The PR number is 2025-03-04T19:52:49.5390432Z # embedded in the tag name: ciflow// 2025-03-04T19:52:49.5390848Z 2025-03-04T19:52:49.5391052Z gh = get_gh_client(github_token) 2025-03-04T19:52:49.5391395Z 2025-03-04T19:52:49.5391674Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-03-04T19:52:49.5392297Z split_tag = ref_name.split("/") 2025-03-04T19:52:49.5392821Z if ( 2025-03-04T19:52:49.5393193Z len(split_tag) == 3 2025-03-04T19:52:49.5393635Z and split_tag[0] == "ciflow" 2025-03-04T19:52:49.5394182Z and split_tag[2].isnumeric() 2025-03-04T19:52:49.5394664Z ): 2025-03-04T19:52:49.5395021Z pr_number = split_tag[2] 2025-03-04T19:52:49.5395467Z try: 2025-03-04T19:52:49.5395866Z repository = gh.get_repo(repo) 2025-03-04T19:52:49.5396554Z pull = repository.get_pull(number=int(pr_number)) 2025-03-04T19:52:49.5397126Z except Exception as e: 2025-03-04T19:52:49.5397643Z raise Exception( # noqa: TRY002 2025-03-04T19:52:49.5398413Z f"issue with pull request {pr_number} from repo {repository}" 2025-03-04T19:52:49.5399063Z ) from e 2025-03-04T19:52:49.5399564Z return pull.user.login # type: ignore[no-any-return] 2025-03-04T19:52:49.5400229Z # In all other cases, return the original input username 2025-03-04T19:52:49.5400813Z return username 2025-03-04T19:52:49.5401036Z 2025-03-04T19:52:49.5401043Z 2025-03-04T19:52:49.5401258Z def is_exception_branch(branch: str) -> bool: 2025-03-04T19:52:49.5401797Z """ 2025-03-04T19:52:49.5402409Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-03-04T19:52:49.5403176Z """ 2025-03-04T19:52:49.5403745Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-03-04T19:52:49.5404252Z 2025-03-04T19:52:49.5404258Z 2025-03-04T19:52:49.5404460Z def load_yaml(yaml_text: str) -> Any: 2025-03-04T19:52:49.5404948Z try: 2025-03-04T19:52:49.5405308Z data = yaml.safe_load(yaml_text) 2025-03-04T19:52:49.5405798Z return data 2025-03-04T19:52:49.5406246Z except yaml.YAMLError: 2025-03-04T19:52:49.5406862Z log.exception("Error loading YAML") 2025-03-04T19:52:49.5407399Z raise 2025-03-04T19:52:49.5407636Z 2025-03-04T19:52:49.5407643Z 2025-03-04T19:52:49.5408054Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-03-04T19:52:49.5408783Z """ 2025-03-04T19:52:49.5409373Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-03-04T19:52:49.5409946Z 2025-03-04T19:52:49.5410281Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:52:49.5410994Z and the text below is the list of opted in users. 2025-03-04T19:52:49.5411394Z 2025-03-04T19:52:49.5411763Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-03-04T19:52:49.5412440Z """ 2025-03-04T19:52:49.5412853Z rollout_state_parts = rollout_state.split("---") 2025-03-04T19:52:49.5413424Z if len(rollout_state_parts) >= 2: 2025-03-04T19:52:49.5413980Z return rollout_state_parts[0], rollout_state_parts[1] 2025-03-04T19:52:49.5414704Z else: 2025-03-04T19:52:49.5415052Z return "", rollout_state 2025-03-04T19:52:49.5415345Z 2025-03-04T19:52:49.5415352Z 2025-03-04T19:52:49.5415542Z class UserOptins(dict[str, list[str]]): 2025-03-04T19:52:49.5416015Z """ 2025-03-04T19:52:49.5416642Z Dictionary of users with a list of features they have opted into 2025-03-04T19:52:49.5417276Z """ 2025-03-04T19:52:49.5417455Z 2025-03-04T19:52:49.5417461Z 2025-03-04T19:52:49.5417795Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-03-04T19:52:49.5418450Z """ 2025-03-04T19:52:49.5419130Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-03-04T19:52:49.5419775Z 2025-03-04T19:52:49.5420373Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-03-04T19:52:49.5421345Z - Example line: "@User1,lf,split_build" 2025-03-04T19:52:49.5422001Z - A "#" prefix indicates the user is opted out of all experiments 2025-03-04T19:52:49.5422471Z 2025-03-04T19:52:49.5422477Z 2025-03-04T19:52:49.5422657Z """ 2025-03-04T19:52:49.5423056Z optins = UserOptins() 2025-03-04T19:52:49.5423534Z for user in user_optin_text.split("\n"): 2025-03-04T19:52:49.5424087Z user = user.strip("\r\n\t -") 2025-03-04T19:52:49.5424603Z if not user or not user.startswith("@"): 2025-03-04T19:52:49.5425162Z # Not a valid user. Skip 2025-03-04T19:52:49.5425662Z continue 2025-03-04T19:52:49.5425917Z 2025-03-04T19:52:49.5426065Z if user: 2025-03-04T19:52:49.5426679Z usr_name = user.split(",")[0].strip("@") 2025-03-04T19:52:49.5427529Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-03-04T19:52:49.5428008Z 2025-03-04T19:52:49.5428171Z return optins 2025-03-04T19:52:49.5428388Z 2025-03-04T19:52:49.5428396Z 2025-03-04T19:52:49.5428671Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-03-04T19:52:49.5429255Z """ 2025-03-04T19:52:49.5429629Z Check if the experiment name is valid. 2025-03-04T19:52:49.5430169Z A valid name: 2025-03-04T19:52:49.5430786Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-03-04T19:52:49.5431711Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-03-04T19:52:49.5432390Z - Cannot contain spaces 2025-03-04T19:52:49.5432824Z """ 2025-03-04T19:52:49.5433014Z 2025-03-04T19:52:49.5433261Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-03-04T19:52:49.5433965Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-03-04T19:52:49.5434404Z 2025-03-04T19:52:49.5434591Z if valid: 2025-03-04T19:52:49.5434950Z return True 2025-03-04T19:52:49.5435179Z 2025-03-04T19:52:49.5435329Z log.error( 2025-03-04T19:52:49.5436810Z 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-04T19:52:49.5438308Z ) 2025-03-04T19:52:49.5438703Z return False 2025-03-04T19:52:49.5438947Z 2025-03-04T19:52:49.5438953Z 2025-03-04T19:52:49.5439249Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-03-04T19:52:49.5439843Z """ 2025-03-04T19:52:49.5440419Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-03-04T19:52:49.5441105Z """ 2025-03-04T19:52:49.5441426Z try: 2025-03-04T19:52:49.5441773Z if settings_text: 2025-03-04T19:52:49.5442462Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-03-04T19:52:49.5443207Z # for easy reading 2025-03-04T19:52:49.5443974Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-03-04T19:52:49.5444948Z # the backtick character in shell commands. 2025-03-04T19:52:49.5445533Z backtick = chr(96) # backtick character 2025-03-04T19:52:49.5446195Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-03-04T19:52:49.5446936Z settings = load_yaml(settings_text) 2025-03-04T19:52:49.5447311Z 2025-03-04T19:52:49.5447703Z # For now we just load experiments. We can expand this if/when we add more settings 2025-03-04T19:52:49.5448451Z experiments = {} 2025-03-04T19:52:49.5448777Z 2025-03-04T19:52:49.5449142Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-03-04T19:52:49.5449853Z if not is_valid_experiment_name(exp_name): 2025-03-04T19:52:49.5450932Z # 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-04T19:52:49.5451906Z continue 2025-03-04T19:52:49.5452175Z 2025-03-04T19:52:49.5452342Z valid_settings = {} 2025-03-04T19:52:49.5452818Z for setting in exp_settings: 2025-03-04T19:52:49.5453381Z if setting not in Experiment._fields: 2025-03-04T19:52:49.5453911Z log.warning( 2025-03-04T19:52:49.5454609Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-03-04T19:52:49.5455339Z ) 2025-03-04T19:52:49.5455738Z else: 2025-03-04T19:52:49.5456221Z valid_settings[setting] = exp_settings[setting] 2025-03-04T19:52:49.5456847Z 2025-03-04T19:52:49.5457111Z experiments[exp_name] = Experiment(**valid_settings) 2025-03-04T19:52:49.5457841Z return Settings(experiments) 2025-03-04T19:52:49.5458202Z 2025-03-04T19:52:49.5458381Z except Exception: 2025-03-04T19:52:49.5458824Z log.exception("Failed to parse settings") 2025-03-04T19:52:49.5459218Z 2025-03-04T19:52:49.5459388Z return Settings() 2025-03-04T19:52:49.5459624Z 2025-03-04T19:52:49.5459640Z 2025-03-04T19:52:49.5459871Z def parse_settings(rollout_state: str) -> Settings: 2025-03-04T19:52:49.5460402Z """ 2025-03-04T19:52:49.5460809Z Parse settings, if any, from the rollout state. 2025-03-04T19:52:49.5461207Z 2025-03-04T19:52:49.5461552Z If the issue body contains "---" then the text above that is the settings 2025-03-04T19:52:49.5462268Z and the text below is the list of opted in users. 2025-03-04T19:52:49.5462668Z 2025-03-04T19:52:49.5463073Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-03-04T19:52:49.5463758Z """ 2025-03-04T19:52:49.5464308Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:52:49.5465054Z return parse_settings_from_text(settings_text) 2025-03-04T19:52:49.5465445Z 2025-03-04T19:52:49.5465456Z 2025-03-04T19:52:49.5465682Z def parse_users(rollout_state: str) -> UserOptins: 2025-03-04T19:52:49.5466242Z """ 2025-03-04T19:52:49.5466810Z Parse users from the rollout state. 2025-03-04T19:52:49.5467142Z 2025-03-04T19:52:49.5467295Z """ 2025-03-04T19:52:49.5467792Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-03-04T19:52:49.5468488Z return parse_user_opt_in_from_text(users_text) 2025-03-04T19:52:49.5468881Z 2025-03-04T19:52:49.5468888Z 2025-03-04T19:52:49.5469290Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:52:49.5470028Z """ 2025-03-04T19:52:49.5470460Z Check if a user is opted into an experiment 2025-03-04T19:52:49.5471018Z """ 2025-03-04T19:52:49.5471497Z return experiment_name in user_optins.get(user, []) 2025-03-04T19:52:49.5471895Z 2025-03-04T19:52:49.5471902Z 2025-03-04T19:52:49.5472308Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-03-04T19:52:49.5473186Z """ 2025-03-04T19:52:49.5473663Z Check if a user explicitly opted out of an experiment 2025-03-04T19:52:49.5474255Z """ 2025-03-04T19:52:49.5474763Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-03-04T19:52:49.5475442Z experiment_optout = "-" + experiment_name 2025-03-04T19:52:49.5476050Z if experiment_optout not in user_optins.get(user, []): 2025-03-04T19:52:49.5476737Z return False 2025-03-04T19:52:49.5476967Z 2025-03-04T19:52:49.5477219Z if is_user_opted_in(user, user_optins, experiment_name): 2025-03-04T19:52:49.5477824Z log.warning( 2025-03-04T19:52:49.5478598Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-03-04T19:52:49.5479420Z ) 2025-03-04T19:52:49.5479621Z 2025-03-04T19:52:49.5479772Z return True 2025-03-04T19:52:49.5479991Z 2025-03-04T19:52:49.5479997Z 2025-03-04T19:52:49.5480158Z def get_runner_prefix( 2025-03-04T19:52:49.5480571Z rollout_state: str, 2025-03-04T19:52:49.5481001Z workflow_requestors: Iterable[str], 2025-03-04T19:52:49.5481474Z branch: str, 2025-03-04T19:52:49.5481926Z eligible_experiments: frozenset[str] = frozenset(), 2025-03-04T19:52:49.5482511Z is_canary: bool = False, 2025-03-04T19:52:49.5482927Z ) -> str: 2025-03-04T19:52:49.5483309Z settings = parse_settings(rollout_state) 2025-03-04T19:52:49.5483896Z user_optins = parse_users(rollout_state) 2025-03-04T19:52:49.5484262Z 2025-03-04T19:52:49.5484447Z fleet_prefix = "" 2025-03-04T19:52:49.5484835Z prefixes = [] 2025-03-04T19:52:49.5485427Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-03-04T19:52:49.5486442Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-03-04T19:52:49.5487228Z log.info( 2025-03-04T19:52:49.5487880Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-03-04T19:52:49.5488586Z ) 2025-03-04T19:52:49.5488942Z continue 2025-03-04T19:52:49.5489177Z 2025-03-04T19:52:49.5489363Z if eligible_experiments: 2025-03-04T19:52:49.5489880Z if experiment_name not in eligible_experiments: 2025-03-04T19:52:49.5490494Z exp_list = ", ".join(eligible_experiments) 2025-03-04T19:52:49.5491063Z log.info( 2025-03-04T19:52:49.5491835Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-03-04T19:52:49.5492635Z ) 2025-03-04T19:52:49.5493006Z continue 2025-03-04T19:52:49.5493437Z elif not experiment_settings.default: 2025-03-04T19:52:49.5493993Z log.info( 2025-03-04T19:52:49.5494630Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-03-04T19:52:49.5495364Z ) 2025-03-04T19:52:49.5495733Z continue 2025-03-04T19:52:49.5495990Z 2025-03-04T19:52:49.5496273Z # Is any workflow_requestor opted out to this experiment? 2025-03-04T19:52:49.5497010Z opted_out_users = [ 2025-03-04T19:52:49.5497481Z requestor 2025-03-04T19:52:49.5497897Z for requestor in workflow_requestors 2025-03-04T19:52:49.5498556Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-03-04T19:52:49.5499147Z ] 2025-03-04T19:52:49.5499344Z 2025-03-04T19:52:49.5499511Z if opted_out_users: 2025-03-04T19:52:49.5499919Z log.info( 2025-03-04T19:52:49.5500487Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-03-04T19:52:49.5501179Z ) 2025-03-04T19:52:49.5501520Z continue 2025-03-04T19:52:49.5501752Z 2025-03-04T19:52:49.5502004Z # Is any workflow_requestor opted in to this experiment? 2025-03-04T19:52:49.5502621Z opted_in_users = [ 2025-03-04T19:52:49.5503087Z requestor 2025-03-04T19:52:49.5503688Z for requestor in workflow_requestors 2025-03-04T19:52:49.5504357Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-03-04T19:52:49.5504950Z ] 2025-03-04T19:52:49.5505143Z 2025-03-04T19:52:49.5505298Z enabled = False 2025-03-04T19:52:49.5505703Z if opted_in_users: 2025-03-04T19:52:49.5506110Z log.info( 2025-03-04T19:52:49.5506793Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-03-04T19:52:49.5507439Z ) 2025-03-04T19:52:49.5507793Z enabled = True 2025-03-04T19:52:49.5508057Z 2025-03-04T19:52:49.5508256Z elif experiment_settings.rollout_perc: 2025-03-04T19:52:49.5509066Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-03-04T19:52:49.5509977Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-03-04T19:52:49.5510590Z log.info( 2025-03-04T19:52:49.5511419Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-03-04T19:52:49.5512324Z ) 2025-03-04T19:52:49.5512701Z enabled = True 2025-03-04T19:52:49.5512976Z 2025-03-04T19:52:49.5513135Z if enabled: 2025-03-04T19:52:49.5513531Z label = experiment_name 2025-03-04T19:52:49.5514091Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-03-04T19:52:49.5514903Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-03-04T19:52:49.5515776Z # - If it's enabled, then we always list it's prefix first 2025-03-04T19:52:49.5516725Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-03-04T19:52:49.5517373Z if is_canary: 2025-03-04T19:52:49.5517821Z label += CANARY_FLEET_SUFFIX 2025-03-04T19:52:49.5518385Z fleet_prefix = label 2025-03-04T19:52:49.5518895Z else: 2025-03-04T19:52:49.5519306Z prefixes.append(label) 2025-03-04T19:52:49.5519629Z 2025-03-04T19:52:49.5519803Z if len(prefixes) > 1: 2025-03-04T19:52:49.5520202Z log.error( 2025-03-04T19:52:49.5521161Z 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-04T19:52:49.5522235Z ) 2025-03-04T19:52:49.5522653Z prefixes = prefixes[:1] 2025-03-04T19:52:49.5522939Z 2025-03-04T19:52:49.5523115Z # Fleet always comes first 2025-03-04T19:52:49.5523601Z if fleet_prefix: 2025-03-04T19:52:49.5524067Z prefixes.insert(0, fleet_prefix) 2025-03-04T19:52:49.5524418Z 2025-03-04T19:52:49.5524648Z return ".".join(prefixes) + "." if prefixes else "" 2025-03-04T19:52:49.5525056Z 2025-03-04T19:52:49.5525062Z 2025-03-04T19:52:49.5525473Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-03-04T19:52:49.5526233Z """ 2025-03-04T19:52:49.5526894Z Gets the first comment of the issue, which contains the desired rollout state. 2025-03-04T19:52:49.5527434Z 2025-03-04T19:52:49.5527804Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-03-04T19:52:49.5528511Z """ 2025-03-04T19:52:49.5528922Z gh = get_gh_client(github_token) 2025-03-04T19:52:49.5529473Z issue = get_issue(gh, repo, issue_num) 2025-03-04T19:52:49.5530078Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-03-04T19:52:49.5530508Z 2025-03-04T19:52:49.5530515Z 2025-03-04T19:52:49.5530894Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-03-04T19:52:49.5531614Z for _ in range(num_retries): 2025-03-04T19:52:49.5532102Z try: 2025-03-04T19:52:49.5532548Z req = Request(url=url, headers=headers) 2025-03-04T19:52:49.5533310Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-03-04T19:52:49.5533927Z return json.loads(content) 2025-03-04T19:52:49.5534425Z except Exception as e: 2025-03-04T19:52:49.5534912Z log.warning(f"Could not download {url}: {e}") 2025-03-04T19:52:49.5535312Z 2025-03-04T19:52:49.5535686Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-03-04T19:52:49.5536459Z return {} 2025-03-04T19:52:49.5536724Z 2025-03-04T19:52:49.5536737Z 2025-03-04T19:52:49.5536910Z @cache 2025-03-04T19:52:49.5537517Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-03-04T19:52:49.5538248Z """ 2025-03-04T19:52:49.5538605Z Dynamically get PR information 2025-03-04T19:52:49.5539053Z """ 2025-03-04T19:52:49.5539535Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-03-04T19:52:49.5540125Z headers = { 2025-03-04T19:52:49.5540538Z "Accept": "application/vnd.github.v3+json", 2025-03-04T19:52:49.5541134Z "Authorization": f"token {github_token}", 2025-03-04T19:52:49.5541683Z } 2025-03-04T19:52:49.5542080Z json_response: dict[str, Any] = download_json( 2025-03-04T19:52:49.5542634Z url=f"{github_api}/issues/{pr_number}", 2025-03-04T19:52:49.5543152Z headers=headers, 2025-03-04T19:52:49.5543550Z ) 2025-03-04T19:52:49.5543743Z 2025-03-04T19:52:49.5543910Z if not json_response: 2025-03-04T19:52:49.5544437Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-03-04T19:52:49.5545063Z return {} 2025-03-04T19:52:49.5545305Z 2025-03-04T19:52:49.5545508Z return json_response 2025-03-04T19:52:49.5545775Z 2025-03-04T19:52:49.5545782Z 2025-03-04T19:52:49.5546164Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-03-04T19:52:49.5547105Z """ 2025-03-04T19:52:49.5547651Z Dynamically get the latest list of labels from the pull request 2025-03-04T19:52:49.5548270Z """ 2025-03-04T19:52:49.5548750Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-03-04T19:52:49.5549359Z return { 2025-03-04T19:52:49.5549919Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-03-04T19:52:49.5550616Z } 2025-03-04T19:52:49.5550805Z 2025-03-04T19:52:49.5550818Z 2025-03-04T19:52:49.5550979Z def main() -> None: 2025-03-04T19:52:49.5551359Z args = parse_args() 2025-03-04T19:52:49.5551616Z 2025-03-04T19:52:49.5551821Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-03-04T19:52:49.5552198Z 2025-03-04T19:52:49.5552403Z # Check if the PR is opt-out 2025-03-04T19:52:49.5552912Z if args.pr_number: 2025-03-04T19:52:49.5553532Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-03-04T19:52:49.5554257Z if OPT_OUT_LABEL in labels: 2025-03-04T19:52:49.5554739Z log.info( 2025-03-04T19:52:49.5555390Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-03-04T19:52:49.5556109Z ) 2025-03-04T19:52:49.5556711Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:52:49.5557325Z sys.exit() 2025-03-04T19:52:49.5557561Z 2025-03-04T19:52:49.5557712Z try: 2025-03-04T19:52:49.5558103Z rollout_state = get_rollout_state_from_issue( 2025-03-04T19:52:49.5558804Z args.github_token, args.github_issue_repo, args.github_issue 2025-03-04T19:52:49.5559414Z ) 2025-03-04T19:52:49.5559605Z 2025-03-04T19:52:49.5559791Z username = get_potential_pr_author( 2025-03-04T19:52:49.5560293Z args.github_token, 2025-03-04T19:52:49.5560736Z args.github_repo, 2025-03-04T19:52:49.5561169Z args.github_actor, 2025-03-04T19:52:49.5561606Z args.github_ref_type, 2025-03-04T19:52:49.5562071Z args.github_branch, 2025-03-04T19:52:49.5562490Z ) 2025-03-04T19:52:49.5562676Z 2025-03-04T19:52:49.5563086Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-03-04T19:52:49.5563527Z 2025-03-04T19:52:49.5563732Z runner_label_prefix = get_runner_prefix( 2025-03-04T19:52:49.5564243Z rollout_state, 2025-03-04T19:52:49.5583684Z (args.github_issue_owner, username), 2025-03-04T19:52:49.5584535Z args.github_branch, 2025-03-04T19:52:49.5585033Z args.eligible_experiments, 2025-03-04T19:52:49.5585582Z is_canary, 2025-03-04T19:52:49.5586039Z ) 2025-03-04T19:52:49.5586270Z 2025-03-04T19:52:49.5586588Z except Exception as e: 2025-03-04T19:52:49.5587028Z log.error( 2025-03-04T19:52:49.5587725Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-03-04T19:52:49.5588485Z ) 2025-03-04T19:52:49.5588718Z 2025-03-04T19:52:49.5589046Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-03-04T19:52:49.5589538Z 2025-03-04T19:52:49.5589544Z 2025-03-04T19:52:49.5589719Z if __name__ == "__main__": 2025-03-04T19:52:49.5590131Z main() 2025-03-04T19:52:49.5590325Z 2025-03-04T19:52:49.5682085Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:52:49.5682965Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-03-04T19:52:49.5729256Z shell: /usr/bin/bash -e {0} 2025-03-04T19:52:49.5729695Z env: 2025-03-04T19:52:49.5730310Z GITHUB_TOKEN: *** 2025-03-04T19:52:49.5730707Z ISSUE_NUMBER: 5132 2025-03-04T19:52:49.5731118Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:52:49.5731617Z ISSUE_OWNER: williamwen42 2025-03-04T19:52:49.5732041Z CHECK_EXPERIMENTS: 2025-03-04T19:52:49.5732442Z PR_NUMBER: 148205 2025-03-04T19:52:49.5732817Z ##[endgroup] 2025-03-04T19:52:49.9901918Z Defaulting to user installation because normal site-packages is not writeable 2025-03-04T19:52:50.3843873Z Collecting urllib3==1.26.18 2025-03-04T19:52:50.4195319Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-03-04T19:52:50.4390881Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.5 MB/s eta 0:00:00 2025-03-04T19:52:50.4631828Z Collecting PyGithub==2.3.0 2025-03-04T19:52:50.4665346Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-03-04T19:52:50.5101522Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-03-04T19:52:50.5138669Z 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-04T19:52:50.5187476Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-03-04T19:52:50.5204096Z 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-04T19:52:50.5219197Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-03-04T19:52:50.5498541Z Collecting Deprecated (from PyGithub==2.3.0) 2025-03-04T19:52:50.5533884Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-03-04T19:52:50.5771071Z 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-04T19:52:50.6924963Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:52:50.6969122Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-03-04T19:52:50.8038499Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-03-04T19:52:50.8083884Z 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-04T19:52:50.8287303Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-03-04T19:52:50.8319595Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-03-04T19:52:50.8553580Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-03-04T19:52:50.8643697Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 18.8 MB/s eta 0:00:00 2025-03-04T19:52:50.8695565Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-03-04T19:52:50.8758341Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 74.7 MB/s eta 0:00:00 2025-03-04T19:52:50.8791034Z 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-04T19:52:50.8883464Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 112.9 MB/s eta 0:00:00 2025-03-04T19:52:50.8915605Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-03-04T19:52:50.8973489Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-03-04T19:52:50.9073710Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 57.6 MB/s eta 0:00:00 2025-03-04T19:52:50.9110791Z 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-04T19:52:50.9158791Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 25.7 MB/s eta 0:00:00 2025-03-04T19:52:50.9189574Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-03-04T19:52:50.9237259Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 36.3 MB/s eta 0:00:00 2025-03-04T19:52:51.2229994Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-03-04T19:52:51.7626147Z 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-04T19:52:51.8465144Z ##[group]Run curr_branch="gh/williamwen42/215/head" 2025-03-04T19:52:51.8465618Z curr_branch="gh/williamwen42/215/head" 2025-03-04T19:52:51.8465959Z curr_ref_type="branch" 2025-03-04T19:52:51.8466270Z echo "Current branch is '$curr_branch'" 2025-03-04T19:52:51.8466854Z  2025-03-04T19:52:51.8467118Z python3 runner_determinator.py \ 2025-03-04T19:52:51.8467498Z  --github-token "$GITHUB_TOKEN" \ 2025-03-04T19:52:51.8467825Z  --github-issue "$ISSUE_NUMBER" \ 2025-03-04T19:52:51.8468142Z  --github-branch "$curr_branch" \ 2025-03-04T19:52:51.8468462Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-03-04T19:52:51.8468807Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-03-04T19:52:51.8469147Z  --github-ref-type "$curr_ref_type" \ 2025-03-04T19:52:51.8469482Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-03-04T19:52:51.8469911Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-03-04T19:52:51.8470265Z  --pr-number "${PR_NUMBER}" 2025-03-04T19:52:51.8517948Z shell: /usr/bin/bash -e {0} 2025-03-04T19:52:51.8518230Z env: 2025-03-04T19:52:51.8518925Z GITHUB_TOKEN: *** 2025-03-04T19:52:51.8519180Z ISSUE_NUMBER: 5132 2025-03-04T19:52:51.8519436Z TRIGGERING_ACTOR: williamwen42 2025-03-04T19:52:51.8519716Z ISSUE_OWNER: williamwen42 2025-03-04T19:52:51.8520005Z CHECK_EXPERIMENTS: 2025-03-04T19:52:51.8520251Z PR_NUMBER: 148205 2025-03-04T19:52:51.8520484Z ##[endgroup] 2025-03-04T19:52:51.8585160Z Current branch is 'gh/williamwen42/215/head' 2025-03-04T19:52:53.2269830Z INFO : Skipping experiment 'awsa100', as it is not a default experiment 2025-03-04T19:52:53.2270843Z INFO : Setting output: label-type='' 2025-03-04T19:52:53.2593068Z Evaluate and set job outputs 2025-03-04T19:52:53.2600499Z Cleaning up orphan processes