2025-12-04T07:56:45.7559240Z Current runner version: '2.329.0' 2025-12-04T07:56:45.7582715Z ##[group]Runner Image Provisioner 2025-12-04T07:56:45.7583726Z Hosted Compute Agent 2025-12-04T07:56:45.7584305Z Version: 20251124.448 2025-12-04T07:56:45.7584960Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T07:56:45.7585829Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T07:56:45.7586441Z ##[endgroup] 2025-12-04T07:56:45.7587020Z ##[group]Operating System 2025-12-04T07:56:45.7587687Z Ubuntu 2025-12-04T07:56:45.7588237Z 24.04.3 2025-12-04T07:56:45.7588723Z LTS 2025-12-04T07:56:45.7589325Z ##[endgroup] 2025-12-04T07:56:45.7590045Z ##[group]Runner Image 2025-12-04T07:56:45.7590655Z Image: ubuntu-24.04 2025-12-04T07:56:45.7591235Z Version: 20251126.144.1 2025-12-04T07:56:45.7592316Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T07:56:45.7593880Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T07:56:45.7595025Z ##[endgroup] 2025-12-04T07:56:45.7596177Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T07:56:45.7598364Z Contents: read 2025-12-04T07:56:45.7598944Z Metadata: read 2025-12-04T07:56:45.7599742Z Packages: read 2025-12-04T07:56:45.7600321Z ##[endgroup] 2025-12-04T07:56:45.7602727Z Secret source: Actions 2025-12-04T07:56:45.7603796Z Prepare workflow directory 2025-12-04T07:56:45.8112461Z Prepare all required actions 2025-12-04T07:56:45.8168111Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T07:56:45.8174051Z ##[group] Inputs 2025-12-04T07:56:45.8174669Z check_experiments: 2025-12-04T07:56:45.8175408Z opt_out_experiments: 2025-12-04T07:56:45.8176013Z triggering_actor: pytorchmergebot 2025-12-04T07:56:45.8176681Z issue_owner: 2025-12-04T07:56:45.8177362Z curr_branch: main 2025-12-04T07:56:45.8178028Z curr_ref_type: branch 2025-12-04T07:56:45.8178688Z issue_number: 5132 2025-12-04T07:56:45.8179286Z ##[endgroup] 2025-12-04T07:56:45.8180281Z Complete job name: get-label-type / runner-determinator 2025-12-04T07:56:45.8763786Z ##[group]Run cat < runner_determinator.py 2025-12-04T07:56:45.8766072Z cat < runner_determinator.py 2025-12-04T07:56:45.8766736Z # flake8: noqa: G004 2025-12-04T07:56:45.8767278Z  2025-12-04T07:56:45.8768038Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:45.8769075Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:45.8770396Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:45.8771127Z  2025-12-04T07:56:45.8771540Z """ 2025-12-04T07:56:45.8772277Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:45.8773285Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:45.8774479Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:45.8775403Z of which runners should be used to run which job. 2025-12-04T07:56:45.8776053Z  2025-12-04T07:56:45.8776768Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:45.8777761Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:45.8778747Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:45.8779795Z list, defined. 2025-12-04T07:56:45.8780348Z  2025-12-04T07:56:45.8781062Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:45.8782082Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:45.8783049Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:45.8784002Z  2025-12-04T07:56:45.8784737Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:45.8785742Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:45.8786572Z experiments which the user could be opted in to. 2025-12-04T07:56:45.8787264Z  2025-12-04T07:56:45.8787737Z The user list has the following rules: 2025-12-04T07:56:45.8788342Z  2025-12-04T07:56:45.8789025Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:45.8790199Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:45.8791076Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:45.8791667Z  2025-12-04T07:56:45.8792200Z Example config: 2025-12-04T07:56:45.8792755Z  # A list of experiments that can be opted into. 2025-12-04T07:56:45.8793691Z  # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:45.8794450Z  # Expected syntax is: 2025-12-04T07:56:45.8795194Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:45.8796288Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:45.8797119Z  2025-12-04T07:56:45.8797568Z  experiments: 2025-12-04T07:56:45.8798159Z  lf: 2025-12-04T07:56:45.8798638Z  rollout_percent: 25 2025-12-04T07:56:45.8799228Z  all_branches: false 2025-12-04T07:56:45.8799867Z  default: true 2025-12-04T07:56:45.8800479Z  --- 2025-12-04T07:56:45.8800908Z  2025-12-04T07:56:45.8801374Z  # Opt-ins: 2025-12-04T07:56:45.8802166Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:45.8803271Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:45.8804213Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:45.8804969Z  # Experiments should be from the above list. 2025-12-04T07:56:45.8805631Z  2025-12-04T07:56:45.8806124Z  @User1,-lf,split_build 2025-12-04T07:56:45.8806684Z  @User2,lf 2025-12-04T07:56:45.8807224Z  @User3,split_build 2025-12-04T07:56:45.8807722Z """ 2025-12-04T07:56:45.8808248Z  2025-12-04T07:56:45.8808670Z import json 2025-12-04T07:56:45.8809199Z import logging 2025-12-04T07:56:45.8810079Z import os 2025-12-04T07:56:45.8810565Z import random 2025-12-04T07:56:45.8811069Z import re 2025-12-04T07:56:45.8811539Z import sys 2025-12-04T07:56:45.8812120Z from argparse import ArgumentParser 2025-12-04T07:56:45.8812753Z from collections.abc import Iterable 2025-12-04T07:56:45.8813497Z from functools import cache 2025-12-04T07:56:45.8814104Z from logging import LogRecord 2025-12-04T07:56:45.8814682Z from typing import Any, NamedTuple 2025-12-04T07:56:45.8815435Z from urllib.request import Request, urlopen 2025-12-04T07:56:45.8816037Z  2025-12-04T07:56:45.8816513Z import yaml 2025-12-04T07:56:45.8817070Z from github import Auth, Github 2025-12-04T07:56:45.8817695Z from github.Issue import Issue 2025-12-04T07:56:45.8818257Z  2025-12-04T07:56:45.8818720Z  2025-12-04T07:56:45.8819287Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:45.8820199Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:45.8821228Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:45.8822177Z  2025-12-04T07:56:45.8822727Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:45.8823417Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:45.8824062Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:45.8824735Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:45.8825386Z  2025-12-04T07:56:45.8825878Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:45.8826445Z  2025-12-04T07:56:45.8826972Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:45.8827600Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:45.8828122Z  2025-12-04T07:56:45.8828702Z  2025-12-04T07:56:45.8829142Z class Experiment(NamedTuple): 2025-12-04T07:56:45.8829966Z  rollout_perc: float = ( 2025-12-04T07:56:45.8830785Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:45.8831620Z  ) 2025-12-04T07:56:45.8832101Z  all_branches: bool = ( 2025-12-04T07:56:45.8832906Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:45.8833670Z  ) 2025-12-04T07:56:45.8834116Z  default: bool = ( 2025-12-04T07:56:45.8834880Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:45.8835653Z  ) 2025-12-04T07:56:45.8836082Z  2025-12-04T07:56:45.8836606Z  # Add more fields as needed 2025-12-04T07:56:45.8837150Z  2025-12-04T07:56:45.8837586Z  2025-12-04T07:56:45.8838096Z class Settings(NamedTuple): 2025-12-04T07:56:45.8838726Z  """ 2025-12-04T07:56:45.8839282Z  Settings for the experiments that can be opted into. 2025-12-04T07:56:45.8840120Z  """ 2025-12-04T07:56:45.8840600Z  2025-12-04T07:56:45.8841074Z  experiments: dict[str, Experiment] = {} 2025-12-04T07:56:45.8841748Z  2025-12-04T07:56:45.8842328Z  2025-12-04T07:56:45.8842859Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:45.8843621Z  """Color codes the log messages based on the log level""" 2025-12-04T07:56:45.8844331Z  2025-12-04T07:56:45.8844753Z  COLORS = { 2025-12-04T07:56:45.8845331Z  "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:45.8846007Z  "ERROR": "\033[31m", # Red 2025-12-04T07:56:45.8846588Z  "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:45.8847237Z  "INFO": "\033[0m", # Reset 2025-12-04T07:56:45.8847831Z  "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:45.8848419Z  } 2025-12-04T07:56:45.8848942Z  2025-12-04T07:56:45.8849588Z  def format(self, record: LogRecord) -> str: 2025-12-04T07:56:45.8850630Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:45.8851551Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:45.8852271Z  return super().format(record) 2025-12-04T07:56:45.8852831Z  2025-12-04T07:56:45.8853303Z  2025-12-04T07:56:45.8853842Z handler = logging.StreamHandler() 2025-12-04T07:56:45.8854646Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:45.8855488Z  2025-12-04T07:56:45.8856031Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:45.8856729Z log.addHandler(handler) 2025-12-04T07:56:45.8857257Z log.setLevel(logging.INFO) 2025-12-04T07:56:45.8857903Z  2025-12-04T07:56:45.8858343Z  2025-12-04T07:56:45.8928228Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:45.8929580Z  """ 2025-12-04T07:56:45.8930551Z  Defines outputs of the github action that invokes this script 2025-12-04T07:56:45.8932063Z  """ 2025-12-04T07:56:45.8932730Z  if not GITHUB_OUTPUT: 2025-12-04T07:56:45.8934552Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:45.8935677Z  log.warning( 2025-12-04T07:56:45.8936552Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T07:56:45.8937450Z  ) 2025-12-04T07:56:45.8937968Z  print(f"::set-output name={key}::{value}") 2025-12-04T07:56:45.8938517Z  return 2025-12-04T07:56:45.8938923Z  2025-12-04T07:56:45.8939316Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:45.8940283Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:45.8940880Z  f.write(f"{key}={value}\n") 2025-12-04T07:56:45.8941365Z  2025-12-04T07:56:45.8941709Z  2025-12-04T07:56:45.8942215Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:45.8942865Z  return frozenset( 2025-12-04T07:56:45.8943511Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:45.8944171Z  ) 2025-12-04T07:56:45.8944524Z  2025-12-04T07:56:45.8944852Z  2025-12-04T07:56:45.8945218Z def parse_args() -> Any: 2025-12-04T07:56:45.8945811Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:45.8946678Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:45.8947437Z  parser.add_argument( 2025-12-04T07:56:45.8947930Z  "--github-issue-repo", 2025-12-04T07:56:45.8948424Z  type=str, 2025-12-04T07:56:45.8948874Z  required=False, 2025-12-04T07:56:45.8950127Z  default="pytorch/test-infra", 2025-12-04T07:56:45.8951187Z  help="GitHub repo to get the issue", 2025-12-04T07:56:45.8952048Z  ) 2025-12-04T07:56:45.8952605Z  parser.add_argument( 2025-12-04T07:56:45.8953083Z  "--github-repo", 2025-12-04T07:56:45.8953545Z  type=str, 2025-12-04T07:56:45.8953977Z  required=True, 2025-12-04T07:56:45.8954477Z  help="GitHub repo where CI is running", 2025-12-04T07:56:45.8954996Z  ) 2025-12-04T07:56:45.8955382Z  parser.add_argument( 2025-12-04T07:56:45.8956022Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:45.8957341Z  ) 2025-12-04T07:56:45.8957738Z  parser.add_argument( 2025-12-04T07:56:45.8958581Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:45.8960117Z  ) 2025-12-04T07:56:45.8961012Z  parser.add_argument( 2025-12-04T07:56:45.8962739Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:45.8964341Z  ) 2025-12-04T07:56:45.8964812Z  parser.add_argument( 2025-12-04T07:56:45.8965511Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:45.8966217Z  ) 2025-12-04T07:56:45.8966602Z  parser.add_argument( 2025-12-04T07:56:45.8967072Z  "--github-ref-type", 2025-12-04T07:56:45.8967553Z  type=str, 2025-12-04T07:56:45.8967989Z  required=True, 2025-12-04T07:56:45.8968516Z  help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:45.8969061Z  ) 2025-12-04T07:56:45.8969902Z  parser.add_argument( 2025-12-04T07:56:45.8970617Z  "--eligible-experiments", 2025-12-04T07:56:45.8971163Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:45.8971684Z  required=False, 2025-12-04T07:56:45.8972145Z  default="", 2025-12-04T07:56:45.8973054Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:45.8973998Z  ) 2025-12-04T07:56:45.8974427Z  parser.add_argument( 2025-12-04T07:56:45.8974965Z  "--opt-out-experiments", 2025-12-04T07:56:45.8975546Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:45.8976119Z  required=False, 2025-12-04T07:56:45.8976631Z  default="", 2025-12-04T07:56:45.8977101Z  help=( 2025-12-04T07:56:45.8977840Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:45.8978993Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:45.8980141Z  ), 2025-12-04T07:56:45.8980528Z  ) 2025-12-04T07:56:45.8980917Z  parser.add_argument( 2025-12-04T07:56:45.8981388Z  "--pr-number", 2025-12-04T07:56:45.8981834Z  type=str, 2025-12-04T07:56:45.8982266Z  required=False, 2025-12-04T07:56:45.8982718Z  default="", 2025-12-04T07:56:45.8983242Z  help="the optional PR number where this is run", 2025-12-04T07:56:45.8983790Z  ) 2025-12-04T07:56:45.8984149Z  2025-12-04T07:56:45.8984520Z  return parser.parse_args() 2025-12-04T07:56:45.8985001Z  2025-12-04T07:56:45.8985333Z  2025-12-04T07:56:45.8985935Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:45.8986852Z  auth = Auth.Token(github_token) 2025-12-04T07:56:45.8987373Z  return Github(auth=auth) 2025-12-04T07:56:45.8987835Z  2025-12-04T07:56:45.8988168Z  2025-12-04T07:56:45.8988810Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:45.8989829Z  repo = gh.get_repo(repo) 2025-12-04T07:56:45.8990455Z  return repo.get_issue(number=issue_num) 2025-12-04T07:56:45.8990967Z  2025-12-04T07:56:45.8991300Z  2025-12-04T07:56:45.8991665Z def get_potential_pr_author( 2025-12-04T07:56:45.8992329Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:45.8993007Z ) -> str: 2025-12-04T07:56:45.8993544Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:45.8994336Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:45.8995098Z  # embedded in the tag name: ciflow// 2025-12-04T07:56:45.8995651Z  2025-12-04T07:56:45.8996025Z  gh = get_gh_client(github_token) 2025-12-04T07:56:45.8996514Z  2025-12-04T07:56:45.8996977Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:45.8997604Z  split_tag = ref_name.split("/") 2025-12-04T07:56:45.8998103Z  if ( 2025-12-04T07:56:45.8998518Z  len(split_tag) == 3 2025-12-04T07:56:45.8999026Z  and split_tag[0] == "ciflow" 2025-12-04T07:56:45.9000055Z  and split_tag[2].isnumeric() 2025-12-04T07:56:45.9000550Z  ): 2025-12-04T07:56:45.9000978Z  pr_number = split_tag[2] 2025-12-04T07:56:45.9001473Z  try: 2025-12-04T07:56:45.9001937Z  repository = gh.get_repo(repo) 2025-12-04T07:56:45.9002723Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:45.9003341Z  except Exception as e: 2025-12-04T07:56:45.9003885Z  raise Exception( # noqa: TRY002 2025-12-04T07:56:45.9004562Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:45.9005201Z  ) from e 2025-12-04T07:56:45.9005769Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:45.9006475Z  # In all other cases, return the original input username 2025-12-04T07:56:45.9007078Z  return username 2025-12-04T07:56:45.9007492Z  2025-12-04T07:56:45.9007830Z  2025-12-04T07:56:45.9008258Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:45.9008780Z  """ 2025-12-04T07:56:45.9009567Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:45.9010347Z  """ 2025-12-04T07:56:45.9010907Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:45.9011554Z  2025-12-04T07:56:45.9011891Z  2025-12-04T07:56:45.9012269Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:45.9012775Z  try: 2025-12-04T07:56:45.9013184Z  data = yaml.safe_load(yaml_text) 2025-12-04T07:56:45.9013695Z  return data 2025-12-04T07:56:45.9014134Z  except yaml.YAMLError: 2025-12-04T07:56:45.9014653Z  log.exception("Error loading YAML") 2025-12-04T07:56:45.9015171Z  raise 2025-12-04T07:56:45.9015555Z  2025-12-04T07:56:45.9015889Z  2025-12-04T07:56:45.9016489Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:45.9017210Z  """ 2025-12-04T07:56:45.9017953Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:45.9018696Z  2025-12-04T07:56:45.9019232Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:45.9020087Z  and the text below is the list of opted in users. 2025-12-04T07:56:45.9020633Z  2025-12-04T07:56:45.9021187Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:45.9021869Z  """ 2025-12-04T07:56:45.9022332Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:45.9022932Z  if len(rollout_state_parts) >= 2: 2025-12-04T07:56:45.9023551Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:45.9024128Z  else: 2025-12-04T07:56:45.9024528Z  return "", rollout_state 2025-12-04T07:56:45.9025000Z  2025-12-04T07:56:45.9025331Z  2025-12-04T07:56:45.9025716Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:45.9026222Z  """ 2025-12-04T07:56:45.9026756Z  Dictionary of users with a list of features they have opted into 2025-12-04T07:56:45.9027382Z  """ 2025-12-04T07:56:45.9027734Z  2025-12-04T07:56:45.9028059Z  2025-12-04T07:56:45.9028581Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:45.9029217Z  """ 2025-12-04T07:56:45.9030173Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T07:56:45.9030967Z  2025-12-04T07:56:45.9031739Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:45.9032702Z  - Example line: "@User1,lf,split_build" 2025-12-04T07:56:45.9033532Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:45.9034151Z  2025-12-04T07:56:45.9034474Z  2025-12-04T07:56:45.9034800Z  """ 2025-12-04T07:56:45.9035173Z  optins = UserOptins() 2025-12-04T07:56:45.9035688Z  for user in user_optin_text.split("\n"): 2025-12-04T07:56:45.9036247Z  user = user.strip("\r\n\t -") 2025-12-04T07:56:45.9036798Z  if not user or not user.startswith("@"): 2025-12-04T07:56:45.9037351Z  # Not a valid user. Skip 2025-12-04T07:56:45.9037877Z  continue 2025-12-04T07:56:45.9038290Z  2025-12-04T07:56:45.9038626Z  if user: 2025-12-04T07:56:45.9039099Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:45.9040191Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:45.9040917Z  2025-12-04T07:56:45.9041271Z  return optins 2025-12-04T07:56:45.9041674Z  2025-12-04T07:56:45.9041997Z  2025-12-04T07:56:45.9042477Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:45.9043076Z  """ 2025-12-04T07:56:45.9043490Z  Check if the experiment name is valid. 2025-12-04T07:56:45.9044055Z  A valid name: 2025-12-04T07:56:45.9044766Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:45.9045716Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:45.9046461Z  - Cannot contain spaces 2025-12-04T07:56:45.9046991Z  """ 2025-12-04T07:56:45.9047391Z  2025-12-04T07:56:45.9047887Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:45.9048648Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:45.9049549Z  2025-12-04T07:56:45.9049999Z  if valid: 2025-12-04T07:56:45.9050443Z  return True 2025-12-04T07:56:45.9050851Z  2025-12-04T07:56:45.9051294Z  log.error( 2025-12-04T07:56:45.9052902Z  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-12-04T07:56:45.9054359Z  ) 2025-12-04T07:56:45.9054727Z  return False 2025-12-04T07:56:45.9055126Z  2025-12-04T07:56:45.9055457Z  2025-12-04T07:56:45.9055957Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:45.9056580Z  """ 2025-12-04T07:56:45.9057169Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:45.9057867Z  """ 2025-12-04T07:56:45.9058225Z  try: 2025-12-04T07:56:45.9058598Z  if settings_text: 2025-12-04T07:56:45.9059328Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:45.9060199Z  # for easy reading 2025-12-04T07:56:45.9061000Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:45.9061874Z  # the backtick character in shell commands. 2025-12-04T07:56:45.9062483Z  backtick = chr(96) # backtick character 2025-12-04T07:56:45.9063154Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:45.9063807Z  settings = load_yaml(settings_text) 2025-12-04T07:56:45.9064311Z  2025-12-04T07:56:45.9065030Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:45.9065752Z  experiments = {} 2025-12-04T07:56:45.9066201Z  2025-12-04T07:56:45.9066743Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:45.9067503Z  if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:45.9068564Z  # 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-12-04T07:56:45.9069697Z  continue 2025-12-04T07:56:45.9070241Z  2025-12-04T07:56:45.9070605Z  valid_settings = {} 2025-12-04T07:56:45.9071133Z  for setting in exp_settings: 2025-12-04T07:56:45.9071698Z  if setting not in Experiment._fields: 2025-12-04T07:56:45.9072265Z  log.warning( 2025-12-04T07:56:45.9072974Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:45.9073670Z  ) 2025-12-04T07:56:45.9074122Z  else: 2025-12-04T07:56:45.9074659Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:45.9075213Z  2025-12-04T07:56:45.9075674Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:45.9076308Z  return Settings(experiments) 2025-12-04T07:56:45.9076794Z  2025-12-04T07:56:45.9077147Z  except Exception: 2025-12-04T07:56:45.9077652Z  log.exception("Failed to parse settings") 2025-12-04T07:56:45.9078171Z  2025-12-04T07:56:45.9078519Z  return Settings() 2025-12-04T07:56:45.9078935Z  2025-12-04T07:56:45.9079263Z  2025-12-04T07:56:45.9080089Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:45.9080678Z  """ 2025-12-04T07:56:45.9081126Z  Parse settings, if any, from the rollout state. 2025-12-04T07:56:45.9081668Z  2025-12-04T07:56:45.9082199Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:45.9082953Z  and the text below is the list of opted in users. 2025-12-04T07:56:45.9083500Z  2025-12-04T07:56:45.9084078Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:45.9084785Z  """ 2025-12-04T07:56:45.9085341Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:45.9086098Z  return parse_settings_from_text(settings_text) 2025-12-04T07:56:45.9086636Z  2025-12-04T07:56:45.9086960Z  2025-12-04T07:56:45.9087401Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:45.9087952Z  """ 2025-12-04T07:56:45.9088365Z  Parse users from the rollout state. 2025-12-04T07:56:45.9088855Z  2025-12-04T07:56:45.9089185Z  """ 2025-12-04T07:56:45.9089933Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:45.9090673Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:45.9091209Z  2025-12-04T07:56:45.9091531Z  2025-12-04T07:56:45.9092137Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:45.9092850Z  """ 2025-12-04T07:56:45.9093289Z  Check if a user is opted into an experiment 2025-12-04T07:56:45.9093809Z  """ 2025-12-04T07:56:45.9094285Z  return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:45.9094986Z  2025-12-04T07:56:45.9095316Z  2025-12-04T07:56:45.9095926Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:45.9096652Z  """ 2025-12-04T07:56:45.9097131Z  Check if a user explicitly opted out of an experiment 2025-12-04T07:56:45.9097692Z  """ 2025-12-04T07:56:45.9098211Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:45.9098906Z  experiment_optout = "-" + experiment_name 2025-12-04T07:56:45.9099659Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:45.9100254Z  return False 2025-12-04T07:56:45.9100665Z  2025-12-04T07:56:45.9101121Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:45.9101701Z  log.warning( 2025-12-04T07:56:45.9102500Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:45.9103350Z  ) 2025-12-04T07:56:45.9103706Z  2025-12-04T07:56:45.9104046Z  return True 2025-12-04T07:56:45.9104436Z  2025-12-04T07:56:45.9104762Z  2025-12-04T07:56:45.9105108Z def get_runner_prefix( 2025-12-04T07:56:45.9105570Z  rollout_state: str, 2025-12-04T07:56:45.9106054Z  workflow_requestors: Iterable[str], 2025-12-04T07:56:45.9106568Z  branch: str, 2025-12-04T07:56:45.9107084Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:45.9107754Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:45.9108332Z  is_canary: bool = False, 2025-12-04T07:56:45.9108787Z ) -> str: 2025-12-04T07:56:45.9109227Z  settings = parse_settings(rollout_state) 2025-12-04T07:56:45.9109904Z  user_optins = parse_users(rollout_state) 2025-12-04T07:56:45.9110417Z  2025-12-04T07:56:45.9110889Z  fleet_prefix = "" 2025-12-04T07:56:45.9111335Z  prefixes = [] 2025-12-04T07:56:45.9112003Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:45.9112923Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:45.9113618Z  log.info( 2025-12-04T07:56:45.9114307Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:45.9115026Z  ) 2025-12-04T07:56:45.9115421Z  continue 2025-12-04T07:56:45.9115823Z  2025-12-04T07:56:45.9116188Z  if opt_out_experiments: 2025-12-04T07:56:45.9116734Z  if experiment_name in opt_out_experiments: 2025-12-04T07:56:45.9117376Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:45.9117959Z  log.info( 2025-12-04T07:56:45.9118876Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:45.9120080Z  ) 2025-12-04T07:56:45.9120503Z  continue 2025-12-04T07:56:45.9120939Z  2025-12-04T07:56:45.9121303Z  if eligible_experiments: 2025-12-04T07:56:45.9121884Z  if experiment_name not in eligible_experiments: 2025-12-04T07:56:45.9122512Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:45.9123061Z  log.info( 2025-12-04T07:56:45.9123840Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:45.9124637Z  ) 2025-12-04T07:56:45.9125236Z  continue 2025-12-04T07:56:45.9125732Z  elif not experiment_settings.default: 2025-12-04T07:56:45.9126255Z  log.info( 2025-12-04T07:56:45.9126925Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:45.9127630Z  ) 2025-12-04T07:56:45.9128030Z  continue 2025-12-04T07:56:45.9128440Z  2025-12-04T07:56:45.9128907Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:45.9129801Z  opted_out_users = [ 2025-12-04T07:56:45.9130290Z  requestor 2025-12-04T07:56:45.9130777Z  for requestor in workflow_requestors 2025-12-04T07:56:45.9131453Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:45.9132063Z  ] 2025-12-04T07:56:45.9132435Z  2025-12-04T07:56:45.9132791Z  if opted_out_users: 2025-12-04T07:56:45.9133251Z  log.info( 2025-12-04T07:56:45.9133892Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:45.9134563Z  ) 2025-12-04T07:56:45.9134965Z  continue 2025-12-04T07:56:45.9135374Z  2025-12-04T07:56:45.9135822Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:45.9136426Z  opted_in_users = [ 2025-12-04T07:56:45.9136887Z  requestor 2025-12-04T07:56:45.9137372Z  for requestor in workflow_requestors 2025-12-04T07:56:45.9138067Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:45.9138670Z  ] 2025-12-04T07:56:45.9139035Z  2025-12-04T07:56:45.9139470Z  enabled = False 2025-12-04T07:56:45.9139934Z  if opted_in_users: 2025-12-04T07:56:45.9140515Z  log.info( 2025-12-04T07:56:45.9141146Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:45.9141798Z  ) 2025-12-04T07:56:45.9142203Z  enabled = True 2025-12-04T07:56:45.9142635Z  2025-12-04T07:56:45.9143032Z  elif experiment_settings.rollout_perc: 2025-12-04T07:56:45.9143842Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:45.9144742Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:45.9145369Z  log.info( 2025-12-04T07:56:45.9146221Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:45.9147103Z  ) 2025-12-04T07:56:45.9147538Z  enabled = True 2025-12-04T07:56:45.9147993Z  2025-12-04T07:56:45.9148342Z  if enabled: 2025-12-04T07:56:45.9148796Z  label = experiment_name 2025-12-04T07:56:45.9149359Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:45.9150262Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:45.9151116Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:45.9151876Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:45.9152519Z  if is_canary: 2025-12-04T07:56:45.9153033Z  label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:45.9153565Z  fleet_prefix = label 2025-12-04T07:56:45.9154185Z  else: 2025-12-04T07:56:45.9154647Z  prefixes.append(label) 2025-12-04T07:56:45.9155133Z  2025-12-04T07:56:45.9155486Z  if len(prefixes) > 1: 2025-12-04T07:56:45.9155941Z  log.error( 2025-12-04T07:56:45.9156953Z  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-12-04T07:56:45.9157998Z  ) 2025-12-04T07:56:45.9158402Z  prefixes = prefixes[:1] 2025-12-04T07:56:45.9158876Z  2025-12-04T07:56:45.9159248Z  # Fleet always comes first 2025-12-04T07:56:45.9159970Z  if fleet_prefix: 2025-12-04T07:56:45.9160455Z  prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:45.9160954Z  2025-12-04T07:56:45.9161390Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:45.9161954Z  2025-12-04T07:56:45.9162276Z  2025-12-04T07:56:45.9162904Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:45.9163650Z  """ 2025-12-04T07:56:45.9164232Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:45.9164907Z  2025-12-04T07:56:45.9165459Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:45.9166140Z  """ 2025-12-04T07:56:45.9166534Z  gh = get_gh_client(github_token) 2025-12-04T07:56:45.9167081Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:45.9167721Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:45.9168289Z  2025-12-04T07:56:45.9168624Z  2025-12-04T07:56:45.9169197Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:45.9170341Z  for _ in range(num_retries): 2025-12-04T07:56:45.9170864Z  try: 2025-12-04T07:56:45.9171316Z  req = Request(url=url, headers=headers) 2025-12-04T07:56:45.9171968Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:45.9172589Z  return json.loads(content) 2025-12-04T07:56:45.9173104Z  except Exception as e: 2025-12-04T07:56:45.9173656Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:45.9174193Z  2025-12-04T07:56:45.9174747Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:45.9175434Z  return {} 2025-12-04T07:56:45.9175819Z  2025-12-04T07:56:45.9176139Z  2025-12-04T07:56:45.9176468Z @cache 2025-12-04T07:56:45.9177095Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:45.9177831Z  """ 2025-12-04T07:56:45.9178234Z  Dynamically get PR information 2025-12-04T07:56:45.9178719Z  """ 2025-12-04T07:56:45.9179221Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:45.9180050Z  headers = { 2025-12-04T07:56:45.9180532Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:45.9181140Z  "Authorization": f"token {github_token}", 2025-12-04T07:56:45.9181662Z  } 2025-12-04T07:56:45.9182107Z  json_response: dict[str, Any] = download_json( 2025-12-04T07:56:45.9182714Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:45.9183235Z  headers=headers, 2025-12-04T07:56:45.9183675Z  ) 2025-12-04T07:56:45.9184031Z  2025-12-04T07:56:45.9184375Z  if not json_response: 2025-12-04T07:56:45.9185105Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:45.9185709Z  return {} 2025-12-04T07:56:45.9186114Z  2025-12-04T07:56:45.9186459Z  return json_response 2025-12-04T07:56:45.9186896Z  2025-12-04T07:56:45.9187217Z  2025-12-04T07:56:45.9187794Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:45.9188492Z  """ 2025-12-04T07:56:45.9189020Z  Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:45.9189763Z  """ 2025-12-04T07:56:45.9190246Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:45.9190834Z  return { 2025-12-04T07:56:45.9191420Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:45.9192083Z  } 2025-12-04T07:56:45.9192429Z  2025-12-04T07:56:45.9192757Z  2025-12-04T07:56:45.9193106Z def main() -> None: 2025-12-04T07:56:45.9193533Z  args = parse_args() 2025-12-04T07:56:45.9193964Z  2025-12-04T07:56:45.9194371Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:45.9194897Z  2025-12-04T07:56:45.9195256Z  # Check if the PR is opt-out 2025-12-04T07:56:45.9195744Z  if args.pr_number: 2025-12-04T07:56:45.9196405Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:45.9197128Z  if OPT_OUT_LABEL in labels: 2025-12-04T07:56:45.9197621Z  log.info( 2025-12-04T07:56:45.9198314Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:45.9199045Z  ) 2025-12-04T07:56:45.9199739Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:45.9200403Z  sys.exit() 2025-12-04T07:56:45.9200945Z  2025-12-04T07:56:45.9201273Z  try: 2025-12-04T07:56:45.9201728Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:45.9202425Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:45.9203044Z  ) 2025-12-04T07:56:45.9203399Z  2025-12-04T07:56:45.9203787Z  username = get_potential_pr_author( 2025-12-04T07:56:45.9204314Z  args.github_token, 2025-12-04T07:56:45.9204806Z  args.github_repo, 2025-12-04T07:56:45.9205295Z  args.github_actor, 2025-12-04T07:56:45.9205789Z  args.github_ref_type, 2025-12-04T07:56:45.9206297Z  args.github_branch, 2025-12-04T07:56:45.9206761Z  ) 2025-12-04T07:56:45.9207128Z  2025-12-04T07:56:45.9207599Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:45.9208185Z  2025-12-04T07:56:45.9208583Z  runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:45.9209133Z  rollout_state, 2025-12-04T07:56:45.9209859Z  (args.github_issue_owner, username), 2025-12-04T07:56:45.9210413Z  args.github_branch, 2025-12-04T07:56:45.9210933Z  args.eligible_experiments, 2025-12-04T07:56:45.9211461Z  args.opt_out_experiments, 2025-12-04T07:56:45.9211965Z  is_canary, 2025-12-04T07:56:45.9212387Z  ) 2025-12-04T07:56:45.9212752Z  2025-12-04T07:56:45.9213109Z  except Exception as e: 2025-12-04T07:56:45.9213573Z  log.error( 2025-12-04T07:56:45.9214262Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:45.9215115Z  ) 2025-12-04T07:56:45.9215479Z  2025-12-04T07:56:45.9215987Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:45.9216740Z  2025-12-04T07:56:45.9217062Z  2025-12-04T07:56:45.9217411Z if __name__ == "__main__": 2025-12-04T07:56:45.9217859Z  main() 2025-12-04T07:56:45.9218222Z  2025-12-04T07:56:45.9218546Z EOF 2025-12-04T07:56:45.9218883Z  2025-12-04T07:56:45.9219245Z cat runner_determinator.py 2025-12-04T07:56:45.9690190Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:45.9691445Z env: 2025-12-04T07:56:45.9692459Z GITHUB_TOKEN: *** 2025-12-04T07:56:45.9693102Z ISSUE_NUMBER: 5132 2025-12-04T07:56:45.9693791Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:45.9694587Z ISSUE_OWNER: 2025-12-04T07:56:45.9695228Z CHECK_EXPERIMENTS: 2025-12-04T07:56:45.9695897Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:45.9696564Z PR_NUMBER: 2025-12-04T07:56:45.9697147Z ##[endgroup] 2025-12-04T07:56:46.0003719Z # flake8: noqa: G004 2025-12-04T07:56:46.0004230Z 2025-12-04T07:56:46.0007851Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:46.0013458Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:46.0014836Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:46.0015569Z 2025-12-04T07:56:46.0015826Z """ 2025-12-04T07:56:46.0016734Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:46.0018208Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:46.0019933Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:46.0021280Z of which runners should be used to run which job. 2025-12-04T07:56:46.0021961Z 2025-12-04T07:56:46.0022578Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:46.0024325Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:46.0025833Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:46.0026959Z list, defined. 2025-12-04T07:56:46.0027334Z 2025-12-04T07:56:46.0027926Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:46.0029643Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:46.0030997Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:46.0031740Z 2025-12-04T07:56:46.0032305Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:46.0033689Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:46.0035003Z experiments which the user could be opted in to. 2025-12-04T07:56:46.0035680Z 2025-12-04T07:56:46.0036005Z The user list has the following rules: 2025-12-04T07:56:46.0036599Z 2025-12-04T07:56:46.0037114Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:46.0038524Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:46.0040059Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:46.0040753Z 2025-12-04T07:56:46.0041048Z Example config: 2025-12-04T07:56:46.0041755Z # A list of experiments that can be opted into. 2025-12-04T07:56:46.0042806Z # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:46.0043791Z # Expected syntax is: 2025-12-04T07:56:46.0044808Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:46.0046364Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:46.0047356Z 2025-12-04T07:56:46.0047616Z experiments: 2025-12-04T07:56:46.0048218Z lf: 2025-12-04T07:56:46.0048832Z rollout_percent: 25 2025-12-04T07:56:46.0050241Z all_branches: false 2025-12-04T07:56:46.0051001Z default: true 2025-12-04T07:56:46.0051754Z --- 2025-12-04T07:56:46.0052088Z 2025-12-04T07:56:46.0052347Z # Opt-ins: 2025-12-04T07:56:46.0053282Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:46.0054684Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:46.0055925Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:46.0057041Z # Experiments should be from the above list. 2025-12-04T07:56:46.0057740Z 2025-12-04T07:56:46.0058055Z @User1,-lf,split_build 2025-12-04T07:56:46.0058816Z @User2,lf 2025-12-04T07:56:46.0059766Z @User3,split_build 2025-12-04T07:56:46.0060516Z """ 2025-12-04T07:56:46.0060871Z 2025-12-04T07:56:46.0061148Z import json 2025-12-04T07:56:46.0061788Z import logging 2025-12-04T07:56:46.0062447Z import os 2025-12-04T07:56:46.0063070Z import random 2025-12-04T07:56:46.0063720Z import re 2025-12-04T07:56:46.0064302Z import sys 2025-12-04T07:56:46.0064974Z from argparse import ArgumentParser 2025-12-04T07:56:46.0065857Z from collections.abc import Iterable 2025-12-04T07:56:46.0066739Z from functools import cache 2025-12-04T07:56:46.0067490Z from logging import LogRecord 2025-12-04T07:56:46.0068275Z from typing import Any, NamedTuple 2025-12-04T07:56:46.0069123Z from urllib.request import Request, urlopen 2025-12-04T07:56:46.0070098Z 2025-12-04T07:56:46.0070385Z import yaml 2025-12-04T07:56:46.0071055Z from github import Auth, Github 2025-12-04T07:56:46.0071847Z from github.Issue import Issue 2025-12-04T07:56:46.0072344Z 2025-12-04T07:56:46.0072355Z 2025-12-04T07:56:46.0072705Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:46.0073806Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:46.0075178Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:46.0076194Z 2025-12-04T07:56:46.0076596Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:46.0077833Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:46.0078733Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:46.0079842Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:46.0080435Z 2025-12-04T07:56:46.0080789Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:46.0081393Z 2025-12-04T07:56:46.0081705Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:46.0082484Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:46.0083022Z 2025-12-04T07:56:46.0083034Z 2025-12-04T07:56:46.0083362Z class Experiment(NamedTuple): 2025-12-04T07:56:46.0084206Z rollout_perc: float = ( 2025-12-04T07:56:46.0085338Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:46.0086505Z ) 2025-12-04T07:56:46.0087156Z all_branches: bool = ( 2025-12-04T07:56:46.0088212Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:46.0089659Z ) 2025-12-04T07:56:46.0090306Z default: bool = ( 2025-12-04T07:56:46.0091293Z True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:46.0092438Z ) 2025-12-04T07:56:46.0092802Z 2025-12-04T07:56:46.0093112Z # Add more fields as needed 2025-12-04T07:56:46.0093655Z 2025-12-04T07:56:46.0093666Z 2025-12-04T07:56:46.0094012Z class Settings(NamedTuple): 2025-12-04T07:56:46.0094779Z """ 2025-12-04T07:56:46.0095543Z Settings for the experiments that can be opted into. 2025-12-04T07:56:46.0096520Z """ 2025-12-04T07:56:46.0096884Z 2025-12-04T07:56:46.0097239Z experiments: dict[str, Experiment] = {} 2025-12-04T07:56:46.0097897Z 2025-12-04T07:56:46.0097910Z 2025-12-04T07:56:46.0098272Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:46.0099566Z """Color codes the log messages based on the log level""" 2025-12-04T07:56:46.0100330Z 2025-12-04T07:56:46.0100592Z COLORS = { 2025-12-04T07:56:46.0101210Z "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:46.0101983Z "ERROR": "\033[31m", # Red 2025-12-04T07:56:46.0102469Z "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:46.0102961Z "INFO": "\033[0m", # Reset 2025-12-04T07:56:46.0103431Z "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:46.0103891Z } 2025-12-04T07:56:46.0104091Z 2025-12-04T07:56:46.0104307Z def format(self, record: LogRecord) -> str: 2025-12-04T07:56:46.0105028Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:46.0105831Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:46.0106407Z return super().format(record) 2025-12-04T07:56:46.0106744Z 2025-12-04T07:56:46.0106757Z 2025-12-04T07:56:46.0106945Z handler = logging.StreamHandler() 2025-12-04T07:56:46.0107622Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:46.0108168Z 2025-12-04T07:56:46.0108411Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:46.0109006Z log.addHandler(handler) 2025-12-04T07:56:46.0109676Z log.setLevel(logging.INFO) 2025-12-04T07:56:46.0109990Z 2025-12-04T07:56:46.0109997Z 2025-12-04T07:56:46.0110260Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:46.0110809Z """ 2025-12-04T07:56:46.0111300Z Defines outputs of the github action that invokes this script 2025-12-04T07:56:46.0111905Z """ 2025-12-04T07:56:46.0112281Z if not GITHUB_OUTPUT: 2025-12-04T07:56:46.0113299Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:46.0114359Z log.warning( 2025-12-04T07:56:46.0115175Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T07:56:46.0116096Z ) 2025-12-04T07:56:46.0126657Z print(f"::set-output name={key}::{value}") 2025-12-04T07:56:46.0127242Z return 2025-12-04T07:56:46.0127493Z 2025-12-04T07:56:46.0127886Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:46.0128454Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:46.0129031Z f.write(f"{key}={value}\n") 2025-12-04T07:56:46.0129573Z 2025-12-04T07:56:46.0129584Z 2025-12-04T07:56:46.0129989Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:46.0130613Z return frozenset( 2025-12-04T07:56:46.0131209Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:46.0131860Z ) 2025-12-04T07:56:46.0132066Z 2025-12-04T07:56:46.0132073Z 2025-12-04T07:56:46.0132243Z def parse_args() -> Any: 2025-12-04T07:56:46.0132770Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:46.0133595Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:46.0134330Z parser.add_argument( 2025-12-04T07:56:46.0134762Z "--github-issue-repo", 2025-12-04T07:56:46.0135237Z type=str, 2025-12-04T07:56:46.0135626Z required=False, 2025-12-04T07:56:46.0136075Z default="pytorch/test-infra", 2025-12-04T07:56:46.0136589Z help="GitHub repo to get the issue", 2025-12-04T07:56:46.0137076Z ) 2025-12-04T07:56:46.0137426Z parser.add_argument( 2025-12-04T07:56:46.0137849Z "--github-repo", 2025-12-04T07:56:46.0138262Z type=str, 2025-12-04T07:56:46.0138642Z required=True, 2025-12-04T07:56:46.0139099Z help="GitHub repo where CI is running", 2025-12-04T07:56:46.0139853Z ) 2025-12-04T07:56:46.0140220Z parser.add_argument( 2025-12-04T07:56:46.0140800Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:46.0141429Z ) 2025-12-04T07:56:46.0141768Z parser.add_argument( 2025-12-04T07:56:46.0142367Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:46.0143009Z ) 2025-12-04T07:56:46.0143519Z parser.add_argument( 2025-12-04T07:56:46.0144142Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:46.0144796Z ) 2025-12-04T07:56:46.0145149Z parser.add_argument( 2025-12-04T07:56:46.0145796Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:46.0146471Z ) 2025-12-04T07:56:46.0146823Z parser.add_argument( 2025-12-04T07:56:46.0147257Z "--github-ref-type", 2025-12-04T07:56:46.0147690Z type=str, 2025-12-04T07:56:46.0148081Z required=True, 2025-12-04T07:56:46.0148552Z help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:46.0149089Z ) 2025-12-04T07:56:46.0149559Z parser.add_argument( 2025-12-04T07:56:46.0150002Z "--eligible-experiments", 2025-12-04T07:56:46.0150496Z type=_str_comma_separated_to_set, 2025-12-04T07:56:46.0150991Z required=False, 2025-12-04T07:56:46.0151394Z default="", 2025-12-04T07:56:46.0152222Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:46.0153097Z ) 2025-12-04T07:56:46.0153453Z parser.add_argument( 2025-12-04T07:56:46.0153896Z "--opt-out-experiments", 2025-12-04T07:56:46.0154377Z type=_str_comma_separated_to_set, 2025-12-04T07:56:46.0154885Z required=False, 2025-12-04T07:56:46.0155291Z default="", 2025-12-04T07:56:46.0155668Z help=( 2025-12-04T07:56:46.0156306Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:46.0157372Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:46.0158157Z ), 2025-12-04T07:56:46.0158494Z ) 2025-12-04T07:56:46.0158850Z parser.add_argument( 2025-12-04T07:56:46.0159273Z "--pr-number", 2025-12-04T07:56:46.0159799Z type=str, 2025-12-04T07:56:46.0160194Z required=False, 2025-12-04T07:56:46.0160597Z default="", 2025-12-04T07:56:46.0161172Z help="the optional PR number where this is run", 2025-12-04T07:56:46.0161702Z ) 2025-12-04T07:56:46.0161900Z 2025-12-04T07:56:46.0162086Z return parser.parse_args() 2025-12-04T07:56:46.0162381Z 2025-12-04T07:56:46.0162387Z 2025-12-04T07:56:46.0162764Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.0163478Z auth = Auth.Token(github_token) 2025-12-04T07:56:46.0163957Z return Github(auth=auth) 2025-12-04T07:56:46.0164251Z 2025-12-04T07:56:46.0164258Z 2025-12-04T07:56:46.0164678Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:46.0165441Z repo = gh.get_repo(repo) 2025-12-04T07:56:46.0165915Z return repo.get_issue(number=issue_num) 2025-12-04T07:56:46.0166277Z 2025-12-04T07:56:46.0166284Z 2025-12-04T07:56:46.0166458Z def get_potential_pr_author( 2025-12-04T07:56:46.0167090Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:46.0167729Z ) -> str: 2025-12-04T07:56:46.0168230Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:46.0168984Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:46.0169896Z # embedded in the tag name: ciflow// 2025-12-04T07:56:46.0170312Z 2025-12-04T07:56:46.0170495Z gh = get_gh_client(github_token) 2025-12-04T07:56:46.0170824Z 2025-12-04T07:56:46.0171074Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:46.0171659Z split_tag = ref_name.split("/") 2025-12-04T07:56:46.0172145Z if ( 2025-12-04T07:56:46.0172523Z len(split_tag) == 3 2025-12-04T07:56:46.0172999Z and split_tag[0] == "ciflow" 2025-12-04T07:56:46.0222149Z and split_tag[2].isnumeric() 2025-12-04T07:56:46.0223033Z ): 2025-12-04T07:56:46.0223674Z pr_number = split_tag[2] 2025-12-04T07:56:46.0224163Z try: 2025-12-04T07:56:46.0224609Z repository = gh.get_repo(repo) 2025-12-04T07:56:46.0225259Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:46.0225879Z except Exception as e: 2025-12-04T07:56:46.0226424Z raise Exception( # noqa: TRY002 2025-12-04T07:56:46.0227097Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:46.0227750Z ) from e 2025-12-04T07:56:46.0228300Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:46.0229003Z # In all other cases, return the original input username 2025-12-04T07:56:46.0229846Z return username 2025-12-04T07:56:46.0230102Z 2025-12-04T07:56:46.0230110Z 2025-12-04T07:56:46.0230322Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:46.0230840Z """ 2025-12-04T07:56:46.0231447Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:46.0232191Z """ 2025-12-04T07:56:46.0232707Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:46.0233207Z 2025-12-04T07:56:46.0233215Z 2025-12-04T07:56:46.0233403Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:46.0233880Z try: 2025-12-04T07:56:46.0234259Z data = yaml.safe_load(yaml_text) 2025-12-04T07:56:46.0234750Z return data 2025-12-04T07:56:46.0235148Z except yaml.YAMLError: 2025-12-04T07:56:46.0235626Z log.exception("Error loading YAML") 2025-12-04T07:56:46.0236116Z raise 2025-12-04T07:56:46.0236342Z 2025-12-04T07:56:46.0236348Z 2025-12-04T07:56:46.0236737Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:46.0237440Z """ 2025-12-04T07:56:46.0238030Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:46.0238604Z 2025-12-04T07:56:46.0239085Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.0240081Z and the text below is the list of opted in users. 2025-12-04T07:56:46.0240486Z 2025-12-04T07:56:46.0240846Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:46.0241509Z """ 2025-12-04T07:56:46.0241933Z rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:46.0242509Z if len(rollout_state_parts) >= 2: 2025-12-04T07:56:46.0243080Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:46.0243645Z else: 2025-12-04T07:56:46.0244010Z return "", rollout_state 2025-12-04T07:56:46.0244316Z 2025-12-04T07:56:46.0244323Z 2025-12-04T07:56:46.0244512Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:46.0244986Z """ 2025-12-04T07:56:46.0245484Z Dictionary of users with a list of features they have opted into 2025-12-04T07:56:46.0246113Z """ 2025-12-04T07:56:46.0246311Z 2025-12-04T07:56:46.0246318Z 2025-12-04T07:56:46.0246638Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:46.0247255Z """ 2025-12-04T07:56:46.0247921Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T07:56:46.0248578Z 2025-12-04T07:56:46.0249157Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:46.0250381Z - Example line: "@User1,lf,split_build" 2025-12-04T07:56:46.0251052Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:46.0251508Z 2025-12-04T07:56:46.0251515Z 2025-12-04T07:56:46.0251671Z """ 2025-12-04T07:56:46.0252038Z optins = UserOptins() 2025-12-04T07:56:46.0252514Z for user in user_optin_text.split("\n"): 2025-12-04T07:56:46.0253049Z user = user.strip("\r\n\t -") 2025-12-04T07:56:46.0253772Z if not user or not user.startswith("@"): 2025-12-04T07:56:46.0254309Z # Not a valid user. Skip 2025-12-04T07:56:46.0254781Z continue 2025-12-04T07:56:46.0255023Z 2025-12-04T07:56:46.0255181Z if user: 2025-12-04T07:56:46.0255601Z usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:46.0256266Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:46.0256732Z 2025-12-04T07:56:46.0256892Z return optins 2025-12-04T07:56:46.0257126Z 2025-12-04T07:56:46.0257133Z 2025-12-04T07:56:46.0257398Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:46.0257970Z """ 2025-12-04T07:56:46.0258356Z Check if the experiment name is valid. 2025-12-04T07:56:46.0258855Z A valid name: 2025-12-04T07:56:46.0259655Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:46.0260568Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:46.0261266Z - Cannot contain spaces 2025-12-04T07:56:46.0261715Z """ 2025-12-04T07:56:46.0261913Z 2025-12-04T07:56:46.0262163Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:46.0262829Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:46.0263254Z 2025-12-04T07:56:46.0263409Z if valid: 2025-12-04T07:56:46.0263774Z return True 2025-12-04T07:56:46.0264008Z 2025-12-04T07:56:46.0264170Z log.error( 2025-12-04T07:56:46.0265535Z 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-12-04T07:56:46.0267034Z ) 2025-12-04T07:56:46.0267383Z return False 2025-12-04T07:56:46.0267612Z 2025-12-04T07:56:46.0267618Z 2025-12-04T07:56:46.0267902Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:46.0268497Z """ 2025-12-04T07:56:46.0269207Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:46.0270093Z """ 2025-12-04T07:56:46.0270432Z try: 2025-12-04T07:56:46.0270790Z if settings_text: 2025-12-04T07:56:46.0271474Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:46.0272220Z # for easy reading 2025-12-04T07:56:46.0272963Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:46.0273799Z # the backtick character in shell commands. 2025-12-04T07:56:46.0274376Z backtick = chr(96) # backtick character 2025-12-04T07:56:46.0275010Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:46.0275641Z settings = load_yaml(settings_text) 2025-12-04T07:56:46.0276000Z 2025-12-04T07:56:46.0276401Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:46.0277110Z experiments = {} 2025-12-04T07:56:46.0277399Z 2025-12-04T07:56:46.0277738Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:46.0278450Z if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:46.0279665Z # 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-12-04T07:56:46.0280815Z continue 2025-12-04T07:56:46.0281132Z 2025-12-04T07:56:46.0281308Z valid_settings = {} 2025-12-04T07:56:46.0281833Z for setting in exp_settings: 2025-12-04T07:56:46.0282379Z if setting not in Experiment._fields: 2025-12-04T07:56:46.0282912Z log.warning( 2025-12-04T07:56:46.0283591Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:46.0284421Z ) 2025-12-04T07:56:46.0284831Z else: 2025-12-04T07:56:46.0285328Z valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:46.0285729Z 2025-12-04T07:56:46.0285994Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:46.0286592Z return Settings(experiments) 2025-12-04T07:56:46.0286933Z 2025-12-04T07:56:46.0287102Z except Exception: 2025-12-04T07:56:46.0287554Z log.exception("Failed to parse settings") 2025-12-04T07:56:46.0287930Z 2025-12-04T07:56:46.0288089Z return Settings() 2025-12-04T07:56:46.0288336Z 2025-12-04T07:56:46.0288342Z 2025-12-04T07:56:46.0288580Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:46.0289117Z """ 2025-12-04T07:56:46.0289780Z Parse settings, if any, from the rollout state. 2025-12-04T07:56:46.0290177Z 2025-12-04T07:56:46.0290517Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:46.0291241Z and the text below is the list of opted in users. 2025-12-04T07:56:46.0291622Z 2025-12-04T07:56:46.0291998Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:46.0292693Z """ 2025-12-04T07:56:46.0293220Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.0293925Z return parse_settings_from_text(settings_text) 2025-12-04T07:56:46.0294303Z 2025-12-04T07:56:46.0294310Z 2025-12-04T07:56:46.0294543Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:46.0295065Z """ 2025-12-04T07:56:46.0295440Z Parse users from the rollout state. 2025-12-04T07:56:46.0295771Z 2025-12-04T07:56:46.0295919Z """ 2025-12-04T07:56:46.0296421Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:46.0297105Z return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:46.0297488Z 2025-12-04T07:56:46.0297495Z 2025-12-04T07:56:46.0298026Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.0298737Z """ 2025-12-04T07:56:46.0299133Z Check if a user is opted into an experiment 2025-12-04T07:56:46.0299868Z """ 2025-12-04T07:56:46.0300343Z return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:46.0300749Z 2025-12-04T07:56:46.0300756Z 2025-12-04T07:56:46.0301146Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:46.0301844Z """ 2025-12-04T07:56:46.0302305Z Check if a user explicitly opted out of an experiment 2025-12-04T07:56:46.0302867Z """ 2025-12-04T07:56:46.0303346Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:46.0303989Z experiment_optout = "-" + experiment_name 2025-12-04T07:56:46.0304769Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:46.0305811Z return False 2025-12-04T07:56:46.0306208Z 2025-12-04T07:56:46.0306629Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:46.0307571Z log.warning( 2025-12-04T07:56:46.0308806Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:46.0309916Z ) 2025-12-04T07:56:46.0310137Z 2025-12-04T07:56:46.0310291Z return True 2025-12-04T07:56:46.0310513Z 2025-12-04T07:56:46.0310521Z 2025-12-04T07:56:46.0310689Z def get_runner_prefix( 2025-12-04T07:56:46.0311110Z rollout_state: str, 2025-12-04T07:56:46.0311552Z workflow_requestors: Iterable[str], 2025-12-04T07:56:46.0312033Z branch: str, 2025-12-04T07:56:46.0312504Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.0313136Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:46.0313698Z is_canary: bool = False, 2025-12-04T07:56:46.0314314Z ) -> str: 2025-12-04T07:56:46.0314723Z settings = parse_settings(rollout_state) 2025-12-04T07:56:46.0315274Z user_optins = parse_users(rollout_state) 2025-12-04T07:56:46.0315638Z 2025-12-04T07:56:46.0315802Z fleet_prefix = "" 2025-12-04T07:56:46.0316204Z prefixes = [] 2025-12-04T07:56:46.0316793Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:46.0317705Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:46.0318377Z log.info( 2025-12-04T07:56:46.0319039Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:46.0320352Z ) 2025-12-04T07:56:46.0320720Z continue 2025-12-04T07:56:46.0320960Z 2025-12-04T07:56:46.0321133Z if opt_out_experiments: 2025-12-04T07:56:46.0321663Z if experiment_name in opt_out_experiments: 2025-12-04T07:56:46.0322270Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:46.0322826Z log.info( 2025-12-04T07:56:46.0323703Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:46.0324610Z ) 2025-12-04T07:56:46.0324989Z continue 2025-12-04T07:56:46.0325241Z 2025-12-04T07:56:46.0325414Z if eligible_experiments: 2025-12-04T07:56:46.0325940Z if experiment_name not in eligible_experiments: 2025-12-04T07:56:46.0326540Z exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:46.0327059Z log.info( 2025-12-04T07:56:46.0327789Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:46.0328569Z ) 2025-12-04T07:56:46.0328945Z continue 2025-12-04T07:56:46.0329570Z elif not experiment_settings.default: 2025-12-04T07:56:46.0330130Z log.info( 2025-12-04T07:56:46.0330887Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:46.0331593Z ) 2025-12-04T07:56:46.0331957Z continue 2025-12-04T07:56:46.0332194Z 2025-12-04T07:56:46.0332452Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:46.0333032Z opted_out_users = [ 2025-12-04T07:56:46.0333450Z requestor 2025-12-04T07:56:46.0333889Z for requestor in workflow_requestors 2025-12-04T07:56:46.0334522Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.0335109Z ] 2025-12-04T07:56:46.0335310Z 2025-12-04T07:56:46.0335477Z if opted_out_users: 2025-12-04T07:56:46.0335908Z log.info( 2025-12-04T07:56:46.0336493Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:46.0337141Z ) 2025-12-04T07:56:46.0337509Z continue 2025-12-04T07:56:46.0337899Z 2025-12-04T07:56:46.0338271Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:46.0338869Z opted_in_users = [ 2025-12-04T07:56:46.0339286Z requestor 2025-12-04T07:56:46.0339948Z for requestor in workflow_requestors 2025-12-04T07:56:46.0340581Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:46.0341196Z ] 2025-12-04T07:56:46.0341394Z 2025-12-04T07:56:46.0341560Z enabled = False 2025-12-04T07:56:46.0341974Z if opted_in_users: 2025-12-04T07:56:46.0342401Z log.info( 2025-12-04T07:56:46.0342969Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:46.0343626Z ) 2025-12-04T07:56:46.0343993Z enabled = True 2025-12-04T07:56:46.0344267Z 2025-12-04T07:56:46.0344472Z elif experiment_settings.rollout_perc: 2025-12-04T07:56:46.0345417Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:46.0346286Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:46.0346899Z log.info( 2025-12-04T07:56:46.0347722Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:46.0348586Z ) 2025-12-04T07:56:46.0348972Z enabled = True 2025-12-04T07:56:46.0349268Z 2025-12-04T07:56:46.0349535Z if enabled: 2025-12-04T07:56:46.0349949Z label = experiment_name 2025-12-04T07:56:46.0350471Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:46.0351250Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:46.0352070Z # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:46.0352799Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:46.0353415Z if is_canary: 2025-12-04T07:56:46.0353881Z label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:46.0354403Z fleet_prefix = label 2025-12-04T07:56:46.0354878Z else: 2025-12-04T07:56:46.0355286Z prefixes.append(label) 2025-12-04T07:56:46.0355611Z 2025-12-04T07:56:46.0355780Z if len(prefixes) > 1: 2025-12-04T07:56:46.0356203Z log.error( 2025-12-04T07:56:46.0357155Z 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-12-04T07:56:46.0358192Z ) 2025-12-04T07:56:46.0358559Z prefixes = prefixes[:1] 2025-12-04T07:56:46.0358858Z 2025-12-04T07:56:46.0359029Z # Fleet always comes first 2025-12-04T07:56:46.0359570Z if fleet_prefix: 2025-12-04T07:56:46.0359997Z prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:46.0360342Z 2025-12-04T07:56:46.0360724Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:46.0361126Z 2025-12-04T07:56:46.0361132Z 2025-12-04T07:56:46.0361538Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:46.0362257Z """ 2025-12-04T07:56:46.0362803Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:46.0363332Z 2025-12-04T07:56:46.0363687Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:46.0364356Z """ 2025-12-04T07:56:46.0364723Z gh = get_gh_client(github_token) 2025-12-04T07:56:46.0365233Z issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:46.0365832Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:46.0366254Z 2025-12-04T07:56:46.0366260Z 2025-12-04T07:56:46.0366662Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:46.0367384Z for _ in range(num_retries): 2025-12-04T07:56:46.0367826Z try: 2025-12-04T07:56:46.0368241Z req = Request(url=url, headers=headers) 2025-12-04T07:56:46.0368874Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:46.0369720Z return json.loads(content) 2025-12-04T07:56:46.0370243Z except Exception as e: 2025-12-04T07:56:46.0370758Z log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:46.0371139Z 2025-12-04T07:56:46.0371491Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:46.0372171Z return {} 2025-12-04T07:56:46.0372391Z 2025-12-04T07:56:46.0372398Z 2025-12-04T07:56:46.0372548Z @cache 2025-12-04T07:56:46.0373123Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:46.0373830Z """ 2025-12-04T07:56:46.0374211Z Dynamically get PR information 2025-12-04T07:56:46.0374829Z """ 2025-12-04T07:56:46.0375305Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:46.0375897Z headers = { 2025-12-04T07:56:46.0376326Z "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:46.0376903Z "Authorization": f"token {github_token}", 2025-12-04T07:56:46.0377402Z } 2025-12-04T07:56:46.0377802Z json_response: dict[str, Any] = download_json( 2025-12-04T07:56:46.0378380Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:46.0378895Z headers=headers, 2025-12-04T07:56:46.0379305Z ) 2025-12-04T07:56:46.0379735Z 2025-12-04T07:56:46.0379924Z if not json_response: 2025-12-04T07:56:46.0380483Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:46.0381075Z return {} 2025-12-04T07:56:46.0381311Z 2025-12-04T07:56:46.0381477Z return json_response 2025-12-04T07:56:46.0381745Z 2025-12-04T07:56:46.0381752Z 2025-12-04T07:56:46.0382149Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:46.0382840Z """ 2025-12-04T07:56:46.0383344Z Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:46.0383950Z """ 2025-12-04T07:56:46.0384426Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:46.0384991Z return { 2025-12-04T07:56:46.0385538Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:46.0386190Z } 2025-12-04T07:56:46.0386384Z 2025-12-04T07:56:46.0386391Z 2025-12-04T07:56:46.0386548Z def main() -> None: 2025-12-04T07:56:46.0386965Z args = parse_args() 2025-12-04T07:56:46.0387221Z 2025-12-04T07:56:46.0387428Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:46.0387796Z 2025-12-04T07:56:46.0387974Z # Check if the PR is opt-out 2025-12-04T07:56:46.0388426Z if args.pr_number: 2025-12-04T07:56:46.0389049Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:46.0390032Z if OPT_OUT_LABEL in labels: 2025-12-04T07:56:46.0390506Z log.info( 2025-12-04T07:56:46.0391157Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:46.0391863Z ) 2025-12-04T07:56:46.0392381Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.0392999Z sys.exit() 2025-12-04T07:56:46.0393254Z 2025-12-04T07:56:46.0393401Z try: 2025-12-04T07:56:46.0393809Z rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:46.0394474Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:46.0395069Z ) 2025-12-04T07:56:46.0395272Z 2025-12-04T07:56:46.0395463Z username = get_potential_pr_author( 2025-12-04T07:56:46.0395994Z args.github_token, 2025-12-04T07:56:46.0396438Z args.github_repo, 2025-12-04T07:56:46.0396888Z args.github_actor, 2025-12-04T07:56:46.0397340Z args.github_ref_type, 2025-12-04T07:56:46.0397816Z args.github_branch, 2025-12-04T07:56:46.0398265Z ) 2025-12-04T07:56:46.0398476Z 2025-12-04T07:56:46.0398736Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:46.0399160Z 2025-12-04T07:56:46.0399474Z runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:46.0400001Z rollout_state, 2025-12-04T07:56:46.0400485Z (args.github_issue_owner, username), 2025-12-04T07:56:46.0401019Z args.github_branch, 2025-12-04T07:56:46.0401493Z args.eligible_experiments, 2025-12-04T07:56:46.0401996Z args.opt_out_experiments, 2025-12-04T07:56:46.0402473Z is_canary, 2025-12-04T07:56:46.0402857Z ) 2025-12-04T07:56:46.0403061Z 2025-12-04T07:56:46.0403237Z except Exception as e: 2025-12-04T07:56:46.0403658Z log.error( 2025-12-04T07:56:46.0404285Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:46.0405137Z ) 2025-12-04T07:56:46.0405333Z 2025-12-04T07:56:46.0405675Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:46.0406154Z 2025-12-04T07:56:46.0406162Z 2025-12-04T07:56:46.0406332Z if __name__ == "__main__": 2025-12-04T07:56:46.0406748Z main() 2025-12-04T07:56:46.0406949Z 2025-12-04T07:56:46.0497031Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:46.0497858Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:46.0531018Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:46.0531463Z env: 2025-12-04T07:56:46.0532020Z GITHUB_TOKEN: *** 2025-12-04T07:56:46.0532408Z ISSUE_NUMBER: 5132 2025-12-04T07:56:46.0532832Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:46.0533311Z ISSUE_OWNER: 2025-12-04T07:56:46.0533684Z CHECK_EXPERIMENTS: 2025-12-04T07:56:46.0534088Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:46.0534487Z PR_NUMBER: 2025-12-04T07:56:46.0534843Z ##[endgroup] 2025-12-04T07:56:47.1335425Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T07:56:47.8568485Z Collecting urllib3==1.26.18 2025-12-04T07:56:47.8900737Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T07:56:47.9091651Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 5.2 MB/s eta 0:00:00 2025-12-04T07:56:47.9323222Z Collecting PyGithub==2.3.0 2025-12-04T07:56:47.9358447Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T07:56:47.9799900Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T07:56:47.9832338Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T07:56:47.9875268Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T07:56:47.9891724Z 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-12-04T07:56:47.9906133Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T07:56:48.0167546Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T07:56:48.0201281Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T07:56:48.0432494Z 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-12-04T07:56:48.1591808Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:48.1643432Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T07:56:48.3212984Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T07:56:48.3250049Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T07:56:48.3445582Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:48.3478696Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T07:56:48.3719647Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T07:56:48.3864488Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 10.8 MB/s eta 0:00:00 2025-12-04T07:56:48.3932960Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T07:56:48.4068624Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 29.0 MB/s eta 0:00:00 2025-12-04T07:56:48.4102454Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T07:56:48.4384030Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 52.8 MB/s eta 0:00:00 2025-12-04T07:56:48.4418258Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T07:56:48.4473603Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T07:56:48.4534977Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 48.3 MB/s eta 0:00:00 2025-12-04T07:56:48.4567558Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T07:56:48.4613466Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 42.9 MB/s eta 0:00:00 2025-12-04T07:56:48.4645672Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T07:56:48.4686007Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 44.9 MB/s eta 0:00:00 2025-12-04T07:56:48.7671493Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T07:56:49.3042511Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T07:56:49.3876725Z ##[group]Run curr_branch="main" 2025-12-04T07:56:49.3877038Z curr_branch="main" 2025-12-04T07:56:49.3877266Z curr_ref_type="branch" 2025-12-04T07:56:49.3877519Z echo "Current branch is '$curr_branch'" 2025-12-04T07:56:49.3877820Z  2025-12-04T07:56:49.3878002Z python3 runner_determinator.py \ 2025-12-04T07:56:49.3878283Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T07:56:49.3878558Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T07:56:49.3878815Z  --github-branch "$curr_branch" \ 2025-12-04T07:56:49.3879081Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T07:56:49.3879358Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T07:56:49.3879815Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T07:56:49.3880083Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T07:56:49.3880390Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T07:56:49.3880763Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T07:56:49.3881055Z  --pr-number "${PR_NUMBER}" 2025-12-04T07:56:49.3914259Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:49.3914496Z env: 2025-12-04T07:56:49.3915054Z GITHUB_TOKEN: *** 2025-12-04T07:56:49.3915244Z ISSUE_NUMBER: 5132 2025-12-04T07:56:49.3915450Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:49.3915681Z ISSUE_OWNER: 2025-12-04T07:56:49.3915882Z CHECK_EXPERIMENTS: 2025-12-04T07:56:49.3916071Z OPT_OUT_EXPERIMENTS: 2025-12-04T07:56:49.3916274Z PR_NUMBER: 2025-12-04T07:56:49.3916440Z ##[endgroup] 2025-12-04T07:56:49.3966029Z Current branch is 'main' 2025-12-04T07:56:50.7155582Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-12-04T07:56:50.7156783Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T07:56:50.7157835Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T07:56:50.7158851Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T07:56:50.7159990Z INFO : Setting output: label-type='lf.' 2025-12-04T07:56:50.7483549Z Evaluate and set job outputs 2025-12-04T07:56:50.7489961Z Set output 'label-type' 2025-12-04T07:56:50.7491877Z Cleaning up orphan processes