2025-06-01T21:04:17.2738548Z Current runner version: '2.324.0' 2025-06-01T21:04:17.2768821Z ##[group]Operating System 2025-06-01T21:04:17.2769534Z Ubuntu 2025-06-01T21:04:17.2770140Z 24.04.2 2025-06-01T21:04:17.2770615Z LTS 2025-06-01T21:04:17.2771086Z ##[endgroup] 2025-06-01T21:04:17.2771646Z ##[group]Runner Image 2025-06-01T21:04:17.2772230Z Image: ubuntu-24.04 2025-06-01T21:04:17.2772744Z Version: 20250527.1.0 2025-06-01T21:04:17.2773796Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250527.1/images/ubuntu/Ubuntu2404-Readme.md 2025-06-01T21:04:17.2775183Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250527.1 2025-06-01T21:04:17.2776330Z ##[endgroup] 2025-06-01T21:04:17.2777341Z ##[group]Runner Image Provisioner 2025-06-01T21:04:17.2777891Z 2.0.437.1 2025-06-01T21:04:17.2778356Z ##[endgroup] 2025-06-01T21:04:17.2779659Z ##[group]GITHUB_TOKEN Permissions 2025-06-01T21:04:17.2781756Z Contents: read 2025-06-01T21:04:17.2782262Z Metadata: read 2025-06-01T21:04:17.2783210Z ##[endgroup] 2025-06-01T21:04:17.2786227Z Secret source: Actions 2025-06-01T21:04:17.2787449Z Prepare workflow directory 2025-06-01T21:04:17.3289887Z Prepare all required actions 2025-06-01T21:04:17.3343319Z Complete job name: before-test / get-label-type / runner-determinator 2025-06-01T21:04:17.8692512Z ##[group]Run cat < runner_determinator.py 2025-06-01T21:04:17.8695304Z cat < runner_determinator.py 2025-06-01T21:04:17.8696330Z # flake8: noqa: G004 2025-06-01T21:04:17.8696945Z  2025-06-01T21:04:17.8697711Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-01T21:04:17.8699395Z # must be kept in sync. You can do it easily by running the following command: 2025-06-01T21:04:17.8700579Z # python .github/scripts/update_runner_determinator.py 2025-06-01T21:04:17.8701346Z  2025-06-01T21:04:17.8701876Z """ 2025-06-01T21:04:17.8702631Z This runner determinator is used to determine which set of runners to run a 2025-06-01T21:04:17.8703735Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-01T21:04:17.8705304Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-01T21:04:17.8706513Z of which runners should be used to run which job. 2025-06-01T21:04:17.8707234Z  2025-06-01T21:04:17.8708035Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-01T21:04:17.8709144Z separated by a line containing "---". If the line is not present, the 2025-06-01T21:04:17.8710184Z settings are considered to be empty with only the second part, the user 2025-06-01T21:04:17.8711129Z list, defined. 2025-06-01T21:04:17.8711639Z  2025-06-01T21:04:17.8712363Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-01T21:04:17.8713526Z used to define any settings that are needed to determine which runners to use. 2025-06-01T21:04:17.8714534Z It's fields are defined by the RolloutSettings class below. 2025-06-01T21:04:17.8715289Z  2025-06-01T21:04:17.8716177Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-01T21:04:17.8717277Z The user list is also a comma separated list of additional features or 2025-06-01T21:04:17.8718221Z experiments which the user could be opted in to. 2025-06-01T21:04:17.8718935Z  2025-06-01T21:04:17.8719491Z The user list has the following rules: 2025-06-01T21:04:17.8720117Z  2025-06-01T21:04:17.8720883Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-01T21:04:17.8721951Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-01T21:04:17.8722866Z - A "#" prefix opts the user out of all experiments 2025-06-01T21:04:17.8723856Z  2025-06-01T21:04:17.8724441Z Example config: 2025-06-01T21:04:17.8725098Z  # A list of experiments that can be opted into. 2025-06-01T21:04:17.8726340Z  # This defines the behavior they'll induce when opted into. 2025-06-01T21:04:17.8727165Z  # Expected syntax is: 2025-06-01T21:04:17.8728084Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-01T21:04:17.8729189Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-01T21:04:17.8730167Z  2025-06-01T21:04:17.8730684Z  experiments: 2025-06-01T21:04:17.8731185Z  lf: 2025-06-01T21:04:17.8731792Z  rollout_percent: 25 2025-06-01T21:04:17.8732381Z  all_branches: false 2025-06-01T21:04:17.8732982Z  default: true 2025-06-01T21:04:17.8733582Z  --- 2025-06-01T21:04:17.8734095Z  2025-06-01T21:04:17.8734575Z  # Opt-ins: 2025-06-01T21:04:17.8735407Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-01T21:04:17.8736761Z  # and specifying experiments to enable in a comma-separated list. 2025-06-01T21:04:17.8737712Z  # To always opt out of an experiment, prefix it with a "-". 2025-06-01T21:04:17.8738630Z  # Experiments should be from the above list. 2025-06-01T21:04:17.8739308Z  2025-06-01T21:04:17.8739800Z  @User1,-lf,split_build 2025-06-01T21:04:17.8740452Z  @User2,lf 2025-06-01T21:04:17.8740978Z  @User3,split_build 2025-06-01T21:04:17.8741554Z """ 2025-06-01T21:04:17.8742023Z  2025-06-01T21:04:17.8742547Z import json 2025-06-01T21:04:17.8743048Z import logging 2025-06-01T21:04:17.8816820Z import os 2025-06-01T21:04:17.8817776Z import random 2025-06-01T21:04:17.8818631Z import re 2025-06-01T21:04:17.8819437Z import sys 2025-06-01T21:04:17.8820395Z from argparse import ArgumentParser 2025-06-01T21:04:17.8821568Z from collections.abc import Iterable 2025-06-01T21:04:17.8822233Z from functools import cache 2025-06-01T21:04:17.8822799Z from logging import LogRecord 2025-06-01T21:04:17.8823391Z from typing import Any, NamedTuple 2025-06-01T21:04:17.8824033Z from urllib.request import Request, urlopen 2025-06-01T21:04:17.8824632Z  2025-06-01T21:04:17.8825036Z import yaml 2025-06-01T21:04:17.8825521Z from github import Auth, Github 2025-06-01T21:04:17.8826338Z from github.Issue import Issue 2025-06-01T21:04:17.8826877Z  2025-06-01T21:04:17.8827261Z  2025-06-01T21:04:17.8827742Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-01T21:04:17.8828522Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-01T21:04:17.8829492Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-01T21:04:17.8830263Z  2025-06-01T21:04:17.8830746Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-01T21:04:17.8831390Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-01T21:04:17.8832008Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-01T21:04:17.8832670Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-01T21:04:17.8833245Z  2025-06-01T21:04:17.8833680Z SETTING_EXPERIMENTS = "experiments" 2025-06-01T21:04:17.8834240Z  2025-06-01T21:04:17.8834638Z LF_FLEET_EXPERIMENT = "lf" 2025-06-01T21:04:17.8835172Z CANARY_FLEET_SUFFIX = ".c" 2025-06-01T21:04:17.8835666Z  2025-06-01T21:04:17.8836205Z  2025-06-01T21:04:17.8836618Z class Experiment(NamedTuple): 2025-06-01T21:04:17.8837177Z  rollout_perc: float = ( 2025-06-01T21:04:17.8838145Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-01T21:04:17.8838875Z  ) 2025-06-01T21:04:17.8839306Z  all_branches: bool = ( 2025-06-01T21:04:17.8840039Z  False # If True, the experiment is also enabled on the exception branches 2025-06-01T21:04:17.8840815Z  ) 2025-06-01T21:04:17.8841240Z  default: bool = ( 2025-06-01T21:04:17.8841899Z  True # If True, the experiment is enabled by default for all queries 2025-06-01T21:04:17.8842598Z  ) 2025-06-01T21:04:17.8842991Z  2025-06-01T21:04:17.8843409Z  # Add more fields as needed 2025-06-01T21:04:17.8843937Z  2025-06-01T21:04:17.8844323Z  2025-06-01T21:04:17.8844745Z class Settings(NamedTuple): 2025-06-01T21:04:17.8845258Z  """ 2025-06-01T21:04:17.8846021Z  Settings for the experiments that can be opted into. 2025-06-01T21:04:17.8846695Z  """ 2025-06-01T21:04:17.8847105Z  2025-06-01T21:04:17.8847548Z  experiments: dict[str, Experiment] = {} 2025-06-01T21:04:17.8848115Z  2025-06-01T21:04:17.8848633Z  2025-06-01T21:04:17.8849106Z class ColorFormatter(logging.Formatter): 2025-06-01T21:04:17.8849823Z  """Color codes the log messages based on the log level""" 2025-06-01T21:04:17.8850451Z  2025-06-01T21:04:17.8850843Z  COLORS = { 2025-06-01T21:04:17.8851325Z  "WARNING": "\033[33m", # Yellow 2025-06-01T21:04:17.8851898Z  "ERROR": "\033[31m", # Red 2025-06-01T21:04:17.8852455Z  "CRITICAL": "\033[31m", # Red 2025-06-01T21:04:17.8853021Z  "INFO": "\033[0m", # Reset 2025-06-01T21:04:17.8853595Z  "DEBUG": "\033[0m", # Reset 2025-06-01T21:04:17.8854119Z  } 2025-06-01T21:04:17.8854555Z  2025-06-01T21:04:17.8855021Z  def format(self, record: LogRecord) -> str: 2025-06-01T21:04:17.8856017Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-01T21:04:17.8856876Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-01T21:04:17.8857520Z  return super().format(record) 2025-06-01T21:04:17.8858053Z  2025-06-01T21:04:17.8858427Z  2025-06-01T21:04:17.8858857Z handler = logging.StreamHandler() 2025-06-01T21:04:17.8859665Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-01T21:04:17.8860434Z  2025-06-01T21:04:17.8860933Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-01T21:04:17.8861578Z log.addHandler(handler) 2025-06-01T21:04:17.8862105Z log.setLevel(logging.INFO) 2025-06-01T21:04:17.8862606Z  2025-06-01T21:04:17.8862984Z  2025-06-01T21:04:17.8863487Z def set_github_output(key: str, value: str) -> None: 2025-06-01T21:04:17.8864113Z  """ 2025-06-01T21:04:17.8864695Z  Defines outputs of the github action that invokes this script 2025-06-01T21:04:17.8865375Z  """ 2025-06-01T21:04:17.8866119Z  if not GITHUB_OUTPUT: 2025-06-01T21:04:17.8867299Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-01T21:04:17.8868505Z  log.warning( 2025-06-01T21:04:17.8869461Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-01T21:04:17.8870450Z  ) 2025-06-01T21:04:17.8870948Z  print(f"::set-output name={key}::{value}") 2025-06-01T21:04:17.8871548Z  return 2025-06-01T21:04:17.8871980Z  2025-06-01T21:04:17.8872558Z  with open(GITHUB_OUTPUT, "a") as f: 2025-06-01T21:04:17.8873204Z  log.info(f"Setting output: {key}='{value}'") 2025-06-01T21:04:17.8873841Z  f.write(f"{key}={value}\n") 2025-06-01T21:04:17.8874371Z  2025-06-01T21:04:17.8874743Z  2025-06-01T21:04:17.8875304Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-01T21:04:17.8876194Z  return frozenset( 2025-06-01T21:04:17.8876912Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-01T21:04:17.8877652Z  ) 2025-06-01T21:04:17.8878066Z  2025-06-01T21:04:17.8878452Z  2025-06-01T21:04:17.8878864Z def parse_args() -> Any: 2025-06-01T21:04:17.8879550Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-06-01T21:04:17.8880503Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-01T21:04:17.8881351Z  parser.add_argument( 2025-06-01T21:04:17.8881893Z  "--github-issue-repo", 2025-06-01T21:04:17.8882446Z  type=str, 2025-06-01T21:04:17.8882939Z  required=False, 2025-06-01T21:04:17.8883605Z  default="pytorch/test-infra", 2025-06-01T21:04:17.8884249Z  help="GitHub repo to get the issue", 2025-06-01T21:04:17.8884819Z  ) 2025-06-01T21:04:17.8885242Z  parser.add_argument( 2025-06-01T21:04:17.8885990Z  "--github-repo", 2025-06-01T21:04:17.8886524Z  type=str, 2025-06-01T21:04:17.8887008Z  required=True, 2025-06-01T21:04:17.8887577Z  help="GitHub repo where CI is running", 2025-06-01T21:04:17.8888158Z  ) 2025-06-01T21:04:17.8888591Z  parser.add_argument( 2025-06-01T21:04:17.8889306Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-01T21:04:17.8890030Z  ) 2025-06-01T21:04:17.8890462Z  parser.add_argument( 2025-06-01T21:04:17.8891184Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-01T21:04:17.8891935Z  ) 2025-06-01T21:04:17.8892368Z  parser.add_argument( 2025-06-01T21:04:17.8893106Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-01T21:04:17.8893857Z  ) 2025-06-01T21:04:17.8894284Z  parser.add_argument( 2025-06-01T21:04:17.8895056Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-01T21:04:17.8895993Z  ) 2025-06-01T21:04:17.8896455Z  parser.add_argument( 2025-06-01T21:04:17.8896995Z  "--github-ref-type", 2025-06-01T21:04:17.8897535Z  type=str, 2025-06-01T21:04:17.8898039Z  required=True, 2025-06-01T21:04:17.8898636Z  help="Current GitHub ref type, branch or tag", 2025-06-01T21:04:17.8899244Z  ) 2025-06-01T21:04:17.8899675Z  parser.add_argument( 2025-06-01T21:04:17.8900228Z  "--eligible-experiments", 2025-06-01T21:04:17.8900843Z  type=_str_comma_separated_to_set, 2025-06-01T21:04:17.8901431Z  required=False, 2025-06-01T21:04:17.8901941Z  default="", 2025-06-01T21:04:17.8902904Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-01T21:04:17.8903906Z  ) 2025-06-01T21:04:17.8904339Z  parser.add_argument( 2025-06-01T21:04:17.8904885Z  "--opt-out-experiments", 2025-06-01T21:04:17.8905472Z  type=_str_comma_separated_to_set, 2025-06-01T21:04:17.8906232Z  required=False, 2025-06-01T21:04:17.8906746Z  default="", 2025-06-01T21:04:17.8907371Z  help=( 2025-06-01T21:04:17.8908155Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-01T21:04:17.8909391Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-01T21:04:17.8910301Z  ), 2025-06-01T21:04:17.8910723Z  ) 2025-06-01T21:04:17.8911161Z  parser.add_argument( 2025-06-01T21:04:17.8911680Z  "--pr-number", 2025-06-01T21:04:17.8912182Z  type=str, 2025-06-01T21:04:17.8912665Z  required=False, 2025-06-01T21:04:17.8913173Z  default="", 2025-06-01T21:04:17.8913752Z  help="the optional PR number where this is run", 2025-06-01T21:04:17.8914368Z  ) 2025-06-01T21:04:17.8914768Z  2025-06-01T21:04:17.8915187Z  return parser.parse_args() 2025-06-01T21:04:17.8915729Z  2025-06-01T21:04:17.8916277Z  2025-06-01T21:04:17.8916940Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-01T21:04:17.8917905Z  auth = Auth.Token(github_token) 2025-06-01T21:04:17.8918519Z  return Github(auth=auth) 2025-06-01T21:04:17.8919039Z  2025-06-01T21:04:17.8919418Z  2025-06-01T21:04:17.8920139Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-01T21:04:17.8921018Z  repo = gh.get_repo(repo) 2025-06-01T21:04:17.8921613Z  return repo.get_issue(number=issue_num) 2025-06-01T21:04:17.8922198Z  2025-06-01T21:04:17.8922583Z  2025-06-01T21:04:17.8922999Z def get_potential_pr_author( 2025-06-01T21:04:17.8923741Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-01T21:04:17.8924480Z ) -> str: 2025-06-01T21:04:17.8925101Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-01T21:04:17.8926208Z  # Fetch the actual username from the original PR. The PR number is 2025-06-01T21:04:17.8927061Z  # embedded in the tag name: ciflow// 2025-06-01T21:04:17.8927692Z  2025-06-01T21:04:17.8928125Z  gh = get_gh_client(github_token) 2025-06-01T21:04:17.8928671Z  2025-06-01T21:04:17.8929188Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-01T21:04:17.8929897Z  split_tag = ref_name.split("/") 2025-06-01T21:04:17.8930459Z  if ( 2025-06-01T21:04:17.8930911Z  len(split_tag) == 3 2025-06-01T21:04:17.8931473Z  and split_tag[0] == "ciflow" 2025-06-01T21:04:17.8932076Z  and split_tag[2].isnumeric() 2025-06-01T21:04:17.8932638Z  ): 2025-06-01T21:04:17.8933108Z  pr_number = split_tag[2] 2025-06-01T21:04:17.8933669Z  try: 2025-06-01T21:04:17.8934196Z  repository = gh.get_repo(repo) 2025-06-01T21:04:17.8934891Z  pull = repository.get_pull(number=int(pr_number)) 2025-06-01T21:04:17.8935578Z  except Exception as e: 2025-06-01T21:04:17.8936756Z  raise Exception( # noqa: TRY002 2025-06-01T21:04:17.8937542Z  f"issue with pull request {pr_number} from repo {repository}" 2025-06-01T21:04:17.8938269Z  ) from e 2025-06-01T21:04:17.8938929Z  return pull.user.login # type: ignore[no-any-return] 2025-06-01T21:04:17.8939738Z  # In all other cases, return the original input username 2025-06-01T21:04:17.8940399Z  return username 2025-06-01T21:04:17.8940880Z  2025-06-01T21:04:17.8941258Z  2025-06-01T21:04:17.8941894Z def is_exception_branch(branch: str) -> bool: 2025-06-01T21:04:17.8942489Z  """ 2025-06-01T21:04:17.8943232Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-01T21:04:17.8944091Z  """ 2025-06-01T21:04:17.8944719Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-01T21:04:17.8945460Z  2025-06-01T21:04:17.8945957Z  2025-06-01T21:04:17.8946408Z def load_yaml(yaml_text: str) -> Any: 2025-06-01T21:04:17.8946969Z  try: 2025-06-01T21:04:17.8947437Z  data = yaml.safe_load(yaml_text) 2025-06-01T21:04:17.8948011Z  return data 2025-06-01T21:04:17.8948521Z  except yaml.YAMLError: 2025-06-01T21:04:17.8949111Z  log.exception("Error loading YAML") 2025-06-01T21:04:17.8949691Z  raise 2025-06-01T21:04:17.8950142Z  2025-06-01T21:04:17.8950525Z  2025-06-01T21:04:17.8951220Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-01T21:04:17.8952040Z  """ 2025-06-01T21:04:17.8952873Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-01T21:04:17.8953704Z  2025-06-01T21:04:17.8954333Z  If the issue body contains "---" then the text above that is the settings 2025-06-01T21:04:17.8955199Z  and the text below is the list of opted in users. 2025-06-01T21:04:17.8955925Z  2025-06-01T21:04:17.8956566Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-01T21:04:17.8957328Z  """ 2025-06-01T21:04:17.8957859Z  rollout_state_parts = rollout_state.split("---") 2025-06-01T21:04:17.8958535Z  if len(rollout_state_parts) >= 2: 2025-06-01T21:04:17.8959309Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-06-01T21:04:17.8960139Z  else: 2025-06-01T21:04:17.8960595Z  return "", rollout_state 2025-06-01T21:04:17.8961115Z  2025-06-01T21:04:17.8961494Z  2025-06-01T21:04:17.8961954Z class UserOptins(dict[str, list[str]]): 2025-06-01T21:04:17.8962528Z  """ 2025-06-01T21:04:17.8963143Z  Dictionary of users with a list of features they have opted into 2025-06-01T21:04:17.8963863Z  """ 2025-06-01T21:04:17.8964263Z  2025-06-01T21:04:17.8964638Z  2025-06-01T21:04:17.8965234Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-01T21:04:17.8966118Z  """ 2025-06-01T21:04:17.8966924Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-01T21:04:17.8967827Z  2025-06-01T21:04:17.8968725Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-01T21:04:17.8969823Z  - Example line: "@User1,lf,split_build" 2025-06-01T21:04:17.8970597Z  - A "#" prefix indicates the user is opted out of all experiments 2025-06-01T21:04:17.8971299Z  2025-06-01T21:04:17.8971674Z  2025-06-01T21:04:17.8972053Z  """ 2025-06-01T21:04:17.8972486Z  optins = UserOptins() 2025-06-01T21:04:17.8973069Z  for user in user_optin_text.split("\n"): 2025-06-01T21:04:17.8973695Z  user = user.strip("\r\n\t -") 2025-06-01T21:04:17.8974324Z  if not user or not user.startswith("@"): 2025-06-01T21:04:17.8974949Z  # Not a valid user. Skip 2025-06-01T21:04:17.8975513Z  continue 2025-06-01T21:04:17.8976114Z  2025-06-01T21:04:17.8976508Z  if user: 2025-06-01T21:04:17.8977175Z  usr_name = user.split(",")[0].strip("@") 2025-06-01T21:04:17.8977932Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-01T21:04:17.8978632Z  2025-06-01T21:04:17.8979040Z  return optins 2025-06-01T21:04:17.8979497Z  2025-06-01T21:04:17.8979865Z  2025-06-01T21:04:17.8980417Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-01T21:04:17.8981090Z  """ 2025-06-01T21:04:17.8981572Z  Check if the experiment name is valid. 2025-06-01T21:04:17.8982172Z  A valid name: 2025-06-01T21:04:17.8982929Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-01T21:04:17.8983953Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-01T21:04:17.8984738Z  - Cannot contain spaces 2025-06-01T21:04:17.8985272Z  """ 2025-06-01T21:04:17.8985671Z  2025-06-01T21:04:17.8986278Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-01T21:04:17.8987076Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-01T21:04:17.8987941Z  2025-06-01T21:04:17.8988502Z  if valid: 2025-06-01T21:04:17.8988957Z  return True 2025-06-01T21:04:17.8989419Z  2025-06-01T21:04:17.8989798Z  log.error( 2025-06-01T21:04:17.8991380Z  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-06-01T21:04:17.8993033Z  ) 2025-06-01T21:04:17.8993442Z  return False 2025-06-01T21:04:17.8993903Z  2025-06-01T21:04:17.8994286Z  2025-06-01T21:04:17.8994856Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-01T21:04:17.8995557Z  """ 2025-06-01T21:04:17.8996335Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-01T21:04:17.8997120Z  """ 2025-06-01T21:04:17.8997532Z  try: 2025-06-01T21:04:17.8997961Z  if settings_text: 2025-06-01T21:04:17.8998791Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-01T21:04:17.8999662Z  # for easy reading 2025-06-01T21:04:17.9000560Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-01T21:04:17.9001533Z  # the backtick character in shell commands. 2025-06-01T21:04:17.9002219Z  backtick = chr(96) # backtick character 2025-06-01T21:04:17.9002980Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-01T21:04:17.9003734Z  settings = load_yaml(settings_text) 2025-06-01T21:04:17.9004307Z  2025-06-01T21:04:17.9004967Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-06-01T21:04:17.9005914Z  experiments = {} 2025-06-01T21:04:17.9006429Z  2025-06-01T21:04:17.9007048Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-01T21:04:17.9007884Z  if not is_valid_experiment_name(exp_name): 2025-06-01T21:04:17.9009084Z  # 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-06-01T21:04:17.9010211Z  continue 2025-06-01T21:04:17.9010719Z  2025-06-01T21:04:17.9011144Z  valid_settings = {} 2025-06-01T21:04:17.9011870Z  for setting in exp_settings: 2025-06-01T21:04:17.9012521Z  if setting not in Experiment._fields: 2025-06-01T21:04:17.9013151Z  log.warning( 2025-06-01T21:04:17.9013958Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-01T21:04:17.9014741Z  ) 2025-06-01T21:04:17.9015237Z  else: 2025-06-01T21:04:17.9016059Z  valid_settings[setting] = exp_settings[setting] 2025-06-01T21:04:17.9016691Z  2025-06-01T21:04:17.9017218Z  experiments[exp_name] = Experiment(**valid_settings) 2025-06-01T21:04:17.9017927Z  return Settings(experiments) 2025-06-01T21:04:17.9018482Z  2025-06-01T21:04:17.9018885Z  except Exception: 2025-06-01T21:04:17.9019452Z  log.exception("Failed to parse settings") 2025-06-01T21:04:17.9020056Z  2025-06-01T21:04:17.9020455Z  return Settings() 2025-06-01T21:04:17.9020930Z  2025-06-01T21:04:17.9021292Z  2025-06-01T21:04:17.9021925Z def parse_settings(rollout_state: str) -> Settings: 2025-06-01T21:04:17.9022562Z  """ 2025-06-01T21:04:17.9023066Z  Parse settings, if any, from the rollout state. 2025-06-01T21:04:17.9023673Z  2025-06-01T21:04:17.9024274Z  If the issue body contains "---" then the text above that is the settings 2025-06-01T21:04:17.9025124Z  and the text below is the list of opted in users. 2025-06-01T21:04:17.9025733Z  2025-06-01T21:04:17.9026502Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-01T21:04:17.9027289Z  """ 2025-06-01T21:04:17.9027919Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T21:04:17.9028779Z  return parse_settings_from_text(settings_text) 2025-06-01T21:04:17.9029379Z  2025-06-01T21:04:17.9029751Z  2025-06-01T21:04:17.9030260Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-01T21:04:17.9030892Z  """ 2025-06-01T21:04:17.9031353Z  Parse users from the rollout state. 2025-06-01T21:04:17.9031920Z  2025-06-01T21:04:17.9032290Z  """ 2025-06-01T21:04:17.9032907Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T21:04:17.9033738Z  return parse_user_opt_in_from_text(users_text) 2025-06-01T21:04:17.9034342Z  2025-06-01T21:04:17.9034723Z  2025-06-01T21:04:17.9035407Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T21:04:17.9036329Z  """ 2025-06-01T21:04:17.9036832Z  Check if a user is opted into an experiment 2025-06-01T21:04:17.9037438Z  """ 2025-06-01T21:04:17.9037981Z  return experiment_name in user_optins.get(user, []) 2025-06-01T21:04:17.9038610Z  2025-06-01T21:04:17.9038986Z  2025-06-01T21:04:17.9039678Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T21:04:17.9040507Z  """ 2025-06-01T21:04:17.9041045Z  Check if a user explicitly opted out of an experiment 2025-06-01T21:04:17.9041699Z  """ 2025-06-01T21:04:17.9042288Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-01T21:04:17.9043061Z  experiment_optout = "-" + experiment_name 2025-06-01T21:04:17.9043793Z  if experiment_optout not in user_optins.get(user, []): 2025-06-01T21:04:17.9044455Z  return False 2025-06-01T21:04:17.9044919Z  2025-06-01T21:04:17.9045436Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-06-01T21:04:17.9046335Z  log.warning( 2025-06-01T21:04:17.9047258Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-01T21:04:17.9048202Z  ) 2025-06-01T21:04:17.9048621Z  2025-06-01T21:04:17.9049008Z  return True 2025-06-01T21:04:17.9049463Z  2025-06-01T21:04:17.9049833Z  2025-06-01T21:04:17.9050237Z def get_runner_prefix( 2025-06-01T21:04:17.9050756Z  rollout_state: str, 2025-06-01T21:04:17.9051315Z  workflow_requestors: Iterable[str], 2025-06-01T21:04:17.9051903Z  branch: str, 2025-06-01T21:04:17.9052493Z  eligible_experiments: frozenset[str] = frozenset(), 2025-06-01T21:04:17.9053253Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-06-01T21:04:17.9053897Z  is_canary: bool = False, 2025-06-01T21:04:17.9054452Z ) -> str: 2025-06-01T21:04:17.9054945Z  settings = parse_settings(rollout_state) 2025-06-01T21:04:17.9055616Z  user_optins = parse_users(rollout_state) 2025-06-01T21:04:17.9056289Z  2025-06-01T21:04:17.9056814Z  fleet_prefix = "" 2025-06-01T21:04:17.9057325Z  prefixes = [] 2025-06-01T21:04:17.9058056Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-01T21:04:17.9059083Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-01T21:04:17.9059859Z  log.info( 2025-06-01T21:04:17.9060641Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-01T21:04:17.9061452Z  ) 2025-06-01T21:04:17.9061904Z  continue 2025-06-01T21:04:17.9062376Z  2025-06-01T21:04:17.9062787Z  if opt_out_experiments: 2025-06-01T21:04:17.9063418Z  if experiment_name in opt_out_experiments: 2025-06-01T21:04:17.9064147Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-01T21:04:17.9064807Z  log.info( 2025-06-01T21:04:17.9065946Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-01T21:04:17.9067002Z  ) 2025-06-01T21:04:17.9067479Z  continue 2025-06-01T21:04:17.9067961Z  2025-06-01T21:04:17.9068376Z  if eligible_experiments: 2025-06-01T21:04:17.9069021Z  if experiment_name not in eligible_experiments: 2025-06-01T21:04:17.9069742Z  exp_list = ", ".join(eligible_experiments) 2025-06-01T21:04:17.9070364Z  log.info( 2025-06-01T21:04:17.9071264Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-01T21:04:17.9072183Z  ) 2025-06-01T21:04:17.9072650Z  continue 2025-06-01T21:04:17.9073228Z  elif not experiment_settings.default: 2025-06-01T21:04:17.9073816Z  log.info( 2025-06-01T21:04:17.9074576Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-01T21:04:17.9075413Z  ) 2025-06-01T21:04:17.9075954Z  continue 2025-06-01T21:04:17.9076419Z  2025-06-01T21:04:17.9076936Z  # Is any workflow_requestor opted out to this experiment? 2025-06-01T21:04:17.9077621Z  opted_out_users = [ 2025-06-01T21:04:17.9078142Z  requestor 2025-06-01T21:04:17.9078689Z  for requestor in workflow_requestors 2025-06-01T21:04:17.9079562Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-01T21:04:17.9080248Z  ] 2025-06-01T21:04:17.9080655Z  2025-06-01T21:04:17.9081059Z  if opted_out_users: 2025-06-01T21:04:17.9081603Z  log.info( 2025-06-01T21:04:17.9082335Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-01T21:04:17.9083097Z  ) 2025-06-01T21:04:17.9083541Z  continue 2025-06-01T21:04:17.9084010Z  2025-06-01T21:04:17.9084526Z  # Is any workflow_requestor opted in to this experiment? 2025-06-01T21:04:17.9085202Z  opted_in_users = [ 2025-06-01T21:04:17.9085730Z  requestor 2025-06-01T21:04:17.9086386Z  for requestor in workflow_requestors 2025-06-01T21:04:17.9087131Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-01T21:04:17.9087813Z  ] 2025-06-01T21:04:17.9088228Z  2025-06-01T21:04:17.9088632Z  enabled = False 2025-06-01T21:04:17.9089147Z  if opted_in_users: 2025-06-01T21:04:17.9089787Z  log.info( 2025-06-01T21:04:17.9090498Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-01T21:04:17.9091247Z  ) 2025-06-01T21:04:17.9091702Z  enabled = True 2025-06-01T21:04:17.9092204Z  2025-06-01T21:04:17.9092658Z  elif experiment_settings.rollout_perc: 2025-06-01T21:04:17.9093566Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-01T21:04:17.9094593Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-01T21:04:17.9095305Z  log.info( 2025-06-01T21:04:17.9096389Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-01T21:04:17.9097380Z  ) 2025-06-01T21:04:17.9097864Z  enabled = True 2025-06-01T21:04:17.9098393Z  2025-06-01T21:04:17.9098787Z  if enabled: 2025-06-01T21:04:17.9099298Z  label = experiment_name 2025-06-01T21:04:17.9099924Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-01T21:04:17.9100833Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-01T21:04:17.9101781Z  # - If it's enabled, then we always list it's prefix first 2025-06-01T21:04:17.9102630Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-01T21:04:17.9103364Z  if is_canary: 2025-06-01T21:04:17.9103943Z  label += CANARY_FLEET_SUFFIX 2025-06-01T21:04:17.9104555Z  fleet_prefix = label 2025-06-01T21:04:17.9105095Z  else: 2025-06-01T21:04:17.9105609Z  prefixes.append(label) 2025-06-01T21:04:17.9106259Z  2025-06-01T21:04:17.9106660Z  if len(prefixes) > 1: 2025-06-01T21:04:17.9107176Z  log.error( 2025-06-01T21:04:17.9108320Z  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-06-01T21:04:17.9109515Z  ) 2025-06-01T21:04:17.9109966Z  prefixes = prefixes[:1] 2025-06-01T21:04:17.9110497Z  2025-06-01T21:04:17.9110906Z  # Fleet always comes first 2025-06-01T21:04:17.9111445Z  if fleet_prefix: 2025-06-01T21:04:17.9111977Z  prefixes.insert(0, fleet_prefix) 2025-06-01T21:04:17.9112659Z  2025-06-01T21:04:17.9113158Z  return ".".join(prefixes) + "." if prefixes else "" 2025-06-01T21:04:17.9113777Z  2025-06-01T21:04:17.9114152Z  2025-06-01T21:04:17.9114847Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-01T21:04:17.9115682Z  """ 2025-06-01T21:04:17.9116445Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-06-01T21:04:17.9117209Z  2025-06-01T21:04:17.9117861Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-01T21:04:17.9118617Z  """ 2025-06-01T21:04:17.9119137Z  gh = get_gh_client(github_token) 2025-06-01T21:04:17.9119765Z  issue = get_issue(gh, repo, issue_num) 2025-06-01T21:04:17.9120485Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-01T21:04:17.9121143Z  2025-06-01T21:04:17.9121515Z  2025-06-01T21:04:17.9122169Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-01T21:04:17.9123110Z  for _ in range(num_retries): 2025-06-01T21:04:17.9123657Z  try: 2025-06-01T21:04:17.9124158Z  req = Request(url=url, headers=headers) 2025-06-01T21:04:17.9124893Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-01T21:04:17.9125610Z  return json.loads(content) 2025-06-01T21:04:17.9126297Z  except Exception as e: 2025-06-01T21:04:17.9126993Z  log.warning(f"Could not download {url}: {e}") 2025-06-01T21:04:17.9127592Z  2025-06-01T21:04:17.9128225Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-01T21:04:17.9129003Z  return {} 2025-06-01T21:04:17.9129455Z  2025-06-01T21:04:17.9129830Z  2025-06-01T21:04:17.9130211Z @cache 2025-06-01T21:04:17.9130915Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-01T21:04:17.9131727Z  """ 2025-06-01T21:04:17.9132184Z  Dynamically get PR information 2025-06-01T21:04:17.9132726Z  """ 2025-06-01T21:04:17.9133299Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-01T21:04:17.9133980Z  headers = { 2025-06-01T21:04:17.9134533Z  "Accept": "application/vnd.github.v3+json", 2025-06-01T21:04:17.9135209Z  "Authorization": f"token {github_token}", 2025-06-01T21:04:17.9135889Z  } 2025-06-01T21:04:17.9136394Z  json_response: dict[str, Any] = download_json( 2025-06-01T21:04:17.9137088Z  url=f"{github_api}/issues/{pr_number}", 2025-06-01T21:04:17.9137696Z  headers=headers, 2025-06-01T21:04:17.9138193Z  ) 2025-06-01T21:04:17.9138586Z  2025-06-01T21:04:17.9138996Z  if not json_response: 2025-06-01T21:04:17.9139660Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-01T21:04:17.9140352Z  return {} 2025-06-01T21:04:17.9140801Z  2025-06-01T21:04:17.9141210Z  return json_response 2025-06-01T21:04:17.9141702Z  2025-06-01T21:04:17.9142074Z  2025-06-01T21:04:17.9142716Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-01T21:04:17.9143500Z  """ 2025-06-01T21:04:17.9144101Z  Dynamically get the latest list of labels from the pull request 2025-06-01T21:04:17.9144811Z  """ 2025-06-01T21:04:17.9145375Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-01T21:04:17.9146138Z  return { 2025-06-01T21:04:17.9146957Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-01T21:04:17.9147698Z  } 2025-06-01T21:04:17.9148095Z  2025-06-01T21:04:17.9148465Z  2025-06-01T21:04:17.9148867Z def main() -> None: 2025-06-01T21:04:17.9149362Z  args = parse_args() 2025-06-01T21:04:17.9149849Z  2025-06-01T21:04:17.9150317Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-01T21:04:17.9150908Z  2025-06-01T21:04:17.9151327Z  # Check if the PR is opt-out 2025-06-01T21:04:17.9151883Z  if args.pr_number: 2025-06-01T21:04:17.9152641Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-01T21:04:17.9153461Z  if OPT_OUT_LABEL in labels: 2025-06-01T21:04:17.9154007Z  log.info( 2025-06-01T21:04:17.9154822Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-01T21:04:17.9155645Z  ) 2025-06-01T21:04:17.9156386Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T21:04:17.9157112Z  sys.exit() 2025-06-01T21:04:17.9157709Z  2025-06-01T21:04:17.9158102Z  try: 2025-06-01T21:04:17.9158603Z  rollout_state = get_rollout_state_from_issue( 2025-06-01T21:04:17.9159394Z  args.github_token, args.github_issue_repo, args.github_issue 2025-06-01T21:04:17.9160091Z  ) 2025-06-01T21:04:17.9160504Z  2025-06-01T21:04:17.9160945Z  username = get_potential_pr_author( 2025-06-01T21:04:17.9161546Z  args.github_token, 2025-06-01T21:04:17.9162092Z  args.github_repo, 2025-06-01T21:04:17.9162636Z  args.github_actor, 2025-06-01T21:04:17.9163194Z  args.github_ref_type, 2025-06-01T21:04:17.9163760Z  args.github_branch, 2025-06-01T21:04:17.9164280Z  ) 2025-06-01T21:04:17.9164691Z  2025-06-01T21:04:17.9165222Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-01T21:04:17.9165977Z  2025-06-01T21:04:17.9166437Z  runner_label_prefix = get_runner_prefix( 2025-06-01T21:04:17.9167048Z  rollout_state, 2025-06-01T21:04:17.9167612Z  (args.github_issue_owner, username), 2025-06-01T21:04:17.9168208Z  args.github_branch, 2025-06-01T21:04:17.9168786Z  args.eligible_experiments, 2025-06-01T21:04:17.9169394Z  args.opt_out_experiments, 2025-06-01T21:04:17.9169949Z  is_canary, 2025-06-01T21:04:17.9170435Z  ) 2025-06-01T21:04:17.9170843Z  2025-06-01T21:04:17.9171259Z  except Exception as e: 2025-06-01T21:04:17.9171797Z  log.error( 2025-06-01T21:04:17.9172574Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-01T21:04:17.9173407Z  ) 2025-06-01T21:04:17.9173823Z  2025-06-01T21:04:17.9174412Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T21:04:17.9175124Z  2025-06-01T21:04:17.9175505Z  2025-06-01T21:04:17.9176000Z if __name__ == "__main__": 2025-06-01T21:04:17.9176522Z  main() 2025-06-01T21:04:17.9176947Z  2025-06-01T21:04:17.9177320Z EOF 2025-06-01T21:04:17.9177717Z  2025-06-01T21:04:17.9178130Z cat runner_determinator.py 2025-06-01T21:04:17.9829377Z shell: /usr/bin/bash -e {0} 2025-06-01T21:04:17.9830191Z env: 2025-06-01T21:04:17.9830909Z GITHUB_TOKEN: *** 2025-06-01T21:04:17.9831341Z ISSUE_NUMBER: 5132 2025-06-01T21:04:17.9831796Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T21:04:17.9832599Z ISSUE_OWNER: 2025-06-01T21:04:17.9833007Z CHECK_EXPERIMENTS: 2025-06-01T21:04:17.9833446Z OPT_OUT_EXPERIMENTS: 2025-06-01T21:04:17.9833883Z PR_NUMBER: 2025-06-01T21:04:17.9834272Z ##[endgroup] 2025-06-01T21:04:18.0066515Z # flake8: noqa: G004 2025-06-01T21:04:18.0067005Z 2025-06-01T21:04:18.0067478Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-06-01T21:04:18.0068427Z # must be kept in sync. You can do it easily by running the following command: 2025-06-01T21:04:18.0069286Z # python .github/scripts/update_runner_determinator.py 2025-06-01T21:04:18.0069740Z 2025-06-01T21:04:18.0069897Z """ 2025-06-01T21:04:18.0070486Z This runner determinator is used to determine which set of runners to run a 2025-06-01T21:04:18.0071369Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-06-01T21:04:18.0072275Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-06-01T21:04:18.0073096Z of which runners should be used to run which job. 2025-06-01T21:04:18.0073505Z 2025-06-01T21:04:18.0073883Z The configuration has two parts, the settings and a list of opted-in users, 2025-06-01T21:04:18.0074964Z separated by a line containing "---". If the line is not present, the 2025-06-01T21:04:18.0076109Z settings are considered to be empty with only the second part, the user 2025-06-01T21:04:18.0076830Z list, defined. 2025-06-01T21:04:18.0077053Z 2025-06-01T21:04:18.0077423Z The first part is a YAML block that defines the rollout settings. This can be 2025-06-01T21:04:18.0078354Z used to define any settings that are needed to determine which runners to use. 2025-06-01T21:04:18.0079185Z It's fields are defined by the RolloutSettings class below. 2025-06-01T21:04:18.0079641Z 2025-06-01T21:04:18.0080020Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-06-01T21:04:18.0080899Z The user list is also a comma separated list of additional features or 2025-06-01T21:04:18.0081638Z experiments which the user could be opted in to. 2025-06-01T21:04:18.0082044Z 2025-06-01T21:04:18.0082253Z The user list has the following rules: 2025-06-01T21:04:18.0082598Z 2025-06-01T21:04:18.0082916Z - Users are GitHub usernames, which must start with the @ prefix 2025-06-01T21:04:18.0083777Z - Each user is also a comma-separated list of features/experiments to enable 2025-06-01T21:04:18.0084541Z - A "#" prefix opts the user out of all experiments 2025-06-01T21:04:18.0084931Z 2025-06-01T21:04:18.0085098Z Example config: 2025-06-01T21:04:18.0085559Z # A list of experiments that can be opted into. 2025-06-01T21:04:18.0086489Z # This defines the behavior they'll induce when opted into. 2025-06-01T21:04:18.0087117Z # Expected syntax is: 2025-06-01T21:04:18.0087754Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-06-01T21:04:18.0088727Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-06-01T21:04:18.0089345Z 2025-06-01T21:04:18.0089521Z experiments: 2025-06-01T21:04:18.0089914Z lf: 2025-06-01T21:04:18.0090298Z rollout_percent: 25 2025-06-01T21:04:18.0090763Z all_branches: false 2025-06-01T21:04:18.0091219Z default: true 2025-06-01T21:04:18.0091630Z --- 2025-06-01T21:04:18.0091838Z 2025-06-01T21:04:18.0091999Z # Opt-ins: 2025-06-01T21:04:18.0092577Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-06-01T21:04:18.0093455Z # and specifying experiments to enable in a comma-separated list. 2025-06-01T21:04:18.0094231Z # To always opt out of an experiment, prefix it with a "-". 2025-06-01T21:04:18.0094892Z # Experiments should be from the above list. 2025-06-01T21:04:18.0095276Z 2025-06-01T21:04:18.0095461Z @User1,-lf,split_build 2025-06-01T21:04:18.0096096Z @User2,lf 2025-06-01T21:04:18.0096539Z @User3,split_build 2025-06-01T21:04:18.0096948Z """ 2025-06-01T21:04:18.0097305Z 2025-06-01T21:04:18.0097472Z import json 2025-06-01T21:04:18.0097840Z import logging 2025-06-01T21:04:18.0098224Z import os 2025-06-01T21:04:18.0098585Z import random 2025-06-01T21:04:18.0098965Z import re 2025-06-01T21:04:18.0099329Z import sys 2025-06-01T21:04:18.0099746Z from argparse import ArgumentParser 2025-06-01T21:04:18.0100289Z from collections.abc import Iterable 2025-06-01T21:04:18.0100809Z from functools import cache 2025-06-01T21:04:18.0101293Z from logging import LogRecord 2025-06-01T21:04:18.0101786Z from typing import Any, NamedTuple 2025-06-01T21:04:18.0102327Z from urllib.request import Request, urlopen 2025-06-01T21:04:18.0102702Z 2025-06-01T21:04:18.0102869Z import yaml 2025-06-01T21:04:18.0103261Z from github import Auth, Github 2025-06-01T21:04:18.0103791Z from github.Issue import Issue 2025-06-01T21:04:18.0104104Z 2025-06-01T21:04:18.0104110Z 2025-06-01T21:04:18.0104327Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-06-01T21:04:18.0105017Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-06-01T21:04:18.0106338Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-06-01T21:04:18.0106968Z 2025-06-01T21:04:18.0107199Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-06-01T21:04:18.0107911Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-06-01T21:04:18.0108441Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-06-01T21:04:18.0108989Z OPT_OUT_LABEL = "no-runner-experiments" 2025-06-01T21:04:18.0109347Z 2025-06-01T21:04:18.0109543Z SETTING_EXPERIMENTS = "experiments" 2025-06-01T21:04:18.0109880Z 2025-06-01T21:04:18.0110069Z LF_FLEET_EXPERIMENT = "lf" 2025-06-01T21:04:18.0110536Z CANARY_FLEET_SUFFIX = ".c" 2025-06-01T21:04:18.0110818Z 2025-06-01T21:04:18.0110830Z 2025-06-01T21:04:18.0111023Z class Experiment(NamedTuple): 2025-06-01T21:04:18.0111502Z rollout_perc: float = ( 2025-06-01T21:04:18.0112160Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-06-01T21:04:18.0112841Z ) 2025-06-01T21:04:18.0113221Z all_branches: bool = ( 2025-06-01T21:04:18.0113846Z False # If True, the experiment is also enabled on the exception branches 2025-06-01T21:04:18.0114511Z ) 2025-06-01T21:04:18.0114877Z default: bool = ( 2025-06-01T21:04:18.0115456Z True # If True, the experiment is enabled by default for all queries 2025-06-01T21:04:18.0116328Z ) 2025-06-01T21:04:18.0116531Z 2025-06-01T21:04:18.0116713Z # Add more fields as needed 2025-06-01T21:04:18.0117024Z 2025-06-01T21:04:18.0117031Z 2025-06-01T21:04:18.0117219Z class Settings(NamedTuple): 2025-06-01T21:04:18.0117671Z """ 2025-06-01T21:04:18.0118120Z Settings for the experiments that can be opted into. 2025-06-01T21:04:18.0118701Z """ 2025-06-01T21:04:18.0118898Z 2025-06-01T21:04:18.0119104Z experiments: dict[str, Experiment] = {} 2025-06-01T21:04:18.0119467Z 2025-06-01T21:04:18.0119479Z 2025-06-01T21:04:18.0119691Z class ColorFormatter(logging.Formatter): 2025-06-01T21:04:18.0120316Z """Color codes the log messages based on the log level""" 2025-06-01T21:04:18.0120760Z 2025-06-01T21:04:18.0120921Z COLORS = { 2025-06-01T21:04:18.0121502Z "WARNING": "\033[33m", # Yellow 2025-06-01T21:04:18.0122135Z "ERROR": "\033[31m", # Red 2025-06-01T21:04:18.0122636Z "CRITICAL": "\033[31m", # Red 2025-06-01T21:04:18.0123147Z "INFO": "\033[0m", # Reset 2025-06-01T21:04:18.0123644Z "DEBUG": "\033[0m", # Reset 2025-06-01T21:04:18.0124113Z } 2025-06-01T21:04:18.0124313Z 2025-06-01T21:04:18.0124535Z def format(self, record: LogRecord) -> str: 2025-06-01T21:04:18.0125281Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-06-01T21:04:18.0126289Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-06-01T21:04:18.0126878Z return super().format(record) 2025-06-01T21:04:18.0127217Z 2025-06-01T21:04:18.0127223Z 2025-06-01T21:04:18.0127418Z handler = logging.StreamHandler() 2025-06-01T21:04:18.0128296Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-06-01T21:04:18.0128858Z 2025-06-01T21:04:18.0129105Z log = logging.getLogger(os.path.basename(__file__)) 2025-06-01T21:04:18.0129693Z log.addHandler(handler) 2025-06-01T21:04:18.0130144Z log.setLevel(logging.INFO) 2025-06-01T21:04:18.0130439Z 2025-06-01T21:04:18.0130445Z 2025-06-01T21:04:18.0130694Z def set_github_output(key: str, value: str) -> None: 2025-06-01T21:04:18.0131257Z """ 2025-06-01T21:04:18.0131760Z Defines outputs of the github action that invokes this script 2025-06-01T21:04:18.0132397Z """ 2025-06-01T21:04:18.0132768Z if not GITHUB_OUTPUT: 2025-06-01T21:04:18.0133845Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-06-01T21:04:18.0134978Z log.warning( 2025-06-01T21:04:18.0135948Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-06-01T21:04:18.0136896Z ) 2025-06-01T21:04:18.0147093Z print(f"::set-output name={key}::{value}") 2025-06-01T21:04:18.0147734Z return 2025-06-01T21:04:18.0147974Z 2025-06-01T21:04:18.0148360Z with open(GITHUB_OUTPUT, "a") as f: 2025-06-01T21:04:18.0148971Z log.info(f"Setting output: {key}='{value}'") 2025-06-01T21:04:18.0149547Z f.write(f"{key}={value}\n") 2025-06-01T21:04:18.0149886Z 2025-06-01T21:04:18.0149894Z 2025-06-01T21:04:18.0150198Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-06-01T21:04:18.0150842Z return frozenset( 2025-06-01T21:04:18.0151458Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-06-01T21:04:18.0152163Z ) 2025-06-01T21:04:18.0152366Z 2025-06-01T21:04:18.0152373Z 2025-06-01T21:04:18.0152562Z def parse_args() -> Any: 2025-06-01T21:04:18.0153137Z parser = ArgumentParser("Get dynamic rollout settings") 2025-06-01T21:04:18.0154002Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-06-01T21:04:18.0154784Z parser.add_argument( 2025-06-01T21:04:18.0155245Z "--github-issue-repo", 2025-06-01T21:04:18.0155705Z type=str, 2025-06-01T21:04:18.0156373Z required=False, 2025-06-01T21:04:18.0156834Z default="pytorch/test-infra", 2025-06-01T21:04:18.0157373Z help="GitHub repo to get the issue", 2025-06-01T21:04:18.0157886Z ) 2025-06-01T21:04:18.0158262Z parser.add_argument( 2025-06-01T21:04:18.0158703Z "--github-repo", 2025-06-01T21:04:18.0159135Z type=str, 2025-06-01T21:04:18.0159526Z required=True, 2025-06-01T21:04:18.0159994Z help="GitHub repo where CI is running", 2025-06-01T21:04:18.0160519Z ) 2025-06-01T21:04:18.0160885Z parser.add_argument( 2025-06-01T21:04:18.0161490Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-06-01T21:04:18.0162147Z ) 2025-06-01T21:04:18.0162519Z parser.add_argument( 2025-06-01T21:04:18.0163148Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-06-01T21:04:18.0163838Z ) 2025-06-01T21:04:18.0164202Z parser.add_argument( 2025-06-01T21:04:18.0164846Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-06-01T21:04:18.0165547Z ) 2025-06-01T21:04:18.0166034Z parser.add_argument( 2025-06-01T21:04:18.0166691Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-06-01T21:04:18.0167411Z ) 2025-06-01T21:04:18.0167786Z parser.add_argument( 2025-06-01T21:04:18.0168244Z "--github-ref-type", 2025-06-01T21:04:18.0168708Z type=str, 2025-06-01T21:04:18.0169104Z required=True, 2025-06-01T21:04:18.0169594Z help="Current GitHub ref type, branch or tag", 2025-06-01T21:04:18.0170139Z ) 2025-06-01T21:04:18.0170512Z parser.add_argument( 2025-06-01T21:04:18.0170983Z "--eligible-experiments", 2025-06-01T21:04:18.0171656Z type=_str_comma_separated_to_set, 2025-06-01T21:04:18.0172179Z required=False, 2025-06-01T21:04:18.0172605Z default="", 2025-06-01T21:04:18.0173469Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-06-01T21:04:18.0222225Z ) 2025-06-01T21:04:18.0222896Z parser.add_argument( 2025-06-01T21:04:18.0223465Z "--opt-out-experiments", 2025-06-01T21:04:18.0224008Z type=_str_comma_separated_to_set, 2025-06-01T21:04:18.0224543Z required=False, 2025-06-01T21:04:18.0224968Z default="", 2025-06-01T21:04:18.0225366Z help=( 2025-06-01T21:04:18.0226175Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-06-01T21:04:18.0227357Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-06-01T21:04:18.0228619Z ), 2025-06-01T21:04:18.0229068Z ) 2025-06-01T21:04:18.0229443Z parser.add_argument( 2025-06-01T21:04:18.0229887Z "--pr-number", 2025-06-01T21:04:18.0230309Z type=str, 2025-06-01T21:04:18.0230699Z required=False, 2025-06-01T21:04:18.0231115Z default="", 2025-06-01T21:04:18.0231770Z help="the optional PR number where this is run", 2025-06-01T21:04:18.0232438Z ) 2025-06-01T21:04:18.0232638Z 2025-06-01T21:04:18.0232830Z return parser.parse_args() 2025-06-01T21:04:18.0233146Z 2025-06-01T21:04:18.0233153Z 2025-06-01T21:04:18.0233559Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-06-01T21:04:18.0234319Z auth = Auth.Token(github_token) 2025-06-01T21:04:18.0234828Z return Github(auth=auth) 2025-06-01T21:04:18.0235131Z 2025-06-01T21:04:18.0235144Z 2025-06-01T21:04:18.0235594Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-06-01T21:04:18.0236562Z repo = gh.get_repo(repo) 2025-06-01T21:04:18.0237074Z return repo.get_issue(number=issue_num) 2025-06-01T21:04:18.0237440Z 2025-06-01T21:04:18.0237446Z 2025-06-01T21:04:18.0237642Z def get_potential_pr_author( 2025-06-01T21:04:18.0238288Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-06-01T21:04:18.0238977Z ) -> str: 2025-06-01T21:04:18.0239487Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-06-01T21:04:18.0240293Z # Fetch the actual username from the original PR. The PR number is 2025-06-01T21:04:18.0241033Z # embedded in the tag name: ciflow// 2025-06-01T21:04:18.0241451Z 2025-06-01T21:04:18.0241648Z gh = get_gh_client(github_token) 2025-06-01T21:04:18.0241981Z 2025-06-01T21:04:18.0242255Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-06-01T21:04:18.0242875Z split_tag = ref_name.split("/") 2025-06-01T21:04:18.0243384Z if ( 2025-06-01T21:04:18.0243773Z len(split_tag) == 3 2025-06-01T21:04:18.0244263Z and split_tag[0] == "ciflow" 2025-06-01T21:04:18.0244786Z and split_tag[2].isnumeric() 2025-06-01T21:04:18.0245283Z ): 2025-06-01T21:04:18.0245672Z pr_number = split_tag[2] 2025-06-01T21:04:18.0246316Z try: 2025-06-01T21:04:18.0246759Z repository = gh.get_repo(repo) 2025-06-01T21:04:18.0247384Z pull = repository.get_pull(number=int(pr_number)) 2025-06-01T21:04:18.0247989Z except Exception as e: 2025-06-01T21:04:18.0248509Z raise Exception( # noqa: TRY002 2025-06-01T21:04:18.0249187Z f"issue with pull request {pr_number} from repo {repository}" 2025-06-01T21:04:18.0249836Z ) from e 2025-06-01T21:04:18.0250382Z return pull.user.login # type: ignore[no-any-return] 2025-06-01T21:04:18.0251073Z # In all other cases, return the original input username 2025-06-01T21:04:18.0251687Z return username 2025-06-01T21:04:18.0251929Z 2025-06-01T21:04:18.0252065Z 2025-06-01T21:04:18.0252305Z def is_exception_branch(branch: str) -> bool: 2025-06-01T21:04:18.0252846Z """ 2025-06-01T21:04:18.0253491Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-06-01T21:04:18.0254268Z """ 2025-06-01T21:04:18.0254817Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-06-01T21:04:18.0255334Z 2025-06-01T21:04:18.0255340Z 2025-06-01T21:04:18.0255536Z def load_yaml(yaml_text: str) -> Any: 2025-06-01T21:04:18.0256143Z try: 2025-06-01T21:04:18.0256537Z data = yaml.safe_load(yaml_text) 2025-06-01T21:04:18.0257045Z return data 2025-06-01T21:04:18.0257461Z except yaml.YAMLError: 2025-06-01T21:04:18.0257940Z log.exception("Error loading YAML") 2025-06-01T21:04:18.0258453Z raise 2025-06-01T21:04:18.0258671Z 2025-06-01T21:04:18.0258677Z 2025-06-01T21:04:18.0259105Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-06-01T21:04:18.0259857Z """ 2025-06-01T21:04:18.0260468Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-06-01T21:04:18.0261078Z 2025-06-01T21:04:18.0261554Z If the issue body contains "---" then the text above that is the settings 2025-06-01T21:04:18.0262329Z and the text below is the list of opted in users. 2025-06-01T21:04:18.0262728Z 2025-06-01T21:04:18.0263100Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-06-01T21:04:18.0263803Z """ 2025-06-01T21:04:18.0264246Z rollout_state_parts = rollout_state.split("---") 2025-06-01T21:04:18.0264867Z if len(rollout_state_parts) >= 2: 2025-06-01T21:04:18.0265466Z return rollout_state_parts[0], rollout_state_parts[1] 2025-06-01T21:04:18.0266179Z else: 2025-06-01T21:04:18.0266567Z return "", rollout_state 2025-06-01T21:04:18.0266886Z 2025-06-01T21:04:18.0266893Z 2025-06-01T21:04:18.0267095Z class UserOptins(dict[str, list[str]]): 2025-06-01T21:04:18.0267615Z """ 2025-06-01T21:04:18.0268137Z Dictionary of users with a list of features they have opted into 2025-06-01T21:04:18.0268787Z """ 2025-06-01T21:04:18.0268987Z 2025-06-01T21:04:18.0268994Z 2025-06-01T21:04:18.0269340Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-06-01T21:04:18.0270004Z """ 2025-06-01T21:04:18.0270722Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-06-01T21:04:18.0271406Z 2025-06-01T21:04:18.0272029Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-06-01T21:04:18.0273028Z - Example line: "@User1,lf,split_build" 2025-06-01T21:04:18.0273708Z - A "#" prefix indicates the user is opted out of all experiments 2025-06-01T21:04:18.0274193Z 2025-06-01T21:04:18.0274200Z 2025-06-01T21:04:18.0274364Z """ 2025-06-01T21:04:18.0274750Z optins = UserOptins() 2025-06-01T21:04:18.0275239Z for user in user_optin_text.split("\n"): 2025-06-01T21:04:18.0275928Z user = user.strip("\r\n\t -") 2025-06-01T21:04:18.0276479Z if not user or not user.startswith("@"): 2025-06-01T21:04:18.0277053Z # Not a valid user. Skip 2025-06-01T21:04:18.0277552Z continue 2025-06-01T21:04:18.0277803Z 2025-06-01T21:04:18.0277968Z if user: 2025-06-01T21:04:18.0278407Z usr_name = user.split(",")[0].strip("@") 2025-06-01T21:04:18.0279106Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-06-01T21:04:18.0279601Z 2025-06-01T21:04:18.0279775Z return optins 2025-06-01T21:04:18.0280014Z 2025-06-01T21:04:18.0280021Z 2025-06-01T21:04:18.0280308Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-06-01T21:04:18.0280920Z """ 2025-06-01T21:04:18.0281319Z Check if the experiment name is valid. 2025-06-01T21:04:18.0281844Z A valid name: 2025-06-01T21:04:18.0282620Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-06-01T21:04:18.0283581Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-06-01T21:04:18.0284328Z - Cannot contain spaces 2025-06-01T21:04:18.0284801Z """ 2025-06-01T21:04:18.0285002Z 2025-06-01T21:04:18.0285276Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-06-01T21:04:18.0286106Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-06-01T21:04:18.0286564Z 2025-06-01T21:04:18.0286729Z if valid: 2025-06-01T21:04:18.0287113Z return True 2025-06-01T21:04:18.0287361Z 2025-06-01T21:04:18.0287527Z log.error( 2025-06-01T21:04:18.0288998Z 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-06-01T21:04:18.0290744Z ) 2025-06-01T21:04:18.0291120Z return False 2025-06-01T21:04:18.0291358Z 2025-06-01T21:04:18.0291366Z 2025-06-01T21:04:18.0291669Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-06-01T21:04:18.0292300Z """ 2025-06-01T21:04:18.0293015Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-06-01T21:04:18.0293746Z """ 2025-06-01T21:04:18.0294104Z try: 2025-06-01T21:04:18.0294488Z if settings_text: 2025-06-01T21:04:18.0295214Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-06-01T21:04:18.0296129Z # for easy reading 2025-06-01T21:04:18.0296920Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-06-01T21:04:18.0297809Z # the backtick character in shell commands. 2025-06-01T21:04:18.0298413Z backtick = chr(96) # backtick character 2025-06-01T21:04:18.0299089Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-06-01T21:04:18.0299753Z settings = load_yaml(settings_text) 2025-06-01T21:04:18.0300129Z 2025-06-01T21:04:18.0300548Z # For now we just load experiments. We can expand this if/when we add more settings 2025-06-01T21:04:18.0301313Z experiments = {} 2025-06-01T21:04:18.0301621Z 2025-06-01T21:04:18.0301999Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-06-01T21:04:18.0302771Z if not is_valid_experiment_name(exp_name): 2025-06-01T21:04:18.0303977Z # 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-06-01T21:04:18.0305042Z continue 2025-06-01T21:04:18.0305329Z 2025-06-01T21:04:18.0305506Z valid_settings = {} 2025-06-01T21:04:18.0306195Z for setting in exp_settings: 2025-06-01T21:04:18.0306774Z if setting not in Experiment._fields: 2025-06-01T21:04:18.0307344Z log.warning( 2025-06-01T21:04:18.0308045Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-06-01T21:04:18.0308777Z ) 2025-06-01T21:04:18.0309214Z else: 2025-06-01T21:04:18.0309722Z valid_settings[setting] = exp_settings[setting] 2025-06-01T21:04:18.0310149Z 2025-06-01T21:04:18.0310428Z experiments[exp_name] = Experiment(**valid_settings) 2025-06-01T21:04:18.0311059Z return Settings(experiments) 2025-06-01T21:04:18.0311416Z 2025-06-01T21:04:18.0311592Z except Exception: 2025-06-01T21:04:18.0312068Z log.exception("Failed to parse settings") 2025-06-01T21:04:18.0312463Z 2025-06-01T21:04:18.0312636Z return Settings() 2025-06-01T21:04:18.0312888Z 2025-06-01T21:04:18.0312895Z 2025-06-01T21:04:18.0313150Z def parse_settings(rollout_state: str) -> Settings: 2025-06-01T21:04:18.0313859Z """ 2025-06-01T21:04:18.0314307Z Parse settings, if any, from the rollout state. 2025-06-01T21:04:18.0314721Z 2025-06-01T21:04:18.0315076Z If the issue body contains "---" then the text above that is the settings 2025-06-01T21:04:18.0316203Z and the text below is the list of opted in users. 2025-06-01T21:04:18.0316629Z 2025-06-01T21:04:18.0317055Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-06-01T21:04:18.0317790Z """ 2025-06-01T21:04:18.0318344Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T21:04:18.0319097Z return parse_settings_from_text(settings_text) 2025-06-01T21:04:18.0319504Z 2025-06-01T21:04:18.0319511Z 2025-06-01T21:04:18.0319750Z def parse_users(rollout_state: str) -> UserOptins: 2025-06-01T21:04:18.0320303Z """ 2025-06-01T21:04:18.0320700Z Parse users from the rollout state. 2025-06-01T21:04:18.0321055Z 2025-06-01T21:04:18.0321226Z """ 2025-06-01T21:04:18.0321749Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-06-01T21:04:18.0322498Z return parse_user_opt_in_from_text(users_text) 2025-06-01T21:04:18.0322904Z 2025-06-01T21:04:18.0322910Z 2025-06-01T21:04:18.0323480Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T21:04:18.0324258Z """ 2025-06-01T21:04:18.0324673Z Check if a user is opted into an experiment 2025-06-01T21:04:18.0325214Z """ 2025-06-01T21:04:18.0325679Z return experiment_name in user_optins.get(user, []) 2025-06-01T21:04:18.0326659Z 2025-06-01T21:04:18.0326671Z 2025-06-01T21:04:18.0327125Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-06-01T21:04:18.0327892Z """ 2025-06-01T21:04:18.0328351Z Check if a user explicitly opted out of an experiment 2025-06-01T21:04:18.0328933Z """ 2025-06-01T21:04:18.0329444Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-06-01T21:04:18.0330142Z experiment_optout = "-" + experiment_name 2025-06-01T21:04:18.0330775Z if experiment_optout not in user_optins.get(user, []): 2025-06-01T21:04:18.0331368Z return False 2025-06-01T21:04:18.0331614Z 2025-06-01T21:04:18.0331891Z if is_user_opted_in(user, user_optins, experiment_name): 2025-06-01T21:04:18.0332476Z log.warning( 2025-06-01T21:04:18.0333268Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-06-01T21:04:18.0334133Z ) 2025-06-01T21:04:18.0334340Z 2025-06-01T21:04:18.0334505Z return True 2025-06-01T21:04:18.0334730Z 2025-06-01T21:04:18.0334736Z 2025-06-01T21:04:18.0334923Z def get_runner_prefix( 2025-06-01T21:04:18.0335343Z rollout_state: str, 2025-06-01T21:04:18.0336005Z workflow_requestors: Iterable[str], 2025-06-01T21:04:18.0336537Z branch: str, 2025-06-01T21:04:18.0337037Z eligible_experiments: frozenset[str] = frozenset(), 2025-06-01T21:04:18.0337699Z opt_out_experiments: frozenset[str] = frozenset(), 2025-06-01T21:04:18.0338286Z is_canary: bool = False, 2025-06-01T21:04:18.0338738Z ) -> str: 2025-06-01T21:04:18.0339154Z settings = parse_settings(rollout_state) 2025-06-01T21:04:18.0339726Z user_optins = parse_users(rollout_state) 2025-06-01T21:04:18.0340095Z 2025-06-01T21:04:18.0340271Z fleet_prefix = "" 2025-06-01T21:04:18.0340695Z prefixes = [] 2025-06-01T21:04:18.0341314Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-06-01T21:04:18.0342245Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-06-01T21:04:18.0342948Z log.info( 2025-06-01T21:04:18.0343626Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-06-01T21:04:18.0344373Z ) 2025-06-01T21:04:18.0344757Z continue 2025-06-01T21:04:18.0345006Z 2025-06-01T21:04:18.0345198Z if opt_out_experiments: 2025-06-01T21:04:18.0346026Z if experiment_name in opt_out_experiments: 2025-06-01T21:04:18.0346672Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-06-01T21:04:18.0347249Z log.info( 2025-06-01T21:04:18.0348175Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-06-01T21:04:18.0349155Z ) 2025-06-01T21:04:18.0349550Z continue 2025-06-01T21:04:18.0349813Z 2025-06-01T21:04:18.0350008Z if eligible_experiments: 2025-06-01T21:04:18.0350576Z if experiment_name not in eligible_experiments: 2025-06-01T21:04:18.0351204Z exp_list = ", ".join(eligible_experiments) 2025-06-01T21:04:18.0351757Z log.info( 2025-06-01T21:04:18.0352528Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-06-01T21:04:18.0353358Z ) 2025-06-01T21:04:18.0353751Z continue 2025-06-01T21:04:18.0354225Z elif not experiment_settings.default: 2025-06-01T21:04:18.0354751Z log.info( 2025-06-01T21:04:18.0355522Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-06-01T21:04:18.0356367Z ) 2025-06-01T21:04:18.0356746Z continue 2025-06-01T21:04:18.0356994Z 2025-06-01T21:04:18.0357263Z # Is any workflow_requestor opted out to this experiment? 2025-06-01T21:04:18.0357876Z opted_out_users = [ 2025-06-01T21:04:18.0358317Z requestor 2025-06-01T21:04:18.0358773Z for requestor in workflow_requestors 2025-06-01T21:04:18.0359433Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-06-01T21:04:18.0360047Z ] 2025-06-01T21:04:18.0360249Z 2025-06-01T21:04:18.0360428Z if opted_out_users: 2025-06-01T21:04:18.0360871Z log.info( 2025-06-01T21:04:18.0361485Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-06-01T21:04:18.0362167Z ) 2025-06-01T21:04:18.0362544Z continue 2025-06-01T21:04:18.0362789Z 2025-06-01T21:04:18.0363062Z # Is any workflow_requestor opted in to this experiment? 2025-06-01T21:04:18.0363687Z opted_in_users = [ 2025-06-01T21:04:18.0364133Z requestor 2025-06-01T21:04:18.0364578Z for requestor in workflow_requestors 2025-06-01T21:04:18.0365235Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-06-01T21:04:18.0365941Z ] 2025-06-01T21:04:18.0366151Z 2025-06-01T21:04:18.0366325Z enabled = False 2025-06-01T21:04:18.0366750Z if opted_in_users: 2025-06-01T21:04:18.0367194Z log.info( 2025-06-01T21:04:18.0367781Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-06-01T21:04:18.0368458Z ) 2025-06-01T21:04:18.0368850Z enabled = True 2025-06-01T21:04:18.0369130Z 2025-06-01T21:04:18.0369341Z elif experiment_settings.rollout_perc: 2025-06-01T21:04:18.0370184Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-06-01T21:04:18.0371112Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-06-01T21:04:18.0371772Z log.info( 2025-06-01T21:04:18.0372630Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-06-01T21:04:18.0373559Z ) 2025-06-01T21:04:18.0373970Z enabled = True 2025-06-01T21:04:18.0374265Z 2025-06-01T21:04:18.0374425Z if enabled: 2025-06-01T21:04:18.0374847Z label = experiment_name 2025-06-01T21:04:18.0375387Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-06-01T21:04:18.0376321Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-06-01T21:04:18.0377329Z # - If it's enabled, then we always list it's prefix first 2025-06-01T21:04:18.0378089Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-06-01T21:04:18.0378748Z if is_canary: 2025-06-01T21:04:18.0379236Z label += CANARY_FLEET_SUFFIX 2025-06-01T21:04:18.0379781Z fleet_prefix = label 2025-06-01T21:04:18.0380259Z else: 2025-06-01T21:04:18.0380686Z prefixes.append(label) 2025-06-01T21:04:18.0381031Z 2025-06-01T21:04:18.0381215Z if len(prefixes) > 1: 2025-06-01T21:04:18.0381654Z log.error( 2025-06-01T21:04:18.0382672Z 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-06-01T21:04:18.0383794Z ) 2025-06-01T21:04:18.0384190Z prefixes = prefixes[:1] 2025-06-01T21:04:18.0384499Z 2025-06-01T21:04:18.0384684Z # Fleet always comes first 2025-06-01T21:04:18.0385153Z if fleet_prefix: 2025-06-01T21:04:18.0385595Z prefixes.insert(0, fleet_prefix) 2025-06-01T21:04:18.0386064Z 2025-06-01T21:04:18.0386429Z return ".".join(prefixes) + "." if prefixes else "" 2025-06-01T21:04:18.0386848Z 2025-06-01T21:04:18.0386857Z 2025-06-01T21:04:18.0387314Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-06-01T21:04:18.0388098Z """ 2025-06-01T21:04:18.0388684Z Gets the first comment of the issue, which contains the desired rollout state. 2025-06-01T21:04:18.0389235Z 2025-06-01T21:04:18.0389609Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-06-01T21:04:18.0390314Z """ 2025-06-01T21:04:18.0390698Z gh = get_gh_client(github_token) 2025-06-01T21:04:18.0391228Z issue = get_issue(gh, repo, issue_num) 2025-06-01T21:04:18.0391847Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-06-01T21:04:18.0392301Z 2025-06-01T21:04:18.0392309Z 2025-06-01T21:04:18.0392712Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-06-01T21:04:18.0393474Z for _ in range(num_retries): 2025-06-01T21:04:18.0393947Z try: 2025-06-01T21:04:18.0394371Z req = Request(url=url, headers=headers) 2025-06-01T21:04:18.0395018Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-06-01T21:04:18.0395662Z return json.loads(content) 2025-06-01T21:04:18.0396286Z except Exception as e: 2025-06-01T21:04:18.0396824Z log.warning(f"Could not download {url}: {e}") 2025-06-01T21:04:18.0397228Z 2025-06-01T21:04:18.0397605Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-06-01T21:04:18.0398313Z return {} 2025-06-01T21:04:18.0398536Z 2025-06-01T21:04:18.0398548Z 2025-06-01T21:04:18.0398703Z @cache 2025-06-01T21:04:18.0399317Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-06-01T21:04:18.0400070Z """ 2025-06-01T21:04:18.0400453Z Dynamically get PR information 2025-06-01T21:04:18.0400942Z """ 2025-06-01T21:04:18.0401438Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-06-01T21:04:18.0402060Z headers = { 2025-06-01T21:04:18.0402521Z "Accept": "application/vnd.github.v3+json", 2025-06-01T21:04:18.0403118Z "Authorization": f"token {github_token}", 2025-06-01T21:04:18.0403681Z } 2025-06-01T21:04:18.0404101Z json_response: dict[str, Any] = download_json( 2025-06-01T21:04:18.0404706Z url=f"{github_api}/issues/{pr_number}", 2025-06-01T21:04:18.0405253Z headers=headers, 2025-06-01T21:04:18.0405682Z ) 2025-06-01T21:04:18.0405972Z 2025-06-01T21:04:18.0406160Z if not json_response: 2025-06-01T21:04:18.0406723Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-06-01T21:04:18.0407339Z return {} 2025-06-01T21:04:18.0407709Z 2025-06-01T21:04:18.0407888Z return json_response 2025-06-01T21:04:18.0408162Z 2025-06-01T21:04:18.0408175Z 2025-06-01T21:04:18.0408575Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-06-01T21:04:18.0409295Z """ 2025-06-01T21:04:18.0409818Z Dynamically get the latest list of labels from the pull request 2025-06-01T21:04:18.0410462Z """ 2025-06-01T21:04:18.0410942Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-06-01T21:04:18.0411551Z return { 2025-06-01T21:04:18.0412125Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-06-01T21:04:18.0412826Z } 2025-06-01T21:04:18.0413021Z 2025-06-01T21:04:18.0413028Z 2025-06-01T21:04:18.0413200Z def main() -> None: 2025-06-01T21:04:18.0413620Z args = parse_args() 2025-06-01T21:04:18.0413886Z 2025-06-01T21:04:18.0414103Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-06-01T21:04:18.0414491Z 2025-06-01T21:04:18.0414691Z # Check if the PR is opt-out 2025-06-01T21:04:18.0415175Z if args.pr_number: 2025-06-01T21:04:18.0415919Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-06-01T21:04:18.0416800Z if OPT_OUT_LABEL in labels: 2025-06-01T21:04:18.0417305Z log.info( 2025-06-01T21:04:18.0417993Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-06-01T21:04:18.0418749Z ) 2025-06-01T21:04:18.0419296Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T21:04:18.0419956Z sys.exit() 2025-06-01T21:04:18.0420220Z 2025-06-01T21:04:18.0420385Z try: 2025-06-01T21:04:18.0420815Z rollout_state = get_rollout_state_from_issue( 2025-06-01T21:04:18.0421515Z args.github_token, args.github_issue_repo, args.github_issue 2025-06-01T21:04:18.0422140Z ) 2025-06-01T21:04:18.0422347Z 2025-06-01T21:04:18.0422552Z username = get_potential_pr_author( 2025-06-01T21:04:18.0423103Z args.github_token, 2025-06-01T21:04:18.0423581Z args.github_repo, 2025-06-01T21:04:18.0424054Z args.github_actor, 2025-06-01T21:04:18.0424532Z args.github_ref_type, 2025-06-01T21:04:18.0425029Z args.github_branch, 2025-06-01T21:04:18.0425486Z ) 2025-06-01T21:04:18.0425695Z 2025-06-01T21:04:18.0426081Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-06-01T21:04:18.0426543Z 2025-06-01T21:04:18.0426763Z runner_label_prefix = get_runner_prefix( 2025-06-01T21:04:18.0427321Z rollout_state, 2025-06-01T21:04:18.0427808Z (args.github_issue_owner, username), 2025-06-01T21:04:18.0428356Z args.github_branch, 2025-06-01T21:04:18.0428850Z args.eligible_experiments, 2025-06-01T21:04:18.0429386Z args.opt_out_experiments, 2025-06-01T21:04:18.0429880Z is_canary, 2025-06-01T21:04:18.0430288Z ) 2025-06-01T21:04:18.0430500Z 2025-06-01T21:04:18.0430682Z except Exception as e: 2025-06-01T21:04:18.0431132Z log.error( 2025-06-01T21:04:18.0431790Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-06-01T21:04:18.0432556Z ) 2025-06-01T21:04:18.0432756Z 2025-06-01T21:04:18.0433082Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-06-01T21:04:18.0433582Z 2025-06-01T21:04:18.0433587Z 2025-06-01T21:04:18.0433767Z if __name__ == "__main__": 2025-06-01T21:04:18.0434208Z main() 2025-06-01T21:04:18.0434416Z 2025-06-01T21:04:18.0522302Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-01T21:04:18.0523212Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-06-01T21:04:18.0574190Z shell: /usr/bin/bash -e {0} 2025-06-01T21:04:18.0574683Z env: 2025-06-01T21:04:18.0575292Z GITHUB_TOKEN: *** 2025-06-01T21:04:18.0575710Z ISSUE_NUMBER: 5132 2025-06-01T21:04:18.0576510Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T21:04:18.0577032Z ISSUE_OWNER: 2025-06-01T21:04:18.0577442Z CHECK_EXPERIMENTS: 2025-06-01T21:04:18.0577881Z OPT_OUT_EXPERIMENTS: 2025-06-01T21:04:18.0578312Z PR_NUMBER: 2025-06-01T21:04:18.0578692Z ##[endgroup] 2025-06-01T21:04:19.3752079Z Defaulting to user installation because normal site-packages is not writeable 2025-06-01T21:04:20.1962118Z Collecting urllib3==1.26.18 2025-06-01T21:04:20.2405259Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-06-01T21:04:20.2670815Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.0 MB/s eta 0:00:00 2025-06-01T21:04:20.2907316Z Collecting PyGithub==2.3.0 2025-06-01T21:04:20.3003700Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-06-01T21:04:20.3460935Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-06-01T21:04:20.3530835Z 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-06-01T21:04:20.3578823Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-06-01T21:04:20.3594792Z 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-06-01T21:04:20.3609108Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-06-01T21:04:20.3899579Z Collecting Deprecated (from PyGithub==2.3.0) 2025-06-01T21:04:20.3969175Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-06-01T21:04:20.4205048Z 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-06-01T21:04:20.5360962Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-01T21:04:20.5433423Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-06-01T21:04:20.6519096Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-06-01T21:04:20.6602608Z 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-06-01T21:04:20.6847053Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-06-01T21:04:20.6932788Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-06-01T21:04:20.7195218Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-06-01T21:04:20.7431181Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.2 MB/s eta 0:00:00 2025-06-01T21:04:20.7496306Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-06-01T21:04:20.7780401Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 13.0 MB/s eta 0:00:00 2025-06-01T21:04:20.7848897Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-06-01T21:04:20.8387071Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 16.2 MB/s eta 0:00:00 2025-06-01T21:04:20.8472228Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-06-01T21:04:20.8571423Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-06-01T21:04:20.8832007Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 19.2 MB/s eta 0:00:00 2025-06-01T21:04:20.8901449Z 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-06-01T21:04:20.8967029Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 16.0 MB/s eta 0:00:00 2025-06-01T21:04:20.9033652Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-06-01T21:04:20.9108992Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 18.1 MB/s eta 0:00:00 2025-06-01T21:04:21.2020720Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-06-01T21:04:21.7333585Z 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-06-01T21:04:21.8096429Z ##[group]Run curr_branch="main" 2025-06-01T21:04:21.8096757Z curr_branch="main" 2025-06-01T21:04:21.8096978Z curr_ref_type="branch" 2025-06-01T21:04:21.8097218Z echo "Current branch is '$curr_branch'" 2025-06-01T21:04:21.8097464Z  2025-06-01T21:04:21.8097648Z python3 runner_determinator.py \ 2025-06-01T21:04:21.8097926Z  --github-token "$GITHUB_TOKEN" \ 2025-06-01T21:04:21.8098198Z  --github-issue "$ISSUE_NUMBER" \ 2025-06-01T21:04:21.8098462Z  --github-branch "$curr_branch" \ 2025-06-01T21:04:21.8098729Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-06-01T21:04:21.8099016Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-06-01T21:04:21.8099301Z  --github-ref-type "$curr_ref_type" \ 2025-06-01T21:04:21.8099569Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-06-01T21:04:21.8099888Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-06-01T21:04:21.8100235Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-06-01T21:04:21.8100528Z  --pr-number "${PR_NUMBER}" 2025-06-01T21:04:21.8153299Z shell: /usr/bin/bash -e {0} 2025-06-01T21:04:21.8153526Z env: 2025-06-01T21:04:21.8154093Z GITHUB_TOKEN: *** 2025-06-01T21:04:21.8154281Z ISSUE_NUMBER: 5132 2025-06-01T21:04:21.8154474Z TRIGGERING_ACTOR: pytorchmergebot 2025-06-01T21:04:21.8154703Z ISSUE_OWNER: 2025-06-01T21:04:21.8154866Z CHECK_EXPERIMENTS: 2025-06-01T21:04:21.8155056Z OPT_OUT_EXPERIMENTS: 2025-06-01T21:04:21.8155235Z PR_NUMBER: 2025-06-01T21:04:21.8155393Z ##[endgroup] 2025-06-01T21:04:21.8223838Z Current branch is 'main' 2025-06-01T21:04:23.4905752Z INFO : Based on rollout percentage of 30%, enabling experiment lf. 2025-06-01T21:04:23.4907064Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-06-01T21:04:23.4908069Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-06-01T21:04:23.4908857Z INFO : Setting output: label-type='lf.' 2025-06-01T21:04:23.5222052Z Evaluate and set job outputs 2025-06-01T21:04:23.5228408Z Set output 'label-type' 2025-06-01T21:04:23.5230178Z Cleaning up orphan processes