2025-08-14T20:48:02.8009128Z Current runner version: '2.327.1' 2025-08-14T20:48:02.8043174Z ##[group]Runner Image Provisioner 2025-08-14T20:48:02.8044770Z Hosted Compute Agent 2025-08-14T20:48:02.8045692Z Version: 20250812.370 2025-08-14T20:48:02.8046588Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:48:02.8047826Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:48:02.8048786Z ##[endgroup] 2025-08-14T20:48:02.8049655Z ##[group]Operating System 2025-08-14T20:48:02.8050485Z Ubuntu 2025-08-14T20:48:02.8051382Z 24.04.2 2025-08-14T20:48:02.8052089Z LTS 2025-08-14T20:48:02.8052864Z ##[endgroup] 2025-08-14T20:48:02.8053623Z ##[group]Runner Image 2025-08-14T20:48:02.8054876Z Image: ubuntu-24.04 2025-08-14T20:48:02.8055771Z Version: 20250804.2.0 2025-08-14T20:48:02.8057422Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:48:02.8059998Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:48:02.8061726Z ##[endgroup] 2025-08-14T20:48:02.8063492Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:48:02.8066652Z Contents: read 2025-08-14T20:48:02.8067497Z Metadata: read 2025-08-14T20:48:02.8068391Z ##[endgroup] 2025-08-14T20:48:02.8071755Z Secret source: Actions 2025-08-14T20:48:02.8072805Z Prepare workflow directory 2025-08-14T20:48:02.8817053Z Prepare all required actions 2025-08-14T20:48:02.8900660Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:48:02.8908177Z ##[group] Inputs 2025-08-14T20:48:02.8909035Z check_experiments: 2025-08-14T20:48:02.8910009Z opt_out_experiments: lf 2025-08-14T20:48:02.8911126Z triggering_actor: pytorchmergebot 2025-08-14T20:48:02.8912147Z issue_owner: 2025-08-14T20:48:02.8912898Z curr_branch: main 2025-08-14T20:48:02.8913909Z curr_ref_type: branch 2025-08-14T20:48:02.8915232Z issue_number: 5132 2025-08-14T20:48:02.8916113Z ##[endgroup] 2025-08-14T20:48:02.8917307Z Complete job name: get-default-label-prefix / runner-determinator 2025-08-14T20:48:03.3784854Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:48:03.3787542Z cat < runner_determinator.py 2025-08-14T20:48:03.3788338Z # flake8: noqa: G004 2025-08-14T20:48:03.3788917Z  2025-08-14T20:48:03.3789693Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:48:03.3790859Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:48:03.3791862Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:48:03.3792583Z  2025-08-14T20:48:03.3793114Z """ 2025-08-14T20:48:03.3793835Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:48:03.3795327Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:48:03.3796617Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:48:03.3797781Z of which runners should be used to run which job. 2025-08-14T20:48:03.3798495Z  2025-08-14T20:48:03.3799334Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:48:03.3800442Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:48:03.3801464Z settings are considered to be empty with only the second part, the user 2025-08-14T20:48:03.3802427Z list, defined. 2025-08-14T20:48:03.3802936Z  2025-08-14T20:48:03.3803632Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:48:03.3805026Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:48:03.3806034Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:48:03.3806775Z  2025-08-14T20:48:03.3807851Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:48:03.3808922Z The user list is also a comma separated list of additional features or 2025-08-14T20:48:03.3809850Z experiments which the user could be opted in to. 2025-08-14T20:48:03.3810602Z  2025-08-14T20:48:03.3811140Z The user list has the following rules: 2025-08-14T20:48:03.3811760Z  2025-08-14T20:48:03.3812539Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:48:03.3813585Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:48:03.3814776Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:48:03.3815539Z  2025-08-14T20:48:03.3816000Z Example config: 2025-08-14T20:48:03.3816651Z  # A list of experiments that can be opted into. 2025-08-14T20:48:03.3817528Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:48:03.3818346Z  # Expected syntax is: 2025-08-14T20:48:03.3819178Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:48:03.3820326Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:48:03.3821248Z  2025-08-14T20:48:03.3821693Z  experiments: 2025-08-14T20:48:03.3822310Z  lf: 2025-08-14T20:48:03.3822824Z  rollout_percent: 25 2025-08-14T20:48:03.3823454Z  all_branches: false 2025-08-14T20:48:03.3824215Z  default: true 2025-08-14T20:48:03.3824783Z  --- 2025-08-14T20:48:03.3825277Z  2025-08-14T20:48:03.3825733Z  # Opt-ins: 2025-08-14T20:48:03.3826582Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:48:03.3827789Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:48:03.3828780Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:48:03.3829705Z  # Experiments should be from the above list. 2025-08-14T20:48:03.3830393Z  2025-08-14T20:48:03.3830886Z  @User1,-lf,split_build 2025-08-14T20:48:03.3831533Z  @User2,lf 2025-08-14T20:48:03.3832100Z  @User3,split_build 2025-08-14T20:48:03.3832657Z """ 2025-08-14T20:48:03.3906261Z  2025-08-14T20:48:03.3906698Z import json 2025-08-14T20:48:03.3907204Z import logging 2025-08-14T20:48:03.3907656Z import os 2025-08-14T20:48:03.3908092Z import random 2025-08-14T20:48:03.3908556Z import re 2025-08-14T20:48:03.3908980Z import sys 2025-08-14T20:48:03.3909459Z from argparse import ArgumentParser 2025-08-14T20:48:03.3910157Z from collections.abc import Iterable 2025-08-14T20:48:03.3910775Z from functools import cache 2025-08-14T20:48:03.3911323Z from logging import LogRecord 2025-08-14T20:48:03.3911899Z from typing import Any, NamedTuple 2025-08-14T20:48:03.3912539Z from urllib.request import Request, urlopen 2025-08-14T20:48:03.3913137Z  2025-08-14T20:48:03.3913521Z import yaml 2025-08-14T20:48:03.3914277Z from github import Auth, Github 2025-08-14T20:48:03.3914882Z from github.Issue import Issue 2025-08-14T20:48:03.3915408Z  2025-08-14T20:48:03.3915770Z  2025-08-14T20:48:03.3916262Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:48:03.3917054Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:48:03.3918042Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:48:03.3918808Z  2025-08-14T20:48:03.3919595Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:48:03.3920253Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:48:03.3920856Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:48:03.3921502Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:48:03.3922066Z  2025-08-14T20:48:03.3922484Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:48:03.3923025Z  2025-08-14T20:48:03.3923425Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:48:03.3923965Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:48:03.3924638Z  2025-08-14T20:48:03.3925012Z  2025-08-14T20:48:03.3925425Z class Experiment(NamedTuple): 2025-08-14T20:48:03.3925978Z  rollout_perc: float = ( 2025-08-14T20:48:03.3926724Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:48:03.3927457Z  ) 2025-08-14T20:48:03.3927882Z  all_branches: bool = ( 2025-08-14T20:48:03.3928616Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:48:03.3929347Z  ) 2025-08-14T20:48:03.3929762Z  default: bool = ( 2025-08-14T20:48:03.3930765Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:48:03.3931507Z  ) 2025-08-14T20:48:03.3931895Z  2025-08-14T20:48:03.3932307Z  # Add more fields as needed 2025-08-14T20:48:03.3932829Z  2025-08-14T20:48:03.3933203Z  2025-08-14T20:48:03.3933608Z class Settings(NamedTuple): 2025-08-14T20:48:03.3934259Z  """ 2025-08-14T20:48:03.3934792Z  Settings for the experiments that can be opted into. 2025-08-14T20:48:03.3935437Z  """ 2025-08-14T20:48:03.3935840Z  2025-08-14T20:48:03.3936275Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:48:03.3936869Z  2025-08-14T20:48:03.3937399Z  2025-08-14T20:48:03.3937869Z class ColorFormatter(logging.Formatter): 2025-08-14T20:48:03.3938589Z  """Color codes the log messages based on the log level""" 2025-08-14T20:48:03.3939226Z  2025-08-14T20:48:03.3939604Z  COLORS = { 2025-08-14T20:48:03.3940087Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:48:03.3940656Z  "ERROR": "\033[31m", # Red 2025-08-14T20:48:03.3941208Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:48:03.3941773Z  "INFO": "\033[0m", # Reset 2025-08-14T20:48:03.3942321Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:48:03.3942850Z  } 2025-08-14T20:48:03.3943240Z  2025-08-14T20:48:03.3943699Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:48:03.3944685Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:48:03.3945555Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:48:03.3946198Z  return super().format(record) 2025-08-14T20:48:03.3946725Z  2025-08-14T20:48:03.3947097Z  2025-08-14T20:48:03.3947514Z handler = logging.StreamHandler() 2025-08-14T20:48:03.3948329Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:48:03.3949106Z  2025-08-14T20:48:03.3949603Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:48:03.3950259Z log.addHandler(handler) 2025-08-14T20:48:03.3950782Z log.setLevel(logging.INFO) 2025-08-14T20:48:03.3951281Z  2025-08-14T20:48:03.3951638Z  2025-08-14T20:48:03.3952135Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:48:03.3952761Z  """ 2025-08-14T20:48:03.3953346Z  Defines outputs of the github action that invokes this script 2025-08-14T20:48:03.3954287Z  """ 2025-08-14T20:48:03.3954704Z  if not GITHUB_OUTPUT: 2025-08-14T20:48:03.3955886Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:48:03.3957101Z  log.warning( 2025-08-14T20:48:03.3958075Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:48:03.3959070Z  ) 2025-08-14T20:48:03.3959563Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:48:03.3960158Z  return 2025-08-14T20:48:03.3960591Z  2025-08-14T20:48:03.3961017Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:48:03.3961652Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:48:03.3962285Z  f.write(f"{key}={value}\n") 2025-08-14T20:48:03.3962818Z  2025-08-14T20:48:03.3963188Z  2025-08-14T20:48:03.3963748Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:48:03.3964632Z  return frozenset( 2025-08-14T20:48:03.3965347Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:48:03.3966083Z  ) 2025-08-14T20:48:03.3966488Z  2025-08-14T20:48:03.3966858Z  2025-08-14T20:48:03.3967259Z def parse_args() -> Any: 2025-08-14T20:48:03.3967926Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:48:03.3968893Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:48:03.3969739Z  parser.add_argument( 2025-08-14T20:48:03.3970277Z  "--github-issue-repo", 2025-08-14T20:48:03.3970828Z  type=str, 2025-08-14T20:48:03.3971318Z  required=False, 2025-08-14T20:48:03.3972000Z  default="pytorch/test-infra", 2025-08-14T20:48:03.3972632Z  help="GitHub repo to get the issue", 2025-08-14T20:48:03.3973197Z  ) 2025-08-14T20:48:03.3973629Z  parser.add_argument( 2025-08-14T20:48:03.3974514Z  "--github-repo", 2025-08-14T20:48:03.3975035Z  type=str, 2025-08-14T20:48:03.3975522Z  required=True, 2025-08-14T20:48:03.3976083Z  help="GitHub repo where CI is running", 2025-08-14T20:48:03.3976655Z  ) 2025-08-14T20:48:03.3977080Z  parser.add_argument( 2025-08-14T20:48:03.3977789Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:48:03.3978510Z  ) 2025-08-14T20:48:03.3978934Z  parser.add_argument( 2025-08-14T20:48:03.3979656Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:48:03.3980404Z  ) 2025-08-14T20:48:03.3980823Z  parser.add_argument( 2025-08-14T20:48:03.3981568Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:48:03.3982312Z  ) 2025-08-14T20:48:03.3982738Z  parser.add_argument( 2025-08-14T20:48:03.3983503Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:48:03.3984377Z  ) 2025-08-14T20:48:03.3984824Z  parser.add_argument( 2025-08-14T20:48:03.3985353Z  "--github-ref-type", 2025-08-14T20:48:03.3985896Z  type=str, 2025-08-14T20:48:03.3986373Z  required=True, 2025-08-14T20:48:03.3986991Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:48:03.3987608Z  ) 2025-08-14T20:48:03.3988041Z  parser.add_argument( 2025-08-14T20:48:03.3988734Z  "--eligible-experiments", 2025-08-14T20:48:03.3989329Z  type=_str_comma_separated_to_set, 2025-08-14T20:48:03.3989904Z  required=False, 2025-08-14T20:48:03.3990416Z  default="", 2025-08-14T20:48:03.3991375Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:48:03.3992365Z  ) 2025-08-14T20:48:03.3992791Z  parser.add_argument( 2025-08-14T20:48:03.3993330Z  "--opt-out-experiments", 2025-08-14T20:48:03.3993927Z  type=_str_comma_separated_to_set, 2025-08-14T20:48:03.3994613Z  required=False, 2025-08-14T20:48:03.3995117Z  default="", 2025-08-14T20:48:03.3995596Z  help=( 2025-08-14T20:48:03.3996364Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:48:03.3997606Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:48:03.3998504Z  ), 2025-08-14T20:48:03.3998930Z  ) 2025-08-14T20:48:03.3999351Z  parser.add_argument( 2025-08-14T20:48:03.3999882Z  "--pr-number", 2025-08-14T20:48:03.4000379Z  type=str, 2025-08-14T20:48:03.4000862Z  required=False, 2025-08-14T20:48:03.4001361Z  default="", 2025-08-14T20:48:03.4001933Z  help="the optional PR number where this is run", 2025-08-14T20:48:03.4002546Z  ) 2025-08-14T20:48:03.4002940Z  2025-08-14T20:48:03.4003358Z  return parser.parse_args() 2025-08-14T20:48:03.4003886Z  2025-08-14T20:48:03.4004403Z  2025-08-14T20:48:03.4005068Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:48:03.4006048Z  auth = Auth.Token(github_token) 2025-08-14T20:48:03.4006662Z  return Github(auth=auth) 2025-08-14T20:48:03.4007173Z  2025-08-14T20:48:03.4007545Z  2025-08-14T20:48:03.4008264Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:48:03.4009145Z  repo = gh.get_repo(repo) 2025-08-14T20:48:03.4009745Z  return repo.get_issue(number=issue_num) 2025-08-14T20:48:03.4010326Z  2025-08-14T20:48:03.4010691Z  2025-08-14T20:48:03.4011096Z def get_potential_pr_author( 2025-08-14T20:48:03.4011846Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:48:03.4012579Z ) -> str: 2025-08-14T20:48:03.4013184Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:48:03.4014226Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:48:03.4015116Z  # embedded in the tag name: ciflow// 2025-08-14T20:48:03.4015759Z  2025-08-14T20:48:03.4016185Z  gh = get_gh_client(github_token) 2025-08-14T20:48:03.4016734Z  2025-08-14T20:48:03.4017251Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:48:03.4017959Z  split_tag = ref_name.split("/") 2025-08-14T20:48:03.4018519Z  if ( 2025-08-14T20:48:03.4018983Z  len(split_tag) == 3 2025-08-14T20:48:03.4019548Z  and split_tag[0] == "ciflow" 2025-08-14T20:48:03.4020153Z  and split_tag[2].isnumeric() 2025-08-14T20:48:03.4020711Z  ): 2025-08-14T20:48:03.4021172Z  pr_number = split_tag[2] 2025-08-14T20:48:03.4021727Z  try: 2025-08-14T20:48:03.4022243Z  repository = gh.get_repo(repo) 2025-08-14T20:48:03.4023081Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:48:03.4023757Z  except Exception as e: 2025-08-14T20:48:03.4024471Z  raise Exception( # noqa: TRY002 2025-08-14T20:48:03.4025237Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:48:03.4025943Z  ) from e 2025-08-14T20:48:03.4026591Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:48:03.4027378Z  # In all other cases, return the original input username 2025-08-14T20:48:03.4028043Z  return username 2025-08-14T20:48:03.4028513Z  2025-08-14T20:48:03.4028880Z  2025-08-14T20:48:03.4029360Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:48:03.4029964Z  """ 2025-08-14T20:48:03.4030711Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:48:03.4031558Z  """ 2025-08-14T20:48:03.4032185Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:48:03.4032911Z  2025-08-14T20:48:03.4033278Z  2025-08-14T20:48:03.4033712Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:48:03.4034386Z  try: 2025-08-14T20:48:03.4034871Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:48:03.4035436Z  return data 2025-08-14T20:48:03.4035932Z  except yaml.YAMLError: 2025-08-14T20:48:03.4036501Z  log.exception("Error loading YAML") 2025-08-14T20:48:03.4037073Z  raise 2025-08-14T20:48:03.4037496Z  2025-08-14T20:48:03.4037870Z  2025-08-14T20:48:03.4038553Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:48:03.4039362Z  """ 2025-08-14T20:48:03.4040203Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:48:03.4041016Z  2025-08-14T20:48:03.4041605Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:48:03.4042461Z  and the text below is the list of opted in users. 2025-08-14T20:48:03.4043063Z  2025-08-14T20:48:03.4043697Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:48:03.4044613Z  """ 2025-08-14T20:48:03.4045132Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:48:03.4045791Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:48:03.4046481Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:48:03.4047129Z  else: 2025-08-14T20:48:03.4047704Z  return "", rollout_state 2025-08-14T20:48:03.4048424Z  2025-08-14T20:48:03.4048795Z  2025-08-14T20:48:03.4049246Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:48:03.4049807Z  """ 2025-08-14T20:48:03.4050403Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:48:03.4051106Z  """ 2025-08-14T20:48:03.4051500Z  2025-08-14T20:48:03.4051863Z  2025-08-14T20:48:03.4052451Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:48:03.4053167Z  """ 2025-08-14T20:48:03.4053953Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:48:03.4055335Z  2025-08-14T20:48:03.4056219Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:48:03.4057305Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:48:03.4058237Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:48:03.4058928Z  2025-08-14T20:48:03.4059289Z  2025-08-14T20:48:03.4059650Z  """ 2025-08-14T20:48:03.4060069Z  optins = UserOptins() 2025-08-14T20:48:03.4060646Z  for user in user_optin_text.split("\n"): 2025-08-14T20:48:03.4061284Z  user = user.strip("\r\n\t -") 2025-08-14T20:48:03.4061911Z  if not user or not user.startswith("@"): 2025-08-14T20:48:03.4062539Z  # Not a valid user. Skip 2025-08-14T20:48:03.4063093Z  continue 2025-08-14T20:48:03.4063549Z  2025-08-14T20:48:03.4063928Z  if user: 2025-08-14T20:48:03.4064791Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:48:03.4065569Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:48:03.4066259Z  2025-08-14T20:48:03.4066649Z  return optins 2025-08-14T20:48:03.4067108Z  2025-08-14T20:48:03.4067462Z  2025-08-14T20:48:03.4068008Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:48:03.4068676Z  """ 2025-08-14T20:48:03.4069143Z  Check if the experiment name is valid. 2025-08-14T20:48:03.4069716Z  A valid name: 2025-08-14T20:48:03.4070457Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:48:03.4071476Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:48:03.4072245Z  - Cannot contain spaces 2025-08-14T20:48:03.4072771Z  """ 2025-08-14T20:48:03.4073153Z  2025-08-14T20:48:03.4073651Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:48:03.4074710Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:48:03.4075520Z  2025-08-14T20:48:03.4075914Z  if valid: 2025-08-14T20:48:03.4076467Z  return True 2025-08-14T20:48:03.4077085Z  2025-08-14T20:48:03.4077463Z  log.error( 2025-08-14T20:48:03.4079035Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:48:03.4080676Z  ) 2025-08-14T20:48:03.4081086Z  return False 2025-08-14T20:48:03.4081529Z  2025-08-14T20:48:03.4081900Z  2025-08-14T20:48:03.4082468Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:48:03.4083161Z  """ 2025-08-14T20:48:03.4083825Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:48:03.4084726Z  """ 2025-08-14T20:48:03.4085134Z  try: 2025-08-14T20:48:03.4085548Z  if settings_text: 2025-08-14T20:48:03.4086366Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:48:03.4087216Z  # for easy reading 2025-08-14T20:48:03.4088101Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:48:03.4089064Z  # the backtick character in shell commands. 2025-08-14T20:48:03.4089730Z  backtick = chr(96) # backtick character 2025-08-14T20:48:03.4090489Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:48:03.4091225Z  settings = load_yaml(settings_text) 2025-08-14T20:48:03.4091779Z  2025-08-14T20:48:03.4092435Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:48:03.4093378Z  experiments = {} 2025-08-14T20:48:03.4093890Z  2025-08-14T20:48:03.4094618Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:48:03.4095458Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:48:03.4096644Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:48:03.4097785Z  continue 2025-08-14T20:48:03.4098285Z  2025-08-14T20:48:03.4098687Z  valid_settings = {} 2025-08-14T20:48:03.4099284Z  for setting in exp_settings: 2025-08-14T20:48:03.4099911Z  if setting not in Experiment._fields: 2025-08-14T20:48:03.4100533Z  log.warning( 2025-08-14T20:48:03.4101354Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:48:03.4102117Z  ) 2025-08-14T20:48:03.4102614Z  else: 2025-08-14T20:48:03.4103208Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:48:03.4103819Z  2025-08-14T20:48:03.4104430Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:48:03.4105127Z  return Settings(experiments) 2025-08-14T20:48:03.4105679Z  2025-08-14T20:48:03.4106065Z  except Exception: 2025-08-14T20:48:03.4106634Z  log.exception("Failed to parse settings") 2025-08-14T20:48:03.4107211Z  2025-08-14T20:48:03.4107598Z  return Settings() 2025-08-14T20:48:03.4108062Z  2025-08-14T20:48:03.4108430Z  2025-08-14T20:48:03.4109050Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:48:03.4109714Z  """ 2025-08-14T20:48:03.4110217Z  Parse settings, if any, from the rollout state. 2025-08-14T20:48:03.4110816Z  2025-08-14T20:48:03.4111408Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:48:03.4112228Z  and the text below is the list of opted in users. 2025-08-14T20:48:03.4112832Z  2025-08-14T20:48:03.4113484Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:48:03.4114370Z  """ 2025-08-14T20:48:03.4115012Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:48:03.4115848Z  return parse_settings_from_text(settings_text) 2025-08-14T20:48:03.4116451Z  2025-08-14T20:48:03.4116807Z  2025-08-14T20:48:03.4117309Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:48:03.4117931Z  """ 2025-08-14T20:48:03.4118377Z  Parse users from the rollout state. 2025-08-14T20:48:03.4118931Z  2025-08-14T20:48:03.4119289Z  """ 2025-08-14T20:48:03.4119896Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:48:03.4120709Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:48:03.4121311Z  2025-08-14T20:48:03.4121665Z  2025-08-14T20:48:03.4122345Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:48:03.4123149Z  """ 2025-08-14T20:48:03.4123633Z  Check if a user is opted into an experiment 2025-08-14T20:48:03.4124318Z  """ 2025-08-14T20:48:03.4124856Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:48:03.4125487Z  2025-08-14T20:48:03.4125994Z  2025-08-14T20:48:03.4126691Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:48:03.4127517Z  """ 2025-08-14T20:48:03.4128048Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:48:03.4128678Z  """ 2025-08-14T20:48:03.4129251Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:48:03.4130016Z  experiment_optout = "-" + experiment_name 2025-08-14T20:48:03.4130729Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:48:03.4131381Z  return False 2025-08-14T20:48:03.4131842Z  2025-08-14T20:48:03.4132343Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:48:03.4132998Z  log.warning( 2025-08-14T20:48:03.4133901Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:48:03.4135007Z  ) 2025-08-14T20:48:03.4135416Z  2025-08-14T20:48:03.4135799Z  return True 2025-08-14T20:48:03.4136237Z  2025-08-14T20:48:03.4136603Z  2025-08-14T20:48:03.4136994Z def get_runner_prefix( 2025-08-14T20:48:03.4137497Z  rollout_state: str, 2025-08-14T20:48:03.4138043Z  workflow_requestors: Iterable[str], 2025-08-14T20:48:03.4138614Z  branch: str, 2025-08-14T20:48:03.4139208Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:48:03.4139962Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:48:03.4140602Z  is_canary: bool = False, 2025-08-14T20:48:03.4141113Z ) -> str: 2025-08-14T20:48:03.4141604Z  settings = parse_settings(rollout_state) 2025-08-14T20:48:03.4142257Z  user_optins = parse_users(rollout_state) 2025-08-14T20:48:03.4142824Z  2025-08-14T20:48:03.4143362Z  fleet_prefix = "" 2025-08-14T20:48:03.4143863Z  prefixes = [] 2025-08-14T20:48:03.4144705Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:48:03.4145729Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:48:03.4146519Z  log.info( 2025-08-14T20:48:03.4147286Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:48:03.4148086Z  ) 2025-08-14T20:48:03.4148551Z  continue 2025-08-14T20:48:03.4149002Z  2025-08-14T20:48:03.4149408Z  if opt_out_experiments: 2025-08-14T20:48:03.4150024Z  if experiment_name in opt_out_experiments: 2025-08-14T20:48:03.4150749Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:48:03.4151410Z  log.info( 2025-08-14T20:48:03.4152425Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:48:03.4153459Z  ) 2025-08-14T20:48:03.4153922Z  continue 2025-08-14T20:48:03.4154515Z  2025-08-14T20:48:03.4154925Z  if eligible_experiments: 2025-08-14T20:48:03.4155565Z  if experiment_name not in eligible_experiments: 2025-08-14T20:48:03.4156268Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:48:03.4156872Z  log.info( 2025-08-14T20:48:03.4157736Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:48:03.4158623Z  ) 2025-08-14T20:48:03.4159225Z  continue 2025-08-14T20:48:03.4159791Z  elif not experiment_settings.default: 2025-08-14T20:48:03.4160371Z  log.info( 2025-08-14T20:48:03.4161129Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:48:03.4161906Z  ) 2025-08-14T20:48:03.4162350Z  continue 2025-08-14T20:48:03.4162808Z  2025-08-14T20:48:03.4163323Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:48:03.4164103Z  opted_out_users = [ 2025-08-14T20:48:03.4164622Z  requestor 2025-08-14T20:48:03.4165164Z  for requestor in workflow_requestors 2025-08-14T20:48:03.4165905Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:48:03.4166589Z  ] 2025-08-14T20:48:03.4166988Z  2025-08-14T20:48:03.4167394Z  if opted_out_users: 2025-08-14T20:48:03.4167938Z  log.info( 2025-08-14T20:48:03.4168656Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:48:03.4169405Z  ) 2025-08-14T20:48:03.4169839Z  continue 2025-08-14T20:48:03.4170302Z  2025-08-14T20:48:03.4170797Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:48:03.4171470Z  opted_in_users = [ 2025-08-14T20:48:03.4171994Z  requestor 2025-08-14T20:48:03.4172540Z  for requestor in workflow_requestors 2025-08-14T20:48:03.4173278Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:48:03.4173948Z  ] 2025-08-14T20:48:03.4174455Z  2025-08-14T20:48:03.4174835Z  enabled = False 2025-08-14T20:48:03.4175345Z  if opted_in_users: 2025-08-14T20:48:03.4175996Z  log.info( 2025-08-14T20:48:03.4176785Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:48:03.4177519Z  ) 2025-08-14T20:48:03.4177967Z  enabled = True 2025-08-14T20:48:03.4178465Z  2025-08-14T20:48:03.4178906Z  elif experiment_settings.rollout_perc: 2025-08-14T20:48:03.4179808Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:48:03.4180826Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:48:03.4181527Z  log.info( 2025-08-14T20:48:03.4182509Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:48:03.4183484Z  ) 2025-08-14T20:48:03.4184075Z  enabled = True 2025-08-14T20:48:03.4184593Z  2025-08-14T20:48:03.4184975Z  if enabled: 2025-08-14T20:48:03.4185470Z  label = experiment_name 2025-08-14T20:48:03.4186095Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:48:03.4186991Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:48:03.4187927Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:48:03.4188758Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:48:03.4189465Z  if is_canary: 2025-08-14T20:48:03.4190037Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:48:03.4190636Z  fleet_prefix = label 2025-08-14T20:48:03.4191178Z  else: 2025-08-14T20:48:03.4191831Z  prefixes.append(label) 2025-08-14T20:48:03.4192377Z  2025-08-14T20:48:03.4192765Z  if len(prefixes) > 1: 2025-08-14T20:48:03.4193270Z  log.error( 2025-08-14T20:48:03.4194511Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:48:03.4195684Z  ) 2025-08-14T20:48:03.4196130Z  prefixes = prefixes[:1] 2025-08-14T20:48:03.4196648Z  2025-08-14T20:48:03.4197046Z  # Fleet always comes first 2025-08-14T20:48:03.4197582Z  if fleet_prefix: 2025-08-14T20:48:03.4198096Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:48:03.4198645Z  2025-08-14T20:48:03.4199134Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:48:03.4199740Z  2025-08-14T20:48:03.4200115Z  2025-08-14T20:48:03.4200801Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:48:03.4201637Z  """ 2025-08-14T20:48:03.4202284Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:48:03.4203041Z  2025-08-14T20:48:03.4203669Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:48:03.4204519Z  """ 2025-08-14T20:48:03.4204967Z  gh = get_gh_client(github_token) 2025-08-14T20:48:03.4205575Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:48:03.4206288Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:48:03.4206928Z  2025-08-14T20:48:03.4207293Z  2025-08-14T20:48:03.4207936Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:48:03.4208885Z  for _ in range(num_retries): 2025-08-14T20:48:03.4209423Z  try: 2025-08-14T20:48:03.4209918Z  req = Request(url=url, headers=headers) 2025-08-14T20:48:03.4210644Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:48:03.4211348Z  return json.loads(content) 2025-08-14T20:48:03.4211929Z  except Exception as e: 2025-08-14T20:48:03.4212544Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:48:03.4213139Z  2025-08-14T20:48:03.4213767Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:48:03.4214638Z  return {} 2025-08-14T20:48:03.4215069Z  2025-08-14T20:48:03.4215428Z  2025-08-14T20:48:03.4215792Z @cache 2025-08-14T20:48:03.4216500Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:48:03.4217325Z  """ 2025-08-14T20:48:03.4217774Z  Dynamically get PR information 2025-08-14T20:48:03.4218317Z  """ 2025-08-14T20:48:03.4218884Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:48:03.4219556Z  headers = { 2025-08-14T20:48:03.4220090Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:48:03.4220755Z  "Authorization": f"token {github_token}", 2025-08-14T20:48:03.4221333Z  } 2025-08-14T20:48:03.4221822Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:48:03.4222492Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:48:03.4223082Z  headers=headers, 2025-08-14T20:48:03.4223564Z  ) 2025-08-14T20:48:03.4223954Z  2025-08-14T20:48:03.4224449Z  if not json_response: 2025-08-14T20:48:03.4225175Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:48:03.4225999Z  return {} 2025-08-14T20:48:03.4226453Z  2025-08-14T20:48:03.4226848Z  return json_response 2025-08-14T20:48:03.4227328Z  2025-08-14T20:48:03.4227685Z  2025-08-14T20:48:03.4228322Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:48:03.4229107Z  """ 2025-08-14T20:48:03.4229694Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:48:03.4230394Z  """ 2025-08-14T20:48:03.4230935Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:48:03.4231598Z  return { 2025-08-14T20:48:03.4232248Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:48:03.4232971Z  } 2025-08-14T20:48:03.4233362Z  2025-08-14T20:48:03.4233724Z  2025-08-14T20:48:03.4234216Z def main() -> None: 2025-08-14T20:48:03.4234736Z  args = parse_args() 2025-08-14T20:48:03.4235223Z  2025-08-14T20:48:03.4235676Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:48:03.4236263Z  2025-08-14T20:48:03.4236671Z  # Check if the PR is opt-out 2025-08-14T20:48:03.4237217Z  if args.pr_number: 2025-08-14T20:48:03.4237964Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:48:03.4238770Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:48:03.4239320Z  log.info( 2025-08-14T20:48:03.4240098Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:48:03.4240912Z  ) 2025-08-14T20:48:03.4241549Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:48:03.4242279Z  sys.exit() 2025-08-14T20:48:03.4242876Z  2025-08-14T20:48:03.4243248Z  try: 2025-08-14T20:48:03.4243749Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:48:03.4244633Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:48:03.4245330Z  ) 2025-08-14T20:48:03.4245746Z  2025-08-14T20:48:03.4246172Z  username = get_potential_pr_author( 2025-08-14T20:48:03.4246766Z  args.github_token, 2025-08-14T20:48:03.4247305Z  args.github_repo, 2025-08-14T20:48:03.4247843Z  args.github_actor, 2025-08-14T20:48:03.4248386Z  args.github_ref_type, 2025-08-14T20:48:03.4248941Z  args.github_branch, 2025-08-14T20:48:03.4249451Z  ) 2025-08-14T20:48:03.4249853Z  2025-08-14T20:48:03.4250382Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:48:03.4251029Z  2025-08-14T20:48:03.4251485Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:48:03.4252080Z  rollout_state, 2025-08-14T20:48:03.4252642Z  (args.github_issue_owner, username), 2025-08-14T20:48:03.4253235Z  args.github_branch, 2025-08-14T20:48:03.4253801Z  args.eligible_experiments, 2025-08-14T20:48:03.4254498Z  args.opt_out_experiments, 2025-08-14T20:48:03.4255053Z  is_canary, 2025-08-14T20:48:03.4255528Z  ) 2025-08-14T20:48:03.4255925Z  2025-08-14T20:48:03.4256334Z  except Exception as e: 2025-08-14T20:48:03.4256848Z  log.error( 2025-08-14T20:48:03.4257623Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:48:03.4258427Z  ) 2025-08-14T20:48:03.4258980Z  2025-08-14T20:48:03.4259561Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:48:03.4260259Z  2025-08-14T20:48:03.4260624Z  2025-08-14T20:48:03.4261005Z if __name__ == "__main__": 2025-08-14T20:48:03.4261510Z  main() 2025-08-14T20:48:03.4261916Z  2025-08-14T20:48:03.4262281Z EOF 2025-08-14T20:48:03.4262657Z  2025-08-14T20:48:03.4263063Z cat runner_determinator.py 2025-08-14T20:48:03.4554904Z shell: /usr/bin/bash -e {0} 2025-08-14T20:48:03.4555900Z env: 2025-08-14T20:48:03.4556688Z GITHUB_TOKEN: *** 2025-08-14T20:48:03.4557123Z ISSUE_NUMBER: 5132 2025-08-14T20:48:03.4557575Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:48:03.4558093Z ISSUE_OWNER: 2025-08-14T20:48:03.4558490Z CHECK_EXPERIMENTS: 2025-08-14T20:48:03.4558942Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:48:03.4559386Z PR_NUMBER: 2025-08-14T20:48:03.4559803Z ##[endgroup] 2025-08-14T20:48:03.4783701Z # flake8: noqa: G004 2025-08-14T20:48:03.4784328Z 2025-08-14T20:48:03.4784780Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:48:03.4785768Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:48:03.4786571Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:48:03.4787036Z 2025-08-14T20:48:03.4787198Z """ 2025-08-14T20:48:03.4787784Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:48:03.4788664Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:48:03.4789576Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:48:03.4790386Z of which runners should be used to run which job. 2025-08-14T20:48:03.4790790Z 2025-08-14T20:48:03.4791170Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:48:03.4792281Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:48:03.4793192Z settings are considered to be empty with only the second part, the user 2025-08-14T20:48:03.4793909Z list, defined. 2025-08-14T20:48:03.4794405Z 2025-08-14T20:48:03.4794791Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:48:03.4795751Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:48:03.4796580Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:48:03.4797047Z 2025-08-14T20:48:03.4797414Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:48:03.4798286Z The user list is also a comma separated list of additional features or 2025-08-14T20:48:03.4799018Z experiments which the user could be opted in to. 2025-08-14T20:48:03.4799423Z 2025-08-14T20:48:03.4799626Z The user list has the following rules: 2025-08-14T20:48:03.4799971Z 2025-08-14T20:48:03.4800304Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:48:03.4801202Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:48:03.4801969Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:48:03.4802365Z 2025-08-14T20:48:03.4802536Z Example config: 2025-08-14T20:48:03.4802989Z # A list of experiments that can be opted into. 2025-08-14T20:48:03.4803651Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:48:03.4804571Z # Expected syntax is: 2025-08-14T20:48:03.4805232Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:48:03.4806219Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:48:03.4806836Z 2025-08-14T20:48:03.4807011Z experiments: 2025-08-14T20:48:03.4807399Z lf: 2025-08-14T20:48:03.4807780Z rollout_percent: 25 2025-08-14T20:48:03.4808464Z all_branches: false 2025-08-14T20:48:03.4808917Z default: true 2025-08-14T20:48:03.4809320Z --- 2025-08-14T20:48:03.4809528Z 2025-08-14T20:48:03.4809692Z # Opt-ins: 2025-08-14T20:48:03.4810276Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:48:03.4811158Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:48:03.4811942Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:48:03.4812605Z # Experiments should be from the above list. 2025-08-14T20:48:03.4812982Z 2025-08-14T20:48:03.4813164Z @User1,-lf,split_build 2025-08-14T20:48:03.4813608Z @User2,lf 2025-08-14T20:48:03.4814210Z @User3,split_build 2025-08-14T20:48:03.4814640Z """ 2025-08-14T20:48:03.4814839Z 2025-08-14T20:48:03.4815001Z import json 2025-08-14T20:48:03.4815368Z import logging 2025-08-14T20:48:03.4815746Z import os 2025-08-14T20:48:03.4816103Z import random 2025-08-14T20:48:03.4816477Z import re 2025-08-14T20:48:03.4816844Z import sys 2025-08-14T20:48:03.4817245Z from argparse import ArgumentParser 2025-08-14T20:48:03.4817779Z from collections.abc import Iterable 2025-08-14T20:48:03.4818299Z from functools import cache 2025-08-14T20:48:03.4818777Z from logging import LogRecord 2025-08-14T20:48:03.4819270Z from typing import Any, NamedTuple 2025-08-14T20:48:03.4819801Z from urllib.request import Request, urlopen 2025-08-14T20:48:03.4820171Z 2025-08-14T20:48:03.4820334Z import yaml 2025-08-14T20:48:03.4820726Z from github import Auth, Github 2025-08-14T20:48:03.4821212Z from github.Issue import Issue 2025-08-14T20:48:03.4821527Z 2025-08-14T20:48:03.4821534Z 2025-08-14T20:48:03.4821749Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:48:03.4822442Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:48:03.4823314Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:48:03.4823889Z 2025-08-14T20:48:03.4824408Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:48:03.4825178Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:48:03.4825711Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:48:03.4826269Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:48:03.4826630Z 2025-08-14T20:48:03.4826822Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:48:03.4827160Z 2025-08-14T20:48:03.4827353Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:48:03.4827806Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:48:03.4828085Z 2025-08-14T20:48:03.4828098Z 2025-08-14T20:48:03.4828292Z class Experiment(NamedTuple): 2025-08-14T20:48:03.4828806Z rollout_perc: float = ( 2025-08-14T20:48:03.4829452Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:48:03.4830143Z ) 2025-08-14T20:48:03.4830522Z all_branches: bool = ( 2025-08-14T20:48:03.4831152Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:48:03.4831835Z ) 2025-08-14T20:48:03.4832200Z default: bool = ( 2025-08-14T20:48:03.4832766Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:48:03.4833415Z ) 2025-08-14T20:48:03.4833607Z 2025-08-14T20:48:03.4833787Z # Add more fields as needed 2025-08-14T20:48:03.4834340Z 2025-08-14T20:48:03.4834351Z 2025-08-14T20:48:03.4834553Z class Settings(NamedTuple): 2025-08-14T20:48:03.4835007Z """ 2025-08-14T20:48:03.4835456Z Settings for the experiments that can be opted into. 2025-08-14T20:48:03.4836035Z """ 2025-08-14T20:48:03.4836232Z 2025-08-14T20:48:03.4836436Z experiments: dict[str, Experiment] = {} 2025-08-14T20:48:03.4836804Z 2025-08-14T20:48:03.4836819Z 2025-08-14T20:48:03.4837018Z class ColorFormatter(logging.Formatter): 2025-08-14T20:48:03.4837634Z """Color codes the log messages based on the log level""" 2025-08-14T20:48:03.4838075Z 2025-08-14T20:48:03.4838235Z COLORS = { 2025-08-14T20:48:03.4838633Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:48:03.4839293Z "ERROR": "\033[31m", # Red 2025-08-14T20:48:03.4839787Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:48:03.4840284Z "INFO": "\033[0m", # Reset 2025-08-14T20:48:03.4840766Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:48:03.4841241Z } 2025-08-14T20:48:03.4841438Z 2025-08-14T20:48:03.4841654Z def format(self, record: LogRecord) -> str: 2025-08-14T20:48:03.4842400Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:48:03.4843186Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:48:03.4843769Z return super().format(record) 2025-08-14T20:48:03.4844354Z 2025-08-14T20:48:03.4844362Z 2025-08-14T20:48:03.4844576Z handler = logging.StreamHandler() 2025-08-14T20:48:03.4845288Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:48:03.4845849Z 2025-08-14T20:48:03.4846086Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:48:03.4846670Z log.addHandler(handler) 2025-08-14T20:48:03.4847115Z log.setLevel(logging.INFO) 2025-08-14T20:48:03.4847410Z 2025-08-14T20:48:03.4847417Z 2025-08-14T20:48:03.4847665Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:48:03.4848229Z """ 2025-08-14T20:48:03.4848719Z Defines outputs of the github action that invokes this script 2025-08-14T20:48:03.4849355Z """ 2025-08-14T20:48:03.4849714Z if not GITHUB_OUTPUT: 2025-08-14T20:48:03.4850778Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:48:03.4851905Z log.warning( 2025-08-14T20:48:03.4852756Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:48:03.4853677Z ) 2025-08-14T20:48:03.4863856Z print(f"::set-output name={key}::{value}") 2025-08-14T20:48:03.4864828Z return 2025-08-14T20:48:03.4865068Z 2025-08-14T20:48:03.4865475Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:48:03.4866096Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:48:03.4866661Z f.write(f"{key}={value}\n") 2025-08-14T20:48:03.4866994Z 2025-08-14T20:48:03.4867002Z 2025-08-14T20:48:03.4867317Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:48:03.4867965Z return frozenset( 2025-08-14T20:48:03.4868584Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:48:03.4869281Z ) 2025-08-14T20:48:03.4869479Z 2025-08-14T20:48:03.4869485Z 2025-08-14T20:48:03.4869666Z def parse_args() -> Any: 2025-08-14T20:48:03.4870228Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:48:03.4871106Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:48:03.4871894Z parser.add_argument( 2025-08-14T20:48:03.4872367Z "--github-issue-repo", 2025-08-14T20:48:03.4872849Z type=str, 2025-08-14T20:48:03.4873267Z required=False, 2025-08-14T20:48:03.4873722Z default="pytorch/test-infra", 2025-08-14T20:48:03.4874497Z help="GitHub repo to get the issue", 2025-08-14T20:48:03.4875023Z ) 2025-08-14T20:48:03.4875402Z parser.add_argument( 2025-08-14T20:48:03.4875849Z "--github-repo", 2025-08-14T20:48:03.4876278Z type=str, 2025-08-14T20:48:03.4876683Z required=True, 2025-08-14T20:48:03.4877159Z help="GitHub repo where CI is running", 2025-08-14T20:48:03.4877688Z ) 2025-08-14T20:48:03.4878051Z parser.add_argument( 2025-08-14T20:48:03.4878675Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:48:03.4879345Z ) 2025-08-14T20:48:03.4879715Z parser.add_argument( 2025-08-14T20:48:03.4880328Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:48:03.4881017Z ) 2025-08-14T20:48:03.4881383Z parser.add_argument( 2025-08-14T20:48:03.4882188Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:48:03.4882891Z ) 2025-08-14T20:48:03.4883262Z parser.add_argument( 2025-08-14T20:48:03.4883926Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:48:03.4884863Z ) 2025-08-14T20:48:03.4885231Z parser.add_argument( 2025-08-14T20:48:03.4885679Z "--github-ref-type", 2025-08-14T20:48:03.4886132Z type=str, 2025-08-14T20:48:03.4886534Z required=True, 2025-08-14T20:48:03.4887027Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:48:03.4887584Z ) 2025-08-14T20:48:03.4887953Z parser.add_argument( 2025-08-14T20:48:03.4888403Z "--eligible-experiments", 2025-08-14T20:48:03.4888926Z type=_str_comma_separated_to_set, 2025-08-14T20:48:03.4889452Z required=False, 2025-08-14T20:48:03.4889869Z default="", 2025-08-14T20:48:03.4890748Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:48:03.4891686Z ) 2025-08-14T20:48:03.4892060Z parser.add_argument( 2025-08-14T20:48:03.4892516Z "--opt-out-experiments", 2025-08-14T20:48:03.4893021Z type=_str_comma_separated_to_set, 2025-08-14T20:48:03.4893541Z required=False, 2025-08-14T20:48:03.4893961Z default="", 2025-08-14T20:48:03.4894536Z help=( 2025-08-14T20:48:03.4895228Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:48:03.4896388Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:48:03.4897236Z ), 2025-08-14T20:48:03.4897595Z ) 2025-08-14T20:48:03.4897959Z parser.add_argument( 2025-08-14T20:48:03.4950485Z "--pr-number", 2025-08-14T20:48:03.4951211Z type=str, 2025-08-14T20:48:03.4951665Z required=False, 2025-08-14T20:48:03.4952147Z default="", 2025-08-14T20:48:03.4952916Z help="the optional PR number where this is run", 2025-08-14T20:48:03.4953500Z ) 2025-08-14T20:48:03.4953713Z 2025-08-14T20:48:03.4953907Z return parser.parse_args() 2025-08-14T20:48:03.4954480Z 2025-08-14T20:48:03.4954487Z 2025-08-14T20:48:03.4954917Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:48:03.4955684Z auth = Auth.Token(github_token) 2025-08-14T20:48:03.4956202Z return Github(auth=auth) 2025-08-14T20:48:03.4956506Z 2025-08-14T20:48:03.4956513Z 2025-08-14T20:48:03.4956976Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:48:03.4957790Z repo = gh.get_repo(repo) 2025-08-14T20:48:03.4958290Z return repo.get_issue(number=issue_num) 2025-08-14T20:48:03.4958663Z 2025-08-14T20:48:03.4958670Z 2025-08-14T20:48:03.4958862Z def get_potential_pr_author( 2025-08-14T20:48:03.4959508Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:48:03.4960194Z ) -> str: 2025-08-14T20:48:03.4960708Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:48:03.4961503Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:48:03.4962248Z # embedded in the tag name: ciflow// 2025-08-14T20:48:03.4962662Z 2025-08-14T20:48:03.4962858Z gh = get_gh_client(github_token) 2025-08-14T20:48:03.4963190Z 2025-08-14T20:48:03.4963452Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:48:03.4964293Z split_tag = ref_name.split("/") 2025-08-14T20:48:03.4964824Z if ( 2025-08-14T20:48:03.4965216Z len(split_tag) == 3 2025-08-14T20:48:03.4965683Z and split_tag[0] == "ciflow" 2025-08-14T20:48:03.4966203Z and split_tag[2].isnumeric() 2025-08-14T20:48:03.4966692Z ): 2025-08-14T20:48:03.4967073Z pr_number = split_tag[2] 2025-08-14T20:48:03.4967739Z try: 2025-08-14T20:48:03.4968171Z repository = gh.get_repo(repo) 2025-08-14T20:48:03.4968779Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:48:03.4969382Z except Exception as e: 2025-08-14T20:48:03.4969899Z raise Exception( # noqa: TRY002 2025-08-14T20:48:03.4970563Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:48:03.4971217Z ) from e 2025-08-14T20:48:03.4971749Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:48:03.4972443Z # In all other cases, return the original input username 2025-08-14T20:48:03.4973028Z return username 2025-08-14T20:48:03.4973265Z 2025-08-14T20:48:03.4973272Z 2025-08-14T20:48:03.4973498Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:48:03.4974232Z """ 2025-08-14T20:48:03.4974941Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:48:03.4975736Z """ 2025-08-14T20:48:03.4976277Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:48:03.4976807Z 2025-08-14T20:48:03.4976814Z 2025-08-14T20:48:03.4977007Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:48:03.4977515Z try: 2025-08-14T20:48:03.4977897Z data = yaml.safe_load(yaml_text) 2025-08-14T20:48:03.4978403Z return data 2025-08-14T20:48:03.4978812Z except yaml.YAMLError: 2025-08-14T20:48:03.4979301Z log.exception("Error loading YAML") 2025-08-14T20:48:03.4979811Z raise 2025-08-14T20:48:03.4980030Z 2025-08-14T20:48:03.4980037Z 2025-08-14T20:48:03.4980451Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:48:03.4981184Z """ 2025-08-14T20:48:03.4981813Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:48:03.4982421Z 2025-08-14T20:48:03.4982951Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:48:03.4983722Z and the text below is the list of opted in users. 2025-08-14T20:48:03.4984286Z 2025-08-14T20:48:03.4984663Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:48:03.4985370Z """ 2025-08-14T20:48:03.4985804Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:48:03.4986418Z if len(rollout_state_parts) >= 2: 2025-08-14T20:48:03.4987024Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:48:03.4987618Z else: 2025-08-14T20:48:03.4987990Z return "", rollout_state 2025-08-14T20:48:03.4988301Z 2025-08-14T20:48:03.4988307Z 2025-08-14T20:48:03.4988503Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:48:03.4989001Z """ 2025-08-14T20:48:03.4989518Z Dictionary of users with a list of features they have opted into 2025-08-14T20:48:03.4990157Z """ 2025-08-14T20:48:03.4990361Z 2025-08-14T20:48:03.4990367Z 2025-08-14T20:48:03.4990703Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:48:03.4991358Z """ 2025-08-14T20:48:03.4992061Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:48:03.4992751Z 2025-08-14T20:48:03.4993374Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:48:03.4994475Z - Example line: "@User1,lf,split_build" 2025-08-14T20:48:03.4995148Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:48:03.4995627Z 2025-08-14T20:48:03.4995633Z 2025-08-14T20:48:03.4995792Z """ 2025-08-14T20:48:03.4996159Z optins = UserOptins() 2025-08-14T20:48:03.4996645Z for user in user_optin_text.split("\n"): 2025-08-14T20:48:03.4997184Z user = user.strip("\r\n\t -") 2025-08-14T20:48:03.4997723Z if not user or not user.startswith("@"): 2025-08-14T20:48:03.4998417Z # Not a valid user. Skip 2025-08-14T20:48:03.4998898Z continue 2025-08-14T20:48:03.4999142Z 2025-08-14T20:48:03.4999301Z if user: 2025-08-14T20:48:03.4999732Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:48:03.5000425Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:48:03.5000919Z 2025-08-14T20:48:03.5001086Z return optins 2025-08-14T20:48:03.5001319Z 2025-08-14T20:48:03.5001333Z 2025-08-14T20:48:03.5001613Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:48:03.5002208Z """ 2025-08-14T20:48:03.5002595Z Check if the experiment name is valid. 2025-08-14T20:48:03.5003104Z A valid name: 2025-08-14T20:48:03.5003729Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:48:03.5005015Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:48:03.5005789Z - Cannot contain spaces 2025-08-14T20:48:03.5006255Z """ 2025-08-14T20:48:03.5006455Z 2025-08-14T20:48:03.5006715Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:48:03.5007427Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:48:03.5007889Z 2025-08-14T20:48:03.5008048Z if valid: 2025-08-14T20:48:03.5008423Z return True 2025-08-14T20:48:03.5008659Z 2025-08-14T20:48:03.5008830Z log.error( 2025-08-14T20:48:03.5010349Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:48:03.5011970Z ) 2025-08-14T20:48:03.5012317Z return False 2025-08-14T20:48:03.5012551Z 2025-08-14T20:48:03.5012558Z 2025-08-14T20:48:03.5012865Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:48:03.5013489Z """ 2025-08-14T20:48:03.5014478Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:48:03.5015243Z """ 2025-08-14T20:48:03.5015589Z try: 2025-08-14T20:48:03.5015956Z if settings_text: 2025-08-14T20:48:03.5016696Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:48:03.5017502Z # for easy reading 2025-08-14T20:48:03.5018285Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:48:03.5019176Z # the backtick character in shell commands. 2025-08-14T20:48:03.5019781Z backtick = chr(96) # backtick character 2025-08-14T20:48:03.5020443Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:48:03.5021101Z settings = load_yaml(settings_text) 2025-08-14T20:48:03.5021471Z 2025-08-14T20:48:03.5021887Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:48:03.5022657Z experiments = {} 2025-08-14T20:48:03.5022954Z 2025-08-14T20:48:03.5023343Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:48:03.5024217Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:48:03.5025368Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:48:03.5026409Z continue 2025-08-14T20:48:03.5026704Z 2025-08-14T20:48:03.5026880Z valid_settings = {} 2025-08-14T20:48:03.5027392Z for setting in exp_settings: 2025-08-14T20:48:03.5027956Z if setting not in Experiment._fields: 2025-08-14T20:48:03.5028503Z log.warning( 2025-08-14T20:48:03.5029234Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:48:03.5030112Z ) 2025-08-14T20:48:03.5030538Z else: 2025-08-14T20:48:03.5031041Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:48:03.5031463Z 2025-08-14T20:48:03.5031727Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:48:03.5032359Z return Settings(experiments) 2025-08-14T20:48:03.5032711Z 2025-08-14T20:48:03.5032881Z except Exception: 2025-08-14T20:48:03.5033354Z log.exception("Failed to parse settings") 2025-08-14T20:48:03.5033739Z 2025-08-14T20:48:03.5033912Z return Settings() 2025-08-14T20:48:03.5034276Z 2025-08-14T20:48:03.5034282Z 2025-08-14T20:48:03.5034531Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:48:03.5035098Z """ 2025-08-14T20:48:03.5035519Z Parse settings, if any, from the rollout state. 2025-08-14T20:48:03.5035940Z 2025-08-14T20:48:03.5036281Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:48:03.5037045Z and the text below is the list of opted in users. 2025-08-14T20:48:03.5037458Z 2025-08-14T20:48:03.5037862Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:48:03.5038632Z """ 2025-08-14T20:48:03.5039181Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:48:03.5039951Z return parse_settings_from_text(settings_text) 2025-08-14T20:48:03.5040349Z 2025-08-14T20:48:03.5040355Z 2025-08-14T20:48:03.5040598Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:48:03.5041162Z """ 2025-08-14T20:48:03.5041543Z Parse users from the rollout state. 2025-08-14T20:48:03.5041895Z 2025-08-14T20:48:03.5042047Z """ 2025-08-14T20:48:03.5042571Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:48:03.5043303Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:48:03.5043726Z 2025-08-14T20:48:03.5043733Z 2025-08-14T20:48:03.5044556Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:48:03.5045371Z """ 2025-08-14T20:48:03.5045793Z Check if a user is opted into an experiment 2025-08-14T20:48:03.5046351Z """ 2025-08-14T20:48:03.5046804Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:48:03.5047229Z 2025-08-14T20:48:03.5047236Z 2025-08-14T20:48:03.5047658Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:48:03.5048395Z """ 2025-08-14T20:48:03.5048852Z Check if a user explicitly opted out of an experiment 2025-08-14T20:48:03.5049423Z """ 2025-08-14T20:48:03.5049915Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:48:03.5050594Z experiment_optout = "-" + experiment_name 2025-08-14T20:48:03.5051219Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:48:03.5051811Z return False 2025-08-14T20:48:03.5052078Z 2025-08-14T20:48:03.5052350Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:48:03.5052949Z log.warning( 2025-08-14T20:48:03.5053752Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:48:03.5054757Z ) 2025-08-14T20:48:03.5054967Z 2025-08-14T20:48:03.5055137Z return True 2025-08-14T20:48:03.5055367Z 2025-08-14T20:48:03.5055374Z 2025-08-14T20:48:03.5055545Z def get_runner_prefix( 2025-08-14T20:48:03.5055979Z rollout_state: str, 2025-08-14T20:48:03.5056430Z workflow_requestors: Iterable[str], 2025-08-14T20:48:03.5056940Z branch: str, 2025-08-14T20:48:03.5057417Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:48:03.5058088Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:48:03.5058670Z is_canary: bool = False, 2025-08-14T20:48:03.5059127Z ) -> str: 2025-08-14T20:48:03.5059669Z settings = parse_settings(rollout_state) 2025-08-14T20:48:03.5060261Z user_optins = parse_users(rollout_state) 2025-08-14T20:48:03.5060633Z 2025-08-14T20:48:03.5060806Z fleet_prefix = "" 2025-08-14T20:48:03.5061219Z prefixes = [] 2025-08-14T20:48:03.5061848Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:48:03.5062787Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:48:03.5063500Z log.info( 2025-08-14T20:48:03.5064500Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:48:03.5065289Z ) 2025-08-14T20:48:03.5065660Z continue 2025-08-14T20:48:03.5065907Z 2025-08-14T20:48:03.5066092Z if opt_out_experiments: 2025-08-14T20:48:03.5066622Z if experiment_name in opt_out_experiments: 2025-08-14T20:48:03.5067257Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:48:03.5067853Z log.info( 2025-08-14T20:48:03.5068787Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:48:03.5069794Z ) 2025-08-14T20:48:03.5070179Z continue 2025-08-14T20:48:03.5070451Z 2025-08-14T20:48:03.5070639Z if eligible_experiments: 2025-08-14T20:48:03.5071194Z if experiment_name not in eligible_experiments: 2025-08-14T20:48:03.5071830Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:48:03.5072393Z log.info( 2025-08-14T20:48:03.5073174Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:48:03.5074119Z ) 2025-08-14T20:48:03.5074516Z continue 2025-08-14T20:48:03.5074993Z elif not experiment_settings.default: 2025-08-14T20:48:03.5075537Z log.info( 2025-08-14T20:48:03.5076332Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:48:03.5077095Z ) 2025-08-14T20:48:03.5077466Z continue 2025-08-14T20:48:03.5077474Z 2025-08-14T20:48:03.5077757Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:48:03.5077934Z opted_out_users = [ 2025-08-14T20:48:03.5078096Z requestor 2025-08-14T20:48:03.5078297Z for requestor in workflow_requestors 2025-08-14T20:48:03.5078615Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:48:03.5078773Z ] 2025-08-14T20:48:03.5078781Z 2025-08-14T20:48:03.5078962Z if opted_out_users: 2025-08-14T20:48:03.5079130Z log.info( 2025-08-14T20:48:03.5079508Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:48:03.5079666Z ) 2025-08-14T20:48:03.5079831Z continue 2025-08-14T20:48:03.5079844Z 2025-08-14T20:48:03.5080124Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:48:03.5080298Z opted_in_users = [ 2025-08-14T20:48:03.5080461Z requestor 2025-08-14T20:48:03.5080674Z for requestor in workflow_requestors 2025-08-14T20:48:03.5080968Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:48:03.5081128Z ] 2025-08-14T20:48:03.5081135Z 2025-08-14T20:48:03.5081311Z enabled = False 2025-08-14T20:48:03.5081485Z if opted_in_users: 2025-08-14T20:48:03.5081645Z log.info( 2025-08-14T20:48:03.5082005Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:48:03.5082165Z ) 2025-08-14T20:48:03.5082336Z enabled = True 2025-08-14T20:48:03.5082344Z 2025-08-14T20:48:03.5082557Z elif experiment_settings.rollout_perc: 2025-08-14T20:48:03.5083024Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:48:03.5083458Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:48:03.5083624Z log.info( 2025-08-14T20:48:03.5084538Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:48:03.5084711Z ) 2025-08-14T20:48:03.5084892Z enabled = True 2025-08-14T20:48:03.5084902Z 2025-08-14T20:48:03.5085072Z if enabled: 2025-08-14T20:48:03.5085261Z label = experiment_name 2025-08-14T20:48:03.5085488Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:48:03.5085930Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:48:03.5086199Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:48:03.5086522Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:48:03.5086700Z if is_canary: 2025-08-14T20:48:03.5086900Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:48:03.5087084Z fleet_prefix = label 2025-08-14T20:48:03.5087243Z else: 2025-08-14T20:48:03.5087440Z prefixes.append(label) 2025-08-14T20:48:03.5087449Z 2025-08-14T20:48:03.5087624Z if len(prefixes) > 1: 2025-08-14T20:48:03.5087786Z log.error( 2025-08-14T20:48:03.5088628Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:48:03.5088790Z ) 2025-08-14T20:48:03.5088980Z prefixes = prefixes[:1] 2025-08-14T20:48:03.5088988Z 2025-08-14T20:48:03.5089177Z # Fleet always comes first 2025-08-14T20:48:03.5089351Z if fleet_prefix: 2025-08-14T20:48:03.5089553Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:48:03.5089566Z 2025-08-14T20:48:03.5089953Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:48:03.5089964Z 2025-08-14T20:48:03.5089970Z 2025-08-14T20:48:03.5090439Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:48:03.5090599Z """ 2025-08-14T20:48:03.5090992Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:48:03.5091000Z 2025-08-14T20:48:03.5091392Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:48:03.5091548Z """ 2025-08-14T20:48:03.5091739Z gh = get_gh_client(github_token) 2025-08-14T20:48:03.5091943Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:48:03.5092221Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:48:03.5092229Z 2025-08-14T20:48:03.5092236Z 2025-08-14T20:48:03.5092637Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:48:03.5092837Z for _ in range(num_retries): 2025-08-14T20:48:03.5093000Z try: 2025-08-14T20:48:03.5093209Z req = Request(url=url, headers=headers) 2025-08-14T20:48:03.5093498Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:48:03.5093697Z return json.loads(content) 2025-08-14T20:48:03.5093886Z except Exception as e: 2025-08-14T20:48:03.5094500Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:48:03.5094510Z 2025-08-14T20:48:03.5094901Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:48:03.5095062Z return {} 2025-08-14T20:48:03.5095071Z 2025-08-14T20:48:03.5095077Z 2025-08-14T20:48:03.5095238Z @cache 2025-08-14T20:48:03.5095673Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:48:03.5095831Z """ 2025-08-14T20:48:03.5096025Z Dynamically get PR information 2025-08-14T20:48:03.5096180Z """ 2025-08-14T20:48:03.5096624Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:48:03.5096788Z headers = { 2025-08-14T20:48:03.5097012Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:48:03.5097227Z "Authorization": f"token {github_token}", 2025-08-14T20:48:03.5097385Z } 2025-08-14T20:48:03.5097614Z json_response: dict[str, Any] = download_json( 2025-08-14T20:48:03.5097822Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:48:03.5098002Z headers=headers, 2025-08-14T20:48:03.5098161Z ) 2025-08-14T20:48:03.5098169Z 2025-08-14T20:48:03.5098348Z if not json_response: 2025-08-14T20:48:03.5098640Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:48:03.5098802Z return {} 2025-08-14T20:48:03.5098809Z 2025-08-14T20:48:03.5098980Z return json_response 2025-08-14T20:48:03.5098987Z 2025-08-14T20:48:03.5098994Z 2025-08-14T20:48:03.5099398Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:48:03.5099567Z """ 2025-08-14T20:48:03.5099894Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:48:03.5100055Z """ 2025-08-14T20:48:03.5100335Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:48:03.5100496Z return { 2025-08-14T20:48:03.5100858Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:48:03.5101018Z } 2025-08-14T20:48:03.5101025Z 2025-08-14T20:48:03.5101031Z 2025-08-14T20:48:03.5101201Z def main() -> None: 2025-08-14T20:48:03.5101373Z args = parse_args() 2025-08-14T20:48:03.5101381Z 2025-08-14T20:48:03.5101603Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:48:03.5101612Z 2025-08-14T20:48:03.5101800Z # Check if the PR is opt-out 2025-08-14T20:48:03.5101971Z if args.pr_number: 2025-08-14T20:48:03.5102375Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:48:03.5102681Z if OPT_OUT_LABEL in labels: 2025-08-14T20:48:03.5102857Z log.info( 2025-08-14T20:48:03.5103296Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:48:03.5103457Z ) 2025-08-14T20:48:03.5103786Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:48:03.5103952Z sys.exit() 2025-08-14T20:48:03.5103959Z 2025-08-14T20:48:03.5104232Z try: 2025-08-14T20:48:03.5104467Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:48:03.5104779Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:48:03.5104943Z ) 2025-08-14T20:48:03.5104951Z 2025-08-14T20:48:03.5105151Z username = get_potential_pr_author( 2025-08-14T20:48:03.5105327Z args.github_token, 2025-08-14T20:48:03.5105504Z args.github_repo, 2025-08-14T20:48:03.5105697Z args.github_actor, 2025-08-14T20:48:03.5105892Z args.github_ref_type, 2025-08-14T20:48:03.5106075Z args.github_branch, 2025-08-14T20:48:03.5106235Z ) 2025-08-14T20:48:03.5106243Z 2025-08-14T20:48:03.5106527Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:48:03.5106535Z 2025-08-14T20:48:03.5106749Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:48:03.5106931Z rollout_state, 2025-08-14T20:48:03.5107136Z (args.github_issue_owner, username), 2025-08-14T20:48:03.5107312Z args.github_branch, 2025-08-14T20:48:03.5107508Z args.eligible_experiments, 2025-08-14T20:48:03.5107707Z args.opt_out_experiments, 2025-08-14T20:48:03.5107869Z is_canary, 2025-08-14T20:48:03.5108025Z ) 2025-08-14T20:48:03.5108033Z 2025-08-14T20:48:03.5108222Z except Exception as e: 2025-08-14T20:48:03.5108384Z log.error( 2025-08-14T20:48:03.5108818Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:48:03.5109106Z ) 2025-08-14T20:48:03.5109120Z 2025-08-14T20:48:03.5109450Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:48:03.5109459Z 2025-08-14T20:48:03.5109466Z 2025-08-14T20:48:03.5109638Z if __name__ == "__main__": 2025-08-14T20:48:03.5109797Z main() 2025-08-14T20:48:03.5109810Z 2025-08-14T20:48:03.5207501Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:48:03.5208429Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:48:03.5249877Z shell: /usr/bin/bash -e {0} 2025-08-14T20:48:03.5250357Z env: 2025-08-14T20:48:03.5250994Z GITHUB_TOKEN: *** 2025-08-14T20:48:03.5251416Z ISSUE_NUMBER: 5132 2025-08-14T20:48:03.5251856Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:48:03.5252362Z ISSUE_OWNER: 2025-08-14T20:48:03.5252759Z CHECK_EXPERIMENTS: 2025-08-14T20:48:03.5253196Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:48:03.5253656Z PR_NUMBER: 2025-08-14T20:48:03.5254169Z ##[endgroup] 2025-08-14T20:48:04.9812924Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:48:05.9199616Z Collecting urllib3==1.26.18 2025-08-14T20:48:05.9565398Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:48:05.9806037Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.0 MB/s eta 0:00:00 2025-08-14T20:48:06.0159258Z Collecting PyGithub==2.3.0 2025-08-14T20:48:06.0202846Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:48:06.0800006Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:48:06.0845674Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:48:06.0894368Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:48:06.0913802Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:48:06.0928970Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:48:06.1318140Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:48:06.1363008Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:48:06.1605523Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:48:06.3036929Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:48:06.3078605Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:48:06.4395220Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:48:06.4434151Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:48:06.4712786Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:48:06.4746082Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:48:06.4978045Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:48:06.5065204Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 19.4 MB/s eta 0:00:00 2025-08-14T20:48:06.5101006Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:48:06.5185109Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 52.1 MB/s eta 0:00:00 2025-08-14T20:48:06.5231236Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:48:06.5363859Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 73.7 MB/s eta 0:00:00 2025-08-14T20:48:06.5401505Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:48:06.5462391Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:48:06.5561727Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 57.5 MB/s eta 0:00:00 2025-08-14T20:48:06.5601584Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:48:06.5641512Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 33.3 MB/s eta 0:00:00 2025-08-14T20:48:06.5674180Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:48:06.5720519Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 36.1 MB/s eta 0:00:00 2025-08-14T20:48:06.8548835Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:48:07.3832144Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:48:07.4655940Z ##[group]Run curr_branch="main" 2025-08-14T20:48:07.4656297Z curr_branch="main" 2025-08-14T20:48:07.4656519Z curr_ref_type="branch" 2025-08-14T20:48:07.4656791Z echo "Current branch is '$curr_branch'" 2025-08-14T20:48:07.4657043Z  2025-08-14T20:48:07.4657223Z python3 runner_determinator.py \ 2025-08-14T20:48:07.4657508Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:48:07.4657790Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:48:07.4658039Z  --github-branch "$curr_branch" \ 2025-08-14T20:48:07.4658301Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:48:07.4658577Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:48:07.4658856Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:48:07.4659118Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:48:07.4659413Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:48:07.4659769Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:48:07.4660052Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:48:07.4701457Z shell: /usr/bin/bash -e {0} 2025-08-14T20:48:07.4701686Z env: 2025-08-14T20:48:07.4702234Z GITHUB_TOKEN: *** 2025-08-14T20:48:07.4702432Z ISSUE_NUMBER: 5132 2025-08-14T20:48:07.4702641Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:48:07.4702873Z ISSUE_OWNER: 2025-08-14T20:48:07.4703057Z CHECK_EXPERIMENTS: 2025-08-14T20:48:07.4703251Z OPT_OUT_EXPERIMENTS: lf 2025-08-14T20:48:07.4703449Z PR_NUMBER: 2025-08-14T20:48:07.4703612Z ##[endgroup] 2025-08-14T20:48:07.4760971Z Current branch is 'main' 2025-08-14T20:48:08.8468073Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-08-14T20:48:08.8469956Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:48:08.8470956Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:48:08.8471501Z INFO : Setting output: label-type='' 2025-08-14T20:48:08.8780872Z Evaluate and set job outputs 2025-08-14T20:48:08.8788042Z Cleaning up orphan processes