2025-07-17T06:33:19.8037183Z Current runner version: '2.326.0' 2025-07-17T06:33:19.8061580Z ##[group]Runner Image Provisioner 2025-07-17T06:33:19.8062859Z Hosted Compute Agent 2025-07-17T06:33:19.8063469Z Version: 20250711.363 2025-07-17T06:33:19.8064063Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:19.8064705Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:19.8065344Z ##[endgroup] 2025-07-17T06:33:19.8065900Z ##[group]Operating System 2025-07-17T06:33:19.8066434Z Ubuntu 2025-07-17T06:33:19.8066964Z 24.04.2 2025-07-17T06:33:19.8067394Z LTS 2025-07-17T06:33:19.8067841Z ##[endgroup] 2025-07-17T06:33:19.8068328Z ##[group]Runner Image 2025-07-17T06:33:19.8068911Z Image: ubuntu-24.04 2025-07-17T06:33:19.8069382Z Version: 20250710.1.0 2025-07-17T06:33:19.8070421Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:19.8071950Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:19.8073139Z ##[endgroup] 2025-07-17T06:33:19.8074154Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:19.8076156Z Contents: read 2025-07-17T06:33:19.8076807Z Metadata: read 2025-07-17T06:33:19.8077290Z ##[endgroup] 2025-07-17T06:33:19.8079831Z Secret source: Actions 2025-07-17T06:33:19.8080891Z Prepare workflow directory 2025-07-17T06:33:19.8609672Z Prepare all required actions 2025-07-17T06:33:19.8666488Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:19.8671447Z ##[group] Inputs 2025-07-17T06:33:19.8672124Z check_experiments: 2025-07-17T06:33:19.8673056Z opt_out_experiments: 2025-07-17T06:33:19.8673633Z triggering_actor: pytorchmergebot 2025-07-17T06:33:19.8674192Z issue_owner: 2025-07-17T06:33:19.8674825Z curr_branch: main 2025-07-17T06:33:19.8675299Z curr_ref_type: branch 2025-07-17T06:33:19.8675982Z issue_number: 5132 2025-07-17T06:33:19.8676588Z ##[endgroup] 2025-07-17T06:33:19.8677243Z Complete job name: before-test / get-label-type / runner-determinator 2025-07-17T06:33:20.6049273Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.6051883Z cat < runner_determinator.py 2025-07-17T06:33:20.6053027Z # flake8: noqa: G004 2025-07-17T06:33:20.6053673Z  2025-07-17T06:33:20.6054555Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.6055646Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.6056645Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.6057434Z  2025-07-17T06:33:20.6057892Z """ 2025-07-17T06:33:20.6058670Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.6059673Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.6060976Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.6061955Z of which runners should be used to run which job. 2025-07-17T06:33:20.6063144Z  2025-07-17T06:33:20.6063923Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.6065006Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.6066127Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.6066985Z list, defined. 2025-07-17T06:33:20.6067525Z  2025-07-17T06:33:20.6068232Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.6069342Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.6070350Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.6071099Z  2025-07-17T06:33:20.6072481Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.6073515Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.6074474Z experiments which the user could be opted in to. 2025-07-17T06:33:20.6075195Z  2025-07-17T06:33:20.6075701Z The user list has the following rules: 2025-07-17T06:33:20.6076374Z  2025-07-17T06:33:20.6077067Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.6078104Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.6079066Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.6079733Z  2025-07-17T06:33:20.6080216Z Example config: 2025-07-17T06:33:20.6080795Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.6081728Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.6082675Z  # Expected syntax is: 2025-07-17T06:33:20.6083485Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.6084691Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.6085548Z  2025-07-17T06:33:20.6086009Z  experiments: 2025-07-17T06:33:20.6086611Z  lf: 2025-07-17T06:33:20.6087143Z  rollout_percent: 25 2025-07-17T06:33:20.6087723Z  all_branches: false 2025-07-17T06:33:20.6088375Z  default: true 2025-07-17T06:33:20.6089205Z  --- 2025-07-17T06:33:20.6089662Z  2025-07-17T06:33:20.6090216Z  # Opt-ins: 2025-07-17T06:33:20.6090948Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.6092288Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.6167507Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.6168914Z  # Experiments should be from the above list. 2025-07-17T06:33:20.6170013Z  2025-07-17T06:33:20.6170748Z  @User1,-lf,split_build 2025-07-17T06:33:20.6171850Z  @User2,lf 2025-07-17T06:33:20.6172895Z  @User3,split_build 2025-07-17T06:33:20.6173411Z """ 2025-07-17T06:33:20.6173806Z  2025-07-17T06:33:20.6174189Z import json 2025-07-17T06:33:20.6174629Z import logging 2025-07-17T06:33:20.6175072Z import os 2025-07-17T06:33:20.6175494Z import random 2025-07-17T06:33:20.6175925Z import re 2025-07-17T06:33:20.6176342Z import sys 2025-07-17T06:33:20.6176815Z from argparse import ArgumentParser 2025-07-17T06:33:20.6177480Z from collections.abc import Iterable 2025-07-17T06:33:20.6178112Z from functools import cache 2025-07-17T06:33:20.6178649Z from logging import LogRecord 2025-07-17T06:33:20.6179218Z from typing import Any, NamedTuple 2025-07-17T06:33:20.6179837Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.6180427Z  2025-07-17T06:33:20.6180808Z import yaml 2025-07-17T06:33:20.6181269Z from github import Auth, Github 2025-07-17T06:33:20.6181828Z from github.Issue import Issue 2025-07-17T06:33:20.6182618Z  2025-07-17T06:33:20.6183000Z  2025-07-17T06:33:20.6183459Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.6184231Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.6185197Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.6185952Z  2025-07-17T06:33:20.6186740Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.6187390Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.6187989Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.6188644Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.6189209Z  2025-07-17T06:33:20.6189646Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.6190184Z  2025-07-17T06:33:20.6190594Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.6191127Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.6191623Z  2025-07-17T06:33:20.6191992Z  2025-07-17T06:33:20.6192801Z class Experiment(NamedTuple): 2025-07-17T06:33:20.6193364Z  rollout_perc: float = ( 2025-07-17T06:33:20.6194110Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.6194846Z  ) 2025-07-17T06:33:20.6195264Z  all_branches: bool = ( 2025-07-17T06:33:20.6196005Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.6196726Z  ) 2025-07-17T06:33:20.6197142Z  default: bool = ( 2025-07-17T06:33:20.6197801Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.6198494Z  ) 2025-07-17T06:33:20.6198877Z  2025-07-17T06:33:20.6199274Z  # Add more fields as needed 2025-07-17T06:33:20.6199789Z  2025-07-17T06:33:20.6200149Z  2025-07-17T06:33:20.6200547Z class Settings(NamedTuple): 2025-07-17T06:33:20.6201045Z  """ 2025-07-17T06:33:20.6201579Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.6202378Z  """ 2025-07-17T06:33:20.6202788Z  2025-07-17T06:33:20.6203225Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.6203810Z  2025-07-17T06:33:20.6204337Z  2025-07-17T06:33:20.6204804Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.6205515Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.6206146Z  2025-07-17T06:33:20.6206525Z  COLORS = { 2025-07-17T06:33:20.6207002Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.6207569Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.6208128Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.6208678Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.6209242Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.6209772Z  } 2025-07-17T06:33:20.6210173Z  2025-07-17T06:33:20.6210624Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.6211452Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.6212526Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.6213170Z  return super().format(record) 2025-07-17T06:33:20.6213704Z  2025-07-17T06:33:20.6214076Z  2025-07-17T06:33:20.6214501Z handler = logging.StreamHandler() 2025-07-17T06:33:20.6215298Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.6216066Z  2025-07-17T06:33:20.6216555Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.6217203Z log.addHandler(handler) 2025-07-17T06:33:20.6217726Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.6218216Z  2025-07-17T06:33:20.6218596Z  2025-07-17T06:33:20.6219094Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.6219721Z  """ 2025-07-17T06:33:20.6220299Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.6221131Z  """ 2025-07-17T06:33:20.6221551Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.6222953Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.6224172Z  log.warning( 2025-07-17T06:33:20.6225119Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.6226098Z  ) 2025-07-17T06:33:20.6226596Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.6227194Z  return 2025-07-17T06:33:20.6227637Z  2025-07-17T06:33:20.6228065Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.6228706Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.6229337Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.6229888Z  2025-07-17T06:33:20.6230259Z  2025-07-17T06:33:20.6230827Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.6231546Z  return frozenset( 2025-07-17T06:33:20.6232796Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.6233578Z  ) 2025-07-17T06:33:20.6233981Z  2025-07-17T06:33:20.6234358Z  2025-07-17T06:33:20.6234757Z def parse_args() -> Any: 2025-07-17T06:33:20.6235425Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.6236359Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.6237190Z  parser.add_argument( 2025-07-17T06:33:20.6237726Z  "--github-issue-repo", 2025-07-17T06:33:20.6238264Z  type=str, 2025-07-17T06:33:20.6238756Z  required=False, 2025-07-17T06:33:20.6239446Z  default="pytorch/test-infra", 2025-07-17T06:33:20.6240068Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.6240621Z  ) 2025-07-17T06:33:20.6241050Z  parser.add_argument( 2025-07-17T06:33:20.6241568Z  "--github-repo", 2025-07-17T06:33:20.6242079Z  type=str, 2025-07-17T06:33:20.6242802Z  required=True, 2025-07-17T06:33:20.6243359Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.6243933Z  ) 2025-07-17T06:33:20.6244348Z  parser.add_argument( 2025-07-17T06:33:20.6245053Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.6245767Z  ) 2025-07-17T06:33:20.6246181Z  parser.add_argument( 2025-07-17T06:33:20.6246898Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.6247632Z  ) 2025-07-17T06:33:20.6248047Z  parser.add_argument( 2025-07-17T06:33:20.6248762Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.6249521Z  ) 2025-07-17T06:33:20.6249943Z  parser.add_argument( 2025-07-17T06:33:20.6250713Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.6251476Z  ) 2025-07-17T06:33:20.6251919Z  parser.add_argument( 2025-07-17T06:33:20.6252556Z  "--github-ref-type", 2025-07-17T06:33:20.6253073Z  type=str, 2025-07-17T06:33:20.6253549Z  required=True, 2025-07-17T06:33:20.6254144Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.6254749Z  ) 2025-07-17T06:33:20.6255170Z  parser.add_argument( 2025-07-17T06:33:20.6255872Z  "--eligible-experiments", 2025-07-17T06:33:20.6256468Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.6257043Z  required=False, 2025-07-17T06:33:20.6257541Z  default="", 2025-07-17T06:33:20.6258526Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.6259515Z  ) 2025-07-17T06:33:20.6259936Z  parser.add_argument( 2025-07-17T06:33:20.6260459Z  "--opt-out-experiments", 2025-07-17T06:33:20.6261043Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.6261611Z  required=False, 2025-07-17T06:33:20.6262106Z  default="", 2025-07-17T06:33:20.6262911Z  help=( 2025-07-17T06:33:20.6263674Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.6264895Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.6265782Z  ), 2025-07-17T06:33:20.6266193Z  ) 2025-07-17T06:33:20.6266618Z  parser.add_argument( 2025-07-17T06:33:20.6267126Z  "--pr-number", 2025-07-17T06:33:20.6267619Z  type=str, 2025-07-17T06:33:20.6268090Z  required=False, 2025-07-17T06:33:20.6268591Z  default="", 2025-07-17T06:33:20.6269157Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.6269770Z  ) 2025-07-17T06:33:20.6270164Z  2025-07-17T06:33:20.6270574Z  return parser.parse_args() 2025-07-17T06:33:20.6271097Z  2025-07-17T06:33:20.6271464Z  2025-07-17T06:33:20.6272123Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.6273363Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.6274010Z  return Github(auth=auth) 2025-07-17T06:33:20.6274520Z  2025-07-17T06:33:20.6274886Z  2025-07-17T06:33:20.6275598Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.6276460Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.6277055Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.6277619Z  2025-07-17T06:33:20.6277989Z  2025-07-17T06:33:20.6278388Z def get_potential_pr_author( 2025-07-17T06:33:20.6279127Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.6279862Z ) -> str: 2025-07-17T06:33:20.6280456Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.6281336Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.6282280Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.6282912Z  2025-07-17T06:33:20.6283332Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.6283874Z  2025-07-17T06:33:20.6284392Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.6285094Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.6285661Z  if ( 2025-07-17T06:33:20.6286112Z  len(split_tag) == 3 2025-07-17T06:33:20.6286681Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.6287275Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.6287826Z  ): 2025-07-17T06:33:20.6288290Z  pr_number = split_tag[2] 2025-07-17T06:33:20.6288835Z  try: 2025-07-17T06:33:20.6289353Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.6290181Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.6290856Z  except Exception as e: 2025-07-17T06:33:20.6291442Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.6292367Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.6293076Z  ) from e 2025-07-17T06:33:20.6293696Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.6294474Z  # In all other cases, return the original input username 2025-07-17T06:33:20.6295117Z  return username 2025-07-17T06:33:20.6295583Z  2025-07-17T06:33:20.6295948Z  2025-07-17T06:33:20.6296414Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.6296990Z  """ 2025-07-17T06:33:20.6297710Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.6298561Z  """ 2025-07-17T06:33:20.6299173Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.6299897Z  2025-07-17T06:33:20.6300259Z  2025-07-17T06:33:20.6300686Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.6301234Z  try: 2025-07-17T06:33:20.6301677Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.6302339Z  return data 2025-07-17T06:33:20.6302829Z  except yaml.YAMLError: 2025-07-17T06:33:20.6303393Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.6303949Z  raise 2025-07-17T06:33:20.6304372Z  2025-07-17T06:33:20.6304729Z  2025-07-17T06:33:20.6305393Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.6306188Z  """ 2025-07-17T06:33:20.6307016Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.6307818Z  2025-07-17T06:33:20.6308399Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.6309250Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.6309847Z  2025-07-17T06:33:20.6310469Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.6311218Z  """ 2025-07-17T06:33:20.6311722Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.6312495Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.6313172Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.6313803Z  else: 2025-07-17T06:33:20.6314416Z  return "", rollout_state 2025-07-17T06:33:20.6315028Z  2025-07-17T06:33:20.6315397Z  2025-07-17T06:33:20.6315843Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.6316402Z  """ 2025-07-17T06:33:20.6316985Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.6317675Z  """ 2025-07-17T06:33:20.6318062Z  2025-07-17T06:33:20.6318427Z  2025-07-17T06:33:20.6318994Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.6319701Z  """ 2025-07-17T06:33:20.6320491Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.6321365Z  2025-07-17T06:33:20.6322339Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.6323425Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.6324322Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.6325007Z  2025-07-17T06:33:20.6325369Z  2025-07-17T06:33:20.6325725Z  """ 2025-07-17T06:33:20.6326138Z  optins = UserOptins() 2025-07-17T06:33:20.6326705Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.6327317Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.6327930Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.6328536Z  # Not a valid user. Skip 2025-07-17T06:33:20.6329075Z  continue 2025-07-17T06:33:20.6329531Z  2025-07-17T06:33:20.6329931Z  if user: 2025-07-17T06:33:20.6330448Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.6331212Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.6331899Z  2025-07-17T06:33:20.6332386Z  return optins 2025-07-17T06:33:20.6332837Z  2025-07-17T06:33:20.6333188Z  2025-07-17T06:33:20.6333720Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.6334382Z  """ 2025-07-17T06:33:20.6334835Z  Check if the experiment name is valid. 2025-07-17T06:33:20.6335398Z  A valid name: 2025-07-17T06:33:20.6336111Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.6337107Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.6337873Z  - Cannot contain spaces 2025-07-17T06:33:20.6338397Z  """ 2025-07-17T06:33:20.6338785Z  2025-07-17T06:33:20.6339279Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.6340054Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.6340816Z  2025-07-17T06:33:20.6341192Z  if valid: 2025-07-17T06:33:20.6341626Z  return True 2025-07-17T06:33:20.6342074Z  2025-07-17T06:33:20.6342632Z  log.error( 2025-07-17T06:33:20.6344193Z  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-07-17T06:33:20.6345831Z  ) 2025-07-17T06:33:20.6346239Z  return False 2025-07-17T06:33:20.6346688Z  2025-07-17T06:33:20.6347052Z  2025-07-17T06:33:20.6347626Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.6348311Z  """ 2025-07-17T06:33:20.6348968Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.6349738Z  """ 2025-07-17T06:33:20.6350129Z  try: 2025-07-17T06:33:20.6350551Z  if settings_text: 2025-07-17T06:33:20.6351361Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.6352308Z  # for easy reading 2025-07-17T06:33:20.6353201Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.6354159Z  # the backtick character in shell commands. 2025-07-17T06:33:20.6354832Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.6355571Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.6356293Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.6356849Z  2025-07-17T06:33:20.6357500Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.6358496Z  experiments = {} 2025-07-17T06:33:20.6358995Z  2025-07-17T06:33:20.6359598Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.6360412Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.6361584Z  # 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-07-17T06:33:20.6362793Z  continue 2025-07-17T06:33:20.6363282Z  2025-07-17T06:33:20.6363694Z  valid_settings = {} 2025-07-17T06:33:20.6364275Z  for setting in exp_settings: 2025-07-17T06:33:20.6364910Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.6365523Z  log.warning( 2025-07-17T06:33:20.6366326Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.6367084Z  ) 2025-07-17T06:33:20.6367570Z  else: 2025-07-17T06:33:20.6368172Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.6368783Z  2025-07-17T06:33:20.6369291Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.6369983Z  return Settings(experiments) 2025-07-17T06:33:20.6370522Z  2025-07-17T06:33:20.6370913Z  except Exception: 2025-07-17T06:33:20.6371473Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.6372053Z  2025-07-17T06:33:20.6372541Z  return Settings() 2025-07-17T06:33:20.6373004Z  2025-07-17T06:33:20.6373365Z  2025-07-17T06:33:20.6373986Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.6374611Z  """ 2025-07-17T06:33:20.6375105Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.6375699Z  2025-07-17T06:33:20.6376278Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.6377101Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.6377696Z  2025-07-17T06:33:20.6378339Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.6379116Z  """ 2025-07-17T06:33:20.6379733Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.6380567Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.6381153Z  2025-07-17T06:33:20.6381509Z  2025-07-17T06:33:20.6382006Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.6382731Z  """ 2025-07-17T06:33:20.6383180Z  Parse users from the rollout state. 2025-07-17T06:33:20.6383729Z  2025-07-17T06:33:20.6384092Z  """ 2025-07-17T06:33:20.6384684Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.6385493Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.6386075Z  2025-07-17T06:33:20.6386441Z  2025-07-17T06:33:20.6387109Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.6387903Z  """ 2025-07-17T06:33:20.6388385Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.6388953Z  """ 2025-07-17T06:33:20.6389476Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.6390089Z  2025-07-17T06:33:20.6390631Z  2025-07-17T06:33:20.6391315Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.6392114Z  """ 2025-07-17T06:33:20.6392756Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.6393392Z  """ 2025-07-17T06:33:20.6393962Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.6394715Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.6395423Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.6396072Z  return False 2025-07-17T06:33:20.6396535Z  2025-07-17T06:33:20.6397043Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.6397687Z  log.warning( 2025-07-17T06:33:20.6398584Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.6399515Z  ) 2025-07-17T06:33:20.6399926Z  2025-07-17T06:33:20.6400302Z  return True 2025-07-17T06:33:20.6400740Z  2025-07-17T06:33:20.6401103Z  2025-07-17T06:33:20.6401496Z def get_runner_prefix( 2025-07-17T06:33:20.6401995Z  rollout_state: str, 2025-07-17T06:33:20.6402644Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.6403203Z  branch: str, 2025-07-17T06:33:20.6403767Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.6404507Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.6405138Z  is_canary: bool = False, 2025-07-17T06:33:20.6405648Z ) -> str: 2025-07-17T06:33:20.6406141Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.6406784Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.6407353Z  2025-07-17T06:33:20.6407861Z  fleet_prefix = "" 2025-07-17T06:33:20.6408359Z  prefixes = [] 2025-07-17T06:33:20.6409069Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.6410088Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.6410846Z  log.info( 2025-07-17T06:33:20.6411622Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.6412524Z  ) 2025-07-17T06:33:20.6412978Z  continue 2025-07-17T06:33:20.6413438Z  2025-07-17T06:33:20.6413841Z  if opt_out_experiments: 2025-07-17T06:33:20.6414451Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.6415156Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.6415814Z  log.info( 2025-07-17T06:33:20.6416826Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.6417877Z  ) 2025-07-17T06:33:20.6418336Z  continue 2025-07-17T06:33:20.6418806Z  2025-07-17T06:33:20.6419207Z  if eligible_experiments: 2025-07-17T06:33:20.6419838Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.6420535Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.6421130Z  log.info( 2025-07-17T06:33:20.6421989Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.6422974Z  ) 2025-07-17T06:33:20.6423561Z  continue 2025-07-17T06:33:20.6424122Z  elif not experiment_settings.default: 2025-07-17T06:33:20.6424699Z  log.info( 2025-07-17T06:33:20.6425425Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.6426199Z  ) 2025-07-17T06:33:20.6426628Z  continue 2025-07-17T06:33:20.6427083Z  2025-07-17T06:33:20.6427593Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.6428270Z  opted_out_users = [ 2025-07-17T06:33:20.6428789Z  requestor 2025-07-17T06:33:20.6429314Z  for requestor in workflow_requestors 2025-07-17T06:33:20.6430053Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.6430724Z  ] 2025-07-17T06:33:20.6431130Z  2025-07-17T06:33:20.6431525Z  if opted_out_users: 2025-07-17T06:33:20.6432059Z  log.info( 2025-07-17T06:33:20.6432869Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.6433611Z  ) 2025-07-17T06:33:20.6434052Z  continue 2025-07-17T06:33:20.6434502Z  2025-07-17T06:33:20.6435008Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.6435659Z  opted_in_users = [ 2025-07-17T06:33:20.6436184Z  requestor 2025-07-17T06:33:20.6436716Z  for requestor in workflow_requestors 2025-07-17T06:33:20.6437447Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.6438114Z  ] 2025-07-17T06:33:20.6438516Z  2025-07-17T06:33:20.6438906Z  enabled = False 2025-07-17T06:33:20.6439412Z  if opted_in_users: 2025-07-17T06:33:20.6440133Z  log.info( 2025-07-17T06:33:20.6440846Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.6441573Z  ) 2025-07-17T06:33:20.6442007Z  enabled = True 2025-07-17T06:33:20.6442601Z  2025-07-17T06:33:20.6443051Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.6443942Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.6444955Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.6445649Z  log.info( 2025-07-17T06:33:20.6446596Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.6447565Z  ) 2025-07-17T06:33:20.6448046Z  enabled = True 2025-07-17T06:33:20.6448554Z  2025-07-17T06:33:20.6448935Z  if enabled: 2025-07-17T06:33:20.6449437Z  label = experiment_name 2025-07-17T06:33:20.6450051Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.6450937Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.6451866Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.6452790Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.6453502Z  if is_canary: 2025-07-17T06:33:20.6454054Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.6454647Z  fleet_prefix = label 2025-07-17T06:33:20.6455190Z  else: 2025-07-17T06:33:20.6455825Z  prefixes.append(label) 2025-07-17T06:33:20.6456363Z  2025-07-17T06:33:20.6456748Z  if len(prefixes) > 1: 2025-07-17T06:33:20.6457253Z  log.error( 2025-07-17T06:33:20.6458397Z  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-07-17T06:33:20.6459571Z  ) 2025-07-17T06:33:20.6460021Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.6460533Z  2025-07-17T06:33:20.6460933Z  # Fleet always comes first 2025-07-17T06:33:20.6461461Z  if fleet_prefix: 2025-07-17T06:33:20.6461984Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.6462638Z  2025-07-17T06:33:20.6463129Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.6463731Z  2025-07-17T06:33:20.6464109Z  2025-07-17T06:33:20.6464799Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.6465613Z  """ 2025-07-17T06:33:20.6466260Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.6467002Z  2025-07-17T06:33:20.6467619Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.6468352Z  """ 2025-07-17T06:33:20.6468798Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.6469405Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.6470099Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.6470731Z  2025-07-17T06:33:20.6471091Z  2025-07-17T06:33:20.6471733Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.6472772Z  for _ in range(num_retries): 2025-07-17T06:33:20.6473318Z  try: 2025-07-17T06:33:20.6473810Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.6474527Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.6475226Z  return json.loads(content) 2025-07-17T06:33:20.6475795Z  except Exception as e: 2025-07-17T06:33:20.6476410Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.6477001Z  2025-07-17T06:33:20.6477618Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.6478382Z  return {} 2025-07-17T06:33:20.6478807Z  2025-07-17T06:33:20.6479173Z  2025-07-17T06:33:20.6479541Z @cache 2025-07-17T06:33:20.6480236Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.6481037Z  """ 2025-07-17T06:33:20.6481478Z  Dynamically get PR information 2025-07-17T06:33:20.6482008Z  """ 2025-07-17T06:33:20.6482679Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.6483356Z  headers = { 2025-07-17T06:33:20.6483882Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.6484538Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.6485106Z  } 2025-07-17T06:33:20.6485592Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.6486248Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.6486838Z  headers=headers, 2025-07-17T06:33:20.6487341Z  ) 2025-07-17T06:33:20.6487723Z  2025-07-17T06:33:20.6488116Z  if not json_response: 2025-07-17T06:33:20.6488761Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.6489571Z  return {} 2025-07-17T06:33:20.6490016Z  2025-07-17T06:33:20.6490400Z  return json_response 2025-07-17T06:33:20.6490868Z  2025-07-17T06:33:20.6491234Z  2025-07-17T06:33:20.6491861Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.6492804Z  """ 2025-07-17T06:33:20.6493392Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.6494079Z  """ 2025-07-17T06:33:20.6494615Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.6495263Z  return { 2025-07-17T06:33:20.6495911Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.6496638Z  } 2025-07-17T06:33:20.6497019Z  2025-07-17T06:33:20.6497393Z  2025-07-17T06:33:20.6497776Z def main() -> None: 2025-07-17T06:33:20.6498259Z  args = parse_args() 2025-07-17T06:33:20.6498732Z  2025-07-17T06:33:20.6499183Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.6499754Z  2025-07-17T06:33:20.6500163Z  # Check if the PR is opt-out 2025-07-17T06:33:20.6500704Z  if args.pr_number: 2025-07-17T06:33:20.6501436Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.6502375Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.6502928Z  log.info( 2025-07-17T06:33:20.6503700Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.6504499Z  ) 2025-07-17T06:33:20.6505132Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.6505870Z  sys.exit() 2025-07-17T06:33:20.6506470Z  2025-07-17T06:33:20.6506856Z  try: 2025-07-17T06:33:20.6507353Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.6508134Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.6508819Z  ) 2025-07-17T06:33:20.6509227Z  2025-07-17T06:33:20.6509656Z  username = get_potential_pr_author( 2025-07-17T06:33:20.6510243Z  args.github_token, 2025-07-17T06:33:20.6510780Z  args.github_repo, 2025-07-17T06:33:20.6511309Z  args.github_actor, 2025-07-17T06:33:20.6511853Z  args.github_ref_type, 2025-07-17T06:33:20.6512510Z  args.github_branch, 2025-07-17T06:33:20.6513023Z  ) 2025-07-17T06:33:20.6513420Z  2025-07-17T06:33:20.6513944Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.6514589Z  2025-07-17T06:33:20.6515042Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.6515631Z  rollout_state, 2025-07-17T06:33:20.6516185Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.6516781Z  args.github_branch, 2025-07-17T06:33:20.6517340Z  args.eligible_experiments, 2025-07-17T06:33:20.6517932Z  args.opt_out_experiments, 2025-07-17T06:33:20.6518481Z  is_canary, 2025-07-17T06:33:20.6518952Z  ) 2025-07-17T06:33:20.6519356Z  2025-07-17T06:33:20.6519748Z  except Exception as e: 2025-07-17T06:33:20.6520263Z  log.error( 2025-07-17T06:33:20.6521012Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.6521945Z  ) 2025-07-17T06:33:20.6522460Z  2025-07-17T06:33:20.6523036Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.6523719Z  2025-07-17T06:33:20.6524087Z  2025-07-17T06:33:20.6524474Z if __name__ == "__main__": 2025-07-17T06:33:20.6524967Z  main() 2025-07-17T06:33:20.6525379Z  2025-07-17T06:33:20.6525739Z EOF 2025-07-17T06:33:20.6526117Z  2025-07-17T06:33:20.6526513Z cat runner_determinator.py 2025-07-17T06:33:20.6821262Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.6822096Z env: 2025-07-17T06:33:20.6823180Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.6823628Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.6824099Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.6824631Z ISSUE_OWNER: 2025-07-17T06:33:20.6825056Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.6825504Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.6825955Z PR_NUMBER: 2025-07-17T06:33:20.6826372Z ##[endgroup] 2025-07-17T06:33:20.7029296Z # flake8: noqa: G004 2025-07-17T06:33:20.7029670Z 2025-07-17T06:33:20.7030110Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.7031063Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.7031868Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.7032607Z 2025-07-17T06:33:20.7032865Z """ 2025-07-17T06:33:20.7033466Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.7034349Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.7035243Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.7036086Z of which runners should be used to run which job. 2025-07-17T06:33:20.7036489Z 2025-07-17T06:33:20.7036882Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.7038000Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.7038901Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.7039622Z list, defined. 2025-07-17T06:33:20.7039861Z 2025-07-17T06:33:20.7040229Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.7041176Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.7042015Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.7042739Z 2025-07-17T06:33:20.7043122Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.7043996Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.7044733Z experiments which the user could be opted in to. 2025-07-17T06:33:20.7045135Z 2025-07-17T06:33:20.7045336Z The user list has the following rules: 2025-07-17T06:33:20.7045689Z 2025-07-17T06:33:20.7046048Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.7046907Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.7047673Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.7048068Z 2025-07-17T06:33:20.7048245Z Example config: 2025-07-17T06:33:20.7048701Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.7049378Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.7050005Z # Expected syntax is: 2025-07-17T06:33:20.7050652Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.7051628Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.7052474Z 2025-07-17T06:33:20.7052663Z experiments: 2025-07-17T06:33:20.7053069Z lf: 2025-07-17T06:33:20.7053447Z rollout_percent: 25 2025-07-17T06:33:20.7054085Z all_branches: false 2025-07-17T06:33:20.7054538Z default: true 2025-07-17T06:33:20.7054954Z --- 2025-07-17T06:33:20.7055163Z 2025-07-17T06:33:20.7055334Z # Opt-ins: 2025-07-17T06:33:20.7055922Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.7056790Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.7057566Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.7058225Z # Experiments should be from the above list. 2025-07-17T06:33:20.7058618Z 2025-07-17T06:33:20.7058805Z @User1,-lf,split_build 2025-07-17T06:33:20.7059256Z @User2,lf 2025-07-17T06:33:20.7059646Z @User3,split_build 2025-07-17T06:33:20.7060063Z """ 2025-07-17T06:33:20.7060260Z 2025-07-17T06:33:20.7060436Z import json 2025-07-17T06:33:20.7060815Z import logging 2025-07-17T06:33:20.7061195Z import os 2025-07-17T06:33:20.7061578Z import random 2025-07-17T06:33:20.7061972Z import re 2025-07-17T06:33:20.7062749Z import sys 2025-07-17T06:33:20.7063225Z from argparse import ArgumentParser 2025-07-17T06:33:20.7063779Z from collections.abc import Iterable 2025-07-17T06:33:20.7064316Z from functools import cache 2025-07-17T06:33:20.7064795Z from logging import LogRecord 2025-07-17T06:33:20.7065288Z from typing import Any, NamedTuple 2025-07-17T06:33:20.7065827Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.7066208Z 2025-07-17T06:33:20.7066379Z import yaml 2025-07-17T06:33:20.7066774Z from github import Auth, Github 2025-07-17T06:33:20.7067275Z from github.Issue import Issue 2025-07-17T06:33:20.7067579Z 2025-07-17T06:33:20.7067586Z 2025-07-17T06:33:20.7067810Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.7068500Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.7069390Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.7069942Z 2025-07-17T06:33:20.7070176Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.7070913Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.7071445Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.7072024Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.7072591Z 2025-07-17T06:33:20.7072810Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.7073145Z 2025-07-17T06:33:20.7073335Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.7073810Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.7074090Z 2025-07-17T06:33:20.7074097Z 2025-07-17T06:33:20.7074291Z class Experiment(NamedTuple): 2025-07-17T06:33:20.7074793Z rollout_perc: float = ( 2025-07-17T06:33:20.7075428Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.7076109Z ) 2025-07-17T06:33:20.7076491Z all_branches: bool = ( 2025-07-17T06:33:20.7077120Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.7077793Z ) 2025-07-17T06:33:20.7078164Z default: bool = ( 2025-07-17T06:33:20.7078738Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.7079376Z ) 2025-07-17T06:33:20.7079576Z 2025-07-17T06:33:20.7079755Z # Add more fields as needed 2025-07-17T06:33:20.7080056Z 2025-07-17T06:33:20.7080062Z 2025-07-17T06:33:20.7080258Z class Settings(NamedTuple): 2025-07-17T06:33:20.7080704Z """ 2025-07-17T06:33:20.7081169Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.7081745Z """ 2025-07-17T06:33:20.7081945Z 2025-07-17T06:33:20.7082158Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.7082717Z 2025-07-17T06:33:20.7082726Z 2025-07-17T06:33:20.7082947Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.7083584Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.7084015Z 2025-07-17T06:33:20.7084189Z COLORS = { 2025-07-17T06:33:20.7084595Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.7085254Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.7085768Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.7086299Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.7086786Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.7087260Z } 2025-07-17T06:33:20.7087458Z 2025-07-17T06:33:20.7087678Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.7088435Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.7089214Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.7089795Z return super().format(record) 2025-07-17T06:33:20.7090127Z 2025-07-17T06:33:20.7090135Z 2025-07-17T06:33:20.7090339Z handler = logging.StreamHandler() 2025-07-17T06:33:20.7091038Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.7091600Z 2025-07-17T06:33:20.7091850Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.7092628Z log.addHandler(handler) 2025-07-17T06:33:20.7093094Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.7093382Z 2025-07-17T06:33:20.7093388Z 2025-07-17T06:33:20.7093644Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.7094203Z """ 2025-07-17T06:33:20.7094709Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.7095339Z """ 2025-07-17T06:33:20.7095717Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.7096787Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.7097909Z log.warning( 2025-07-17T06:33:20.7098765Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.7099707Z ) 2025-07-17T06:33:20.7109931Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.7110547Z return 2025-07-17T06:33:20.7110790Z 2025-07-17T06:33:20.7111211Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.7111827Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.7112653Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.7112986Z 2025-07-17T06:33:20.7112993Z 2025-07-17T06:33:20.7113310Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.7113955Z return frozenset( 2025-07-17T06:33:20.7114583Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.7115268Z ) 2025-07-17T06:33:20.7115479Z 2025-07-17T06:33:20.7115486Z 2025-07-17T06:33:20.7115674Z def parse_args() -> Any: 2025-07-17T06:33:20.7116247Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.7117103Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.7117871Z parser.add_argument( 2025-07-17T06:33:20.7118328Z "--github-issue-repo", 2025-07-17T06:33:20.7118807Z type=str, 2025-07-17T06:33:20.7119208Z required=False, 2025-07-17T06:33:20.7119659Z default="pytorch/test-infra", 2025-07-17T06:33:20.7120190Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.7120697Z ) 2025-07-17T06:33:20.7121070Z parser.add_argument( 2025-07-17T06:33:20.7121528Z "--github-repo", 2025-07-17T06:33:20.7121954Z type=str, 2025-07-17T06:33:20.7122559Z required=True, 2025-07-17T06:33:20.7123036Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.7123567Z ) 2025-07-17T06:33:20.7123945Z parser.add_argument( 2025-07-17T06:33:20.7124548Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.7125207Z ) 2025-07-17T06:33:20.7125574Z parser.add_argument( 2025-07-17T06:33:20.7126196Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.7126863Z ) 2025-07-17T06:33:20.7127360Z parser.add_argument( 2025-07-17T06:33:20.7128352Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.7129197Z ) 2025-07-17T06:33:20.7129585Z parser.add_argument( 2025-07-17T06:33:20.7130350Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.7131202Z ) 2025-07-17T06:33:20.7131690Z parser.add_argument( 2025-07-17T06:33:20.7132320Z "--github-ref-type", 2025-07-17T06:33:20.7132900Z type=str, 2025-07-17T06:33:20.7133426Z required=True, 2025-07-17T06:33:20.7184063Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.7184763Z ) 2025-07-17T06:33:20.7185158Z parser.add_argument( 2025-07-17T06:33:20.7185636Z "--eligible-experiments", 2025-07-17T06:33:20.7186169Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.7186705Z required=False, 2025-07-17T06:33:20.7187122Z default="", 2025-07-17T06:33:20.7187991Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.7188931Z ) 2025-07-17T06:33:20.7189320Z parser.add_argument( 2025-07-17T06:33:20.7189785Z "--opt-out-experiments", 2025-07-17T06:33:20.7190296Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.7190821Z required=False, 2025-07-17T06:33:20.7191260Z default="", 2025-07-17T06:33:20.7191656Z help=( 2025-07-17T06:33:20.7192526Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.7193664Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.7194494Z ), 2025-07-17T06:33:20.7194852Z ) 2025-07-17T06:33:20.7195228Z parser.add_argument( 2025-07-17T06:33:20.7195668Z "--pr-number", 2025-07-17T06:33:20.7196084Z type=str, 2025-07-17T06:33:20.7196490Z required=False, 2025-07-17T06:33:20.7196912Z default="", 2025-07-17T06:33:20.7197594Z help="the optional PR number where this is run", 2025-07-17T06:33:20.7198179Z ) 2025-07-17T06:33:20.7198379Z 2025-07-17T06:33:20.7198572Z return parser.parse_args() 2025-07-17T06:33:20.7198880Z 2025-07-17T06:33:20.7198887Z 2025-07-17T06:33:20.7199296Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.7200054Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.7200572Z return Github(auth=auth) 2025-07-17T06:33:20.7200877Z 2025-07-17T06:33:20.7200883Z 2025-07-17T06:33:20.7201338Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.7202132Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.7202868Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.7203236Z 2025-07-17T06:33:20.7203242Z 2025-07-17T06:33:20.7203431Z def get_potential_pr_author( 2025-07-17T06:33:20.7204082Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.7204762Z ) -> str: 2025-07-17T06:33:20.7205279Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.7206079Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.7206816Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.7207235Z 2025-07-17T06:33:20.7207434Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.7207764Z 2025-07-17T06:33:20.7208027Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.7208655Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.7209151Z if ( 2025-07-17T06:33:20.7209560Z len(split_tag) == 3 2025-07-17T06:33:20.7210041Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.7210582Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.7211082Z ): 2025-07-17T06:33:20.7211468Z pr_number = split_tag[2] 2025-07-17T06:33:20.7212116Z try: 2025-07-17T06:33:20.7212877Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.7213509Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.7214110Z except Exception as e: 2025-07-17T06:33:20.7214641Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.7215303Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.7215947Z ) from e 2025-07-17T06:33:20.7216484Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.7217176Z # In all other cases, return the original input username 2025-07-17T06:33:20.7217764Z return username 2025-07-17T06:33:20.7218004Z 2025-07-17T06:33:20.7218011Z 2025-07-17T06:33:20.7218235Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.7218773Z """ 2025-07-17T06:33:20.7219412Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.7220198Z """ 2025-07-17T06:33:20.7220747Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.7221274Z 2025-07-17T06:33:20.7221281Z 2025-07-17T06:33:20.7221476Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.7221970Z try: 2025-07-17T06:33:20.7222580Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.7223097Z return data 2025-07-17T06:33:20.7223515Z except yaml.YAMLError: 2025-07-17T06:33:20.7224000Z log.exception("Error loading YAML") 2025-07-17T06:33:20.7224512Z raise 2025-07-17T06:33:20.7224738Z 2025-07-17T06:33:20.7224745Z 2025-07-17T06:33:20.7225162Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.7225912Z """ 2025-07-17T06:33:20.7226522Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.7227127Z 2025-07-17T06:33:20.7227632Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.7228395Z and the text below is the list of opted in users. 2025-07-17T06:33:20.7228803Z 2025-07-17T06:33:20.7229174Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.7229877Z """ 2025-07-17T06:33:20.7230321Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.7230953Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.7231552Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.7232145Z else: 2025-07-17T06:33:20.7232733Z return "", rollout_state 2025-07-17T06:33:20.7233066Z 2025-07-17T06:33:20.7233073Z 2025-07-17T06:33:20.7233272Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.7233773Z """ 2025-07-17T06:33:20.7234297Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.7234955Z """ 2025-07-17T06:33:20.7235174Z 2025-07-17T06:33:20.7235182Z 2025-07-17T06:33:20.7235519Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.7236174Z """ 2025-07-17T06:33:20.7236870Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.7237556Z 2025-07-17T06:33:20.7238164Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.7239169Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.7239849Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.7240332Z 2025-07-17T06:33:20.7240338Z 2025-07-17T06:33:20.7240505Z """ 2025-07-17T06:33:20.7240883Z optins = UserOptins() 2025-07-17T06:33:20.7241380Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.7241936Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.7242672Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.7243385Z # Not a valid user. Skip 2025-07-17T06:33:20.7243884Z continue 2025-07-17T06:33:20.7244131Z 2025-07-17T06:33:20.7244303Z if user: 2025-07-17T06:33:20.7244740Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.7245434Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.7245925Z 2025-07-17T06:33:20.7246131Z return optins 2025-07-17T06:33:20.7246378Z 2025-07-17T06:33:20.7246384Z 2025-07-17T06:33:20.7246665Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.7247271Z """ 2025-07-17T06:33:20.7247665Z Check if the experiment name is valid. 2025-07-17T06:33:20.7248190Z A valid name: 2025-07-17T06:33:20.7248818Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.7249777Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.7250509Z - Cannot contain spaces 2025-07-17T06:33:20.7250980Z """ 2025-07-17T06:33:20.7251182Z 2025-07-17T06:33:20.7251442Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.7252132Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.7253224Z 2025-07-17T06:33:20.7253404Z if valid: 2025-07-17T06:33:20.7253788Z return True 2025-07-17T06:33:20.7254029Z 2025-07-17T06:33:20.7254198Z log.error( 2025-07-17T06:33:20.7255644Z 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-07-17T06:33:20.7257213Z ) 2025-07-17T06:33:20.7257574Z return False 2025-07-17T06:33:20.7257810Z 2025-07-17T06:33:20.7257817Z 2025-07-17T06:33:20.7258118Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.7258739Z """ 2025-07-17T06:33:20.7259504Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.7260301Z """ 2025-07-17T06:33:20.7260656Z try: 2025-07-17T06:33:20.7261040Z if settings_text: 2025-07-17T06:33:20.7261754Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.7262727Z # for easy reading 2025-07-17T06:33:20.7263517Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.7264406Z # the backtick character in shell commands. 2025-07-17T06:33:20.7265012Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.7265672Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.7266346Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.7266719Z 2025-07-17T06:33:20.7267139Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.7267926Z experiments = {} 2025-07-17T06:33:20.7268226Z 2025-07-17T06:33:20.7268636Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.7269417Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.7270532Z # 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-07-17T06:33:20.7271579Z continue 2025-07-17T06:33:20.7271873Z 2025-07-17T06:33:20.7272059Z valid_settings = {} 2025-07-17T06:33:20.7272692Z for setting in exp_settings: 2025-07-17T06:33:20.7273271Z if setting not in Experiment._fields: 2025-07-17T06:33:20.7273836Z log.warning( 2025-07-17T06:33:20.7274537Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.7275440Z ) 2025-07-17T06:33:20.7275874Z else: 2025-07-17T06:33:20.7276391Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.7276817Z 2025-07-17T06:33:20.7277103Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.7277738Z return Settings(experiments) 2025-07-17T06:33:20.7278088Z 2025-07-17T06:33:20.7278272Z except Exception: 2025-07-17T06:33:20.7278757Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.7279156Z 2025-07-17T06:33:20.7279334Z return Settings() 2025-07-17T06:33:20.7279590Z 2025-07-17T06:33:20.7279597Z 2025-07-17T06:33:20.7279846Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.7280429Z """ 2025-07-17T06:33:20.7280872Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.7281274Z 2025-07-17T06:33:20.7281627Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.7282558Z and the text below is the list of opted in users. 2025-07-17T06:33:20.7282970Z 2025-07-17T06:33:20.7283378Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.7284120Z """ 2025-07-17T06:33:20.7284681Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.7285435Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.7285838Z 2025-07-17T06:33:20.7285845Z 2025-07-17T06:33:20.7286098Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.7286663Z """ 2025-07-17T06:33:20.7287058Z Parse users from the rollout state. 2025-07-17T06:33:20.7287407Z 2025-07-17T06:33:20.7287565Z """ 2025-07-17T06:33:20.7288104Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.7288857Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.7289266Z 2025-07-17T06:33:20.7289273Z 2025-07-17T06:33:20.7289812Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.7290588Z """ 2025-07-17T06:33:20.7291006Z Check if a user is opted into an experiment 2025-07-17T06:33:20.7291547Z """ 2025-07-17T06:33:20.7292006Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.7292547Z 2025-07-17T06:33:20.7292554Z 2025-07-17T06:33:20.7292973Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.7293729Z """ 2025-07-17T06:33:20.7294182Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.7294765Z """ 2025-07-17T06:33:20.7295262Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.7295953Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.7296587Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.7297205Z return False 2025-07-17T06:33:20.7297466Z 2025-07-17T06:33:20.7297736Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.7298342Z log.warning( 2025-07-17T06:33:20.7299145Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.7300028Z ) 2025-07-17T06:33:20.7300236Z 2025-07-17T06:33:20.7300407Z return True 2025-07-17T06:33:20.7300639Z 2025-07-17T06:33:20.7300645Z 2025-07-17T06:33:20.7300820Z def get_runner_prefix( 2025-07-17T06:33:20.7301262Z rollout_state: str, 2025-07-17T06:33:20.7301724Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.7302458Z branch: str, 2025-07-17T06:33:20.7302963Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.7303619Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.7304211Z is_canary: bool = False, 2025-07-17T06:33:20.7304668Z ) -> str: 2025-07-17T06:33:20.7305243Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.7305824Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.7306199Z 2025-07-17T06:33:20.7306373Z fleet_prefix = "" 2025-07-17T06:33:20.7306792Z prefixes = [] 2025-07-17T06:33:20.7307427Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.7308371Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.7309086Z log.info( 2025-07-17T06:33:20.7309763Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.7310520Z ) 2025-07-17T06:33:20.7310903Z continue 2025-07-17T06:33:20.7311147Z 2025-07-17T06:33:20.7311336Z if opt_out_experiments: 2025-07-17T06:33:20.7311877Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.7313109Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.7313745Z log.info( 2025-07-17T06:33:20.7314678Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.7315643Z ) 2025-07-17T06:33:20.7316045Z continue 2025-07-17T06:33:20.7316309Z 2025-07-17T06:33:20.7316497Z if eligible_experiments: 2025-07-17T06:33:20.7317083Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.7317716Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.7318267Z log.info( 2025-07-17T06:33:20.7319306Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.7320378Z ) 2025-07-17T06:33:20.7320792Z continue 2025-07-17T06:33:20.7321314Z elif not experiment_settings.default: 2025-07-17T06:33:20.7321857Z log.info( 2025-07-17T06:33:20.7323068Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.7323892Z ) 2025-07-17T06:33:20.7324275Z continue 2025-07-17T06:33:20.7324519Z 2025-07-17T06:33:20.7324796Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.7325425Z opted_out_users = [ 2025-07-17T06:33:20.7325867Z requestor 2025-07-17T06:33:20.7326318Z for requestor in workflow_requestors 2025-07-17T06:33:20.7326977Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.7327604Z ] 2025-07-17T06:33:20.7327808Z 2025-07-17T06:33:20.7327995Z if opted_out_users: 2025-07-17T06:33:20.7328441Z log.info( 2025-07-17T06:33:20.7329052Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.7329733Z ) 2025-07-17T06:33:20.7330111Z continue 2025-07-17T06:33:20.7330364Z 2025-07-17T06:33:20.7330649Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.7331282Z opted_in_users = [ 2025-07-17T06:33:20.7331725Z requestor 2025-07-17T06:33:20.7332306Z for requestor in workflow_requestors 2025-07-17T06:33:20.7332977Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.7333588Z ] 2025-07-17T06:33:20.7333788Z 2025-07-17T06:33:20.7333964Z enabled = False 2025-07-17T06:33:20.7334395Z if opted_in_users: 2025-07-17T06:33:20.7334841Z log.info( 2025-07-17T06:33:20.7335444Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.7336125Z ) 2025-07-17T06:33:20.7336512Z enabled = True 2025-07-17T06:33:20.7336795Z 2025-07-17T06:33:20.7337013Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.7337837Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.7338895Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.7339552Z log.info( 2025-07-17T06:33:20.7340406Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.7341326Z ) 2025-07-17T06:33:20.7341725Z enabled = True 2025-07-17T06:33:20.7342029Z 2025-07-17T06:33:20.7342298Z if enabled: 2025-07-17T06:33:20.7342733Z label = experiment_name 2025-07-17T06:33:20.7343274Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.7344100Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.7344971Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.7345731Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.7346456Z if is_canary: 2025-07-17T06:33:20.7346959Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.7347500Z fleet_prefix = label 2025-07-17T06:33:20.7347986Z else: 2025-07-17T06:33:20.7348416Z prefixes.append(label) 2025-07-17T06:33:20.7348755Z 2025-07-17T06:33:20.7348937Z if len(prefixes) > 1: 2025-07-17T06:33:20.7349379Z log.error( 2025-07-17T06:33:20.7350390Z 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-07-17T06:33:20.7351494Z ) 2025-07-17T06:33:20.7351875Z prefixes = prefixes[:1] 2025-07-17T06:33:20.7352289Z 2025-07-17T06:33:20.7352482Z # Fleet always comes first 2025-07-17T06:33:20.7352952Z if fleet_prefix: 2025-07-17T06:33:20.7353395Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.7353757Z 2025-07-17T06:33:20.7354142Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.7354560Z 2025-07-17T06:33:20.7354566Z 2025-07-17T06:33:20.7355007Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.7355787Z """ 2025-07-17T06:33:20.7356362Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.7356931Z 2025-07-17T06:33:20.7357309Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.7358008Z """ 2025-07-17T06:33:20.7358392Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.7358929Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.7359548Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.7360003Z 2025-07-17T06:33:20.7360010Z 2025-07-17T06:33:20.7360401Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.7361177Z for _ in range(num_retries): 2025-07-17T06:33:20.7361656Z try: 2025-07-17T06:33:20.7362087Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.7362853Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.7363496Z return json.loads(content) 2025-07-17T06:33:20.7364010Z except Exception as e: 2025-07-17T06:33:20.7364548Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.7364946Z 2025-07-17T06:33:20.7365320Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.7366035Z return {} 2025-07-17T06:33:20.7366255Z 2025-07-17T06:33:20.7366261Z 2025-07-17T06:33:20.7366424Z @cache 2025-07-17T06:33:20.7367025Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.7367776Z """ 2025-07-17T06:33:20.7368162Z Dynamically get PR information 2025-07-17T06:33:20.7368645Z """ 2025-07-17T06:33:20.7369275Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.7369898Z headers = { 2025-07-17T06:33:20.7370349Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.7370953Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.7371492Z } 2025-07-17T06:33:20.7371914Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.7372627Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.7373168Z headers=headers, 2025-07-17T06:33:20.7373591Z ) 2025-07-17T06:33:20.7373787Z 2025-07-17T06:33:20.7373970Z if not json_response: 2025-07-17T06:33:20.7374538Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.7375147Z return {} 2025-07-17T06:33:20.7375389Z 2025-07-17T06:33:20.7375571Z return json_response 2025-07-17T06:33:20.7375849Z 2025-07-17T06:33:20.7375855Z 2025-07-17T06:33:20.7376259Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.7376994Z """ 2025-07-17T06:33:20.7377522Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.7378180Z """ 2025-07-17T06:33:20.7378658Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.7379270Z return { 2025-07-17T06:33:20.7379866Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.7380566Z } 2025-07-17T06:33:20.7380767Z 2025-07-17T06:33:20.7380774Z 2025-07-17T06:33:20.7380946Z def main() -> None: 2025-07-17T06:33:20.7381361Z args = parse_args() 2025-07-17T06:33:20.7381628Z 2025-07-17T06:33:20.7381845Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.7382334Z 2025-07-17T06:33:20.7382529Z # Check if the PR is opt-out 2025-07-17T06:33:20.7383024Z if args.pr_number: 2025-07-17T06:33:20.7383666Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.7384554Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.7385051Z log.info( 2025-07-17T06:33:20.7385732Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.7386488Z ) 2025-07-17T06:33:20.7387035Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.7387701Z sys.exit() 2025-07-17T06:33:20.7387963Z 2025-07-17T06:33:20.7388126Z try: 2025-07-17T06:33:20.7388552Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.7389254Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.7389888Z ) 2025-07-17T06:33:20.7390091Z 2025-07-17T06:33:20.7390295Z username = get_potential_pr_author( 2025-07-17T06:33:20.7390837Z args.github_token, 2025-07-17T06:33:20.7391308Z args.github_repo, 2025-07-17T06:33:20.7391788Z args.github_actor, 2025-07-17T06:33:20.7392372Z args.github_ref_type, 2025-07-17T06:33:20.7392876Z args.github_branch, 2025-07-17T06:33:20.7393340Z ) 2025-07-17T06:33:20.7393552Z 2025-07-17T06:33:20.7393828Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.7394286Z 2025-07-17T06:33:20.7394517Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.7395068Z rollout_state, 2025-07-17T06:33:20.7395553Z (args.github_issue_owner, username), 2025-07-17T06:33:20.7396097Z args.github_branch, 2025-07-17T06:33:20.7396587Z args.eligible_experiments, 2025-07-17T06:33:20.7397116Z args.opt_out_experiments, 2025-07-17T06:33:20.7397620Z is_canary, 2025-07-17T06:33:20.7398023Z ) 2025-07-17T06:33:20.7398237Z 2025-07-17T06:33:20.7398425Z except Exception as e: 2025-07-17T06:33:20.7398873Z log.error( 2025-07-17T06:33:20.7399528Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.7400428Z ) 2025-07-17T06:33:20.7400636Z 2025-07-17T06:33:20.7400963Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.7401471Z 2025-07-17T06:33:20.7401477Z 2025-07-17T06:33:20.7401666Z if __name__ == "__main__": 2025-07-17T06:33:20.7402101Z main() 2025-07-17T06:33:20.7402431Z 2025-07-17T06:33:20.7498129Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.7499039Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.7531483Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.7531978Z env: 2025-07-17T06:33:20.7532855Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.7533310Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.7533771Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.7534308Z ISSUE_OWNER: 2025-07-17T06:33:20.7534713Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.7535143Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.7535598Z PR_NUMBER: 2025-07-17T06:33:20.7535982Z ##[endgroup] 2025-07-17T06:33:21.1133859Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.7393562Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.7841104Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.8077665Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.2 MB/s eta 0:00:00 2025-07-17T06:33:21.8287390Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.8317408Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.8749174Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.8776784Z 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-07-17T06:33:21.8822901Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.8840808Z 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-07-17T06:33:21.8855660Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.9112122Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.9144549Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.9375851Z 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-07-17T06:33:22.0465006Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:22.0499710Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:22.1531362Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:22.1565199Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:22.1753623Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:22.1784776Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:22.2013935Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:22.2134383Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 13.3 MB/s eta 0:00:00 2025-07-17T06:33:22.2213559Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:22.2313040Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 43.4 MB/s eta 0:00:00 2025-07-17T06:33:22.2344047Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:22.2485104Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 68.9 MB/s eta 0:00:00 2025-07-17T06:33:22.2512846Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:22.2563896Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:22.2649831Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 70.0 MB/s eta 0:00:00 2025-07-17T06:33:22.2679519Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:22.2719962Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 33.9 MB/s eta 0:00:00 2025-07-17T06:33:22.2746801Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:22.2791182Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.1 MB/s eta 0:00:00 2025-07-17T06:33:22.5725316Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:23.1234106Z 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.2 2025-07-17T06:33:23.2344661Z ##[group]Run curr_branch="main" 2025-07-17T06:33:23.2344988Z curr_branch="main" 2025-07-17T06:33:23.2345250Z curr_ref_type="branch" 2025-07-17T06:33:23.2345505Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:23.2345756Z  2025-07-17T06:33:23.2345951Z python3 runner_determinator.py \ 2025-07-17T06:33:23.2346230Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:23.2346515Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:23.2346797Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:23.2347092Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:23.2347383Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:23.2347662Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:23.2347941Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:23.2348240Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:23.2348611Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:23.2348898Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:23.2377729Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:23.2377962Z env: 2025-07-17T06:33:23.2378584Z GITHUB_TOKEN: *** 2025-07-17T06:33:23.2378793Z ISSUE_NUMBER: 5132 2025-07-17T06:33:23.2379008Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:23.2379241Z ISSUE_OWNER: 2025-07-17T06:33:23.2379425Z CHECK_EXPERIMENTS: 2025-07-17T06:33:23.2379610Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:23.2379799Z PR_NUMBER: 2025-07-17T06:33:23.2379967Z ##[endgroup] 2025-07-17T06:33:23.2428274Z Current branch is 'main' 2025-07-17T06:33:24.7874656Z INFO : Based on rollout percentage of 25%, enabling experiment lf. 2025-07-17T06:33:24.7875862Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.7876863Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.7877624Z INFO : Setting output: label-type='lf.' 2025-07-17T06:33:24.8210648Z Evaluate and set job outputs 2025-07-17T06:33:24.8217185Z Set output 'label-type' 2025-07-17T06:33:24.8219445Z Cleaning up orphan processes