2025-09-07T06:15:10.9469326Z Current runner version: '2.328.0' 2025-09-07T06:15:10.9493575Z ##[group]Runner Image Provisioner 2025-09-07T06:15:10.9494412Z Hosted Compute Agent 2025-09-07T06:15:10.9494957Z Version: 20250829.383 2025-09-07T06:15:10.9495527Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:15:10.9496288Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:15:10.9496887Z ##[endgroup] 2025-09-07T06:15:10.9497371Z ##[group]Operating System 2025-09-07T06:15:10.9498301Z Ubuntu 2025-09-07T06:15:10.9498756Z 24.04.3 2025-09-07T06:15:10.9499217Z LTS 2025-09-07T06:15:10.9499667Z ##[endgroup] 2025-09-07T06:15:10.9500213Z ##[group]Runner Image 2025-09-07T06:15:10.9500758Z Image: ubuntu-24.04 2025-09-07T06:15:10.9501260Z Version: 20250831.1.0 2025-09-07T06:15:10.9502256Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:15:10.9503783Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:15:10.9504752Z ##[endgroup] 2025-09-07T06:15:10.9505741Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:15:10.9508078Z Contents: read 2025-09-07T06:15:10.9508628Z Metadata: read 2025-09-07T06:15:10.9509494Z ##[endgroup] 2025-09-07T06:15:10.9512055Z Secret source: Actions 2025-09-07T06:15:10.9512899Z Prepare workflow directory 2025-09-07T06:15:11.0021820Z Prepare all required actions 2025-09-07T06:15:11.0080612Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:15:11.0086086Z ##[group] Inputs 2025-09-07T06:15:11.0086650Z check_experiments: 2025-09-07T06:15:11.0087325Z opt_out_experiments: 2025-09-07T06:15:11.0088055Z triggering_actor: pytorchmergebot 2025-09-07T06:15:11.0088648Z issue_owner: 2025-09-07T06:15:11.0089221Z curr_branch: main 2025-09-07T06:15:11.0089739Z curr_ref_type: branch 2025-09-07T06:15:11.0090373Z issue_number: 5132 2025-09-07T06:15:11.0090946Z ##[endgroup] 2025-09-07T06:15:11.0091628Z Complete job name: before-test / get-label-type / runner-determinator 2025-09-07T06:15:11.5367152Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:15:11.5369898Z cat < runner_determinator.py 2025-09-07T06:15:11.5370687Z # flake8: noqa: G004 2025-09-07T06:15:11.5371228Z  2025-09-07T06:15:11.5372040Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:15:11.5373134Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:15:11.5374197Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:15:11.5374921Z  2025-09-07T06:15:11.5375432Z """ 2025-09-07T06:15:11.5376192Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:15:11.5377200Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:15:11.5378850Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:15:11.5379891Z of which runners should be used to run which job. 2025-09-07T06:15:11.5380587Z  2025-09-07T06:15:11.5381378Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:15:11.5382482Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:15:11.5383523Z settings are considered to be empty with only the second part, the user 2025-09-07T06:15:11.5384400Z list, defined. 2025-09-07T06:15:11.5384977Z  2025-09-07T06:15:11.5385657Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:15:11.5386802Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:15:11.5388132Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:15:11.5388929Z  2025-09-07T06:15:11.5390244Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:15:11.5391281Z The user list is also a comma separated list of additional features or 2025-09-07T06:15:11.5392194Z experiments which the user could be opted in to. 2025-09-07T06:15:11.5392909Z  2025-09-07T06:15:11.5393452Z The user list has the following rules: 2025-09-07T06:15:11.5394097Z  2025-09-07T06:15:11.5394804Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:15:11.5395876Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:15:11.5396777Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:15:11.5397503Z  2025-09-07T06:15:11.5398190Z Example config: 2025-09-07T06:15:11.5398837Z  # A list of experiments that can be opted into. 2025-09-07T06:15:11.5399736Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:15:11.5400502Z  # Expected syntax is: 2025-09-07T06:15:11.5401318Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:15:11.5402395Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:15:11.5403363Z  2025-09-07T06:15:11.5403844Z  experiments: 2025-09-07T06:15:11.5491611Z  lf: 2025-09-07T06:15:11.5492268Z  rollout_percent: 25 2025-09-07T06:15:11.5492840Z  all_branches: false 2025-09-07T06:15:11.5493364Z  default: true 2025-09-07T06:15:11.5493835Z  --- 2025-09-07T06:15:11.5494229Z  2025-09-07T06:15:11.5494607Z  # Opt-ins: 2025-09-07T06:15:11.5495289Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:15:11.5496599Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:15:11.5497477Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:15:11.5498391Z  # Experiments should be from the above list. 2025-09-07T06:15:11.5498995Z  2025-09-07T06:15:11.5499401Z  @User1,-lf,split_build 2025-09-07T06:15:11.5499912Z  @User2,lf 2025-09-07T06:15:11.5500365Z  @User3,split_build 2025-09-07T06:15:11.5500853Z """ 2025-09-07T06:15:11.5501228Z  2025-09-07T06:15:11.5501605Z import json 2025-09-07T06:15:11.5502043Z import logging 2025-09-07T06:15:11.5502478Z import os 2025-09-07T06:15:11.5502900Z import random 2025-09-07T06:15:11.5503338Z import re 2025-09-07T06:15:11.5503752Z import sys 2025-09-07T06:15:11.5504217Z from argparse import ArgumentParser 2025-09-07T06:15:11.5504887Z from collections.abc import Iterable 2025-09-07T06:15:11.5505473Z from functools import cache 2025-09-07T06:15:11.5506003Z from logging import LogRecord 2025-09-07T06:15:11.5506570Z from typing import Any, NamedTuple 2025-09-07T06:15:11.5507184Z from urllib.request import Request, urlopen 2025-09-07T06:15:11.5508066Z  2025-09-07T06:15:11.5508493Z import yaml 2025-09-07T06:15:11.5508959Z from github import Auth, Github 2025-09-07T06:15:11.5509524Z from github.Issue import Issue 2025-09-07T06:15:11.5510041Z  2025-09-07T06:15:11.5510410Z  2025-09-07T06:15:11.5510868Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:15:11.5511638Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:15:11.5512592Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:15:11.5513348Z  2025-09-07T06:15:11.5514014Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:15:11.5514648Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:15:11.5515238Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:15:11.5515888Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:15:11.5516451Z  2025-09-07T06:15:11.5516872Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:15:11.5517415Z  2025-09-07T06:15:11.5517930Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:15:11.5518473Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:15:11.5518969Z  2025-09-07T06:15:11.5519326Z  2025-09-07T06:15:11.5519732Z class Experiment(NamedTuple): 2025-09-07T06:15:11.5520285Z  rollout_perc: float = ( 2025-09-07T06:15:11.5521015Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:15:11.5521739Z  ) 2025-09-07T06:15:11.5522152Z  all_branches: bool = ( 2025-09-07T06:15:11.5522868Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:15:11.5523584Z  ) 2025-09-07T06:15:11.5523999Z  default: bool = ( 2025-09-07T06:15:11.5524647Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:15:11.5525332Z  ) 2025-09-07T06:15:11.5525711Z  2025-09-07T06:15:11.5526114Z  # Add more fields as needed 2025-09-07T06:15:11.5526616Z  2025-09-07T06:15:11.5526980Z  2025-09-07T06:15:11.5527372Z class Settings(NamedTuple): 2025-09-07T06:15:11.5527973Z  """ 2025-09-07T06:15:11.5528502Z  Settings for the experiments that can be opted into. 2025-09-07T06:15:11.5529115Z  """ 2025-09-07T06:15:11.5529506Z  2025-09-07T06:15:11.5529946Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:15:11.5530567Z  2025-09-07T06:15:11.5531057Z  2025-09-07T06:15:11.5531511Z class ColorFormatter(logging.Formatter): 2025-09-07T06:15:11.5532203Z  """Color codes the log messages based on the log level""" 2025-09-07T06:15:11.5532832Z  2025-09-07T06:15:11.5533208Z  COLORS = { 2025-09-07T06:15:11.5533671Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:15:11.5534233Z  "ERROR": "\033[31m", # Red 2025-09-07T06:15:11.5534781Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:15:11.5535331Z  "INFO": "\033[0m", # Reset 2025-09-07T06:15:11.5535874Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:15:11.5536399Z  } 2025-09-07T06:15:11.5536792Z  2025-09-07T06:15:11.5537240Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:15:11.5538201Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:15:11.5539071Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:15:11.5539713Z  return super().format(record) 2025-09-07T06:15:11.5540240Z  2025-09-07T06:15:11.5540606Z  2025-09-07T06:15:11.5541018Z handler = logging.StreamHandler() 2025-09-07T06:15:11.5541813Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:15:11.5542578Z  2025-09-07T06:15:11.5543072Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:15:11.5543711Z log.addHandler(handler) 2025-09-07T06:15:11.5544217Z log.setLevel(logging.INFO) 2025-09-07T06:15:11.5544709Z  2025-09-07T06:15:11.5545076Z  2025-09-07T06:15:11.5545572Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:15:11.5546190Z  """ 2025-09-07T06:15:11.5546757Z  Defines outputs of the github action that invokes this script 2025-09-07T06:15:11.5547567Z  """ 2025-09-07T06:15:11.5548329Z  if not GITHUB_OUTPUT: 2025-09-07T06:15:11.5549490Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:15:11.5550683Z  log.warning( 2025-09-07T06:15:11.5551629Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:15:11.5552612Z  ) 2025-09-07T06:15:11.5553104Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:15:11.5553698Z  return 2025-09-07T06:15:11.5554121Z  2025-09-07T06:15:11.5554553Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:15:11.5555185Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:15:11.5555809Z  f.write(f"{key}={value}\n") 2025-09-07T06:15:11.5556336Z  2025-09-07T06:15:11.5556701Z  2025-09-07T06:15:11.5557261Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:15:11.5558251Z  return frozenset( 2025-09-07T06:15:11.5558959Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:15:11.5559679Z  ) 2025-09-07T06:15:11.5560086Z  2025-09-07T06:15:11.5560447Z  2025-09-07T06:15:11.5560850Z def parse_args() -> Any: 2025-09-07T06:15:11.5561507Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:15:11.5562441Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:15:11.5563273Z  parser.add_argument( 2025-09-07T06:15:11.5563800Z  "--github-issue-repo", 2025-09-07T06:15:11.5564349Z  type=str, 2025-09-07T06:15:11.5564825Z  required=False, 2025-09-07T06:15:11.5565497Z  default="pytorch/test-infra", 2025-09-07T06:15:11.5566131Z  help="GitHub repo to get the issue", 2025-09-07T06:15:11.5566685Z  ) 2025-09-07T06:15:11.5567104Z  parser.add_argument( 2025-09-07T06:15:11.5567723Z  "--github-repo", 2025-09-07T06:15:11.5568230Z  type=str, 2025-09-07T06:15:11.5568711Z  required=True, 2025-09-07T06:15:11.5569264Z  help="GitHub repo where CI is running", 2025-09-07T06:15:11.5569824Z  ) 2025-09-07T06:15:11.5570256Z  parser.add_argument( 2025-09-07T06:15:11.5570956Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:15:11.5571668Z  ) 2025-09-07T06:15:11.5572087Z  parser.add_argument( 2025-09-07T06:15:11.5572798Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:15:11.5573529Z  ) 2025-09-07T06:15:11.5573942Z  parser.add_argument( 2025-09-07T06:15:11.5574667Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:15:11.5575403Z  ) 2025-09-07T06:15:11.5575818Z  parser.add_argument( 2025-09-07T06:15:11.5576564Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:15:11.5577309Z  ) 2025-09-07T06:15:11.5577840Z  parser.add_argument( 2025-09-07T06:15:11.5578386Z  "--github-ref-type", 2025-09-07T06:15:11.5578910Z  type=str, 2025-09-07T06:15:11.5579380Z  required=True, 2025-09-07T06:15:11.5579966Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:15:11.5580548Z  ) 2025-09-07T06:15:11.5580962Z  parser.add_argument( 2025-09-07T06:15:11.5581622Z  "--eligible-experiments", 2025-09-07T06:15:11.5582216Z  type=_str_comma_separated_to_set, 2025-09-07T06:15:11.5582782Z  required=False, 2025-09-07T06:15:11.5583274Z  default="", 2025-09-07T06:15:11.5584215Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:15:11.5585183Z  ) 2025-09-07T06:15:11.5585601Z  parser.add_argument( 2025-09-07T06:15:11.5586126Z  "--opt-out-experiments", 2025-09-07T06:15:11.5586707Z  type=_str_comma_separated_to_set, 2025-09-07T06:15:11.5587261Z  required=False, 2025-09-07T06:15:11.5588033Z  default="", 2025-09-07T06:15:11.5588557Z  help=( 2025-09-07T06:15:11.5589335Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:15:11.5590545Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:15:11.5591423Z  ), 2025-09-07T06:15:11.5591829Z  ) 2025-09-07T06:15:11.5592242Z  parser.add_argument( 2025-09-07T06:15:11.5592752Z  "--pr-number", 2025-09-07T06:15:11.5593250Z  type=str, 2025-09-07T06:15:11.5593719Z  required=False, 2025-09-07T06:15:11.5594209Z  default="", 2025-09-07T06:15:11.5594762Z  help="the optional PR number where this is run", 2025-09-07T06:15:11.5595367Z  ) 2025-09-07T06:15:11.5595752Z  2025-09-07T06:15:11.5596158Z  return parser.parse_args() 2025-09-07T06:15:11.5596674Z  2025-09-07T06:15:11.5597044Z  2025-09-07T06:15:11.5597798Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:15:11.5598796Z  auth = Auth.Token(github_token) 2025-09-07T06:15:11.5599408Z  return Github(auth=auth) 2025-09-07T06:15:11.5599903Z  2025-09-07T06:15:11.5600266Z  2025-09-07T06:15:11.5600970Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:15:11.5601837Z  repo = gh.get_repo(repo) 2025-09-07T06:15:11.5602418Z  return repo.get_issue(number=issue_num) 2025-09-07T06:15:11.5602977Z  2025-09-07T06:15:11.5603348Z  2025-09-07T06:15:11.5603742Z def get_potential_pr_author( 2025-09-07T06:15:11.5604474Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:15:11.5605195Z ) -> str: 2025-09-07T06:15:11.5605799Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:15:11.5606668Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:15:11.5607494Z  # embedded in the tag name: ciflow// 2025-09-07T06:15:11.5608213Z  2025-09-07T06:15:11.5608646Z  gh = get_gh_client(github_token) 2025-09-07T06:15:11.5609185Z  2025-09-07T06:15:11.5609691Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:15:11.5610387Z  split_tag = ref_name.split("/") 2025-09-07T06:15:11.5610943Z  if ( 2025-09-07T06:15:11.5611389Z  len(split_tag) == 3 2025-09-07T06:15:11.5611959Z  and split_tag[0] == "ciflow" 2025-09-07T06:15:11.5612541Z  and split_tag[2].isnumeric() 2025-09-07T06:15:11.5613096Z  ): 2025-09-07T06:15:11.5613545Z  pr_number = split_tag[2] 2025-09-07T06:15:11.5614095Z  try: 2025-09-07T06:15:11.5614596Z  repository = gh.get_repo(repo) 2025-09-07T06:15:11.5615407Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:15:11.5616080Z  except Exception as e: 2025-09-07T06:15:11.5616670Z  raise Exception( # noqa: TRY002 2025-09-07T06:15:11.5617405Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:15:11.5618199Z  ) from e 2025-09-07T06:15:11.5618832Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:15:11.5619601Z  # In all other cases, return the original input username 2025-09-07T06:15:11.5620233Z  return username 2025-09-07T06:15:11.5620696Z  2025-09-07T06:15:11.5621061Z  2025-09-07T06:15:11.5621522Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:15:11.5622099Z  """ 2025-09-07T06:15:11.5622825Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:15:11.5623651Z  """ 2025-09-07T06:15:11.5624268Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:15:11.5624969Z  2025-09-07T06:15:11.5625328Z  2025-09-07T06:15:11.5625749Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:15:11.5626284Z  try: 2025-09-07T06:15:11.5626726Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:15:11.5627282Z  return data 2025-09-07T06:15:11.5628057Z  except yaml.YAMLError: 2025-09-07T06:15:11.5628683Z  log.exception("Error loading YAML") 2025-09-07T06:15:11.5629248Z  raise 2025-09-07T06:15:11.5629668Z  2025-09-07T06:15:11.5630030Z  2025-09-07T06:15:11.5630703Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:15:11.5631492Z  """ 2025-09-07T06:15:11.5632327Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:15:11.5633122Z  2025-09-07T06:15:11.5633706Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:15:11.5634547Z  and the text below is the list of opted in users. 2025-09-07T06:15:11.5635144Z  2025-09-07T06:15:11.5635766Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:15:11.5636508Z  """ 2025-09-07T06:15:11.5637012Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:15:11.5638170Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:15:11.5638894Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:15:11.5639654Z  else: 2025-09-07T06:15:11.5640221Z  return "", rollout_state 2025-09-07T06:15:11.5640753Z  2025-09-07T06:15:11.5641106Z  2025-09-07T06:15:11.5641541Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:15:11.5642090Z  """ 2025-09-07T06:15:11.5642674Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:15:11.5643361Z  """ 2025-09-07T06:15:11.5643739Z  2025-09-07T06:15:11.5644088Z  2025-09-07T06:15:11.5644656Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:15:11.5645350Z  """ 2025-09-07T06:15:11.5646120Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:15:11.5646985Z  2025-09-07T06:15:11.5647946Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:15:11.5649059Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:15:11.5649961Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:15:11.5650643Z  2025-09-07T06:15:11.5650999Z  2025-09-07T06:15:11.5651352Z  """ 2025-09-07T06:15:11.5651766Z  optins = UserOptins() 2025-09-07T06:15:11.5652336Z  for user in user_optin_text.split("\n"): 2025-09-07T06:15:11.5652946Z  user = user.strip("\r\n\t -") 2025-09-07T06:15:11.5653554Z  if not user or not user.startswith("@"): 2025-09-07T06:15:11.5654156Z  # Not a valid user. Skip 2025-09-07T06:15:11.5654701Z  continue 2025-09-07T06:15:11.5655144Z  2025-09-07T06:15:11.5655542Z  if user: 2025-09-07T06:15:11.5656053Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:15:11.5656804Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:15:11.5657486Z  2025-09-07T06:15:11.5657982Z  return optins 2025-09-07T06:15:11.5658425Z  2025-09-07T06:15:11.5658774Z  2025-09-07T06:15:11.5659303Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:15:11.5659958Z  """ 2025-09-07T06:15:11.5660416Z  Check if the experiment name is valid. 2025-09-07T06:15:11.5660972Z  A valid name: 2025-09-07T06:15:11.5661695Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:15:11.5662690Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:15:11.5663446Z  - Cannot contain spaces 2025-09-07T06:15:11.5663963Z  """ 2025-09-07T06:15:11.5664341Z  2025-09-07T06:15:11.5664829Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:15:11.5665596Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:15:11.5666357Z  2025-09-07T06:15:11.5666731Z  if valid: 2025-09-07T06:15:11.5667160Z  return True 2025-09-07T06:15:11.5667782Z  2025-09-07T06:15:11.5668291Z  log.error( 2025-09-07T06:15:11.5669838Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T06:15:11.5671437Z  ) 2025-09-07T06:15:11.5671835Z  return False 2025-09-07T06:15:11.5672279Z  2025-09-07T06:15:11.5672633Z  2025-09-07T06:15:11.5673210Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:15:11.5673883Z  """ 2025-09-07T06:15:11.5674539Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:15:11.5675307Z  """ 2025-09-07T06:15:11.5675694Z  try: 2025-09-07T06:15:11.5676100Z  if settings_text: 2025-09-07T06:15:11.5676897Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:15:11.5677839Z  # for easy reading 2025-09-07T06:15:11.5678713Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:15:11.5679660Z  # the backtick character in shell commands. 2025-09-07T06:15:11.5680314Z  backtick = chr(96) # backtick character 2025-09-07T06:15:11.5681039Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:15:11.5681755Z  settings = load_yaml(settings_text) 2025-09-07T06:15:11.5682293Z  2025-09-07T06:15:11.5682932Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:15:11.5683870Z  experiments = {} 2025-09-07T06:15:11.5684367Z  2025-09-07T06:15:11.5684974Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:15:11.5685778Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:15:11.5686947Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T06:15:11.5688134Z  continue 2025-09-07T06:15:11.5688619Z  2025-09-07T06:15:11.5689048Z  valid_settings = {} 2025-09-07T06:15:11.5689625Z  for setting in exp_settings: 2025-09-07T06:15:11.5690238Z  if setting not in Experiment._fields: 2025-09-07T06:15:11.5690841Z  log.warning( 2025-09-07T06:15:11.5691621Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:15:11.5692363Z  ) 2025-09-07T06:15:11.5692843Z  else: 2025-09-07T06:15:11.5693435Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:15:11.5694045Z  2025-09-07T06:15:11.5694548Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:15:11.5695229Z  return Settings(experiments) 2025-09-07T06:15:11.5695760Z  2025-09-07T06:15:11.5696140Z  except Exception: 2025-09-07T06:15:11.5696693Z  log.exception("Failed to parse settings") 2025-09-07T06:15:11.5697259Z  2025-09-07T06:15:11.5697727Z  return Settings() 2025-09-07T06:15:11.5698192Z  2025-09-07T06:15:11.5698545Z  2025-09-07T06:15:11.5699194Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:15:11.5699815Z  """ 2025-09-07T06:15:11.5700312Z  Parse settings, if any, from the rollout state. 2025-09-07T06:15:11.5700891Z  2025-09-07T06:15:11.5701461Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:15:11.5702281Z  and the text below is the list of opted in users. 2025-09-07T06:15:11.5702863Z  2025-09-07T06:15:11.5703496Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:15:11.5704252Z  """ 2025-09-07T06:15:11.5704867Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:15:11.5705689Z  return parse_settings_from_text(settings_text) 2025-09-07T06:15:11.5706277Z  2025-09-07T06:15:11.5706631Z  2025-09-07T06:15:11.5707112Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:15:11.5707997Z  """ 2025-09-07T06:15:11.5708472Z  Parse users from the rollout state. 2025-09-07T06:15:11.5709015Z  2025-09-07T06:15:11.5709377Z  """ 2025-09-07T06:15:11.5709969Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:15:11.5710763Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:15:11.5711346Z  2025-09-07T06:15:11.5711705Z  2025-09-07T06:15:11.5712356Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:15:11.5713137Z  """ 2025-09-07T06:15:11.5713612Z  Check if a user is opted into an experiment 2025-09-07T06:15:11.5714174Z  """ 2025-09-07T06:15:11.5714684Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:15:11.5715300Z  2025-09-07T06:15:11.5715808Z  2025-09-07T06:15:11.5716482Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:15:11.5717272Z  """ 2025-09-07T06:15:11.5717914Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:15:11.5718536Z  """ 2025-09-07T06:15:11.5719098Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:15:11.5719847Z  experiment_optout = "-" + experiment_name 2025-09-07T06:15:11.5720543Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:15:11.5721178Z  return False 2025-09-07T06:15:11.5721628Z  2025-09-07T06:15:11.5722128Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:15:11.5722777Z  log.warning( 2025-09-07T06:15:11.5723652Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:15:11.5724562Z  ) 2025-09-07T06:15:11.5724962Z  2025-09-07T06:15:11.5725328Z  return True 2025-09-07T06:15:11.5725753Z  2025-09-07T06:15:11.5726105Z  2025-09-07T06:15:11.5726488Z def get_runner_prefix( 2025-09-07T06:15:11.5726976Z  rollout_state: str, 2025-09-07T06:15:11.5727503Z  workflow_requestors: Iterable[str], 2025-09-07T06:15:11.5728149Z  branch: str, 2025-09-07T06:15:11.5728721Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:15:11.5729456Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:15:11.5730084Z  is_canary: bool = False, 2025-09-07T06:15:11.5730597Z ) -> str: 2025-09-07T06:15:11.5731093Z  settings = parse_settings(rollout_state) 2025-09-07T06:15:11.5731741Z  user_optins = parse_users(rollout_state) 2025-09-07T06:15:11.5732295Z  2025-09-07T06:15:11.5732801Z  fleet_prefix = "" 2025-09-07T06:15:11.5733289Z  prefixes = [] 2025-09-07T06:15:11.5734004Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:15:11.5735017Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:15:11.5735770Z  log.info( 2025-09-07T06:15:11.5736525Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:15:11.5737313Z  ) 2025-09-07T06:15:11.5737862Z  continue 2025-09-07T06:15:11.5738309Z  2025-09-07T06:15:11.5738708Z  if opt_out_experiments: 2025-09-07T06:15:11.5739305Z  if experiment_name in opt_out_experiments: 2025-09-07T06:15:11.5740010Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:15:11.5740640Z  log.info( 2025-09-07T06:15:11.5741632Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:15:11.5742636Z  ) 2025-09-07T06:15:11.5743088Z  continue 2025-09-07T06:15:11.5743551Z  2025-09-07T06:15:11.5743950Z  if eligible_experiments: 2025-09-07T06:15:11.5744566Z  if experiment_name not in eligible_experiments: 2025-09-07T06:15:11.5745252Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:15:11.5745834Z  log.info( 2025-09-07T06:15:11.5746690Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:15:11.5747561Z  ) 2025-09-07T06:15:11.5748285Z  continue 2025-09-07T06:15:11.5748848Z  elif not experiment_settings.default: 2025-09-07T06:15:11.5749422Z  log.info( 2025-09-07T06:15:11.5750154Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:15:11.5750911Z  ) 2025-09-07T06:15:11.5751337Z  continue 2025-09-07T06:15:11.5751784Z  2025-09-07T06:15:11.5752291Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:15:11.5752999Z  opted_out_users = [ 2025-09-07T06:15:11.5753497Z  requestor 2025-09-07T06:15:11.5754024Z  for requestor in workflow_requestors 2025-09-07T06:15:11.5754744Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:15:11.5755408Z  ] 2025-09-07T06:15:11.5755812Z  2025-09-07T06:15:11.5756209Z  if opted_out_users: 2025-09-07T06:15:11.5756746Z  log.info( 2025-09-07T06:15:11.5757451Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:15:11.5758295Z  ) 2025-09-07T06:15:11.5758729Z  continue 2025-09-07T06:15:11.5759184Z  2025-09-07T06:15:11.5759685Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:15:11.5760341Z  opted_in_users = [ 2025-09-07T06:15:11.5760869Z  requestor 2025-09-07T06:15:11.5761402Z  for requestor in workflow_requestors 2025-09-07T06:15:11.5762130Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:15:11.5762790Z  ] 2025-09-07T06:15:11.5763190Z  2025-09-07T06:15:11.5763566Z  enabled = False 2025-09-07T06:15:11.5764082Z  if opted_in_users: 2025-09-07T06:15:11.5764703Z  log.info( 2025-09-07T06:15:11.5765393Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:15:11.5766110Z  ) 2025-09-07T06:15:11.5766552Z  enabled = True 2025-09-07T06:15:11.5767032Z  2025-09-07T06:15:11.5767470Z  elif experiment_settings.rollout_perc: 2025-09-07T06:15:11.5768535Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:15:11.5769549Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:15:11.5770237Z  log.info( 2025-09-07T06:15:11.5771179Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:15:11.5772135Z  ) 2025-09-07T06:15:11.5772620Z  enabled = True 2025-09-07T06:15:11.5773120Z  2025-09-07T06:15:11.5773529Z  if enabled: 2025-09-07T06:15:11.5774027Z  label = experiment_name 2025-09-07T06:15:11.5774634Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:15:11.5775512Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:15:11.5776439Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:15:11.5777259Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:15:11.5778055Z  if is_canary: 2025-09-07T06:15:11.5778608Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:15:11.5779203Z  fleet_prefix = label 2025-09-07T06:15:11.5779737Z  else: 2025-09-07T06:15:11.5780363Z  prefixes.append(label) 2025-09-07T06:15:11.5780894Z  2025-09-07T06:15:11.5781288Z  if len(prefixes) > 1: 2025-09-07T06:15:11.5781796Z  log.error( 2025-09-07T06:15:11.5782917Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T06:15:11.5784077Z  ) 2025-09-07T06:15:11.5784516Z  prefixes = prefixes[:1] 2025-09-07T06:15:11.5785031Z  2025-09-07T06:15:11.5785423Z  # Fleet always comes first 2025-09-07T06:15:11.5785955Z  if fleet_prefix: 2025-09-07T06:15:11.5786476Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:15:11.5787021Z  2025-09-07T06:15:11.5787514Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:15:11.5788220Z  2025-09-07T06:15:11.5788592Z  2025-09-07T06:15:11.5789306Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:15:11.5790121Z  """ 2025-09-07T06:15:11.5790760Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:15:11.5791509Z  2025-09-07T06:15:11.5792132Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:15:11.5792878Z  """ 2025-09-07T06:15:11.5793322Z  gh = get_gh_client(github_token) 2025-09-07T06:15:11.5793922Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:15:11.5794639Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:15:11.5795274Z  2025-09-07T06:15:11.5795640Z  2025-09-07T06:15:11.5796283Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:15:11.5797207Z  for _ in range(num_retries): 2025-09-07T06:15:11.5797847Z  try: 2025-09-07T06:15:11.5798340Z  req = Request(url=url, headers=headers) 2025-09-07T06:15:11.5799056Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:15:11.5799750Z  return json.loads(content) 2025-09-07T06:15:11.5800329Z  except Exception as e: 2025-09-07T06:15:11.5800946Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:15:11.5801524Z  2025-09-07T06:15:11.5802144Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:15:11.5802890Z  return {} 2025-09-07T06:15:11.5803311Z  2025-09-07T06:15:11.5803670Z  2025-09-07T06:15:11.5804036Z @cache 2025-09-07T06:15:11.5804799Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:15:11.5805606Z  """ 2025-09-07T06:15:11.5806065Z  Dynamically get PR information 2025-09-07T06:15:11.5806587Z  """ 2025-09-07T06:15:11.5807145Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:15:11.5807928Z  headers = { 2025-09-07T06:15:11.5808468Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:15:11.5809118Z  "Authorization": f"token {github_token}", 2025-09-07T06:15:11.5809688Z  } 2025-09-07T06:15:11.5810178Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:15:11.5810840Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:15:11.5811423Z  headers=headers, 2025-09-07T06:15:11.5811901Z  ) 2025-09-07T06:15:11.5812288Z  2025-09-07T06:15:11.5812676Z  if not json_response: 2025-09-07T06:15:11.5813327Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:15:11.5814126Z  return {} 2025-09-07T06:15:11.5814565Z  2025-09-07T06:15:11.5814961Z  return json_response 2025-09-07T06:15:11.5815448Z  2025-09-07T06:15:11.5815815Z  2025-09-07T06:15:11.5816439Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:15:11.5817211Z  """ 2025-09-07T06:15:11.5817893Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:15:11.5818596Z  """ 2025-09-07T06:15:11.5819140Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:15:11.5819785Z  return { 2025-09-07T06:15:11.5820436Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:15:11.5821164Z  } 2025-09-07T06:15:11.5821550Z  2025-09-07T06:15:11.5821912Z  2025-09-07T06:15:11.5822296Z def main() -> None: 2025-09-07T06:15:11.5822772Z  args = parse_args() 2025-09-07T06:15:11.5823247Z  2025-09-07T06:15:11.5823697Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:15:11.5824260Z  2025-09-07T06:15:11.5824664Z  # Check if the PR is opt-out 2025-09-07T06:15:11.5825202Z  if args.pr_number: 2025-09-07T06:15:11.5825942Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:15:11.5826742Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:15:11.5827287Z  log.info( 2025-09-07T06:15:11.5828152Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:15:11.5828954Z  ) 2025-09-07T06:15:11.5829581Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:15:11.5830296Z  sys.exit() 2025-09-07T06:15:11.5830875Z  2025-09-07T06:15:11.5831250Z  try: 2025-09-07T06:15:11.5831745Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:15:11.5832516Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:15:11.5833187Z  ) 2025-09-07T06:15:11.5833588Z  2025-09-07T06:15:11.5834010Z  username = get_potential_pr_author( 2025-09-07T06:15:11.5834596Z  args.github_token, 2025-09-07T06:15:11.5835123Z  args.github_repo, 2025-09-07T06:15:11.5835651Z  args.github_actor, 2025-09-07T06:15:11.5836190Z  args.github_ref_type, 2025-09-07T06:15:11.5836738Z  args.github_branch, 2025-09-07T06:15:11.5837243Z  ) 2025-09-07T06:15:11.5837733Z  2025-09-07T06:15:11.5838254Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:15:11.5838896Z  2025-09-07T06:15:11.5839343Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:15:11.5839926Z  rollout_state, 2025-09-07T06:15:11.5840476Z  (args.github_issue_owner, username), 2025-09-07T06:15:11.5841063Z  args.github_branch, 2025-09-07T06:15:11.5841617Z  args.eligible_experiments, 2025-09-07T06:15:11.5842200Z  args.opt_out_experiments, 2025-09-07T06:15:11.5842746Z  is_canary, 2025-09-07T06:15:11.5843234Z  ) 2025-09-07T06:15:11.5843622Z  2025-09-07T06:15:11.5844018Z  except Exception as e: 2025-09-07T06:15:11.5844524Z  log.error( 2025-09-07T06:15:11.5845275Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:15:11.5846191Z  ) 2025-09-07T06:15:11.5846590Z  2025-09-07T06:15:11.5847177Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:15:11.5847967Z  2025-09-07T06:15:11.5848331Z  2025-09-07T06:15:11.5848711Z if __name__ == "__main__": 2025-09-07T06:15:11.5849209Z  main() 2025-09-07T06:15:11.5849618Z  2025-09-07T06:15:11.5849984Z EOF 2025-09-07T06:15:11.5850361Z  2025-09-07T06:15:11.5850761Z cat runner_determinator.py 2025-09-07T06:15:11.6982297Z shell: /usr/bin/bash -e {0} 2025-09-07T06:15:11.6983138Z env: 2025-09-07T06:15:11.6983850Z GITHUB_TOKEN: *** 2025-09-07T06:15:11.6984290Z ISSUE_NUMBER: 5132 2025-09-07T06:15:11.6984738Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:15:11.6985265Z ISSUE_OWNER: 2025-09-07T06:15:11.6985675Z CHECK_EXPERIMENTS: 2025-09-07T06:15:11.6986117Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:15:11.6986548Z PR_NUMBER: 2025-09-07T06:15:11.6986962Z ##[endgroup] 2025-09-07T06:15:11.7192175Z # flake8: noqa: G004 2025-09-07T06:15:11.7192539Z 2025-09-07T06:15:11.7192967Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:15:11.7193922Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:15:11.7194719Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:15:11.7195160Z 2025-09-07T06:15:11.7195327Z """ 2025-09-07T06:15:11.7195895Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:15:11.7196767Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:15:11.7197956Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:15:11.7198867Z of which runners should be used to run which job. 2025-09-07T06:15:11.7199268Z 2025-09-07T06:15:11.7199658Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:15:11.7200774Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:15:11.7201675Z settings are considered to be empty with only the second part, the user 2025-09-07T06:15:11.7202411Z list, defined. 2025-09-07T06:15:11.7202639Z 2025-09-07T06:15:11.7203000Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:15:11.7203912Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:15:11.7204747Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:15:11.7205188Z 2025-09-07T06:15:11.7205563Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:15:11.7206623Z The user list is also a comma separated list of additional features or 2025-09-07T06:15:11.7207363Z experiments which the user could be opted in to. 2025-09-07T06:15:11.7207994Z 2025-09-07T06:15:11.7208199Z The user list has the following rules: 2025-09-07T06:15:11.7208556Z 2025-09-07T06:15:11.7208881Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:15:11.7209728Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:15:11.7210486Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:15:11.7210882Z 2025-09-07T06:15:11.7211063Z Example config: 2025-09-07T06:15:11.7211511Z # A list of experiments that can be opted into. 2025-09-07T06:15:11.7212178Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:15:11.7212799Z # Expected syntax is: 2025-09-07T06:15:11.7213434Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:15:11.7214395Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:15:11.7214999Z 2025-09-07T06:15:11.7215171Z experiments: 2025-09-07T06:15:11.7215566Z lf: 2025-09-07T06:15:11.7215944Z rollout_percent: 25 2025-09-07T06:15:11.7216586Z all_branches: false 2025-09-07T06:15:11.7217041Z default: true 2025-09-07T06:15:11.7217454Z --- 2025-09-07T06:15:11.7217865Z 2025-09-07T06:15:11.7218050Z # Opt-ins: 2025-09-07T06:15:11.7218636Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:15:11.7219499Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:15:11.7220364Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:15:11.7221018Z # Experiments should be from the above list. 2025-09-07T06:15:11.7221393Z 2025-09-07T06:15:11.7221574Z @User1,-lf,split_build 2025-09-07T06:15:11.7222013Z @User2,lf 2025-09-07T06:15:11.7222394Z @User3,split_build 2025-09-07T06:15:11.7222800Z """ 2025-09-07T06:15:11.7222989Z 2025-09-07T06:15:11.7223150Z import json 2025-09-07T06:15:11.7223529Z import logging 2025-09-07T06:15:11.7223906Z import os 2025-09-07T06:15:11.7224269Z import random 2025-09-07T06:15:11.7224646Z import re 2025-09-07T06:15:11.7225016Z import sys 2025-09-07T06:15:11.7225422Z from argparse import ArgumentParser 2025-09-07T06:15:11.7225945Z from collections.abc import Iterable 2025-09-07T06:15:11.7226461Z from functools import cache 2025-09-07T06:15:11.7226932Z from logging import LogRecord 2025-09-07T06:15:11.7227428Z from typing import Any, NamedTuple 2025-09-07T06:15:11.7228264Z from urllib.request import Request, urlopen 2025-09-07T06:15:11.7228649Z 2025-09-07T06:15:11.7228817Z import yaml 2025-09-07T06:15:11.7229211Z from github import Auth, Github 2025-09-07T06:15:11.7229701Z from github.Issue import Issue 2025-09-07T06:15:11.7230005Z 2025-09-07T06:15:11.7230012Z 2025-09-07T06:15:11.7230237Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:15:11.7230912Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:15:11.7231780Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:15:11.7232333Z 2025-09-07T06:15:11.7232559Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:15:11.7233295Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:15:11.7233819Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:15:11.7234375Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:15:11.7234731Z 2025-09-07T06:15:11.7234933Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:15:11.7235268Z 2025-09-07T06:15:11.7235457Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:15:11.7235918Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:15:11.7236196Z 2025-09-07T06:15:11.7236203Z 2025-09-07T06:15:11.7236393Z class Experiment(NamedTuple): 2025-09-07T06:15:11.7236881Z rollout_perc: float = ( 2025-09-07T06:15:11.7237515Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:15:11.7238403Z ) 2025-09-07T06:15:11.7238784Z all_branches: bool = ( 2025-09-07T06:15:11.7239401Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:15:11.7240068Z ) 2025-09-07T06:15:11.7240437Z default: bool = ( 2025-09-07T06:15:11.7241005Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:15:11.7241634Z ) 2025-09-07T06:15:11.7241831Z 2025-09-07T06:15:11.7242014Z # Add more fields as needed 2025-09-07T06:15:11.7242312Z 2025-09-07T06:15:11.7242318Z 2025-09-07T06:15:11.7242509Z class Settings(NamedTuple): 2025-09-07T06:15:11.7242948Z """ 2025-09-07T06:15:11.7243402Z Settings for the experiments that can be opted into. 2025-09-07T06:15:11.7243968Z """ 2025-09-07T06:15:11.7244159Z 2025-09-07T06:15:11.7244370Z experiments: dict[str, Experiment] = {} 2025-09-07T06:15:11.7244763Z 2025-09-07T06:15:11.7244770Z 2025-09-07T06:15:11.7244978Z class ColorFormatter(logging.Formatter): 2025-09-07T06:15:11.7245600Z """Color codes the log messages based on the log level""" 2025-09-07T06:15:11.7246023Z 2025-09-07T06:15:11.7246192Z COLORS = { 2025-09-07T06:15:11.7246588Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:15:11.7247255Z "ERROR": "\033[31m", # Red 2025-09-07T06:15:11.7247946Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:15:11.7248463Z "INFO": "\033[0m", # Reset 2025-09-07T06:15:11.7248945Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:15:11.7249410Z } 2025-09-07T06:15:11.7249603Z 2025-09-07T06:15:11.7249823Z def format(self, record: LogRecord) -> str: 2025-09-07T06:15:11.7250568Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:15:11.7251343Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:15:11.7251912Z return super().format(record) 2025-09-07T06:15:11.7252237Z 2025-09-07T06:15:11.7252244Z 2025-09-07T06:15:11.7252445Z handler = logging.StreamHandler() 2025-09-07T06:15:11.7253146Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:15:11.7253705Z 2025-09-07T06:15:11.7253952Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:15:11.7254528Z log.addHandler(handler) 2025-09-07T06:15:11.7254980Z log.setLevel(logging.INFO) 2025-09-07T06:15:11.7255258Z 2025-09-07T06:15:11.7255266Z 2025-09-07T06:15:11.7255515Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:15:11.7256073Z """ 2025-09-07T06:15:11.7256575Z Defines outputs of the github action that invokes this script 2025-09-07T06:15:11.7257201Z """ 2025-09-07T06:15:11.7257739Z if not GITHUB_OUTPUT: 2025-09-07T06:15:11.7258831Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:15:11.7259942Z log.warning( 2025-09-07T06:15:11.7260788Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:15:11.7261717Z ) 2025-09-07T06:15:11.7271827Z print(f"::set-output name={key}::{value}") 2025-09-07T06:15:11.7272473Z return 2025-09-07T06:15:11.7272715Z 2025-09-07T06:15:11.7273123Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:15:11.7273727Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:15:11.7274306Z f.write(f"{key}={value}\n") 2025-09-07T06:15:11.7274635Z 2025-09-07T06:15:11.7274642Z 2025-09-07T06:15:11.7274953Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:15:11.7275584Z return frozenset( 2025-09-07T06:15:11.7276197Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:15:11.7276865Z ) 2025-09-07T06:15:11.7277063Z 2025-09-07T06:15:11.7277070Z 2025-09-07T06:15:11.7277247Z def parse_args() -> Any: 2025-09-07T06:15:11.7278053Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:15:11.7278945Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:15:11.7279722Z parser.add_argument( 2025-09-07T06:15:11.7280184Z "--github-issue-repo", 2025-09-07T06:15:11.7280651Z type=str, 2025-09-07T06:15:11.7281062Z required=False, 2025-09-07T06:15:11.7281503Z default="pytorch/test-infra", 2025-09-07T06:15:11.7282035Z help="GitHub repo to get the issue", 2025-09-07T06:15:11.7282538Z ) 2025-09-07T06:15:11.7282902Z parser.add_argument( 2025-09-07T06:15:11.7283351Z "--github-repo", 2025-09-07T06:15:11.7283777Z type=str, 2025-09-07T06:15:11.7284174Z required=True, 2025-09-07T06:15:11.7284631Z help="GitHub repo where CI is running", 2025-09-07T06:15:11.7285154Z ) 2025-09-07T06:15:11.7285522Z parser.add_argument( 2025-09-07T06:15:11.7286119Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:15:11.7286773Z ) 2025-09-07T06:15:11.7287136Z parser.add_argument( 2025-09-07T06:15:11.7287940Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:15:11.7288618Z ) 2025-09-07T06:15:11.7288982Z parser.add_argument( 2025-09-07T06:15:11.7343977Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:15:11.7344954Z ) 2025-09-07T06:15:11.7345374Z parser.add_argument( 2025-09-07T06:15:11.7346048Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:15:11.7346780Z ) 2025-09-07T06:15:11.7347159Z parser.add_argument( 2025-09-07T06:15:11.7347797Z "--github-ref-type", 2025-09-07T06:15:11.7348300Z type=str, 2025-09-07T06:15:11.7348704Z required=True, 2025-09-07T06:15:11.7349197Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:15:11.7349749Z ) 2025-09-07T06:15:11.7350124Z parser.add_argument( 2025-09-07T06:15:11.7350580Z "--eligible-experiments", 2025-09-07T06:15:11.7351085Z type=_str_comma_separated_to_set, 2025-09-07T06:15:11.7351598Z required=False, 2025-09-07T06:15:11.7352006Z default="", 2025-09-07T06:15:11.7352854Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:15:11.7353772Z ) 2025-09-07T06:15:11.7354150Z parser.add_argument( 2025-09-07T06:15:11.7354612Z "--opt-out-experiments", 2025-09-07T06:15:11.7355122Z type=_str_comma_separated_to_set, 2025-09-07T06:15:11.7355637Z required=False, 2025-09-07T06:15:11.7356053Z default="", 2025-09-07T06:15:11.7356452Z help=( 2025-09-07T06:15:11.7357111Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:15:11.7358471Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:15:11.7359317Z ), 2025-09-07T06:15:11.7359670Z ) 2025-09-07T06:15:11.7360038Z parser.add_argument( 2025-09-07T06:15:11.7360477Z "--pr-number", 2025-09-07T06:15:11.7360896Z type=str, 2025-09-07T06:15:11.7361295Z required=False, 2025-09-07T06:15:11.7361724Z default="", 2025-09-07T06:15:11.7362382Z help="the optional PR number where this is run", 2025-09-07T06:15:11.7362965Z ) 2025-09-07T06:15:11.7363166Z 2025-09-07T06:15:11.7363358Z return parser.parse_args() 2025-09-07T06:15:11.7363668Z 2025-09-07T06:15:11.7363675Z 2025-09-07T06:15:11.7364073Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:15:11.7364822Z auth = Auth.Token(github_token) 2025-09-07T06:15:11.7365319Z return Github(auth=auth) 2025-09-07T06:15:11.7365612Z 2025-09-07T06:15:11.7365619Z 2025-09-07T06:15:11.7366074Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:15:11.7366869Z repo = gh.get_repo(repo) 2025-09-07T06:15:11.7367358Z return repo.get_issue(number=issue_num) 2025-09-07T06:15:11.7367879Z 2025-09-07T06:15:11.7367887Z 2025-09-07T06:15:11.7368079Z def get_potential_pr_author( 2025-09-07T06:15:11.7368722Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:15:11.7369400Z ) -> str: 2025-09-07T06:15:11.7369912Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:15:11.7370703Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:15:11.7371429Z # embedded in the tag name: ciflow// 2025-09-07T06:15:11.7371847Z 2025-09-07T06:15:11.7372039Z gh = get_gh_client(github_token) 2025-09-07T06:15:11.7372364Z 2025-09-07T06:15:11.7372627Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:15:11.7373243Z split_tag = ref_name.split("/") 2025-09-07T06:15:11.7373731Z if ( 2025-09-07T06:15:11.7374114Z len(split_tag) == 3 2025-09-07T06:15:11.7374596Z and split_tag[0] == "ciflow" 2025-09-07T06:15:11.7375112Z and split_tag[2].isnumeric() 2025-09-07T06:15:11.7375603Z ): 2025-09-07T06:15:11.7375982Z pr_number = split_tag[2] 2025-09-07T06:15:11.7376607Z try: 2025-09-07T06:15:11.7377034Z repository = gh.get_repo(repo) 2025-09-07T06:15:11.7377763Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:15:11.7378365Z except Exception as e: 2025-09-07T06:15:11.7378885Z raise Exception( # noqa: TRY002 2025-09-07T06:15:11.7379542Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:15:11.7380171Z ) from e 2025-09-07T06:15:11.7380699Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:15:11.7381380Z # In all other cases, return the original input username 2025-09-07T06:15:11.7381961Z return username 2025-09-07T06:15:11.7382200Z 2025-09-07T06:15:11.7382206Z 2025-09-07T06:15:11.7382427Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:15:11.7382950Z """ 2025-09-07T06:15:11.7383575Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:15:11.7384337Z """ 2025-09-07T06:15:11.7384878Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:15:11.7385386Z 2025-09-07T06:15:11.7385392Z 2025-09-07T06:15:11.7385587Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:15:11.7386071Z try: 2025-09-07T06:15:11.7386451Z data = yaml.safe_load(yaml_text) 2025-09-07T06:15:11.7386953Z return data 2025-09-07T06:15:11.7387361Z except yaml.YAMLError: 2025-09-07T06:15:11.7387992Z log.exception("Error loading YAML") 2025-09-07T06:15:11.7388499Z raise 2025-09-07T06:15:11.7388713Z 2025-09-07T06:15:11.7388719Z 2025-09-07T06:15:11.7389132Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:15:11.7389867Z """ 2025-09-07T06:15:11.7390478Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:15:11.7391077Z 2025-09-07T06:15:11.7391565Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:15:11.7392332Z and the text below is the list of opted in users. 2025-09-07T06:15:11.7392733Z 2025-09-07T06:15:11.7393102Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:15:11.7393798Z """ 2025-09-07T06:15:11.7394235Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:15:11.7394846Z if len(rollout_state_parts) >= 2: 2025-09-07T06:15:11.7395449Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:15:11.7396036Z else: 2025-09-07T06:15:11.7396406Z return "", rollout_state 2025-09-07T06:15:11.7396720Z 2025-09-07T06:15:11.7396728Z 2025-09-07T06:15:11.7396931Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:15:11.7397435Z """ 2025-09-07T06:15:11.7398093Z Dictionary of users with a list of features they have opted into 2025-09-07T06:15:11.7398739Z """ 2025-09-07T06:15:11.7398942Z 2025-09-07T06:15:11.7398949Z 2025-09-07T06:15:11.7399284Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:15:11.7399935Z """ 2025-09-07T06:15:11.7400641Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:15:11.7401321Z 2025-09-07T06:15:11.7401934Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:15:11.7402914Z - Example line: "@User1,lf,split_build" 2025-09-07T06:15:11.7403585Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:15:11.7404061Z 2025-09-07T06:15:11.7404067Z 2025-09-07T06:15:11.7404224Z """ 2025-09-07T06:15:11.7404584Z optins = UserOptins() 2025-09-07T06:15:11.7405069Z for user in user_optin_text.split("\n"): 2025-09-07T06:15:11.7405622Z user = user.strip("\r\n\t -") 2025-09-07T06:15:11.7406151Z if not user or not user.startswith("@"): 2025-09-07T06:15:11.7406842Z # Not a valid user. Skip 2025-09-07T06:15:11.7407319Z continue 2025-09-07T06:15:11.7407559Z 2025-09-07T06:15:11.7407840Z if user: 2025-09-07T06:15:11.7408272Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:15:11.7408958Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:15:11.7409448Z 2025-09-07T06:15:11.7409612Z return optins 2025-09-07T06:15:11.7409851Z 2025-09-07T06:15:11.7409858Z 2025-09-07T06:15:11.7410142Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:15:11.7410736Z """ 2025-09-07T06:15:11.7411121Z Check if the experiment name is valid. 2025-09-07T06:15:11.7411636Z A valid name: 2025-09-07T06:15:11.7412257Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:15:11.7413203Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:15:11.7413925Z - Cannot contain spaces 2025-09-07T06:15:11.7414384Z """ 2025-09-07T06:15:11.7414579Z 2025-09-07T06:15:11.7414843Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:15:11.7415528Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:15:11.7415963Z 2025-09-07T06:15:11.7416129Z if valid: 2025-09-07T06:15:11.7416498Z return True 2025-09-07T06:15:11.7416737Z 2025-09-07T06:15:11.7416894Z log.error( 2025-09-07T06:15:11.7418431Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-09-07T06:15:11.7419989Z ) 2025-09-07T06:15:11.7420347Z return False 2025-09-07T06:15:11.7420580Z 2025-09-07T06:15:11.7420586Z 2025-09-07T06:15:11.7420883Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:15:11.7421498Z """ 2025-09-07T06:15:11.7422253Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:15:11.7422981Z """ 2025-09-07T06:15:11.7423331Z try: 2025-09-07T06:15:11.7423695Z if settings_text: 2025-09-07T06:15:11.7424414Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:15:11.7425192Z # for easy reading 2025-09-07T06:15:11.7425971Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:15:11.7426848Z # the backtick character in shell commands. 2025-09-07T06:15:11.7427447Z backtick = chr(96) # backtick character 2025-09-07T06:15:11.7428266Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:15:11.7428937Z settings = load_yaml(settings_text) 2025-09-07T06:15:11.7429306Z 2025-09-07T06:15:11.7429722Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:15:11.7430471Z experiments = {} 2025-09-07T06:15:11.7430771Z 2025-09-07T06:15:11.7431141Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:15:11.7431909Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:15:11.7433008Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-09-07T06:15:11.7434048Z continue 2025-09-07T06:15:11.7434327Z 2025-09-07T06:15:11.7434505Z valid_settings = {} 2025-09-07T06:15:11.7435024Z for setting in exp_settings: 2025-09-07T06:15:11.7435584Z if setting not in Experiment._fields: 2025-09-07T06:15:11.7436137Z log.warning( 2025-09-07T06:15:11.7436830Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:15:11.7437799Z ) 2025-09-07T06:15:11.7438241Z else: 2025-09-07T06:15:11.7438750Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:15:11.7439169Z 2025-09-07T06:15:11.7439450Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:15:11.7440072Z return Settings(experiments) 2025-09-07T06:15:11.7440422Z 2025-09-07T06:15:11.7440595Z except Exception: 2025-09-07T06:15:11.7441061Z log.exception("Failed to parse settings") 2025-09-07T06:15:11.7441446Z 2025-09-07T06:15:11.7441615Z return Settings() 2025-09-07T06:15:11.7441868Z 2025-09-07T06:15:11.7441875Z 2025-09-07T06:15:11.7442122Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:15:11.7442674Z """ 2025-09-07T06:15:11.7443112Z Parse settings, if any, from the rollout state. 2025-09-07T06:15:11.7443507Z 2025-09-07T06:15:11.7443861Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:15:11.7444652Z and the text below is the list of opted in users. 2025-09-07T06:15:11.7445057Z 2025-09-07T06:15:11.7445465Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:15:11.7446189Z """ 2025-09-07T06:15:11.7446744Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:15:11.7447489Z return parse_settings_from_text(settings_text) 2025-09-07T06:15:11.7447997Z 2025-09-07T06:15:11.7448004Z 2025-09-07T06:15:11.7448253Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:15:11.7448806Z """ 2025-09-07T06:15:11.7449196Z Parse users from the rollout state. 2025-09-07T06:15:11.7449541Z 2025-09-07T06:15:11.7449702Z """ 2025-09-07T06:15:11.7450218Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:15:11.7450965Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:15:11.7451366Z 2025-09-07T06:15:11.7451373Z 2025-09-07T06:15:11.7451911Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:15:11.7452667Z """ 2025-09-07T06:15:11.7453077Z Check if a user is opted into an experiment 2025-09-07T06:15:11.7453608Z """ 2025-09-07T06:15:11.7454064Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:15:11.7454484Z 2025-09-07T06:15:11.7454490Z 2025-09-07T06:15:11.7454907Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:15:11.7455649Z """ 2025-09-07T06:15:11.7456105Z Check if a user explicitly opted out of an experiment 2025-09-07T06:15:11.7456685Z """ 2025-09-07T06:15:11.7457181Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:15:11.7457970Z experiment_optout = "-" + experiment_name 2025-09-07T06:15:11.7458606Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:15:11.7459201Z return False 2025-09-07T06:15:11.7459459Z 2025-09-07T06:15:11.7459736Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:15:11.7460331Z log.warning( 2025-09-07T06:15:11.7461130Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:15:11.7462002Z ) 2025-09-07T06:15:11.7462215Z 2025-09-07T06:15:11.7462384Z return True 2025-09-07T06:15:11.7462616Z 2025-09-07T06:15:11.7462622Z 2025-09-07T06:15:11.7462808Z def get_runner_prefix( 2025-09-07T06:15:11.7463239Z rollout_state: str, 2025-09-07T06:15:11.7463702Z workflow_requestors: Iterable[str], 2025-09-07T06:15:11.7464214Z branch: str, 2025-09-07T06:15:11.7464703Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:15:11.7465361Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:15:11.7465953Z is_canary: bool = False, 2025-09-07T06:15:11.7466401Z ) -> str: 2025-09-07T06:15:11.7466958Z settings = parse_settings(rollout_state) 2025-09-07T06:15:11.7467542Z user_optins = parse_users(rollout_state) 2025-09-07T06:15:11.7468076Z 2025-09-07T06:15:11.7468259Z fleet_prefix = "" 2025-09-07T06:15:11.7468674Z prefixes = [] 2025-09-07T06:15:11.7469289Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:15:11.7470229Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:15:11.7470930Z log.info( 2025-09-07T06:15:11.7471599Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:15:11.7472347Z ) 2025-09-07T06:15:11.7472728Z continue 2025-09-07T06:15:11.7472972Z 2025-09-07T06:15:11.7473163Z if opt_out_experiments: 2025-09-07T06:15:11.7473689Z if experiment_name in opt_out_experiments: 2025-09-07T06:15:11.7474322Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:15:11.7474904Z log.info( 2025-09-07T06:15:11.7475827Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:15:11.7476793Z ) 2025-09-07T06:15:11.7477192Z continue 2025-09-07T06:15:11.7477461Z 2025-09-07T06:15:11.7478297Z if eligible_experiments: 2025-09-07T06:15:11.7478899Z if experiment_name not in eligible_experiments: 2025-09-07T06:15:11.7479535Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:15:11.7480083Z log.info( 2025-09-07T06:15:11.7480857Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:15:11.7481683Z ) 2025-09-07T06:15:11.7482079Z continue 2025-09-07T06:15:11.7482547Z elif not experiment_settings.default: 2025-09-07T06:15:11.7483076Z log.info( 2025-09-07T06:15:11.7483874Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:15:11.7484613Z ) 2025-09-07T06:15:11.7484985Z continue 2025-09-07T06:15:11.7485229Z 2025-09-07T06:15:11.7485498Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:15:11.7486116Z opted_out_users = [ 2025-09-07T06:15:11.7486567Z requestor 2025-09-07T06:15:11.7487051Z for requestor in workflow_requestors 2025-09-07T06:15:11.7487831Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:15:11.7488456Z ] 2025-09-07T06:15:11.7488662Z 2025-09-07T06:15:11.7488849Z if opted_out_users: 2025-09-07T06:15:11.7489293Z log.info( 2025-09-07T06:15:11.7489904Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:15:11.7490594Z ) 2025-09-07T06:15:11.7490973Z continue 2025-09-07T06:15:11.7491224Z 2025-09-07T06:15:11.7491502Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:15:11.7492124Z opted_in_users = [ 2025-09-07T06:15:11.7492571Z requestor 2025-09-07T06:15:11.7493022Z for requestor in workflow_requestors 2025-09-07T06:15:11.7493683Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:15:11.7494290Z ] 2025-09-07T06:15:11.7494498Z 2025-09-07T06:15:11.7494667Z enabled = False 2025-09-07T06:15:11.7495092Z if opted_in_users: 2025-09-07T06:15:11.7495531Z log.info( 2025-09-07T06:15:11.7496125Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:15:11.7496797Z ) 2025-09-07T06:15:11.7497182Z enabled = True 2025-09-07T06:15:11.7497456Z 2025-09-07T06:15:11.7497770Z elif experiment_settings.rollout_perc: 2025-09-07T06:15:11.7498605Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:15:11.7499673Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:15:11.7500327Z log.info( 2025-09-07T06:15:11.7501178Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:15:11.7502102Z ) 2025-09-07T06:15:11.7502504Z enabled = True 2025-09-07T06:15:11.7502795Z 2025-09-07T06:15:11.7502960Z if enabled: 2025-09-07T06:15:11.7503378Z label = experiment_name 2025-09-07T06:15:11.7503921Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:15:11.7504752Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:15:11.7505617Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:15:11.7506375Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:15:11.7507036Z if is_canary: 2025-09-07T06:15:11.7507519Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:15:11.7508176Z fleet_prefix = label 2025-09-07T06:15:11.7508664Z else: 2025-09-07T06:15:11.7509085Z prefixes.append(label) 2025-09-07T06:15:11.7509424Z 2025-09-07T06:15:11.7509606Z if len(prefixes) > 1: 2025-09-07T06:15:11.7510049Z log.error( 2025-09-07T06:15:11.7511065Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-09-07T06:15:11.7512178Z ) 2025-09-07T06:15:11.7512565Z prefixes = prefixes[:1] 2025-09-07T06:15:11.7512871Z 2025-09-07T06:15:11.7513055Z # Fleet always comes first 2025-09-07T06:15:11.7513523Z if fleet_prefix: 2025-09-07T06:15:11.7513966Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:15:11.7514336Z 2025-09-07T06:15:11.7514715Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:15:11.7515136Z 2025-09-07T06:15:11.7515142Z 2025-09-07T06:15:11.7515585Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:15:11.7516341Z """ 2025-09-07T06:15:11.7516922Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:15:11.7517481Z 2025-09-07T06:15:11.7517972Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:15:11.7518673Z """ 2025-09-07T06:15:11.7519057Z gh = get_gh_client(github_token) 2025-09-07T06:15:11.7519602Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:15:11.7520236Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:15:11.7520681Z 2025-09-07T06:15:11.7520688Z 2025-09-07T06:15:11.7521082Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:15:11.7521847Z for _ in range(num_retries): 2025-09-07T06:15:11.7522314Z try: 2025-09-07T06:15:11.7522741Z req = Request(url=url, headers=headers) 2025-09-07T06:15:11.7523394Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:15:11.7524029Z return json.loads(content) 2025-09-07T06:15:11.7524544Z except Exception as e: 2025-09-07T06:15:11.7525077Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:15:11.7525472Z 2025-09-07T06:15:11.7525849Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:15:11.7526553Z return {} 2025-09-07T06:15:11.7526773Z 2025-09-07T06:15:11.7526786Z 2025-09-07T06:15:11.7526945Z @cache 2025-09-07T06:15:11.7527549Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:15:11.7528941Z """ 2025-09-07T06:15:11.7529348Z Dynamically get PR information 2025-09-07T06:15:11.7529833Z """ 2025-09-07T06:15:11.7530511Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:15:11.7531124Z headers = { 2025-09-07T06:15:11.7531585Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:15:11.7532183Z "Authorization": f"token {github_token}", 2025-09-07T06:15:11.7532716Z } 2025-09-07T06:15:11.7533135Z json_response: dict[str, Any] = download_json( 2025-09-07T06:15:11.7533741Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:15:11.7534279Z headers=headers, 2025-09-07T06:15:11.7534701Z ) 2025-09-07T06:15:11.7534901Z 2025-09-07T06:15:11.7535084Z if not json_response: 2025-09-07T06:15:11.7535653Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:15:11.7536261Z return {} 2025-09-07T06:15:11.7536494Z 2025-09-07T06:15:11.7536671Z return json_response 2025-09-07T06:15:11.7536940Z 2025-09-07T06:15:11.7536950Z 2025-09-07T06:15:11.7537344Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:15:11.7538207Z """ 2025-09-07T06:15:11.7538730Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:15:11.7539378Z """ 2025-09-07T06:15:11.7539859Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:15:11.7540466Z return { 2025-09-07T06:15:11.7541050Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:15:11.7541747Z } 2025-09-07T06:15:11.7541950Z 2025-09-07T06:15:11.7541957Z 2025-09-07T06:15:11.7542127Z def main() -> None: 2025-09-07T06:15:11.7542548Z args = parse_args() 2025-09-07T06:15:11.7542810Z 2025-09-07T06:15:11.7543027Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:15:11.7543406Z 2025-09-07T06:15:11.7543600Z # Check if the PR is opt-out 2025-09-07T06:15:11.7544084Z if args.pr_number: 2025-09-07T06:15:11.7544751Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:15:11.7545629Z if OPT_OUT_LABEL in labels: 2025-09-07T06:15:11.7546125Z log.info( 2025-09-07T06:15:11.7546810Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:15:11.7547561Z ) 2025-09-07T06:15:11.7548217Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:15:11.7548880Z sys.exit() 2025-09-07T06:15:11.7549143Z 2025-09-07T06:15:11.7549307Z try: 2025-09-07T06:15:11.7549740Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:15:11.7550439Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:15:11.7551067Z ) 2025-09-07T06:15:11.7551268Z 2025-09-07T06:15:11.7551470Z username = get_potential_pr_author( 2025-09-07T06:15:11.7552011Z args.github_token, 2025-09-07T06:15:11.7552483Z args.github_repo, 2025-09-07T06:15:11.7552954Z args.github_actor, 2025-09-07T06:15:11.7553438Z args.github_ref_type, 2025-09-07T06:15:11.7553935Z args.github_branch, 2025-09-07T06:15:11.7554397Z ) 2025-09-07T06:15:11.7554600Z 2025-09-07T06:15:11.7554877Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:15:11.7555323Z 2025-09-07T06:15:11.7555546Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:15:11.7556095Z rollout_state, 2025-09-07T06:15:11.7556574Z (args.github_issue_owner, username), 2025-09-07T06:15:11.7557110Z args.github_branch, 2025-09-07T06:15:11.7557703Z args.eligible_experiments, 2025-09-07T06:15:11.7558242Z args.opt_out_experiments, 2025-09-07T06:15:11.7558740Z is_canary, 2025-09-07T06:15:11.7559148Z ) 2025-09-07T06:15:11.7559354Z 2025-09-07T06:15:11.7559537Z except Exception as e: 2025-09-07T06:15:11.7560012Z log.error( 2025-09-07T06:15:11.7560674Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:15:11.7561566Z ) 2025-09-07T06:15:11.7561771Z 2025-09-07T06:15:11.7562097Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:15:11.7562594Z 2025-09-07T06:15:11.7562600Z 2025-09-07T06:15:11.7562779Z if __name__ == "__main__": 2025-09-07T06:15:11.7563208Z main() 2025-09-07T06:15:11.7563415Z 2025-09-07T06:15:11.7655542Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:15:11.7656430Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:15:11.7686815Z shell: /usr/bin/bash -e {0} 2025-09-07T06:15:11.7687401Z env: 2025-09-07T06:15:11.7688242Z GITHUB_TOKEN: *** 2025-09-07T06:15:11.7688668Z ISSUE_NUMBER: 5132 2025-09-07T06:15:11.7689118Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:15:11.7689615Z ISSUE_OWNER: 2025-09-07T06:15:11.7690016Z CHECK_EXPERIMENTS: 2025-09-07T06:15:11.7690428Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:15:11.7690864Z PR_NUMBER: 2025-09-07T06:15:11.7691238Z ##[endgroup] 2025-09-07T06:15:14.1485847Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:15:15.4109893Z Collecting urllib3==1.26.18 2025-09-07T06:15:15.4476226Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:15:15.4671873Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.7 MB/s eta 0:00:00 2025-09-07T06:15:15.4906096Z Collecting PyGithub==2.3.0 2025-09-07T06:15:15.4943537Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:15:15.5377077Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:15:15.5413064Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-09-07T06:15:15.5457933Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:15:15.5473458Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-09-07T06:15:15.5493671Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:15:15.5751644Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:15:15.5788049Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:15:15.6015219Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-09-07T06:15:15.7141565Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:15:15.7187281Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:15:15.8376748Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:15:15.8416792Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-09-07T06:15:15.8598904Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:15:15.8634086Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:15:15.8864749Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:15:15.8917301Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 40.4 MB/s eta 0:00:00 2025-09-07T06:15:15.8978349Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:15:15.9038335Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 82.3 MB/s eta 0:00:00 2025-09-07T06:15:15.9077188Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:15:15.9168191Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 121.3 MB/s eta 0:00:00 2025-09-07T06:15:15.9203777Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:15:15.9260346Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:15:15.9324706Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 98.0 MB/s eta 0:00:00 2025-09-07T06:15:15.9363655Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:15:15.9403778Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 32.7 MB/s eta 0:00:00 2025-09-07T06:15:15.9439779Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:15:15.9481857Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 42.4 MB/s eta 0:00:00 2025-09-07T06:15:16.3228063Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:15:16.8534394Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-09-07T06:15:16.9353186Z ##[group]Run curr_branch="main" 2025-09-07T06:15:16.9353514Z curr_branch="main" 2025-09-07T06:15:16.9353739Z curr_ref_type="branch" 2025-09-07T06:15:16.9354016Z echo "Current branch is '$curr_branch'" 2025-09-07T06:15:16.9354273Z  2025-09-07T06:15:16.9354457Z python3 runner_determinator.py \ 2025-09-07T06:15:16.9354738Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:15:16.9355006Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:15:16.9355260Z  --github-branch "$curr_branch" \ 2025-09-07T06:15:16.9355525Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:15:16.9355801Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:15:16.9356082Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:15:16.9356366Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:15:16.9356673Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:15:16.9357035Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:15:16.9357328Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:15:16.9388606Z shell: /usr/bin/bash -e {0} 2025-09-07T06:15:16.9388836Z env: 2025-09-07T06:15:16.9389400Z GITHUB_TOKEN: *** 2025-09-07T06:15:16.9389598Z ISSUE_NUMBER: 5132 2025-09-07T06:15:16.9389809Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:15:16.9390041Z ISSUE_OWNER: 2025-09-07T06:15:16.9390222Z CHECK_EXPERIMENTS: 2025-09-07T06:15:16.9390423Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:15:16.9390609Z PR_NUMBER: 2025-09-07T06:15:16.9390776Z ##[endgroup] 2025-09-07T06:15:16.9439358Z Current branch is 'main' 2025-09-07T06:15:18.8816080Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-09-07T06:15:18.8817249Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:15:18.8818450Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:15:18.8819319Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:15:18.8820026Z INFO : Setting output: label-type='lf.' 2025-09-07T06:15:18.9155744Z Evaluate and set job outputs 2025-09-07T06:15:18.9162498Z Set output 'label-type' 2025-09-07T06:15:18.9164327Z Cleaning up orphan processes