2025-09-07T07:00:42.3317093Z Current runner version: '2.328.0' 2025-09-07T07:00:42.3341670Z ##[group]Runner Image Provisioner 2025-09-07T07:00:42.3342460Z Hosted Compute Agent 2025-09-07T07:00:42.3343066Z Version: 20250829.383 2025-09-07T07:00:42.3343695Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T07:00:42.3344399Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T07:00:42.3345068Z ##[endgroup] 2025-09-07T07:00:42.3345660Z ##[group]Operating System 2025-09-07T07:00:42.3346219Z Ubuntu 2025-09-07T07:00:42.3346772Z 24.04.3 2025-09-07T07:00:42.3347219Z LTS 2025-09-07T07:00:42.3347669Z ##[endgroup] 2025-09-07T07:00:42.3348096Z ##[group]Runner Image 2025-09-07T07:00:42.3348733Z Image: ubuntu-24.04 2025-09-07T07:00:42.3349236Z Version: 20250831.1.0 2025-09-07T07:00:42.3350380Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T07:00:42.3352052Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T07:00:42.3353144Z ##[endgroup] 2025-09-07T07:00:42.3354174Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T07:00:42.3356345Z Contents: read 2025-09-07T07:00:42.3356978Z Metadata: read 2025-09-07T07:00:42.3357478Z ##[endgroup] 2025-09-07T07:00:42.3360094Z Secret source: Actions 2025-09-07T07:00:42.3361149Z Prepare workflow directory 2025-09-07T07:00:42.3863606Z Prepare all required actions 2025-09-07T07:00:42.3919274Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T07:00:42.3924645Z ##[group] Inputs 2025-09-07T07:00:42.3925192Z check_experiments: 2025-09-07T07:00:42.3925923Z opt_out_experiments: lf 2025-09-07T07:00:42.3926490Z triggering_actor: pytorchmergebot 2025-09-07T07:00:42.3927114Z issue_owner: 2025-09-07T07:00:42.3927685Z curr_branch: main 2025-09-07T07:00:42.3928173Z curr_ref_type: branch 2025-09-07T07:00:42.3928898Z issue_number: 5132 2025-09-07T07:00:42.3929781Z ##[endgroup] 2025-09-07T07:00:42.3930516Z Complete job name: get-default-label-prefix / runner-determinator 2025-09-07T07:00:42.9217281Z ##[group]Run cat < runner_determinator.py 2025-09-07T07:00:42.9219855Z cat < runner_determinator.py 2025-09-07T07:00:42.9220610Z # flake8: noqa: G004 2025-09-07T07:00:42.9221205Z  2025-09-07T07:00:42.9222096Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:00:42.9223249Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:00:42.9224225Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:00:42.9225015Z  2025-09-07T07:00:42.9225472Z """ 2025-09-07T07:00:42.9226233Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:00:42.9227365Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:00:42.9228670Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:00:42.9229814Z of which runners should be used to run which job. 2025-09-07T07:00:42.9230620Z  2025-09-07T07:00:42.9231371Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:00:42.9232454Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:00:42.9233594Z settings are considered to be empty with only the second part, the user 2025-09-07T07:00:42.9234501Z list, defined. 2025-09-07T07:00:42.9235010Z  2025-09-07T07:00:42.9235789Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:00:42.9236876Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:00:42.9237915Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:00:42.9238684Z  2025-09-07T07:00:42.9240022Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:00:42.9241114Z The user list is also a comma separated list of additional features or 2025-09-07T07:00:42.9242139Z experiments which the user could be opted in to. 2025-09-07T07:00:42.9242881Z  2025-09-07T07:00:42.9243383Z The user list has the following rules: 2025-09-07T07:00:42.9244089Z  2025-09-07T07:00:42.9244841Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:00:42.9245857Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:00:42.9246855Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:00:42.9247543Z  2025-09-07T07:00:42.9248034Z Example config: 2025-09-07T07:00:42.9248624Z  # A list of experiments that can be opted into. 2025-09-07T07:00:42.9249776Z  # This defines the behavior they'll induce when opted into. 2025-09-07T07:00:42.9250596Z  # Expected syntax is: 2025-09-07T07:00:42.9251387Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:00:42.9252634Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:00:42.9253514Z  2025-09-07T07:00:42.9253996Z  experiments: 2025-09-07T07:00:42.9254657Z  lf: 2025-09-07T07:00:42.9255167Z  rollout_percent: 25 2025-09-07T07:00:42.9255783Z  all_branches: false 2025-09-07T07:00:42.9256444Z  default: true 2025-09-07T07:00:42.9257024Z  --- 2025-09-07T07:00:42.9257486Z  2025-09-07T07:00:42.9258055Z  # Opt-ins: 2025-09-07T07:00:42.9258802Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:00:42.9260184Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:00:42.9261280Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:00:42.9262111Z  # Experiments should be from the above list. 2025-09-07T07:00:42.9262813Z  2025-09-07T07:00:42.9263373Z  @User1,-lf,split_build 2025-09-07T07:00:42.9264018Z  @User2,lf 2025-09-07T07:00:42.9264581Z  @User3,split_build 2025-09-07T07:00:42.9338472Z """ 2025-09-07T07:00:42.9339532Z  2025-09-07T07:00:42.9340256Z import json 2025-09-07T07:00:42.9341103Z import logging 2025-09-07T07:00:42.9342038Z import os 2025-09-07T07:00:42.9342883Z import random 2025-09-07T07:00:42.9343731Z import re 2025-09-07T07:00:42.9344195Z import sys 2025-09-07T07:00:42.9344676Z from argparse import ArgumentParser 2025-09-07T07:00:42.9345345Z from collections.abc import Iterable 2025-09-07T07:00:42.9345983Z from functools import cache 2025-09-07T07:00:42.9346544Z from logging import LogRecord 2025-09-07T07:00:42.9347122Z from typing import Any, NamedTuple 2025-09-07T07:00:42.9347763Z from urllib.request import Request, urlopen 2025-09-07T07:00:42.9348372Z  2025-09-07T07:00:42.9348769Z import yaml 2025-09-07T07:00:42.9349243Z from github import Auth, Github 2025-09-07T07:00:42.9350043Z from github.Issue import Issue 2025-09-07T07:00:42.9350576Z  2025-09-07T07:00:42.9350941Z  2025-09-07T07:00:42.9351412Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:00:42.9352201Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:00:42.9353185Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:00:42.9353958Z  2025-09-07T07:00:42.9354680Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:00:42.9355337Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:00:42.9355939Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:00:42.9356596Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:00:42.9357168Z  2025-09-07T07:00:42.9357602Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:00:42.9358150Z  2025-09-07T07:00:42.9358558Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:00:42.9359090Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:00:42.9359826Z  2025-09-07T07:00:42.9360216Z  2025-09-07T07:00:42.9360633Z class Experiment(NamedTuple): 2025-09-07T07:00:42.9361201Z  rollout_perc: float = ( 2025-09-07T07:00:42.9361978Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:00:42.9362717Z  ) 2025-09-07T07:00:42.9363136Z  all_branches: bool = ( 2025-09-07T07:00:42.9363882Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:00:42.9364612Z  ) 2025-09-07T07:00:42.9365029Z  default: bool = ( 2025-09-07T07:00:42.9365695Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T07:00:42.9366394Z  ) 2025-09-07T07:00:42.9366789Z  2025-09-07T07:00:42.9367188Z  # Add more fields as needed 2025-09-07T07:00:42.9367707Z  2025-09-07T07:00:42.9368074Z  2025-09-07T07:00:42.9368482Z class Settings(NamedTuple): 2025-09-07T07:00:42.9368998Z  """ 2025-09-07T07:00:42.9369702Z  Settings for the experiments that can be opted into. 2025-09-07T07:00:42.9370345Z  """ 2025-09-07T07:00:42.9370744Z  2025-09-07T07:00:42.9371191Z  experiments: dict[str, Experiment] = {} 2025-09-07T07:00:42.9371764Z  2025-09-07T07:00:42.9372278Z  2025-09-07T07:00:42.9372739Z class ColorFormatter(logging.Formatter): 2025-09-07T07:00:42.9373446Z  """Color codes the log messages based on the log level""" 2025-09-07T07:00:42.9374079Z  2025-09-07T07:00:42.9374456Z  COLORS = { 2025-09-07T07:00:42.9374937Z  "WARNING": "\033[33m", # Yellow 2025-09-07T07:00:42.9375502Z  "ERROR": "\033[31m", # Red 2025-09-07T07:00:42.9376060Z  "CRITICAL": "\033[31m", # Red 2025-09-07T07:00:42.9376614Z  "INFO": "\033[0m", # Reset 2025-09-07T07:00:42.9377181Z  "DEBUG": "\033[0m", # Reset 2025-09-07T07:00:42.9377698Z  } 2025-09-07T07:00:42.9378088Z  2025-09-07T07:00:42.9378541Z  def format(self, record: LogRecord) -> str: 2025-09-07T07:00:42.9379575Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:00:42.9380494Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:00:42.9381138Z  return super().format(record) 2025-09-07T07:00:42.9381678Z  2025-09-07T07:00:42.9382042Z  2025-09-07T07:00:42.9382464Z handler = logging.StreamHandler() 2025-09-07T07:00:42.9383265Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:00:42.9384033Z  2025-09-07T07:00:42.9384529Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:00:42.9385175Z log.addHandler(handler) 2025-09-07T07:00:42.9385696Z log.setLevel(logging.INFO) 2025-09-07T07:00:42.9386198Z  2025-09-07T07:00:42.9386570Z  2025-09-07T07:00:42.9387066Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:00:42.9387693Z  """ 2025-09-07T07:00:42.9388278Z  Defines outputs of the github action that invokes this script 2025-09-07T07:00:42.9389109Z  """ 2025-09-07T07:00:42.9389724Z  if not GITHUB_OUTPUT: 2025-09-07T07:00:42.9390907Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:00:42.9392124Z  log.warning( 2025-09-07T07:00:42.9393095Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:00:42.9394087Z  ) 2025-09-07T07:00:42.9394588Z  print(f"::set-output name={key}::{value}") 2025-09-07T07:00:42.9395178Z  return 2025-09-07T07:00:42.9395615Z  2025-09-07T07:00:42.9396043Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:00:42.9396693Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:00:42.9397330Z  f.write(f"{key}={value}\n") 2025-09-07T07:00:42.9397868Z  2025-09-07T07:00:42.9398245Z  2025-09-07T07:00:42.9398802Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:00:42.9399740Z  return frozenset( 2025-09-07T07:00:42.9400456Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:00:42.9401191Z  ) 2025-09-07T07:00:42.9401590Z  2025-09-07T07:00:42.9401966Z  2025-09-07T07:00:42.9402364Z def parse_args() -> Any: 2025-09-07T07:00:42.9403024Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:00:42.9403982Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:00:42.9404811Z  parser.add_argument( 2025-09-07T07:00:42.9405347Z  "--github-issue-repo", 2025-09-07T07:00:42.9405886Z  type=str, 2025-09-07T07:00:42.9406383Z  required=False, 2025-09-07T07:00:42.9407059Z  default="pytorch/test-infra", 2025-09-07T07:00:42.9407686Z  help="GitHub repo to get the issue", 2025-09-07T07:00:42.9408260Z  ) 2025-09-07T07:00:42.9408683Z  parser.add_argument( 2025-09-07T07:00:42.9409205Z  "--github-repo", 2025-09-07T07:00:42.9410048Z  type=str, 2025-09-07T07:00:42.9410547Z  required=True, 2025-09-07T07:00:42.9411103Z  help="GitHub repo where CI is running", 2025-09-07T07:00:42.9411685Z  ) 2025-09-07T07:00:42.9412105Z  parser.add_argument( 2025-09-07T07:00:42.9412804Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:00:42.9413524Z  ) 2025-09-07T07:00:42.9413948Z  parser.add_argument( 2025-09-07T07:00:42.9414680Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:00:42.9415420Z  ) 2025-09-07T07:00:42.9415847Z  parser.add_argument( 2025-09-07T07:00:42.9416584Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:00:42.9417322Z  ) 2025-09-07T07:00:42.9417745Z  parser.add_argument( 2025-09-07T07:00:42.9418509Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:00:42.9419275Z  ) 2025-09-07T07:00:42.9419931Z  parser.add_argument( 2025-09-07T07:00:42.9420470Z  "--github-ref-type", 2025-09-07T07:00:42.9420998Z  type=str, 2025-09-07T07:00:42.9421475Z  required=True, 2025-09-07T07:00:42.9422062Z  help="Current GitHub ref type, branch or tag", 2025-09-07T07:00:42.9422666Z  ) 2025-09-07T07:00:42.9423088Z  parser.add_argument( 2025-09-07T07:00:42.9423785Z  "--eligible-experiments", 2025-09-07T07:00:42.9424387Z  type=_str_comma_separated_to_set, 2025-09-07T07:00:42.9424964Z  required=False, 2025-09-07T07:00:42.9425466Z  default="", 2025-09-07T07:00:42.9426418Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:00:42.9427411Z  ) 2025-09-07T07:00:42.9427837Z  parser.add_argument( 2025-09-07T07:00:42.9428375Z  "--opt-out-experiments", 2025-09-07T07:00:42.9428966Z  type=_str_comma_separated_to_set, 2025-09-07T07:00:42.9429718Z  required=False, 2025-09-07T07:00:42.9430228Z  default="", 2025-09-07T07:00:42.9430705Z  help=( 2025-09-07T07:00:42.9431468Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:00:42.9432683Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:00:42.9433569Z  ), 2025-09-07T07:00:42.9433983Z  ) 2025-09-07T07:00:42.9434413Z  parser.add_argument( 2025-09-07T07:00:42.9434934Z  "--pr-number", 2025-09-07T07:00:42.9435425Z  type=str, 2025-09-07T07:00:42.9435895Z  required=False, 2025-09-07T07:00:42.9436387Z  default="", 2025-09-07T07:00:42.9436954Z  help="the optional PR number where this is run", 2025-09-07T07:00:42.9437562Z  ) 2025-09-07T07:00:42.9437957Z  2025-09-07T07:00:42.9438368Z  return parser.parse_args() 2025-09-07T07:00:42.9438886Z  2025-09-07T07:00:42.9439249Z  2025-09-07T07:00:42.9440127Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:00:42.9441106Z  auth = Auth.Token(github_token) 2025-09-07T07:00:42.9441745Z  return Github(auth=auth) 2025-09-07T07:00:42.9442261Z  2025-09-07T07:00:42.9442618Z  2025-09-07T07:00:42.9443344Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:00:42.9444215Z  repo = gh.get_repo(repo) 2025-09-07T07:00:42.9444812Z  return repo.get_issue(number=issue_num) 2025-09-07T07:00:42.9445392Z  2025-09-07T07:00:42.9445761Z  2025-09-07T07:00:42.9446165Z def get_potential_pr_author( 2025-09-07T07:00:42.9446903Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:00:42.9447638Z ) -> str: 2025-09-07T07:00:42.9448238Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:00:42.9449138Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:00:42.9450171Z  # embedded in the tag name: ciflow// 2025-09-07T07:00:42.9450805Z  2025-09-07T07:00:42.9451232Z  gh = get_gh_client(github_token) 2025-09-07T07:00:42.9451772Z  2025-09-07T07:00:42.9452286Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:00:42.9452975Z  split_tag = ref_name.split("/") 2025-09-07T07:00:42.9453531Z  if ( 2025-09-07T07:00:42.9453989Z  len(split_tag) == 3 2025-09-07T07:00:42.9454549Z  and split_tag[0] == "ciflow" 2025-09-07T07:00:42.9455142Z  and split_tag[2].isnumeric() 2025-09-07T07:00:42.9455691Z  ): 2025-09-07T07:00:42.9456153Z  pr_number = split_tag[2] 2025-09-07T07:00:42.9456703Z  try: 2025-09-07T07:00:42.9457225Z  repository = gh.get_repo(repo) 2025-09-07T07:00:42.9458056Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:00:42.9458743Z  except Exception as e: 2025-09-07T07:00:42.9459577Z  raise Exception( # noqa: TRY002 2025-09-07T07:00:42.9460354Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:00:42.9461063Z  ) from e 2025-09-07T07:00:42.9461704Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:00:42.9462486Z  # In all other cases, return the original input username 2025-09-07T07:00:42.9463141Z  return username 2025-09-07T07:00:42.9463609Z  2025-09-07T07:00:42.9463984Z  2025-09-07T07:00:42.9464451Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:00:42.9465038Z  """ 2025-09-07T07:00:42.9465771Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:00:42.9466618Z  """ 2025-09-07T07:00:42.9467236Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:00:42.9467952Z  2025-09-07T07:00:42.9468317Z  2025-09-07T07:00:42.9468738Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:00:42.9469290Z  try: 2025-09-07T07:00:42.9469913Z  data = yaml.safe_load(yaml_text) 2025-09-07T07:00:42.9470483Z  return data 2025-09-07T07:00:42.9470977Z  except yaml.YAMLError: 2025-09-07T07:00:42.9471549Z  log.exception("Error loading YAML") 2025-09-07T07:00:42.9472115Z  raise 2025-09-07T07:00:42.9472540Z  2025-09-07T07:00:42.9472904Z  2025-09-07T07:00:42.9473567Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:00:42.9474369Z  """ 2025-09-07T07:00:42.9475204Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:00:42.9476033Z  2025-09-07T07:00:42.9476619Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:00:42.9477463Z  and the text below is the list of opted in users. 2025-09-07T07:00:42.9478068Z  2025-09-07T07:00:42.9478689Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:00:42.9479658Z  """ 2025-09-07T07:00:42.9480191Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T07:00:42.9480854Z  if len(rollout_state_parts) >= 2: 2025-09-07T07:00:42.9481541Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:00:42.9482176Z  else: 2025-09-07T07:00:42.9482613Z  return "", rollout_state 2025-09-07T07:00:42.9483134Z  2025-09-07T07:00:42.9483667Z  2025-09-07T07:00:42.9484197Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:00:42.9484754Z  """ 2025-09-07T07:00:42.9485335Z  Dictionary of users with a list of features they have opted into 2025-09-07T07:00:42.9486033Z  """ 2025-09-07T07:00:42.9486421Z  2025-09-07T07:00:42.9486776Z  2025-09-07T07:00:42.9487354Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:00:42.9488055Z  """ 2025-09-07T07:00:42.9488838Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:00:42.9490276Z  2025-09-07T07:00:42.9491155Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:00:42.9492221Z  - Example line: "@User1,lf,split_build" 2025-09-07T07:00:42.9493133Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:00:42.9493814Z  2025-09-07T07:00:42.9494169Z  2025-09-07T07:00:42.9494531Z  """ 2025-09-07T07:00:42.9494944Z  optins = UserOptins() 2025-09-07T07:00:42.9495515Z  for user in user_optin_text.split("\n"): 2025-09-07T07:00:42.9496128Z  user = user.strip("\r\n\t -") 2025-09-07T07:00:42.9496745Z  if not user or not user.startswith("@"): 2025-09-07T07:00:42.9497364Z  # Not a valid user. Skip 2025-09-07T07:00:42.9497914Z  continue 2025-09-07T07:00:42.9498367Z  2025-09-07T07:00:42.9498735Z  if user: 2025-09-07T07:00:42.9499263Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T07:00:42.9500187Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:00:42.9500910Z  2025-09-07T07:00:42.9501302Z  return optins 2025-09-07T07:00:42.9501750Z  2025-09-07T07:00:42.9502111Z  2025-09-07T07:00:42.9502644Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:00:42.9503304Z  """ 2025-09-07T07:00:42.9503763Z  Check if the experiment name is valid. 2025-09-07T07:00:42.9504324Z  A valid name: 2025-09-07T07:00:42.9505047Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:00:42.9506065Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:00:42.9506835Z  - Cannot contain spaces 2025-09-07T07:00:42.9507346Z  """ 2025-09-07T07:00:42.9507734Z  2025-09-07T07:00:42.9508226Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:00:42.9509000Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:00:42.9509876Z  2025-09-07T07:00:42.9510262Z  if valid: 2025-09-07T07:00:42.9510712Z  return True 2025-09-07T07:00:42.9511155Z  2025-09-07T07:00:42.9511525Z  log.error( 2025-09-07T07:00:42.9513083Z  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-09-07T07:00:42.9514697Z  ) 2025-09-07T07:00:42.9515102Z  return False 2025-09-07T07:00:42.9515544Z  2025-09-07T07:00:42.9515901Z  2025-09-07T07:00:42.9516453Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:00:42.9517143Z  """ 2025-09-07T07:00:42.9517800Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:00:42.9518562Z  """ 2025-09-07T07:00:42.9518958Z  try: 2025-09-07T07:00:42.9519478Z  if settings_text: 2025-09-07T07:00:42.9520295Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:00:42.9521136Z  # for easy reading 2025-09-07T07:00:42.9522019Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:00:42.9522973Z  # the backtick character in shell commands. 2025-09-07T07:00:42.9523648Z  backtick = chr(96) # backtick character 2025-09-07T07:00:42.9524399Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:00:42.9525131Z  settings = load_yaml(settings_text) 2025-09-07T07:00:42.9525692Z  2025-09-07T07:00:42.9526338Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:00:42.9527279Z  experiments = {} 2025-09-07T07:00:42.9527778Z  2025-09-07T07:00:42.9528383Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:00:42.9529215Z  if not is_valid_experiment_name(exp_name): 2025-09-07T07:00:42.9530503Z  # 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-09-07T07:00:42.9531632Z  continue 2025-09-07T07:00:42.9532125Z  2025-09-07T07:00:42.9532532Z  valid_settings = {} 2025-09-07T07:00:42.9533115Z  for setting in exp_settings: 2025-09-07T07:00:42.9533738Z  if setting not in Experiment._fields: 2025-09-07T07:00:42.9534352Z  log.warning( 2025-09-07T07:00:42.9535147Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:00:42.9535914Z  ) 2025-09-07T07:00:42.9536404Z  else: 2025-09-07T07:00:42.9536993Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T07:00:42.9537636Z  2025-09-07T07:00:42.9538152Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:00:42.9538855Z  return Settings(experiments) 2025-09-07T07:00:42.9539480Z  2025-09-07T07:00:42.9539885Z  except Exception: 2025-09-07T07:00:42.9540455Z  log.exception("Failed to parse settings") 2025-09-07T07:00:42.9541035Z  2025-09-07T07:00:42.9541418Z  return Settings() 2025-09-07T07:00:42.9541908Z  2025-09-07T07:00:42.9542278Z  2025-09-07T07:00:42.9542894Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:00:42.9543532Z  """ 2025-09-07T07:00:42.9544029Z  Parse settings, if any, from the rollout state. 2025-09-07T07:00:42.9544640Z  2025-09-07T07:00:42.9545218Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:00:42.9546051Z  and the text below is the list of opted in users. 2025-09-07T07:00:42.9546653Z  2025-09-07T07:00:42.9547293Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:00:42.9548066Z  """ 2025-09-07T07:00:42.9548682Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:00:42.9549615Z  return parse_settings_from_text(settings_text) 2025-09-07T07:00:42.9550206Z  2025-09-07T07:00:42.9550563Z  2025-09-07T07:00:42.9551062Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:00:42.9551678Z  """ 2025-09-07T07:00:42.9552130Z  Parse users from the rollout state. 2025-09-07T07:00:42.9552679Z  2025-09-07T07:00:42.9553049Z  """ 2025-09-07T07:00:42.9553649Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:00:42.9554470Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T07:00:42.9555063Z  2025-09-07T07:00:42.9555423Z  2025-09-07T07:00:42.9556093Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:00:42.9556887Z  """ 2025-09-07T07:00:42.9557391Z  Check if a user is opted into an experiment 2025-09-07T07:00:42.9557963Z  """ 2025-09-07T07:00:42.9558491Z  return experiment_name in user_optins.get(user, []) 2025-09-07T07:00:42.9559109Z  2025-09-07T07:00:42.9559774Z  2025-09-07T07:00:42.9560469Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:00:42.9561282Z  """ 2025-09-07T07:00:42.9561811Z  Check if a user explicitly opted out of an experiment 2025-09-07T07:00:42.9562443Z  """ 2025-09-07T07:00:42.9563031Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:00:42.9563799Z  experiment_optout = "-" + experiment_name 2025-09-07T07:00:42.9564516Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:00:42.9565169Z  return False 2025-09-07T07:00:42.9565625Z  2025-09-07T07:00:42.9566130Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:00:42.9566779Z  log.warning( 2025-09-07T07:00:42.9567695Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:00:42.9568629Z  ) 2025-09-07T07:00:42.9569035Z  2025-09-07T07:00:42.9569512Z  return True 2025-09-07T07:00:42.9569955Z  2025-09-07T07:00:42.9570321Z  2025-09-07T07:00:42.9570711Z def get_runner_prefix( 2025-09-07T07:00:42.9571221Z  rollout_state: str, 2025-09-07T07:00:42.9571759Z  workflow_requestors: Iterable[str], 2025-09-07T07:00:42.9572327Z  branch: str, 2025-09-07T07:00:42.9572896Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:00:42.9573647Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:00:42.9574285Z  is_canary: bool = False, 2025-09-07T07:00:42.9574794Z ) -> str: 2025-09-07T07:00:42.9575287Z  settings = parse_settings(rollout_state) 2025-09-07T07:00:42.9575933Z  user_optins = parse_users(rollout_state) 2025-09-07T07:00:42.9576510Z  2025-09-07T07:00:42.9577016Z  fleet_prefix = "" 2025-09-07T07:00:42.9577520Z  prefixes = [] 2025-09-07T07:00:42.9578243Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:00:42.9579266Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:00:42.9580139Z  log.info( 2025-09-07T07:00:42.9580905Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:00:42.9581710Z  ) 2025-09-07T07:00:42.9582158Z  continue 2025-09-07T07:00:42.9582622Z  2025-09-07T07:00:42.9583029Z  if opt_out_experiments: 2025-09-07T07:00:42.9583637Z  if experiment_name in opt_out_experiments: 2025-09-07T07:00:42.9584364Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:00:42.9585001Z  log.info( 2025-09-07T07:00:42.9586038Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:00:42.9587075Z  ) 2025-09-07T07:00:42.9587546Z  continue 2025-09-07T07:00:42.9588063Z  2025-09-07T07:00:42.9588481Z  if eligible_experiments: 2025-09-07T07:00:42.9589122Z  if experiment_name not in eligible_experiments: 2025-09-07T07:00:42.9589919Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T07:00:42.9590529Z  log.info( 2025-09-07T07:00:42.9591397Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:00:42.9592291Z  ) 2025-09-07T07:00:42.9592877Z  continue 2025-09-07T07:00:42.9593430Z  elif not experiment_settings.default: 2025-09-07T07:00:42.9594007Z  log.info( 2025-09-07T07:00:42.9594750Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:00:42.9595533Z  ) 2025-09-07T07:00:42.9595970Z  continue 2025-09-07T07:00:42.9596419Z  2025-09-07T07:00:42.9596932Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:00:42.9597596Z  opted_out_users = [ 2025-09-07T07:00:42.9598111Z  requestor 2025-09-07T07:00:42.9598643Z  for requestor in workflow_requestors 2025-09-07T07:00:42.9599488Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:00:42.9600172Z  ] 2025-09-07T07:00:42.9600574Z  2025-09-07T07:00:42.9600973Z  if opted_out_users: 2025-09-07T07:00:42.9601496Z  log.info( 2025-09-07T07:00:42.9602209Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:00:42.9602950Z  ) 2025-09-07T07:00:42.9603390Z  continue 2025-09-07T07:00:42.9603840Z  2025-09-07T07:00:42.9604350Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:00:42.9605013Z  opted_in_users = [ 2025-09-07T07:00:42.9605543Z  requestor 2025-09-07T07:00:42.9606086Z  for requestor in workflow_requestors 2025-09-07T07:00:42.9606819Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:00:42.9607492Z  ] 2025-09-07T07:00:42.9607900Z  2025-09-07T07:00:42.9608286Z  enabled = False 2025-09-07T07:00:42.9608792Z  if opted_in_users: 2025-09-07T07:00:42.9609522Z  log.info( 2025-09-07T07:00:42.9610258Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:00:42.9610990Z  ) 2025-09-07T07:00:42.9611441Z  enabled = True 2025-09-07T07:00:42.9611934Z  2025-09-07T07:00:42.9612381Z  elif experiment_settings.rollout_perc: 2025-09-07T07:00:42.9613277Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:00:42.9614291Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:00:42.9615002Z  log.info( 2025-09-07T07:00:42.9615950Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:00:42.9616929Z  ) 2025-09-07T07:00:42.9617408Z  enabled = True 2025-09-07T07:00:42.9617937Z  2025-09-07T07:00:42.9618324Z  if enabled: 2025-09-07T07:00:42.9618822Z  label = experiment_name 2025-09-07T07:00:42.9619542Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:00:42.9620431Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:00:42.9621373Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T07:00:42.9622194Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:00:42.9622899Z  if is_canary: 2025-09-07T07:00:42.9623459Z  label += CANARY_FLEET_SUFFIX 2025-09-07T07:00:42.9624054Z  fleet_prefix = label 2025-09-07T07:00:42.9624592Z  else: 2025-09-07T07:00:42.9625223Z  prefixes.append(label) 2025-09-07T07:00:42.9625768Z  2025-09-07T07:00:42.9626154Z  if len(prefixes) > 1: 2025-09-07T07:00:42.9626663Z  log.error( 2025-09-07T07:00:42.9627806Z  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-09-07T07:00:42.9628967Z  ) 2025-09-07T07:00:42.9629518Z  prefixes = prefixes[:1] 2025-09-07T07:00:42.9630037Z  2025-09-07T07:00:42.9630442Z  # Fleet always comes first 2025-09-07T07:00:42.9630971Z  if fleet_prefix: 2025-09-07T07:00:42.9631495Z  prefixes.insert(0, fleet_prefix) 2025-09-07T07:00:42.9632039Z  2025-09-07T07:00:42.9632517Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:00:42.9633127Z  2025-09-07T07:00:42.9633498Z  2025-09-07T07:00:42.9634191Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:00:42.9635003Z  """ 2025-09-07T07:00:42.9635655Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:00:42.9636406Z  2025-09-07T07:00:42.9637026Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:00:42.9637787Z  """ 2025-09-07T07:00:42.9638234Z  gh = get_gh_client(github_token) 2025-09-07T07:00:42.9638843Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T07:00:42.9639874Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:00:42.9640569Z  2025-09-07T07:00:42.9640936Z  2025-09-07T07:00:42.9641613Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:00:42.9642596Z  for _ in range(num_retries): 2025-09-07T07:00:42.9643137Z  try: 2025-09-07T07:00:42.9643632Z  req = Request(url=url, headers=headers) 2025-09-07T07:00:42.9644349Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:00:42.9645056Z  return json.loads(content) 2025-09-07T07:00:42.9645636Z  except Exception as e: 2025-09-07T07:00:42.9646253Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T07:00:42.9646854Z  2025-09-07T07:00:42.9647486Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:00:42.9648256Z  return {} 2025-09-07T07:00:42.9648688Z  2025-09-07T07:00:42.9649053Z  2025-09-07T07:00:42.9649674Z @cache 2025-09-07T07:00:42.9650634Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:00:42.9651597Z  """ 2025-09-07T07:00:42.9652049Z  Dynamically get PR information 2025-09-07T07:00:42.9652591Z  """ 2025-09-07T07:00:42.9653159Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:00:42.9653840Z  headers = { 2025-09-07T07:00:42.9654372Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T07:00:42.9655042Z  "Authorization": f"token {github_token}", 2025-09-07T07:00:42.9655610Z  } 2025-09-07T07:00:42.9656097Z  json_response: dict[str, Any] = download_json( 2025-09-07T07:00:42.9656767Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:00:42.9657350Z  headers=headers, 2025-09-07T07:00:42.9657846Z  ) 2025-09-07T07:00:42.9658223Z  2025-09-07T07:00:42.9658618Z  if not json_response: 2025-09-07T07:00:42.9659269Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:00:42.9660260Z  return {} 2025-09-07T07:00:42.9660709Z  2025-09-07T07:00:42.9661103Z  return json_response 2025-09-07T07:00:42.9661604Z  2025-09-07T07:00:42.9661960Z  2025-09-07T07:00:42.9662596Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:00:42.9663365Z  """ 2025-09-07T07:00:42.9663971Z  Dynamically get the latest list of labels from the pull request 2025-09-07T07:00:42.9664680Z  """ 2025-09-07T07:00:42.9665224Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:00:42.9665887Z  return { 2025-09-07T07:00:42.9666537Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:00:42.9667271Z  } 2025-09-07T07:00:42.9667659Z  2025-09-07T07:00:42.9668040Z  2025-09-07T07:00:42.9668423Z def main() -> None: 2025-09-07T07:00:42.9668912Z  args = parse_args() 2025-09-07T07:00:42.9669521Z  2025-09-07T07:00:42.9669989Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:00:42.9670572Z  2025-09-07T07:00:42.9670971Z  # Check if the PR is opt-out 2025-09-07T07:00:42.9671512Z  if args.pr_number: 2025-09-07T07:00:42.9672244Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:00:42.9673048Z  if OPT_OUT_LABEL in labels: 2025-09-07T07:00:42.9673584Z  log.info( 2025-09-07T07:00:42.9674360Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:00:42.9675165Z  ) 2025-09-07T07:00:42.9675793Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:00:42.9676526Z  sys.exit() 2025-09-07T07:00:42.9677110Z  2025-09-07T07:00:42.9677491Z  try: 2025-09-07T07:00:42.9677995Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T07:00:42.9678770Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:00:42.9679555Z  ) 2025-09-07T07:00:42.9679964Z  2025-09-07T07:00:42.9680397Z  username = get_potential_pr_author( 2025-09-07T07:00:42.9680980Z  args.github_token, 2025-09-07T07:00:42.9681525Z  args.github_repo, 2025-09-07T07:00:42.9682062Z  args.github_actor, 2025-09-07T07:00:42.9682607Z  args.github_ref_type, 2025-09-07T07:00:42.9683147Z  args.github_branch, 2025-09-07T07:00:42.9683647Z  ) 2025-09-07T07:00:42.9684050Z  2025-09-07T07:00:42.9684565Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:00:42.9685227Z  2025-09-07T07:00:42.9685674Z  runner_label_prefix = get_runner_prefix( 2025-09-07T07:00:42.9686264Z  rollout_state, 2025-09-07T07:00:42.9686820Z  (args.github_issue_owner, username), 2025-09-07T07:00:42.9687406Z  args.github_branch, 2025-09-07T07:00:42.9687977Z  args.eligible_experiments, 2025-09-07T07:00:42.9688568Z  args.opt_out_experiments, 2025-09-07T07:00:42.9689121Z  is_canary, 2025-09-07T07:00:42.9689688Z  ) 2025-09-07T07:00:42.9690095Z  2025-09-07T07:00:42.9690488Z  except Exception as e: 2025-09-07T07:00:42.9690997Z  log.error( 2025-09-07T07:00:42.9691761Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:00:42.9692566Z  ) 2025-09-07T07:00:42.9693104Z  2025-09-07T07:00:42.9693707Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:00:42.9694409Z  2025-09-07T07:00:42.9694768Z  2025-09-07T07:00:42.9695162Z if __name__ == "__main__": 2025-09-07T07:00:42.9695662Z  main() 2025-09-07T07:00:42.9696074Z  2025-09-07T07:00:42.9696435Z EOF 2025-09-07T07:00:42.9696814Z  2025-09-07T07:00:42.9697229Z cat runner_determinator.py 2025-09-07T07:00:42.9913846Z shell: /usr/bin/bash -e {0} 2025-09-07T07:00:42.9914654Z env: 2025-09-07T07:00:42.9915429Z GITHUB_TOKEN: *** 2025-09-07T07:00:42.9915865Z ISSUE_NUMBER: 5132 2025-09-07T07:00:42.9916328Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:00:42.9916840Z ISSUE_OWNER: 2025-09-07T07:00:42.9917250Z CHECK_EXPERIMENTS: 2025-09-07T07:00:42.9917694Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:00:42.9918148Z PR_NUMBER: 2025-09-07T07:00:42.9918559Z ##[endgroup] 2025-09-07T07:00:43.0123529Z # flake8: noqa: G004 2025-09-07T07:00:43.0123871Z 2025-09-07T07:00:43.0124312Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:00:43.0125296Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:00:43.0126092Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:00:43.0126545Z 2025-09-07T07:00:43.0126700Z """ 2025-09-07T07:00:43.0127272Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:00:43.0128139Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:00:43.0129053Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:00:43.0130248Z of which runners should be used to run which job. 2025-09-07T07:00:43.0130674Z 2025-09-07T07:00:43.0131066Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:00:43.0132179Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:00:43.0133077Z settings are considered to be empty with only the second part, the user 2025-09-07T07:00:43.0133786Z list, defined. 2025-09-07T07:00:43.0134013Z 2025-09-07T07:00:43.0134378Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:00:43.0135321Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:00:43.0136149Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:00:43.0136603Z 2025-09-07T07:00:43.0136971Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:00:43.0137838Z The user list is also a comma separated list of additional features or 2025-09-07T07:00:43.0138584Z experiments which the user could be opted in to. 2025-09-07T07:00:43.0138988Z 2025-09-07T07:00:43.0139194Z The user list has the following rules: 2025-09-07T07:00:43.0139747Z 2025-09-07T07:00:43.0140083Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:00:43.0140956Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:00:43.0141713Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:00:43.0142118Z 2025-09-07T07:00:43.0142282Z Example config: 2025-09-07T07:00:43.0142730Z # A list of experiments that can be opted into. 2025-09-07T07:00:43.0143397Z # This defines the behavior they'll induce when opted into. 2025-09-07T07:00:43.0144036Z # Expected syntax is: 2025-09-07T07:00:43.0144690Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:00:43.0145691Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:00:43.0146311Z 2025-09-07T07:00:43.0146487Z experiments: 2025-09-07T07:00:43.0146885Z lf: 2025-09-07T07:00:43.0147270Z rollout_percent: 25 2025-09-07T07:00:43.0147893Z all_branches: false 2025-09-07T07:00:43.0148355Z default: true 2025-09-07T07:00:43.0148762Z --- 2025-09-07T07:00:43.0148967Z 2025-09-07T07:00:43.0149134Z # Opt-ins: 2025-09-07T07:00:43.0149917Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:00:43.0150800Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:00:43.0151593Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:00:43.0152258Z # Experiments should be from the above list. 2025-09-07T07:00:43.0152648Z 2025-09-07T07:00:43.0152836Z @User1,-lf,split_build 2025-09-07T07:00:43.0153274Z @User2,lf 2025-09-07T07:00:43.0153663Z @User3,split_build 2025-09-07T07:00:43.0154071Z """ 2025-09-07T07:00:43.0154271Z 2025-09-07T07:00:43.0154431Z import json 2025-09-07T07:00:43.0154798Z import logging 2025-09-07T07:00:43.0155180Z import os 2025-09-07T07:00:43.0155538Z import random 2025-09-07T07:00:43.0155913Z import re 2025-09-07T07:00:43.0156283Z import sys 2025-09-07T07:00:43.0156691Z from argparse import ArgumentParser 2025-09-07T07:00:43.0157228Z from collections.abc import Iterable 2025-09-07T07:00:43.0157750Z from functools import cache 2025-09-07T07:00:43.0158227Z from logging import LogRecord 2025-09-07T07:00:43.0158712Z from typing import Any, NamedTuple 2025-09-07T07:00:43.0159255Z from urllib.request import Request, urlopen 2025-09-07T07:00:43.0159912Z 2025-09-07T07:00:43.0160083Z import yaml 2025-09-07T07:00:43.0160489Z from github import Auth, Github 2025-09-07T07:00:43.0160977Z from github.Issue import Issue 2025-09-07T07:00:43.0161286Z 2025-09-07T07:00:43.0161293Z 2025-09-07T07:00:43.0161509Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:00:43.0162203Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:00:43.0163082Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:00:43.0163666Z 2025-09-07T07:00:43.0163894Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:00:43.0164682Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:00:43.0165217Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:00:43.0165778Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:00:43.0166144Z 2025-09-07T07:00:43.0166338Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:00:43.0166672Z 2025-09-07T07:00:43.0166862Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:00:43.0167328Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:00:43.0167614Z 2025-09-07T07:00:43.0167627Z 2025-09-07T07:00:43.0167820Z class Experiment(NamedTuple): 2025-09-07T07:00:43.0168293Z rollout_perc: float = ( 2025-09-07T07:00:43.0168944Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:00:43.0169849Z ) 2025-09-07T07:00:43.0170246Z all_branches: bool = ( 2025-09-07T07:00:43.0170882Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:00:43.0171562Z ) 2025-09-07T07:00:43.0171931Z default: bool = ( 2025-09-07T07:00:43.0172522Z True # If True, the experiment is enabled by default for all queries 2025-09-07T07:00:43.0173175Z ) 2025-09-07T07:00:43.0173372Z 2025-09-07T07:00:43.0173550Z # Add more fields as needed 2025-09-07T07:00:43.0173856Z 2025-09-07T07:00:43.0173863Z 2025-09-07T07:00:43.0174046Z class Settings(NamedTuple): 2025-09-07T07:00:43.0174502Z """ 2025-09-07T07:00:43.0174951Z Settings for the experiments that can be opted into. 2025-09-07T07:00:43.0175539Z """ 2025-09-07T07:00:43.0175736Z 2025-09-07T07:00:43.0175946Z experiments: dict[str, Experiment] = {} 2025-09-07T07:00:43.0176313Z 2025-09-07T07:00:43.0176325Z 2025-09-07T07:00:43.0176529Z class ColorFormatter(logging.Formatter): 2025-09-07T07:00:43.0177150Z """Color codes the log messages based on the log level""" 2025-09-07T07:00:43.0177591Z 2025-09-07T07:00:43.0177753Z COLORS = { 2025-09-07T07:00:43.0178149Z "WARNING": "\033[33m", # Yellow 2025-09-07T07:00:43.0178803Z "ERROR": "\033[31m", # Red 2025-09-07T07:00:43.0179454Z "CRITICAL": "\033[31m", # Red 2025-09-07T07:00:43.0179999Z "INFO": "\033[0m", # Reset 2025-09-07T07:00:43.0180492Z "DEBUG": "\033[0m", # Reset 2025-09-07T07:00:43.0180968Z } 2025-09-07T07:00:43.0181168Z 2025-09-07T07:00:43.0181388Z def format(self, record: LogRecord) -> str: 2025-09-07T07:00:43.0182148Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:00:43.0182934Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:00:43.0183521Z return super().format(record) 2025-09-07T07:00:43.0183857Z 2025-09-07T07:00:43.0183863Z 2025-09-07T07:00:43.0184059Z handler = logging.StreamHandler() 2025-09-07T07:00:43.0184777Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:00:43.0185342Z 2025-09-07T07:00:43.0185586Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:00:43.0186182Z log.addHandler(handler) 2025-09-07T07:00:43.0186631Z log.setLevel(logging.INFO) 2025-09-07T07:00:43.0186924Z 2025-09-07T07:00:43.0186930Z 2025-09-07T07:00:43.0187178Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:00:43.0187746Z """ 2025-09-07T07:00:43.0188247Z Defines outputs of the github action that invokes this script 2025-09-07T07:00:43.0188880Z """ 2025-09-07T07:00:43.0189244Z if not GITHUB_OUTPUT: 2025-09-07T07:00:43.0190538Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:00:43.0191674Z log.warning( 2025-09-07T07:00:43.0192536Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:00:43.0193474Z ) 2025-09-07T07:00:43.0203575Z print(f"::set-output name={key}::{value}") 2025-09-07T07:00:43.0204225Z return 2025-09-07T07:00:43.0204466Z 2025-09-07T07:00:43.0204873Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:00:43.0205500Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:00:43.0206078Z f.write(f"{key}={value}\n") 2025-09-07T07:00:43.0206419Z 2025-09-07T07:00:43.0206426Z 2025-09-07T07:00:43.0206731Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:00:43.0207370Z return frozenset( 2025-09-07T07:00:43.0207983Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:00:43.0208690Z ) 2025-09-07T07:00:43.0208890Z 2025-09-07T07:00:43.0208898Z 2025-09-07T07:00:43.0209079Z def parse_args() -> Any: 2025-09-07T07:00:43.0209899Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:00:43.0210787Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:00:43.0211573Z parser.add_argument( 2025-09-07T07:00:43.0212040Z "--github-issue-repo", 2025-09-07T07:00:43.0212512Z type=str, 2025-09-07T07:00:43.0212917Z required=False, 2025-09-07T07:00:43.0213371Z default="pytorch/test-infra", 2025-09-07T07:00:43.0213916Z help="GitHub repo to get the issue", 2025-09-07T07:00:43.0214429Z ) 2025-09-07T07:00:43.0214803Z parser.add_argument( 2025-09-07T07:00:43.0215248Z "--github-repo", 2025-09-07T07:00:43.0215677Z type=str, 2025-09-07T07:00:43.0216076Z required=True, 2025-09-07T07:00:43.0216554Z help="GitHub repo where CI is running", 2025-09-07T07:00:43.0217081Z ) 2025-09-07T07:00:43.0217461Z parser.add_argument( 2025-09-07T07:00:43.0218071Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:00:43.0218779Z ) 2025-09-07T07:00:43.0219149Z parser.add_argument( 2025-09-07T07:00:43.0219951Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:00:43.0220649Z ) 2025-09-07T07:00:43.0221023Z parser.add_argument( 2025-09-07T07:00:43.0221830Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:00:43.0222530Z ) 2025-09-07T07:00:43.0222907Z parser.add_argument( 2025-09-07T07:00:43.0223560Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:00:43.0224286Z ) 2025-09-07T07:00:43.0224651Z parser.add_argument( 2025-09-07T07:00:43.0225096Z "--github-ref-type", 2025-09-07T07:00:43.0225548Z type=str, 2025-09-07T07:00:43.0225949Z required=True, 2025-09-07T07:00:43.0226447Z help="Current GitHub ref type, branch or tag", 2025-09-07T07:00:43.0226994Z ) 2025-09-07T07:00:43.0227368Z parser.add_argument( 2025-09-07T07:00:43.0227827Z "--eligible-experiments", 2025-09-07T07:00:43.0228355Z type=_str_comma_separated_to_set, 2025-09-07T07:00:43.0228875Z required=False, 2025-09-07T07:00:43.0229296Z default="", 2025-09-07T07:00:43.0230366Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:00:43.0231314Z ) 2025-09-07T07:00:43.0231684Z parser.add_argument( 2025-09-07T07:00:43.0232138Z "--opt-out-experiments", 2025-09-07T07:00:43.0232643Z type=_str_comma_separated_to_set, 2025-09-07T07:00:43.0233161Z required=False, 2025-09-07T07:00:43.0233584Z default="", 2025-09-07T07:00:43.0233969Z help=( 2025-09-07T07:00:43.0234633Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:00:43.0235778Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:00:43.0236618Z ), 2025-09-07T07:00:43.0236988Z ) 2025-09-07T07:00:43.0285561Z parser.add_argument( 2025-09-07T07:00:43.0286223Z "--pr-number", 2025-09-07T07:00:43.0286716Z type=str, 2025-09-07T07:00:43.0287130Z required=False, 2025-09-07T07:00:43.0287571Z default="", 2025-09-07T07:00:43.0288232Z help="the optional PR number where this is run", 2025-09-07T07:00:43.0288803Z ) 2025-09-07T07:00:43.0289010Z 2025-09-07T07:00:43.0289207Z return parser.parse_args() 2025-09-07T07:00:43.0289673Z 2025-09-07T07:00:43.0289680Z 2025-09-07T07:00:43.0290103Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:00:43.0290873Z auth = Auth.Token(github_token) 2025-09-07T07:00:43.0291379Z return Github(auth=auth) 2025-09-07T07:00:43.0291675Z 2025-09-07T07:00:43.0291681Z 2025-09-07T07:00:43.0292140Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:00:43.0292938Z repo = gh.get_repo(repo) 2025-09-07T07:00:43.0293430Z return repo.get_issue(number=issue_num) 2025-09-07T07:00:43.0293799Z 2025-09-07T07:00:43.0293806Z 2025-09-07T07:00:43.0293989Z def get_potential_pr_author( 2025-09-07T07:00:43.0294632Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:00:43.0295308Z ) -> str: 2025-09-07T07:00:43.0295821Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:00:43.0296616Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:00:43.0297359Z # embedded in the tag name: ciflow// 2025-09-07T07:00:43.0297775Z 2025-09-07T07:00:43.0297966Z gh = get_gh_client(github_token) 2025-09-07T07:00:43.0298301Z 2025-09-07T07:00:43.0298568Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:00:43.0299200Z split_tag = ref_name.split("/") 2025-09-07T07:00:43.0299825Z if ( 2025-09-07T07:00:43.0300215Z len(split_tag) == 3 2025-09-07T07:00:43.0300687Z and split_tag[0] == "ciflow" 2025-09-07T07:00:43.0301214Z and split_tag[2].isnumeric() 2025-09-07T07:00:43.0301703Z ): 2025-09-07T07:00:43.0302086Z pr_number = split_tag[2] 2025-09-07T07:00:43.0302709Z try: 2025-09-07T07:00:43.0303144Z repository = gh.get_repo(repo) 2025-09-07T07:00:43.0303765Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:00:43.0304369Z except Exception as e: 2025-09-07T07:00:43.0304890Z raise Exception( # noqa: TRY002 2025-09-07T07:00:43.0305552Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:00:43.0306202Z ) from e 2025-09-07T07:00:43.0306732Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:00:43.0307429Z # In all other cases, return the original input username 2025-09-07T07:00:43.0308013Z return username 2025-09-07T07:00:43.0308252Z 2025-09-07T07:00:43.0308259Z 2025-09-07T07:00:43.0308482Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:00:43.0309021Z """ 2025-09-07T07:00:43.0309776Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:00:43.0310570Z """ 2025-09-07T07:00:43.0311118Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:00:43.0311653Z 2025-09-07T07:00:43.0311659Z 2025-09-07T07:00:43.0311849Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:00:43.0312338Z try: 2025-09-07T07:00:43.0312722Z data = yaml.safe_load(yaml_text) 2025-09-07T07:00:43.0313229Z return data 2025-09-07T07:00:43.0313637Z except yaml.YAMLError: 2025-09-07T07:00:43.0314116Z log.exception("Error loading YAML") 2025-09-07T07:00:43.0314619Z raise 2025-09-07T07:00:43.0314841Z 2025-09-07T07:00:43.0314847Z 2025-09-07T07:00:43.0315258Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:00:43.0315993Z """ 2025-09-07T07:00:43.0316619Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:00:43.0317230Z 2025-09-07T07:00:43.0317709Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:00:43.0318522Z and the text below is the list of opted in users. 2025-09-07T07:00:43.0318933Z 2025-09-07T07:00:43.0319308Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:00:43.0320111Z """ 2025-09-07T07:00:43.0320553Z rollout_state_parts = rollout_state.split("---") 2025-09-07T07:00:43.0321157Z if len(rollout_state_parts) >= 2: 2025-09-07T07:00:43.0321771Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:00:43.0322356Z else: 2025-09-07T07:00:43.0322732Z return "", rollout_state 2025-09-07T07:00:43.0323042Z 2025-09-07T07:00:43.0323048Z 2025-09-07T07:00:43.0323254Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:00:43.0323758Z """ 2025-09-07T07:00:43.0324271Z Dictionary of users with a list of features they have opted into 2025-09-07T07:00:43.0324921Z """ 2025-09-07T07:00:43.0325125Z 2025-09-07T07:00:43.0325131Z 2025-09-07T07:00:43.0325471Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:00:43.0326128Z """ 2025-09-07T07:00:43.0326853Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:00:43.0327542Z 2025-09-07T07:00:43.0328166Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:00:43.0329156Z - Example line: "@User1,lf,split_build" 2025-09-07T07:00:43.0329938Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:00:43.0330421Z 2025-09-07T07:00:43.0330427Z 2025-09-07T07:00:43.0330589Z """ 2025-09-07T07:00:43.0330953Z optins = UserOptins() 2025-09-07T07:00:43.0331437Z for user in user_optin_text.split("\n"): 2025-09-07T07:00:43.0331985Z user = user.strip("\r\n\t -") 2025-09-07T07:00:43.0332522Z if not user or not user.startswith("@"): 2025-09-07T07:00:43.0333215Z # Not a valid user. Skip 2025-09-07T07:00:43.0333725Z continue 2025-09-07T07:00:43.0333966Z 2025-09-07T07:00:43.0334121Z if user: 2025-09-07T07:00:43.0334559Z usr_name = user.split(",")[0].strip("@") 2025-09-07T07:00:43.0335255Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:00:43.0335750Z 2025-09-07T07:00:43.0335916Z return optins 2025-09-07T07:00:43.0336152Z 2025-09-07T07:00:43.0336165Z 2025-09-07T07:00:43.0336447Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:00:43.0337039Z """ 2025-09-07T07:00:43.0337434Z Check if the experiment name is valid. 2025-09-07T07:00:43.0337947Z A valid name: 2025-09-07T07:00:43.0338581Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:00:43.0339958Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:00:43.0340728Z - Cannot contain spaces 2025-09-07T07:00:43.0341191Z """ 2025-09-07T07:00:43.0341389Z 2025-09-07T07:00:43.0341648Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:00:43.0342356Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:00:43.0342802Z 2025-09-07T07:00:43.0342958Z if valid: 2025-09-07T07:00:43.0343336Z return True 2025-09-07T07:00:43.0343568Z 2025-09-07T07:00:43.0343733Z log.error( 2025-09-07T07:00:43.0345205Z 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-09-07T07:00:43.0346763Z ) 2025-09-07T07:00:43.0347113Z return False 2025-09-07T07:00:43.0347349Z 2025-09-07T07:00:43.0347356Z 2025-09-07T07:00:43.0347659Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:00:43.0348275Z """ 2025-09-07T07:00:43.0349004Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:00:43.0349863Z """ 2025-09-07T07:00:43.0350212Z try: 2025-09-07T07:00:43.0350578Z if settings_text: 2025-09-07T07:00:43.0351310Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:00:43.0352104Z # for easy reading 2025-09-07T07:00:43.0352893Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:00:43.0353788Z # the backtick character in shell commands. 2025-09-07T07:00:43.0354391Z backtick = chr(96) # backtick character 2025-09-07T07:00:43.0355047Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:00:43.0355710Z settings = load_yaml(settings_text) 2025-09-07T07:00:43.0356077Z 2025-09-07T07:00:43.0356491Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:00:43.0357259Z experiments = {} 2025-09-07T07:00:43.0357561Z 2025-09-07T07:00:43.0357949Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:00:43.0358713Z if not is_valid_experiment_name(exp_name): 2025-09-07T07:00:43.0359941Z # 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-09-07T07:00:43.0360994Z continue 2025-09-07T07:00:43.0361287Z 2025-09-07T07:00:43.0361464Z valid_settings = {} 2025-09-07T07:00:43.0361979Z for setting in exp_settings: 2025-09-07T07:00:43.0362547Z if setting not in Experiment._fields: 2025-09-07T07:00:43.0363094Z log.warning( 2025-09-07T07:00:43.0363802Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:00:43.0364667Z ) 2025-09-07T07:00:43.0365093Z else: 2025-09-07T07:00:43.0365602Z valid_settings[setting] = exp_settings[setting] 2025-09-07T07:00:43.0366027Z 2025-09-07T07:00:43.0366296Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:00:43.0366924Z return Settings(experiments) 2025-09-07T07:00:43.0367278Z 2025-09-07T07:00:43.0367450Z except Exception: 2025-09-07T07:00:43.0367922Z log.exception("Failed to parse settings") 2025-09-07T07:00:43.0368309Z 2025-09-07T07:00:43.0368482Z return Settings() 2025-09-07T07:00:43.0368733Z 2025-09-07T07:00:43.0368739Z 2025-09-07T07:00:43.0368986Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:00:43.0369668Z """ 2025-09-07T07:00:43.0370085Z Parse settings, if any, from the rollout state. 2025-09-07T07:00:43.0370503Z 2025-09-07T07:00:43.0370858Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:00:43.0371625Z and the text below is the list of opted in users. 2025-09-07T07:00:43.0372029Z 2025-09-07T07:00:43.0372437Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:00:43.0373198Z """ 2025-09-07T07:00:43.0373741Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:00:43.0374505Z return parse_settings_from_text(settings_text) 2025-09-07T07:00:43.0374902Z 2025-09-07T07:00:43.0374908Z 2025-09-07T07:00:43.0375148Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:00:43.0375711Z """ 2025-09-07T07:00:43.0376091Z Parse users from the rollout state. 2025-09-07T07:00:43.0376447Z 2025-09-07T07:00:43.0376603Z """ 2025-09-07T07:00:43.0377136Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:00:43.0377870Z return parse_user_opt_in_from_text(users_text) 2025-09-07T07:00:43.0378289Z 2025-09-07T07:00:43.0378296Z 2025-09-07T07:00:43.0378874Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:00:43.0379748Z """ 2025-09-07T07:00:43.0380166Z Check if a user is opted into an experiment 2025-09-07T07:00:43.0380704Z """ 2025-09-07T07:00:43.0381147Z return experiment_name in user_optins.get(user, []) 2025-09-07T07:00:43.0381570Z 2025-09-07T07:00:43.0381577Z 2025-09-07T07:00:43.0382007Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:00:43.0382754Z """ 2025-09-07T07:00:43.0383209Z Check if a user explicitly opted out of an experiment 2025-09-07T07:00:43.0383784Z """ 2025-09-07T07:00:43.0384280Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:00:43.0384967Z experiment_optout = "-" + experiment_name 2025-09-07T07:00:43.0385604Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:00:43.0386205Z return False 2025-09-07T07:00:43.0386466Z 2025-09-07T07:00:43.0386749Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:00:43.0387358Z log.warning( 2025-09-07T07:00:43.0388162Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:00:43.0389052Z ) 2025-09-07T07:00:43.0389254Z 2025-09-07T07:00:43.0389524Z return True 2025-09-07T07:00:43.0389761Z 2025-09-07T07:00:43.0389767Z 2025-09-07T07:00:43.0389946Z def get_runner_prefix( 2025-09-07T07:00:43.0390385Z rollout_state: str, 2025-09-07T07:00:43.0390837Z workflow_requestors: Iterable[str], 2025-09-07T07:00:43.0391350Z branch: str, 2025-09-07T07:00:43.0391826Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:00:43.0392494Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:00:43.0393073Z is_canary: bool = False, 2025-09-07T07:00:43.0393525Z ) -> str: 2025-09-07T07:00:43.0394101Z settings = parse_settings(rollout_state) 2025-09-07T07:00:43.0394682Z user_optins = parse_users(rollout_state) 2025-09-07T07:00:43.0395051Z 2025-09-07T07:00:43.0395227Z fleet_prefix = "" 2025-09-07T07:00:43.0395640Z prefixes = [] 2025-09-07T07:00:43.0396259Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:00:43.0397198Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:00:43.0397915Z log.info( 2025-09-07T07:00:43.0398591Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:00:43.0399462Z ) 2025-09-07T07:00:43.0399840Z continue 2025-09-07T07:00:43.0400086Z 2025-09-07T07:00:43.0400272Z if opt_out_experiments: 2025-09-07T07:00:43.0400809Z if experiment_name in opt_out_experiments: 2025-09-07T07:00:43.0401455Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:00:43.0402046Z log.info( 2025-09-07T07:00:43.0402972Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:00:43.0403955Z ) 2025-09-07T07:00:43.0404347Z continue 2025-09-07T07:00:43.0404615Z 2025-09-07T07:00:43.0404801Z if eligible_experiments: 2025-09-07T07:00:43.0405355Z if experiment_name not in eligible_experiments: 2025-09-07T07:00:43.0405980Z exp_list = ", ".join(eligible_experiments) 2025-09-07T07:00:43.0406543Z log.info( 2025-09-07T07:00:43.0407320Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:00:43.0408165Z ) 2025-09-07T07:00:43.0408553Z continue 2025-09-07T07:00:43.0409024Z elif not experiment_settings.default: 2025-09-07T07:00:43.0409669Z log.info( 2025-09-07T07:00:43.0410451Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:00:43.0411206Z ) 2025-09-07T07:00:43.0411571Z continue 2025-09-07T07:00:43.0411579Z 2025-09-07T07:00:43.0411858Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:00:43.0412034Z opted_out_users = [ 2025-09-07T07:00:43.0412197Z requestor 2025-09-07T07:00:43.0412400Z for requestor in workflow_requestors 2025-09-07T07:00:43.0412703Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:00:43.0412861Z ] 2025-09-07T07:00:43.0412869Z 2025-09-07T07:00:43.0413047Z if opted_out_users: 2025-09-07T07:00:43.0413215Z log.info( 2025-09-07T07:00:43.0413588Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:00:43.0413744Z ) 2025-09-07T07:00:43.0413909Z continue 2025-09-07T07:00:43.0413920Z 2025-09-07T07:00:43.0414196Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:00:43.0414372Z opted_in_users = [ 2025-09-07T07:00:43.0414536Z requestor 2025-09-07T07:00:43.0414745Z for requestor in workflow_requestors 2025-09-07T07:00:43.0415037Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:00:43.0415194Z ] 2025-09-07T07:00:43.0415201Z 2025-09-07T07:00:43.0415373Z enabled = False 2025-09-07T07:00:43.0415547Z if opted_in_users: 2025-09-07T07:00:43.0415713Z log.info( 2025-09-07T07:00:43.0416071Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:00:43.0416230Z ) 2025-09-07T07:00:43.0416401Z enabled = True 2025-09-07T07:00:43.0416408Z 2025-09-07T07:00:43.0416618Z elif experiment_settings.rollout_perc: 2025-09-07T07:00:43.0417079Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:00:43.0417509Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:00:43.0417680Z log.info( 2025-09-07T07:00:43.0418279Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:00:43.0418470Z ) 2025-09-07T07:00:43.0418642Z enabled = True 2025-09-07T07:00:43.0418649Z 2025-09-07T07:00:43.0418815Z if enabled: 2025-09-07T07:00:43.0418997Z label = experiment_name 2025-09-07T07:00:43.0419214Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:00:43.0419756Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:00:43.0420032Z # - If it's enabled, then we always list it's prefix first 2025-09-07T07:00:43.0420348Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:00:43.0420524Z if is_canary: 2025-09-07T07:00:43.0420722Z label += CANARY_FLEET_SUFFIX 2025-09-07T07:00:43.0420904Z fleet_prefix = label 2025-09-07T07:00:43.0421059Z else: 2025-09-07T07:00:43.0421252Z prefixes.append(label) 2025-09-07T07:00:43.0421260Z 2025-09-07T07:00:43.0421435Z if len(prefixes) > 1: 2025-09-07T07:00:43.0421599Z log.error( 2025-09-07T07:00:43.0422419Z 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-09-07T07:00:43.0422576Z ) 2025-09-07T07:00:43.0422761Z prefixes = prefixes[:1] 2025-09-07T07:00:43.0422768Z 2025-09-07T07:00:43.0422949Z # Fleet always comes first 2025-09-07T07:00:43.0423122Z if fleet_prefix: 2025-09-07T07:00:43.0423324Z prefixes.insert(0, fleet_prefix) 2025-09-07T07:00:43.0423337Z 2025-09-07T07:00:43.0423702Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:00:43.0423711Z 2025-09-07T07:00:43.0423717Z 2025-09-07T07:00:43.0424173Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:00:43.0424330Z """ 2025-09-07T07:00:43.0424718Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:00:43.0424728Z 2025-09-07T07:00:43.0425113Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:00:43.0425270Z """ 2025-09-07T07:00:43.0425457Z gh = get_gh_client(github_token) 2025-09-07T07:00:43.0425662Z issue = get_issue(gh, repo, issue_num) 2025-09-07T07:00:43.0425934Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:00:43.0425941Z 2025-09-07T07:00:43.0425947Z 2025-09-07T07:00:43.0426344Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:00:43.0426532Z for _ in range(num_retries): 2025-09-07T07:00:43.0426696Z try: 2025-09-07T07:00:43.0426910Z req = Request(url=url, headers=headers) 2025-09-07T07:00:43.0427198Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:00:43.0427394Z return json.loads(content) 2025-09-07T07:00:43.0427577Z except Exception as e: 2025-09-07T07:00:43.0427811Z log.warning(f"Could not download {url}: {e}") 2025-09-07T07:00:43.0427819Z 2025-09-07T07:00:43.0428200Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:00:43.0428364Z return {} 2025-09-07T07:00:43.0428372Z 2025-09-07T07:00:43.0428378Z 2025-09-07T07:00:43.0428530Z @cache 2025-09-07T07:00:43.0428960Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:00:43.0429118Z """ 2025-09-07T07:00:43.0429309Z Dynamically get PR information 2025-09-07T07:00:43.0429576Z """ 2025-09-07T07:00:43.0430024Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:00:43.0430191Z headers = { 2025-09-07T07:00:43.0430417Z "Accept": "application/vnd.github.v3+json", 2025-09-07T07:00:43.0430634Z "Authorization": f"token {github_token}", 2025-09-07T07:00:43.0430789Z } 2025-09-07T07:00:43.0431020Z json_response: dict[str, Any] = download_json( 2025-09-07T07:00:43.0431233Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:00:43.0431409Z headers=headers, 2025-09-07T07:00:43.0431561Z ) 2025-09-07T07:00:43.0431569Z 2025-09-07T07:00:43.0431743Z if not json_response: 2025-09-07T07:00:43.0432040Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:00:43.0432202Z return {} 2025-09-07T07:00:43.0432210Z 2025-09-07T07:00:43.0432385Z return json_response 2025-09-07T07:00:43.0432393Z 2025-09-07T07:00:43.0432399Z 2025-09-07T07:00:43.0432803Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:00:43.0432972Z """ 2025-09-07T07:00:43.0433296Z Dynamically get the latest list of labels from the pull request 2025-09-07T07:00:43.0433454Z """ 2025-09-07T07:00:43.0433732Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:00:43.0433893Z return { 2025-09-07T07:00:43.0434254Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:00:43.0434410Z } 2025-09-07T07:00:43.0434418Z 2025-09-07T07:00:43.0434424Z 2025-09-07T07:00:43.0434591Z def main() -> None: 2025-09-07T07:00:43.0434764Z args = parse_args() 2025-09-07T07:00:43.0434772Z 2025-09-07T07:00:43.0434995Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:00:43.0435003Z 2025-09-07T07:00:43.0435190Z # Check if the PR is opt-out 2025-09-07T07:00:43.0435360Z if args.pr_number: 2025-09-07T07:00:43.0435758Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:00:43.0436065Z if OPT_OUT_LABEL in labels: 2025-09-07T07:00:43.0436236Z log.info( 2025-09-07T07:00:43.0436685Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:00:43.0436851Z ) 2025-09-07T07:00:43.0437179Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:00:43.0437346Z sys.exit() 2025-09-07T07:00:43.0437354Z 2025-09-07T07:00:43.0437516Z try: 2025-09-07T07:00:43.0437748Z rollout_state = get_rollout_state_from_issue( 2025-09-07T07:00:43.0438056Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:00:43.0438218Z ) 2025-09-07T07:00:43.0438225Z 2025-09-07T07:00:43.0438426Z username = get_potential_pr_author( 2025-09-07T07:00:43.0438603Z args.github_token, 2025-09-07T07:00:43.0438783Z args.github_repo, 2025-09-07T07:00:43.0438963Z args.github_actor, 2025-09-07T07:00:43.0439147Z args.github_ref_type, 2025-09-07T07:00:43.0439439Z args.github_branch, 2025-09-07T07:00:43.0439602Z ) 2025-09-07T07:00:43.0439610Z 2025-09-07T07:00:43.0439888Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:00:43.0439895Z 2025-09-07T07:00:43.0440106Z runner_label_prefix = get_runner_prefix( 2025-09-07T07:00:43.0440280Z rollout_state, 2025-09-07T07:00:43.0440482Z (args.github_issue_owner, username), 2025-09-07T07:00:43.0440652Z args.github_branch, 2025-09-07T07:00:43.0440842Z args.eligible_experiments, 2025-09-07T07:00:43.0441036Z args.opt_out_experiments, 2025-09-07T07:00:43.0441202Z is_canary, 2025-09-07T07:00:43.0441358Z ) 2025-09-07T07:00:43.0441366Z 2025-09-07T07:00:43.0441549Z except Exception as e: 2025-09-07T07:00:43.0441712Z log.error( 2025-09-07T07:00:43.0442143Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:00:43.0442428Z ) 2025-09-07T07:00:43.0442441Z 2025-09-07T07:00:43.0442769Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:00:43.0442777Z 2025-09-07T07:00:43.0442784Z 2025-09-07T07:00:43.0442958Z if __name__ == "__main__": 2025-09-07T07:00:43.0443116Z main() 2025-09-07T07:00:43.0443127Z 2025-09-07T07:00:43.0531700Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:00:43.0532086Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:00:43.0561654Z shell: /usr/bin/bash -e {0} 2025-09-07T07:00:43.0562132Z env: 2025-09-07T07:00:43.0562740Z GITHUB_TOKEN: *** 2025-09-07T07:00:43.0563159Z ISSUE_NUMBER: 5132 2025-09-07T07:00:43.0563605Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:00:43.0564092Z ISSUE_OWNER: 2025-09-07T07:00:43.0564484Z CHECK_EXPERIMENTS: 2025-09-07T07:00:43.0564905Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:00:43.0565352Z PR_NUMBER: 2025-09-07T07:00:43.0565727Z ##[endgroup] 2025-09-07T07:00:44.1644484Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T07:00:45.2138890Z Collecting urllib3==1.26.18 2025-09-07T07:00:45.2683470Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T07:00:45.2901228Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.5 MB/s eta 0:00:00 2025-09-07T07:00:45.3185522Z Collecting PyGithub==2.3.0 2025-09-07T07:00:45.3258608Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T07:00:45.3718850Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T07:00:45.3786232Z 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-09-07T07:00:45.3832009Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T07:00:45.3843756Z 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-09-07T07:00:45.3862239Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T07:00:45.4148274Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T07:00:45.4214086Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T07:00:45.4444322Z 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-09-07T07:00:45.5703113Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:00:45.5775303Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T07:00:45.7000759Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T07:00:45.7074857Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T07:00:45.7305674Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:00:45.7373032Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T07:00:45.7644268Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T07:00:45.7773302Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 12.0 MB/s eta 0:00:00 2025-09-07T07:00:45.7867855Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T07:00:45.8138693Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 13.7 MB/s eta 0:00:00 2025-09-07T07:00:45.8208966Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T07:00:45.8660514Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 19.5 MB/s eta 0:00:00 2025-09-07T07:00:45.8731152Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T07:00:45.8829843Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T07:00:45.9031795Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 25.3 MB/s eta 0:00:00 2025-09-07T07:00:45.9099673Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T07:00:45.9147207Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 25.2 MB/s eta 0:00:00 2025-09-07T07:00:45.9213975Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T07:00:45.9280134Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 21.6 MB/s eta 0:00:00 2025-09-07T07:00:46.2363275Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T07:00:46.7668085Z 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.3 2025-09-07T07:00:46.8430353Z ##[group]Run curr_branch="main" 2025-09-07T07:00:46.8430667Z curr_branch="main" 2025-09-07T07:00:46.8430886Z curr_ref_type="branch" 2025-09-07T07:00:46.8431176Z echo "Current branch is '$curr_branch'" 2025-09-07T07:00:46.8431427Z  2025-09-07T07:00:46.8431607Z python3 runner_determinator.py \ 2025-09-07T07:00:46.8431881Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T07:00:46.8432152Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T07:00:46.8432402Z  --github-branch "$curr_branch" \ 2025-09-07T07:00:46.8432656Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T07:00:46.8432930Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T07:00:46.8433195Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T07:00:46.8433459Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T07:00:46.8433743Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T07:00:46.8434100Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T07:00:46.8434386Z  --pr-number "${PR_NUMBER}" 2025-09-07T07:00:46.8465371Z shell: /usr/bin/bash -e {0} 2025-09-07T07:00:46.8465604Z env: 2025-09-07T07:00:46.8466172Z GITHUB_TOKEN: *** 2025-09-07T07:00:46.8466354Z ISSUE_NUMBER: 5132 2025-09-07T07:00:46.8466555Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:00:46.8466778Z ISSUE_OWNER: 2025-09-07T07:00:46.8466954Z CHECK_EXPERIMENTS: 2025-09-07T07:00:46.8467141Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:00:46.8467336Z PR_NUMBER: 2025-09-07T07:00:46.8467497Z ##[endgroup] 2025-09-07T07:00:46.8516888Z Current branch is 'main' 2025-09-07T07:00:48.1827301Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-09-07T07:00:48.1828446Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T07:00:48.1829063Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T07:00:48.1829821Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T07:00:48.1830279Z INFO : Setting output: label-type='' 2025-09-07T07:00:48.2138554Z Evaluate and set job outputs 2025-09-07T07:00:48.2145445Z Cleaning up orphan processes