2025-10-10T00:01:07.7913204Z Current runner version: '2.328.0' 2025-10-10T00:01:07.7936442Z ##[group]Runner Image Provisioner 2025-10-10T00:01:07.7937226Z Hosted Compute Agent 2025-10-10T00:01:07.7937763Z Version: 20250912.392 2025-10-10T00:01:07.7938453Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:07.7939148Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:07.7939716Z ##[endgroup] 2025-10-10T00:01:07.7940344Z ##[group]Operating System 2025-10-10T00:01:07.7941406Z Ubuntu 2025-10-10T00:01:07.7942250Z 24.04.3 2025-10-10T00:01:07.7942916Z LTS 2025-10-10T00:01:07.7943410Z ##[endgroup] 2025-10-10T00:01:07.7943876Z ##[group]Runner Image 2025-10-10T00:01:07.7944513Z Image: ubuntu-24.04 2025-10-10T00:01:07.7945043Z Version: 20250929.60.1 2025-10-10T00:01:07.7946020Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:07.7947618Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:07.7948606Z ##[endgroup] 2025-10-10T00:01:07.7950050Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:07.7952330Z Contents: read 2025-10-10T00:01:07.7952818Z Metadata: read 2025-10-10T00:01:07.7953425Z ##[endgroup] 2025-10-10T00:01:07.7955760Z Secret source: Actions 2025-10-10T00:01:07.7956638Z Prepare workflow directory 2025-10-10T00:01:07.8450810Z Prepare all required actions 2025-10-10T00:01:07.8505517Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:07.8510353Z ##[group] Inputs 2025-10-10T00:01:07.8511461Z check_experiments: 2025-10-10T00:01:07.8512033Z opt_out_experiments: lf 2025-10-10T00:01:07.8512615Z triggering_actor: pytorchmergebot 2025-10-10T00:01:07.8513246Z issue_owner: 2025-10-10T00:01:07.8513771Z curr_branch: main 2025-10-10T00:01:07.8514261Z curr_ref_type: branch 2025-10-10T00:01:07.8514986Z issue_number: 5132 2025-10-10T00:01:07.8515552Z ##[endgroup] 2025-10-10T00:01:07.8516124Z Complete job name: get-label-type / runner-determinator 2025-10-10T00:01:08.3843742Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:08.3846150Z cat < runner_determinator.py 2025-10-10T00:01:08.3846870Z # flake8: noqa: G004 2025-10-10T00:01:08.3847419Z  2025-10-10T00:01:08.3848326Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.3849445Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.3850705Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.3851575Z  2025-10-10T00:01:08.3852031Z """ 2025-10-10T00:01:08.3852806Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.3853892Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.3855189Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.3856178Z of which runners should be used to run which job. 2025-10-10T00:01:08.3857058Z  2025-10-10T00:01:08.3857785Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.3858878Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.3860035Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.3861096Z list, defined. 2025-10-10T00:01:08.3861635Z  2025-10-10T00:01:08.3862399Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.3863512Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.3864527Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.3865324Z  2025-10-10T00:01:08.3866353Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.3867395Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.3868402Z experiments which the user could be opted in to. 2025-10-10T00:01:08.3869120Z  2025-10-10T00:01:08.3869622Z The user list has the following rules: 2025-10-10T00:01:08.3870332Z  2025-10-10T00:01:08.3871311Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.3872385Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.3957672Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.3958382Z  2025-10-10T00:01:08.3958789Z Example config: 2025-10-10T00:01:08.3959336Z  # A list of experiments that can be opted into. 2025-10-10T00:01:08.3960089Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.3960943Z  # Expected syntax is: 2025-10-10T00:01:08.3961687Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.3962750Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.3963549Z  2025-10-10T00:01:08.3963936Z  experiments: 2025-10-10T00:01:08.3964376Z  lf: 2025-10-10T00:01:08.3964810Z  rollout_percent: 25 2025-10-10T00:01:08.3965350Z  all_branches: false 2025-10-10T00:01:08.3965857Z  default: true 2025-10-10T00:01:08.3966337Z  --- 2025-10-10T00:01:08.3966732Z  2025-10-10T00:01:08.3967108Z  # Opt-ins: 2025-10-10T00:01:08.3967779Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.3968968Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.3969865Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.3970727Z  # Experiments should be from the above list. 2025-10-10T00:01:08.3971325Z  2025-10-10T00:01:08.3971737Z  @User1,-lf,split_build 2025-10-10T00:01:08.3972250Z  @User2,lf 2025-10-10T00:01:08.3972707Z  @User3,split_build 2025-10-10T00:01:08.3973192Z """ 2025-10-10T00:01:08.3973575Z  2025-10-10T00:01:08.3973961Z import json 2025-10-10T00:01:08.3974406Z import logging 2025-10-10T00:01:08.3974861Z import os 2025-10-10T00:01:08.3975290Z import random 2025-10-10T00:01:08.3975730Z import re 2025-10-10T00:01:08.3976155Z import sys 2025-10-10T00:01:08.3976633Z from argparse import ArgumentParser 2025-10-10T00:01:08.3977373Z from collections.abc import Iterable 2025-10-10T00:01:08.3977964Z from functools import cache 2025-10-10T00:01:08.3978505Z from logging import LogRecord 2025-10-10T00:01:08.3979070Z from typing import Any, NamedTuple 2025-10-10T00:01:08.3979692Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.3980285Z  2025-10-10T00:01:08.3980918Z import yaml 2025-10-10T00:01:08.3981389Z from github import Auth, Github 2025-10-10T00:01:08.3981959Z from github.Issue import Issue 2025-10-10T00:01:08.3982484Z  2025-10-10T00:01:08.3982864Z  2025-10-10T00:01:08.3983334Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.3984113Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.3985087Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.3985855Z  2025-10-10T00:01:08.3986531Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.3987232Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.3987840Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.3988487Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.3989053Z  2025-10-10T00:01:08.3989482Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.3990034Z  2025-10-10T00:01:08.3990561Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.3991113Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.3991616Z  2025-10-10T00:01:08.3991986Z  2025-10-10T00:01:08.3992404Z class Experiment(NamedTuple): 2025-10-10T00:01:08.3992956Z  rollout_perc: float = ( 2025-10-10T00:01:08.3993696Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.3994429Z  ) 2025-10-10T00:01:08.3994854Z  all_branches: bool = ( 2025-10-10T00:01:08.3995582Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.3996311Z  ) 2025-10-10T00:01:08.3996729Z  default: bool = ( 2025-10-10T00:01:08.3997390Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.3998089Z  ) 2025-10-10T00:01:08.3998483Z  2025-10-10T00:01:08.3998887Z  # Add more fields as needed 2025-10-10T00:01:08.3999403Z  2025-10-10T00:01:08.3999779Z  2025-10-10T00:01:08.4000187Z class Settings(NamedTuple): 2025-10-10T00:01:08.4001070Z  """ 2025-10-10T00:01:08.4001843Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:08.4002478Z  """ 2025-10-10T00:01:08.4002879Z  2025-10-10T00:01:08.4003323Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.4003905Z  2025-10-10T00:01:08.4004442Z  2025-10-10T00:01:08.4004907Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.4005611Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.4006292Z  2025-10-10T00:01:08.4006724Z  COLORS = { 2025-10-10T00:01:08.4007264Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.4007834Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.4008393Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.4008972Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.4009532Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.4010064Z  } 2025-10-10T00:01:08.4010583Z  2025-10-10T00:01:08.4011052Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.4011892Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.4012745Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.4013381Z  return super().format(record) 2025-10-10T00:01:08.4013954Z  2025-10-10T00:01:08.4014375Z  2025-10-10T00:01:08.4014847Z handler = logging.StreamHandler() 2025-10-10T00:01:08.4015661Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.4016434Z  2025-10-10T00:01:08.4016941Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.4017639Z log.addHandler(handler) 2025-10-10T00:01:08.4018244Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.4018751Z  2025-10-10T00:01:08.4019115Z  2025-10-10T00:01:08.4019623Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.4020245Z  """ 2025-10-10T00:01:08.4020931Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.4021778Z  """ 2025-10-10T00:01:08.4022210Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:08.4023386Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.4024589Z  log.warning( 2025-10-10T00:01:08.4025560Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.4026550Z  ) 2025-10-10T00:01:08.4027047Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.4027650Z  return 2025-10-10T00:01:08.4028088Z  2025-10-10T00:01:08.4028528Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.4029181Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.4029813Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:08.4030351Z  2025-10-10T00:01:08.4031221Z  2025-10-10T00:01:08.4031792Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.4032505Z  return frozenset( 2025-10-10T00:01:08.4033213Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.4033985Z  ) 2025-10-10T00:01:08.4034433Z  2025-10-10T00:01:08.4034848Z  2025-10-10T00:01:08.4035297Z def parse_args() -> Any: 2025-10-10T00:01:08.4035972Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.4036928Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.4037759Z  parser.add_argument( 2025-10-10T00:01:08.4038296Z  "--github-issue-repo", 2025-10-10T00:01:08.4038846Z  type=str, 2025-10-10T00:01:08.4039328Z  required=False, 2025-10-10T00:01:08.4040004Z  default="pytorch/test-infra", 2025-10-10T00:01:08.4040779Z  help="GitHub repo to get the issue", 2025-10-10T00:01:08.4041347Z  ) 2025-10-10T00:01:08.4041776Z  parser.add_argument( 2025-10-10T00:01:08.4042292Z  "--github-repo", 2025-10-10T00:01:08.4042803Z  type=str, 2025-10-10T00:01:08.4043279Z  required=True, 2025-10-10T00:01:08.4043834Z  help="GitHub repo where CI is running", 2025-10-10T00:01:08.4044397Z  ) 2025-10-10T00:01:08.4044830Z  parser.add_argument( 2025-10-10T00:01:08.4045539Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.4046259Z  ) 2025-10-10T00:01:08.4046702Z  parser.add_argument( 2025-10-10T00:01:08.4047430Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.4048178Z  ) 2025-10-10T00:01:08.4048604Z  parser.add_argument( 2025-10-10T00:01:08.4049342Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.4050091Z  ) 2025-10-10T00:01:08.4050613Z  parser.add_argument( 2025-10-10T00:01:08.4051390Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.4052156Z  ) 2025-10-10T00:01:08.4052605Z  parser.add_argument( 2025-10-10T00:01:08.4053141Z  "--github-ref-type", 2025-10-10T00:01:08.4053671Z  type=str, 2025-10-10T00:01:08.4054145Z  required=True, 2025-10-10T00:01:08.4054742Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.4055340Z  ) 2025-10-10T00:01:08.4055765Z  parser.add_argument( 2025-10-10T00:01:08.4056440Z  "--eligible-experiments", 2025-10-10T00:01:08.4057048Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.4057620Z  required=False, 2025-10-10T00:01:08.4058126Z  default="", 2025-10-10T00:01:08.4059080Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.4060063Z  ) 2025-10-10T00:01:08.4060645Z  parser.add_argument( 2025-10-10T00:01:08.4061184Z  "--opt-out-experiments", 2025-10-10T00:01:08.4061776Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.4062349Z  required=False, 2025-10-10T00:01:08.4062857Z  default="", 2025-10-10T00:01:08.4063328Z  help=( 2025-10-10T00:01:08.4064097Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.4065318Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.4066207Z  ), 2025-10-10T00:01:08.4066631Z  ) 2025-10-10T00:01:08.4067061Z  parser.add_argument( 2025-10-10T00:01:08.4067584Z  "--pr-number", 2025-10-10T00:01:08.4068082Z  type=str, 2025-10-10T00:01:08.4068572Z  required=False, 2025-10-10T00:01:08.4069080Z  default="", 2025-10-10T00:01:08.4069656Z  help="the optional PR number where this is run", 2025-10-10T00:01:08.4070269Z  ) 2025-10-10T00:01:08.4070794Z  2025-10-10T00:01:08.4071220Z  return parser.parse_args() 2025-10-10T00:01:08.4071750Z  2025-10-10T00:01:08.4072122Z  2025-10-10T00:01:08.4072787Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.4073749Z  auth = Auth.Token(github_token) 2025-10-10T00:01:08.4074356Z  return Github(auth=auth) 2025-10-10T00:01:08.4074865Z  2025-10-10T00:01:08.4075238Z  2025-10-10T00:01:08.4075950Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.4076838Z  repo = gh.get_repo(repo) 2025-10-10T00:01:08.4077436Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.4078013Z  2025-10-10T00:01:08.4078408Z  2025-10-10T00:01:08.4078819Z def get_potential_pr_author( 2025-10-10T00:01:08.4079569Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.4080312Z ) -> str: 2025-10-10T00:01:08.4081052Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.4081949Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.4082799Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:08.4083434Z  2025-10-10T00:01:08.4083871Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.4084426Z  2025-10-10T00:01:08.4084948Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.4085651Z  split_tag = ref_name.split("/") 2025-10-10T00:01:08.4086212Z  if ( 2025-10-10T00:01:08.4086678Z  len(split_tag) == 3 2025-10-10T00:01:08.4087250Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:08.4087849Z  and split_tag[2].isnumeric() 2025-10-10T00:01:08.4088408Z  ): 2025-10-10T00:01:08.4088875Z  pr_number = split_tag[2] 2025-10-10T00:01:08.4089444Z  try: 2025-10-10T00:01:08.4089966Z  repository = gh.get_repo(repo) 2025-10-10T00:01:08.4090911Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.4091601Z  except Exception as e: 2025-10-10T00:01:08.4092198Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:08.4092951Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.4093665Z  ) from e 2025-10-10T00:01:08.4094306Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.4095091Z  # In all other cases, return the original input username 2025-10-10T00:01:08.4095737Z  return username 2025-10-10T00:01:08.4096215Z  2025-10-10T00:01:08.4096593Z  2025-10-10T00:01:08.4097077Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.4097667Z  """ 2025-10-10T00:01:08.4098413Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.4099262Z  """ 2025-10-10T00:01:08.4099890Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.4100707Z  2025-10-10T00:01:08.4101091Z  2025-10-10T00:01:08.4101529Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.4102086Z  try: 2025-10-10T00:01:08.4102552Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.4103116Z  return data 2025-10-10T00:01:08.4103628Z  except yaml.YAMLError: 2025-10-10T00:01:08.4104203Z  log.exception("Error loading YAML") 2025-10-10T00:01:08.4104774Z  raise 2025-10-10T00:01:08.4105210Z  2025-10-10T00:01:08.4105588Z  2025-10-10T00:01:08.4106262Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.4107076Z  """ 2025-10-10T00:01:08.4107911Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.4108725Z  2025-10-10T00:01:08.4109327Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.4110183Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.4110907Z  2025-10-10T00:01:08.4111557Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.4112320Z  """ 2025-10-10T00:01:08.4112831Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.4113484Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.4114374Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.4115074Z  else: 2025-10-10T00:01:08.4115523Z  return "", rollout_state 2025-10-10T00:01:08.4116042Z  2025-10-10T00:01:08.4116417Z  2025-10-10T00:01:08.4116862Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.4117423Z  """ 2025-10-10T00:01:08.4118051Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.4118749Z  """ 2025-10-10T00:01:08.4119141Z  2025-10-10T00:01:08.4119510Z  2025-10-10T00:01:08.4120093Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.4120905Z  """ 2025-10-10T00:01:08.4121696Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.4122590Z  2025-10-10T00:01:08.4123452Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.4124529Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.4125419Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.4126103Z  2025-10-10T00:01:08.4126472Z  2025-10-10T00:01:08.4126842Z  """ 2025-10-10T00:01:08.4127270Z  optins = UserOptins() 2025-10-10T00:01:08.4127841Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.4128464Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:08.4129080Z  if not user or not user.startswith("@"): 2025-10-10T00:01:08.4129695Z  # Not a valid user. Skip 2025-10-10T00:01:08.4130247Z  continue 2025-10-10T00:01:08.4130833Z  2025-10-10T00:01:08.4131218Z  if user: 2025-10-10T00:01:08.4131766Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.4132533Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.4133229Z  2025-10-10T00:01:08.4133620Z  return optins 2025-10-10T00:01:08.4134073Z  2025-10-10T00:01:08.4134436Z  2025-10-10T00:01:08.4134985Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.4135649Z  """ 2025-10-10T00:01:08.4136115Z  Check if the experiment name is valid. 2025-10-10T00:01:08.4136685Z  A valid name: 2025-10-10T00:01:08.4137430Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.4138446Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.4139216Z  - Cannot contain spaces 2025-10-10T00:01:08.4139743Z  """ 2025-10-10T00:01:08.4140132Z  2025-10-10T00:01:08.4140735Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.4141518Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.4142298Z  2025-10-10T00:01:08.4142687Z  if valid: 2025-10-10T00:01:08.4143131Z  return True 2025-10-10T00:01:08.4143592Z  2025-10-10T00:01:08.4143977Z  log.error( 2025-10-10T00:01:08.4145527Z  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-10-10T00:01:08.4147143Z  ) 2025-10-10T00:01:08.4147557Z  return False 2025-10-10T00:01:08.4148005Z  2025-10-10T00:01:08.4148372Z  2025-10-10T00:01:08.4148935Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.4149626Z  """ 2025-10-10T00:01:08.4150289Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.4151160Z  """ 2025-10-10T00:01:08.4151566Z  try: 2025-10-10T00:01:08.4151994Z  if settings_text: 2025-10-10T00:01:08.4152808Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.4153687Z  # for easy reading 2025-10-10T00:01:08.4154581Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.4155543Z  # the backtick character in shell commands. 2025-10-10T00:01:08.4156213Z  backtick = chr(96) # backtick character 2025-10-10T00:01:08.4156964Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.4157701Z  settings = load_yaml(settings_text) 2025-10-10T00:01:08.4158256Z  2025-10-10T00:01:08.4158907Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.4159870Z  experiments = {} 2025-10-10T00:01:08.4160388Z  2025-10-10T00:01:08.4161107Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.4161938Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.4163131Z  # 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-10-10T00:01:08.4164243Z  continue 2025-10-10T00:01:08.4164741Z  2025-10-10T00:01:08.4165154Z  valid_settings = {} 2025-10-10T00:01:08.4165741Z  for setting in exp_settings: 2025-10-10T00:01:08.4166372Z  if setting not in Experiment._fields: 2025-10-10T00:01:08.4166989Z  log.warning( 2025-10-10T00:01:08.4167800Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.4168566Z  ) 2025-10-10T00:01:08.4169063Z  else: 2025-10-10T00:01:08.4169659Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.4170273Z  2025-10-10T00:01:08.4170895Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.4171590Z  return Settings(experiments) 2025-10-10T00:01:08.4172136Z  2025-10-10T00:01:08.4172532Z  except Exception: 2025-10-10T00:01:08.4173098Z  log.exception("Failed to parse settings") 2025-10-10T00:01:08.4173676Z  2025-10-10T00:01:08.4174077Z  return Settings() 2025-10-10T00:01:08.4174551Z  2025-10-10T00:01:08.4174909Z  2025-10-10T00:01:08.4175540Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.4176174Z  """ 2025-10-10T00:01:08.4176680Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.4177296Z  2025-10-10T00:01:08.4177881Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.4178712Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.4179317Z  2025-10-10T00:01:08.4179968Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.4180846Z  """ 2025-10-10T00:01:08.4181479Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.4182305Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.4182903Z  2025-10-10T00:01:08.4183267Z  2025-10-10T00:01:08.4183771Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.4184396Z  """ 2025-10-10T00:01:08.4184846Z  Parse users from the rollout state. 2025-10-10T00:01:08.4185404Z  2025-10-10T00:01:08.4185768Z  """ 2025-10-10T00:01:08.4186376Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.4187187Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.4187779Z  2025-10-10T00:01:08.4188158Z  2025-10-10T00:01:08.4188843Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.4189653Z  """ 2025-10-10T00:01:08.4190140Z  Check if a user is opted into an experiment 2025-10-10T00:01:08.4190822Z  """ 2025-10-10T00:01:08.4191352Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.4191976Z  2025-10-10T00:01:08.4192470Z  2025-10-10T00:01:08.4193164Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.4193974Z  """ 2025-10-10T00:01:08.4194499Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.4195133Z  """ 2025-10-10T00:01:08.4195706Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.4196473Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.4197190Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.4197849Z  return False 2025-10-10T00:01:08.4198315Z  2025-10-10T00:01:08.4198824Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.4199480Z  log.warning( 2025-10-10T00:01:08.4200384Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.4201427Z  ) 2025-10-10T00:01:08.4201826Z  2025-10-10T00:01:08.4202218Z  return True 2025-10-10T00:01:08.4202670Z  2025-10-10T00:01:08.4203050Z  2025-10-10T00:01:08.4203451Z def get_runner_prefix( 2025-10-10T00:01:08.4203947Z  rollout_state: str, 2025-10-10T00:01:08.4204491Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:08.4205048Z  branch: str, 2025-10-10T00:01:08.4205635Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.4206375Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.4207019Z  is_canary: bool = False, 2025-10-10T00:01:08.4207538Z ) -> str: 2025-10-10T00:01:08.4208034Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:08.4208681Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.4209247Z  2025-10-10T00:01:08.4209763Z  fleet_prefix = "" 2025-10-10T00:01:08.4210260Z  prefixes = [] 2025-10-10T00:01:08.4211079Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.4212104Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.4212872Z  log.info( 2025-10-10T00:01:08.4213642Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.4214443Z  ) 2025-10-10T00:01:08.4214905Z  continue 2025-10-10T00:01:08.4215365Z  2025-10-10T00:01:08.4215785Z  if opt_out_experiments: 2025-10-10T00:01:08.4216396Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.4217109Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.4217798Z  log.info( 2025-10-10T00:01:08.4218816Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.4219876Z  ) 2025-10-10T00:01:08.4220347Z  continue 2025-10-10T00:01:08.4220917Z  2025-10-10T00:01:08.4221336Z  if eligible_experiments: 2025-10-10T00:01:08.4221964Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.4222661Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.4223261Z  log.info( 2025-10-10T00:01:08.4224142Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.4225033Z  ) 2025-10-10T00:01:08.4225496Z  continue 2025-10-10T00:01:08.4226200Z  elif not experiment_settings.default: 2025-10-10T00:01:08.4226790Z  log.info( 2025-10-10T00:01:08.4227550Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.4228333Z  ) 2025-10-10T00:01:08.4228784Z  continue 2025-10-10T00:01:08.4229252Z  2025-10-10T00:01:08.4229767Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.4230532Z  opted_out_users = [ 2025-10-10T00:01:08.4231062Z  requestor 2025-10-10T00:01:08.4231604Z  for requestor in workflow_requestors 2025-10-10T00:01:08.4232344Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.4233030Z  ] 2025-10-10T00:01:08.4233437Z  2025-10-10T00:01:08.4233851Z  if opted_out_users: 2025-10-10T00:01:08.4234392Z  log.info( 2025-10-10T00:01:08.4235109Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.4235861Z  ) 2025-10-10T00:01:08.4236307Z  continue 2025-10-10T00:01:08.4236769Z  2025-10-10T00:01:08.4237287Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.4237950Z  opted_in_users = [ 2025-10-10T00:01:08.4238483Z  requestor 2025-10-10T00:01:08.4239017Z  for requestor in workflow_requestors 2025-10-10T00:01:08.4239752Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.4240414Z  ] 2025-10-10T00:01:08.4240930Z  2025-10-10T00:01:08.4241323Z  enabled = False 2025-10-10T00:01:08.4241835Z  if opted_in_users: 2025-10-10T00:01:08.4242465Z  log.info( 2025-10-10T00:01:08.4243170Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.4243907Z  ) 2025-10-10T00:01:08.4244354Z  enabled = True 2025-10-10T00:01:08.4244850Z  2025-10-10T00:01:08.4245295Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.4246203Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.4247231Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.4247929Z  log.info( 2025-10-10T00:01:08.4248884Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.4249854Z  ) 2025-10-10T00:01:08.4250342Z  enabled = True 2025-10-10T00:01:08.4250951Z  2025-10-10T00:01:08.4251344Z  if enabled: 2025-10-10T00:01:08.4251854Z  label = experiment_name 2025-10-10T00:01:08.4252473Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.4253366Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.4254312Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.4255150Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.4255875Z  if is_canary: 2025-10-10T00:01:08.4256442Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.4257050Z  fleet_prefix = label 2025-10-10T00:01:08.4257600Z  else: 2025-10-10T00:01:08.4258244Z  prefixes.append(label) 2025-10-10T00:01:08.4258790Z  2025-10-10T00:01:08.4259198Z  if len(prefixes) > 1: 2025-10-10T00:01:08.4259714Z  log.error( 2025-10-10T00:01:08.4260956Z  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-10-10T00:01:08.4262144Z  ) 2025-10-10T00:01:08.4262595Z  prefixes = prefixes[:1] 2025-10-10T00:01:08.4263118Z  2025-10-10T00:01:08.4263517Z  # Fleet always comes first 2025-10-10T00:01:08.4264054Z  if fleet_prefix: 2025-10-10T00:01:08.4264578Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.4265129Z  2025-10-10T00:01:08.4265627Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.4266244Z  2025-10-10T00:01:08.4266628Z  2025-10-10T00:01:08.4267319Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.4268150Z  """ 2025-10-10T00:01:08.4268804Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.4269565Z  2025-10-10T00:01:08.4270198Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.4271048Z  """ 2025-10-10T00:01:08.4271511Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.4272124Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.4272834Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.4273472Z  2025-10-10T00:01:08.4273847Z  2025-10-10T00:01:08.4274500Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.4275435Z  for _ in range(num_retries): 2025-10-10T00:01:08.4275984Z  try: 2025-10-10T00:01:08.4276486Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:08.4277279Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.4277989Z  return json.loads(content) 2025-10-10T00:01:08.4278574Z  except Exception as e: 2025-10-10T00:01:08.4279194Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.4279842Z  2025-10-10T00:01:08.4280631Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.4281669Z  return {} 2025-10-10T00:01:08.4282203Z  2025-10-10T00:01:08.4282576Z  2025-10-10T00:01:08.4283087Z @cache 2025-10-10T00:01:08.4284129Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.4285257Z  """ 2025-10-10T00:01:08.4285825Z  Dynamically get PR information 2025-10-10T00:01:08.4286368Z  """ 2025-10-10T00:01:08.4286938Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.4287619Z  headers = { 2025-10-10T00:01:08.4288176Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.4288851Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:08.4289457Z  } 2025-10-10T00:01:08.4289963Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.4290744Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.4291349Z  headers=headers, 2025-10-10T00:01:08.4291836Z  ) 2025-10-10T00:01:08.4292235Z  2025-10-10T00:01:08.4292640Z  if not json_response: 2025-10-10T00:01:08.4293307Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.4294149Z  return {} 2025-10-10T00:01:08.4294617Z  2025-10-10T00:01:08.4295021Z  return json_response 2025-10-10T00:01:08.4295513Z  2025-10-10T00:01:08.4295886Z  2025-10-10T00:01:08.4296532Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.4297316Z  """ 2025-10-10T00:01:08.4297923Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.4298629Z  """ 2025-10-10T00:01:08.4299185Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.4299844Z  return { 2025-10-10T00:01:08.4300607Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.4301343Z  } 2025-10-10T00:01:08.4301743Z  2025-10-10T00:01:08.4302113Z  2025-10-10T00:01:08.4302521Z def main() -> None: 2025-10-10T00:01:08.4303002Z  args = parse_args() 2025-10-10T00:01:08.4303487Z  2025-10-10T00:01:08.4303949Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.4304528Z  2025-10-10T00:01:08.4304940Z  # Check if the PR is opt-out 2025-10-10T00:01:08.4305483Z  if args.pr_number: 2025-10-10T00:01:08.4306237Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.4307042Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.4307593Z  log.info( 2025-10-10T00:01:08.4308369Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.4309169Z  ) 2025-10-10T00:01:08.4309797Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.4310621Z  sys.exit() 2025-10-10T00:01:08.4311223Z  2025-10-10T00:01:08.4311604Z  try: 2025-10-10T00:01:08.4312109Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.4312885Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.4313566Z  ) 2025-10-10T00:01:08.4313978Z  2025-10-10T00:01:08.4314409Z  username = get_potential_pr_author( 2025-10-10T00:01:08.4314999Z  args.github_token, 2025-10-10T00:01:08.4315542Z  args.github_repo, 2025-10-10T00:01:08.4316084Z  args.github_actor, 2025-10-10T00:01:08.4316640Z  args.github_ref_type, 2025-10-10T00:01:08.4317198Z  args.github_branch, 2025-10-10T00:01:08.4317750Z  ) 2025-10-10T00:01:08.4318156Z  2025-10-10T00:01:08.4318686Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.4319341Z  2025-10-10T00:01:08.4319798Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.4320394Z  rollout_state, 2025-10-10T00:01:08.4321068Z  (args.github_issue_owner, username), 2025-10-10T00:01:08.4321664Z  args.github_branch, 2025-10-10T00:01:08.4322240Z  args.eligible_experiments, 2025-10-10T00:01:08.4322838Z  args.opt_out_experiments, 2025-10-10T00:01:08.4323396Z  is_canary, 2025-10-10T00:01:08.4323878Z  ) 2025-10-10T00:01:08.4324292Z  2025-10-10T00:01:08.4324701Z  except Exception as e: 2025-10-10T00:01:08.4325218Z  log.error( 2025-10-10T00:01:08.4325989Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.4326794Z  ) 2025-10-10T00:01:08.4327343Z  2025-10-10T00:01:08.4327926Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.4328628Z  2025-10-10T00:01:08.4329000Z  2025-10-10T00:01:08.4329396Z if __name__ == "__main__": 2025-10-10T00:01:08.4329901Z  main() 2025-10-10T00:01:08.4330313Z  2025-10-10T00:01:08.4330841Z EOF 2025-10-10T00:01:08.4331225Z  2025-10-10T00:01:08.4331629Z cat runner_determinator.py 2025-10-10T00:01:08.7859455Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:08.7861263Z env: 2025-10-10T00:01:08.7862775Z GITHUB_TOKEN: *** 2025-10-10T00:01:08.7863901Z ISSUE_NUMBER: 5132 2025-10-10T00:01:08.7865109Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:08.7866437Z ISSUE_OWNER: 2025-10-10T00:01:08.7867509Z CHECK_EXPERIMENTS: 2025-10-10T00:01:08.7868647Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:08.7869817Z PR_NUMBER: 2025-10-10T00:01:08.7871016Z ##[endgroup] 2025-10-10T00:01:08.8129634Z # flake8: noqa: G004 2025-10-10T00:01:08.8130270Z 2025-10-10T00:01:08.8131418Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.8133455Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.8135204Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.8136184Z 2025-10-10T00:01:08.8136576Z """ 2025-10-10T00:01:08.8137872Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.8139779Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.8141994Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.8143839Z of which runners should be used to run which job. 2025-10-10T00:01:08.8144763Z 2025-10-10T00:01:08.8145660Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.8147994Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.8150225Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.8152317Z list, defined. 2025-10-10T00:01:08.8152894Z 2025-10-10T00:01:08.8153802Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.8156116Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.8158190Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.8159306Z 2025-10-10T00:01:08.8160209Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.8162571Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.8164414Z experiments which the user could be opted in to. 2025-10-10T00:01:08.8165416Z 2025-10-10T00:01:08.8165898Z The user list has the following rules: 2025-10-10T00:01:08.8166758Z 2025-10-10T00:01:08.8167526Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.8169632Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.8171885Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.8172887Z 2025-10-10T00:01:08.8173306Z Example config: 2025-10-10T00:01:08.8174384Z # A list of experiments that can be opted into. 2025-10-10T00:01:08.8176004Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.8177509Z # Expected syntax is: 2025-10-10T00:01:08.8179008Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.8181614Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.8183131Z 2025-10-10T00:01:08.8183505Z experiments: 2025-10-10T00:01:08.8184374Z lf: 2025-10-10T00:01:08.8185236Z rollout_percent: 25 2025-10-10T00:01:08.8186455Z all_branches: false 2025-10-10T00:01:08.8187441Z default: true 2025-10-10T00:01:08.8188349Z --- 2025-10-10T00:01:08.8188764Z 2025-10-10T00:01:08.8189106Z # Opt-ins: 2025-10-10T00:01:08.8190378Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.8192598Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.8194435Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.8195967Z # Experiments should be from the above list. 2025-10-10T00:01:08.8196861Z 2025-10-10T00:01:08.8197242Z @User1,-lf,split_build 2025-10-10T00:01:08.8198214Z @User2,lf 2025-10-10T00:01:08.8199048Z @User3,split_build 2025-10-10T00:01:08.8199970Z """ 2025-10-10T00:01:08.8200377Z 2025-10-10T00:01:08.8200873Z import json 2025-10-10T00:01:08.8201671Z import logging 2025-10-10T00:01:08.8202509Z import os 2025-10-10T00:01:08.8203296Z import random 2025-10-10T00:01:08.8204121Z import re 2025-10-10T00:01:08.8204908Z import sys 2025-10-10T00:01:08.8205780Z from argparse import ArgumentParser 2025-10-10T00:01:08.8206959Z from collections.abc import Iterable 2025-10-10T00:01:08.8208126Z from functools import cache 2025-10-10T00:01:08.8209161Z from logging import LogRecord 2025-10-10T00:01:08.8210273Z from typing import Any, NamedTuple 2025-10-10T00:01:08.8211713Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.8212574Z 2025-10-10T00:01:08.8212918Z import yaml 2025-10-10T00:01:08.8213761Z from github import Auth, Github 2025-10-10T00:01:08.8214870Z from github.Issue import Issue 2025-10-10T00:01:08.8215552Z 2025-10-10T00:01:08.8215559Z 2025-10-10T00:01:08.8216027Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.8217564Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.8219533Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.8221053Z 2025-10-10T00:01:08.8221563Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.8223048Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.8224203Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.8225456Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.8226294Z 2025-10-10T00:01:08.8226707Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.8227474Z 2025-10-10T00:01:08.8227865Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.8228918Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.8229560Z 2025-10-10T00:01:08.8229566Z 2025-10-10T00:01:08.8229971Z class Experiment(NamedTuple): 2025-10-10T00:01:08.8231190Z rollout_perc: float = ( 2025-10-10T00:01:08.8232649Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.8234261Z ) 2025-10-10T00:01:08.8235044Z all_branches: bool = ( 2025-10-10T00:01:08.8236464Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.8238049Z ) 2025-10-10T00:01:08.8238818Z default: bool = ( 2025-10-10T00:01:08.8240073Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.8241643Z ) 2025-10-10T00:01:08.8242042Z 2025-10-10T00:01:08.8242396Z # Add more fields as needed 2025-10-10T00:01:08.8243062Z 2025-10-10T00:01:08.8243069Z 2025-10-10T00:01:08.8243447Z class Settings(NamedTuple): 2025-10-10T00:01:08.8244377Z """ 2025-10-10T00:01:08.8245329Z Settings for the experiments that can be opted into. 2025-10-10T00:01:08.8246597Z """ 2025-10-10T00:01:08.8246999Z 2025-10-10T00:01:08.8247412Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.8248260Z 2025-10-10T00:01:08.8248267Z 2025-10-10T00:01:08.8248704Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.8250102Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.8251343Z 2025-10-10T00:01:08.8251676Z COLORS = { 2025-10-10T00:01:08.8252493Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.8253747Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.8254827Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.8255891Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.8256914Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.8257906Z } 2025-10-10T00:01:08.8258296Z 2025-10-10T00:01:08.8258738Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.8260552Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.8262344Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.8263610Z return super().format(record) 2025-10-10T00:01:08.8264368Z 2025-10-10T00:01:08.8264375Z 2025-10-10T00:01:08.8264776Z handler = logging.StreamHandler() 2025-10-10T00:01:08.8266360Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.8267676Z 2025-10-10T00:01:08.8268186Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.8269458Z log.addHandler(handler) 2025-10-10T00:01:08.8270380Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.8271098Z 2025-10-10T00:01:08.8271105Z 2025-10-10T00:01:08.8271623Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.8272841Z """ 2025-10-10T00:01:08.8273880Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.8275277Z """ 2025-10-10T00:01:08.8275996Z if not GITHUB_OUTPUT: 2025-10-10T00:01:08.8278554Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.8281384Z log.warning( 2025-10-10T00:01:08.8283293Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.8285444Z ) 2025-10-10T00:01:08.8296488Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.8297706Z return 2025-10-10T00:01:08.8350644Z 2025-10-10T00:01:08.8351356Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.8352763Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.8354019Z f.write(f"{key}={value}\n") 2025-10-10T00:01:08.8354723Z 2025-10-10T00:01:08.8354731Z 2025-10-10T00:01:08.8355374Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.8356757Z return frozenset( 2025-10-10T00:01:08.8358055Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.8359586Z ) 2025-10-10T00:01:08.8359974Z 2025-10-10T00:01:08.8359981Z 2025-10-10T00:01:08.8360330Z def parse_args() -> Any: 2025-10-10T00:01:08.8361601Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.8363528Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.8365234Z parser.add_argument( 2025-10-10T00:01:08.8366174Z "--github-issue-repo", 2025-10-10T00:01:08.8367121Z type=str, 2025-10-10T00:01:08.8367922Z required=False, 2025-10-10T00:01:08.8368859Z default="pytorch/test-infra", 2025-10-10T00:01:08.8370016Z help="GitHub repo to get the issue", 2025-10-10T00:01:08.8371362Z ) 2025-10-10T00:01:08.8372095Z parser.add_argument( 2025-10-10T00:01:08.8372990Z "--github-repo", 2025-10-10T00:01:08.8373853Z type=str, 2025-10-10T00:01:08.8374635Z required=True, 2025-10-10T00:01:08.8375569Z help="GitHub repo where CI is running", 2025-10-10T00:01:08.8376677Z ) 2025-10-10T00:01:08.8377404Z parser.add_argument( 2025-10-10T00:01:08.8378689Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.8380152Z ) 2025-10-10T00:01:08.8380987Z parser.add_argument( 2025-10-10T00:01:08.8382333Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.8383811Z ) 2025-10-10T00:01:08.8384567Z parser.add_argument( 2025-10-10T00:01:08.8386096Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.8387626Z ) 2025-10-10T00:01:08.8388341Z parser.add_argument( 2025-10-10T00:01:08.8389714Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.8391375Z ) 2025-10-10T00:01:08.8392087Z parser.add_argument( 2025-10-10T00:01:08.8392989Z "--github-ref-type", 2025-10-10T00:01:08.8393899Z type=str, 2025-10-10T00:01:08.8394672Z required=True, 2025-10-10T00:01:08.8395653Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.8396798Z ) 2025-10-10T00:01:08.8397506Z parser.add_argument( 2025-10-10T00:01:08.8398424Z "--eligible-experiments", 2025-10-10T00:01:08.8399492Z type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8400664Z required=False, 2025-10-10T00:01:08.8401493Z default="", 2025-10-10T00:01:08.8403337Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.8405432Z ) 2025-10-10T00:01:08.8406154Z parser.add_argument( 2025-10-10T00:01:08.8407068Z "--opt-out-experiments", 2025-10-10T00:01:08.8408304Z type=_str_comma_separated_to_set, 2025-10-10T00:01:08.8409924Z required=False, 2025-10-10T00:01:08.8411408Z default="", 2025-10-10T00:01:08.8412652Z help=( 2025-10-10T00:01:08.8414519Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.8417153Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.8418997Z ), 2025-10-10T00:01:08.8419691Z ) 2025-10-10T00:01:08.8420408Z parser.add_argument( 2025-10-10T00:01:08.8421513Z "--pr-number", 2025-10-10T00:01:08.8422326Z type=str, 2025-10-10T00:01:08.8423101Z required=False, 2025-10-10T00:01:08.8423938Z default="", 2025-10-10T00:01:08.8425039Z help="the optional PR number where this is run", 2025-10-10T00:01:08.8426196Z ) 2025-10-10T00:01:08.8426586Z 2025-10-10T00:01:08.8426946Z return parser.parse_args() 2025-10-10T00:01:08.8427591Z 2025-10-10T00:01:08.8427598Z 2025-10-10T00:01:08.8428482Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8430084Z auth = Auth.Token(github_token) 2025-10-10T00:01:08.8431447Z return Github(auth=auth) 2025-10-10T00:01:08.8432045Z 2025-10-10T00:01:08.8432052Z 2025-10-10T00:01:08.8432998Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.8434709Z repo = gh.get_repo(repo) 2025-10-10T00:01:08.8436291Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.8437563Z 2025-10-10T00:01:08.8437575Z 2025-10-10T00:01:08.8438157Z def get_potential_pr_author( 2025-10-10T00:01:08.8439661Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.8441272Z ) -> str: 2025-10-10T00:01:08.8442327Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.8444009Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.8445535Z # embedded in the tag name: ciflow// 2025-10-10T00:01:08.8446394Z 2025-10-10T00:01:08.8446746Z gh = get_gh_client(github_token) 2025-10-10T00:01:08.8447426Z 2025-10-10T00:01:08.8447959Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.8449220Z split_tag = ref_name.split("/") 2025-10-10T00:01:08.8450221Z if ( 2025-10-10T00:01:08.8451170Z len(split_tag) == 3 2025-10-10T00:01:08.8452134Z and split_tag[0] == "ciflow" 2025-10-10T00:01:08.8453186Z and split_tag[2].isnumeric() 2025-10-10T00:01:08.8454166Z ): 2025-10-10T00:01:08.8454887Z pr_number = split_tag[2] 2025-10-10T00:01:08.8456057Z try: 2025-10-10T00:01:08.8456908Z repository = gh.get_repo(repo) 2025-10-10T00:01:08.8458182Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.8459430Z except Exception as e: 2025-10-10T00:01:08.8460904Z raise Exception( # noqa: TRY002 2025-10-10T00:01:08.8462331Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.8463704Z ) from e 2025-10-10T00:01:08.8464775Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.8466264Z # In all other cases, return the original input username 2025-10-10T00:01:08.8467473Z return username 2025-10-10T00:01:08.8467952Z 2025-10-10T00:01:08.8467959Z 2025-10-10T00:01:08.8468400Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.8469495Z """ 2025-10-10T00:01:08.8471356Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.8473061Z """ 2025-10-10T00:01:08.8474157Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.8475280Z 2025-10-10T00:01:08.8475287Z 2025-10-10T00:01:08.8475670Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.8476664Z try: 2025-10-10T00:01:08.8477404Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.8478431Z return data 2025-10-10T00:01:08.8479233Z except yaml.YAMLError: 2025-10-10T00:01:08.8480197Z log.exception("Error loading YAML") 2025-10-10T00:01:08.8482145Z raise 2025-10-10T00:01:08.8482889Z 2025-10-10T00:01:08.8482904Z 2025-10-10T00:01:08.8483913Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.8485613Z """ 2025-10-10T00:01:08.8486903Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.8488202Z 2025-10-10T00:01:08.8489116Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8490924Z and the text below is the list of opted in users. 2025-10-10T00:01:08.8491793Z 2025-10-10T00:01:08.8492578Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.8494060Z """ 2025-10-10T00:01:08.8494931Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.8496810Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.8498093Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.8499320Z else: 2025-10-10T00:01:08.8500052Z return "", rollout_state 2025-10-10T00:01:08.8500909Z 2025-10-10T00:01:08.8500917Z 2025-10-10T00:01:08.8501314Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.8502341Z """ 2025-10-10T00:01:08.8503394Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.8504736Z """ 2025-10-10T00:01:08.8505138Z 2025-10-10T00:01:08.8505161Z 2025-10-10T00:01:08.8505844Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.8507460Z """ 2025-10-10T00:01:08.8509097Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.8510780Z 2025-10-10T00:01:08.8512183Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.8514339Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.8515745Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.8516778Z 2025-10-10T00:01:08.8516786Z 2025-10-10T00:01:08.8517091Z """ 2025-10-10T00:01:08.8517802Z optins = UserOptins() 2025-10-10T00:01:08.8518991Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.8520236Z user = user.strip("\r\n\t -") 2025-10-10T00:01:08.8521508Z if not user or not user.startswith("@"): 2025-10-10T00:01:08.8522832Z # Not a valid user. Skip 2025-10-10T00:01:08.8523812Z continue 2025-10-10T00:01:08.8524290Z 2025-10-10T00:01:08.8524589Z if user: 2025-10-10T00:01:08.8525443Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.8526883Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.8527935Z 2025-10-10T00:01:08.8528249Z return optins 2025-10-10T00:01:08.8528706Z 2025-10-10T00:01:08.8528713Z 2025-10-10T00:01:08.8529291Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.8530718Z """ 2025-10-10T00:01:08.8531496Z Check if the experiment name is valid. 2025-10-10T00:01:08.8532536Z A valid name: 2025-10-10T00:01:08.8533834Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.8535802Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.8537285Z - Cannot contain spaces 2025-10-10T00:01:08.8538195Z """ 2025-10-10T00:01:08.8538578Z 2025-10-10T00:01:08.8539078Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.8540691Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.8541639Z 2025-10-10T00:01:08.8541940Z if valid: 2025-10-10T00:01:08.8542672Z return True 2025-10-10T00:01:08.8543129Z 2025-10-10T00:01:08.8543430Z log.error( 2025-10-10T00:01:08.8546535Z 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-10-10T00:01:08.8549867Z ) 2025-10-10T00:01:08.8550675Z return False 2025-10-10T00:01:08.8551134Z 2025-10-10T00:01:08.8551141Z 2025-10-10T00:01:08.8551746Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.8553008Z """ 2025-10-10T00:01:08.8554357Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.8555842Z """ 2025-10-10T00:01:08.8556507Z try: 2025-10-10T00:01:08.8557212Z if settings_text: 2025-10-10T00:01:08.8558682Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.8560323Z # for easy reading 2025-10-10T00:01:08.8562474Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.8564352Z # the backtick character in shell commands. 2025-10-10T00:01:08.8565571Z backtick = chr(96) # backtick character 2025-10-10T00:01:08.8566910Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.8568261Z settings = load_yaml(settings_text) 2025-10-10T00:01:08.8569009Z 2025-10-10T00:01:08.8569853Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.8571591Z experiments = {} 2025-10-10T00:01:08.8572170Z 2025-10-10T00:01:08.8572926Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.8574472Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.8576816Z # 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-10-10T00:01:08.8579055Z continue 2025-10-10T00:01:08.8579622Z 2025-10-10T00:01:08.8579959Z valid_settings = {} 2025-10-10T00:01:08.8581176Z for setting in exp_settings: 2025-10-10T00:01:08.8582305Z if setting not in Experiment._fields: 2025-10-10T00:01:08.8583425Z log.warning( 2025-10-10T00:01:08.8584878Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.8586567Z ) 2025-10-10T00:01:08.8587397Z else: 2025-10-10T00:01:08.8588435Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.8589309Z 2025-10-10T00:01:08.8589845Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.8591577Z return Settings(experiments) 2025-10-10T00:01:08.8592293Z 2025-10-10T00:01:08.8592623Z except Exception: 2025-10-10T00:01:08.8593549Z log.exception("Failed to parse settings") 2025-10-10T00:01:08.8594328Z 2025-10-10T00:01:08.8594659Z return Settings() 2025-10-10T00:01:08.8595163Z 2025-10-10T00:01:08.8595170Z 2025-10-10T00:01:08.8595660Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.8596813Z """ 2025-10-10T00:01:08.8597630Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.8598449Z 2025-10-10T00:01:08.8599132Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.8600832Z and the text below is the list of opted in users. 2025-10-10T00:01:08.8601659Z 2025-10-10T00:01:08.8602468Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.8603981Z """ 2025-10-10T00:01:08.8605166Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8607659Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.8608524Z 2025-10-10T00:01:08.8608531Z 2025-10-10T00:01:08.8609013Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.8610300Z """ 2025-10-10T00:01:08.8611794Z Parse users from the rollout state. 2025-10-10T00:01:08.8613028Z 2025-10-10T00:01:08.8613601Z """ 2025-10-10T00:01:08.8615457Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.8618026Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.8619460Z 2025-10-10T00:01:08.8619475Z 2025-10-10T00:01:08.8621318Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8623991Z """ 2025-10-10T00:01:08.8625376Z Check if a user is opted into an experiment 2025-10-10T00:01:08.8627210Z """ 2025-10-10T00:01:08.8628507Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.8629396Z 2025-10-10T00:01:08.8629406Z 2025-10-10T00:01:08.8630241Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.8632071Z """ 2025-10-10T00:01:08.8632959Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.8634111Z """ 2025-10-10T00:01:08.8635081Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.8636440Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.8637696Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.8638880Z return False 2025-10-10T00:01:08.8639381Z 2025-10-10T00:01:08.8639905Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.8641276Z log.warning( 2025-10-10T00:01:08.8642871Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.8644657Z ) 2025-10-10T00:01:08.8645043Z 2025-10-10T00:01:08.8645353Z return True 2025-10-10T00:01:08.8645784Z 2025-10-10T00:01:08.8645792Z 2025-10-10T00:01:08.8646113Z def get_runner_prefix( 2025-10-10T00:01:08.8646937Z rollout_state: str, 2025-10-10T00:01:08.8647809Z workflow_requestors: Iterable[str], 2025-10-10T00:01:08.8648793Z branch: str, 2025-10-10T00:01:08.8649713Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8651165Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.8652324Z is_canary: bool = False, 2025-10-10T00:01:08.8653193Z ) -> str: 2025-10-10T00:01:08.8653984Z settings = parse_settings(rollout_state) 2025-10-10T00:01:08.8655312Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.8656049Z 2025-10-10T00:01:08.8656371Z fleet_prefix = "" 2025-10-10T00:01:08.8657181Z prefixes = [] 2025-10-10T00:01:08.8658398Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.8660250Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.8661862Z log.info( 2025-10-10T00:01:08.8663180Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.8664700Z ) 2025-10-10T00:01:08.8665405Z continue 2025-10-10T00:01:08.8665878Z 2025-10-10T00:01:08.8666214Z if opt_out_experiments: 2025-10-10T00:01:08.8667229Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.8668470Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.8669628Z log.info( 2025-10-10T00:01:08.8671685Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.8673654Z ) 2025-10-10T00:01:08.8674400Z continue 2025-10-10T00:01:08.8674905Z 2025-10-10T00:01:08.8675254Z if eligible_experiments: 2025-10-10T00:01:08.8676326Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.8677562Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.8678639Z log.info( 2025-10-10T00:01:08.8680188Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.8682091Z ) 2025-10-10T00:01:08.8682883Z continue 2025-10-10T00:01:08.8683768Z elif not experiment_settings.default: 2025-10-10T00:01:08.8684822Z log.info( 2025-10-10T00:01:08.8686254Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.8687724Z ) 2025-10-10T00:01:08.8688425Z continue 2025-10-10T00:01:08.8688886Z 2025-10-10T00:01:08.8689409Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.8690769Z opted_out_users = [ 2025-10-10T00:01:08.8691620Z requestor 2025-10-10T00:01:08.8692473Z for requestor in workflow_requestors 2025-10-10T00:01:08.8693755Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.8694970Z ] 2025-10-10T00:01:08.8695354Z 2025-10-10T00:01:08.8695684Z if opted_out_users: 2025-10-10T00:01:08.8696531Z log.info( 2025-10-10T00:01:08.8697703Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.8699077Z ) 2025-10-10T00:01:08.8699776Z continue 2025-10-10T00:01:08.8700257Z 2025-10-10T00:01:08.8700924Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.8702121Z opted_in_users = [ 2025-10-10T00:01:08.8702955Z requestor 2025-10-10T00:01:08.8703805Z for requestor in workflow_requestors 2025-10-10T00:01:08.8705068Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.8706279Z ] 2025-10-10T00:01:08.8706661Z 2025-10-10T00:01:08.8706974Z enabled = False 2025-10-10T00:01:08.8707781Z if opted_in_users: 2025-10-10T00:01:08.8708616Z log.info( 2025-10-10T00:01:08.8709754Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.8711277Z ) 2025-10-10T00:01:08.8711999Z enabled = True 2025-10-10T00:01:08.8712522Z 2025-10-10T00:01:08.8712927Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.8714534Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.8716504Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.8717965Z log.info( 2025-10-10T00:01:08.8719795Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.8721808Z ) 2025-10-10T00:01:08.8722539Z enabled = True 2025-10-10T00:01:08.8723102Z 2025-10-10T00:01:08.8723413Z if enabled: 2025-10-10T00:01:08.8724180Z label = experiment_name 2025-10-10T00:01:08.8725211Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.8726799Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.8728505Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.8729987Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.8731443Z if is_canary: 2025-10-10T00:01:08.8732372Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.8733387Z fleet_prefix = label 2025-10-10T00:01:08.8734295Z else: 2025-10-10T00:01:08.8735071Z prefixes.append(label) 2025-10-10T00:01:08.8735738Z 2025-10-10T00:01:08.8736064Z if len(prefixes) > 1: 2025-10-10T00:01:08.8736888Z log.error( 2025-10-10T00:01:08.8738903Z 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-10-10T00:01:08.8741341Z ) 2025-10-10T00:01:08.8742044Z prefixes = prefixes[:1] 2025-10-10T00:01:08.8742653Z 2025-10-10T00:01:08.8742992Z # Fleet always comes first 2025-10-10T00:01:08.8743858Z if fleet_prefix: 2025-10-10T00:01:08.8744698Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.8745381Z 2025-10-10T00:01:08.8746000Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.8746845Z 2025-10-10T00:01:08.8746852Z 2025-10-10T00:01:08.8747674Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.8749137Z """ 2025-10-10T00:01:08.8750215Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.8751473Z 2025-10-10T00:01:08.8752192Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.8753537Z """ 2025-10-10T00:01:08.8754248Z gh = get_gh_client(github_token) 2025-10-10T00:01:08.8755255Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.8756478Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.8757324Z 2025-10-10T00:01:08.8757331Z 2025-10-10T00:01:08.8758090Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.8759525Z for _ in range(num_retries): 2025-10-10T00:01:08.8760402Z try: 2025-10-10T00:01:08.8761263Z req = Request(url=url, headers=headers) 2025-10-10T00:01:08.8762498Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.8763713Z return json.loads(content) 2025-10-10T00:01:08.8764683Z except Exception as e: 2025-10-10T00:01:08.8765680Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.8766446Z 2025-10-10T00:01:08.8767150Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.8768525Z return {} 2025-10-10T00:01:08.8768929Z 2025-10-10T00:01:08.8768938Z 2025-10-10T00:01:08.8769234Z @cache 2025-10-10T00:01:08.8770389Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.8771919Z """ 2025-10-10T00:01:08.8772645Z Dynamically get PR information 2025-10-10T00:01:08.8773546Z """ 2025-10-10T00:01:08.8774600Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.8775796Z headers = { 2025-10-10T00:01:08.8776607Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.8777754Z "Authorization": f"token {github_token}", 2025-10-10T00:01:08.8778742Z } 2025-10-10T00:01:08.8779507Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.8780725Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.8781739Z headers=headers, 2025-10-10T00:01:08.8782543Z ) 2025-10-10T00:01:08.8782901Z 2025-10-10T00:01:08.8783215Z if not json_response: 2025-10-10T00:01:08.8784250Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.8785431Z return {} 2025-10-10T00:01:08.8785866Z 2025-10-10T00:01:08.8786184Z return json_response 2025-10-10T00:01:08.8786697Z 2025-10-10T00:01:08.8786704Z 2025-10-10T00:01:08.8787459Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.8788850Z """ 2025-10-10T00:01:08.8789809Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.8791177Z """ 2025-10-10T00:01:08.8792046Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.8793174Z return { 2025-10-10T00:01:08.8794256Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.8795590Z } 2025-10-10T00:01:08.8795967Z 2025-10-10T00:01:08.8795975Z 2025-10-10T00:01:08.8796280Z def main() -> None: 2025-10-10T00:01:08.8797026Z args = parse_args() 2025-10-10T00:01:08.8797518Z 2025-10-10T00:01:08.8797914Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.8798637Z 2025-10-10T00:01:08.8798984Z # Check if the PR is opt-out 2025-10-10T00:01:08.8799866Z if args.pr_number: 2025-10-10T00:01:08.8801175Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.8802729Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.8803648Z log.info( 2025-10-10T00:01:08.8804926Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.8806518Z ) 2025-10-10T00:01:08.8807780Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.8809054Z sys.exit() 2025-10-10T00:01:08.8809525Z 2025-10-10T00:01:08.8809808Z try: 2025-10-10T00:01:08.8810713Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.8812078Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.8813278Z ) 2025-10-10T00:01:08.8813653Z 2025-10-10T00:01:08.8814028Z username = get_potential_pr_author( 2025-10-10T00:01:08.8815041Z args.github_token, 2025-10-10T00:01:08.8815951Z args.github_repo, 2025-10-10T00:01:08.8816852Z args.github_actor, 2025-10-10T00:01:08.8817761Z args.github_ref_type, 2025-10-10T00:01:08.8818694Z args.github_branch, 2025-10-10T00:01:08.8819543Z ) 2025-10-10T00:01:08.8819917Z 2025-10-10T00:01:08.8820541Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.8821425Z 2025-10-10T00:01:08.8821819Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.8822865Z rollout_state, 2025-10-10T00:01:08.8823761Z (args.github_issue_owner, username), 2025-10-10T00:01:08.8824809Z args.github_branch, 2025-10-10T00:01:08.8825726Z args.eligible_experiments, 2025-10-10T00:01:08.8826773Z args.opt_out_experiments, 2025-10-10T00:01:08.8827695Z is_canary, 2025-10-10T00:01:08.8828451Z ) 2025-10-10T00:01:08.8828825Z 2025-10-10T00:01:08.8829175Z except Exception as e: 2025-10-10T00:01:08.8830428Z log.error( 2025-10-10T00:01:08.8832042Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.8833770Z ) 2025-10-10T00:01:08.8834153Z 2025-10-10T00:01:08.8834771Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.8835730Z 2025-10-10T00:01:08.8835739Z 2025-10-10T00:01:08.8836059Z if __name__ == "__main__": 2025-10-10T00:01:08.8836873Z main() 2025-10-10T00:01:08.8837264Z 2025-10-10T00:01:08.8941939Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:08.8943594Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:08.8977521Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:08.8978396Z env: 2025-10-10T00:01:08.8979414Z GITHUB_TOKEN: *** 2025-10-10T00:01:08.8980177Z ISSUE_NUMBER: 5132 2025-10-10T00:01:08.8981169Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:08.8982116Z ISSUE_OWNER: 2025-10-10T00:01:08.8982841Z CHECK_EXPERIMENTS: 2025-10-10T00:01:08.8983664Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:08.8984479Z PR_NUMBER: 2025-10-10T00:01:08.8985228Z ##[endgroup] 2025-10-10T00:01:10.9513300Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:11.7820270Z Collecting urllib3==1.26.18 2025-10-10T00:01:11.8415640Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:11.8646293Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-10-10T00:01:11.8906108Z Collecting PyGithub==2.3.0 2025-10-10T00:01:11.8979201Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:11.9445070Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:11.9518536Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:11.9565724Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:11.9582621Z 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-10-10T00:01:11.9597693Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:11.9888603Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:11.9960771Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:12.0198040Z 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-10-10T00:01:12.1522308Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:12.1597561Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:12.2955656Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:12.3036759Z 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-10-10T00:01:12.3286606Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:12.3357527Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:12.3618392Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:12.3755865Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 11.3 MB/s eta 0:00:00 2025-10-10T00:01:12.3833300Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:12.4084460Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 14.7 MB/s eta 0:00:00 2025-10-10T00:01:12.4155454Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:12.4844624Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 20.7 MB/s eta 0:00:00 2025-10-10T00:01:12.4915966Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:12.5007874Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:12.5107728Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 25.5 MB/s eta 0:00:00 2025-10-10T00:01:12.5182024Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:12.5227496Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 28.1 MB/s eta 0:00:00 2025-10-10T00:01:12.5298038Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:12.5347475Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 32.3 MB/s eta 0:00:00 2025-10-10T00:01:12.8940075Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:13.4253220Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:13.5083126Z ##[group]Run curr_branch="main" 2025-10-10T00:01:13.5083437Z curr_branch="main" 2025-10-10T00:01:13.5083653Z curr_ref_type="branch" 2025-10-10T00:01:13.5083912Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:13.5084179Z  2025-10-10T00:01:13.5084370Z python3 runner_determinator.py \ 2025-10-10T00:01:13.5084649Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:13.5084917Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:13.5085163Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:13.5085440Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:13.5085713Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:13.5085990Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:13.5086259Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:13.5086552Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:13.5086904Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:13.5087198Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:13.5121152Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:13.5121390Z env: 2025-10-10T00:01:13.5121831Z GITHUB_TOKEN: *** 2025-10-10T00:01:13.5122024Z ISSUE_NUMBER: 5132 2025-10-10T00:01:13.5122235Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:13.5122466Z ISSUE_OWNER: 2025-10-10T00:01:13.5122646Z CHECK_EXPERIMENTS: 2025-10-10T00:01:13.5122834Z OPT_OUT_EXPERIMENTS: lf 2025-10-10T00:01:13.5123028Z PR_NUMBER: 2025-10-10T00:01:13.5123187Z ##[endgroup] 2025-10-10T00:01:13.5174942Z Current branch is 'main' 2025-10-10T00:01:15.0922422Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-10-10T00:01:15.0924075Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:15.0925558Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:15.0926966Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:15.0928061Z INFO : Setting output: label-type='' 2025-10-10T00:01:15.1235912Z Evaluate and set job outputs 2025-10-10T00:01:15.1242871Z Cleaning up orphan processes