2025-07-17T06:33:30.6912368Z Current runner version: '2.326.0' 2025-07-17T06:33:30.6934739Z ##[group]Runner Image Provisioner 2025-07-17T06:33:30.6935583Z Hosted Compute Agent 2025-07-17T06:33:30.6936137Z Version: 20250711.363 2025-07-17T06:33:30.6936670Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:30.6937368Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:30.6937928Z ##[endgroup] 2025-07-17T06:33:30.6938473Z ##[group]Operating System 2025-07-17T06:33:30.6938971Z Ubuntu 2025-07-17T06:33:30.6939524Z 24.04.2 2025-07-17T06:33:30.6940140Z LTS 2025-07-17T06:33:30.6940537Z ##[endgroup] 2025-07-17T06:33:30.6941085Z ##[group]Runner Image 2025-07-17T06:33:30.6941611Z Image: ubuntu-24.04 2025-07-17T06:33:30.6942084Z Version: 20250710.1.0 2025-07-17T06:33:30.6943108Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:30.6944580Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:30.6945551Z ##[endgroup] 2025-07-17T06:33:30.6946618Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:30.6948568Z Contents: read 2025-07-17T06:33:30.6949063Z Metadata: read 2025-07-17T06:33:30.6949561Z Packages: read 2025-07-17T06:33:30.6950580Z ##[endgroup] 2025-07-17T06:33:30.6953003Z Secret source: Actions 2025-07-17T06:33:30.6953685Z Prepare workflow directory 2025-07-17T06:33:30.7460957Z Prepare all required actions 2025-07-17T06:33:30.7516777Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:30.7521992Z ##[group] Inputs 2025-07-17T06:33:30.7522623Z check_experiments: 2025-07-17T06:33:30.7523195Z opt_out_experiments: 2025-07-17T06:33:30.7523725Z triggering_actor: pytorchmergebot 2025-07-17T06:33:30.7524388Z issue_owner: 2025-07-17T06:33:30.7524864Z curr_branch: main 2025-07-17T06:33:30.7525503Z curr_ref_type: branch 2025-07-17T06:33:30.7526064Z issue_number: 5132 2025-07-17T06:33:30.7526573Z ##[endgroup] 2025-07-17T06:33:30.7527161Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:30.8108583Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:30.8111754Z cat < runner_determinator.py 2025-07-17T06:33:30.8112482Z # flake8: noqa: G004 2025-07-17T06:33:30.8113076Z  2025-07-17T06:33:30.8113787Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:30.8114919Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:30.8116006Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:30.8116667Z  2025-07-17T06:33:30.8117175Z """ 2025-07-17T06:33:30.8117836Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:30.8118863Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:30.8120205Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:30.8121148Z of which runners should be used to run which job. 2025-07-17T06:33:30.8121907Z  2025-07-17T06:33:30.8122552Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:30.8123623Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:30.8124664Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:30.8125478Z list, defined. 2025-07-17T06:33:30.8125946Z  2025-07-17T06:33:30.8126661Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:30.8127739Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:30.8128670Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:30.8129698Z  2025-07-17T06:33:30.8130478Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:30.8131487Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:30.8132441Z experiments which the user could be opted in to. 2025-07-17T06:33:30.8133120Z  2025-07-17T06:33:30.8133600Z The user list has the following rules: 2025-07-17T06:33:30.8134238Z  2025-07-17T06:33:30.8134857Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:30.8135782Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:30.8136722Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:30.8137409Z  2025-07-17T06:33:30.8137823Z Example config: 2025-07-17T06:33:30.8138462Z  # A list of experiments that can be opted into. 2025-07-17T06:33:30.8139230Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:30.8140279Z  # Expected syntax is: 2025-07-17T06:33:30.8141165Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:30.8142243Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:30.8143090Z  2025-07-17T06:33:30.8143581Z  experiments: 2025-07-17T06:33:30.8144098Z  lf: 2025-07-17T06:33:30.8144557Z  rollout_percent: 25 2025-07-17T06:33:30.8145199Z  all_branches: false 2025-07-17T06:33:30.8145816Z  default: true 2025-07-17T06:33:30.8146328Z  --- 2025-07-17T06:33:30.8146835Z  2025-07-17T06:33:30.8147242Z  # Opt-ins: 2025-07-17T06:33:30.8147956Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:30.8149154Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:30.8150449Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:30.8151228Z  # Experiments should be from the above list. 2025-07-17T06:33:30.8151928Z  2025-07-17T06:33:30.8152393Z  @User1,-lf,split_build 2025-07-17T06:33:30.8152940Z  @User2,lf 2025-07-17T06:33:30.8153561Z  @User3,split_build 2025-07-17T06:33:30.8154090Z """ 2025-07-17T06:33:30.8154557Z  2025-07-17T06:33:30.8155067Z import json 2025-07-17T06:33:30.8155559Z import logging 2025-07-17T06:33:30.8156137Z import os 2025-07-17T06:33:30.8156653Z import random 2025-07-17T06:33:30.8157226Z import re 2025-07-17T06:33:30.8157717Z import sys 2025-07-17T06:33:30.8158264Z from argparse import ArgumentParser 2025-07-17T06:33:30.8158975Z from collections.abc import Iterable 2025-07-17T06:33:30.8159602Z from functools import cache 2025-07-17T06:33:30.8160477Z from logging import LogRecord 2025-07-17T06:33:30.8161093Z from typing import Any, NamedTuple 2025-07-17T06:33:30.8161791Z from urllib.request import Request, urlopen 2025-07-17T06:33:30.8162483Z  2025-07-17T06:33:30.8162901Z import yaml 2025-07-17T06:33:30.8163434Z from github import Auth, Github 2025-07-17T06:33:30.8164051Z from github.Issue import Issue 2025-07-17T06:33:30.8164693Z  2025-07-17T06:33:30.8165097Z  2025-07-17T06:33:30.8165663Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:30.8166507Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:30.8167473Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:30.8168552Z  2025-07-17T06:33:30.8169138Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:30.8169962Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:30.8170697Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:30.8171374Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:30.8172002Z  2025-07-17T06:33:30.8172530Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:30.8173163Z  2025-07-17T06:33:30.8173599Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:30.8174232Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:30.8174776Z  2025-07-17T06:33:30.8175215Z  2025-07-17T06:33:30.8175750Z class Experiment(NamedTuple): 2025-07-17T06:33:30.8176352Z  rollout_perc: float = ( 2025-07-17T06:33:30.8177145Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:30.8177890Z  ) 2025-07-17T06:33:30.8178448Z  all_branches: bool = ( 2025-07-17T06:33:30.8179199Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:30.8180296Z  ) 2025-07-17T06:33:30.8180897Z  default: bool = ( 2025-07-17T06:33:30.8181591Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:30.8182391Z  ) 2025-07-17T06:33:30.8182835Z  2025-07-17T06:33:30.8183363Z  # Add more fields as needed 2025-07-17T06:33:30.8183904Z  2025-07-17T06:33:30.8184437Z  2025-07-17T06:33:30.8184913Z class Settings(NamedTuple): 2025-07-17T06:33:30.8185445Z  """ 2025-07-17T06:33:30.8186097Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:30.8186755Z  """ 2025-07-17T06:33:30.8187202Z  2025-07-17T06:33:30.8187771Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:30.8188406Z  2025-07-17T06:33:30.8188955Z  2025-07-17T06:33:30.8189556Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:30.8190588Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:30.8191274Z  2025-07-17T06:33:30.8191815Z  COLORS = { 2025-07-17T06:33:30.8192327Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:30.8192942Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:30.8193596Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:30.8194228Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:30.8194864Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:30.8195480Z  } 2025-07-17T06:33:30.8195939Z  2025-07-17T06:33:30.8196429Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:30.8197389Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:30.8198398Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:30.8199097Z  return super().format(record) 2025-07-17T06:33:30.8199867Z  2025-07-17T06:33:30.8200281Z  2025-07-17T06:33:30.8200761Z handler = logging.StreamHandler() 2025-07-17T06:33:30.8201578Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:30.8202409Z  2025-07-17T06:33:30.8202968Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:30.8203740Z log.addHandler(handler) 2025-07-17T06:33:30.8204326Z log.setLevel(logging.INFO) 2025-07-17T06:33:30.8204862Z  2025-07-17T06:33:30.8205344Z  2025-07-17T06:33:30.8205877Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:30.8206600Z  """ 2025-07-17T06:33:30.8207232Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:30.8208150Z  """ 2025-07-17T06:33:30.8208635Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:30.8209912Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:30.8211145Z  log.warning( 2025-07-17T06:33:30.8212124Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:30.8213209Z  ) 2025-07-17T06:33:30.8213775Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:30.8214397Z  return 2025-07-17T06:33:30.8214949Z  2025-07-17T06:33:30.8215406Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:30.8216134Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:30.8216870Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:30.8217447Z  2025-07-17T06:33:30.8217885Z  2025-07-17T06:33:30.8218560Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:30.8219326Z  return frozenset( 2025-07-17T06:33:30.8220394Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:30.8296489Z  ) 2025-07-17T06:33:30.8297216Z  2025-07-17T06:33:30.8297869Z  2025-07-17T06:33:30.8298545Z def parse_args() -> Any: 2025-07-17T06:33:30.8299621Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:30.8301449Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:30.8302292Z  parser.add_argument( 2025-07-17T06:33:30.8302803Z  "--github-issue-repo", 2025-07-17T06:33:30.8303312Z  type=str, 2025-07-17T06:33:30.8303775Z  required=False, 2025-07-17T06:33:30.8304484Z  default="pytorch/test-infra", 2025-07-17T06:33:30.8305093Z  help="GitHub repo to get the issue", 2025-07-17T06:33:30.8305624Z  ) 2025-07-17T06:33:30.8306013Z  parser.add_argument( 2025-07-17T06:33:30.8306504Z  "--github-repo", 2025-07-17T06:33:30.8307033Z  type=str, 2025-07-17T06:33:30.8307530Z  required=True, 2025-07-17T06:33:30.8308110Z  help="GitHub repo where CI is running", 2025-07-17T06:33:30.8308701Z  ) 2025-07-17T06:33:30.8309096Z  parser.add_argument( 2025-07-17T06:33:30.8310175Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:30.8310863Z  ) 2025-07-17T06:33:30.8311261Z  parser.add_argument( 2025-07-17T06:33:30.8311936Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:30.8312645Z  ) 2025-07-17T06:33:30.8313036Z  parser.add_argument( 2025-07-17T06:33:30.8313717Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:30.8314427Z  ) 2025-07-17T06:33:30.8314816Z  parser.add_argument( 2025-07-17T06:33:30.8315516Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:30.8316254Z  ) 2025-07-17T06:33:30.8316648Z  parser.add_argument( 2025-07-17T06:33:30.8317142Z  "--github-ref-type", 2025-07-17T06:33:30.8317628Z  type=str, 2025-07-17T06:33:30.8318076Z  required=True, 2025-07-17T06:33:30.8318619Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:30.8319177Z  ) 2025-07-17T06:33:30.8319572Z  parser.add_argument( 2025-07-17T06:33:30.8320512Z  "--eligible-experiments", 2025-07-17T06:33:30.8321078Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:30.8321610Z  required=False, 2025-07-17T06:33:30.8322114Z  default="", 2025-07-17T06:33:30.8322990Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:30.8323924Z  ) 2025-07-17T06:33:30.8324318Z  parser.add_argument( 2025-07-17T06:33:30.8324813Z  "--opt-out-experiments", 2025-07-17T06:33:30.8325357Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:30.8325888Z  required=False, 2025-07-17T06:33:30.8326362Z  default="", 2025-07-17T06:33:30.8326798Z  help=( 2025-07-17T06:33:30.8327504Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:30.8328648Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:30.8329489Z  ), 2025-07-17T06:33:30.8330248Z  ) 2025-07-17T06:33:30.8330640Z  parser.add_argument( 2025-07-17T06:33:30.8331157Z  "--pr-number", 2025-07-17T06:33:30.8331617Z  type=str, 2025-07-17T06:33:30.8332058Z  required=False, 2025-07-17T06:33:30.8332523Z  default="", 2025-07-17T06:33:30.8333050Z  help="the optional PR number where this is run", 2025-07-17T06:33:30.8333620Z  ) 2025-07-17T06:33:30.8333985Z  2025-07-17T06:33:30.8334371Z  return parser.parse_args() 2025-07-17T06:33:30.8334873Z  2025-07-17T06:33:30.8335214Z  2025-07-17T06:33:30.8335820Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:30.8336754Z  auth = Auth.Token(github_token) 2025-07-17T06:33:30.8337296Z  return Github(auth=auth) 2025-07-17T06:33:30.8337769Z  2025-07-17T06:33:30.8338110Z  2025-07-17T06:33:30.8338756Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:30.8339576Z  repo = gh.get_repo(repo) 2025-07-17T06:33:30.8340357Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:30.8340890Z  2025-07-17T06:33:30.8341230Z  2025-07-17T06:33:30.8341600Z def get_potential_pr_author( 2025-07-17T06:33:30.8342285Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:30.8342974Z ) -> str: 2025-07-17T06:33:30.8343531Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:30.8344352Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:30.8345138Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:30.8345723Z  2025-07-17T06:33:30.8346112Z  gh = get_gh_client(github_token) 2025-07-17T06:33:30.8346620Z  2025-07-17T06:33:30.8347091Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:30.8347746Z  split_tag = ref_name.split("/") 2025-07-17T06:33:30.8348260Z  if ( 2025-07-17T06:33:30.8348680Z  len(split_tag) == 3 2025-07-17T06:33:30.8349211Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:30.8349951Z  and split_tag[2].isnumeric() 2025-07-17T06:33:30.8350493Z  ): 2025-07-17T06:33:30.8350921Z  pr_number = split_tag[2] 2025-07-17T06:33:30.8351435Z  try: 2025-07-17T06:33:30.8351911Z  repository = gh.get_repo(repo) 2025-07-17T06:33:30.8352710Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:30.8353355Z  except Exception as e: 2025-07-17T06:33:30.8353908Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:30.8354601Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:30.8355259Z  ) from e 2025-07-17T06:33:30.8355850Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:30.8356566Z  # In all other cases, return the original input username 2025-07-17T06:33:30.8357178Z  return username 2025-07-17T06:33:30.8357616Z  2025-07-17T06:33:30.8357948Z  2025-07-17T06:33:30.8358379Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:30.8358927Z  """ 2025-07-17T06:33:30.8359602Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:30.8360653Z  """ 2025-07-17T06:33:30.8361240Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:30.8361981Z  2025-07-17T06:33:30.8362320Z  2025-07-17T06:33:30.8362714Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:30.8363226Z  try: 2025-07-17T06:33:30.8363647Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:30.8364170Z  return data 2025-07-17T06:33:30.8364642Z  except yaml.YAMLError: 2025-07-17T06:33:30.8365168Z  log.exception("Error loading YAML") 2025-07-17T06:33:30.8365698Z  raise 2025-07-17T06:33:30.8366096Z  2025-07-17T06:33:30.8366425Z  2025-07-17T06:33:30.8367038Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:30.8367797Z  """ 2025-07-17T06:33:30.8368574Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:30.8369325Z  2025-07-17T06:33:30.8370457Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:30.8371260Z  and the text below is the list of opted in users. 2025-07-17T06:33:30.8371823Z  2025-07-17T06:33:30.8372391Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:30.8373094Z  """ 2025-07-17T06:33:30.8373557Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:30.8374166Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:30.8374798Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:30.8375401Z  else: 2025-07-17T06:33:30.8375804Z  return "", rollout_state 2025-07-17T06:33:30.8376293Z  2025-07-17T06:33:30.8376623Z  2025-07-17T06:33:30.8377025Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:30.8377539Z  """ 2025-07-17T06:33:30.8378085Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:30.8378734Z  """ 2025-07-17T06:33:30.8379096Z  2025-07-17T06:33:30.8379425Z  2025-07-17T06:33:30.8380075Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:30.8380756Z  """ 2025-07-17T06:33:30.8381465Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:30.8382310Z  2025-07-17T06:33:30.8383089Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:30.8384097Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:30.8384931Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:30.8385559Z  2025-07-17T06:33:30.8385888Z  2025-07-17T06:33:30.8386217Z  """ 2025-07-17T06:33:30.8386606Z  optins = UserOptins() 2025-07-17T06:33:30.8387129Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:30.8387706Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:30.8388277Z  if not user or not user.startswith("@"): 2025-07-17T06:33:30.8388842Z  # Not a valid user. Skip 2025-07-17T06:33:30.8389354Z  continue 2025-07-17T06:33:30.8389983Z  2025-07-17T06:33:30.8390355Z  if user: 2025-07-17T06:33:30.8390826Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:30.8391535Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:30.8392180Z  2025-07-17T06:33:30.8392536Z  return optins 2025-07-17T06:33:30.8392959Z  2025-07-17T06:33:30.8393294Z  2025-07-17T06:33:30.8393788Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:30.8394410Z  """ 2025-07-17T06:33:30.8394832Z  Check if the experiment name is valid. 2025-07-17T06:33:30.8395359Z  A valid name: 2025-07-17T06:33:30.8396031Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:30.8396972Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:30.8397725Z  - Cannot contain spaces 2025-07-17T06:33:30.8398206Z  """ 2025-07-17T06:33:30.8398558Z  2025-07-17T06:33:30.8399017Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:30.8399904Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:30.8400714Z  2025-07-17T06:33:30.8401072Z  if valid: 2025-07-17T06:33:30.8401484Z  return True 2025-07-17T06:33:30.8401908Z  2025-07-17T06:33:30.8402258Z  log.error( 2025-07-17T06:33:30.8403679Z  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-07-17T06:33:30.8405213Z  ) 2025-07-17T06:33:30.8405590Z  return False 2025-07-17T06:33:30.8406006Z  2025-07-17T06:33:30.8406339Z  2025-07-17T06:33:30.8406846Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:30.8407492Z  """ 2025-07-17T06:33:30.8408096Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:30.8408814Z  """ 2025-07-17T06:33:30.8409185Z  try: 2025-07-17T06:33:30.8409573Z  if settings_text: 2025-07-17T06:33:30.8410604Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:30.8411401Z  # for easy reading 2025-07-17T06:33:30.8412206Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:30.8413095Z  # the backtick character in shell commands. 2025-07-17T06:33:30.8413727Z  backtick = chr(96) # backtick character 2025-07-17T06:33:30.8414400Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:30.8415083Z  settings = load_yaml(settings_text) 2025-07-17T06:33:30.8415597Z  2025-07-17T06:33:30.8416330Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:30.8417071Z  experiments = {} 2025-07-17T06:33:30.8417534Z  2025-07-17T06:33:30.8418088Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:30.8418859Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:30.8420161Z  # 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-07-17T06:33:30.8421226Z  continue 2025-07-17T06:33:30.8421686Z  2025-07-17T06:33:30.8422060Z  valid_settings = {} 2025-07-17T06:33:30.8422595Z  for setting in exp_settings: 2025-07-17T06:33:30.8423175Z  if setting not in Experiment._fields: 2025-07-17T06:33:30.8423754Z  log.warning( 2025-07-17T06:33:30.8424474Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:30.8425181Z  ) 2025-07-17T06:33:30.8425627Z  else: 2025-07-17T06:33:30.8426172Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:30.8426744Z  2025-07-17T06:33:30.8427215Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:30.8427864Z  return Settings(experiments) 2025-07-17T06:33:30.8428366Z  2025-07-17T06:33:30.8428728Z  except Exception: 2025-07-17T06:33:30.8429250Z  log.exception("Failed to parse settings") 2025-07-17T06:33:30.8430004Z  2025-07-17T06:33:30.8430366Z  return Settings() 2025-07-17T06:33:30.8430798Z  2025-07-17T06:33:30.8431137Z  2025-07-17T06:33:30.8431711Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:30.8432290Z  """ 2025-07-17T06:33:30.8432749Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:30.8433304Z  2025-07-17T06:33:30.8433841Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:30.8434614Z  and the text below is the list of opted in users. 2025-07-17T06:33:30.8435169Z  2025-07-17T06:33:30.8435784Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:30.8436508Z  """ 2025-07-17T06:33:30.8437079Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:30.8437851Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:30.8438402Z  2025-07-17T06:33:30.8438736Z  2025-07-17T06:33:30.8439189Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:30.8439882Z  """ 2025-07-17T06:33:30.8440294Z  Parse users from the rollout state. 2025-07-17T06:33:30.8440804Z  2025-07-17T06:33:30.8441133Z  """ 2025-07-17T06:33:30.8441685Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:30.8442440Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:30.8442993Z  2025-07-17T06:33:30.8443329Z  2025-07-17T06:33:30.8443941Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:30.8444699Z  """ 2025-07-17T06:33:30.8445138Z  Check if a user is opted into an experiment 2025-07-17T06:33:30.8445680Z  """ 2025-07-17T06:33:30.8446150Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:30.8446855Z  2025-07-17T06:33:30.8447196Z  2025-07-17T06:33:30.8447810Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:30.8448559Z  """ 2025-07-17T06:33:30.8449037Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:30.8449623Z  """ 2025-07-17T06:33:30.8450252Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:30.8450965Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:30.8451632Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:30.8452242Z  return False 2025-07-17T06:33:30.8452669Z  2025-07-17T06:33:30.8453121Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:30.8453722Z  log.warning( 2025-07-17T06:33:30.8454528Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:30.8455398Z  ) 2025-07-17T06:33:30.8455768Z  2025-07-17T06:33:30.8456118Z  return True 2025-07-17T06:33:30.8456520Z  2025-07-17T06:33:30.8456851Z  2025-07-17T06:33:30.8457216Z def get_runner_prefix( 2025-07-17T06:33:30.8457679Z  rollout_state: str, 2025-07-17T06:33:30.8458180Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:30.8458693Z  branch: str, 2025-07-17T06:33:30.8459231Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:30.8460178Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:30.8460791Z  is_canary: bool = False, 2025-07-17T06:33:30.8461270Z ) -> str: 2025-07-17T06:33:30.8461716Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:30.8462315Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:30.8462840Z  2025-07-17T06:33:30.8463328Z  fleet_prefix = "" 2025-07-17T06:33:30.8463782Z  prefixes = [] 2025-07-17T06:33:30.8464462Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:30.8465432Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:30.8466169Z  log.info( 2025-07-17T06:33:30.8466876Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:30.8467623Z  ) 2025-07-17T06:33:30.8468029Z  continue 2025-07-17T06:33:30.8468445Z  2025-07-17T06:33:30.8468812Z  if opt_out_experiments: 2025-07-17T06:33:30.8469380Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:30.8470236Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:30.8470844Z  log.info( 2025-07-17T06:33:30.8471769Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:30.8472749Z  ) 2025-07-17T06:33:30.8473185Z  continue 2025-07-17T06:33:30.8473630Z  2025-07-17T06:33:30.8473998Z  if eligible_experiments: 2025-07-17T06:33:30.8474582Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:30.8475233Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:30.8475791Z  log.info( 2025-07-17T06:33:30.8476583Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:30.8477414Z  ) 2025-07-17T06:33:30.8477971Z  continue 2025-07-17T06:33:30.8478486Z  elif not experiment_settings.default: 2025-07-17T06:33:30.8479019Z  log.info( 2025-07-17T06:33:30.8479700Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:30.8480543Z  ) 2025-07-17T06:33:30.8480946Z  continue 2025-07-17T06:33:30.8481369Z  2025-07-17T06:33:30.8481837Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:30.8482457Z  opted_out_users = [ 2025-07-17T06:33:30.8482932Z  requestor 2025-07-17T06:33:30.8483427Z  for requestor in workflow_requestors 2025-07-17T06:33:30.8484101Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:30.8484732Z  ] 2025-07-17T06:33:30.8485105Z  2025-07-17T06:33:30.8485467Z  if opted_out_users: 2025-07-17T06:33:30.8485955Z  log.info( 2025-07-17T06:33:30.8486591Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:30.8487282Z  ) 2025-07-17T06:33:30.8487678Z  continue 2025-07-17T06:33:30.8488095Z  2025-07-17T06:33:30.8488553Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:30.8489173Z  opted_in_users = [ 2025-07-17T06:33:30.8489652Z  requestor 2025-07-17T06:33:30.8490247Z  for requestor in workflow_requestors 2025-07-17T06:33:30.8490919Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:30.8491532Z  ] 2025-07-17T06:33:30.8491902Z  2025-07-17T06:33:30.8492253Z  enabled = False 2025-07-17T06:33:30.8492728Z  if opted_in_users: 2025-07-17T06:33:30.8493321Z  log.info( 2025-07-17T06:33:30.8493951Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:30.8494632Z  ) 2025-07-17T06:33:30.8495041Z  enabled = True 2025-07-17T06:33:30.8495497Z  2025-07-17T06:33:30.8495899Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:30.8496719Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:30.8497690Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:30.8498337Z  log.info( 2025-07-17T06:33:30.8499224Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:30.8500406Z  ) 2025-07-17T06:33:30.8500851Z  enabled = True 2025-07-17T06:33:30.8501321Z  2025-07-17T06:33:30.8501667Z  if enabled: 2025-07-17T06:33:30.8502130Z  label = experiment_name 2025-07-17T06:33:30.8502696Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:30.8503518Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:30.8504383Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:30.8505148Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:30.8505815Z  if is_canary: 2025-07-17T06:33:30.8506333Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:30.8506894Z  fleet_prefix = label 2025-07-17T06:33:30.8507527Z  else: 2025-07-17T06:33:30.8507992Z  prefixes.append(label) 2025-07-17T06:33:30.8508490Z  2025-07-17T06:33:30.8508856Z  if len(prefixes) > 1: 2025-07-17T06:33:30.8509320Z  log.error( 2025-07-17T06:33:30.8510583Z  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-07-17T06:33:30.8511681Z  ) 2025-07-17T06:33:30.8512083Z  prefixes = prefixes[:1] 2025-07-17T06:33:30.8512563Z  2025-07-17T06:33:30.8512927Z  # Fleet always comes first 2025-07-17T06:33:30.8513430Z  if fleet_prefix: 2025-07-17T06:33:30.8513911Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:30.8514418Z  2025-07-17T06:33:30.8514867Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:30.8515435Z  2025-07-17T06:33:30.8515775Z  2025-07-17T06:33:30.8516396Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:30.8517163Z  """ 2025-07-17T06:33:30.8517758Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:30.8518457Z  2025-07-17T06:33:30.8519036Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:30.8519844Z  """ 2025-07-17T06:33:30.8520268Z  gh = get_gh_client(github_token) 2025-07-17T06:33:30.8520830Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:30.8521487Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:30.8522080Z  2025-07-17T06:33:30.8522407Z  2025-07-17T06:33:30.8522990Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:30.8523882Z  for _ in range(num_retries): 2025-07-17T06:33:30.8524375Z  try: 2025-07-17T06:33:30.8524823Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:30.8525485Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:30.8526140Z  return json.loads(content) 2025-07-17T06:33:30.8526668Z  except Exception as e: 2025-07-17T06:33:30.8527240Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:30.8527789Z  2025-07-17T06:33:30.8528362Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:30.8529081Z  return {} 2025-07-17T06:33:30.8529483Z  2025-07-17T06:33:30.8529988Z  2025-07-17T06:33:30.8530334Z @cache 2025-07-17T06:33:30.8530972Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:30.8531721Z  """ 2025-07-17T06:33:30.8532126Z  Dynamically get PR information 2025-07-17T06:33:30.8532614Z  """ 2025-07-17T06:33:30.8533123Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:30.8533747Z  headers = { 2025-07-17T06:33:30.8534235Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:30.8534849Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:30.8535374Z  } 2025-07-17T06:33:30.8535822Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:30.8536439Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:30.8536988Z  headers=headers, 2025-07-17T06:33:30.8537436Z  ) 2025-07-17T06:33:30.8537796Z  2025-07-17T06:33:30.8538150Z  if not json_response: 2025-07-17T06:33:30.8538882Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:30.8539510Z  return {} 2025-07-17T06:33:30.8540180Z  2025-07-17T06:33:30.8540547Z  return json_response 2025-07-17T06:33:30.8540993Z  2025-07-17T06:33:30.8541327Z  2025-07-17T06:33:30.8541907Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:30.8542627Z  """ 2025-07-17T06:33:30.8543166Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:30.8543811Z  """ 2025-07-17T06:33:30.8544307Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:30.8544915Z  return { 2025-07-17T06:33:30.8545510Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:30.8546197Z  } 2025-07-17T06:33:30.8546552Z  2025-07-17T06:33:30.8546890Z  2025-07-17T06:33:30.8547248Z def main() -> None: 2025-07-17T06:33:30.8547698Z  args = parse_args() 2025-07-17T06:33:30.8548139Z  2025-07-17T06:33:30.8548559Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:30.8549092Z  2025-07-17T06:33:30.8549464Z  # Check if the PR is opt-out 2025-07-17T06:33:30.8550169Z  if args.pr_number: 2025-07-17T06:33:30.8550856Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:30.8551605Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:30.8552119Z  log.info( 2025-07-17T06:33:30.8552823Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:30.8553576Z  ) 2025-07-17T06:33:30.8554155Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:30.8554824Z  sys.exit() 2025-07-17T06:33:30.8555400Z  2025-07-17T06:33:30.8555746Z  try: 2025-07-17T06:33:30.8556202Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:30.8556915Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:30.8557548Z  ) 2025-07-17T06:33:30.8557918Z  2025-07-17T06:33:30.8558306Z  username = get_potential_pr_author( 2025-07-17T06:33:30.8558849Z  args.github_token, 2025-07-17T06:33:30.8559341Z  args.github_repo, 2025-07-17T06:33:30.8559947Z  args.github_actor, 2025-07-17T06:33:30.8560461Z  args.github_ref_type, 2025-07-17T06:33:30.8560964Z  args.github_branch, 2025-07-17T06:33:30.8561444Z  ) 2025-07-17T06:33:30.8561806Z  2025-07-17T06:33:30.8562289Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:30.8562887Z  2025-07-17T06:33:30.8563298Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:30.8563867Z  rollout_state, 2025-07-17T06:33:30.8564380Z  (args.github_issue_owner, username), 2025-07-17T06:33:30.8564922Z  args.github_branch, 2025-07-17T06:33:30.8565441Z  args.eligible_experiments, 2025-07-17T06:33:30.8565987Z  args.opt_out_experiments, 2025-07-17T06:33:30.8566489Z  is_canary, 2025-07-17T06:33:30.8566928Z  ) 2025-07-17T06:33:30.8567295Z  2025-07-17T06:33:30.8567655Z  except Exception as e: 2025-07-17T06:33:30.8568131Z  log.error( 2025-07-17T06:33:30.8568818Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:30.8569691Z  ) 2025-07-17T06:33:30.8570169Z  2025-07-17T06:33:30.8570684Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:30.8571327Z  2025-07-17T06:33:30.8571759Z  2025-07-17T06:33:30.8572103Z if __name__ == "__main__": 2025-07-17T06:33:30.8572569Z  main() 2025-07-17T06:33:30.8572949Z  2025-07-17T06:33:30.8573302Z EOF 2025-07-17T06:33:30.8573708Z  2025-07-17T06:33:30.8574125Z cat runner_determinator.py 2025-07-17T06:33:30.8790908Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:30.8791700Z env: 2025-07-17T06:33:30.8792338Z GITHUB_TOKEN: *** 2025-07-17T06:33:30.8792745Z ISSUE_NUMBER: 5132 2025-07-17T06:33:30.8793166Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:30.8793654Z ISSUE_OWNER: 2025-07-17T06:33:30.8794032Z CHECK_EXPERIMENTS: 2025-07-17T06:33:30.8794447Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:30.8794874Z PR_NUMBER: 2025-07-17T06:33:30.8795242Z ##[endgroup] 2025-07-17T06:33:30.9019956Z # flake8: noqa: G004 2025-07-17T06:33:30.9020333Z 2025-07-17T06:33:30.9020740Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:30.9021649Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:30.9022432Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:30.9022888Z 2025-07-17T06:33:30.9023043Z """ 2025-07-17T06:33:30.9023592Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:30.9024442Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:30.9025321Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:30.9026155Z of which runners should be used to run which job. 2025-07-17T06:33:30.9026559Z 2025-07-17T06:33:30.9026927Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:30.9027970Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:30.9028823Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:30.9029486Z list, defined. 2025-07-17T06:33:30.9029885Z 2025-07-17T06:33:30.9030238Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:30.9031115Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:30.9031916Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:30.9032363Z 2025-07-17T06:33:30.9032713Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:30.9033547Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:30.9034279Z experiments which the user could be opted in to. 2025-07-17T06:33:30.9034681Z 2025-07-17T06:33:30.9034869Z The user list has the following rules: 2025-07-17T06:33:30.9035230Z 2025-07-17T06:33:30.9035530Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:30.9036370Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:30.9037114Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:30.9037522Z 2025-07-17T06:33:30.9037692Z Example config: 2025-07-17T06:33:30.9038142Z # A list of experiments that can be opted into. 2025-07-17T06:33:30.9038794Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:30.9039410Z # Expected syntax is: 2025-07-17T06:33:30.9040720Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:30.9041669Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:30.9042385Z 2025-07-17T06:33:30.9042658Z experiments: 2025-07-17T06:33:30.9043157Z lf: 2025-07-17T06:33:30.9043541Z rollout_percent: 25 2025-07-17T06:33:30.9044167Z all_branches: false 2025-07-17T06:33:30.9044609Z default: true 2025-07-17T06:33:30.9045027Z --- 2025-07-17T06:33:30.9045241Z 2025-07-17T06:33:30.9045397Z # Opt-ins: 2025-07-17T06:33:30.9045959Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:30.9046799Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:30.9047551Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:30.9048208Z # Experiments should be from the above list. 2025-07-17T06:33:30.9048591Z 2025-07-17T06:33:30.9048773Z @User1,-lf,split_build 2025-07-17T06:33:30.9049206Z @User2,lf 2025-07-17T06:33:30.9049589Z @User3,split_build 2025-07-17T06:33:30.9050297Z """ 2025-07-17T06:33:30.9050504Z 2025-07-17T06:33:30.9050656Z import json 2025-07-17T06:33:30.9051034Z import logging 2025-07-17T06:33:30.9051420Z import os 2025-07-17T06:33:30.9051784Z import random 2025-07-17T06:33:30.9052174Z import re 2025-07-17T06:33:30.9052532Z import sys 2025-07-17T06:33:30.9052935Z from argparse import ArgumentParser 2025-07-17T06:33:30.9053453Z from collections.abc import Iterable 2025-07-17T06:33:30.9053978Z from functools import cache 2025-07-17T06:33:30.9054445Z from logging import LogRecord 2025-07-17T06:33:30.9054948Z from typing import Any, NamedTuple 2025-07-17T06:33:30.9055481Z from urllib.request import Request, urlopen 2025-07-17T06:33:30.9055867Z 2025-07-17T06:33:30.9056024Z import yaml 2025-07-17T06:33:30.9056420Z from github import Auth, Github 2025-07-17T06:33:30.9056911Z from github.Issue import Issue 2025-07-17T06:33:30.9057224Z 2025-07-17T06:33:30.9057231Z 2025-07-17T06:33:30.9057445Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:30.9058108Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:30.9058942Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:30.9059495Z 2025-07-17T06:33:30.9059869Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:30.9060757Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:30.9061273Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:30.9061812Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:30.9062170Z 2025-07-17T06:33:30.9062361Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:30.9062709Z 2025-07-17T06:33:30.9062883Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:30.9063343Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:30.9063629Z 2025-07-17T06:33:30.9063635Z 2025-07-17T06:33:30.9063812Z class Experiment(NamedTuple): 2025-07-17T06:33:30.9064294Z rollout_perc: float = ( 2025-07-17T06:33:30.9064922Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:30.9065572Z ) 2025-07-17T06:33:30.9065942Z all_branches: bool = ( 2025-07-17T06:33:30.9066543Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:30.9067210Z ) 2025-07-17T06:33:30.9067570Z default: bool = ( 2025-07-17T06:33:30.9068127Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:30.9068759Z ) 2025-07-17T06:33:30.9068966Z 2025-07-17T06:33:30.9069138Z # Add more fields as needed 2025-07-17T06:33:30.9069447Z 2025-07-17T06:33:30.9069453Z 2025-07-17T06:33:30.9069634Z class Settings(NamedTuple): 2025-07-17T06:33:30.9070267Z """ 2025-07-17T06:33:30.9070719Z Settings for the experiments that can be opted into. 2025-07-17T06:33:30.9071273Z """ 2025-07-17T06:33:30.9071478Z 2025-07-17T06:33:30.9071673Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:30.9072044Z 2025-07-17T06:33:30.9072049Z 2025-07-17T06:33:30.9072249Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:30.9072862Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:30.9073299Z 2025-07-17T06:33:30.9073456Z COLORS = { 2025-07-17T06:33:30.9073852Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:30.9074499Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:30.9074995Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:30.9075490Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:30.9075961Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:30.9076425Z } 2025-07-17T06:33:30.9076627Z 2025-07-17T06:33:30.9076836Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:30.9077555Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:30.9078314Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:30.9078879Z return super().format(record) 2025-07-17T06:33:30.9079223Z 2025-07-17T06:33:30.9079229Z 2025-07-17T06:33:30.9079415Z handler = logging.StreamHandler() 2025-07-17T06:33:30.9080249Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:30.9080807Z 2025-07-17T06:33:30.9081037Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:30.9081613Z log.addHandler(handler) 2025-07-17T06:33:30.9082047Z log.setLevel(logging.INFO) 2025-07-17T06:33:30.9082342Z 2025-07-17T06:33:30.9082348Z 2025-07-17T06:33:30.9082586Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:30.9083126Z """ 2025-07-17T06:33:30.9083616Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:30.9084216Z """ 2025-07-17T06:33:30.9084580Z if not GITHUB_OUTPUT: 2025-07-17T06:33:30.9085586Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:30.9086686Z log.warning( 2025-07-17T06:33:30.9087490Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:30.9088365Z ) 2025-07-17T06:33:30.9098009Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:30.9098604Z return 2025-07-17T06:33:30.9098863Z 2025-07-17T06:33:30.9099239Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:30.9100097Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:30.9100691Z f.write(f"{key}={value}\n") 2025-07-17T06:33:30.9101059Z 2025-07-17T06:33:30.9101066Z 2025-07-17T06:33:30.9101360Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:30.9101969Z return frozenset( 2025-07-17T06:33:30.9102559Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:30.9103243Z ) 2025-07-17T06:33:30.9103452Z 2025-07-17T06:33:30.9103458Z 2025-07-17T06:33:30.9103631Z def parse_args() -> Any: 2025-07-17T06:33:30.9104165Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:30.9104997Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:30.9105742Z parser.add_argument( 2025-07-17T06:33:30.9106189Z "--github-issue-repo", 2025-07-17T06:33:30.9106657Z type=str, 2025-07-17T06:33:30.9107058Z required=False, 2025-07-17T06:33:30.9107506Z default="pytorch/test-infra", 2025-07-17T06:33:30.9108031Z help="GitHub repo to get the issue", 2025-07-17T06:33:30.9108549Z ) 2025-07-17T06:33:30.9108913Z parser.add_argument( 2025-07-17T06:33:30.9109365Z "--github-repo", 2025-07-17T06:33:30.9109907Z type=str, 2025-07-17T06:33:30.9110298Z required=True, 2025-07-17T06:33:30.9110753Z help="GitHub repo where CI is running", 2025-07-17T06:33:30.9111274Z ) 2025-07-17T06:33:30.9111648Z parser.add_argument( 2025-07-17T06:33:30.9112233Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:30.9112877Z ) 2025-07-17T06:33:30.9113243Z parser.add_argument( 2025-07-17T06:33:30.9113851Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:30.9114507Z ) 2025-07-17T06:33:30.9115011Z parser.add_argument( 2025-07-17T06:33:30.9115635Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:30.9116307Z ) 2025-07-17T06:33:30.9116671Z parser.add_argument( 2025-07-17T06:33:30.9117299Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:30.9118014Z ) 2025-07-17T06:33:30.9118369Z parser.add_argument( 2025-07-17T06:33:30.9118818Z "--github-ref-type", 2025-07-17T06:33:30.9119264Z type=str, 2025-07-17T06:33:30.9120096Z required=True, 2025-07-17T06:33:30.9120905Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:30.9121837Z ) 2025-07-17T06:33:30.9122517Z parser.add_argument( 2025-07-17T06:33:30.9123334Z "--eligible-experiments", 2025-07-17T06:33:30.9124201Z type=_str_comma_separated_to_set, 2025-07-17T06:33:30.9125101Z required=False, 2025-07-17T06:33:30.9125834Z default="", 2025-07-17T06:33:30.9127294Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:30.9128867Z ) 2025-07-17T06:33:30.9129461Z parser.add_argument( 2025-07-17T06:33:30.9130628Z "--opt-out-experiments", 2025-07-17T06:33:30.9131570Z type=_str_comma_separated_to_set, 2025-07-17T06:33:30.9132447Z required=False, 2025-07-17T06:33:30.9133146Z default="", 2025-07-17T06:33:30.9133875Z help=( 2025-07-17T06:33:30.9135026Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:30.9136992Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:30.9138448Z ), 2025-07-17T06:33:30.9139045Z ) 2025-07-17T06:33:30.9139647Z parser.add_argument( 2025-07-17T06:33:30.9141366Z "--pr-number", 2025-07-17T06:33:30.9142060Z type=str, 2025-07-17T06:33:30.9142715Z required=False, 2025-07-17T06:33:30.9143383Z default="", 2025-07-17T06:33:30.9144360Z help="the optional PR number where this is run", 2025-07-17T06:33:30.9145278Z ) 2025-07-17T06:33:30.9145601Z 2025-07-17T06:33:30.9145917Z return parser.parse_args() 2025-07-17T06:33:30.9146425Z 2025-07-17T06:33:30.9146435Z 2025-07-17T06:33:30.9147118Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:30.9148454Z auth = Auth.Token(github_token) 2025-07-17T06:33:30.9149345Z return Github(auth=auth) 2025-07-17T06:33:30.9150061Z 2025-07-17T06:33:30.9150076Z 2025-07-17T06:33:30.9150829Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:30.9152220Z repo = gh.get_repo(repo) 2025-07-17T06:33:30.9153098Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:30.9153736Z 2025-07-17T06:33:30.9153746Z 2025-07-17T06:33:30.9154069Z def get_potential_pr_author( 2025-07-17T06:33:30.9155209Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:30.9156438Z ) -> str: 2025-07-17T06:33:30.9157323Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:30.9158661Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:30.9160063Z # embedded in the tag name: ciflow// 2025-07-17T06:33:30.9160778Z 2025-07-17T06:33:30.9161072Z gh = get_gh_client(github_token) 2025-07-17T06:33:30.9161598Z 2025-07-17T06:33:30.9161990Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:30.9162812Z split_tag = ref_name.split("/") 2025-07-17T06:33:30.9163328Z if ( 2025-07-17T06:33:30.9163725Z len(split_tag) == 3 2025-07-17T06:33:30.9164198Z and split_tag[0] == "ciflow" 2025-07-17T06:33:30.9164731Z and split_tag[2].isnumeric() 2025-07-17T06:33:30.9165212Z ): 2025-07-17T06:33:30.9165811Z pr_number = split_tag[2] 2025-07-17T06:33:30.9166303Z try: 2025-07-17T06:33:30.9166732Z repository = gh.get_repo(repo) 2025-07-17T06:33:30.9167337Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:30.9167930Z except Exception as e: 2025-07-17T06:33:30.9168447Z raise Exception( # noqa: TRY002 2025-07-17T06:33:30.9169101Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:30.9169925Z ) from e 2025-07-17T06:33:30.9170475Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:30.9171155Z # In all other cases, return the original input username 2025-07-17T06:33:30.9171722Z return username 2025-07-17T06:33:30.9171974Z 2025-07-17T06:33:30.9171981Z 2025-07-17T06:33:30.9172190Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:30.9172715Z """ 2025-07-17T06:33:30.9173327Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:30.9174089Z """ 2025-07-17T06:33:30.9174607Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:30.9175122Z 2025-07-17T06:33:30.9175129Z 2025-07-17T06:33:30.9175313Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:30.9175790Z try: 2025-07-17T06:33:30.9176174Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:30.9176675Z return data 2025-07-17T06:33:30.9177081Z except yaml.YAMLError: 2025-07-17T06:33:30.9177559Z log.exception("Error loading YAML") 2025-07-17T06:33:30.9178070Z raise 2025-07-17T06:33:30.9178296Z 2025-07-17T06:33:30.9178303Z 2025-07-17T06:33:30.9178691Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:30.9179394Z """ 2025-07-17T06:33:30.9180184Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:30.9180773Z 2025-07-17T06:33:30.9181222Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:30.9181956Z and the text below is the list of opted in users. 2025-07-17T06:33:30.9182355Z 2025-07-17T06:33:30.9182710Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:30.9183387Z """ 2025-07-17T06:33:30.9183825Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:30.9184403Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:30.9232482Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:30.9233534Z else: 2025-07-17T06:33:30.9234124Z return "", rollout_state 2025-07-17T06:33:30.9234466Z 2025-07-17T06:33:30.9234477Z 2025-07-17T06:33:30.9234685Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:30.9235200Z """ 2025-07-17T06:33:30.9235726Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:30.9236358Z """ 2025-07-17T06:33:30.9236578Z 2025-07-17T06:33:30.9236590Z 2025-07-17T06:33:30.9236921Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:30.9237569Z """ 2025-07-17T06:33:30.9238250Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:30.9238911Z 2025-07-17T06:33:30.9239485Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:30.9240705Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:30.9241375Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:30.9241846Z 2025-07-17T06:33:30.9241853Z 2025-07-17T06:33:30.9241999Z """ 2025-07-17T06:33:30.9242377Z optins = UserOptins() 2025-07-17T06:33:30.9242859Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:30.9243398Z user = user.strip("\r\n\t -") 2025-07-17T06:33:30.9244189Z if not user or not user.startswith("@"): 2025-07-17T06:33:30.9244725Z # Not a valid user. Skip 2025-07-17T06:33:30.9245197Z continue 2025-07-17T06:33:30.9245446Z 2025-07-17T06:33:30.9245597Z if user: 2025-07-17T06:33:30.9246020Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:30.9246692Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:30.9247195Z 2025-07-17T06:33:30.9247351Z return optins 2025-07-17T06:33:30.9247590Z 2025-07-17T06:33:30.9247597Z 2025-07-17T06:33:30.9247866Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:30.9248452Z """ 2025-07-17T06:33:30.9248839Z Check if the experiment name is valid. 2025-07-17T06:33:30.9249348Z A valid name: 2025-07-17T06:33:30.9250138Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:30.9251038Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:30.9251742Z - Cannot contain spaces 2025-07-17T06:33:30.9252201Z """ 2025-07-17T06:33:30.9252414Z 2025-07-17T06:33:30.9252657Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:30.9253337Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:30.9253790Z 2025-07-17T06:33:30.9253937Z if valid: 2025-07-17T06:33:30.9254315Z return True 2025-07-17T06:33:30.9254558Z 2025-07-17T06:33:30.9254712Z log.error( 2025-07-17T06:33:30.9256066Z 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-07-17T06:33:30.9257544Z ) 2025-07-17T06:33:30.9257894Z return False 2025-07-17T06:33:30.9258144Z 2025-07-17T06:33:30.9258151Z 2025-07-17T06:33:30.9258433Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:30.9259041Z """ 2025-07-17T06:33:30.9259916Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:30.9260670Z """ 2025-07-17T06:33:30.9261022Z try: 2025-07-17T06:33:30.9261398Z if settings_text: 2025-07-17T06:33:30.9262085Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:30.9262838Z # for easy reading 2025-07-17T06:33:30.9263592Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:30.9264448Z # the backtick character in shell commands. 2025-07-17T06:33:30.9265042Z backtick = chr(96) # backtick character 2025-07-17T06:33:30.9265699Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:30.9266348Z settings = load_yaml(settings_text) 2025-07-17T06:33:30.9266712Z 2025-07-17T06:33:30.9267092Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:30.9267816Z experiments = {} 2025-07-17T06:33:30.9268108Z 2025-07-17T06:33:30.9268452Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:30.9269178Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:30.9270512Z # 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-07-17T06:33:30.9271500Z continue 2025-07-17T06:33:30.9271789Z 2025-07-17T06:33:30.9271960Z valid_settings = {} 2025-07-17T06:33:30.9272465Z for setting in exp_settings: 2025-07-17T06:33:30.9273021Z if setting not in Experiment._fields: 2025-07-17T06:33:30.9273575Z log.warning( 2025-07-17T06:33:30.9274257Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:30.9275091Z ) 2025-07-17T06:33:30.9275515Z else: 2025-07-17T06:33:30.9276027Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:30.9276452Z 2025-07-17T06:33:30.9276705Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:30.9277315Z return Settings(experiments) 2025-07-17T06:33:30.9277669Z 2025-07-17T06:33:30.9277832Z except Exception: 2025-07-17T06:33:30.9278297Z log.exception("Failed to parse settings") 2025-07-17T06:33:30.9278686Z 2025-07-17T06:33:30.9278849Z return Settings() 2025-07-17T06:33:30.9279110Z 2025-07-17T06:33:30.9279117Z 2025-07-17T06:33:30.9279354Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:30.9280072Z """ 2025-07-17T06:33:30.9280484Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:30.9280880Z 2025-07-17T06:33:30.9281212Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:30.9281943Z and the text below is the list of opted in users. 2025-07-17T06:33:30.9282355Z 2025-07-17T06:33:30.9282729Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:30.9283438Z """ 2025-07-17T06:33:30.9283964Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:30.9284679Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:30.9285070Z 2025-07-17T06:33:30.9285076Z 2025-07-17T06:33:30.9285303Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:30.9285856Z """ 2025-07-17T06:33:30.9286235Z Parse users from the rollout state. 2025-07-17T06:33:30.9286591Z 2025-07-17T06:33:30.9286780Z """ 2025-07-17T06:33:30.9287291Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:30.9287992Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:30.9288396Z 2025-07-17T06:33:30.9288403Z 2025-07-17T06:33:30.9288911Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:30.9289626Z """ 2025-07-17T06:33:30.9290196Z Check if a user is opted into an experiment 2025-07-17T06:33:30.9290723Z """ 2025-07-17T06:33:30.9291159Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:30.9291572Z 2025-07-17T06:33:30.9291577Z 2025-07-17T06:33:30.9291967Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:30.9292691Z """ 2025-07-17T06:33:30.9293153Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:30.9293720Z """ 2025-07-17T06:33:30.9294213Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:30.9294867Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:30.9295492Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:30.9296074Z return False 2025-07-17T06:33:30.9296321Z 2025-07-17T06:33:30.9296571Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:30.9297147Z log.warning( 2025-07-17T06:33:30.9297889Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:30.9298719Z ) 2025-07-17T06:33:30.9298929Z 2025-07-17T06:33:30.9299082Z return True 2025-07-17T06:33:30.9299324Z 2025-07-17T06:33:30.9299330Z 2025-07-17T06:33:30.9299497Z def get_runner_prefix( 2025-07-17T06:33:30.9300117Z rollout_state: str, 2025-07-17T06:33:30.9300571Z workflow_requestors: Iterable[str], 2025-07-17T06:33:30.9301082Z branch: str, 2025-07-17T06:33:30.9301548Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:30.9302188Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:30.9302756Z is_canary: bool = False, 2025-07-17T06:33:30.9303199Z ) -> str: 2025-07-17T06:33:30.9303751Z settings = parse_settings(rollout_state) 2025-07-17T06:33:30.9304316Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:30.9304678Z 2025-07-17T06:33:30.9304845Z fleet_prefix = "" 2025-07-17T06:33:30.9305265Z prefixes = [] 2025-07-17T06:33:30.9305864Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:30.9306744Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:30.9307423Z log.info( 2025-07-17T06:33:30.9308057Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:30.9308783Z ) 2025-07-17T06:33:30.9309153Z continue 2025-07-17T06:33:30.9309407Z 2025-07-17T06:33:30.9309586Z if opt_out_experiments: 2025-07-17T06:33:30.9310251Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:30.9310865Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:30.9311432Z log.info( 2025-07-17T06:33:30.9312299Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:30.9313220Z ) 2025-07-17T06:33:30.9313600Z continue 2025-07-17T06:33:30.9313876Z 2025-07-17T06:33:30.9314047Z if eligible_experiments: 2025-07-17T06:33:30.9314580Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:30.9315187Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:30.9315724Z log.info( 2025-07-17T06:33:30.9316457Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:30.9317261Z ) 2025-07-17T06:33:30.9317647Z continue 2025-07-17T06:33:30.9318109Z elif not experiment_settings.default: 2025-07-17T06:33:30.9318630Z log.info( 2025-07-17T06:33:30.9319369Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:30.9320251Z ) 2025-07-17T06:33:30.9320622Z continue 2025-07-17T06:33:30.9320868Z 2025-07-17T06:33:30.9321131Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:30.9321722Z opted_out_users = [ 2025-07-17T06:33:30.9322162Z requestor 2025-07-17T06:33:30.9322604Z for requestor in workflow_requestors 2025-07-17T06:33:30.9323249Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:30.9323856Z ] 2025-07-17T06:33:30.9324066Z 2025-07-17T06:33:30.9324230Z if opted_out_users: 2025-07-17T06:33:30.9324671Z log.info( 2025-07-17T06:33:30.9325254Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:30.9325923Z ) 2025-07-17T06:33:30.9326299Z continue 2025-07-17T06:33:30.9326548Z 2025-07-17T06:33:30.9326796Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:30.9327377Z opted_in_users = [ 2025-07-17T06:33:30.9327807Z requestor 2025-07-17T06:33:30.9328252Z for requestor in workflow_requestors 2025-07-17T06:33:30.9328878Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:30.9329488Z ] 2025-07-17T06:33:30.9329694Z 2025-07-17T06:33:30.9330069Z enabled = False 2025-07-17T06:33:30.9330505Z if opted_in_users: 2025-07-17T06:33:30.9330936Z log.info( 2025-07-17T06:33:30.9331516Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:30.9332172Z ) 2025-07-17T06:33:30.9332554Z enabled = True 2025-07-17T06:33:30.9332838Z 2025-07-17T06:33:30.9333043Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:30.9333831Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:30.9334856Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:30.9335476Z log.info( 2025-07-17T06:33:30.9336287Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:30.9337155Z ) 2025-07-17T06:33:30.9337549Z enabled = True 2025-07-17T06:33:30.9337840Z 2025-07-17T06:33:30.9337995Z if enabled: 2025-07-17T06:33:30.9338401Z label = experiment_name 2025-07-17T06:33:30.9338943Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:30.9339919Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:30.9340834Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:30.9341567Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:30.9342211Z if is_canary: 2025-07-17T06:33:30.9342703Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:30.9343245Z fleet_prefix = label 2025-07-17T06:33:30.9343723Z else: 2025-07-17T06:33:30.9344131Z prefixes.append(label) 2025-07-17T06:33:30.9344484Z 2025-07-17T06:33:30.9344657Z if len(prefixes) > 1: 2025-07-17T06:33:30.9345092Z log.error( 2025-07-17T06:33:30.9346057Z 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-07-17T06:33:30.9347110Z ) 2025-07-17T06:33:30.9347480Z prefixes = prefixes[:1] 2025-07-17T06:33:30.9347790Z 2025-07-17T06:33:30.9347969Z # Fleet always comes first 2025-07-17T06:33:30.9348420Z if fleet_prefix: 2025-07-17T06:33:30.9348862Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:30.9349226Z 2025-07-17T06:33:30.9349584Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:30.9350110Z 2025-07-17T06:33:30.9350116Z 2025-07-17T06:33:30.9350524Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:30.9351266Z """ 2025-07-17T06:33:30.9351819Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:30.9352368Z 2025-07-17T06:33:30.9352717Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:30.9353382Z """ 2025-07-17T06:33:30.9353763Z gh = get_gh_client(github_token) 2025-07-17T06:33:30.9354287Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:30.9354909Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:30.9355340Z 2025-07-17T06:33:30.9355346Z 2025-07-17T06:33:30.9355716Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:30.9356433Z for _ in range(num_retries): 2025-07-17T06:33:30.9356893Z try: 2025-07-17T06:33:30.9357303Z req = Request(url=url, headers=headers) 2025-07-17T06:33:30.9357942Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:30.9358552Z return json.loads(content) 2025-07-17T06:33:30.9359066Z except Exception as e: 2025-07-17T06:33:30.9359586Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:30.9360081Z 2025-07-17T06:33:30.9360425Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:30.9361109Z return {} 2025-07-17T06:33:30.9361329Z 2025-07-17T06:33:30.9361335Z 2025-07-17T06:33:30.9361482Z @cache 2025-07-17T06:33:30.9362065Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:30.9362782Z """ 2025-07-17T06:33:30.9363156Z Dynamically get PR information 2025-07-17T06:33:30.9363753Z """ 2025-07-17T06:33:30.9364225Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:30.9364828Z headers = { 2025-07-17T06:33:30.9365260Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:30.9365838Z "Authorization": f"token {github_token}", 2025-07-17T06:33:30.9366346Z } 2025-07-17T06:33:30.9366759Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:30.9367335Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:30.9367871Z headers=headers, 2025-07-17T06:33:30.9368290Z ) 2025-07-17T06:33:30.9368495Z 2025-07-17T06:33:30.9368660Z if not json_response: 2025-07-17T06:33:30.9369195Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:30.9369986Z return {} 2025-07-17T06:33:30.9370227Z 2025-07-17T06:33:30.9370400Z return json_response 2025-07-17T06:33:30.9370672Z 2025-07-17T06:33:30.9370678Z 2025-07-17T06:33:30.9371048Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:30.9371744Z """ 2025-07-17T06:33:30.9372251Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:30.9372873Z """ 2025-07-17T06:33:30.9373336Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:30.9373923Z return { 2025-07-17T06:33:30.9374479Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:30.9375145Z } 2025-07-17T06:33:30.9375351Z 2025-07-17T06:33:30.9375357Z 2025-07-17T06:33:30.9375514Z def main() -> None: 2025-07-17T06:33:30.9375914Z args = parse_args() 2025-07-17T06:33:30.9376185Z 2025-07-17T06:33:30.9376386Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:30.9376765Z 2025-07-17T06:33:30.9376947Z # Check if the PR is opt-out 2025-07-17T06:33:30.9377412Z if args.pr_number: 2025-07-17T06:33:30.9378026Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:30.9378860Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:30.9379352Z log.info( 2025-07-17T06:33:30.9380164Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:30.9380892Z ) 2025-07-17T06:33:30.9381415Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:30.9382048Z sys.exit() 2025-07-17T06:33:30.9382305Z 2025-07-17T06:33:30.9382460Z try: 2025-07-17T06:33:30.9382866Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:30.9383535Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:30.9384135Z ) 2025-07-17T06:33:30.9384353Z 2025-07-17T06:33:30.9384540Z username = get_potential_pr_author( 2025-07-17T06:33:30.9385052Z args.github_token, 2025-07-17T06:33:30.9385519Z args.github_repo, 2025-07-17T06:33:30.9385968Z args.github_actor, 2025-07-17T06:33:30.9386424Z args.github_ref_type, 2025-07-17T06:33:30.9386936Z args.github_branch, 2025-07-17T06:33:30.9387373Z ) 2025-07-17T06:33:30.9387578Z 2025-07-17T06:33:30.9387838Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:30.9388278Z 2025-07-17T06:33:30.9388473Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:30.9389011Z rollout_state, 2025-07-17T06:33:30.9389466Z (args.github_issue_owner, username), 2025-07-17T06:33:30.9390091Z args.github_branch, 2025-07-17T06:33:30.9390570Z args.eligible_experiments, 2025-07-17T06:33:30.9391077Z args.opt_out_experiments, 2025-07-17T06:33:30.9391566Z is_canary, 2025-07-17T06:33:30.9391965Z ) 2025-07-17T06:33:30.9392185Z 2025-07-17T06:33:30.9392353Z except Exception as e: 2025-07-17T06:33:30.9392779Z log.error( 2025-07-17T06:33:30.9393403Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:30.9394280Z ) 2025-07-17T06:33:30.9394499Z 2025-07-17T06:33:30.9394803Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:30.9395280Z 2025-07-17T06:33:30.9395287Z 2025-07-17T06:33:30.9395457Z if __name__ == "__main__": 2025-07-17T06:33:30.9395876Z main() 2025-07-17T06:33:30.9396091Z 2025-07-17T06:33:30.9482110Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:30.9482909Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:30.9509659Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:30.9510353Z env: 2025-07-17T06:33:30.9510905Z GITHUB_TOKEN: *** 2025-07-17T06:33:30.9511276Z ISSUE_NUMBER: 5132 2025-07-17T06:33:30.9511675Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:30.9512127Z ISSUE_OWNER: 2025-07-17T06:33:30.9512487Z CHECK_EXPERIMENTS: 2025-07-17T06:33:30.9512870Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:30.9513264Z PR_NUMBER: 2025-07-17T06:33:30.9513602Z ##[endgroup] 2025-07-17T06:33:32.1473704Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:33.0979015Z Collecting urllib3==1.26.18 2025-07-17T06:33:33.1802040Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:33.2070230Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.6 MB/s eta 0:00:00 2025-07-17T06:33:33.2414567Z Collecting PyGithub==2.3.0 2025-07-17T06:33:33.2570743Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:33.3189525Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:33.3344682Z 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-07-17T06:33:33.3387458Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:33.3403844Z 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-07-17T06:33:33.3418240Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:33.3779068Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:33.3930385Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:33.4157876Z 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-07-17T06:33:33.5524097Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:33.5677263Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:33.6794960Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:33.6948420Z 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-07-17T06:33:33.7246450Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:33.7399054Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:33.7754183Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:33.7943148Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.0 MB/s eta 0:00:00 2025-07-17T06:33:33.8105761Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:33.8331021Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.8 MB/s eta 0:00:00 2025-07-17T06:33:33.8488125Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:33.8687253Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 47.1 MB/s eta 0:00:00 2025-07-17T06:33:33.8838764Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:33.9011992Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:33.9076118Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 99.7 MB/s eta 0:00:00 2025-07-17T06:33:33.9226360Z 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-07-17T06:33:33.9281105Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 20.5 MB/s eta 0:00:00 2025-07-17T06:33:33.9433362Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:33.9476620Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.8 MB/s eta 0:00:00 2025-07-17T06:33:34.2765141Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:34.8054238Z 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-07-17T06:33:34.8785694Z ##[group]Run curr_branch="main" 2025-07-17T06:33:34.8786060Z curr_branch="main" 2025-07-17T06:33:34.8786292Z curr_ref_type="branch" 2025-07-17T06:33:34.8786545Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:34.8786814Z  2025-07-17T06:33:34.8787003Z python3 runner_determinator.py \ 2025-07-17T06:33:34.8787285Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:34.8787554Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:34.8787809Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:34.8788084Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:34.8788378Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:34.8788665Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:34.8788932Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:34.8789239Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:34.8789600Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:34.8790126Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:34.8818281Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:34.8818511Z env: 2025-07-17T06:33:34.8818995Z GITHUB_TOKEN: *** 2025-07-17T06:33:34.8819196Z ISSUE_NUMBER: 5132 2025-07-17T06:33:34.8819416Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:34.8819657Z ISSUE_OWNER: 2025-07-17T06:33:34.8820126Z CHECK_EXPERIMENTS: 2025-07-17T06:33:34.8820329Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:34.8820527Z PR_NUMBER: 2025-07-17T06:33:34.8820692Z ##[endgroup] 2025-07-17T06:33:34.8867594Z Current branch is 'main' 2025-07-17T06:33:36.3614907Z INFO : Based on rollout percentage of 25%, enabling experiment lf. 2025-07-17T06:33:36.3616247Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:36.3617259Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:36.3617939Z INFO : Setting output: label-type='lf.' 2025-07-17T06:33:36.3925430Z Evaluate and set job outputs 2025-07-17T06:33:36.3932267Z Set output 'label-type' 2025-07-17T06:33:36.3934018Z Cleaning up orphan processes