2025-08-14T20:43:47.3735082Z Current runner version: '2.327.1' 2025-08-14T20:43:47.3767907Z ##[group]Runner Image Provisioner 2025-08-14T20:43:47.3769154Z Hosted Compute Agent 2025-08-14T20:43:47.3770003Z Version: 20250812.370 2025-08-14T20:43:47.3770938Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:43:47.3772093Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:43:47.3772982Z ##[endgroup] 2025-08-14T20:43:47.3773895Z ##[group]Operating System 2025-08-14T20:43:47.3774754Z Ubuntu 2025-08-14T20:43:47.3775518Z 24.04.2 2025-08-14T20:43:47.3776507Z LTS 2025-08-14T20:43:47.3777258Z ##[endgroup] 2025-08-14T20:43:47.3777986Z ##[group]Runner Image 2025-08-14T20:43:47.3779008Z Image: ubuntu-24.04 2025-08-14T20:43:47.3779961Z Version: 20250804.2.0 2025-08-14T20:43:47.3781683Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:43:47.3784919Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:43:47.3786844Z ##[endgroup] 2025-08-14T20:43:47.3788431Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:43:47.3791416Z Metadata: read 2025-08-14T20:43:47.3792309Z ##[endgroup] 2025-08-14T20:43:47.3795142Z Secret source: Actions 2025-08-14T20:43:47.3796689Z Prepare workflow directory 2025-08-14T20:43:47.4523356Z Prepare all required actions 2025-08-14T20:43:47.4606259Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:43:47.4613527Z ##[group] Inputs 2025-08-14T20:43:47.4614577Z check_experiments: 2025-08-14T20:43:47.4615456Z opt_out_experiments: 2025-08-14T20:43:47.4616697Z triggering_actor: pytorchmergebot 2025-08-14T20:43:47.4617629Z issue_owner: 2025-08-14T20:43:47.4618448Z curr_branch: main 2025-08-14T20:43:47.4619452Z curr_ref_type: branch 2025-08-14T20:43:47.4620292Z issue_number: 5132 2025-08-14T20:43:47.4621280Z ##[endgroup] 2025-08-14T20:43:47.4622246Z Complete job name: get-label-type / runner-determinator 2025-08-14T20:43:47.9588870Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:43:47.9591408Z cat < runner_determinator.py 2025-08-14T20:43:47.9592251Z # flake8: noqa: G004 2025-08-14T20:43:47.9592804Z  2025-08-14T20:43:47.9593633Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:47.9594835Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:47.9596012Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:47.9596797Z  2025-08-14T20:43:47.9597297Z """ 2025-08-14T20:43:47.9598079Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:47.9599171Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:47.9600460Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:47.9601494Z of which runners should be used to run which job. 2025-08-14T20:43:47.9602207Z  2025-08-14T20:43:47.9603027Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:47.9604118Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:47.9605192Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:47.9606489Z list, defined. 2025-08-14T20:43:47.9607018Z  2025-08-14T20:43:47.9607722Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:47.9608896Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:47.9610113Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:47.9610849Z  2025-08-14T20:43:47.9611685Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:47.9613023Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:47.9613935Z experiments which the user could be opted in to. 2025-08-14T20:43:47.9614714Z  2025-08-14T20:43:47.9615213Z The user list has the following rules: 2025-08-14T20:43:47.9616066Z  2025-08-14T20:43:47.9616877Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:47.9617925Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:47.9618881Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:47.9619574Z  2025-08-14T20:43:47.9620086Z Example config: 2025-08-14T20:43:47.9620686Z  # A list of experiments that can be opted into. 2025-08-14T20:43:47.9621604Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:47.9622438Z  # Expected syntax is: 2025-08-14T20:43:47.9623251Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:47.9700110Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:47.9701368Z  2025-08-14T20:43:47.9701777Z  experiments: 2025-08-14T20:43:47.9702248Z  lf: 2025-08-14T20:43:47.9702699Z  rollout_percent: 25 2025-08-14T20:43:47.9703240Z  all_branches: false 2025-08-14T20:43:47.9703930Z  default: true 2025-08-14T20:43:47.9704420Z  --- 2025-08-14T20:43:47.9704829Z  2025-08-14T20:43:47.9705215Z  # Opt-ins: 2025-08-14T20:43:47.9706193Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:47.9707432Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:47.9708335Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:47.9709129Z  # Experiments should be from the above list. 2025-08-14T20:43:47.9709776Z  2025-08-14T20:43:47.9710247Z  @User1,-lf,split_build 2025-08-14T20:43:47.9710815Z  @User2,lf 2025-08-14T20:43:47.9711335Z  @User3,split_build 2025-08-14T20:43:47.9711832Z """ 2025-08-14T20:43:47.9712233Z  2025-08-14T20:43:47.9712622Z import json 2025-08-14T20:43:47.9713079Z import logging 2025-08-14T20:43:47.9713533Z import os 2025-08-14T20:43:47.9713960Z import random 2025-08-14T20:43:47.9714415Z import re 2025-08-14T20:43:47.9714845Z import sys 2025-08-14T20:43:47.9715329Z from argparse import ArgumentParser 2025-08-14T20:43:47.9716176Z from collections.abc import Iterable 2025-08-14T20:43:47.9716857Z from functools import cache 2025-08-14T20:43:47.9717420Z from logging import LogRecord 2025-08-14T20:43:47.9718015Z from typing import Any, NamedTuple 2025-08-14T20:43:47.9718665Z from urllib.request import Request, urlopen 2025-08-14T20:43:47.9719272Z  2025-08-14T20:43:47.9719664Z import yaml 2025-08-14T20:43:47.9720143Z from github import Auth, Github 2025-08-14T20:43:47.9720727Z from github.Issue import Issue 2025-08-14T20:43:47.9721274Z  2025-08-14T20:43:47.9721654Z  2025-08-14T20:43:47.9722124Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:47.9722925Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:47.9723930Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:47.9724722Z  2025-08-14T20:43:47.9725217Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:47.9726153Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:47.9726779Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:47.9727459Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:47.9728037Z  2025-08-14T20:43:47.9728489Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:47.9729213Z  2025-08-14T20:43:47.9729840Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:47.9730395Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:47.9730913Z  2025-08-14T20:43:47.9731286Z  2025-08-14T20:43:47.9731708Z class Experiment(NamedTuple): 2025-08-14T20:43:47.9732279Z  rollout_perc: float = ( 2025-08-14T20:43:47.9733048Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:47.9733822Z  ) 2025-08-14T20:43:47.9734260Z  all_branches: bool = ( 2025-08-14T20:43:47.9735037Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:47.9735953Z  ) 2025-08-14T20:43:47.9736389Z  default: bool = ( 2025-08-14T20:43:47.9737073Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:47.9737795Z  ) 2025-08-14T20:43:47.9738198Z  2025-08-14T20:43:47.9738608Z  # Add more fields as needed 2025-08-14T20:43:47.9739142Z  2025-08-14T20:43:47.9739512Z  2025-08-14T20:43:47.9739927Z class Settings(NamedTuple): 2025-08-14T20:43:47.9740463Z  """ 2025-08-14T20:43:47.9741013Z  Settings for the experiments that can be opted into. 2025-08-14T20:43:47.9741674Z  """ 2025-08-14T20:43:47.9742077Z  2025-08-14T20:43:47.9742535Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:43:47.9743110Z  2025-08-14T20:43:47.9743702Z  2025-08-14T20:43:47.9744183Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:47.9745012Z  """Color codes the log messages based on the log level""" 2025-08-14T20:43:47.9745670Z  2025-08-14T20:43:47.9746162Z  COLORS = { 2025-08-14T20:43:47.9746650Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:47.9747232Z  "ERROR": "\033[31m", # Red 2025-08-14T20:43:47.9747806Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:47.9748384Z  "INFO": "\033[0m", # Reset 2025-08-14T20:43:47.9748951Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:47.9749496Z  } 2025-08-14T20:43:47.9749900Z  2025-08-14T20:43:47.9750372Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:43:47.9751263Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:47.9752146Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:47.9752820Z  return super().format(record) 2025-08-14T20:43:47.9753397Z  2025-08-14T20:43:47.9753822Z  2025-08-14T20:43:47.9754301Z handler = logging.StreamHandler() 2025-08-14T20:43:47.9755124Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:47.9756036Z  2025-08-14T20:43:47.9756553Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:47.9757221Z log.addHandler(handler) 2025-08-14T20:43:47.9757759Z log.setLevel(logging.INFO) 2025-08-14T20:43:47.9758273Z  2025-08-14T20:43:47.9758657Z  2025-08-14T20:43:47.9759167Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:47.9759812Z  """ 2025-08-14T20:43:47.9760404Z  Defines outputs of the github action that invokes this script 2025-08-14T20:43:47.9761117Z  """ 2025-08-14T20:43:47.9761684Z  if not GITHUB_OUTPUT: 2025-08-14T20:43:47.9762879Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:47.9764133Z  log.warning( 2025-08-14T20:43:47.9765120Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:47.9766278Z  ) 2025-08-14T20:43:47.9766797Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:43:47.9767400Z  return 2025-08-14T20:43:47.9767847Z  2025-08-14T20:43:47.9768284Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:47.9768954Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:47.9769605Z  f.write(f"{key}={value}\n") 2025-08-14T20:43:47.9770161Z  2025-08-14T20:43:47.9770548Z  2025-08-14T20:43:47.9771128Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:47.9771883Z  return frozenset( 2025-08-14T20:43:47.9772617Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:47.9773383Z  ) 2025-08-14T20:43:47.9773799Z  2025-08-14T20:43:47.9774184Z  2025-08-14T20:43:47.9774598Z def parse_args() -> Any: 2025-08-14T20:43:47.9775305Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:47.9776446Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:47.9777330Z  parser.add_argument( 2025-08-14T20:43:47.9777893Z  "--github-issue-repo", 2025-08-14T20:43:47.9778450Z  type=str, 2025-08-14T20:43:47.9778950Z  required=False, 2025-08-14T20:43:47.9779642Z  default="pytorch/test-infra", 2025-08-14T20:43:47.9780296Z  help="GitHub repo to get the issue", 2025-08-14T20:43:47.9780885Z  ) 2025-08-14T20:43:47.9781325Z  parser.add_argument( 2025-08-14T20:43:47.9781861Z  "--github-repo", 2025-08-14T20:43:47.9782386Z  type=str, 2025-08-14T20:43:47.9782889Z  required=True, 2025-08-14T20:43:47.9783465Z  help="GitHub repo where CI is running", 2025-08-14T20:43:47.9784072Z  ) 2025-08-14T20:43:47.9784516Z  parser.add_argument( 2025-08-14T20:43:47.9785253Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:47.9786264Z  ) 2025-08-14T20:43:47.9786703Z  parser.add_argument( 2025-08-14T20:43:47.9787451Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:47.9788237Z  ) 2025-08-14T20:43:47.9788690Z  parser.add_argument( 2025-08-14T20:43:47.9789450Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:47.9790236Z  ) 2025-08-14T20:43:47.9790683Z  parser.add_argument( 2025-08-14T20:43:47.9791470Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:47.9792267Z  ) 2025-08-14T20:43:47.9792720Z  parser.add_argument( 2025-08-14T20:43:47.9793265Z  "--github-ref-type", 2025-08-14T20:43:47.9793807Z  type=str, 2025-08-14T20:43:47.9794307Z  required=True, 2025-08-14T20:43:47.9794922Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:47.9795553Z  ) 2025-08-14T20:43:47.9796092Z  parser.add_argument( 2025-08-14T20:43:47.9796664Z  "--eligible-experiments", 2025-08-14T20:43:47.9797415Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.9798021Z  required=False, 2025-08-14T20:43:47.9798530Z  default="", 2025-08-14T20:43:47.9799524Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:47.9800564Z  ) 2025-08-14T20:43:47.9800996Z  parser.add_argument( 2025-08-14T20:43:47.9801742Z  "--opt-out-experiments", 2025-08-14T20:43:47.9802357Z  type=_str_comma_separated_to_set, 2025-08-14T20:43:47.9802956Z  required=False, 2025-08-14T20:43:47.9803474Z  default="", 2025-08-14T20:43:47.9803952Z  help=( 2025-08-14T20:43:47.9804746Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:47.9806121Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:47.9807086Z  ), 2025-08-14T20:43:47.9807522Z  ) 2025-08-14T20:43:47.9807971Z  parser.add_argument( 2025-08-14T20:43:47.9808501Z  "--pr-number", 2025-08-14T20:43:47.9809016Z  type=str, 2025-08-14T20:43:47.9809506Z  required=False, 2025-08-14T20:43:47.9810022Z  default="", 2025-08-14T20:43:47.9810616Z  help="the optional PR number where this is run", 2025-08-14T20:43:47.9811246Z  ) 2025-08-14T20:43:47.9811658Z  2025-08-14T20:43:47.9812086Z  return parser.parse_args() 2025-08-14T20:43:47.9812647Z  2025-08-14T20:43:47.9813033Z  2025-08-14T20:43:47.9813715Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.9814762Z  auth = Auth.Token(github_token) 2025-08-14T20:43:47.9815400Z  return Github(auth=auth) 2025-08-14T20:43:47.9816096Z  2025-08-14T20:43:47.9816480Z  2025-08-14T20:43:47.9817225Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:47.9818148Z  repo = gh.get_repo(repo) 2025-08-14T20:43:47.9818755Z  return repo.get_issue(number=issue_num) 2025-08-14T20:43:47.9819349Z  2025-08-14T20:43:47.9819744Z  2025-08-14T20:43:47.9820168Z def get_potential_pr_author( 2025-08-14T20:43:47.9820935Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:47.9821711Z ) -> str: 2025-08-14T20:43:47.9822331Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:47.9823259Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:47.9824140Z  # embedded in the tag name: ciflow// 2025-08-14T20:43:47.9824789Z  2025-08-14T20:43:47.9825224Z  gh = get_gh_client(github_token) 2025-08-14T20:43:47.9825872Z  2025-08-14T20:43:47.9826409Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:47.9827130Z  split_tag = ref_name.split("/") 2025-08-14T20:43:47.9827718Z  if ( 2025-08-14T20:43:47.9828184Z  len(split_tag) == 3 2025-08-14T20:43:47.9828770Z  and split_tag[0] == "ciflow" 2025-08-14T20:43:47.9829394Z  and split_tag[2].isnumeric() 2025-08-14T20:43:47.9829970Z  ): 2025-08-14T20:43:47.9830456Z  pr_number = split_tag[2] 2025-08-14T20:43:47.9831023Z  try: 2025-08-14T20:43:47.9831551Z  repository = gh.get_repo(repo) 2025-08-14T20:43:47.9832264Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:47.9833123Z  except Exception as e: 2025-08-14T20:43:47.9833743Z  raise Exception( # noqa: TRY002 2025-08-14T20:43:47.9834517Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:47.9835266Z  ) from e 2025-08-14T20:43:47.9836027Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:47.9836847Z  # In all other cases, return the original input username 2025-08-14T20:43:47.9837534Z  return username 2025-08-14T20:43:47.9838021Z  2025-08-14T20:43:47.9838412Z  2025-08-14T20:43:47.9838890Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:47.9839506Z  """ 2025-08-14T20:43:47.9840259Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:47.9841159Z  """ 2025-08-14T20:43:47.9841790Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:47.9842551Z  2025-08-14T20:43:47.9842940Z  2025-08-14T20:43:47.9843380Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:47.9843966Z  try: 2025-08-14T20:43:47.9844426Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:43:47.9845061Z  return data 2025-08-14T20:43:47.9845565Z  except yaml.YAMLError: 2025-08-14T20:43:47.9846258Z  log.exception("Error loading YAML") 2025-08-14T20:43:47.9846845Z  raise 2025-08-14T20:43:47.9847298Z  2025-08-14T20:43:47.9847686Z  2025-08-14T20:43:47.9848380Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:47.9849219Z  """ 2025-08-14T20:43:47.9850075Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:47.9850931Z  2025-08-14T20:43:47.9851538Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.9852417Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.9853062Z  2025-08-14T20:43:47.9853701Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:47.9854503Z  """ 2025-08-14T20:43:47.9855035Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:47.9855862Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:43:47.9856708Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:47.9857497Z  else: 2025-08-14T20:43:47.9857965Z  return "", rollout_state 2025-08-14T20:43:47.9858500Z  2025-08-14T20:43:47.9858871Z  2025-08-14T20:43:47.9859331Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:47.9859919Z  """ 2025-08-14T20:43:47.9860524Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:43:47.9861265Z  """ 2025-08-14T20:43:47.9861664Z  2025-08-14T20:43:47.9862036Z  2025-08-14T20:43:47.9862637Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:47.9863373Z  """ 2025-08-14T20:43:47.9864192Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:47.9865133Z  2025-08-14T20:43:47.9866617Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:47.9867751Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:43:47.9868551Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:47.9869421Z  2025-08-14T20:43:47.9869795Z  2025-08-14T20:43:47.9870179Z  """ 2025-08-14T20:43:47.9870616Z  optins = UserOptins() 2025-08-14T20:43:47.9871204Z  for user in user_optin_text.split("\n"): 2025-08-14T20:43:47.9871850Z  user = user.strip("\r\n\t -") 2025-08-14T20:43:47.9872492Z  if not user or not user.startswith("@"): 2025-08-14T20:43:47.9873127Z  # Not a valid user. Skip 2025-08-14T20:43:47.9873692Z  continue 2025-08-14T20:43:47.9874199Z  2025-08-14T20:43:47.9874587Z  if user: 2025-08-14T20:43:47.9875131Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:47.9876027Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:47.9876745Z  2025-08-14T20:43:47.9877146Z  return optins 2025-08-14T20:43:47.9877613Z  2025-08-14T20:43:47.9877985Z  2025-08-14T20:43:47.9878537Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:47.9879241Z  """ 2025-08-14T20:43:47.9879715Z  Check if the experiment name is valid. 2025-08-14T20:43:47.9880319Z  A valid name: 2025-08-14T20:43:47.9881077Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:47.9882156Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:47.9882967Z  - Cannot contain spaces 2025-08-14T20:43:47.9883502Z  """ 2025-08-14T20:43:47.9883910Z  2025-08-14T20:43:47.9884426Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:47.9885241Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:47.9886142Z  2025-08-14T20:43:47.9886786Z  if valid: 2025-08-14T20:43:47.9887246Z  return True 2025-08-14T20:43:47.9887716Z  2025-08-14T20:43:47.9888109Z  log.error( 2025-08-14T20:43:47.9889726Z  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-08-14T20:43:47.9891455Z  ) 2025-08-14T20:43:47.9891870Z  return False 2025-08-14T20:43:47.9892339Z  2025-08-14T20:43:47.9892713Z  2025-08-14T20:43:47.9893293Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:47.9894027Z  """ 2025-08-14T20:43:47.9894703Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:47.9895505Z  """ 2025-08-14T20:43:47.9896022Z  try: 2025-08-14T20:43:47.9896457Z  if settings_text: 2025-08-14T20:43:47.9897294Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:47.9898192Z  # for easy reading 2025-08-14T20:43:47.9899106Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:47.9900113Z  # the backtick character in shell commands. 2025-08-14T20:43:47.9900803Z  backtick = chr(96) # backtick character 2025-08-14T20:43:47.9901569Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:47.9902333Z  settings = load_yaml(settings_text) 2025-08-14T20:43:47.9902918Z  2025-08-14T20:43:47.9903585Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:47.9904563Z  experiments = {} 2025-08-14T20:43:47.9905086Z  2025-08-14T20:43:47.9905821Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:47.9906685Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:47.9907913Z  # 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-08-14T20:43:47.9909097Z  continue 2025-08-14T20:43:47.9909608Z  2025-08-14T20:43:47.9910036Z  valid_settings = {} 2025-08-14T20:43:47.9910643Z  for setting in exp_settings: 2025-08-14T20:43:47.9911293Z  if setting not in Experiment._fields: 2025-08-14T20:43:47.9911935Z  log.warning( 2025-08-14T20:43:47.9912758Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:47.9913563Z  ) 2025-08-14T20:43:47.9914065Z  else: 2025-08-14T20:43:47.9914688Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:47.9915323Z  2025-08-14T20:43:47.9915944Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:47.9916682Z  return Settings(experiments) 2025-08-14T20:43:47.9917244Z  2025-08-14T20:43:47.9917652Z  except Exception: 2025-08-14T20:43:47.9918232Z  log.exception("Failed to parse settings") 2025-08-14T20:43:47.9918832Z  2025-08-14T20:43:47.9919228Z  return Settings() 2025-08-14T20:43:47.9919711Z  2025-08-14T20:43:47.9920095Z  2025-08-14T20:43:47.9920722Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:47.9921398Z  """ 2025-08-14T20:43:47.9921911Z  Parse settings, if any, from the rollout state. 2025-08-14T20:43:47.9922533Z  2025-08-14T20:43:47.9923134Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:47.9924005Z  and the text below is the list of opted in users. 2025-08-14T20:43:47.9924632Z  2025-08-14T20:43:47.9925306Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:47.9926226Z  """ 2025-08-14T20:43:47.9926872Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.9927758Z  return parse_settings_from_text(settings_text) 2025-08-14T20:43:47.9928376Z  2025-08-14T20:43:47.9928747Z  2025-08-14T20:43:47.9929252Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:47.9929895Z  """ 2025-08-14T20:43:47.9930366Z  Parse users from the rollout state. 2025-08-14T20:43:47.9930935Z  2025-08-14T20:43:47.9931316Z  """ 2025-08-14T20:43:47.9931942Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:47.9932793Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:47.9933404Z  2025-08-14T20:43:47.9933781Z  2025-08-14T20:43:47.9934471Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.9935313Z  """ 2025-08-14T20:43:47.9935903Z  Check if a user is opted into an experiment 2025-08-14T20:43:47.9936518Z  """ 2025-08-14T20:43:47.9937070Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:47.9937714Z  2025-08-14T20:43:47.9938092Z  2025-08-14T20:43:47.9938924Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:47.9939777Z  """ 2025-08-14T20:43:47.9940326Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:43:47.9940972Z  """ 2025-08-14T20:43:47.9941577Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:47.9942361Z  experiment_optout = "-" + experiment_name 2025-08-14T20:43:47.9943112Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:47.9943792Z  return False 2025-08-14T20:43:47.9944270Z  2025-08-14T20:43:47.9944825Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:47.9945507Z  log.warning( 2025-08-14T20:43:47.9946549Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:47.9947527Z  ) 2025-08-14T20:43:47.9947956Z  2025-08-14T20:43:47.9948349Z  return True 2025-08-14T20:43:47.9948810Z  2025-08-14T20:43:47.9949185Z  2025-08-14T20:43:47.9949585Z def get_runner_prefix( 2025-08-14T20:43:47.9950108Z  rollout_state: str, 2025-08-14T20:43:47.9950664Z  workflow_requestors: Iterable[str], 2025-08-14T20:43:47.9951258Z  branch: str, 2025-08-14T20:43:47.9951856Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.9952626Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:47.9953292Z  is_canary: bool = False, 2025-08-14T20:43:47.9953827Z ) -> str: 2025-08-14T20:43:47.9954341Z  settings = parse_settings(rollout_state) 2025-08-14T20:43:47.9955015Z  user_optins = parse_users(rollout_state) 2025-08-14T20:43:47.9955602Z  2025-08-14T20:43:47.9956226Z  fleet_prefix = "" 2025-08-14T20:43:47.9956749Z  prefixes = [] 2025-08-14T20:43:47.9957493Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:47.9958547Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:47.9959357Z  log.info( 2025-08-14T20:43:47.9960142Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:47.9960976Z  ) 2025-08-14T20:43:47.9961442Z  continue 2025-08-14T20:43:47.9961913Z  2025-08-14T20:43:47.9962333Z  if opt_out_experiments: 2025-08-14T20:43:47.9962972Z  if experiment_name in opt_out_experiments: 2025-08-14T20:43:47.9963721Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:47.9964387Z  log.info( 2025-08-14T20:43:47.9965450Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:47.9966606Z  ) 2025-08-14T20:43:47.9967091Z  continue 2025-08-14T20:43:47.9967577Z  2025-08-14T20:43:47.9968001Z  if eligible_experiments: 2025-08-14T20:43:47.9968670Z  if experiment_name not in eligible_experiments: 2025-08-14T20:43:47.9969397Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:47.9970030Z  log.info( 2025-08-14T20:43:47.9970925Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:47.9971856Z  ) 2025-08-14T20:43:47.9972339Z  continue 2025-08-14T20:43:47.9973057Z  elif not experiment_settings.default: 2025-08-14T20:43:47.9973658Z  log.info( 2025-08-14T20:43:47.9974423Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:47.9975236Z  ) 2025-08-14T20:43:47.9975867Z  continue 2025-08-14T20:43:47.9976348Z  2025-08-14T20:43:47.9976878Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:47.9977584Z  opted_out_users = [ 2025-08-14T20:43:47.9978127Z  requestor 2025-08-14T20:43:47.9978677Z  for requestor in workflow_requestors 2025-08-14T20:43:47.9979447Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.9980148Z  ] 2025-08-14T20:43:47.9980566Z  2025-08-14T20:43:47.9980970Z  if opted_out_users: 2025-08-14T20:43:47.9981540Z  log.info( 2025-08-14T20:43:47.9982280Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:47.9983063Z  ) 2025-08-14T20:43:47.9983528Z  continue 2025-08-14T20:43:47.9984000Z  2025-08-14T20:43:47.9984531Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:47.9985228Z  opted_in_users = [ 2025-08-14T20:43:47.9986289Z  requestor 2025-08-14T20:43:47.9986961Z  for requestor in workflow_requestors 2025-08-14T20:43:47.9987715Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:47.9988401Z  ] 2025-08-14T20:43:47.9988809Z  2025-08-14T20:43:47.9989201Z  enabled = False 2025-08-14T20:43:47.9989713Z  if opted_in_users: 2025-08-14T20:43:47.9990435Z  log.info( 2025-08-14T20:43:47.9991142Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:47.9991877Z  ) 2025-08-14T20:43:47.9992328Z  enabled = True 2025-08-14T20:43:47.9992813Z  2025-08-14T20:43:47.9993268Z  elif experiment_settings.rollout_perc: 2025-08-14T20:43:47.9994164Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:47.9995199Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:47.9996094Z  log.info( 2025-08-14T20:43:47.9997074Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:47.9998086Z  ) 2025-08-14T20:43:47.9998561Z  enabled = True 2025-08-14T20:43:47.9999082Z  2025-08-14T20:43:47.9999458Z  if enabled: 2025-08-14T20:43:47.9999965Z  label = experiment_name 2025-08-14T20:43:48.0000593Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.0001494Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.0002462Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.0003310Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.0004034Z  if is_canary: 2025-08-14T20:43:48.0004613Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.0005213Z  fleet_prefix = label 2025-08-14T20:43:48.0005857Z  else: 2025-08-14T20:43:48.0006366Z  prefixes.append(label) 2025-08-14T20:43:48.0007047Z  2025-08-14T20:43:48.0007441Z  if len(prefixes) > 1: 2025-08-14T20:43:48.0007960Z  log.error( 2025-08-14T20:43:48.0009107Z  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-08-14T20:43:48.0010308Z  ) 2025-08-14T20:43:48.0010762Z  prefixes = prefixes[:1] 2025-08-14T20:43:48.0011283Z  2025-08-14T20:43:48.0011694Z  # Fleet always comes first 2025-08-14T20:43:48.0012231Z  if fleet_prefix: 2025-08-14T20:43:48.0012765Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.0013311Z  2025-08-14T20:43:48.0013804Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.0014432Z  2025-08-14T20:43:48.0014795Z  2025-08-14T20:43:48.0015498Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.0016447Z  """ 2025-08-14T20:43:48.0017105Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.0017879Z  2025-08-14T20:43:48.0018520Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.0019298Z  """ 2025-08-14T20:43:48.0019747Z  gh = get_gh_client(github_token) 2025-08-14T20:43:48.0020372Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.0021091Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.0021751Z  2025-08-14T20:43:48.0022121Z  2025-08-14T20:43:48.0022774Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.0023748Z  for _ in range(num_retries): 2025-08-14T20:43:48.0024299Z  try: 2025-08-14T20:43:48.0024799Z  req = Request(url=url, headers=headers) 2025-08-14T20:43:48.0025537Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.0026366Z  return json.loads(content) 2025-08-14T20:43:48.0026953Z  except Exception as e: 2025-08-14T20:43:48.0027581Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.0028191Z  2025-08-14T20:43:48.0028810Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.0029597Z  return {} 2025-08-14T20:43:48.0030021Z  2025-08-14T20:43:48.0030389Z  2025-08-14T20:43:48.0030753Z @cache 2025-08-14T20:43:48.0031456Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.0032292Z  """ 2025-08-14T20:43:48.0032752Z  Dynamically get PR information 2025-08-14T20:43:48.0033308Z  """ 2025-08-14T20:43:48.0033874Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.0034561Z  headers = { 2025-08-14T20:43:48.0035088Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.0035864Z  "Authorization": f"token {github_token}", 2025-08-14T20:43:48.0036449Z  } 2025-08-14T20:43:48.0036949Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.0037621Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.0038223Z  headers=headers, 2025-08-14T20:43:48.0038725Z  ) 2025-08-14T20:43:48.0039111Z  2025-08-14T20:43:48.0039609Z  if not json_response: 2025-08-14T20:43:48.0040279Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.0041117Z  return {} 2025-08-14T20:43:48.0041583Z  2025-08-14T20:43:48.0041999Z  return json_response 2025-08-14T20:43:48.0042503Z  2025-08-14T20:43:48.0042869Z  2025-08-14T20:43:48.0043537Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.0044359Z  """ 2025-08-14T20:43:48.0045010Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.0045840Z  """ 2025-08-14T20:43:48.0046414Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.0047105Z  return { 2025-08-14T20:43:48.0047772Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.0048548Z  } 2025-08-14T20:43:48.0048950Z  2025-08-14T20:43:48.0049335Z  2025-08-14T20:43:48.0049744Z def main() -> None: 2025-08-14T20:43:48.0050260Z  args = parse_args() 2025-08-14T20:43:48.0050757Z  2025-08-14T20:43:48.0051235Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.0051833Z  2025-08-14T20:43:48.0052258Z  # Check if the PR is opt-out 2025-08-14T20:43:48.0052827Z  if args.pr_number: 2025-08-14T20:43:48.0053591Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.0054437Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.0055006Z  log.info( 2025-08-14T20:43:48.0055900Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.0056743Z  ) 2025-08-14T20:43:48.0057387Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.0058171Z  sys.exit() 2025-08-14T20:43:48.0058784Z  2025-08-14T20:43:48.0059171Z  try: 2025-08-14T20:43:48.0059680Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.0060491Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.0061198Z  ) 2025-08-14T20:43:48.0061617Z  2025-08-14T20:43:48.0062064Z  username = get_potential_pr_author( 2025-08-14T20:43:48.0062672Z  args.github_token, 2025-08-14T20:43:48.0063243Z  args.github_repo, 2025-08-14T20:43:48.0063797Z  args.github_actor, 2025-08-14T20:43:48.0064377Z  args.github_ref_type, 2025-08-14T20:43:48.0064942Z  args.github_branch, 2025-08-14T20:43:48.0065476Z  ) 2025-08-14T20:43:48.0065995Z  2025-08-14T20:43:48.0066538Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.0067226Z  2025-08-14T20:43:48.0067691Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.0068309Z  rollout_state, 2025-08-14T20:43:48.0068887Z  (args.github_issue_owner, username), 2025-08-14T20:43:48.0069506Z  args.github_branch, 2025-08-14T20:43:48.0070088Z  args.eligible_experiments, 2025-08-14T20:43:48.0070702Z  args.opt_out_experiments, 2025-08-14T20:43:48.0071274Z  is_canary, 2025-08-14T20:43:48.0071760Z  ) 2025-08-14T20:43:48.0072182Z  2025-08-14T20:43:48.0072592Z  except Exception as e: 2025-08-14T20:43:48.0073128Z  log.error( 2025-08-14T20:43:48.0073907Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.0074765Z  ) 2025-08-14T20:43:48.0075192Z  2025-08-14T20:43:48.0076020Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.0076779Z  2025-08-14T20:43:48.0077157Z  2025-08-14T20:43:48.0077563Z if __name__ == "__main__": 2025-08-14T20:43:48.0078080Z  main() 2025-08-14T20:43:48.0078506Z  2025-08-14T20:43:48.0078878Z EOF 2025-08-14T20:43:48.0079272Z  2025-08-14T20:43:48.0079685Z cat runner_determinator.py 2025-08-14T20:43:48.0472527Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.0473503Z env: 2025-08-14T20:43:48.0474287Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.0474728Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.0475203Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.0475894Z ISSUE_OWNER: 2025-08-14T20:43:48.0476328Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.0476780Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.0477225Z PR_NUMBER: 2025-08-14T20:43:48.0477620Z ##[endgroup] 2025-08-14T20:43:48.0697517Z # flake8: noqa: G004 2025-08-14T20:43:48.0697889Z 2025-08-14T20:43:48.0698332Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:43:48.0699326Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:43:48.0700165Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:43:48.0700611Z 2025-08-14T20:43:48.0700784Z """ 2025-08-14T20:43:48.0701370Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:43:48.0702266Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:43:48.0703187Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:43:48.0704010Z of which runners should be used to run which job. 2025-08-14T20:43:48.0704409Z 2025-08-14T20:43:48.0704796Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:43:48.0706126Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:43:48.0707122Z settings are considered to be empty with only the second part, the user 2025-08-14T20:43:48.0707829Z list, defined. 2025-08-14T20:43:48.0708067Z 2025-08-14T20:43:48.0708439Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:43:48.0709386Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:43:48.0710212Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:43:48.0710653Z 2025-08-14T20:43:48.0711029Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:43:48.0711901Z The user list is also a comma separated list of additional features or 2025-08-14T20:43:48.0712637Z experiments which the user could be opted in to. 2025-08-14T20:43:48.0713041Z 2025-08-14T20:43:48.0713250Z The user list has the following rules: 2025-08-14T20:43:48.0713604Z 2025-08-14T20:43:48.0713920Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:43:48.0714799Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:43:48.0715578Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:43:48.0716706Z 2025-08-14T20:43:48.0716907Z Example config: 2025-08-14T20:43:48.0717373Z # A list of experiments that can be opted into. 2025-08-14T20:43:48.0718057Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:43:48.0718688Z # Expected syntax is: 2025-08-14T20:43:48.0719340Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:43:48.0720336Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:43:48.0720951Z 2025-08-14T20:43:48.0721126Z experiments: 2025-08-14T20:43:48.0721526Z lf: 2025-08-14T20:43:48.0721914Z rollout_percent: 25 2025-08-14T20:43:48.0722376Z all_branches: false 2025-08-14T20:43:48.0723022Z default: true 2025-08-14T20:43:48.0723443Z --- 2025-08-14T20:43:48.0723646Z 2025-08-14T20:43:48.0723815Z # Opt-ins: 2025-08-14T20:43:48.0724407Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:43:48.0725268Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:43:48.0726315Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:43:48.0726991Z # Experiments should be from the above list. 2025-08-14T20:43:48.0727379Z 2025-08-14T20:43:48.0727568Z @User1,-lf,split_build 2025-08-14T20:43:48.0728022Z @User2,lf 2025-08-14T20:43:48.0728410Z @User3,split_build 2025-08-14T20:43:48.0728874Z """ 2025-08-14T20:43:48.0729068Z 2025-08-14T20:43:48.0729232Z import json 2025-08-14T20:43:48.0729613Z import logging 2025-08-14T20:43:48.0730000Z import os 2025-08-14T20:43:48.0730373Z import random 2025-08-14T20:43:48.0730751Z import re 2025-08-14T20:43:48.0731122Z import sys 2025-08-14T20:43:48.0731539Z from argparse import ArgumentParser 2025-08-14T20:43:48.0732080Z from collections.abc import Iterable 2025-08-14T20:43:48.0732609Z from functools import cache 2025-08-14T20:43:48.0733087Z from logging import LogRecord 2025-08-14T20:43:48.0733580Z from typing import Any, NamedTuple 2025-08-14T20:43:48.0734126Z from urllib.request import Request, urlopen 2025-08-14T20:43:48.0734506Z 2025-08-14T20:43:48.0734675Z import yaml 2025-08-14T20:43:48.0735072Z from github import Auth, Github 2025-08-14T20:43:48.0735574Z from github.Issue import Issue 2025-08-14T20:43:48.0736179Z 2025-08-14T20:43:48.0736189Z 2025-08-14T20:43:48.0736434Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:43:48.0737137Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:43:48.0738020Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:43:48.0738597Z 2025-08-14T20:43:48.0738831Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:43:48.0739582Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:43:48.0740110Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:43:48.0740687Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:43:48.0741038Z 2025-08-14T20:43:48.0741244Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:43:48.0741574Z 2025-08-14T20:43:48.0741771Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:43:48.0742243Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:43:48.0742525Z 2025-08-14T20:43:48.0742532Z 2025-08-14T20:43:48.0742730Z class Experiment(NamedTuple): 2025-08-14T20:43:48.0743219Z rollout_perc: float = ( 2025-08-14T20:43:48.0743867Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:43:48.0744567Z ) 2025-08-14T20:43:48.0744938Z all_branches: bool = ( 2025-08-14T20:43:48.0745568Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:43:48.0746488Z ) 2025-08-14T20:43:48.0746859Z default: bool = ( 2025-08-14T20:43:48.0747454Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:43:48.0748100Z ) 2025-08-14T20:43:48.0748300Z 2025-08-14T20:43:48.0748486Z # Add more fields as needed 2025-08-14T20:43:48.0748785Z 2025-08-14T20:43:48.0748792Z 2025-08-14T20:43:48.0748991Z class Settings(NamedTuple): 2025-08-14T20:43:48.0749437Z """ 2025-08-14T20:43:48.0749891Z Settings for the experiments that can be opted into. 2025-08-14T20:43:48.0750462Z """ 2025-08-14T20:43:48.0750655Z 2025-08-14T20:43:48.0750875Z experiments: dict[str, Experiment] = {} 2025-08-14T20:43:48.0751243Z 2025-08-14T20:43:48.0751250Z 2025-08-14T20:43:48.0751464Z class ColorFormatter(logging.Formatter): 2025-08-14T20:43:48.0752098Z """Color codes the log messages based on the log level""" 2025-08-14T20:43:48.0752532Z 2025-08-14T20:43:48.0752702Z COLORS = { 2025-08-14T20:43:48.0753102Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:43:48.0753614Z "ERROR": "\033[31m", # Red 2025-08-14T20:43:48.0754251Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:43:48.0754759Z "INFO": "\033[0m", # Reset 2025-08-14T20:43:48.0755241Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:43:48.0755931Z } 2025-08-14T20:43:48.0756144Z 2025-08-14T20:43:48.0756390Z def format(self, record: LogRecord) -> str: 2025-08-14T20:43:48.0757186Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:43:48.0757974Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:43:48.0758553Z return super().format(record) 2025-08-14T20:43:48.0758888Z 2025-08-14T20:43:48.0758896Z 2025-08-14T20:43:48.0759103Z handler = logging.StreamHandler() 2025-08-14T20:43:48.0759820Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:43:48.0760381Z 2025-08-14T20:43:48.0760628Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:43:48.0761210Z log.addHandler(handler) 2025-08-14T20:43:48.0761665Z log.setLevel(logging.INFO) 2025-08-14T20:43:48.0761957Z 2025-08-14T20:43:48.0761965Z 2025-08-14T20:43:48.0762223Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:43:48.0762781Z """ 2025-08-14T20:43:48.0763289Z Defines outputs of the github action that invokes this script 2025-08-14T20:43:48.0763921Z """ 2025-08-14T20:43:48.0764296Z if not GITHUB_OUTPUT: 2025-08-14T20:43:48.0765369Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:43:48.0766716Z log.warning( 2025-08-14T20:43:48.0767576Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:43:48.0768503Z ) 2025-08-14T20:43:48.0778395Z print(f"::set-output name={key}::{value}") 2025-08-14T20:43:48.0779023Z return 2025-08-14T20:43:48.0779274Z 2025-08-14T20:43:48.0779677Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:43:48.0780320Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:43:48.0780908Z f.write(f"{key}={value}\n") 2025-08-14T20:43:48.0781239Z 2025-08-14T20:43:48.0781246Z 2025-08-14T20:43:48.0781567Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:43:48.0782209Z return frozenset( 2025-08-14T20:43:48.0782839Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:43:48.0783531Z ) 2025-08-14T20:43:48.0783736Z 2025-08-14T20:43:48.0783742Z 2025-08-14T20:43:48.0783933Z def parse_args() -> Any: 2025-08-14T20:43:48.0784494Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:43:48.0785388Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:43:48.0786511Z parser.add_argument( 2025-08-14T20:43:48.0786992Z "--github-issue-repo", 2025-08-14T20:43:48.0787473Z type=str, 2025-08-14T20:43:48.0787903Z required=False, 2025-08-14T20:43:48.0788380Z default="pytorch/test-infra", 2025-08-14T20:43:48.0788923Z help="GitHub repo to get the issue", 2025-08-14T20:43:48.0789448Z ) 2025-08-14T20:43:48.0789833Z parser.add_argument( 2025-08-14T20:43:48.0790283Z "--github-repo", 2025-08-14T20:43:48.0790729Z type=str, 2025-08-14T20:43:48.0791147Z required=True, 2025-08-14T20:43:48.0791628Z help="GitHub repo where CI is running", 2025-08-14T20:43:48.0792172Z ) 2025-08-14T20:43:48.0792563Z parser.add_argument( 2025-08-14T20:43:48.0793185Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:43:48.0793863Z ) 2025-08-14T20:43:48.0794234Z parser.add_argument( 2025-08-14T20:43:48.0794873Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:43:48.0795557Z ) 2025-08-14T20:43:48.0796128Z parser.add_argument( 2025-08-14T20:43:48.0796779Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:43:48.0797641Z ) 2025-08-14T20:43:48.0798014Z parser.add_argument( 2025-08-14T20:43:48.0798683Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:43:48.0799406Z ) 2025-08-14T20:43:48.0799786Z parser.add_argument( 2025-08-14T20:43:48.0800249Z "--github-ref-type", 2025-08-14T20:43:48.0800708Z type=str, 2025-08-14T20:43:48.0801116Z required=True, 2025-08-14T20:43:48.0852178Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:43:48.0852872Z ) 2025-08-14T20:43:48.0853291Z parser.add_argument( 2025-08-14T20:43:48.0853776Z "--eligible-experiments", 2025-08-14T20:43:48.0854306Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.0854838Z required=False, 2025-08-14T20:43:48.0855266Z default="", 2025-08-14T20:43:48.0856441Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:43:48.0857453Z ) 2025-08-14T20:43:48.0857829Z parser.add_argument( 2025-08-14T20:43:48.0858311Z "--opt-out-experiments", 2025-08-14T20:43:48.0858822Z type=_str_comma_separated_to_set, 2025-08-14T20:43:48.0859351Z required=False, 2025-08-14T20:43:48.0859784Z default="", 2025-08-14T20:43:48.0860190Z help=( 2025-08-14T20:43:48.0860868Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:43:48.0862014Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:43:48.0862847Z ), 2025-08-14T20:43:48.0863203Z ) 2025-08-14T20:43:48.0863576Z parser.add_argument( 2025-08-14T20:43:48.0864012Z "--pr-number", 2025-08-14T20:43:48.0864432Z type=str, 2025-08-14T20:43:48.0864832Z required=False, 2025-08-14T20:43:48.0865251Z default="", 2025-08-14T20:43:48.0866170Z help="the optional PR number where this is run", 2025-08-14T20:43:48.0866799Z ) 2025-08-14T20:43:48.0867001Z 2025-08-14T20:43:48.0867202Z return parser.parse_args() 2025-08-14T20:43:48.0867511Z 2025-08-14T20:43:48.0867519Z 2025-08-14T20:43:48.0867926Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.0868687Z auth = Auth.Token(github_token) 2025-08-14T20:43:48.0869199Z return Github(auth=auth) 2025-08-14T20:43:48.0869505Z 2025-08-14T20:43:48.0869513Z 2025-08-14T20:43:48.0869967Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:43:48.0870784Z repo = gh.get_repo(repo) 2025-08-14T20:43:48.0871301Z return repo.get_issue(number=issue_num) 2025-08-14T20:43:48.0871667Z 2025-08-14T20:43:48.0871673Z 2025-08-14T20:43:48.0871874Z def get_potential_pr_author( 2025-08-14T20:43:48.0872516Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:43:48.0873207Z ) -> str: 2025-08-14T20:43:48.0873722Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:43:48.0874531Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:43:48.0875283Z # embedded in the tag name: ciflow// 2025-08-14T20:43:48.0875902Z 2025-08-14T20:43:48.0876119Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.0876460Z 2025-08-14T20:43:48.0876733Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:43:48.0877355Z split_tag = ref_name.split("/") 2025-08-14T20:43:48.0877864Z if ( 2025-08-14T20:43:48.0878256Z len(split_tag) == 3 2025-08-14T20:43:48.0878751Z and split_tag[0] == "ciflow" 2025-08-14T20:43:48.0879297Z and split_tag[2].isnumeric() 2025-08-14T20:43:48.0880227Z ): 2025-08-14T20:43:48.0880945Z pr_number = split_tag[2] 2025-08-14T20:43:48.0881877Z try: 2025-08-14T20:43:48.0882888Z repository = gh.get_repo(repo) 2025-08-14T20:43:48.0884136Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:43:48.0885329Z except Exception as e: 2025-08-14T20:43:48.0886494Z raise Exception( # noqa: TRY002 2025-08-14T20:43:48.0887715Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:43:48.0888801Z ) from e 2025-08-14T20:43:48.0889665Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:43:48.0890982Z # In all other cases, return the original input username 2025-08-14T20:43:48.0892376Z return username 2025-08-14T20:43:48.0892887Z 2025-08-14T20:43:48.0892899Z 2025-08-14T20:43:48.0893312Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:43:48.0894281Z """ 2025-08-14T20:43:48.0895517Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:43:48.0897005Z """ 2025-08-14T20:43:48.0897652Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:43:48.0898189Z 2025-08-14T20:43:48.0898197Z 2025-08-14T20:43:48.0898408Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:43:48.0898914Z try: 2025-08-14T20:43:48.0899309Z data = yaml.safe_load(yaml_text) 2025-08-14T20:43:48.0899828Z return data 2025-08-14T20:43:48.0900262Z except yaml.YAMLError: 2025-08-14T20:43:48.0900814Z log.exception("Error loading YAML") 2025-08-14T20:43:48.0901346Z raise 2025-08-14T20:43:48.0901563Z 2025-08-14T20:43:48.0901570Z 2025-08-14T20:43:48.0901999Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:43:48.0902779Z """ 2025-08-14T20:43:48.0903415Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:43:48.0904018Z 2025-08-14T20:43:48.0904563Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.0905349Z and the text below is the list of opted in users. 2025-08-14T20:43:48.0906000Z 2025-08-14T20:43:48.0906416Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:43:48.0907595Z """ 2025-08-14T20:43:48.0908054Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:43:48.0908674Z if len(rollout_state_parts) >= 2: 2025-08-14T20:43:48.0909290Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:43:48.0909942Z else: 2025-08-14T20:43:48.0910325Z return "", rollout_state 2025-08-14T20:43:48.0910637Z 2025-08-14T20:43:48.0910644Z 2025-08-14T20:43:48.0910847Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:43:48.0911361Z """ 2025-08-14T20:43:48.0911886Z Dictionary of users with a list of features they have opted into 2025-08-14T20:43:48.0912586Z """ 2025-08-14T20:43:48.0912787Z 2025-08-14T20:43:48.0912794Z 2025-08-14T20:43:48.0913157Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:43:48.0913807Z """ 2025-08-14T20:43:48.0914519Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:43:48.0915196Z 2025-08-14T20:43:48.0916008Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:43:48.0917022Z - Example line: "@User1,lf,split_build" 2025-08-14T20:43:48.0917709Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:43:48.0918193Z 2025-08-14T20:43:48.0918201Z 2025-08-14T20:43:48.0918361Z """ 2025-08-14T20:43:48.0918736Z optins = UserOptins() 2025-08-14T20:43:48.0919223Z for user in user_optin_text.split("\n"): 2025-08-14T20:43:48.0919787Z user = user.strip("\r\n\t -") 2025-08-14T20:43:48.0920336Z if not user or not user.startswith("@"): 2025-08-14T20:43:48.0920901Z # Not a valid user. Skip 2025-08-14T20:43:48.0921552Z continue 2025-08-14T20:43:48.0921801Z 2025-08-14T20:43:48.0921971Z if user: 2025-08-14T20:43:48.0922415Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:43:48.0923105Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:43:48.0923603Z 2025-08-14T20:43:48.0923772Z return optins 2025-08-14T20:43:48.0924008Z 2025-08-14T20:43:48.0924016Z 2025-08-14T20:43:48.0924303Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:43:48.0924905Z """ 2025-08-14T20:43:48.0925303Z Check if the experiment name is valid. 2025-08-14T20:43:48.0926032Z A valid name: 2025-08-14T20:43:48.0926682Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:43:48.0927696Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:43:48.0928443Z - Cannot contain spaces 2025-08-14T20:43:48.0928920Z """ 2025-08-14T20:43:48.0929130Z 2025-08-14T20:43:48.0929393Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:43:48.0930104Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:43:48.0930559Z 2025-08-14T20:43:48.0930728Z if valid: 2025-08-14T20:43:48.0931122Z return True 2025-08-14T20:43:48.0931361Z 2025-08-14T20:43:48.0931526Z log.error( 2025-08-14T20:43:48.0932999Z 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-08-14T20:43:48.0934569Z ) 2025-08-14T20:43:48.0934931Z return False 2025-08-14T20:43:48.0935163Z 2025-08-14T20:43:48.0935170Z 2025-08-14T20:43:48.0935485Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:43:48.0936364Z """ 2025-08-14T20:43:48.0937110Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:43:48.0937862Z """ 2025-08-14T20:43:48.0938224Z try: 2025-08-14T20:43:48.0938600Z if settings_text: 2025-08-14T20:43:48.0939335Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:43:48.0940140Z # for easy reading 2025-08-14T20:43:48.0940933Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:43:48.0941823Z # the backtick character in shell commands. 2025-08-14T20:43:48.0942427Z backtick = chr(96) # backtick character 2025-08-14T20:43:48.0943097Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:43:48.0943758Z settings = load_yaml(settings_text) 2025-08-14T20:43:48.0944147Z 2025-08-14T20:43:48.0944574Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:43:48.0945353Z experiments = {} 2025-08-14T20:43:48.0945649Z 2025-08-14T20:43:48.0946299Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:43:48.0947095Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:43:48.0948220Z # 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-08-14T20:43:48.0949279Z continue 2025-08-14T20:43:48.0949566Z 2025-08-14T20:43:48.0949756Z valid_settings = {} 2025-08-14T20:43:48.0950276Z for setting in exp_settings: 2025-08-14T20:43:48.0950852Z if setting not in Experiment._fields: 2025-08-14T20:43:48.0951404Z log.warning( 2025-08-14T20:43:48.0952120Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:43:48.0952856Z ) 2025-08-14T20:43:48.0953445Z else: 2025-08-14T20:43:48.0953960Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:43:48.0954395Z 2025-08-14T20:43:48.0954673Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:43:48.0955312Z return Settings(experiments) 2025-08-14T20:43:48.0955666Z 2025-08-14T20:43:48.0956404Z except Exception: 2025-08-14T20:43:48.0956955Z log.exception("Failed to parse settings") 2025-08-14T20:43:48.0957351Z 2025-08-14T20:43:48.0957530Z return Settings() 2025-08-14T20:43:48.0957793Z 2025-08-14T20:43:48.0957799Z 2025-08-14T20:43:48.0958054Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:43:48.0958630Z """ 2025-08-14T20:43:48.0959072Z Parse settings, if any, from the rollout state. 2025-08-14T20:43:48.0959481Z 2025-08-14T20:43:48.0959852Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:43:48.0960627Z and the text below is the list of opted in users. 2025-08-14T20:43:48.0961039Z 2025-08-14T20:43:48.0961451Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:43:48.0962191Z """ 2025-08-14T20:43:48.0962758Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.0963519Z return parse_settings_from_text(settings_text) 2025-08-14T20:43:48.0963923Z 2025-08-14T20:43:48.0963930Z 2025-08-14T20:43:48.0964177Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:43:48.0964737Z """ 2025-08-14T20:43:48.0965130Z Parse users from the rollout state. 2025-08-14T20:43:48.0965482Z 2025-08-14T20:43:48.0965639Z """ 2025-08-14T20:43:48.0966385Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:43:48.0967152Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:43:48.0967555Z 2025-08-14T20:43:48.0967563Z 2025-08-14T20:43:48.0968140Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.0968902Z """ 2025-08-14T20:43:48.0969325Z Check if a user is opted into an experiment 2025-08-14T20:43:48.0969872Z """ 2025-08-14T20:43:48.0970326Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:43:48.0970747Z 2025-08-14T20:43:48.0970753Z 2025-08-14T20:43:48.0971180Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:43:48.0971941Z """ 2025-08-14T20:43:48.0972411Z Check if a user explicitly opted out of an experiment 2025-08-14T20:43:48.0972991Z """ 2025-08-14T20:43:48.0973495Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:43:48.0974189Z experiment_optout = "-" + experiment_name 2025-08-14T20:43:48.0974830Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:43:48.0975434Z return False 2025-08-14T20:43:48.0975816Z 2025-08-14T20:43:48.0976112Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:43:48.0976727Z log.warning( 2025-08-14T20:43:48.0977543Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:43:48.0978449Z ) 2025-08-14T20:43:48.0978664Z 2025-08-14T20:43:48.0978838Z return True 2025-08-14T20:43:48.0979074Z 2025-08-14T20:43:48.0979081Z 2025-08-14T20:43:48.0979269Z def get_runner_prefix( 2025-08-14T20:43:48.0979713Z rollout_state: str, 2025-08-14T20:43:48.0980188Z workflow_requestors: Iterable[str], 2025-08-14T20:43:48.0980710Z branch: str, 2025-08-14T20:43:48.0981211Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.0981875Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:43:48.0982482Z is_canary: bool = False, 2025-08-14T20:43:48.0982947Z ) -> str: 2025-08-14T20:43:48.0983374Z settings = parse_settings(rollout_state) 2025-08-14T20:43:48.0984108Z user_optins = parse_users(rollout_state) 2025-08-14T20:43:48.0984508Z 2025-08-14T20:43:48.0984690Z fleet_prefix = "" 2025-08-14T20:43:48.0985125Z prefixes = [] 2025-08-14T20:43:48.0985864Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:43:48.0986814Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:43:48.0987526Z log.info( 2025-08-14T20:43:48.0988245Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:43:48.0989006Z ) 2025-08-14T20:43:48.0989398Z continue 2025-08-14T20:43:48.0989648Z 2025-08-14T20:43:48.0989849Z if opt_out_experiments: 2025-08-14T20:43:48.0990394Z if experiment_name in opt_out_experiments: 2025-08-14T20:43:48.0991056Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:43:48.0991644Z log.info( 2025-08-14T20:43:48.0992598Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:43:48.0993579Z ) 2025-08-14T20:43:48.0993991Z continue 2025-08-14T20:43:48.0994266Z 2025-08-14T20:43:48.0994463Z if eligible_experiments: 2025-08-14T20:43:48.0995067Z if experiment_name not in eligible_experiments: 2025-08-14T20:43:48.0995804Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:43:48.0996371Z log.info( 2025-08-14T20:43:48.0997162Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:43:48.0998007Z ) 2025-08-14T20:43:48.0998409Z continue 2025-08-14T20:43:48.0998898Z elif not experiment_settings.default: 2025-08-14T20:43:48.0999435Z log.info( 2025-08-14T20:43:48.1000225Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:43:48.1000980Z ) 2025-08-14T20:43:48.1001359Z continue 2025-08-14T20:43:48.1001608Z 2025-08-14T20:43:48.1001890Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:43:48.1002506Z opted_out_users = [ 2025-08-14T20:43:48.1002955Z requestor 2025-08-14T20:43:48.1003411Z for requestor in workflow_requestors 2025-08-14T20:43:48.1004082Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.1004721Z ] 2025-08-14T20:43:48.1004927Z 2025-08-14T20:43:48.1005117Z if opted_out_users: 2025-08-14T20:43:48.1005578Z log.info( 2025-08-14T20:43:48.1006312Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:43:48.1007016Z ) 2025-08-14T20:43:48.1007405Z continue 2025-08-14T20:43:48.1007651Z 2025-08-14T20:43:48.1007941Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:43:48.1008608Z opted_in_users = [ 2025-08-14T20:43:48.1009070Z requestor 2025-08-14T20:43:48.1009538Z for requestor in workflow_requestors 2025-08-14T20:43:48.1010218Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:43:48.1010851Z ] 2025-08-14T20:43:48.1011068Z 2025-08-14T20:43:48.1011252Z enabled = False 2025-08-14T20:43:48.1011696Z if opted_in_users: 2025-08-14T20:43:48.1012156Z log.info( 2025-08-14T20:43:48.1012777Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:43:48.1013479Z ) 2025-08-14T20:43:48.1013877Z enabled = True 2025-08-14T20:43:48.1014158Z 2025-08-14T20:43:48.1014384Z elif experiment_settings.rollout_perc: 2025-08-14T20:43:48.1015237Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:43:48.1016516Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:43:48.1017181Z log.info( 2025-08-14T20:43:48.1018059Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:43:48.1018992Z ) 2025-08-14T20:43:48.1019412Z enabled = True 2025-08-14T20:43:48.1019709Z 2025-08-14T20:43:48.1019878Z if enabled: 2025-08-14T20:43:48.1020313Z label = experiment_name 2025-08-14T20:43:48.1020864Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:43:48.1021702Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:43:48.1022606Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:43:48.1023382Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:43:48.1024061Z if is_canary: 2025-08-14T20:43:48.1024564Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:43:48.1025123Z fleet_prefix = label 2025-08-14T20:43:48.1025610Z else: 2025-08-14T20:43:48.1026162Z prefixes.append(label) 2025-08-14T20:43:48.1026509Z 2025-08-14T20:43:48.1026695Z if len(prefixes) > 1: 2025-08-14T20:43:48.1027153Z log.error( 2025-08-14T20:43:48.1028194Z 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-08-14T20:43:48.1029317Z ) 2025-08-14T20:43:48.1029719Z prefixes = prefixes[:1] 2025-08-14T20:43:48.1030030Z 2025-08-14T20:43:48.1030225Z # Fleet always comes first 2025-08-14T20:43:48.1030710Z if fleet_prefix: 2025-08-14T20:43:48.1031166Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:43:48.1031531Z 2025-08-14T20:43:48.1031924Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:43:48.1032353Z 2025-08-14T20:43:48.1032360Z 2025-08-14T20:43:48.1032820Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:43:48.1033611Z """ 2025-08-14T20:43:48.1034205Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:43:48.1034773Z 2025-08-14T20:43:48.1035168Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:43:48.1035995Z """ 2025-08-14T20:43:48.1036381Z gh = get_gh_client(github_token) 2025-08-14T20:43:48.1036931Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:43:48.1037578Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:43:48.1038031Z 2025-08-14T20:43:48.1038038Z 2025-08-14T20:43:48.1038452Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:43:48.1039225Z for _ in range(num_retries): 2025-08-14T20:43:48.1039721Z try: 2025-08-14T20:43:48.1040164Z req = Request(url=url, headers=headers) 2025-08-14T20:43:48.1040835Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:43:48.1041490Z return json.loads(content) 2025-08-14T20:43:48.1042020Z except Exception as e: 2025-08-14T20:43:48.1042573Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:43:48.1042981Z 2025-08-14T20:43:48.1043377Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:43:48.1044093Z return {} 2025-08-14T20:43:48.1044318Z 2025-08-14T20:43:48.1044330Z 2025-08-14T20:43:48.1044492Z @cache 2025-08-14T20:43:48.1045118Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:43:48.1045987Z """ 2025-08-14T20:43:48.1046390Z Dynamically get PR information 2025-08-14T20:43:48.1046889Z """ 2025-08-14T20:43:48.1047405Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:43:48.1048177Z headers = { 2025-08-14T20:43:48.1048645Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:43:48.1049258Z "Authorization": f"token {github_token}", 2025-08-14T20:43:48.1049804Z } 2025-08-14T20:43:48.1050238Z json_response: dict[str, Any] = download_json( 2025-08-14T20:43:48.1050856Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:43:48.1051402Z headers=headers, 2025-08-14T20:43:48.1051832Z ) 2025-08-14T20:43:48.1052034Z 2025-08-14T20:43:48.1052220Z if not json_response: 2025-08-14T20:43:48.1052791Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:43:48.1053694Z return {} 2025-08-14T20:43:48.1053942Z 2025-08-14T20:43:48.1054129Z return json_response 2025-08-14T20:43:48.1054411Z 2025-08-14T20:43:48.1054424Z 2025-08-14T20:43:48.1054831Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:43:48.1055584Z """ 2025-08-14T20:43:48.1056241Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:43:48.1056941Z """ 2025-08-14T20:43:48.1057440Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:43:48.1058068Z return { 2025-08-14T20:43:48.1058668Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:43:48.1059385Z } 2025-08-14T20:43:48.1059588Z 2025-08-14T20:43:48.1059595Z 2025-08-14T20:43:48.1059771Z def main() -> None: 2025-08-14T20:43:48.1060195Z args = parse_args() 2025-08-14T20:43:48.1060467Z 2025-08-14T20:43:48.1060691Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:43:48.1061085Z 2025-08-14T20:43:48.1061282Z # Check if the PR is opt-out 2025-08-14T20:43:48.1061779Z if args.pr_number: 2025-08-14T20:43:48.1062438Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:43:48.1063360Z if OPT_OUT_LABEL in labels: 2025-08-14T20:43:48.1063894Z log.info( 2025-08-14T20:43:48.1064600Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:43:48.1065360Z ) 2025-08-14T20:43:48.1066033Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.1066712Z sys.exit() 2025-08-14T20:43:48.1066979Z 2025-08-14T20:43:48.1067147Z try: 2025-08-14T20:43:48.1067591Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:43:48.1068308Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:43:48.1068954Z ) 2025-08-14T20:43:48.1069161Z 2025-08-14T20:43:48.1069371Z username = get_potential_pr_author( 2025-08-14T20:43:48.1069923Z args.github_token, 2025-08-14T20:43:48.1070409Z args.github_repo, 2025-08-14T20:43:48.1070899Z args.github_actor, 2025-08-14T20:43:48.1071386Z args.github_ref_type, 2025-08-14T20:43:48.1071901Z args.github_branch, 2025-08-14T20:43:48.1072368Z ) 2025-08-14T20:43:48.1072576Z 2025-08-14T20:43:48.1072875Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:43:48.1073331Z 2025-08-14T20:43:48.1073567Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:43:48.1074122Z rollout_state, 2025-08-14T20:43:48.1074618Z (args.github_issue_owner, username), 2025-08-14T20:43:48.1075172Z args.github_branch, 2025-08-14T20:43:48.1075776Z args.eligible_experiments, 2025-08-14T20:43:48.1076340Z args.opt_out_experiments, 2025-08-14T20:43:48.1076853Z is_canary, 2025-08-14T20:43:48.1077274Z ) 2025-08-14T20:43:48.1077485Z 2025-08-14T20:43:48.1077672Z except Exception as e: 2025-08-14T20:43:48.1078133Z log.error( 2025-08-14T20:43:48.1078800Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:43:48.1079713Z ) 2025-08-14T20:43:48.1079922Z 2025-08-14T20:43:48.1080260Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:43:48.1080765Z 2025-08-14T20:43:48.1080773Z 2025-08-14T20:43:48.1080957Z if __name__ == "__main__": 2025-08-14T20:43:48.1081402Z main() 2025-08-14T20:43:48.1081612Z 2025-08-14T20:43:48.1173730Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.1174646Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:43:48.1216074Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:48.1216590Z env: 2025-08-14T20:43:48.1217212Z GITHUB_TOKEN: *** 2025-08-14T20:43:48.1217620Z ISSUE_NUMBER: 5132 2025-08-14T20:43:48.1218058Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:48.1218569Z ISSUE_OWNER: 2025-08-14T20:43:48.1218984Z CHECK_EXPERIMENTS: 2025-08-14T20:43:48.1219403Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:48.1219847Z PR_NUMBER: 2025-08-14T20:43:48.1220229Z ##[endgroup] 2025-08-14T20:43:49.1920014Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:43:49.8667726Z Collecting urllib3==1.26.18 2025-08-14T20:43:49.9034583Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:43:49.9276781Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.9 MB/s eta 0:00:00 2025-08-14T20:43:49.9496769Z Collecting PyGithub==2.3.0 2025-08-14T20:43:49.9533834Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:43:49.9962797Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:43:50.0002626Z 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-08-14T20:43:50.0046854Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:43:50.0063929Z 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-08-14T20:43:50.0079351Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:43:50.0370105Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:43:50.0406418Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:43:50.0629178Z 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-08-14T20:43:50.1775518Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.1840603Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:43:50.2997329Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:43:50.3043386Z 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-08-14T20:43:50.3234152Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:43:50.3271277Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:43:50.3514343Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:43:50.3607231Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 18.0 MB/s eta 0:00:00 2025-08-14T20:43:50.3642466Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:43:50.3709474Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 70.1 MB/s eta 0:00:00 2025-08-14T20:43:50.3746265Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:43:50.3833916Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 123.5 MB/s eta 0:00:00 2025-08-14T20:43:50.3870835Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:43:50.3931958Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:43:50.3993711Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 108.2 MB/s eta 0:00:00 2025-08-14T20:43:50.4034122Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:43:50.4081916Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 25.0 MB/s eta 0:00:00 2025-08-14T20:43:50.4116576Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:43:50.4158339Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.0 MB/s eta 0:00:00 2025-08-14T20:43:50.7025665Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:43:51.2306304Z 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-08-14T20:43:51.3062972Z ##[group]Run curr_branch="main" 2025-08-14T20:43:51.3063287Z curr_branch="main" 2025-08-14T20:43:51.3063513Z curr_ref_type="branch" 2025-08-14T20:43:51.3063754Z echo "Current branch is '$curr_branch'" 2025-08-14T20:43:51.3064038Z  2025-08-14T20:43:51.3064221Z python3 runner_determinator.py \ 2025-08-14T20:43:51.3064497Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:43:51.3064761Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:43:51.3065005Z  --github-branch "$curr_branch" \ 2025-08-14T20:43:51.3065272Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:43:51.3065550Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:43:51.3066070Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:43:51.3066341Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:43:51.3066640Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:43:51.3067000Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:43:51.3067287Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:43:51.3109671Z shell: /usr/bin/bash -e {0} 2025-08-14T20:43:51.3109902Z env: 2025-08-14T20:43:51.3110475Z GITHUB_TOKEN: *** 2025-08-14T20:43:51.3110664Z ISSUE_NUMBER: 5132 2025-08-14T20:43:51.3110892Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:43:51.3111117Z ISSUE_OWNER: 2025-08-14T20:43:51.3111297Z CHECK_EXPERIMENTS: 2025-08-14T20:43:51.3111483Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:43:51.3111668Z PR_NUMBER: 2025-08-14T20:43:51.3111828Z ##[endgroup] 2025-08-14T20:43:51.3170092Z Current branch is 'main' 2025-08-14T20:43:52.6943417Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-08-14T20:43:52.6944568Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:43:52.6945345Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:43:52.6946145Z INFO : Setting output: label-type='lf.' 2025-08-14T20:43:52.7277388Z Evaluate and set job outputs 2025-08-14T20:43:52.7283606Z Set output 'label-type' 2025-08-14T20:43:52.7285460Z Cleaning up orphan processes