2025-08-26T19:31:40.7462273Z Current runner version: '2.328.0' 2025-08-26T19:31:40.7488110Z ##[group]Runner Image Provisioner 2025-08-26T19:31:40.7488850Z Hosted Compute Agent 2025-08-26T19:31:40.7489371Z Version: 20250825.382 2025-08-26T19:31:40.7490017Z Commit: 7109f2abf901479dac39397456e363ac0cca0730 2025-08-26T19:31:40.7490685Z Build Date: 2025-08-25T22:55:50Z 2025-08-26T19:31:40.7491523Z ##[endgroup] 2025-08-26T19:31:40.7492159Z ##[group]Operating System 2025-08-26T19:31:40.7492706Z Ubuntu 2025-08-26T19:31:40.7493137Z 24.04.2 2025-08-26T19:31:40.7493641Z LTS 2025-08-26T19:31:40.7494050Z ##[endgroup] 2025-08-26T19:31:40.7494522Z ##[group]Runner Image 2025-08-26T19:31:40.7495079Z Image: ubuntu-24.04 2025-08-26T19:31:40.7495591Z Version: 20250818.1.0 2025-08-26T19:31:40.7496543Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250818.1/images/ubuntu/Ubuntu2404-Readme.md 2025-08-26T19:31:40.7498120Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250818.1 2025-08-26T19:31:40.7499091Z ##[endgroup] 2025-08-26T19:31:40.7500096Z ##[group]GITHUB_TOKEN Permissions 2025-08-26T19:31:40.7502555Z Contents: read 2025-08-26T19:31:40.7503163Z Metadata: read 2025-08-26T19:31:40.7503777Z ##[endgroup] 2025-08-26T19:31:40.7506599Z Secret source: Actions 2025-08-26T19:31:40.7507782Z Prepare workflow directory 2025-08-26T19:31:40.8029180Z Prepare all required actions 2025-08-26T19:31:40.8087126Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (262640fd220236042fbf4443cc163c8838c84c3d) 2025-08-26T19:31:40.8092854Z ##[group] Inputs 2025-08-26T19:31:40.8093436Z check_experiments: 2025-08-26T19:31:40.8093991Z opt_out_experiments: lf 2025-08-26T19:31:40.8094515Z triggering_actor: pytorchmergebot 2025-08-26T19:31:40.8095193Z issue_owner: 2025-08-26T19:31:40.8095724Z curr_branch: main 2025-08-26T19:31:40.8096181Z curr_ref_type: branch 2025-08-26T19:31:40.8096908Z issue_number: 5132 2025-08-26T19:31:40.8097393Z ##[endgroup] 2025-08-26T19:31:40.8097984Z Complete job name: get-label-type / runner-determinator 2025-08-26T19:31:41.3665508Z ##[group]Run cat < runner_determinator.py 2025-08-26T19:31:41.3668008Z cat < runner_determinator.py 2025-08-26T19:31:41.3668731Z # flake8: noqa: G004 2025-08-26T19:31:41.3669247Z  2025-08-26T19:31:41.3670120Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:41.3671472Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:41.3672461Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:41.3673280Z  2025-08-26T19:31:41.3673716Z """ 2025-08-26T19:31:41.3674469Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:41.3675604Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:41.3676831Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:41.3677923Z of which runners should be used to run which job. 2025-08-26T19:31:41.3678601Z  2025-08-26T19:31:41.3679346Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:41.3680432Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:41.3681766Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:41.3682620Z list, defined. 2025-08-26T19:31:41.3683197Z  2025-08-26T19:31:41.3683916Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:41.3684972Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:41.3686016Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:41.3686752Z  2025-08-26T19:31:41.3687781Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:41.3688888Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:41.3689792Z experiments which the user could be opted in to. 2025-08-26T19:31:41.3690493Z  2025-08-26T19:31:41.3691092Z The user list has the following rules: 2025-08-26T19:31:41.3691829Z  2025-08-26T19:31:41.3692518Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:41.3693541Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:41.3694554Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:41.3695215Z  2025-08-26T19:31:41.3695684Z Example config: 2025-08-26T19:31:41.3696346Z  # A list of experiments that can be opted into. 2025-08-26T19:31:41.3697216Z  # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:41.3697965Z  # Expected syntax is: 2025-08-26T19:31:41.3781426Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:41.3783544Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.3785144Z  2025-08-26T19:31:41.3785862Z  experiments: 2025-08-26T19:31:41.3786501Z  lf: 2025-08-26T19:31:41.3786952Z  rollout_percent: 25 2025-08-26T19:31:41.3787490Z  all_branches: false 2025-08-26T19:31:41.3788007Z  default: true 2025-08-26T19:31:41.3788478Z  --- 2025-08-26T19:31:41.3788870Z  2025-08-26T19:31:41.3789248Z  # Opt-ins: 2025-08-26T19:31:41.3789919Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.3791441Z  # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.3792422Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.3793164Z  # Experiments should be from the above list. 2025-08-26T19:31:41.3793741Z  2025-08-26T19:31:41.3794143Z  @User1,-lf,split_build 2025-08-26T19:31:41.3794648Z  @User2,lf 2025-08-26T19:31:41.3795096Z  @User3,split_build 2025-08-26T19:31:41.3795574Z """ 2025-08-26T19:31:41.3795953Z  2025-08-26T19:31:41.3796322Z import json 2025-08-26T19:31:41.3796741Z import logging 2025-08-26T19:31:41.3797172Z import os 2025-08-26T19:31:41.3797589Z import random 2025-08-26T19:31:41.3798008Z import re 2025-08-26T19:31:41.3798418Z import sys 2025-08-26T19:31:41.3798886Z from argparse import ArgumentParser 2025-08-26T19:31:41.3799542Z from collections.abc import Iterable 2025-08-26T19:31:41.3800132Z from functools import cache 2025-08-26T19:31:41.3800665Z from logging import LogRecord 2025-08-26T19:31:41.3801431Z from typing import Any, NamedTuple 2025-08-26T19:31:41.3802057Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.3802643Z  2025-08-26T19:31:41.3803022Z import yaml 2025-08-26T19:31:41.3803488Z from github import Auth, Github 2025-08-26T19:31:41.3804042Z from github.Issue import Issue 2025-08-26T19:31:41.3804550Z  2025-08-26T19:31:41.3804915Z  2025-08-26T19:31:41.3805365Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.3806118Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.3807091Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.3807847Z  2025-08-26T19:31:41.3808532Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.3809160Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.3809762Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.3810402Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.3811142Z  2025-08-26T19:31:41.3811586Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.3812126Z  2025-08-26T19:31:41.3812522Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.3813059Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.3813553Z  2025-08-26T19:31:41.3813912Z  2025-08-26T19:31:41.3814318Z class Experiment(NamedTuple): 2025-08-26T19:31:41.3814858Z  rollout_perc: float = ( 2025-08-26T19:31:41.3815600Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.3816332Z  ) 2025-08-26T19:31:41.3816748Z  all_branches: bool = ( 2025-08-26T19:31:41.3817479Z  False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.3818191Z  ) 2025-08-26T19:31:41.3818601Z  default: bool = ( 2025-08-26T19:31:41.3819257Z  True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.3819939Z  ) 2025-08-26T19:31:41.3820326Z  2025-08-26T19:31:41.3820716Z  # Add more fields as needed 2025-08-26T19:31:41.3821464Z  2025-08-26T19:31:41.3821833Z  2025-08-26T19:31:41.3822243Z class Settings(NamedTuple): 2025-08-26T19:31:41.3822749Z  """ 2025-08-26T19:31:41.3823282Z  Settings for the experiments that can be opted into. 2025-08-26T19:31:41.3823902Z  """ 2025-08-26T19:31:41.3824293Z  2025-08-26T19:31:41.3824725Z  experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.3825274Z  2025-08-26T19:31:41.3825847Z  2025-08-26T19:31:41.3826293Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.3826995Z  """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.3827628Z  2025-08-26T19:31:41.3828007Z  COLORS = { 2025-08-26T19:31:41.3828477Z  "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.3829044Z  "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.3829595Z  "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.3830147Z  "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.3830694Z  "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.3831499Z  } 2025-08-26T19:31:41.3831895Z  2025-08-26T19:31:41.3832353Z  def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.3833167Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.3834013Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.3834645Z  return super().format(record) 2025-08-26T19:31:41.3835177Z  2025-08-26T19:31:41.3835532Z  2025-08-26T19:31:41.3835948Z handler = logging.StreamHandler() 2025-08-26T19:31:41.3836746Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.3837509Z  2025-08-26T19:31:41.3837996Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.3838641Z log.addHandler(handler) 2025-08-26T19:31:41.3839161Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.3839694Z  2025-08-26T19:31:41.3840063Z  2025-08-26T19:31:41.3840553Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.3841535Z  """ 2025-08-26T19:31:41.3842105Z  Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.3842948Z  """ 2025-08-26T19:31:41.3843371Z  if not GITHUB_OUTPUT: 2025-08-26T19:31:41.3844524Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.3845729Z  log.warning( 2025-08-26T19:31:41.3846679Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.3847652Z  ) 2025-08-26T19:31:41.3848140Z  print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.3848730Z  return 2025-08-26T19:31:41.3849159Z  2025-08-26T19:31:41.3849575Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.3850206Z  log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.3850824Z  f.write(f"{key}={value}\n") 2025-08-26T19:31:41.3851541Z  2025-08-26T19:31:41.3851914Z  2025-08-26T19:31:41.3852465Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.3853168Z  return frozenset( 2025-08-26T19:31:41.3853865Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.3854586Z  ) 2025-08-26T19:31:41.3854984Z  2025-08-26T19:31:41.3855354Z  2025-08-26T19:31:41.3855745Z def parse_args() -> Any: 2025-08-26T19:31:41.3856406Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.3857343Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.3858169Z  parser.add_argument( 2025-08-26T19:31:41.3858703Z  "--github-issue-repo", 2025-08-26T19:31:41.3859235Z  type=str, 2025-08-26T19:31:41.3859711Z  required=False, 2025-08-26T19:31:41.3860375Z  default="pytorch/test-infra", 2025-08-26T19:31:41.3861203Z  help="GitHub repo to get the issue", 2025-08-26T19:31:41.3861776Z  ) 2025-08-26T19:31:41.3862203Z  parser.add_argument( 2025-08-26T19:31:41.3862727Z  "--github-repo", 2025-08-26T19:31:41.3863222Z  type=str, 2025-08-26T19:31:41.3863698Z  required=True, 2025-08-26T19:31:41.3864240Z  help="GitHub repo where CI is running", 2025-08-26T19:31:41.3864814Z  ) 2025-08-26T19:31:41.3865233Z  parser.add_argument( 2025-08-26T19:31:41.3865932Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.3866631Z  ) 2025-08-26T19:31:41.3867055Z  parser.add_argument( 2025-08-26T19:31:41.3867773Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.3868516Z  ) 2025-08-26T19:31:41.3868944Z  parser.add_argument( 2025-08-26T19:31:41.3869666Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.3870417Z  ) 2025-08-26T19:31:41.3871069Z  parser.add_argument( 2025-08-26T19:31:41.3871913Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.3872684Z  ) 2025-08-26T19:31:41.3873132Z  parser.add_argument( 2025-08-26T19:31:41.3873659Z  "--github-ref-type", 2025-08-26T19:31:41.3874176Z  type=str, 2025-08-26T19:31:41.3874654Z  required=True, 2025-08-26T19:31:41.3875243Z  help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.3875836Z  ) 2025-08-26T19:31:41.3876256Z  parser.add_argument( 2025-08-26T19:31:41.3876789Z  "--eligible-experiments", 2025-08-26T19:31:41.3877532Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.3878105Z  required=False, 2025-08-26T19:31:41.3878595Z  default="", 2025-08-26T19:31:41.3879538Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.3880509Z  ) 2025-08-26T19:31:41.3881099Z  parser.add_argument( 2025-08-26T19:31:41.3881644Z  "--opt-out-experiments", 2025-08-26T19:31:41.3882227Z  type=_str_comma_separated_to_set, 2025-08-26T19:31:41.3882795Z  required=False, 2025-08-26T19:31:41.3883288Z  default="", 2025-08-26T19:31:41.3883763Z  help=( 2025-08-26T19:31:41.3884510Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.3885722Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.3886605Z  ), 2025-08-26T19:31:41.3887021Z  ) 2025-08-26T19:31:41.3887445Z  parser.add_argument( 2025-08-26T19:31:41.3887951Z  "--pr-number", 2025-08-26T19:31:41.3888440Z  type=str, 2025-08-26T19:31:41.3888910Z  required=False, 2025-08-26T19:31:41.3889405Z  default="", 2025-08-26T19:31:41.3889964Z  help="the optional PR number where this is run", 2025-08-26T19:31:41.3890571Z  ) 2025-08-26T19:31:41.3891131Z  2025-08-26T19:31:41.3891554Z  return parser.parse_args() 2025-08-26T19:31:41.3892079Z  2025-08-26T19:31:41.3892444Z  2025-08-26T19:31:41.3893099Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.3894077Z  auth = Auth.Token(github_token) 2025-08-26T19:31:41.3894687Z  return Github(auth=auth) 2025-08-26T19:31:41.3895197Z  2025-08-26T19:31:41.3895566Z  2025-08-26T19:31:41.3896278Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.3897140Z  repo = gh.get_repo(repo) 2025-08-26T19:31:41.3897730Z  return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.3898298Z  2025-08-26T19:31:41.3898668Z  2025-08-26T19:31:41.3899068Z def get_potential_pr_author( 2025-08-26T19:31:41.3899805Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.3900552Z ) -> str: 2025-08-26T19:31:41.3901354Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.3902241Z  # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.3903080Z  # embedded in the tag name: ciflow// 2025-08-26T19:31:41.3903702Z  2025-08-26T19:31:41.3904127Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.3904662Z  2025-08-26T19:31:41.3905181Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.3905867Z  split_tag = ref_name.split("/") 2025-08-26T19:31:41.3906433Z  if ( 2025-08-26T19:31:41.3906885Z  len(split_tag) == 3 2025-08-26T19:31:41.3907447Z  and split_tag[0] == "ciflow" 2025-08-26T19:31:41.3908030Z  and split_tag[2].isnumeric() 2025-08-26T19:31:41.3908581Z  ): 2025-08-26T19:31:41.3909036Z  pr_number = split_tag[2] 2025-08-26T19:31:41.3909577Z  try: 2025-08-26T19:31:41.3910086Z  repository = gh.get_repo(repo) 2025-08-26T19:31:41.3911147Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.3911886Z  except Exception as e: 2025-08-26T19:31:41.3912497Z  raise Exception( # noqa: TRY002 2025-08-26T19:31:41.3913244Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.3913940Z  ) from e 2025-08-26T19:31:41.3914557Z  return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.3915330Z  # In all other cases, return the original input username 2025-08-26T19:31:41.3915971Z  return username 2025-08-26T19:31:41.3916434Z  2025-08-26T19:31:41.3916800Z  2025-08-26T19:31:41.3917265Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.3917845Z  """ 2025-08-26T19:31:41.3918564Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.3919402Z  """ 2025-08-26T19:31:41.3920005Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.3920721Z  2025-08-26T19:31:41.3921930Z  2025-08-26T19:31:41.3922390Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.3922952Z  try: 2025-08-26T19:31:41.3923401Z  data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.3923965Z  return data 2025-08-26T19:31:41.3924452Z  except yaml.YAMLError: 2025-08-26T19:31:41.3925028Z  log.exception("Error loading YAML") 2025-08-26T19:31:41.3925582Z  raise 2025-08-26T19:31:41.3926012Z  2025-08-26T19:31:41.3926382Z  2025-08-26T19:31:41.3927052Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.3927843Z  """ 2025-08-26T19:31:41.3928688Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.3929502Z  2025-08-26T19:31:41.3930094Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.3931096Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.3931710Z  2025-08-26T19:31:41.3932362Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.3933110Z  """ 2025-08-26T19:31:41.3933621Z  rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.3934271Z  if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.3935117Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.3935891Z  else: 2025-08-26T19:31:41.3936329Z  return "", rollout_state 2025-08-26T19:31:41.3936842Z  2025-08-26T19:31:41.3937220Z  2025-08-26T19:31:41.3937651Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.3938208Z  """ 2025-08-26T19:31:41.3938791Z  Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.3939513Z  """ 2025-08-26T19:31:41.3939898Z  2025-08-26T19:31:41.3940255Z  2025-08-26T19:31:41.3940826Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.3941642Z  """ 2025-08-26T19:31:41.3942421Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.3943291Z  2025-08-26T19:31:41.3944145Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.3945192Z  - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.3946081Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.3946761Z  2025-08-26T19:31:41.3947115Z  2025-08-26T19:31:41.3947482Z  """ 2025-08-26T19:31:41.3947892Z  optins = UserOptins() 2025-08-26T19:31:41.3948452Z  for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.3949061Z  user = user.strip("\r\n\t -") 2025-08-26T19:31:41.3949665Z  if not user or not user.startswith("@"): 2025-08-26T19:31:41.3950263Z  # Not a valid user. Skip 2025-08-26T19:31:41.3950797Z  continue 2025-08-26T19:31:41.3951461Z  2025-08-26T19:31:41.3951860Z  if user: 2025-08-26T19:31:41.3952372Z  usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.3953111Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.3953801Z  2025-08-26T19:31:41.3954181Z  return optins 2025-08-26T19:31:41.3954632Z  2025-08-26T19:31:41.3954987Z  2025-08-26T19:31:41.3955523Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.3956180Z  """ 2025-08-26T19:31:41.3956637Z  Check if the experiment name is valid. 2025-08-26T19:31:41.3957207Z  A valid name: 2025-08-26T19:31:41.3957919Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.3958914Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.3959661Z  - Cannot contain spaces 2025-08-26T19:31:41.3960171Z  """ 2025-08-26T19:31:41.3960556Z  2025-08-26T19:31:41.3961148Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.3961920Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.3962743Z  2025-08-26T19:31:41.3963347Z  if valid: 2025-08-26T19:31:41.3963790Z  return True 2025-08-26T19:31:41.3964244Z  2025-08-26T19:31:41.3964612Z  log.error( 2025-08-26T19:31:41.3966146Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:41.3967761Z  ) 2025-08-26T19:31:41.3968163Z  return False 2025-08-26T19:31:41.3968621Z  2025-08-26T19:31:41.3968975Z  2025-08-26T19:31:41.3969529Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.3970211Z  """ 2025-08-26T19:31:41.3970956Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.3971731Z  """ 2025-08-26T19:31:41.3972126Z  try: 2025-08-26T19:31:41.3972539Z  if settings_text: 2025-08-26T19:31:41.3973327Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.3974168Z  # for easy reading 2025-08-26T19:31:41.3975039Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.3975977Z  # the backtick character in shell commands. 2025-08-26T19:31:41.3976635Z  backtick = chr(96) # backtick character 2025-08-26T19:31:41.3977365Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.3978082Z  settings = load_yaml(settings_text) 2025-08-26T19:31:41.3978630Z  2025-08-26T19:31:41.3979260Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.3980186Z  experiments = {} 2025-08-26T19:31:41.3980679Z  2025-08-26T19:31:41.3981384Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.3982199Z  if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.3983365Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:41.3984485Z  continue 2025-08-26T19:31:41.3984977Z  2025-08-26T19:31:41.3985388Z  valid_settings = {} 2025-08-26T19:31:41.3985961Z  for setting in exp_settings: 2025-08-26T19:31:41.3986591Z  if setting not in Experiment._fields: 2025-08-26T19:31:41.3987206Z  log.warning( 2025-08-26T19:31:41.3988011Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.3988766Z  ) 2025-08-26T19:31:41.3989255Z  else: 2025-08-26T19:31:41.3989847Z  valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.3990459Z  2025-08-26T19:31:41.3991101Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.3991798Z  return Settings(experiments) 2025-08-26T19:31:41.3992345Z  2025-08-26T19:31:41.3992739Z  except Exception: 2025-08-26T19:31:41.3993296Z  log.exception("Failed to parse settings") 2025-08-26T19:31:41.3993886Z  2025-08-26T19:31:41.3994271Z  return Settings() 2025-08-26T19:31:41.3994735Z  2025-08-26T19:31:41.3995094Z  2025-08-26T19:31:41.3995729Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.3996362Z  """ 2025-08-26T19:31:41.3996864Z  Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.3997464Z  2025-08-26T19:31:41.3998041Z  If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.3998859Z  and the text below is the list of opted in users. 2025-08-26T19:31:41.3999448Z  2025-08-26T19:31:41.4000094Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.4001003Z  """ 2025-08-26T19:31:41.4001630Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.4002462Z  return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.4003044Z  2025-08-26T19:31:41.4003412Z  2025-08-26T19:31:41.4003911Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.4004526Z  """ 2025-08-26T19:31:41.4004966Z  Parse users from the rollout state. 2025-08-26T19:31:41.4005513Z  2025-08-26T19:31:41.4005874Z  """ 2025-08-26T19:31:41.4006471Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.4007280Z  return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.4007864Z  2025-08-26T19:31:41.4008224Z  2025-08-26T19:31:41.4008886Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.4009679Z  """ 2025-08-26T19:31:41.4010160Z  Check if a user is opted into an experiment 2025-08-26T19:31:41.4010726Z  """ 2025-08-26T19:31:41.4011339Z  return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.4011953Z  2025-08-26T19:31:41.4012459Z  2025-08-26T19:31:41.4013129Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.4013932Z  """ 2025-08-26T19:31:41.4014450Z  Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.4015072Z  """ 2025-08-26T19:31:41.4015632Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.4016384Z  experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.4017083Z  if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.4017732Z  return False 2025-08-26T19:31:41.4018193Z  2025-08-26T19:31:41.4018691Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.4019337Z  log.warning( 2025-08-26T19:31:41.4020236Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.4021255Z  ) 2025-08-26T19:31:41.4021666Z  2025-08-26T19:31:41.4022038Z  return True 2025-08-26T19:31:41.4022477Z  2025-08-26T19:31:41.4022836Z  2025-08-26T19:31:41.4023223Z def get_runner_prefix( 2025-08-26T19:31:41.4023715Z  rollout_state: str, 2025-08-26T19:31:41.4024258Z  workflow_requestors: Iterable[str], 2025-08-26T19:31:41.4024822Z  branch: str, 2025-08-26T19:31:41.4025392Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.4026128Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.4026758Z  is_canary: bool = False, 2025-08-26T19:31:41.4027271Z ) -> str: 2025-08-26T19:31:41.4027761Z  settings = parse_settings(rollout_state) 2025-08-26T19:31:41.4028399Z  user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.4028972Z  2025-08-26T19:31:41.4029473Z  fleet_prefix = "" 2025-08-26T19:31:41.4029977Z  prefixes = [] 2025-08-26T19:31:41.4030700Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.4031822Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.4032582Z  log.info( 2025-08-26T19:31:41.4033333Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.4034125Z  ) 2025-08-26T19:31:41.4034575Z  continue 2025-08-26T19:31:41.4035037Z  2025-08-26T19:31:41.4035436Z  if opt_out_experiments: 2025-08-26T19:31:41.4036041Z  if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.4036746Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.4037401Z  log.info( 2025-08-26T19:31:41.4038435Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.4039486Z  ) 2025-08-26T19:31:41.4039946Z  continue 2025-08-26T19:31:41.4040418Z  2025-08-26T19:31:41.4040921Z  if eligible_experiments: 2025-08-26T19:31:41.4041558Z  if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.4042248Z  exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.4042848Z  log.info( 2025-08-26T19:31:41.4043706Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.4044593Z  ) 2025-08-26T19:31:41.4045047Z  continue 2025-08-26T19:31:41.4045739Z  elif not experiment_settings.default: 2025-08-26T19:31:41.4046316Z  log.info( 2025-08-26T19:31:41.4047057Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.4047837Z  ) 2025-08-26T19:31:41.4048268Z  continue 2025-08-26T19:31:41.4048721Z  2025-08-26T19:31:41.4049219Z  # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.4049888Z  opted_out_users = [ 2025-08-26T19:31:41.4050402Z  requestor 2025-08-26T19:31:41.4051030Z  for requestor in workflow_requestors 2025-08-26T19:31:41.4051769Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.4052436Z  ] 2025-08-26T19:31:41.4052841Z  2025-08-26T19:31:41.4053227Z  if opted_out_users: 2025-08-26T19:31:41.4053767Z  log.info( 2025-08-26T19:31:41.4054465Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.4055204Z  ) 2025-08-26T19:31:41.4055647Z  continue 2025-08-26T19:31:41.4056099Z  2025-08-26T19:31:41.4056604Z  # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.4057263Z  opted_in_users = [ 2025-08-26T19:31:41.4057785Z  requestor 2025-08-26T19:31:41.4058305Z  for requestor in workflow_requestors 2025-08-26T19:31:41.4059040Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.4059707Z  ] 2025-08-26T19:31:41.4060106Z  2025-08-26T19:31:41.4060498Z  enabled = False 2025-08-26T19:31:41.4061092Z  if opted_in_users: 2025-08-26T19:31:41.4061752Z  log.info( 2025-08-26T19:31:41.4062446Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.4063166Z  ) 2025-08-26T19:31:41.4063608Z  enabled = True 2025-08-26T19:31:41.4064092Z  2025-08-26T19:31:41.4064535Z  elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.4065417Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.4066418Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.4067117Z  log.info( 2025-08-26T19:31:41.4068060Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.4069018Z  ) 2025-08-26T19:31:41.4069499Z  enabled = True 2025-08-26T19:31:41.4070001Z  2025-08-26T19:31:41.4070379Z  if enabled: 2025-08-26T19:31:41.4070978Z  label = experiment_name 2025-08-26T19:31:41.4071595Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.4072485Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.4073415Z  # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.4074230Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.4074938Z  if is_canary: 2025-08-26T19:31:41.4075495Z  label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.4076086Z  fleet_prefix = label 2025-08-26T19:31:41.4076627Z  else: 2025-08-26T19:31:41.4077250Z  prefixes.append(label) 2025-08-26T19:31:41.4077789Z  2025-08-26T19:31:41.4078175Z  if len(prefixes) > 1: 2025-08-26T19:31:41.4078681Z  log.error( 2025-08-26T19:31:41.4079786Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:41.4081044Z  ) 2025-08-26T19:31:41.4081493Z  prefixes = prefixes[:1] 2025-08-26T19:31:41.4082000Z  2025-08-26T19:31:41.4082401Z  # Fleet always comes first 2025-08-26T19:31:41.4082925Z  if fleet_prefix: 2025-08-26T19:31:41.4083437Z  prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.4083975Z  2025-08-26T19:31:41.4084454Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.4085056Z  2025-08-26T19:31:41.4085427Z  2025-08-26T19:31:41.4086113Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.4086916Z  """ 2025-08-26T19:31:41.4087554Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.4088284Z  2025-08-26T19:31:41.4088901Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.4089647Z  """ 2025-08-26T19:31:41.4090092Z  gh = get_gh_client(github_token) 2025-08-26T19:31:41.4090697Z  issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.4091498Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.4092135Z  2025-08-26T19:31:41.4092492Z  2025-08-26T19:31:41.4093133Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.4094061Z  for _ in range(num_retries): 2025-08-26T19:31:41.4094594Z  try: 2025-08-26T19:31:41.4095176Z  req = Request(url=url, headers=headers) 2025-08-26T19:31:41.4095931Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.4096634Z  return json.loads(content) 2025-08-26T19:31:41.4097204Z  except Exception as e: 2025-08-26T19:31:41.4097813Z  log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.4098394Z  2025-08-26T19:31:41.4099012Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.4099775Z  return {} 2025-08-26T19:31:41.4100204Z  2025-08-26T19:31:41.4100567Z  2025-08-26T19:31:41.4101068Z @cache 2025-08-26T19:31:41.4101775Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.4102596Z  """ 2025-08-26T19:31:41.4103052Z  Dynamically get PR information 2025-08-26T19:31:41.4103579Z  """ 2025-08-26T19:31:41.4104154Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.4104825Z  headers = { 2025-08-26T19:31:41.4105347Z  "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.4106008Z  "Authorization": f"token {github_token}", 2025-08-26T19:31:41.4106569Z  } 2025-08-26T19:31:41.4107058Z  json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.4107714Z  url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.4108301Z  headers=headers, 2025-08-26T19:31:41.4108782Z  ) 2025-08-26T19:31:41.4109166Z  2025-08-26T19:31:41.4109573Z  if not json_response: 2025-08-26T19:31:41.4110218Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.4111150Z  return {} 2025-08-26T19:31:41.4111602Z  2025-08-26T19:31:41.4111996Z  return json_response 2025-08-26T19:31:41.4112479Z  2025-08-26T19:31:41.4112846Z  2025-08-26T19:31:41.4113474Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.4114247Z  """ 2025-08-26T19:31:41.4114835Z  Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.4115524Z  """ 2025-08-26T19:31:41.4116074Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.4116727Z  return { 2025-08-26T19:31:41.4117374Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.4118102Z  } 2025-08-26T19:31:41.4118487Z  2025-08-26T19:31:41.4118856Z  2025-08-26T19:31:41.4119249Z def main() -> None: 2025-08-26T19:31:41.4119734Z  args = parse_args() 2025-08-26T19:31:41.4120206Z  2025-08-26T19:31:41.4120669Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.4121340Z  2025-08-26T19:31:41.4121748Z  # Check if the PR is opt-out 2025-08-26T19:31:41.4122290Z  if args.pr_number: 2025-08-26T19:31:41.4123023Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.4123829Z  if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.4124368Z  log.info( 2025-08-26T19:31:41.4125137Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.4125934Z  ) 2025-08-26T19:31:41.4126556Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.4127288Z  sys.exit() 2025-08-26T19:31:41.4127875Z  2025-08-26T19:31:41.4128256Z  try: 2025-08-26T19:31:41.4128750Z  rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.4129524Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.4130195Z  ) 2025-08-26T19:31:41.4130600Z  2025-08-26T19:31:41.4131126Z  username = get_potential_pr_author( 2025-08-26T19:31:41.4131708Z  args.github_token, 2025-08-26T19:31:41.4132252Z  args.github_repo, 2025-08-26T19:31:41.4132783Z  args.github_actor, 2025-08-26T19:31:41.4133344Z  args.github_ref_type, 2025-08-26T19:31:41.4133888Z  args.github_branch, 2025-08-26T19:31:41.4134399Z  ) 2025-08-26T19:31:41.4134797Z  2025-08-26T19:31:41.4135325Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.4135973Z  2025-08-26T19:31:41.4136413Z  runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.4137009Z  rollout_state, 2025-08-26T19:31:41.4137566Z  (args.github_issue_owner, username), 2025-08-26T19:31:41.4138159Z  args.github_branch, 2025-08-26T19:31:41.4138717Z  args.eligible_experiments, 2025-08-26T19:31:41.4139309Z  args.opt_out_experiments, 2025-08-26T19:31:41.4139892Z  is_canary, 2025-08-26T19:31:41.4140364Z  ) 2025-08-26T19:31:41.4140772Z  2025-08-26T19:31:41.4141263Z  except Exception as e: 2025-08-26T19:31:41.4141778Z  log.error( 2025-08-26T19:31:41.4142531Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.4143333Z  ) 2025-08-26T19:31:41.4143883Z  2025-08-26T19:31:41.4144465Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.4145166Z  2025-08-26T19:31:41.4145529Z  2025-08-26T19:31:41.4145921Z if __name__ == "__main__": 2025-08-26T19:31:41.4146413Z  main() 2025-08-26T19:31:41.4146825Z  2025-08-26T19:31:41.4147189Z EOF 2025-08-26T19:31:41.4147572Z  2025-08-26T19:31:41.4147971Z cat runner_determinator.py 2025-08-26T19:31:41.4460228Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.4461341Z env: 2025-08-26T19:31:41.4462130Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.4462572Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.4463016Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.4463524Z ISSUE_OWNER: 2025-08-26T19:31:41.4463927Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.4464353Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:41.4464789Z PR_NUMBER: 2025-08-26T19:31:41.4465193Z ##[endgroup] 2025-08-26T19:31:41.4686743Z # flake8: noqa: G004 2025-08-26T19:31:41.4687108Z 2025-08-26T19:31:41.4687540Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-26T19:31:41.4688519Z # must be kept in sync. You can do it easily by running the following command: 2025-08-26T19:31:41.4689307Z # python .github/scripts/update_runner_determinator.py 2025-08-26T19:31:41.4689757Z 2025-08-26T19:31:41.4689912Z """ 2025-08-26T19:31:41.4690484Z This runner determinator is used to determine which set of runners to run a 2025-08-26T19:31:41.4691642Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-26T19:31:41.4692555Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-26T19:31:41.4693364Z of which runners should be used to run which job. 2025-08-26T19:31:41.4693767Z 2025-08-26T19:31:41.4694148Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-26T19:31:41.4695277Z separated by a line containing "---". If the line is not present, the 2025-08-26T19:31:41.4696666Z settings are considered to be empty with only the second part, the user 2025-08-26T19:31:41.4697434Z list, defined. 2025-08-26T19:31:41.4697693Z 2025-08-26T19:31:41.4698071Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-26T19:31:41.4699077Z used to define any settings that are needed to determine which runners to use. 2025-08-26T19:31:41.4699911Z It's fields are defined by the RolloutSettings class below. 2025-08-26T19:31:41.4700361Z 2025-08-26T19:31:41.4700728Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-26T19:31:41.4701984Z The user list is also a comma separated list of additional features or 2025-08-26T19:31:41.4702733Z experiments which the user could be opted in to. 2025-08-26T19:31:41.4703139Z 2025-08-26T19:31:41.4703344Z The user list has the following rules: 2025-08-26T19:31:41.4703686Z 2025-08-26T19:31:41.4704021Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-26T19:31:41.4704903Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-26T19:31:41.4705663Z - A "#" prefix opts the user out of all experiments 2025-08-26T19:31:41.4706062Z 2025-08-26T19:31:41.4706230Z Example config: 2025-08-26T19:31:41.4706684Z # A list of experiments that can be opted into. 2025-08-26T19:31:41.4707355Z # This defines the behavior they'll induce when opted into. 2025-08-26T19:31:41.4707980Z # Expected syntax is: 2025-08-26T19:31:41.4708614Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-26T19:31:41.4709592Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-26T19:31:41.4710204Z 2025-08-26T19:31:41.4710384Z experiments: 2025-08-26T19:31:41.4710769Z lf: 2025-08-26T19:31:41.4711499Z rollout_percent: 25 2025-08-26T19:31:41.4712032Z all_branches: false 2025-08-26T19:31:41.4712723Z default: true 2025-08-26T19:31:41.4713123Z --- 2025-08-26T19:31:41.4713329Z 2025-08-26T19:31:41.4713494Z # Opt-ins: 2025-08-26T19:31:41.4714068Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-26T19:31:41.4714940Z # and specifying experiments to enable in a comma-separated list. 2025-08-26T19:31:41.4715720Z # To always opt out of an experiment, prefix it with a "-". 2025-08-26T19:31:41.4716376Z # Experiments should be from the above list. 2025-08-26T19:31:41.4716760Z 2025-08-26T19:31:41.4716944Z @User1,-lf,split_build 2025-08-26T19:31:41.4717376Z @User2,lf 2025-08-26T19:31:41.4717754Z @User3,split_build 2025-08-26T19:31:41.4718150Z """ 2025-08-26T19:31:41.4718350Z 2025-08-26T19:31:41.4718511Z import json 2025-08-26T19:31:41.4718875Z import logging 2025-08-26T19:31:41.4719260Z import os 2025-08-26T19:31:41.4719623Z import random 2025-08-26T19:31:41.4720078Z import re 2025-08-26T19:31:41.4720555Z import sys 2025-08-26T19:31:41.4721230Z from argparse import ArgumentParser 2025-08-26T19:31:41.4721799Z from collections.abc import Iterable 2025-08-26T19:31:41.4722315Z from functools import cache 2025-08-26T19:31:41.4722790Z from logging import LogRecord 2025-08-26T19:31:41.4723285Z from typing import Any, NamedTuple 2025-08-26T19:31:41.4723813Z from urllib.request import Request, urlopen 2025-08-26T19:31:41.4724183Z 2025-08-26T19:31:41.4724353Z import yaml 2025-08-26T19:31:41.4724783Z from github import Auth, Github 2025-08-26T19:31:41.4725313Z from github.Issue import Issue 2025-08-26T19:31:41.4725642Z 2025-08-26T19:31:41.4725650Z 2025-08-26T19:31:41.4725890Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-26T19:31:41.4726631Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-26T19:31:41.4727546Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-26T19:31:41.4728137Z 2025-08-26T19:31:41.4728385Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-26T19:31:41.4729136Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-26T19:31:41.4729663Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-26T19:31:41.4730214Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-26T19:31:41.4730564Z 2025-08-26T19:31:41.4730752Z SETTING_EXPERIMENTS = "experiments" 2025-08-26T19:31:41.4731331Z 2025-08-26T19:31:41.4731525Z LF_FLEET_EXPERIMENT = "lf" 2025-08-26T19:31:41.4731985Z CANARY_FLEET_SUFFIX = ".c" 2025-08-26T19:31:41.4732272Z 2025-08-26T19:31:41.4732279Z 2025-08-26T19:31:41.4732461Z class Experiment(NamedTuple): 2025-08-26T19:31:41.4732947Z rollout_perc: float = ( 2025-08-26T19:31:41.4733576Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-26T19:31:41.4734256Z ) 2025-08-26T19:31:41.4734620Z all_branches: bool = ( 2025-08-26T19:31:41.4735243Z False # If True, the experiment is also enabled on the exception branches 2025-08-26T19:31:41.4735910Z ) 2025-08-26T19:31:41.4736276Z default: bool = ( 2025-08-26T19:31:41.4736841Z True # If True, the experiment is enabled by default for all queries 2025-08-26T19:31:41.4737477Z ) 2025-08-26T19:31:41.4737668Z 2025-08-26T19:31:41.4737851Z # Add more fields as needed 2025-08-26T19:31:41.4738150Z 2025-08-26T19:31:41.4738157Z 2025-08-26T19:31:41.4738338Z class Settings(NamedTuple): 2025-08-26T19:31:41.4738779Z """ 2025-08-26T19:31:41.4739222Z Settings for the experiments that can be opted into. 2025-08-26T19:31:41.4739803Z """ 2025-08-26T19:31:41.4739995Z 2025-08-26T19:31:41.4740197Z experiments: dict[str, Experiment] = {} 2025-08-26T19:31:41.4740564Z 2025-08-26T19:31:41.4740571Z 2025-08-26T19:31:41.4740773Z class ColorFormatter(logging.Formatter): 2025-08-26T19:31:41.4741696Z """Color codes the log messages based on the log level""" 2025-08-26T19:31:41.4742141Z 2025-08-26T19:31:41.4742300Z COLORS = { 2025-08-26T19:31:41.4742701Z "WARNING": "\033[33m", # Yellow 2025-08-26T19:31:41.4743376Z "ERROR": "\033[31m", # Red 2025-08-26T19:31:41.4743870Z "CRITICAL": "\033[31m", # Red 2025-08-26T19:31:41.4744380Z "INFO": "\033[0m", # Reset 2025-08-26T19:31:41.4744868Z "DEBUG": "\033[0m", # Reset 2025-08-26T19:31:41.4745334Z } 2025-08-26T19:31:41.4745527Z 2025-08-26T19:31:41.4745745Z def format(self, record: LogRecord) -> str: 2025-08-26T19:31:41.4746492Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-26T19:31:41.4747268Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-26T19:31:41.4747847Z return super().format(record) 2025-08-26T19:31:41.4748181Z 2025-08-26T19:31:41.4748188Z 2025-08-26T19:31:41.4748378Z handler = logging.StreamHandler() 2025-08-26T19:31:41.4749080Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-26T19:31:41.4749641Z 2025-08-26T19:31:41.4749893Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-26T19:31:41.4750470Z log.addHandler(handler) 2025-08-26T19:31:41.4751153Z log.setLevel(logging.INFO) 2025-08-26T19:31:41.4751454Z 2025-08-26T19:31:41.4751461Z 2025-08-26T19:31:41.4751709Z def set_github_output(key: str, value: str) -> None: 2025-08-26T19:31:41.4752265Z """ 2025-08-26T19:31:41.4752755Z Defines outputs of the github action that invokes this script 2025-08-26T19:31:41.4753392Z """ 2025-08-26T19:31:41.4753784Z if not GITHUB_OUTPUT: 2025-08-26T19:31:41.4754903Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-26T19:31:41.4756086Z log.warning( 2025-08-26T19:31:41.4756984Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-26T19:31:41.4757968Z ) 2025-08-26T19:31:41.4769851Z print(f"::set-output name={key}::{value}") 2025-08-26T19:31:41.4770487Z return 2025-08-26T19:31:41.4770722Z 2025-08-26T19:31:41.4771426Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-26T19:31:41.4772068Z log.info(f"Setting output: {key}='{value}'") 2025-08-26T19:31:41.4772649Z f.write(f"{key}={value}\n") 2025-08-26T19:31:41.4772978Z 2025-08-26T19:31:41.4772985Z 2025-08-26T19:31:41.4773284Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-26T19:31:41.4773923Z return frozenset( 2025-08-26T19:31:41.4774524Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-26T19:31:41.4775216Z ) 2025-08-26T19:31:41.4775407Z 2025-08-26T19:31:41.4775415Z 2025-08-26T19:31:41.4775600Z def parse_args() -> Any: 2025-08-26T19:31:41.4776156Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-26T19:31:41.4777028Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-26T19:31:41.4777799Z parser.add_argument( 2025-08-26T19:31:41.4778252Z "--github-issue-repo", 2025-08-26T19:31:41.4778708Z type=str, 2025-08-26T19:31:41.4779122Z required=False, 2025-08-26T19:31:41.4779566Z default="pytorch/test-infra", 2025-08-26T19:31:41.4780098Z help="GitHub repo to get the issue", 2025-08-26T19:31:41.4780604Z ) 2025-08-26T19:31:41.4781257Z parser.add_argument( 2025-08-26T19:31:41.4781760Z "--github-repo", 2025-08-26T19:31:41.4782191Z type=str, 2025-08-26T19:31:41.4782590Z required=True, 2025-08-26T19:31:41.4783047Z help="GitHub repo where CI is running", 2025-08-26T19:31:41.4835658Z ) 2025-08-26T19:31:41.4836554Z parser.add_argument( 2025-08-26T19:31:41.4837712Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-26T19:31:41.4838616Z ) 2025-08-26T19:31:41.4838998Z parser.add_argument( 2025-08-26T19:31:41.4839623Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-26T19:31:41.4840301Z ) 2025-08-26T19:31:41.4840673Z parser.add_argument( 2025-08-26T19:31:41.4841879Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-26T19:31:41.4842589Z ) 2025-08-26T19:31:41.4842951Z parser.add_argument( 2025-08-26T19:31:41.4843602Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-26T19:31:41.4844319Z ) 2025-08-26T19:31:41.4844694Z parser.add_argument( 2025-08-26T19:31:41.4845135Z "--github-ref-type", 2025-08-26T19:31:41.4845578Z type=str, 2025-08-26T19:31:41.4845958Z required=True, 2025-08-26T19:31:41.4846433Z help="Current GitHub ref type, branch or tag", 2025-08-26T19:31:41.4846971Z ) 2025-08-26T19:31:41.4847327Z parser.add_argument( 2025-08-26T19:31:41.4847775Z "--eligible-experiments", 2025-08-26T19:31:41.4848279Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.4848796Z required=False, 2025-08-26T19:31:41.4849197Z default="", 2025-08-26T19:31:41.4850042Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-26T19:31:41.4851157Z ) 2025-08-26T19:31:41.4851530Z parser.add_argument( 2025-08-26T19:31:41.4851978Z "--opt-out-experiments", 2025-08-26T19:31:41.4852475Z type=_str_comma_separated_to_set, 2025-08-26T19:31:41.4852985Z required=False, 2025-08-26T19:31:41.4853404Z default="", 2025-08-26T19:31:41.4853788Z help=( 2025-08-26T19:31:41.4854441Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-26T19:31:41.4855567Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-26T19:31:41.4856389Z ), 2025-08-26T19:31:41.4856736Z ) 2025-08-26T19:31:41.4857092Z parser.add_argument( 2025-08-26T19:31:41.4857523Z "--pr-number", 2025-08-26T19:31:41.4857928Z type=str, 2025-08-26T19:31:41.4858320Z required=False, 2025-08-26T19:31:41.4858733Z default="", 2025-08-26T19:31:41.4859381Z help="the optional PR number where this is run", 2025-08-26T19:31:41.4859946Z ) 2025-08-26T19:31:41.4860142Z 2025-08-26T19:31:41.4860331Z return parser.parse_args() 2025-08-26T19:31:41.4860638Z 2025-08-26T19:31:41.4860645Z 2025-08-26T19:31:41.4861325Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.4862106Z auth = Auth.Token(github_token) 2025-08-26T19:31:41.4862615Z return Github(auth=auth) 2025-08-26T19:31:41.4862908Z 2025-08-26T19:31:41.4862914Z 2025-08-26T19:31:41.4863368Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-26T19:31:41.4864155Z repo = gh.get_repo(repo) 2025-08-26T19:31:41.4864655Z return repo.get_issue(number=issue_num) 2025-08-26T19:31:41.4865014Z 2025-08-26T19:31:41.4865021Z 2025-08-26T19:31:41.4865211Z def get_potential_pr_author( 2025-08-26T19:31:41.4865863Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-26T19:31:41.4866531Z ) -> str: 2025-08-26T19:31:41.4867036Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-26T19:31:41.4867827Z # Fetch the actual username from the original PR. The PR number is 2025-08-26T19:31:41.4868554Z # embedded in the tag name: ciflow// 2025-08-26T19:31:41.4868966Z 2025-08-26T19:31:41.4869151Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.4869475Z 2025-08-26T19:31:41.4869733Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-26T19:31:41.4870344Z split_tag = ref_name.split("/") 2025-08-26T19:31:41.4870826Z if ( 2025-08-26T19:31:41.4871410Z len(split_tag) == 3 2025-08-26T19:31:41.4871880Z and split_tag[0] == "ciflow" 2025-08-26T19:31:41.4872391Z and split_tag[2].isnumeric() 2025-08-26T19:31:41.4872869Z ): 2025-08-26T19:31:41.4873240Z pr_number = split_tag[2] 2025-08-26T19:31:41.4873891Z try: 2025-08-26T19:31:41.4874304Z repository = gh.get_repo(repo) 2025-08-26T19:31:41.4874907Z pull = repository.get_pull(number=int(pr_number)) 2025-08-26T19:31:41.4875492Z except Exception as e: 2025-08-26T19:31:41.4875997Z raise Exception( # noqa: TRY002 2025-08-26T19:31:41.4876653Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-26T19:31:41.4877288Z ) from e 2025-08-26T19:31:41.4877814Z return pull.user.login # type: ignore[no-any-return] 2025-08-26T19:31:41.4878486Z # In all other cases, return the original input username 2025-08-26T19:31:41.4879065Z return username 2025-08-26T19:31:41.4879303Z 2025-08-26T19:31:41.4879309Z 2025-08-26T19:31:41.4879525Z def is_exception_branch(branch: str) -> bool: 2025-08-26T19:31:41.4880047Z """ 2025-08-26T19:31:41.4880672Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-26T19:31:41.4881777Z """ 2025-08-26T19:31:41.4882328Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-26T19:31:41.4882846Z 2025-08-26T19:31:41.4882853Z 2025-08-26T19:31:41.4883047Z def load_yaml(yaml_text: str) -> Any: 2025-08-26T19:31:41.4883531Z try: 2025-08-26T19:31:41.4883908Z data = yaml.safe_load(yaml_text) 2025-08-26T19:31:41.4884410Z return data 2025-08-26T19:31:41.4884815Z except yaml.YAMLError: 2025-08-26T19:31:41.4885287Z log.exception("Error loading YAML") 2025-08-26T19:31:41.4885784Z raise 2025-08-26T19:31:41.4886004Z 2025-08-26T19:31:41.4886009Z 2025-08-26T19:31:41.4886425Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-26T19:31:41.4887161Z """ 2025-08-26T19:31:41.4887763Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-26T19:31:41.4888363Z 2025-08-26T19:31:41.4888848Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.4889681Z and the text below is the list of opted in users. 2025-08-26T19:31:41.4890164Z 2025-08-26T19:31:41.4890532Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-26T19:31:41.4891423Z """ 2025-08-26T19:31:41.4891986Z rollout_state_parts = rollout_state.split("---") 2025-08-26T19:31:41.4892728Z if len(rollout_state_parts) >= 2: 2025-08-26T19:31:41.4893327Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-26T19:31:41.4893911Z else: 2025-08-26T19:31:41.4894282Z return "", rollout_state 2025-08-26T19:31:41.4894588Z 2025-08-26T19:31:41.4894596Z 2025-08-26T19:31:41.4894794Z class UserOptins(dict[str, list[str]]): 2025-08-26T19:31:41.4895292Z """ 2025-08-26T19:31:41.4895801Z Dictionary of users with a list of features they have opted into 2025-08-26T19:31:41.4896439Z """ 2025-08-26T19:31:41.4896629Z 2025-08-26T19:31:41.4896649Z 2025-08-26T19:31:41.4896984Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-26T19:31:41.4897632Z """ 2025-08-26T19:31:41.4898330Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-26T19:31:41.4899020Z 2025-08-26T19:31:41.4899632Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-26T19:31:41.4900618Z - Example line: "@User1,lf,split_build" 2025-08-26T19:31:41.4901505Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-26T19:31:41.4901991Z 2025-08-26T19:31:41.4901999Z 2025-08-26T19:31:41.4902160Z """ 2025-08-26T19:31:41.4902521Z optins = UserOptins() 2025-08-26T19:31:41.4902999Z for user in user_optin_text.split("\n"): 2025-08-26T19:31:41.4903534Z user = user.strip("\r\n\t -") 2025-08-26T19:31:41.4904064Z if not user or not user.startswith("@"): 2025-08-26T19:31:41.4904779Z # Not a valid user. Skip 2025-08-26T19:31:41.4905251Z continue 2025-08-26T19:31:41.4905495Z 2025-08-26T19:31:41.4905660Z if user: 2025-08-26T19:31:41.4906084Z usr_name = user.split(",")[0].strip("@") 2025-08-26T19:31:41.4906761Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-26T19:31:41.4907253Z 2025-08-26T19:31:41.4907416Z return optins 2025-08-26T19:31:41.4907654Z 2025-08-26T19:31:41.4907660Z 2025-08-26T19:31:41.4907934Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-26T19:31:41.4908531Z """ 2025-08-26T19:31:41.4908911Z Check if the experiment name is valid. 2025-08-26T19:31:41.4909419Z A valid name: 2025-08-26T19:31:41.4910034Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-26T19:31:41.4911603Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-26T19:31:41.4912366Z - Cannot contain spaces 2025-08-26T19:31:41.4912826Z """ 2025-08-26T19:31:41.4913025Z 2025-08-26T19:31:41.4913289Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-26T19:31:41.4913981Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-26T19:31:41.4914424Z 2025-08-26T19:31:41.4914588Z if valid: 2025-08-26T19:31:41.4914956Z return True 2025-08-26T19:31:41.4915194Z 2025-08-26T19:31:41.4915363Z log.error( 2025-08-26T19:31:41.4916807Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-26T19:31:41.4918368Z ) 2025-08-26T19:31:41.4918710Z return False 2025-08-26T19:31:41.4918941Z 2025-08-26T19:31:41.4918948Z 2025-08-26T19:31:41.4919246Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-26T19:31:41.4919867Z """ 2025-08-26T19:31:41.4920584Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-26T19:31:41.4921460Z """ 2025-08-26T19:31:41.4921801Z try: 2025-08-26T19:31:41.4922164Z if settings_text: 2025-08-26T19:31:41.4922874Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-26T19:31:41.4923664Z # for easy reading 2025-08-26T19:31:41.4924447Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-26T19:31:41.4925323Z # the backtick character in shell commands. 2025-08-26T19:31:41.4925922Z backtick = chr(96) # backtick character 2025-08-26T19:31:41.4926566Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-26T19:31:41.4927233Z settings = load_yaml(settings_text) 2025-08-26T19:31:41.4927605Z 2025-08-26T19:31:41.4928015Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-26T19:31:41.4928771Z experiments = {} 2025-08-26T19:31:41.4929065Z 2025-08-26T19:31:41.4929459Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-26T19:31:41.4930216Z if not is_valid_experiment_name(exp_name): 2025-08-26T19:31:41.4931421Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-26T19:31:41.4932472Z continue 2025-08-26T19:31:41.4932759Z 2025-08-26T19:31:41.4932938Z valid_settings = {} 2025-08-26T19:31:41.4933457Z for setting in exp_settings: 2025-08-26T19:31:41.4934020Z if setting not in Experiment._fields: 2025-08-26T19:31:41.4934567Z log.warning( 2025-08-26T19:31:41.4935252Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-26T19:31:41.4936123Z ) 2025-08-26T19:31:41.4936539Z else: 2025-08-26T19:31:41.4937037Z valid_settings[setting] = exp_settings[setting] 2025-08-26T19:31:41.4937455Z 2025-08-26T19:31:41.4937718Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-26T19:31:41.4938345Z return Settings(experiments) 2025-08-26T19:31:41.4938694Z 2025-08-26T19:31:41.4938870Z except Exception: 2025-08-26T19:31:41.4939332Z log.exception("Failed to parse settings") 2025-08-26T19:31:41.4939721Z 2025-08-26T19:31:41.4939886Z return Settings() 2025-08-26T19:31:41.4940137Z 2025-08-26T19:31:41.4940144Z 2025-08-26T19:31:41.4940384Z def parse_settings(rollout_state: str) -> Settings: 2025-08-26T19:31:41.4941059Z """ 2025-08-26T19:31:41.4941506Z Parse settings, if any, from the rollout state. 2025-08-26T19:31:41.4941905Z 2025-08-26T19:31:41.4942246Z If the issue body contains "---" then the text above that is the settings 2025-08-26T19:31:41.4943016Z and the text below is the list of opted in users. 2025-08-26T19:31:41.4943418Z 2025-08-26T19:31:41.4943817Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-26T19:31:41.4944554Z """ 2025-08-26T19:31:41.4945088Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.4945836Z return parse_settings_from_text(settings_text) 2025-08-26T19:31:41.4946232Z 2025-08-26T19:31:41.4946239Z 2025-08-26T19:31:41.4946482Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-26T19:31:41.4947027Z """ 2025-08-26T19:31:41.4947409Z Parse users from the rollout state. 2025-08-26T19:31:41.4947751Z 2025-08-26T19:31:41.4947901Z """ 2025-08-26T19:31:41.4948413Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-26T19:31:41.4949159Z return parse_user_opt_in_from_text(users_text) 2025-08-26T19:31:41.4949566Z 2025-08-26T19:31:41.4949580Z 2025-08-26T19:31:41.4950121Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.4950981Z """ 2025-08-26T19:31:41.4951395Z Check if a user is opted into an experiment 2025-08-26T19:31:41.4951927Z """ 2025-08-26T19:31:41.4952363Z return experiment_name in user_optins.get(user, []) 2025-08-26T19:31:41.4952783Z 2025-08-26T19:31:41.4952790Z 2025-08-26T19:31:41.4953196Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-26T19:31:41.4953940Z """ 2025-08-26T19:31:41.4954390Z Check if a user explicitly opted out of an experiment 2025-08-26T19:31:41.4954965Z """ 2025-08-26T19:31:41.4955455Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-26T19:31:41.4956130Z experiment_optout = "-" + experiment_name 2025-08-26T19:31:41.4956750Z if experiment_optout not in user_optins.get(user, []): 2025-08-26T19:31:41.4957363Z return False 2025-08-26T19:31:41.4957620Z 2025-08-26T19:31:41.4957890Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-26T19:31:41.4958485Z log.warning( 2025-08-26T19:31:41.4959292Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-26T19:31:41.4960171Z ) 2025-08-26T19:31:41.4960377Z 2025-08-26T19:31:41.4960549Z return True 2025-08-26T19:31:41.4960781Z 2025-08-26T19:31:41.4960788Z 2025-08-26T19:31:41.4961096Z def get_runner_prefix( 2025-08-26T19:31:41.4961542Z rollout_state: str, 2025-08-26T19:31:41.4961995Z workflow_requestors: Iterable[str], 2025-08-26T19:31:41.4962515Z branch: str, 2025-08-26T19:31:41.4962998Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.4963655Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-26T19:31:41.4964248Z is_canary: bool = False, 2025-08-26T19:31:41.4964695Z ) -> str: 2025-08-26T19:31:41.4965105Z settings = parse_settings(rollout_state) 2025-08-26T19:31:41.4965826Z user_optins = parse_users(rollout_state) 2025-08-26T19:31:41.4966197Z 2025-08-26T19:31:41.4966368Z fleet_prefix = "" 2025-08-26T19:31:41.4966778Z prefixes = [] 2025-08-26T19:31:41.4967400Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-26T19:31:41.4968341Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-26T19:31:41.4969047Z log.info( 2025-08-26T19:31:41.4969720Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-26T19:31:41.4970467Z ) 2025-08-26T19:31:41.4970945Z continue 2025-08-26T19:31:41.4971203Z 2025-08-26T19:31:41.4971395Z if opt_out_experiments: 2025-08-26T19:31:41.4971926Z if experiment_name in opt_out_experiments: 2025-08-26T19:31:41.4972560Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-26T19:31:41.4973160Z log.info( 2025-08-26T19:31:41.4974072Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-26T19:31:41.4975048Z ) 2025-08-26T19:31:41.4975448Z continue 2025-08-26T19:31:41.4975711Z 2025-08-26T19:31:41.4975895Z if eligible_experiments: 2025-08-26T19:31:41.4976471Z if experiment_name not in eligible_experiments: 2025-08-26T19:31:41.4977093Z exp_list = ", ".join(eligible_experiments) 2025-08-26T19:31:41.4977653Z log.info( 2025-08-26T19:31:41.4978419Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-26T19:31:41.4979257Z ) 2025-08-26T19:31:41.4979647Z continue 2025-08-26T19:31:41.4980107Z elif not experiment_settings.default: 2025-08-26T19:31:41.4980638Z log.info( 2025-08-26T19:31:41.4981524Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-26T19:31:41.4982280Z ) 2025-08-26T19:31:41.4982654Z continue 2025-08-26T19:31:41.4982901Z 2025-08-26T19:31:41.4983169Z # Is any workflow_requestor opted out to this experiment? 2025-08-26T19:31:41.4983779Z opted_out_users = [ 2025-08-26T19:31:41.4984212Z requestor 2025-08-26T19:31:41.4984662Z for requestor in workflow_requestors 2025-08-26T19:31:41.4985319Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.4985946Z ] 2025-08-26T19:31:41.4986145Z 2025-08-26T19:31:41.4986321Z if opted_out_users: 2025-08-26T19:31:41.4986770Z log.info( 2025-08-26T19:31:41.4987375Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-26T19:31:41.4988074Z ) 2025-08-26T19:31:41.4988449Z continue 2025-08-26T19:31:41.4988696Z 2025-08-26T19:31:41.4988974Z # Is any workflow_requestor opted in to this experiment? 2025-08-26T19:31:41.4989618Z opted_in_users = [ 2025-08-26T19:31:41.4990058Z requestor 2025-08-26T19:31:41.4990728Z for requestor in workflow_requestors 2025-08-26T19:31:41.4991549Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-26T19:31:41.4992185Z ] 2025-08-26T19:31:41.4992390Z 2025-08-26T19:31:41.4992567Z enabled = False 2025-08-26T19:31:41.4992997Z if opted_in_users: 2025-08-26T19:31:41.4993437Z log.info( 2025-08-26T19:31:41.4994026Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-26T19:31:41.4994715Z ) 2025-08-26T19:31:41.4995096Z enabled = True 2025-08-26T19:31:41.4995377Z 2025-08-26T19:31:41.4995589Z elif experiment_settings.rollout_perc: 2025-08-26T19:31:41.4996426Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-26T19:31:41.4997523Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-26T19:31:41.4998175Z log.info( 2025-08-26T19:31:41.4999025Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-26T19:31:41.4999952Z ) 2025-08-26T19:31:41.5000344Z enabled = True 2025-08-26T19:31:41.5000646Z 2025-08-26T19:31:41.5000810Z if enabled: 2025-08-26T19:31:41.5001338Z label = experiment_name 2025-08-26T19:31:41.5001885Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-26T19:31:41.5002719Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-26T19:31:41.5003588Z # - If it's enabled, then we always list it's prefix first 2025-08-26T19:31:41.5004347Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-26T19:31:41.5005010Z if is_canary: 2025-08-26T19:31:41.5005488Z label += CANARY_FLEET_SUFFIX 2025-08-26T19:31:41.5006027Z fleet_prefix = label 2025-08-26T19:31:41.5006510Z else: 2025-08-26T19:31:41.5006927Z prefixes.append(label) 2025-08-26T19:31:41.5007278Z 2025-08-26T19:31:41.5007458Z if len(prefixes) > 1: 2025-08-26T19:31:41.5007898Z log.error( 2025-08-26T19:31:41.5008922Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-26T19:31:41.5010046Z ) 2025-08-26T19:31:41.5010428Z prefixes = prefixes[:1] 2025-08-26T19:31:41.5010742Z 2025-08-26T19:31:41.5011025Z # Fleet always comes first 2025-08-26T19:31:41.5011493Z if fleet_prefix: 2025-08-26T19:31:41.5011936Z prefixes.insert(0, fleet_prefix) 2025-08-26T19:31:41.5012298Z 2025-08-26T19:31:41.5012680Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-26T19:31:41.5013097Z 2025-08-26T19:31:41.5013104Z 2025-08-26T19:31:41.5013544Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-26T19:31:41.5014322Z """ 2025-08-26T19:31:41.5014894Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-26T19:31:41.5015461Z 2025-08-26T19:31:41.5015842Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-26T19:31:41.5016557Z """ 2025-08-26T19:31:41.5016938Z gh = get_gh_client(github_token) 2025-08-26T19:31:41.5017479Z issue = get_issue(gh, repo, issue_num) 2025-08-26T19:31:41.5018100Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-26T19:31:41.5018558Z 2025-08-26T19:31:41.5018565Z 2025-08-26T19:31:41.5018957Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-26T19:31:41.5019715Z for _ in range(num_retries): 2025-08-26T19:31:41.5020189Z try: 2025-08-26T19:31:41.5020596Z req = Request(url=url, headers=headers) 2025-08-26T19:31:41.5021362Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-26T19:31:41.5022002Z return json.loads(content) 2025-08-26T19:31:41.5022519Z except Exception as e: 2025-08-26T19:31:41.5023061Z log.warning(f"Could not download {url}: {e}") 2025-08-26T19:31:41.5023465Z 2025-08-26T19:31:41.5023839Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-26T19:31:41.5024553Z return {} 2025-08-26T19:31:41.5024774Z 2025-08-26T19:31:41.5024782Z 2025-08-26T19:31:41.5024945Z @cache 2025-08-26T19:31:41.5025557Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-26T19:31:41.5026313Z """ 2025-08-26T19:31:41.5026694Z Dynamically get PR information 2025-08-26T19:31:41.5027180Z """ 2025-08-26T19:31:41.5027840Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-26T19:31:41.5028467Z headers = { 2025-08-26T19:31:41.5028909Z "Accept": "application/vnd.github.v3+json", 2025-08-26T19:31:41.5029509Z "Authorization": f"token {github_token}", 2025-08-26T19:31:41.5030035Z } 2025-08-26T19:31:41.5030448Z json_response: dict[str, Any] = download_json( 2025-08-26T19:31:41.5031155Z url=f"{github_api}/issues/{pr_number}", 2025-08-26T19:31:41.5031693Z headers=headers, 2025-08-26T19:31:41.5032111Z ) 2025-08-26T19:31:41.5032301Z 2025-08-26T19:31:41.5032482Z if not json_response: 2025-08-26T19:31:41.5033045Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-26T19:31:41.5033649Z return {} 2025-08-26T19:31:41.5033890Z 2025-08-26T19:31:41.5034061Z return json_response 2025-08-26T19:31:41.5034332Z 2025-08-26T19:31:41.5034339Z 2025-08-26T19:31:41.5034734Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-26T19:31:41.5035476Z """ 2025-08-26T19:31:41.5035989Z Dynamically get the latest list of labels from the pull request 2025-08-26T19:31:41.5036643Z """ 2025-08-26T19:31:41.5037118Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-26T19:31:41.5037724Z return { 2025-08-26T19:31:41.5038310Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-26T19:31:41.5038998Z } 2025-08-26T19:31:41.5039203Z 2025-08-26T19:31:41.5039210Z 2025-08-26T19:31:41.5039377Z def main() -> None: 2025-08-26T19:31:41.5039794Z args = parse_args() 2025-08-26T19:31:41.5040057Z 2025-08-26T19:31:41.5040270Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-26T19:31:41.5040654Z 2025-08-26T19:31:41.5040947Z # Check if the PR is opt-out 2025-08-26T19:31:41.5041437Z if args.pr_number: 2025-08-26T19:31:41.5042086Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-26T19:31:41.5042968Z if OPT_OUT_LABEL in labels: 2025-08-26T19:31:41.5043466Z log.info( 2025-08-26T19:31:41.5044144Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-26T19:31:41.5044906Z ) 2025-08-26T19:31:41.5045444Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.5046100Z sys.exit() 2025-08-26T19:31:41.5046359Z 2025-08-26T19:31:41.5046518Z try: 2025-08-26T19:31:41.5046945Z rollout_state = get_rollout_state_from_issue( 2025-08-26T19:31:41.5047642Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-26T19:31:41.5048266Z ) 2025-08-26T19:31:41.5048478Z 2025-08-26T19:31:41.5048683Z username = get_potential_pr_author( 2025-08-26T19:31:41.5049222Z args.github_token, 2025-08-26T19:31:41.5049689Z args.github_repo, 2025-08-26T19:31:41.5050156Z args.github_actor, 2025-08-26T19:31:41.5050663Z args.github_ref_type, 2025-08-26T19:31:41.5051283Z args.github_branch, 2025-08-26T19:31:41.5051749Z ) 2025-08-26T19:31:41.5051963Z 2025-08-26T19:31:41.5052237Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-26T19:31:41.5052685Z 2025-08-26T19:31:41.5052907Z runner_label_prefix = get_runner_prefix( 2025-08-26T19:31:41.5053451Z rollout_state, 2025-08-26T19:31:41.5053931Z (args.github_issue_owner, username), 2025-08-26T19:31:41.5054474Z args.github_branch, 2025-08-26T19:31:41.5054968Z args.eligible_experiments, 2025-08-26T19:31:41.5055494Z args.opt_out_experiments, 2025-08-26T19:31:41.5055991Z is_canary, 2025-08-26T19:31:41.5056392Z ) 2025-08-26T19:31:41.5056596Z 2025-08-26T19:31:41.5056776Z except Exception as e: 2025-08-26T19:31:41.5057218Z log.error( 2025-08-26T19:31:41.5057871Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-26T19:31:41.5058766Z ) 2025-08-26T19:31:41.5058966Z 2025-08-26T19:31:41.5059281Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-26T19:31:41.5059780Z 2025-08-26T19:31:41.5059792Z 2025-08-26T19:31:41.5059966Z if __name__ == "__main__": 2025-08-26T19:31:41.5060392Z main() 2025-08-26T19:31:41.5060607Z 2025-08-26T19:31:41.5157081Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.5157978Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-26T19:31:41.5199169Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:41.5199646Z env: 2025-08-26T19:31:41.5200265Z GITHUB_TOKEN: *** 2025-08-26T19:31:41.5200679Z ISSUE_NUMBER: 5132 2025-08-26T19:31:41.5201446Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:41.5201967Z ISSUE_OWNER: 2025-08-26T19:31:41.5202363Z CHECK_EXPERIMENTS: 2025-08-26T19:31:41.5202785Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:41.5203225Z PR_NUMBER: 2025-08-26T19:31:41.5203614Z ##[endgroup] 2025-08-26T19:31:42.4084984Z Defaulting to user installation because normal site-packages is not writeable 2025-08-26T19:31:43.3513513Z Collecting urllib3==1.26.18 2025-08-26T19:31:43.4338434Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-26T19:31:43.4628395Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.2 MB/s eta 0:00:00 2025-08-26T19:31:43.4923410Z Collecting PyGithub==2.3.0 2025-08-26T19:31:43.5097386Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-26T19:31:43.5607081Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-26T19:31:43.5786166Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-26T19:31:43.5841996Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-26T19:31:43.5862134Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-26T19:31:43.5878183Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-26T19:31:43.6187049Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-26T19:31:43.6365170Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-26T19:31:43.6602656Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-26T19:31:43.7839676Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.8016691Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-26T19:31:43.9271781Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-26T19:31:43.9448677Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-26T19:31:43.9684303Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-26T19:31:43.9858699Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-26T19:31:44.0235174Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-26T19:31:44.0444443Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 7.1 MB/s eta 0:00:00 2025-08-26T19:31:44.0618788Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-26T19:31:44.0831363Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 18.1 MB/s eta 0:00:00 2025-08-26T19:31:44.1004395Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-26T19:31:44.1225571Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 42.7 MB/s eta 0:00:00 2025-08-26T19:31:44.1398445Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-26T19:31:44.1611987Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-26T19:31:44.1680313Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 99.1 MB/s eta 0:00:00 2025-08-26T19:31:44.1857594Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-26T19:31:44.1908684Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 24.0 MB/s eta 0:00:00 2025-08-26T19:31:44.2084155Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-26T19:31:44.2131747Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 36.1 MB/s eta 0:00:00 2025-08-26T19:31:44.5243591Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-26T19:31:45.0719429Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-26T19:31:45.1697089Z ##[group]Run curr_branch="main" 2025-08-26T19:31:45.1697396Z curr_branch="main" 2025-08-26T19:31:45.1697617Z curr_ref_type="branch" 2025-08-26T19:31:45.1697893Z echo "Current branch is '$curr_branch'" 2025-08-26T19:31:45.1698138Z  2025-08-26T19:31:45.1698318Z python3 runner_determinator.py \ 2025-08-26T19:31:45.1698678Z  --github-token "$GITHUB_TOKEN" \ 2025-08-26T19:31:45.1699011Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-26T19:31:45.1699263Z  --github-branch "$curr_branch" \ 2025-08-26T19:31:45.1699522Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-26T19:31:45.1699798Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-26T19:31:45.1700066Z  --github-ref-type "$curr_ref_type" \ 2025-08-26T19:31:45.1700336Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-26T19:31:45.1700627Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-26T19:31:45.1701189Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-26T19:31:45.1701508Z  --pr-number "${PR_NUMBER}" 2025-08-26T19:31:45.1743244Z shell: /usr/bin/bash -e {0} 2025-08-26T19:31:45.1743470Z env: 2025-08-26T19:31:45.1744031Z GITHUB_TOKEN: *** 2025-08-26T19:31:45.1744219Z ISSUE_NUMBER: 5132 2025-08-26T19:31:45.1744430Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-26T19:31:45.1744656Z ISSUE_OWNER: 2025-08-26T19:31:45.1744874Z CHECK_EXPERIMENTS: 2025-08-26T19:31:45.1745071Z OPT_OUT_EXPERIMENTS: lf 2025-08-26T19:31:45.1745264Z PR_NUMBER: 2025-08-26T19:31:45.1745427Z ##[endgroup] 2025-08-26T19:31:45.1804327Z Current branch is 'main' 2025-08-26T19:31:46.5873231Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-08-26T19:31:46.5874516Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-26T19:31:46.5876103Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-26T19:31:46.5876782Z INFO : Setting output: label-type='' 2025-08-26T19:31:46.6226066Z Evaluate and set job outputs 2025-08-26T19:31:46.6233095Z Cleaning up orphan processes