2025-08-26T19:31:41.6660500Z Current runner version: '2.328.0' 2025-08-26T19:31:41.6684592Z ##[group]Runner Image Provisioner 2025-08-26T19:31:41.6685406Z Hosted Compute Agent 2025-08-26T19:31:41.6685930Z Version: 20250818.377 2025-08-26T19:31:41.6686634Z Commit: 3c593e9f75fe0b87e893bca80d6e12ba089c61fc 2025-08-26T19:31:41.6687328Z Build Date: 2025-08-18T14:52:18Z 2025-08-26T19:31:41.6687925Z ##[endgroup] 2025-08-26T19:31:41.6688674Z ##[group]Operating System 2025-08-26T19:31:41.6689265Z Ubuntu 2025-08-26T19:31:41.6689717Z 24.04.2 2025-08-26T19:31:41.6690244Z LTS 2025-08-26T19:31:41.6690762Z ##[endgroup] 2025-08-26T19:31:41.6691218Z ##[group]Runner Image 2025-08-26T19:31:41.6691821Z Image: ubuntu-24.04 2025-08-26T19:31:41.6692314Z Version: 20250818.1.0 2025-08-26T19:31:41.6693306Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:41.6694857Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:41.6695833Z ##[endgroup] 2025-08-26T19:31:41.6696878Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:41.6699145Z Contents: read 2025-08-26T19:31:41.6699683Z Metadata: read 2025-08-26T19:31:41.6700272Z ##[endgroup] 2025-08-26T19:31:41.6702401Z Secret source: Actions 2025-08-26T19:31:41.6703078Z Prepare workflow directory 2025-08-26T19:31:41.7304245Z Prepare all required actions 2025-08-26T19:31:41.7386660Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:41.7394379Z ##[group] Inputs 2025-08-26T19:31:41.7395283Z check_experiments: 2025-08-26T19:31:41.7396285Z opt_out_experiments: 2025-08-26T19:31:41.7397285Z triggering_actor: pytorchmergebot 2025-08-26T19:31:41.7398559Z issue_owner: 2025-08-26T19:31:41.7399466Z curr_branch: main 2025-08-26T19:31:41.7400249Z curr_ref_type: branch 2025-08-26T19:31:41.7401334Z issue_number: 5132 2025-08-26T19:31:41.7402332Z ##[endgroup] 2025-08-26T19:31:41.7403381Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-26T19:31:42.3725376Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:42.3728258Z cat < runner_determinator.py 2025-08-26T19:31:42.3729377Z # flake8: noqa: G004 2025-08-26T19:31:42.3730002Z  2025-08-26T19:31:42.3730812Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:42.3732037Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:42.3733047Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:42.3733834Z  2025-08-26T19:31:42.3734336Z """ 2025-08-26T19:31:42.3735149Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:42.3736253Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:42.3737562Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:42.3738840Z of which runners should be used to run which job. 2025-08-26T19:31:42.3739569Z  2025-08-26T19:31:42.3740427Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:42.3741530Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:42.3742613Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:42.3743615Z list, defined. 2025-08-26T19:31:42.3744145Z  2025-08-26T19:31:42.3744869Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:42.3746048Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:42.3747105Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:42.3747886Z  2025-08-26T19:31:42.3749172Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:42.3750318Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:42.3751244Z experiments which the user could be opted in to. 2025-08-26T19:31:42.3752113Z  2025-08-26T19:31:42.3752676Z The user list has the following rules: 2025-08-26T19:31:42.3753361Z  2025-08-26T19:31:42.3754192Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:42.3755257Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:42.3756249Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:42.3756978Z  2025-08-26T19:31:42.3757511Z Example config: 2025-08-26T19:31:42.3758310Z  # A list of experiments that can be opted into. 2025-08-26T19:31:42.3759240Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:42.3760096Z  # Expected syntax is: 2025-08-26T19:31:42.3760927Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:42.3845210Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:42.3846488Z  2025-08-26T19:31:42.3846945Z  experiments: 2025-08-26T19:31:42.3847426Z  lf: 2025-08-26T19:31:42.3847887Z  rollout_percent: 25 2025-08-26T19:31:42.3848923Z  all_branches: false 2025-08-26T19:31:42.3849482Z  default: true 2025-08-26T19:31:42.3849970Z  --- 2025-08-26T19:31:42.3850390Z  2025-08-26T19:31:42.3850818Z  # Opt-ins: 2025-08-26T19:31:42.3851539Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:42.3853014Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:42.3853945Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:42.3854715Z  # Experiments should be from the above list. 2025-08-26T19:31:42.3855326Z  2025-08-26T19:31:42.3855768Z  @User1,-lf,split_build 2025-08-26T19:31:42.3856311Z  @User2,lf 2025-08-26T19:31:42.3856798Z  @User3,split_build 2025-08-26T19:31:42.3857302Z """ 2025-08-26T19:31:42.3857711Z  2025-08-26T19:31:42.3858372Z import json 2025-08-26T19:31:42.3858860Z import logging 2025-08-26T19:31:42.3859335Z import os 2025-08-26T19:31:42.3859778Z import random 2025-08-26T19:31:42.3860250Z import re 2025-08-26T19:31:42.3860688Z import sys 2025-08-26T19:31:42.3861188Z from argparse import ArgumentParser 2025-08-26T19:31:42.3861901Z from collections.abc import Iterable 2025-08-26T19:31:42.3862516Z from functools import cache 2025-08-26T19:31:42.3863082Z from logging import LogRecord 2025-08-26T19:31:42.3863672Z from typing import Any, NamedTuple 2025-08-26T19:31:42.3864322Z from urllib.request import Request, urlopen 2025-08-26T19:31:42.3864930Z  2025-08-26T19:31:42.3865341Z import yaml 2025-08-26T19:31:42.3865826Z from github import Auth, Github 2025-08-26T19:31:42.3866415Z from github.Issue import Issue 2025-08-26T19:31:42.3866961Z  2025-08-26T19:31:42.3867347Z  2025-08-26T19:31:42.3867846Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:42.3868755Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:42.3869764Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:42.3870544Z  2025-08-26T19:31:42.3871258Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:42.3871921Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:42.3872538Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:42.3873225Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:42.3873819Z  2025-08-26T19:31:42.3874280Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:42.3874854Z  2025-08-26T19:31:42.3875288Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:42.3875835Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:42.3876357Z  2025-08-26T19:31:42.3876749Z  2025-08-26T19:31:42.3877180Z class Experiment(NamedTuple): 2025-08-26T19:31:42.3877763Z  rollout_perc: float = ( 2025-08-26T19:31:42.3878637Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:42.3879400Z  ) 2025-08-26T19:31:42.3879838Z  all_branches: bool = ( 2025-08-26T19:31:42.3880608Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:42.3881362Z  ) 2025-08-26T19:31:42.3881796Z  default: bool = ( 2025-08-26T19:31:42.3882493Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:42.3883207Z  ) 2025-08-26T19:31:42.3883624Z  2025-08-26T19:31:42.3884053Z  # Add more fields as needed 2025-08-26T19:31:42.3884594Z  2025-08-26T19:31:42.3884976Z  2025-08-26T19:31:42.3885402Z class Settings(NamedTuple): 2025-08-26T19:31:42.3885935Z  """ 2025-08-26T19:31:42.3886491Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:42.3887154Z  """ 2025-08-26T19:31:42.3887568Z  2025-08-26T19:31:42.3888257Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:42.3888965Z  2025-08-26T19:31:42.3889522Z  2025-08-26T19:31:42.3890012Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:42.3890746Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:42.3891397Z  2025-08-26T19:31:42.3891801Z  COLORS = { 2025-08-26T19:31:42.3892307Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:42.3892889Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:42.3893469Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:42.3894055Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:42.3894636Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:42.3895181Z  } 2025-08-26T19:31:42.3895602Z  2025-08-26T19:31:42.3896088Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:42.3896927Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:42.3897805Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:42.3899002Z  return super().format(record) 2025-08-26T19:31:42.3899577Z  2025-08-26T19:31:42.3899969Z  2025-08-26T19:31:42.3900413Z handler = logging.StreamHandler() 2025-08-26T19:31:42.3901245Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:42.3902036Z  2025-08-26T19:31:42.3902564Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:42.3903238Z log.addHandler(handler) 2025-08-26T19:31:42.3903782Z log.setLevel(logging.INFO) 2025-08-26T19:31:42.3904302Z  2025-08-26T19:31:42.3904694Z  2025-08-26T19:31:42.3905218Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:42.3905880Z  """ 2025-08-26T19:31:42.3906500Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:42.3907374Z  """ 2025-08-26T19:31:42.3907828Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:42.3909178Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:42.3910425Z  log.warning( 2025-08-26T19:31:42.3911415Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:42.3912446Z  ) 2025-08-26T19:31:42.3912973Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:42.3913588Z  return 2025-08-26T19:31:42.3914049Z  2025-08-26T19:31:42.3914507Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:42.3915182Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:42.3915834Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:42.3916404Z  2025-08-26T19:31:42.3916809Z  2025-08-26T19:31:42.3917386Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:42.3918419Z  return frozenset( 2025-08-26T19:31:42.3919191Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:42.3919964Z  ) 2025-08-26T19:31:42.3920389Z  2025-08-26T19:31:42.3920790Z  2025-08-26T19:31:42.3921208Z def parse_args() -> Any: 2025-08-26T19:31:42.3921908Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:42.3922898Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:42.3923753Z  parser.add_argument( 2025-08-26T19:31:42.3924322Z  "--github-issue-repo", 2025-08-26T19:31:42.3924883Z  type=str, 2025-08-26T19:31:42.3925404Z  required=False, 2025-08-26T19:31:42.3926126Z  default="pytorch/test-infra", 2025-08-26T19:31:42.3926800Z  help="GitHub repo to get the issue", 2025-08-26T19:31:42.3927391Z  ) 2025-08-26T19:31:42.3927835Z  parser.add_argument( 2025-08-26T19:31:42.3928673Z  "--github-repo", 2025-08-26T19:31:42.3929217Z  type=str, 2025-08-26T19:31:42.3929720Z  required=True, 2025-08-26T19:31:42.3930295Z  help="GitHub repo where CI is running", 2025-08-26T19:31:42.3930897Z  ) 2025-08-26T19:31:42.3931347Z  parser.add_argument( 2025-08-26T19:31:42.3932080Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:42.3932822Z  ) 2025-08-26T19:31:42.3933266Z  parser.add_argument( 2025-08-26T19:31:42.3934018Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:42.3934788Z  ) 2025-08-26T19:31:42.3935239Z  parser.add_argument( 2025-08-26T19:31:42.3935995Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:42.3936770Z  ) 2025-08-26T19:31:42.3937223Z  parser.add_argument( 2025-08-26T19:31:42.3938784Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:42.3939670Z  ) 2025-08-26T19:31:42.3940156Z  parser.add_argument( 2025-08-26T19:31:42.3940720Z  "--github-ref-type", 2025-08-26T19:31:42.3941281Z  type=str, 2025-08-26T19:31:42.3941791Z  required=True, 2025-08-26T19:31:42.3942428Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:42.3943060Z  ) 2025-08-26T19:31:42.3943510Z  parser.add_argument( 2025-08-26T19:31:42.3944295Z  "--eligible-experiments", 2025-08-26T19:31:42.3944928Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:42.3945542Z  required=False, 2025-08-26T19:31:42.3946067Z  default="", 2025-08-26T19:31:42.3947061Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:42.3948308Z  ) 2025-08-26T19:31:42.3948779Z  parser.add_argument( 2025-08-26T19:31:42.3949348Z  "--opt-out-experiments", 2025-08-26T19:31:42.3949959Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:42.3950563Z  required=False, 2025-08-26T19:31:42.3951079Z  default="", 2025-08-26T19:31:42.3951578Z  help=( 2025-08-26T19:31:42.3952408Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:42.3953661Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:42.3954588Z  ), 2025-08-26T19:31:42.3955026Z  ) 2025-08-26T19:31:42.3955482Z  parser.add_argument( 2025-08-26T19:31:42.3956020Z  "--pr-number", 2025-08-26T19:31:42.3956545Z  type=str, 2025-08-26T19:31:42.3957051Z  required=False, 2025-08-26T19:31:42.3957574Z  default="", 2025-08-26T19:31:42.3958299Z  help="the optional PR number where this is run", 2025-08-26T19:31:42.3958939Z  ) 2025-08-26T19:31:42.3959357Z  2025-08-26T19:31:42.3959794Z  return parser.parse_args() 2025-08-26T19:31:42.3960352Z  2025-08-26T19:31:42.3960744Z  2025-08-26T19:31:42.3961436Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.3962460Z  auth = Auth.Token(github_token) 2025-08-26T19:31:42.3963109Z  return Github(auth=auth) 2025-08-26T19:31:42.3963648Z  2025-08-26T19:31:42.3964037Z  2025-08-26T19:31:42.3964793Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.3965696Z  repo = gh.get_repo(repo) 2025-08-26T19:31:42.3966328Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:42.3966944Z  2025-08-26T19:31:42.3967342Z  2025-08-26T19:31:42.3967779Z def get_potential_pr_author( 2025-08-26T19:31:42.3968868Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:42.3969659Z ) -> str: 2025-08-26T19:31:42.3970288Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:42.3971237Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:42.3972114Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:42.3972766Z  2025-08-26T19:31:42.3973225Z  gh = get_gh_client(github_token) 2025-08-26T19:31:42.3973793Z  2025-08-26T19:31:42.3974344Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:42.3975071Z  split_tag = ref_name.split("/") 2025-08-26T19:31:42.3975657Z  if ( 2025-08-26T19:31:42.3976145Z  len(split_tag) == 3 2025-08-26T19:31:42.3976738Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:42.3977362Z  and split_tag[2].isnumeric() 2025-08-26T19:31:42.3977933Z  ): 2025-08-26T19:31:42.3978573Z  pr_number = split_tag[2] 2025-08-26T19:31:42.3979147Z  try: 2025-08-26T19:31:42.3979688Z  repository = gh.get_repo(repo) 2025-08-26T19:31:42.3980572Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:42.3981283Z  except Exception as e: 2025-08-26T19:31:42.3981903Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:42.3982674Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:42.3983408Z  ) from e 2025-08-26T19:31:42.3984068Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:42.3984874Z  # In all other cases, return the original input username 2025-08-26T19:31:42.3985554Z  return username 2025-08-26T19:31:42.3986039Z  2025-08-26T19:31:42.3986443Z  2025-08-26T19:31:42.3986930Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:42.3987541Z  """ 2025-08-26T19:31:42.3988413Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:42.3989300Z  """ 2025-08-26T19:31:42.3989947Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:42.3990691Z  2025-08-26T19:31:42.3991095Z  2025-08-26T19:31:42.3991546Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:42.3992128Z  try: 2025-08-26T19:31:42.3992618Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:42.3993218Z  return data 2025-08-26T19:31:42.3993739Z  except yaml.YAMLError: 2025-08-26T19:31:42.3994340Z  log.exception("Error loading YAML") 2025-08-26T19:31:42.3994936Z  raise 2025-08-26T19:31:42.3995393Z  2025-08-26T19:31:42.3995793Z  2025-08-26T19:31:42.3996487Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:42.3997322Z  """ 2025-08-26T19:31:42.3998272Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:42.3999119Z  2025-08-26T19:31:42.3999732Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.4000602Z  and the text below is the list of opted in users. 2025-08-26T19:31:42.4001236Z  2025-08-26T19:31:42.4001957Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:42.4002922Z  """ 2025-08-26T19:31:42.4003473Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:42.4004172Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:42.4005060Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:42.4005858Z  else: 2025-08-26T19:31:42.4006338Z  return "", rollout_state 2025-08-26T19:31:42.4006889Z  2025-08-26T19:31:42.4007285Z  2025-08-26T19:31:42.4007751Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:42.4008466Z  """ 2025-08-26T19:31:42.4009083Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:42.4009834Z  """ 2025-08-26T19:31:42.4010386Z  2025-08-26T19:31:42.4010784Z  2025-08-26T19:31:42.4011390Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:42.4012125Z  """ 2025-08-26T19:31:42.4013170Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:42.4014151Z  2025-08-26T19:31:42.4015063Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:42.4016170Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:42.4017147Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:42.4017862Z  2025-08-26T19:31:42.4018384Z  2025-08-26T19:31:42.4018781Z  """ 2025-08-26T19:31:42.4019225Z  optins = UserOptins() 2025-08-26T19:31:42.4019833Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:42.4020488Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:42.4021136Z  if not user or not user.startswith("@"): 2025-08-26T19:31:42.4021782Z  # Not a valid user. Skip 2025-08-26T19:31:42.4022360Z  continue 2025-08-26T19:31:42.4022892Z  2025-08-26T19:31:42.4023295Z  if user: 2025-08-26T19:31:42.4023846Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:42.4024631Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:42.4025361Z  2025-08-26T19:31:42.4025790Z  return optins 2025-08-26T19:31:42.4026262Z  2025-08-26T19:31:42.4026652Z  2025-08-26T19:31:42.4027217Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:42.4027911Z  """ 2025-08-26T19:31:42.4028509Z  Check if the experiment name is valid. 2025-08-26T19:31:42.4029113Z  A valid name: 2025-08-26T19:31:42.4029872Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:42.4030915Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:42.4031720Z  - Cannot contain spaces 2025-08-26T19:31:42.4032262Z  """ 2025-08-26T19:31:42.4032680Z  2025-08-26T19:31:42.4033202Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:42.4034022Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:42.4034846Z  2025-08-26T19:31:42.4035564Z  if valid: 2025-08-26T19:31:42.4036051Z  return True 2025-08-26T19:31:42.4036530Z  2025-08-26T19:31:42.4036942Z  log.error( 2025-08-26T19:31:42.4038658Z  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-26T19:31:42.4040357Z  ) 2025-08-26T19:31:42.4040787Z  return False 2025-08-26T19:31:42.4041257Z  2025-08-26T19:31:42.4041642Z  2025-08-26T19:31:42.4042223Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:42.4042937Z  """ 2025-08-26T19:31:42.4043623Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:42.4044426Z  """ 2025-08-26T19:31:42.4044852Z  try: 2025-08-26T19:31:42.4045293Z  if settings_text: 2025-08-26T19:31:42.4046139Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:42.4047019Z  # for easy reading 2025-08-26T19:31:42.4047936Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:42.4049025Z  # the backtick character in shell commands. 2025-08-26T19:31:42.4049718Z  backtick = chr(96) # backtick character 2025-08-26T19:31:42.4050498Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:42.4051246Z  settings = load_yaml(settings_text) 2025-08-26T19:31:42.4051864Z  2025-08-26T19:31:42.4052548Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:42.4053537Z  experiments = {} 2025-08-26T19:31:42.4054059Z  2025-08-26T19:31:42.4054694Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:42.4055552Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:42.4056767Z  # 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-26T19:31:42.4057953Z  continue 2025-08-26T19:31:42.4058596Z  2025-08-26T19:31:42.4059040Z  valid_settings = {} 2025-08-26T19:31:42.4059665Z  for setting in exp_settings: 2025-08-26T19:31:42.4060318Z  if setting not in Experiment._fields: 2025-08-26T19:31:42.4060974Z  log.warning( 2025-08-26T19:31:42.4061822Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:42.4062629Z  ) 2025-08-26T19:31:42.4063155Z  else: 2025-08-26T19:31:42.4063784Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:42.4064435Z  2025-08-26T19:31:42.4064980Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:42.4065713Z  return Settings(experiments) 2025-08-26T19:31:42.4066284Z  2025-08-26T19:31:42.4066708Z  except Exception: 2025-08-26T19:31:42.4067295Z  log.exception("Failed to parse settings") 2025-08-26T19:31:42.4067912Z  2025-08-26T19:31:42.4068429Z  return Settings() 2025-08-26T19:31:42.4068921Z  2025-08-26T19:31:42.4069323Z  2025-08-26T19:31:42.4069980Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:42.4070649Z  """ 2025-08-26T19:31:42.4071177Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:42.4071810Z  2025-08-26T19:31:42.4072425Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.4073294Z  and the text below is the list of opted in users. 2025-08-26T19:31:42.4073932Z  2025-08-26T19:31:42.4074612Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:42.4075432Z  """ 2025-08-26T19:31:42.4076085Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.4076958Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:42.4077578Z  2025-08-26T19:31:42.4078082Z  2025-08-26T19:31:42.4078621Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:42.4079266Z  """ 2025-08-26T19:31:42.4079746Z  Parse users from the rollout state. 2025-08-26T19:31:42.4080320Z  2025-08-26T19:31:42.4080716Z  """ 2025-08-26T19:31:42.4081339Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.4082188Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:42.4082804Z  2025-08-26T19:31:42.4083196Z  2025-08-26T19:31:42.4083894Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.4084725Z  """ 2025-08-26T19:31:42.4085230Z  Check if a user is opted into an experiment 2025-08-26T19:31:42.4085850Z  """ 2025-08-26T19:31:42.4086404Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:42.4087055Z  2025-08-26T19:31:42.4087585Z  2025-08-26T19:31:42.4088416Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.4089255Z  """ 2025-08-26T19:31:42.4089810Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:42.4090462Z  """ 2025-08-26T19:31:42.4091065Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:42.4091852Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:42.4092598Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:42.4093292Z  return False 2025-08-26T19:31:42.4093776Z  2025-08-26T19:31:42.4094328Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:42.4095013Z  log.warning( 2025-08-26T19:31:42.4095960Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:42.4096931Z  ) 2025-08-26T19:31:42.4097367Z  2025-08-26T19:31:42.4097768Z  return True 2025-08-26T19:31:42.4098332Z  2025-08-26T19:31:42.4098730Z  2025-08-26T19:31:42.4099144Z def get_runner_prefix( 2025-08-26T19:31:42.4099685Z  rollout_state: str, 2025-08-26T19:31:42.4100254Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:42.4100847Z  branch: str, 2025-08-26T19:31:42.4101468Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.4102250Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.4102918Z  is_canary: bool = False, 2025-08-26T19:31:42.4103447Z ) -> str: 2025-08-26T19:31:42.4103971Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:42.4104647Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:42.4105256Z  2025-08-26T19:31:42.4105808Z  fleet_prefix = "" 2025-08-26T19:31:42.4106340Z  prefixes = [] 2025-08-26T19:31:42.4107091Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:42.4108249Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:42.4109066Z  log.info( 2025-08-26T19:31:42.4109857Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:42.4110833Z  ) 2025-08-26T19:31:42.4111420Z  continue 2025-08-26T19:31:42.4111906Z  2025-08-26T19:31:42.4112342Z  if opt_out_experiments: 2025-08-26T19:31:42.4112985Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:42.4113741Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:42.4114426Z  log.info( 2025-08-26T19:31:42.4115492Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:42.4116559Z  ) 2025-08-26T19:31:42.4117051Z  continue 2025-08-26T19:31:42.4117559Z  2025-08-26T19:31:42.4118110Z  if eligible_experiments: 2025-08-26T19:31:42.4118793Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:42.4119517Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:42.4120154Z  log.info( 2025-08-26T19:31:42.4121061Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:42.4122002Z  ) 2025-08-26T19:31:42.4122657Z  continue 2025-08-26T19:31:42.4123240Z  elif not experiment_settings.default: 2025-08-26T19:31:42.4123853Z  log.info( 2025-08-26T19:31:42.4124624Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:42.4125446Z  ) 2025-08-26T19:31:42.4125909Z  continue 2025-08-26T19:31:42.4126392Z  2025-08-26T19:31:42.4126931Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:42.4127633Z  opted_out_users = [ 2025-08-26T19:31:42.4128294Z  requestor 2025-08-26T19:31:42.4128855Z  for requestor in workflow_requestors 2025-08-26T19:31:42.4129628Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.4130340Z  ] 2025-08-26T19:31:42.4130773Z  2025-08-26T19:31:42.4131204Z  if opted_out_users: 2025-08-26T19:31:42.4131767Z  log.info( 2025-08-26T19:31:42.4132512Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:42.4133290Z  ) 2025-08-26T19:31:42.4133756Z  continue 2025-08-26T19:31:42.4134240Z  2025-08-26T19:31:42.4134781Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:42.4135467Z  opted_in_users = [ 2025-08-26T19:31:42.4136027Z  requestor 2025-08-26T19:31:42.4136589Z  for requestor in workflow_requestors 2025-08-26T19:31:42.4137350Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.4138154Z  ] 2025-08-26T19:31:42.4138589Z  2025-08-26T19:31:42.4139009Z  enabled = False 2025-08-26T19:31:42.4139547Z  if opted_in_users: 2025-08-26T19:31:42.4140226Z  log.info( 2025-08-26T19:31:42.4140962Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:42.4141721Z  ) 2025-08-26T19:31:42.4142199Z  enabled = True 2025-08-26T19:31:42.4142713Z  2025-08-26T19:31:42.4143185Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:42.4144122Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:42.4145186Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:42.4145922Z  log.info( 2025-08-26T19:31:42.4146913Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:42.4147923Z  ) 2025-08-26T19:31:42.4148587Z  enabled = True 2025-08-26T19:31:42.4149136Z  2025-08-26T19:31:42.4149543Z  if enabled: 2025-08-26T19:31:42.4150073Z  label = experiment_name 2025-08-26T19:31:42.4150723Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:42.4151659Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:42.4152679Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:42.4153534Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:42.4154276Z  if is_canary: 2025-08-26T19:31:42.4154870Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:42.4155493Z  fleet_prefix = label 2025-08-26T19:31:42.4156067Z  else: 2025-08-26T19:31:42.4156740Z  prefixes.append(label) 2025-08-26T19:31:42.4157318Z  2025-08-26T19:31:42.4157736Z  if len(prefixes) > 1: 2025-08-26T19:31:42.4158388Z  log.error( 2025-08-26T19:31:42.4159573Z  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-26T19:31:42.4160802Z  ) 2025-08-26T19:31:42.4161275Z  prefixes = prefixes[:1] 2025-08-26T19:31:42.4161815Z  2025-08-26T19:31:42.4162241Z  # Fleet always comes first 2025-08-26T19:31:42.4162800Z  if fleet_prefix: 2025-08-26T19:31:42.4163349Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:42.4163931Z  2025-08-26T19:31:42.4164443Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:42.4165088Z  2025-08-26T19:31:42.4165485Z  2025-08-26T19:31:42.4166337Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:42.4167202Z  """ 2025-08-26T19:31:42.4167883Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:42.4168779Z  2025-08-26T19:31:42.4169436Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:42.4170224Z  """ 2025-08-26T19:31:42.4170693Z  gh = get_gh_client(github_token) 2025-08-26T19:31:42.4171340Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:42.4172078Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:42.4172758Z  2025-08-26T19:31:42.4173150Z  2025-08-26T19:31:42.4173829Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:42.4174821Z  for _ in range(num_retries): 2025-08-26T19:31:42.4175385Z  try: 2025-08-26T19:31:42.4175906Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:42.4176657Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:42.4177397Z  return json.loads(content) 2025-08-26T19:31:42.4178106Z  except Exception as e: 2025-08-26T19:31:42.4178761Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:42.4179388Z  2025-08-26T19:31:42.4180035Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:42.4180830Z  return {} 2025-08-26T19:31:42.4181281Z  2025-08-26T19:31:42.4181679Z  2025-08-26T19:31:42.4182066Z @cache 2025-08-26T19:31:42.4182800Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:42.4183653Z  """ 2025-08-26T19:31:42.4184120Z  Dynamically get PR information 2025-08-26T19:31:42.4184685Z  """ 2025-08-26T19:31:42.4185272Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:42.4185988Z  headers = { 2025-08-26T19:31:42.4186541Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:42.4187242Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:42.4187842Z  } 2025-08-26T19:31:42.4188486Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:42.4189193Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:42.4189810Z  headers=headers, 2025-08-26T19:31:42.4190333Z  ) 2025-08-26T19:31:42.4190752Z  2025-08-26T19:31:42.4191179Z  if not json_response: 2025-08-26T19:31:42.4191864Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:42.4192732Z  return {} 2025-08-26T19:31:42.4193213Z  2025-08-26T19:31:42.4193633Z  return json_response 2025-08-26T19:31:42.4194160Z  2025-08-26T19:31:42.4194551Z  2025-08-26T19:31:42.4195239Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:42.4196060Z  """ 2025-08-26T19:31:42.4196691Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:42.4197424Z  """ 2025-08-26T19:31:42.4198116Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:42.4198831Z  return { 2025-08-26T19:31:42.4199519Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:42.4200296Z  } 2025-08-26T19:31:42.4200711Z  2025-08-26T19:31:42.4201131Z  2025-08-26T19:31:42.4201556Z def main() -> None: 2025-08-26T19:31:42.4202085Z  args = parse_args() 2025-08-26T19:31:42.4202598Z  2025-08-26T19:31:42.4203085Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:42.4203697Z  2025-08-26T19:31:42.4204134Z  # Check if the PR is opt-out 2025-08-26T19:31:42.4204720Z  if args.pr_number: 2025-08-26T19:31:42.4205495Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:42.4206350Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:42.4206927Z  log.info( 2025-08-26T19:31:42.4207745Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:42.4208715Z  ) 2025-08-26T19:31:42.4209379Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:42.4210154Z  sys.exit() 2025-08-26T19:31:42.4210787Z  2025-08-26T19:31:42.4211193Z  try: 2025-08-26T19:31:42.4211717Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:42.4212541Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:42.4213260Z  ) 2025-08-26T19:31:42.4213685Z  2025-08-26T19:31:42.4214147Z  username = get_potential_pr_author( 2025-08-26T19:31:42.4214759Z  args.github_token, 2025-08-26T19:31:42.4215334Z  args.github_repo, 2025-08-26T19:31:42.4215893Z  args.github_actor, 2025-08-26T19:31:42.4216474Z  args.github_ref_type, 2025-08-26T19:31:42.4217058Z  args.github_branch, 2025-08-26T19:31:42.4217606Z  ) 2025-08-26T19:31:42.4218147Z  2025-08-26T19:31:42.4218709Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:42.4219401Z  2025-08-26T19:31:42.4219876Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:42.4220506Z  rollout_state, 2025-08-26T19:31:42.4221099Z  (args.github_issue_owner, username), 2025-08-26T19:31:42.4221727Z  args.github_branch, 2025-08-26T19:31:42.4222332Z  args.eligible_experiments, 2025-08-26T19:31:42.4222946Z  args.opt_out_experiments, 2025-08-26T19:31:42.4223531Z  is_canary, 2025-08-26T19:31:42.4224028Z  ) 2025-08-26T19:31:42.4224462Z  2025-08-26T19:31:42.4224884Z  except Exception as e: 2025-08-26T19:31:42.4225449Z  log.error( 2025-08-26T19:31:42.4226253Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:42.4227300Z  ) 2025-08-26T19:31:42.4227741Z  2025-08-26T19:31:42.4228464Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:42.4229228Z  2025-08-26T19:31:42.4229620Z  2025-08-26T19:31:42.4230038Z if __name__ == "__main__": 2025-08-26T19:31:42.4230564Z  main() 2025-08-26T19:31:42.4231003Z  2025-08-26T19:31:42.4231391Z EOF 2025-08-26T19:31:42.4231804Z  2025-08-26T19:31:42.4232232Z cat runner_determinator.py 2025-08-26T19:31:42.5944123Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:42.5945229Z env: 2025-08-26T19:31:42.5946324Z GITHUB_TOKEN: *** 2025-08-26T19:31:42.5946936Z ISSUE_NUMBER: 5132 2025-08-26T19:31:42.5947582Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:42.5948489Z ISSUE_OWNER: 2025-08-26T19:31:42.5949081Z CHECK_EXPERIMENTS: 2025-08-26T19:31:42.5949768Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:42.5950415Z PR_NUMBER: 2025-08-26T19:31:42.5950999Z ##[endgroup] 2025-08-26T19:31:42.6172947Z # flake8: noqa: G004 2025-08-26T19:31:42.6173427Z 2025-08-26T19:31:42.6174140Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:42.6175709Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:42.6177184Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:42.6178192Z 2025-08-26T19:31:42.6178602Z """ 2025-08-26T19:31:42.6179756Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:42.6181526Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:42.6183369Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:42.6185001Z of which runners should be used to run which job. 2025-08-26T19:31:42.6185788Z 2025-08-26T19:31:42.6186527Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:42.6188703Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:42.6190607Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:42.6192131Z list, defined. 2025-08-26T19:31:42.6192618Z 2025-08-26T19:31:42.6193398Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:42.6195412Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:42.6197265Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:42.6198475Z 2025-08-26T19:31:42.6199286Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:42.6201219Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:42.6202992Z experiments which the user could be opted in to. 2025-08-26T19:31:42.6203978Z 2025-08-26T19:31:42.6204421Z The user list has the following rules: 2025-08-26T19:31:42.6205263Z 2025-08-26T19:31:42.6206036Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:42.6208438Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:42.6210362Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:42.6211320Z 2025-08-26T19:31:42.6211702Z Example config: 2025-08-26T19:31:42.6212718Z # A list of experiments that can be opted into. 2025-08-26T19:31:42.6214313Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:42.6215827Z # Expected syntax is: 2025-08-26T19:31:42.6217327Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:42.6219948Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:42.6221487Z 2025-08-26T19:31:42.6221852Z experiments: 2025-08-26T19:31:42.6222686Z lf: 2025-08-26T19:31:42.6223459Z rollout_percent: 25 2025-08-26T19:31:42.6224708Z all_branches: false 2025-08-26T19:31:42.6225683Z default: true 2025-08-26T19:31:42.6226542Z --- 2025-08-26T19:31:42.6226950Z 2025-08-26T19:31:42.6227267Z # Opt-ins: 2025-08-26T19:31:42.6228661Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:42.6230725Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:42.6232549Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:42.6234043Z # Experiments should be from the above list. 2025-08-26T19:31:42.6234922Z 2025-08-26T19:31:42.6235275Z @User1,-lf,split_build 2025-08-26T19:31:42.6236205Z @User2,lf 2025-08-26T19:31:42.6236974Z @User3,split_build 2025-08-26T19:31:42.6237811Z """ 2025-08-26T19:31:42.6238285Z 2025-08-26T19:31:42.6238603Z import json 2025-08-26T19:31:42.6239340Z import logging 2025-08-26T19:31:42.6240104Z import os 2025-08-26T19:31:42.6240827Z import random 2025-08-26T19:31:42.6241582Z import re 2025-08-26T19:31:42.6242313Z import sys 2025-08-26T19:31:42.6243126Z from argparse import ArgumentParser 2025-08-26T19:31:42.6244270Z from collections.abc import Iterable 2025-08-26T19:31:42.6245413Z from functools import cache 2025-08-26T19:31:42.6246419Z from logging import LogRecord 2025-08-26T19:31:42.6247485Z from typing import Any, NamedTuple 2025-08-26T19:31:42.6248942Z from urllib.request import Request, urlopen 2025-08-26T19:31:42.6249818Z 2025-08-26T19:31:42.6250139Z import yaml 2025-08-26T19:31:42.6250923Z from github import Auth, Github 2025-08-26T19:31:42.6251983Z from github.Issue import Issue 2025-08-26T19:31:42.6252670Z 2025-08-26T19:31:42.6252677Z 2025-08-26T19:31:42.6253129Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:42.6254703Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:42.6256742Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:42.6258255Z 2025-08-26T19:31:42.6258735Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:42.6260172Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:42.6261271Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:42.6262484Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:42.6263306Z 2025-08-26T19:31:42.6263706Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:42.6264453Z 2025-08-26T19:31:42.6264811Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:42.6265807Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:42.6266445Z 2025-08-26T19:31:42.6266453Z 2025-08-26T19:31:42.6266829Z class Experiment(NamedTuple): 2025-08-26T19:31:42.6267855Z rollout_perc: float = ( 2025-08-26T19:31:42.6269404Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:42.6270986Z ) 2025-08-26T19:31:42.6271716Z all_branches: bool = ( 2025-08-26T19:31:42.6273131Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:42.6274698Z ) 2025-08-26T19:31:42.6275417Z default: bool = ( 2025-08-26T19:31:42.6276665Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:42.6278256Z ) 2025-08-26T19:31:42.6278655Z 2025-08-26T19:31:42.6279008Z # Add more fields as needed 2025-08-26T19:31:42.6279677Z 2025-08-26T19:31:42.6279685Z 2025-08-26T19:31:42.6280052Z class Settings(NamedTuple): 2025-08-26T19:31:42.6280969Z """ 2025-08-26T19:31:42.6281896Z Settings for the experiments that can be opted into. 2025-08-26T19:31:42.6283150Z """ 2025-08-26T19:31:42.6283535Z 2025-08-26T19:31:42.6283944Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:42.6284771Z 2025-08-26T19:31:42.6284779Z 2025-08-26T19:31:42.6285200Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:42.6286567Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:42.6287570Z 2025-08-26T19:31:42.6287873Z COLORS = { 2025-08-26T19:31:42.6288870Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:42.6290118Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:42.6291168Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:42.6292223Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:42.6293238Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:42.6294231Z } 2025-08-26T19:31:42.6294613Z 2025-08-26T19:31:42.6295048Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:42.6296778Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:42.6298744Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:42.6300023Z return super().format(record) 2025-08-26T19:31:42.6300765Z 2025-08-26T19:31:42.6300773Z 2025-08-26T19:31:42.6301160Z handler = logging.StreamHandler() 2025-08-26T19:31:42.6302755Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:42.6304098Z 2025-08-26T19:31:42.6304600Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:42.6305914Z log.addHandler(handler) 2025-08-26T19:31:42.6306835Z log.setLevel(logging.INFO) 2025-08-26T19:31:42.6307453Z 2025-08-26T19:31:42.6307460Z 2025-08-26T19:31:42.6308057Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:42.6309285Z """ 2025-08-26T19:31:42.6310335Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:42.6311732Z """ 2025-08-26T19:31:42.6312439Z if not GITHUB_OUTPUT: 2025-08-26T19:31:42.6315084Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:42.6317913Z log.warning( 2025-08-26T19:31:42.6319963Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:42.6322174Z ) 2025-08-26T19:31:42.6334233Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:42.6335484Z return 2025-08-26T19:31:42.6335946Z 2025-08-26T19:31:42.6336616Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:42.6337876Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:42.6339414Z f.write(f"{key}={value}\n") 2025-08-26T19:31:42.6340143Z 2025-08-26T19:31:42.6340151Z 2025-08-26T19:31:42.6340823Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:42.6342244Z return frozenset( 2025-08-26T19:31:42.6343601Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:42.6345190Z ) 2025-08-26T19:31:42.6345578Z 2025-08-26T19:31:42.6345585Z 2025-08-26T19:31:42.6345924Z def parse_args() -> Any: 2025-08-26T19:31:42.6347096Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:42.6349237Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:42.6351018Z parser.add_argument( 2025-08-26T19:31:42.6351936Z "--github-issue-repo", 2025-08-26T19:31:42.6353198Z type=str, 2025-08-26T19:31:42.6354150Z required=False, 2025-08-26T19:31:42.6355085Z default="pytorch/test-infra", 2025-08-26T19:31:42.6356194Z help="GitHub repo to get the issue", 2025-08-26T19:31:42.6357248Z ) 2025-08-26T19:31:42.6357934Z parser.add_argument( 2025-08-26T19:31:42.6359054Z "--github-repo", 2025-08-26T19:31:42.6359910Z type=str, 2025-08-26T19:31:42.6360663Z required=True, 2025-08-26T19:31:42.6361575Z help="GitHub repo where CI is running", 2025-08-26T19:31:42.6362676Z ) 2025-08-26T19:31:42.6363366Z parser.add_argument( 2025-08-26T19:31:42.6364649Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:42.6366101Z ) 2025-08-26T19:31:42.6366962Z parser.add_argument( 2025-08-26T19:31:42.6422897Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:42.6426102Z ) 2025-08-26T19:31:42.6427561Z parser.add_argument( 2025-08-26T19:31:42.6431030Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:42.6433906Z ) 2025-08-26T19:31:42.6435064Z parser.add_argument( 2025-08-26T19:31:42.6437352Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:42.6440114Z ) 2025-08-26T19:31:42.6441236Z parser.add_argument( 2025-08-26T19:31:42.6442747Z "--github-ref-type", 2025-08-26T19:31:42.6444244Z type=str, 2025-08-26T19:31:42.6445508Z required=True, 2025-08-26T19:31:42.6447145Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:42.6449300Z ) 2025-08-26T19:31:42.6450459Z parser.add_argument( 2025-08-26T19:31:42.6452027Z "--eligible-experiments", 2025-08-26T19:31:42.6453777Z type=_str_comma_separated_to_set, 2025-08-26T19:31:42.6455483Z required=False, 2025-08-26T19:31:42.6456897Z default="", 2025-08-26T19:31:42.6460213Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:42.6463777Z ) 2025-08-26T19:31:42.6464956Z parser.add_argument( 2025-08-26T19:31:42.6466491Z "--opt-out-experiments", 2025-08-26T19:31:42.6468448Z type=_str_comma_separated_to_set, 2025-08-26T19:31:42.6470167Z required=False, 2025-08-26T19:31:42.6471531Z default="", 2025-08-26T19:31:42.6472763Z help=( 2025-08-26T19:31:42.6475068Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:42.6479530Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:42.6482608Z ), 2025-08-26T19:31:42.6483700Z ) 2025-08-26T19:31:42.6484774Z parser.add_argument( 2025-08-26T19:31:42.6486209Z "--pr-number", 2025-08-26T19:31:42.6487413Z type=str, 2025-08-26T19:31:42.6488785Z required=False, 2025-08-26T19:31:42.6490070Z default="", 2025-08-26T19:31:42.6491765Z help="the optional PR number where this is run", 2025-08-26T19:31:42.6493463Z ) 2025-08-26T19:31:42.6494036Z 2025-08-26T19:31:42.6494571Z return parser.parse_args() 2025-08-26T19:31:42.6495630Z 2025-08-26T19:31:42.6495650Z 2025-08-26T19:31:42.6496975Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.6499726Z auth = Auth.Token(github_token) 2025-08-26T19:31:42.6501293Z return Github(auth=auth) 2025-08-26T19:31:42.6502266Z 2025-08-26T19:31:42.6502281Z 2025-08-26T19:31:42.6503725Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:42.6506500Z repo = gh.get_repo(repo) 2025-08-26T19:31:42.6508397Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:42.6509622Z 2025-08-26T19:31:42.6509639Z 2025-08-26T19:31:42.6510281Z def get_potential_pr_author( 2025-08-26T19:31:42.6512464Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:42.6514684Z ) -> str: 2025-08-26T19:31:42.6516180Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:42.6519289Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:42.6521848Z # embedded in the tag name: ciflow// 2025-08-26T19:31:42.6523339Z 2025-08-26T19:31:42.6523954Z gh = get_gh_client(github_token) 2025-08-26T19:31:42.6525076Z 2025-08-26T19:31:42.6525958Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:42.6528289Z split_tag = ref_name.split("/") 2025-08-26T19:31:42.6529972Z if ( 2025-08-26T19:31:42.6531218Z len(split_tag) == 3 2025-08-26T19:31:42.6532828Z and split_tag[0] == "ciflow" 2025-08-26T19:31:42.6534602Z and split_tag[2].isnumeric() 2025-08-26T19:31:42.6536286Z ): 2025-08-26T19:31:42.6537562Z pr_number = split_tag[2] 2025-08-26T19:31:42.6539691Z try: 2025-08-26T19:31:42.6541075Z repository = gh.get_repo(repo) 2025-08-26T19:31:42.6543248Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:42.6545373Z except Exception as e: 2025-08-26T19:31:42.6547152Z raise Exception( # noqa: TRY002 2025-08-26T19:31:42.6549784Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:42.6552086Z ) from e 2025-08-26T19:31:42.6553920Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:42.6556379Z # In all other cases, return the original input username 2025-08-26T19:31:42.6558790Z return username 2025-08-26T19:31:42.6559652Z 2025-08-26T19:31:42.6559666Z 2025-08-26T19:31:42.6560364Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:42.6561609Z """ 2025-08-26T19:31:42.6562979Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:42.6564692Z """ 2025-08-26T19:31:42.6565803Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:42.6566978Z 2025-08-26T19:31:42.6566985Z 2025-08-26T19:31:42.6567354Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:42.6568636Z try: 2025-08-26T19:31:42.6569387Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:42.6570437Z return data 2025-08-26T19:31:42.6571241Z except yaml.YAMLError: 2025-08-26T19:31:42.6572198Z log.exception("Error loading YAML") 2025-08-26T19:31:42.6573244Z raise 2025-08-26T19:31:42.6573664Z 2025-08-26T19:31:42.6573672Z 2025-08-26T19:31:42.6574541Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:42.6576126Z """ 2025-08-26T19:31:42.6577419Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:42.6578970Z 2025-08-26T19:31:42.6579927Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.6581552Z and the text below is the list of opted in users. 2025-08-26T19:31:42.6582420Z 2025-08-26T19:31:42.6583221Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:42.6584726Z """ 2025-08-26T19:31:42.6585565Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:42.6586799Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:42.6588236Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:42.6589492Z else: 2025-08-26T19:31:42.6590220Z return "", rollout_state 2025-08-26T19:31:42.6590846Z 2025-08-26T19:31:42.6590854Z 2025-08-26T19:31:42.6591237Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:42.6592255Z """ 2025-08-26T19:31:42.6593285Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:42.6594646Z """ 2025-08-26T19:31:42.6595033Z 2025-08-26T19:31:42.6595039Z 2025-08-26T19:31:42.6595734Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:42.6597113Z """ 2025-08-26T19:31:42.6598805Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:42.6600363Z 2025-08-26T19:31:42.6601744Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:42.6603949Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:42.6605359Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:42.6606408Z 2025-08-26T19:31:42.6606415Z 2025-08-26T19:31:42.6606699Z """ 2025-08-26T19:31:42.6607399Z optins = UserOptins() 2025-08-26T19:31:42.6608548Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:42.6609683Z user = user.strip("\r\n\t -") 2025-08-26T19:31:42.6610775Z if not user or not user.startswith("@"): 2025-08-26T19:31:42.6612090Z # Not a valid user. Skip 2025-08-26T19:31:42.6613064Z continue 2025-08-26T19:31:42.6613546Z 2025-08-26T19:31:42.6613835Z if user: 2025-08-26T19:31:42.6614662Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:42.6616108Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:42.6617182Z 2025-08-26T19:31:42.6617494Z return optins 2025-08-26T19:31:42.6617958Z 2025-08-26T19:31:42.6618104Z 2025-08-26T19:31:42.6618748Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:42.6619987Z """ 2025-08-26T19:31:42.6620740Z Check if the experiment name is valid. 2025-08-26T19:31:42.6621783Z A valid name: 2025-08-26T19:31:42.6623080Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:42.6625114Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:42.6626655Z - Cannot contain spaces 2025-08-26T19:31:42.6627548Z """ 2025-08-26T19:31:42.6627933Z 2025-08-26T19:31:42.6628627Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:42.6630076Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:42.6631025Z 2025-08-26T19:31:42.6631317Z if valid: 2025-08-26T19:31:42.6632023Z return True 2025-08-26T19:31:42.6632486Z 2025-08-26T19:31:42.6632780Z log.error( 2025-08-26T19:31:42.6635988Z 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-26T19:31:42.6639603Z ) 2025-08-26T19:31:42.6640269Z return False 2025-08-26T19:31:42.6640720Z 2025-08-26T19:31:42.6640727Z 2025-08-26T19:31:42.6641330Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:42.6642610Z """ 2025-08-26T19:31:42.6643936Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:42.6645441Z """ 2025-08-26T19:31:42.6646094Z try: 2025-08-26T19:31:42.6646779Z if settings_text: 2025-08-26T19:31:42.6648472Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:42.6650152Z # for easy reading 2025-08-26T19:31:42.6651792Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:42.6653684Z # the backtick character in shell commands. 2025-08-26T19:31:42.6654897Z backtick = chr(96) # backtick character 2025-08-26T19:31:42.6656247Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:42.6657583Z settings = load_yaml(settings_text) 2025-08-26T19:31:42.6658498Z 2025-08-26T19:31:42.6659390Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:42.6660985Z experiments = {} 2025-08-26T19:31:42.6661571Z 2025-08-26T19:31:42.6662344Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:42.6663909Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:42.6666295Z # 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-26T19:31:42.6668814Z continue 2025-08-26T19:31:42.6669377Z 2025-08-26T19:31:42.6669709Z valid_settings = {} 2025-08-26T19:31:42.6670732Z for setting in exp_settings: 2025-08-26T19:31:42.6671859Z if setting not in Experiment._fields: 2025-08-26T19:31:42.6672979Z log.warning( 2025-08-26T19:31:42.6674425Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:42.6676081Z ) 2025-08-26T19:31:42.6676893Z else: 2025-08-26T19:31:42.6677887Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:42.6678954Z 2025-08-26T19:31:42.6679494Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:42.6680773Z return Settings(experiments) 2025-08-26T19:31:42.6681496Z 2025-08-26T19:31:42.6681818Z except Exception: 2025-08-26T19:31:42.6682730Z log.exception("Failed to parse settings") 2025-08-26T19:31:42.6683548Z 2025-08-26T19:31:42.6683861Z return Settings() 2025-08-26T19:31:42.6684356Z 2025-08-26T19:31:42.6684363Z 2025-08-26T19:31:42.6684846Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:42.6685985Z """ 2025-08-26T19:31:42.6686795Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:42.6687630Z 2025-08-26T19:31:42.6688515Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:42.6690086Z and the text below is the list of opted in users. 2025-08-26T19:31:42.6690917Z 2025-08-26T19:31:42.6691747Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:42.6693246Z """ 2025-08-26T19:31:42.6694309Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.6695823Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:42.6696636Z 2025-08-26T19:31:42.6696643Z 2025-08-26T19:31:42.6697109Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:42.6698371Z """ 2025-08-26T19:31:42.6699103Z Parse users from the rollout state. 2025-08-26T19:31:42.6699801Z 2025-08-26T19:31:42.6700091Z """ 2025-08-26T19:31:42.6701096Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:42.6702558Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:42.6703375Z 2025-08-26T19:31:42.6703382Z 2025-08-26T19:31:42.6704355Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.6705882Z """ 2025-08-26T19:31:42.6706648Z Check if a user is opted into an experiment 2025-08-26T19:31:42.6707689Z """ 2025-08-26T19:31:42.6708749Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:42.6709604Z 2025-08-26T19:31:42.6709611Z 2025-08-26T19:31:42.6710443Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:42.6711980Z """ 2025-08-26T19:31:42.6712843Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:42.6713991Z """ 2025-08-26T19:31:42.6714946Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:42.6716318Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:42.6717590Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:42.6718953Z return False 2025-08-26T19:31:42.6719439Z 2025-08-26T19:31:42.6719963Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:42.6721142Z log.warning( 2025-08-26T19:31:42.6722783Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:42.6724589Z ) 2025-08-26T19:31:42.6724968Z 2025-08-26T19:31:42.6725263Z return True 2025-08-26T19:31:42.6725695Z 2025-08-26T19:31:42.6725702Z 2025-08-26T19:31:42.6726028Z def get_runner_prefix( 2025-08-26T19:31:42.6726832Z rollout_state: str, 2025-08-26T19:31:42.6727703Z workflow_requestors: Iterable[str], 2025-08-26T19:31:42.6728909Z branch: str, 2025-08-26T19:31:42.6729832Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.6731141Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:42.6732312Z is_canary: bool = False, 2025-08-26T19:31:42.6733166Z ) -> str: 2025-08-26T19:31:42.6734139Z settings = parse_settings(rollout_state) 2025-08-26T19:31:42.6735274Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:42.6736020Z 2025-08-26T19:31:42.6736334Z fleet_prefix = "" 2025-08-26T19:31:42.6737127Z prefixes = [] 2025-08-26T19:31:42.6738587Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:42.6740488Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:42.6741904Z log.info( 2025-08-26T19:31:42.6743234Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:42.6744775Z ) 2025-08-26T19:31:42.6745460Z continue 2025-08-26T19:31:42.6745919Z 2025-08-26T19:31:42.6746262Z if opt_out_experiments: 2025-08-26T19:31:42.6747258Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:42.6748703Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:42.6749852Z log.info( 2025-08-26T19:31:42.6751738Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:42.6753771Z ) 2025-08-26T19:31:42.6754485Z continue 2025-08-26T19:31:42.6754988Z 2025-08-26T19:31:42.6755336Z if eligible_experiments: 2025-08-26T19:31:42.6756427Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:42.6757682Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:42.6758862Z log.info( 2025-08-26T19:31:42.6760450Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:42.6762151Z ) 2025-08-26T19:31:42.6762867Z continue 2025-08-26T19:31:42.6763761Z elif not experiment_settings.default: 2025-08-26T19:31:42.6764777Z log.info( 2025-08-26T19:31:42.6766237Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:42.6767724Z ) 2025-08-26T19:31:42.6768595Z continue 2025-08-26T19:31:42.6769085Z 2025-08-26T19:31:42.6769618Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:42.6770835Z opted_out_users = [ 2025-08-26T19:31:42.6771672Z requestor 2025-08-26T19:31:42.6772505Z for requestor in workflow_requestors 2025-08-26T19:31:42.6773816Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.6775069Z ] 2025-08-26T19:31:42.6775451Z 2025-08-26T19:31:42.6775776Z if opted_out_users: 2025-08-26T19:31:42.6776611Z log.info( 2025-08-26T19:31:42.6777807Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:42.6779304Z ) 2025-08-26T19:31:42.6779998Z continue 2025-08-26T19:31:42.6780465Z 2025-08-26T19:31:42.6780989Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:42.6782177Z opted_in_users = [ 2025-08-26T19:31:42.6783031Z requestor 2025-08-26T19:31:42.6783875Z for requestor in workflow_requestors 2025-08-26T19:31:42.6785169Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:42.6786396Z ] 2025-08-26T19:31:42.6786787Z 2025-08-26T19:31:42.6787089Z enabled = False 2025-08-26T19:31:42.6787909Z if opted_in_users: 2025-08-26T19:31:42.6788844Z log.info( 2025-08-26T19:31:42.6790012Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:42.6791363Z ) 2025-08-26T19:31:42.6792074Z enabled = True 2025-08-26T19:31:42.6792603Z 2025-08-26T19:31:42.6793001Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:42.6794637Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:42.6796674Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:42.6797935Z log.info( 2025-08-26T19:31:42.6799750Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:42.6801593Z ) 2025-08-26T19:31:42.6802334Z enabled = True 2025-08-26T19:31:42.6802892Z 2025-08-26T19:31:42.6803178Z if enabled: 2025-08-26T19:31:42.6803960Z label = experiment_name 2025-08-26T19:31:42.6804988Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:42.6806631Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:42.6808469Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:42.6809960Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:42.6811265Z if is_canary: 2025-08-26T19:31:42.6812170Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:42.6813211Z fleet_prefix = label 2025-08-26T19:31:42.6814122Z else: 2025-08-26T19:31:42.6814897Z prefixes.append(label) 2025-08-26T19:31:42.6815571Z 2025-08-26T19:31:42.6815891Z if len(prefixes) > 1: 2025-08-26T19:31:42.6816714Z log.error( 2025-08-26T19:31:42.6818884Z 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-26T19:31:42.6821168Z ) 2025-08-26T19:31:42.6821874Z prefixes = prefixes[:1] 2025-08-26T19:31:42.6822458Z 2025-08-26T19:31:42.6822799Z # Fleet always comes first 2025-08-26T19:31:42.6823679Z if fleet_prefix: 2025-08-26T19:31:42.6824509Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:42.6825211Z 2025-08-26T19:31:42.6825799Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:42.6826617Z 2025-08-26T19:31:42.6826626Z 2025-08-26T19:31:42.6827481Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:42.6829091Z """ 2025-08-26T19:31:42.6830218Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:42.6831349Z 2025-08-26T19:31:42.6832112Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:42.6833515Z """ 2025-08-26T19:31:42.6834217Z gh = get_gh_client(github_token) 2025-08-26T19:31:42.6835232Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:42.6836430Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:42.6837286Z 2025-08-26T19:31:42.6837293Z 2025-08-26T19:31:42.6838366Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:42.6840064Z for _ in range(num_retries): 2025-08-26T19:31:42.6840947Z try: 2025-08-26T19:31:42.6841721Z req = Request(url=url, headers=headers) 2025-08-26T19:31:42.6842979Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:42.6844213Z return json.loads(content) 2025-08-26T19:31:42.6845200Z except Exception as e: 2025-08-26T19:31:42.6846206Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:42.6846986Z 2025-08-26T19:31:42.6847717Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:42.6849318Z return {} 2025-08-26T19:31:42.6849735Z 2025-08-26T19:31:42.6849743Z 2025-08-26T19:31:42.6850034Z @cache 2025-08-26T19:31:42.6851197Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:42.6852660Z """ 2025-08-26T19:31:42.6853368Z Dynamically get PR information 2025-08-26T19:31:42.6854307Z """ 2025-08-26T19:31:42.6855414Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:42.6856610Z headers = { 2025-08-26T19:31:42.6857441Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:42.6858702Z "Authorization": f"token {github_token}", 2025-08-26T19:31:42.6859741Z } 2025-08-26T19:31:42.6860509Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:42.6861659Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:42.6862684Z headers=headers, 2025-08-26T19:31:42.6863454Z ) 2025-08-26T19:31:42.6863812Z 2025-08-26T19:31:42.6864129Z if not json_response: 2025-08-26T19:31:42.6865189Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:42.6866364Z return {} 2025-08-26T19:31:42.6867026Z 2025-08-26T19:31:42.6867359Z return json_response 2025-08-26T19:31:42.6867888Z 2025-08-26T19:31:42.6867895Z 2025-08-26T19:31:42.6868759Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:42.6870182Z """ 2025-08-26T19:31:42.6871164Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:42.6872413Z """ 2025-08-26T19:31:42.6873284Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:42.6874442Z return { 2025-08-26T19:31:42.6875527Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:42.6876871Z } 2025-08-26T19:31:42.6877232Z 2025-08-26T19:31:42.6877238Z 2025-08-26T19:31:42.6877538Z def main() -> None: 2025-08-26T19:31:42.6878383Z args = parse_args() 2025-08-26T19:31:42.6878876Z 2025-08-26T19:31:42.6879276Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:42.6880009Z 2025-08-26T19:31:42.6880336Z # Check if the PR is opt-out 2025-08-26T19:31:42.6881244Z if args.pr_number: 2025-08-26T19:31:42.6882473Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:42.6884359Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:42.6885291Z log.info( 2025-08-26T19:31:42.6886622Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:42.6888234Z ) 2025-08-26T19:31:42.6889256Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:42.6890544Z sys.exit() 2025-08-26T19:31:42.6891015Z 2025-08-26T19:31:42.6891293Z try: 2025-08-26T19:31:42.6892084Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:42.6893444Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:42.6894667Z ) 2025-08-26T19:31:42.6895040Z 2025-08-26T19:31:42.6895403Z username = get_potential_pr_author( 2025-08-26T19:31:42.6896418Z args.github_token, 2025-08-26T19:31:42.6897306Z args.github_repo, 2025-08-26T19:31:42.6898290Z args.github_actor, 2025-08-26T19:31:42.6899207Z args.github_ref_type, 2025-08-26T19:31:42.6900132Z args.github_branch, 2025-08-26T19:31:42.6900971Z ) 2025-08-26T19:31:42.6901338Z 2025-08-26T19:31:42.6901868Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:42.6902761Z 2025-08-26T19:31:42.6903152Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:42.6904191Z rollout_state, 2025-08-26T19:31:42.6905095Z (args.github_issue_owner, username), 2025-08-26T19:31:42.6906121Z args.github_branch, 2025-08-26T19:31:42.6907033Z args.eligible_experiments, 2025-08-26T19:31:42.6908140Z args.opt_out_experiments, 2025-08-26T19:31:42.6909079Z is_canary, 2025-08-26T19:31:42.6909817Z ) 2025-08-26T19:31:42.6910188Z 2025-08-26T19:31:42.6910519Z except Exception as e: 2025-08-26T19:31:42.6911357Z log.error( 2025-08-26T19:31:42.6912633Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:42.6914306Z ) 2025-08-26T19:31:42.6914682Z 2025-08-26T19:31:42.6915312Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:42.6916287Z 2025-08-26T19:31:42.6916296Z 2025-08-26T19:31:42.6916640Z if __name__ == "__main__": 2025-08-26T19:31:42.6917495Z main() 2025-08-26T19:31:42.6917897Z 2025-08-26T19:31:42.7046831Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:42.7049637Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:42.7110834Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:42.7112229Z env: 2025-08-26T19:31:42.7113913Z GITHUB_TOKEN: *** 2025-08-26T19:31:42.7115175Z ISSUE_NUMBER: 5132 2025-08-26T19:31:42.7116548Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:42.7118536Z ISSUE_OWNER: 2025-08-26T19:31:42.7119437Z CHECK_EXPERIMENTS: 2025-08-26T19:31:42.7120232Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:42.7121040Z PR_NUMBER: 2025-08-26T19:31:42.7121730Z ##[endgroup] 2025-08-26T19:31:43.3041533Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:43.9738474Z Collecting urllib3==1.26.18 2025-08-26T19:31:44.0824856Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:44.1235465Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 1.3 MB/s eta 0:00:00 2025-08-26T19:31:44.1586762Z Collecting PyGithub==2.3.0 2025-08-26T19:31:44.1876579Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:44.2426115Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:44.2725218Z 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-26T19:31:44.2770160Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:44.2788204Z 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-26T19:31:44.2802699Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:44.3159808Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:44.3449191Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:44.3687508Z 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-26T19:31:44.5095469Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:44.5383891Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:44.6689083Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:44.6986195Z 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-26T19:31:44.7301956Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:44.7587504Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:44.8076955Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:44.8434546Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 4.0 MB/s eta 0:00:00 2025-08-26T19:31:44.8720187Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:44.9071877Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 10.5 MB/s eta 0:00:00 2025-08-26T19:31:44.9359577Z 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-26T19:31:44.9716015Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 25.2 MB/s eta 0:00:00 2025-08-26T19:31:45.0003820Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:45.0318468Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:45.0398232Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 78.4 MB/s eta 0:00:00 2025-08-26T19:31:45.0686761Z 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-26T19:31:45.0735759Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 24.6 MB/s eta 0:00:00 2025-08-26T19:31:45.1023353Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:45.1077840Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 28.9 MB/s eta 0:00:00 2025-08-26T19:31:45.4027494Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:45.9540399Z 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-26T19:31:46.0641102Z ##[group]Run curr_branch="main" 2025-08-26T19:31:46.0641426Z curr_branch="main" 2025-08-26T19:31:46.0641660Z curr_ref_type="branch" 2025-08-26T19:31:46.0641947Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:46.0642208Z  2025-08-26T19:31:46.0642409Z python3 runner_determinator.py \ 2025-08-26T19:31:46.0642693Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:46.0642969Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:46.0643235Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:46.0643502Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:46.0643817Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:46.0644098Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:46.0644382Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:46.0644685Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:46.0645081Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:46.0645386Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:46.0687658Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:46.0687910Z env: 2025-08-26T19:31:46.0688572Z GITHUB_TOKEN: *** 2025-08-26T19:31:46.0688775Z ISSUE_NUMBER: 5132 2025-08-26T19:31:46.0689013Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:46.0689257Z ISSUE_OWNER: 2025-08-26T19:31:46.0689441Z CHECK_EXPERIMENTS: 2025-08-26T19:31:46.0689636Z OPT_OUT_EXPERIMENTS: 2025-08-26T19:31:46.0689830Z PR_NUMBER: 2025-08-26T19:31:46.0690000Z ##[endgroup] 2025-08-26T19:31:46.0754339Z Current branch is 'main' 2025-08-26T19:31:47.8520021Z INFO : Based on rollout percentage of 75%, enabling experiment lf. 2025-08-26T19:31:47.8521213Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:47.8524413Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:47.8525151Z INFO : Setting output: label-type='lf.' 2025-08-26T19:31:47.8880986Z Evaluate and set job outputs 2025-08-26T19:31:47.8887317Z Set output 'label-type' 2025-08-26T19:31:47.8889832Z Cleaning up orphan processes