2025-09-07T06:09:28.6764482Z Current runner version: '2.328.0' 2025-09-07T06:09:28.6787900Z ##[group]Runner Image Provisioner 2025-09-07T06:09:28.6788628Z Hosted Compute Agent 2025-09-07T06:09:28.6789165Z Version: 20250829.383 2025-09-07T06:09:28.6789854Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T06:09:28.6790510Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T06:09:28.6791092Z ##[endgroup] 2025-09-07T06:09:28.6791659Z ##[group]Operating System 2025-09-07T06:09:28.6792227Z Ubuntu 2025-09-07T06:09:28.6792665Z 24.04.3 2025-09-07T06:09:28.6793166Z LTS 2025-09-07T06:09:28.6793606Z ##[endgroup] 2025-09-07T06:09:28.6794093Z ##[group]Runner Image 2025-09-07T06:09:28.6794700Z Image: ubuntu-24.04 2025-09-07T06:09:28.6795186Z Version: 20250831.1.0 2025-09-07T06:09:28.6796165Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T06:09:28.6797901Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T06:09:28.6798850Z ##[endgroup] 2025-09-07T06:09:28.6799805Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T06:09:28.6801914Z Metadata: read 2025-09-07T06:09:28.6802437Z ##[endgroup] 2025-09-07T06:09:28.6805119Z Secret source: Actions 2025-09-07T06:09:28.6806024Z Prepare workflow directory 2025-09-07T06:09:28.7326083Z Prepare all required actions 2025-09-07T06:09:28.7386871Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T06:09:28.7393457Z ##[group] Inputs 2025-09-07T06:09:28.7394146Z check_experiments: 2025-09-07T06:09:28.7394777Z opt_out_experiments: 2025-09-07T06:09:28.7395331Z triggering_actor: pytorchmergebot 2025-09-07T06:09:28.7396021Z issue_owner: 2025-09-07T06:09:28.7396796Z curr_branch: main 2025-09-07T06:09:28.7397426Z curr_ref_type: branch 2025-09-07T06:09:28.7397913Z issue_number: 5132 2025-09-07T06:09:28.7398541Z ##[endgroup] 2025-09-07T06:09:28.7399243Z Complete job name: get-label-type / runner-determinator 2025-09-07T06:09:29.3309339Z ##[group]Run cat < runner_determinator.py 2025-09-07T06:09:29.3311815Z cat < runner_determinator.py 2025-09-07T06:09:29.3312520Z # flake8: noqa: G004 2025-09-07T06:09:29.3313168Z  2025-09-07T06:09:29.3313971Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:29.3315036Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:29.3316100Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:29.3316990Z  2025-09-07T06:09:29.3317462Z """ 2025-09-07T06:09:29.3318293Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:29.3319307Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:29.3320546Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:29.3321580Z of which runners should be used to run which job. 2025-09-07T06:09:29.3322272Z  2025-09-07T06:09:29.3322948Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:29.3324118Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:29.3325160Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:29.3325953Z list, defined. 2025-09-07T06:09:29.3326891Z  2025-09-07T06:09:29.3327587Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:29.3328658Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:29.3329836Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:29.3330555Z  2025-09-07T06:09:29.3331253Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:29.3332683Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:29.3333651Z experiments which the user could be opted in to. 2025-09-07T06:09:29.3334355Z  2025-09-07T06:09:29.3334948Z The user list has the following rules: 2025-09-07T06:09:29.3335591Z  2025-09-07T06:09:29.3336448Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:29.3337608Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:29.3338497Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:29.3339178Z  2025-09-07T06:09:29.3339716Z Example config: 2025-09-07T06:09:29.3340314Z  # A list of experiments that can be opted into. 2025-09-07T06:09:29.3341167Z  # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:29.3341955Z  # Expected syntax is: 2025-09-07T06:09:29.3342800Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:29.3343919Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:29.3428467Z  2025-09-07T06:09:29.3429009Z  experiments: 2025-09-07T06:09:29.3429470Z  lf: 2025-09-07T06:09:29.3429941Z  rollout_percent: 25 2025-09-07T06:09:29.3430474Z  all_branches: false 2025-09-07T06:09:29.3430982Z  default: true 2025-09-07T06:09:29.3431458Z  --- 2025-09-07T06:09:29.3431859Z  2025-09-07T06:09:29.3432257Z  # Opt-ins: 2025-09-07T06:09:29.3432931Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:29.3434117Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:29.3434983Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:29.3435713Z  # Experiments should be from the above list. 2025-09-07T06:09:29.3436424Z  2025-09-07T06:09:29.3436844Z  @User1,-lf,split_build 2025-09-07T06:09:29.3437356Z  @User2,lf 2025-09-07T06:09:29.3437804Z  @User3,split_build 2025-09-07T06:09:29.3438285Z """ 2025-09-07T06:09:29.3438666Z  2025-09-07T06:09:29.3439055Z import json 2025-09-07T06:09:29.3439492Z import logging 2025-09-07T06:09:29.3439928Z import os 2025-09-07T06:09:29.3440344Z import random 2025-09-07T06:09:29.3440772Z import re 2025-09-07T06:09:29.3441183Z import sys 2025-09-07T06:09:29.3441637Z from argparse import ArgumentParser 2025-09-07T06:09:29.3442301Z from collections.abc import Iterable 2025-09-07T06:09:29.3442895Z from functools import cache 2025-09-07T06:09:29.3443425Z from logging import LogRecord 2025-09-07T06:09:29.3443979Z from typing import Any, NamedTuple 2025-09-07T06:09:29.3444589Z from urllib.request import Request, urlopen 2025-09-07T06:09:29.3445173Z  2025-09-07T06:09:29.3445546Z import yaml 2025-09-07T06:09:29.3446005Z from github import Auth, Github 2025-09-07T06:09:29.3446832Z from github.Issue import Issue 2025-09-07T06:09:29.3447349Z  2025-09-07T06:09:29.3447713Z  2025-09-07T06:09:29.3448168Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:29.3448929Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:29.3449878Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:29.3450628Z  2025-09-07T06:09:29.3451105Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:29.3451903Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:29.3452500Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:29.3453148Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:29.3453714Z  2025-09-07T06:09:29.3454137Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:29.3454677Z  2025-09-07T06:09:29.3455078Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:29.3455600Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:29.3456093Z  2025-09-07T06:09:29.3456572Z  2025-09-07T06:09:29.3456982Z class Experiment(NamedTuple): 2025-09-07T06:09:29.3457527Z  rollout_perc: float = ( 2025-09-07T06:09:29.3458255Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:29.3458971Z  ) 2025-09-07T06:09:29.3459386Z  all_branches: bool = ( 2025-09-07T06:09:29.3460100Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:29.3460809Z  ) 2025-09-07T06:09:29.3461216Z  default: bool = ( 2025-09-07T06:09:29.3461858Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:29.3462540Z  ) 2025-09-07T06:09:29.3462928Z  2025-09-07T06:09:29.3463326Z  # Add more fields as needed 2025-09-07T06:09:29.3463827Z  2025-09-07T06:09:29.3464199Z  2025-09-07T06:09:29.3464601Z class Settings(NamedTuple): 2025-09-07T06:09:29.3465107Z  """ 2025-09-07T06:09:29.3465646Z  Settings for the experiments that can be opted into. 2025-09-07T06:09:29.3466359Z  """ 2025-09-07T06:09:29.3466762Z  2025-09-07T06:09:29.3467196Z  experiments: dict[str, Experiment] = {} 2025-09-07T06:09:29.3467764Z  2025-09-07T06:09:29.3468283Z  2025-09-07T06:09:29.3468748Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:29.3469441Z  """Color codes the log messages based on the log level""" 2025-09-07T06:09:29.3470070Z  2025-09-07T06:09:29.3470448Z  COLORS = { 2025-09-07T06:09:29.3470921Z  "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:29.3471482Z  "ERROR": "\033[31m", # Red 2025-09-07T06:09:29.3472040Z  "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:29.3472600Z  "INFO": "\033[0m", # Reset 2025-09-07T06:09:29.3473150Z  "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:29.3473664Z  } 2025-09-07T06:09:29.3474048Z  2025-09-07T06:09:29.3474501Z  def format(self, record: LogRecord) -> str: 2025-09-07T06:09:29.3475321Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:29.3476154Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:29.3476905Z  return super().format(record) 2025-09-07T06:09:29.3477439Z  2025-09-07T06:09:29.3477806Z  2025-09-07T06:09:29.3478222Z handler = logging.StreamHandler() 2025-09-07T06:09:29.3479017Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:29.3479775Z  2025-09-07T06:09:29.3480262Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:29.3480908Z log.addHandler(handler) 2025-09-07T06:09:29.3481417Z log.setLevel(logging.INFO) 2025-09-07T06:09:29.3481909Z  2025-09-07T06:09:29.3482269Z  2025-09-07T06:09:29.3482766Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:29.3483396Z  """ 2025-09-07T06:09:29.3483975Z  Defines outputs of the github action that invokes this script 2025-09-07T06:09:29.3484649Z  """ 2025-09-07T06:09:29.3485197Z  if not GITHUB_OUTPUT: 2025-09-07T06:09:29.3486883Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:29.3488112Z  log.warning( 2025-09-07T06:09:29.3489062Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:29.3490036Z  ) 2025-09-07T06:09:29.3490527Z  print(f"::set-output name={key}::{value}") 2025-09-07T06:09:29.3491115Z  return 2025-09-07T06:09:29.3491540Z  2025-09-07T06:09:29.3491965Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:29.3492588Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:29.3493212Z  f.write(f"{key}={value}\n") 2025-09-07T06:09:29.3493734Z  2025-09-07T06:09:29.3494111Z  2025-09-07T06:09:29.3494662Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:29.3495364Z  return frozenset( 2025-09-07T06:09:29.3496066Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:29.3496928Z  ) 2025-09-07T06:09:29.3497332Z  2025-09-07T06:09:29.3497698Z  2025-09-07T06:09:29.3498093Z def parse_args() -> Any: 2025-09-07T06:09:29.3498748Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:29.3499687Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:29.3500517Z  parser.add_argument( 2025-09-07T06:09:29.3501044Z  "--github-issue-repo", 2025-09-07T06:09:29.3501577Z  type=str, 2025-09-07T06:09:29.3502060Z  required=False, 2025-09-07T06:09:29.3502747Z  default="pytorch/test-infra", 2025-09-07T06:09:29.3503366Z  help="GitHub repo to get the issue", 2025-09-07T06:09:29.3503916Z  ) 2025-09-07T06:09:29.3504340Z  parser.add_argument( 2025-09-07T06:09:29.3504848Z  "--github-repo", 2025-09-07T06:09:29.3505347Z  type=str, 2025-09-07T06:09:29.3505821Z  required=True, 2025-09-07T06:09:29.3506474Z  help="GitHub repo where CI is running", 2025-09-07T06:09:29.3507037Z  ) 2025-09-07T06:09:29.3507465Z  parser.add_argument( 2025-09-07T06:09:29.3508165Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:29.3508866Z  ) 2025-09-07T06:09:29.3509283Z  parser.add_argument( 2025-09-07T06:09:29.3509990Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:29.3510718Z  ) 2025-09-07T06:09:29.3511133Z  parser.add_argument( 2025-09-07T06:09:29.3511858Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:29.3512592Z  ) 2025-09-07T06:09:29.3513012Z  parser.add_argument( 2025-09-07T06:09:29.3513765Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:29.3514514Z  ) 2025-09-07T06:09:29.3514950Z  parser.add_argument( 2025-09-07T06:09:29.3515469Z  "--github-ref-type", 2025-09-07T06:09:29.3515986Z  type=str, 2025-09-07T06:09:29.3516628Z  required=True, 2025-09-07T06:09:29.3517221Z  help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:29.3517812Z  ) 2025-09-07T06:09:29.3518234Z  parser.add_argument( 2025-09-07T06:09:29.3518764Z  "--eligible-experiments", 2025-09-07T06:09:29.3519501Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:29.3520071Z  required=False, 2025-09-07T06:09:29.3520565Z  default="", 2025-09-07T06:09:29.3521510Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:29.3522486Z  ) 2025-09-07T06:09:29.3522912Z  parser.add_argument( 2025-09-07T06:09:29.3523446Z  "--opt-out-experiments", 2025-09-07T06:09:29.3524026Z  type=_str_comma_separated_to_set, 2025-09-07T06:09:29.3524590Z  required=False, 2025-09-07T06:09:29.3525087Z  default="", 2025-09-07T06:09:29.3525552Z  help=( 2025-09-07T06:09:29.3526424Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:29.3527628Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:29.3528515Z  ), 2025-09-07T06:09:29.3528929Z  ) 2025-09-07T06:09:29.3529347Z  parser.add_argument( 2025-09-07T06:09:29.3529860Z  "--pr-number", 2025-09-07T06:09:29.3530355Z  type=str, 2025-09-07T06:09:29.3530825Z  required=False, 2025-09-07T06:09:29.3531319Z  default="", 2025-09-07T06:09:29.3531882Z  help="the optional PR number where this is run", 2025-09-07T06:09:29.3532483Z  ) 2025-09-07T06:09:29.3532867Z  2025-09-07T06:09:29.3533290Z  return parser.parse_args() 2025-09-07T06:09:29.3533809Z  2025-09-07T06:09:29.3534175Z  2025-09-07T06:09:29.3534817Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.3535760Z  auth = Auth.Token(github_token) 2025-09-07T06:09:29.3536467Z  return Github(auth=auth) 2025-09-07T06:09:29.3536981Z  2025-09-07T06:09:29.3537347Z  2025-09-07T06:09:29.3538046Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.3538912Z  repo = gh.get_repo(repo) 2025-09-07T06:09:29.3539495Z  return repo.get_issue(number=issue_num) 2025-09-07T06:09:29.3540054Z  2025-09-07T06:09:29.3540424Z  2025-09-07T06:09:29.3540820Z def get_potential_pr_author( 2025-09-07T06:09:29.3541544Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:29.3542265Z ) -> str: 2025-09-07T06:09:29.3542863Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:29.3543736Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:29.3544564Z  # embedded in the tag name: ciflow// 2025-09-07T06:09:29.3545191Z  2025-09-07T06:09:29.3545609Z  gh = get_gh_client(github_token) 2025-09-07T06:09:29.3546151Z  2025-09-07T06:09:29.3546776Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:29.3547476Z  split_tag = ref_name.split("/") 2025-09-07T06:09:29.3548032Z  if ( 2025-09-07T06:09:29.3548478Z  len(split_tag) == 3 2025-09-07T06:09:29.3549040Z  and split_tag[0] == "ciflow" 2025-09-07T06:09:29.3549629Z  and split_tag[2].isnumeric() 2025-09-07T06:09:29.3550173Z  ): 2025-09-07T06:09:29.3550629Z  pr_number = split_tag[2] 2025-09-07T06:09:29.3551173Z  try: 2025-09-07T06:09:29.3551670Z  repository = gh.get_repo(repo) 2025-09-07T06:09:29.3552350Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:29.3553170Z  except Exception as e: 2025-09-07T06:09:29.3553753Z  raise Exception( # noqa: TRY002 2025-09-07T06:09:29.3554490Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:29.3555183Z  ) from e 2025-09-07T06:09:29.3555812Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:29.3556692Z  # In all other cases, return the original input username 2025-09-07T06:09:29.3557331Z  return username 2025-09-07T06:09:29.3557789Z  2025-09-07T06:09:29.3558153Z  2025-09-07T06:09:29.3558618Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:29.3559189Z  """ 2025-09-07T06:09:29.3559911Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:29.3560749Z  """ 2025-09-07T06:09:29.3561360Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:29.3562073Z  2025-09-07T06:09:29.3562439Z  2025-09-07T06:09:29.3562869Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:29.3563411Z  try: 2025-09-07T06:09:29.3563868Z  data = yaml.safe_load(yaml_text) 2025-09-07T06:09:29.3564421Z  return data 2025-09-07T06:09:29.3564915Z  except yaml.YAMLError: 2025-09-07T06:09:29.3565485Z  log.exception("Error loading YAML") 2025-09-07T06:09:29.3566041Z  raise 2025-09-07T06:09:29.3566568Z  2025-09-07T06:09:29.3566934Z  2025-09-07T06:09:29.3567609Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:29.3568393Z  """ 2025-09-07T06:09:29.3569211Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:29.3570017Z  2025-09-07T06:09:29.3570605Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.3571448Z  and the text below is the list of opted in users. 2025-09-07T06:09:29.3572046Z  2025-09-07T06:09:29.3572664Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:29.3573408Z  """ 2025-09-07T06:09:29.3573922Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:29.3574577Z  if len(rollout_state_parts) >= 2: 2025-09-07T06:09:29.3575260Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:29.3575902Z  else: 2025-09-07T06:09:29.3576557Z  return "", rollout_state 2025-09-07T06:09:29.3577203Z  2025-09-07T06:09:29.3577572Z  2025-09-07T06:09:29.3578015Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:29.3578566Z  """ 2025-09-07T06:09:29.3579153Z  Dictionary of users with a list of features they have opted into 2025-09-07T06:09:29.3579837Z  """ 2025-09-07T06:09:29.3580219Z  2025-09-07T06:09:29.3580587Z  2025-09-07T06:09:29.3581169Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:29.3581878Z  """ 2025-09-07T06:09:29.3582656Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:29.3583540Z  2025-09-07T06:09:29.3584391Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:29.3585448Z  - Example line: "@User1,lf,split_build" 2025-09-07T06:09:29.3586196Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:29.3587132Z  2025-09-07T06:09:29.3587497Z  2025-09-07T06:09:29.3587855Z  """ 2025-09-07T06:09:29.3588273Z  optins = UserOptins() 2025-09-07T06:09:29.3588840Z  for user in user_optin_text.split("\n"): 2025-09-07T06:09:29.3589457Z  user = user.strip("\r\n\t -") 2025-09-07T06:09:29.3590065Z  if not user or not user.startswith("@"): 2025-09-07T06:09:29.3590666Z  # Not a valid user. Skip 2025-09-07T06:09:29.3591205Z  continue 2025-09-07T06:09:29.3591652Z  2025-09-07T06:09:29.3592029Z  if user: 2025-09-07T06:09:29.3592571Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:29.3593325Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:29.3594002Z  2025-09-07T06:09:29.3594383Z  return optins 2025-09-07T06:09:29.3594834Z  2025-09-07T06:09:29.3595190Z  2025-09-07T06:09:29.3595730Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:29.3596499Z  """ 2025-09-07T06:09:29.3596969Z  Check if the experiment name is valid. 2025-09-07T06:09:29.3597537Z  A valid name: 2025-09-07T06:09:29.3598262Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:29.3599252Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:29.3600011Z  - Cannot contain spaces 2025-09-07T06:09:29.3600523Z  """ 2025-09-07T06:09:29.3600910Z  2025-09-07T06:09:29.3601412Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:29.3602185Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:29.3602950Z  2025-09-07T06:09:29.3603333Z  if valid: 2025-09-07T06:09:29.3603770Z  return True 2025-09-07T06:09:29.3604215Z  2025-09-07T06:09:29.3604583Z  log.error( 2025-09-07T06:09:29.3606109Z  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-09-07T06:09:29.3607815Z  ) 2025-09-07T06:09:29.3608217Z  return False 2025-09-07T06:09:29.3608665Z  2025-09-07T06:09:29.3609022Z  2025-09-07T06:09:29.3609577Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:29.3610248Z  """ 2025-09-07T06:09:29.3610906Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:29.3611664Z  """ 2025-09-07T06:09:29.3612066Z  try: 2025-09-07T06:09:29.3612479Z  if settings_text: 2025-09-07T06:09:29.3613287Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:29.3614127Z  # for easy reading 2025-09-07T06:09:29.3614997Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:29.3615945Z  # the backtick character in shell commands. 2025-09-07T06:09:29.3616707Z  backtick = chr(96) # backtick character 2025-09-07T06:09:29.3617440Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:29.3618159Z  settings = load_yaml(settings_text) 2025-09-07T06:09:29.3618706Z  2025-09-07T06:09:29.3619351Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:29.3620261Z  experiments = {} 2025-09-07T06:09:29.3620762Z  2025-09-07T06:09:29.3621361Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:29.3622170Z  if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:29.3623333Z  # 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-09-07T06:09:29.3624412Z  continue 2025-09-07T06:09:29.3624901Z  2025-09-07T06:09:29.3625302Z  valid_settings = {} 2025-09-07T06:09:29.3625881Z  for setting in exp_settings: 2025-09-07T06:09:29.3626799Z  if setting not in Experiment._fields: 2025-09-07T06:09:29.3627418Z  log.warning( 2025-09-07T06:09:29.3628207Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:29.3628958Z  ) 2025-09-07T06:09:29.3629443Z  else: 2025-09-07T06:09:29.3630038Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:29.3630646Z  2025-09-07T06:09:29.3631155Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:29.3631838Z  return Settings(experiments) 2025-09-07T06:09:29.3632371Z  2025-09-07T06:09:29.3632755Z  except Exception: 2025-09-07T06:09:29.3633316Z  log.exception("Failed to parse settings") 2025-09-07T06:09:29.3633893Z  2025-09-07T06:09:29.3634273Z  return Settings() 2025-09-07T06:09:29.3634736Z  2025-09-07T06:09:29.3635088Z  2025-09-07T06:09:29.3635763Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:29.3636511Z  """ 2025-09-07T06:09:29.3637012Z  Parse settings, if any, from the rollout state. 2025-09-07T06:09:29.3637596Z  2025-09-07T06:09:29.3638175Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.3638998Z  and the text below is the list of opted in users. 2025-09-07T06:09:29.3639584Z  2025-09-07T06:09:29.3640220Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:29.3640989Z  """ 2025-09-07T06:09:29.3641605Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.3642423Z  return parse_settings_from_text(settings_text) 2025-09-07T06:09:29.3643005Z  2025-09-07T06:09:29.3643365Z  2025-09-07T06:09:29.3643851Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:29.3644467Z  """ 2025-09-07T06:09:29.3644907Z  Parse users from the rollout state. 2025-09-07T06:09:29.3645452Z  2025-09-07T06:09:29.3645809Z  """ 2025-09-07T06:09:29.3646509Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.3647321Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:29.3647904Z  2025-09-07T06:09:29.3648265Z  2025-09-07T06:09:29.3648926Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.3649713Z  """ 2025-09-07T06:09:29.3650183Z  Check if a user is opted into an experiment 2025-09-07T06:09:29.3650754Z  """ 2025-09-07T06:09:29.3651265Z  return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:29.3651885Z  2025-09-07T06:09:29.3652244Z  2025-09-07T06:09:29.3653049Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.3653846Z  """ 2025-09-07T06:09:29.3654359Z  Check if a user explicitly opted out of an experiment 2025-09-07T06:09:29.3654975Z  """ 2025-09-07T06:09:29.3655538Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:29.3656388Z  experiment_optout = "-" + experiment_name 2025-09-07T06:09:29.3657093Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:29.3657736Z  return False 2025-09-07T06:09:29.3658197Z  2025-09-07T06:09:29.3658696Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:29.3659342Z  log.warning( 2025-09-07T06:09:29.3660226Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:29.3661145Z  ) 2025-09-07T06:09:29.3661547Z  2025-09-07T06:09:29.3661919Z  return True 2025-09-07T06:09:29.3662354Z  2025-09-07T06:09:29.3662717Z  2025-09-07T06:09:29.3663110Z def get_runner_prefix( 2025-09-07T06:09:29.3663605Z  rollout_state: str, 2025-09-07T06:09:29.3664139Z  workflow_requestors: Iterable[str], 2025-09-07T06:09:29.3664690Z  branch: str, 2025-09-07T06:09:29.3665268Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.3666005Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.3666728Z  is_canary: bool = False, 2025-09-07T06:09:29.3667236Z ) -> str: 2025-09-07T06:09:29.3667723Z  settings = parse_settings(rollout_state) 2025-09-07T06:09:29.3668361Z  user_optins = parse_users(rollout_state) 2025-09-07T06:09:29.3668910Z  2025-09-07T06:09:29.3669426Z  fleet_prefix = "" 2025-09-07T06:09:29.3669919Z  prefixes = [] 2025-09-07T06:09:29.3670624Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:29.3671622Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:29.3672373Z  log.info( 2025-09-07T06:09:29.3673126Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:29.3673915Z  ) 2025-09-07T06:09:29.3674363Z  continue 2025-09-07T06:09:29.3674813Z  2025-09-07T06:09:29.3675221Z  if opt_out_experiments: 2025-09-07T06:09:29.3675829Z  if experiment_name in opt_out_experiments: 2025-09-07T06:09:29.3676639Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:29.3677282Z  log.info( 2025-09-07T06:09:29.3678272Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:29.3679280Z  ) 2025-09-07T06:09:29.3679739Z  continue 2025-09-07T06:09:29.3680210Z  2025-09-07T06:09:29.3680616Z  if eligible_experiments: 2025-09-07T06:09:29.3681238Z  if experiment_name not in eligible_experiments: 2025-09-07T06:09:29.3681921Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:29.3682505Z  log.info( 2025-09-07T06:09:29.3683362Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:29.3684234Z  ) 2025-09-07T06:09:29.3684689Z  continue 2025-09-07T06:09:29.3685367Z  elif not experiment_settings.default: 2025-09-07T06:09:29.3685937Z  log.info( 2025-09-07T06:09:29.3686773Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:29.3687541Z  ) 2025-09-07T06:09:29.3687974Z  continue 2025-09-07T06:09:29.3688425Z  2025-09-07T06:09:29.3688931Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:29.3689595Z  opted_out_users = [ 2025-09-07T06:09:29.3690100Z  requestor 2025-09-07T06:09:29.3690635Z  for requestor in workflow_requestors 2025-09-07T06:09:29.3691358Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.3692022Z  ] 2025-09-07T06:09:29.3692425Z  2025-09-07T06:09:29.3692814Z  if opted_out_users: 2025-09-07T06:09:29.3693358Z  log.info( 2025-09-07T06:09:29.3694045Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:29.3694773Z  ) 2025-09-07T06:09:29.3695201Z  continue 2025-09-07T06:09:29.3695656Z  2025-09-07T06:09:29.3696151Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:29.3696953Z  opted_in_users = [ 2025-09-07T06:09:29.3697478Z  requestor 2025-09-07T06:09:29.3698017Z  for requestor in workflow_requestors 2025-09-07T06:09:29.3698748Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.3699402Z  ] 2025-09-07T06:09:29.3699808Z  2025-09-07T06:09:29.3700190Z  enabled = False 2025-09-07T06:09:29.3700693Z  if opted_in_users: 2025-09-07T06:09:29.3701325Z  log.info( 2025-09-07T06:09:29.3702012Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:29.3702731Z  ) 2025-09-07T06:09:29.3703175Z  enabled = True 2025-09-07T06:09:29.3703672Z  2025-09-07T06:09:29.3704108Z  elif experiment_settings.rollout_perc: 2025-09-07T06:09:29.3705000Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:29.3706010Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:29.3706810Z  log.info( 2025-09-07T06:09:29.3707750Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:29.3708702Z  ) 2025-09-07T06:09:29.3709185Z  enabled = True 2025-09-07T06:09:29.3709694Z  2025-09-07T06:09:29.3710076Z  if enabled: 2025-09-07T06:09:29.3710572Z  label = experiment_name 2025-09-07T06:09:29.3711179Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:29.3712064Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:29.3712995Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:29.3713816Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:29.3714525Z  if is_canary: 2025-09-07T06:09:29.3715079Z  label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:29.3715673Z  fleet_prefix = label 2025-09-07T06:09:29.3716207Z  else: 2025-09-07T06:09:29.3716808Z  prefixes.append(label) 2025-09-07T06:09:29.3717472Z  2025-09-07T06:09:29.3717863Z  if len(prefixes) > 1: 2025-09-07T06:09:29.3718369Z  log.error( 2025-09-07T06:09:29.3719477Z  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-09-07T06:09:29.3720632Z  ) 2025-09-07T06:09:29.3721066Z  prefixes = prefixes[:1] 2025-09-07T06:09:29.3721579Z  2025-09-07T06:09:29.3721978Z  # Fleet always comes first 2025-09-07T06:09:29.3722509Z  if fleet_prefix: 2025-09-07T06:09:29.3723028Z  prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:29.3723575Z  2025-09-07T06:09:29.3724064Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:29.3724662Z  2025-09-07T06:09:29.3725030Z  2025-09-07T06:09:29.3725714Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:29.3726626Z  """ 2025-09-07T06:09:29.3727264Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:29.3728018Z  2025-09-07T06:09:29.3728634Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:29.3729373Z  """ 2025-09-07T06:09:29.3729815Z  gh = get_gh_client(github_token) 2025-09-07T06:09:29.3730417Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:29.3731116Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:29.3731742Z  2025-09-07T06:09:29.3732112Z  2025-09-07T06:09:29.3732749Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:29.3733672Z  for _ in range(num_retries): 2025-09-07T06:09:29.3734217Z  try: 2025-09-07T06:09:29.3734705Z  req = Request(url=url, headers=headers) 2025-09-07T06:09:29.3735422Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:29.3736117Z  return json.loads(content) 2025-09-07T06:09:29.3736795Z  except Exception as e: 2025-09-07T06:09:29.3737416Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:29.3737999Z  2025-09-07T06:09:29.3738612Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:29.3739365Z  return {} 2025-09-07T06:09:29.3739798Z  2025-09-07T06:09:29.3740154Z  2025-09-07T06:09:29.3740521Z @cache 2025-09-07T06:09:29.3741207Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:29.3742003Z  """ 2025-09-07T06:09:29.3742452Z  Dynamically get PR information 2025-09-07T06:09:29.3742975Z  """ 2025-09-07T06:09:29.3743527Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:29.3744186Z  headers = { 2025-09-07T06:09:29.3744726Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:29.3745384Z  "Authorization": f"token {github_token}", 2025-09-07T06:09:29.3745954Z  } 2025-09-07T06:09:29.3746546Z  json_response: dict[str, Any] = download_json( 2025-09-07T06:09:29.3747203Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:29.3747786Z  headers=headers, 2025-09-07T06:09:29.3748262Z  ) 2025-09-07T06:09:29.3748644Z  2025-09-07T06:09:29.3749036Z  if not json_response: 2025-09-07T06:09:29.3749684Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:29.3750483Z  return {} 2025-09-07T06:09:29.3750930Z  2025-09-07T06:09:29.3751325Z  return json_response 2025-09-07T06:09:29.3751801Z  2025-09-07T06:09:29.3752169Z  2025-09-07T06:09:29.3752800Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:29.3753567Z  """ 2025-09-07T06:09:29.3754144Z  Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:29.3754835Z  """ 2025-09-07T06:09:29.3755378Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:29.3756019Z  return { 2025-09-07T06:09:29.3756772Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:29.3757492Z  } 2025-09-07T06:09:29.3757880Z  2025-09-07T06:09:29.3758241Z  2025-09-07T06:09:29.3758632Z def main() -> None: 2025-09-07T06:09:29.3759113Z  args = parse_args() 2025-09-07T06:09:29.3759585Z  2025-09-07T06:09:29.3760037Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:29.3760605Z  2025-09-07T06:09:29.3761014Z  # Check if the PR is opt-out 2025-09-07T06:09:29.3761554Z  if args.pr_number: 2025-09-07T06:09:29.3762287Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:29.3763080Z  if OPT_OUT_LABEL in labels: 2025-09-07T06:09:29.3763620Z  log.info( 2025-09-07T06:09:29.3764382Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:29.3765174Z  ) 2025-09-07T06:09:29.3765794Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.3766606Z  sys.exit() 2025-09-07T06:09:29.3767204Z  2025-09-07T06:09:29.3767576Z  try: 2025-09-07T06:09:29.3768066Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:29.3768833Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:29.3769500Z  ) 2025-09-07T06:09:29.3769901Z  2025-09-07T06:09:29.3770325Z  username = get_potential_pr_author( 2025-09-07T06:09:29.3770908Z  args.github_token, 2025-09-07T06:09:29.3771440Z  args.github_repo, 2025-09-07T06:09:29.3771976Z  args.github_actor, 2025-09-07T06:09:29.3772516Z  args.github_ref_type, 2025-09-07T06:09:29.3773066Z  args.github_branch, 2025-09-07T06:09:29.3773581Z  ) 2025-09-07T06:09:29.3773980Z  2025-09-07T06:09:29.3774500Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:29.3775145Z  2025-09-07T06:09:29.3775594Z  runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:29.3776182Z  rollout_state, 2025-09-07T06:09:29.3776843Z  (args.github_issue_owner, username), 2025-09-07T06:09:29.3777438Z  args.github_branch, 2025-09-07T06:09:29.3777996Z  args.eligible_experiments, 2025-09-07T06:09:29.3778590Z  args.opt_out_experiments, 2025-09-07T06:09:29.3779135Z  is_canary, 2025-09-07T06:09:29.3779604Z  ) 2025-09-07T06:09:29.3779998Z  2025-09-07T06:09:29.3780397Z  except Exception as e: 2025-09-07T06:09:29.3780904Z  log.error( 2025-09-07T06:09:29.3781656Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:29.3782444Z  ) 2025-09-07T06:09:29.3782844Z  2025-09-07T06:09:29.3783542Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.3784222Z  2025-09-07T06:09:29.3784597Z  2025-09-07T06:09:29.3784986Z if __name__ == "__main__": 2025-09-07T06:09:29.3785483Z  main() 2025-09-07T06:09:29.3785890Z  2025-09-07T06:09:29.3786356Z EOF 2025-09-07T06:09:29.3786740Z  2025-09-07T06:09:29.3787142Z cat runner_determinator.py 2025-09-07T06:09:29.5088776Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:29.5089694Z env: 2025-09-07T06:09:29.5090495Z GITHUB_TOKEN: *** 2025-09-07T06:09:29.5091000Z ISSUE_NUMBER: 5132 2025-09-07T06:09:29.5091547Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:29.5092164Z ISSUE_OWNER: 2025-09-07T06:09:29.5092652Z CHECK_EXPERIMENTS: 2025-09-07T06:09:29.5093178Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:29.5093697Z PR_NUMBER: 2025-09-07T06:09:29.5094156Z ##[endgroup] 2025-09-07T06:09:29.5301919Z # flake8: noqa: G004 2025-09-07T06:09:29.5302314Z 2025-09-07T06:09:29.5302750Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T06:09:29.5303675Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T06:09:29.5304470Z # python .github/scripts/update_runner_determinator.py 2025-09-07T06:09:29.5304907Z 2025-09-07T06:09:29.5305067Z """ 2025-09-07T06:09:29.5305632Z This runner determinator is used to determine which set of runners to run a 2025-09-07T06:09:29.5306742Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T06:09:29.5307639Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T06:09:29.5308438Z of which runners should be used to run which job. 2025-09-07T06:09:29.5308834Z 2025-09-07T06:09:29.5309216Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T06:09:29.5310294Z separated by a line containing "---". If the line is not present, the 2025-09-07T06:09:29.5311189Z settings are considered to be empty with only the second part, the user 2025-09-07T06:09:29.5311874Z list, defined. 2025-09-07T06:09:29.5312105Z 2025-09-07T06:09:29.5312461Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T06:09:29.5313364Z used to define any settings that are needed to determine which runners to use. 2025-09-07T06:09:29.5314179Z It's fields are defined by the RolloutSettings class below. 2025-09-07T06:09:29.5314610Z 2025-09-07T06:09:29.5314973Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T06:09:29.5315816Z The user list is also a comma separated list of additional features or 2025-09-07T06:09:29.5316797Z experiments which the user could be opted in to. 2025-09-07T06:09:29.5317197Z 2025-09-07T06:09:29.5317395Z The user list has the following rules: 2025-09-07T06:09:29.5317743Z 2025-09-07T06:09:29.5318055Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T06:09:29.5318893Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T06:09:29.5319652Z - A "#" prefix opts the user out of all experiments 2025-09-07T06:09:29.5320042Z 2025-09-07T06:09:29.5320214Z Example config: 2025-09-07T06:09:29.5320662Z # A list of experiments that can be opted into. 2025-09-07T06:09:29.5321318Z # This defines the behavior they'll induce when opted into. 2025-09-07T06:09:29.5321927Z # Expected syntax is: 2025-09-07T06:09:29.5322555Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T06:09:29.5323504Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T06:09:29.5324103Z 2025-09-07T06:09:29.5324268Z experiments: 2025-09-07T06:09:29.5324659Z lf: 2025-09-07T06:09:29.5325028Z rollout_percent: 25 2025-09-07T06:09:29.5325474Z all_branches: false 2025-09-07T06:09:29.5326069Z default: true 2025-09-07T06:09:29.5326741Z --- 2025-09-07T06:09:29.5326949Z 2025-09-07T06:09:29.5327110Z # Opt-ins: 2025-09-07T06:09:29.5327688Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T06:09:29.5328539Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T06:09:29.5329295Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T06:09:29.5329938Z # Experiments should be from the above list. 2025-09-07T06:09:29.5330310Z 2025-09-07T06:09:29.5330487Z @User1,-lf,split_build 2025-09-07T06:09:29.5330914Z @User2,lf 2025-09-07T06:09:29.5331286Z @User3,split_build 2025-09-07T06:09:29.5331687Z """ 2025-09-07T06:09:29.5331878Z 2025-09-07T06:09:29.5332041Z import json 2025-09-07T06:09:29.5332404Z import logging 2025-09-07T06:09:29.5332778Z import os 2025-09-07T06:09:29.5333143Z import random 2025-09-07T06:09:29.5333517Z import re 2025-09-07T06:09:29.5333875Z import sys 2025-09-07T06:09:29.5334305Z from argparse import ArgumentParser 2025-09-07T06:09:29.5334819Z from collections.abc import Iterable 2025-09-07T06:09:29.5335329Z from functools import cache 2025-09-07T06:09:29.5335787Z from logging import LogRecord 2025-09-07T06:09:29.5336478Z from typing import Any, NamedTuple 2025-09-07T06:09:29.5337037Z from urllib.request import Request, urlopen 2025-09-07T06:09:29.5337416Z 2025-09-07T06:09:29.5337582Z import yaml 2025-09-07T06:09:29.5337968Z from github import Auth, Github 2025-09-07T06:09:29.5338452Z from github.Issue import Issue 2025-09-07T06:09:29.5338746Z 2025-09-07T06:09:29.5338753Z 2025-09-07T06:09:29.5338967Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T06:09:29.5339641Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T06:09:29.5340501Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T06:09:29.5341044Z 2025-09-07T06:09:29.5341268Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T06:09:29.5341982Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T06:09:29.5342498Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T06:09:29.5343041Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T06:09:29.5343386Z 2025-09-07T06:09:29.5343585Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T06:09:29.5343914Z 2025-09-07T06:09:29.5344096Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T06:09:29.5344554Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T06:09:29.5344829Z 2025-09-07T06:09:29.5344836Z 2025-09-07T06:09:29.5345023Z class Experiment(NamedTuple): 2025-09-07T06:09:29.5345500Z rollout_perc: float = ( 2025-09-07T06:09:29.5346116Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T06:09:29.5347295Z ) 2025-09-07T06:09:29.5347675Z all_branches: bool = ( 2025-09-07T06:09:29.5348288Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T06:09:29.5348949Z ) 2025-09-07T06:09:29.5349303Z default: bool = ( 2025-09-07T06:09:29.5349878Z True # If True, the experiment is enabled by default for all queries 2025-09-07T06:09:29.5350503Z ) 2025-09-07T06:09:29.5350701Z 2025-09-07T06:09:29.5350880Z # Add more fields as needed 2025-09-07T06:09:29.5351175Z 2025-09-07T06:09:29.5351183Z 2025-09-07T06:09:29.5351371Z class Settings(NamedTuple): 2025-09-07T06:09:29.5351801Z """ 2025-09-07T06:09:29.5352242Z Settings for the experiments that can be opted into. 2025-09-07T06:09:29.5352794Z """ 2025-09-07T06:09:29.5352985Z 2025-09-07T06:09:29.5353195Z experiments: dict[str, Experiment] = {} 2025-09-07T06:09:29.5353550Z 2025-09-07T06:09:29.5353558Z 2025-09-07T06:09:29.5353764Z class ColorFormatter(logging.Formatter): 2025-09-07T06:09:29.5354374Z """Color codes the log messages based on the log level""" 2025-09-07T06:09:29.5354797Z 2025-09-07T06:09:29.5354961Z COLORS = { 2025-09-07T06:09:29.5355352Z "WARNING": "\033[33m", # Yellow 2025-09-07T06:09:29.5355847Z "ERROR": "\033[31m", # Red 2025-09-07T06:09:29.5356711Z "CRITICAL": "\033[31m", # Red 2025-09-07T06:09:29.5357224Z "INFO": "\033[0m", # Reset 2025-09-07T06:09:29.5357691Z "DEBUG": "\033[0m", # Reset 2025-09-07T06:09:29.5358154Z } 2025-09-07T06:09:29.5358341Z 2025-09-07T06:09:29.5358553Z def format(self, record: LogRecord) -> str: 2025-09-07T06:09:29.5359287Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T06:09:29.5360050Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T06:09:29.5360608Z return super().format(record) 2025-09-07T06:09:29.5360930Z 2025-09-07T06:09:29.5360938Z 2025-09-07T06:09:29.5361131Z handler = logging.StreamHandler() 2025-09-07T06:09:29.5361812Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T06:09:29.5362359Z 2025-09-07T06:09:29.5362598Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T06:09:29.5363161Z log.addHandler(handler) 2025-09-07T06:09:29.5363601Z log.setLevel(logging.INFO) 2025-09-07T06:09:29.5363883Z 2025-09-07T06:09:29.5363890Z 2025-09-07T06:09:29.5364136Z def set_github_output(key: str, value: str) -> None: 2025-09-07T06:09:29.5364680Z """ 2025-09-07T06:09:29.5365172Z Defines outputs of the github action that invokes this script 2025-09-07T06:09:29.5365785Z """ 2025-09-07T06:09:29.5366142Z if not GITHUB_OUTPUT: 2025-09-07T06:09:29.5367341Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T06:09:29.5368441Z log.warning( 2025-09-07T06:09:29.5369276Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T06:09:29.5370186Z ) 2025-09-07T06:09:29.5380293Z print(f"::set-output name={key}::{value}") 2025-09-07T06:09:29.5380908Z return 2025-09-07T06:09:29.5381146Z 2025-09-07T06:09:29.5381522Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T06:09:29.5382116Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T06:09:29.5382686Z f.write(f"{key}={value}\n") 2025-09-07T06:09:29.5383010Z 2025-09-07T06:09:29.5383017Z 2025-09-07T06:09:29.5383319Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T06:09:29.5383937Z return frozenset( 2025-09-07T06:09:29.5384538Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T06:09:29.5385208Z ) 2025-09-07T06:09:29.5385408Z 2025-09-07T06:09:29.5385415Z 2025-09-07T06:09:29.5385597Z def parse_args() -> Any: 2025-09-07T06:09:29.5386143Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T06:09:29.5387197Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T06:09:29.5387966Z parser.add_argument( 2025-09-07T06:09:29.5388425Z "--github-issue-repo", 2025-09-07T06:09:29.5388886Z type=str, 2025-09-07T06:09:29.5389286Z required=False, 2025-09-07T06:09:29.5389749Z default="pytorch/test-infra", 2025-09-07T06:09:29.5390285Z help="GitHub repo to get the issue", 2025-09-07T06:09:29.5390794Z ) 2025-09-07T06:09:29.5391153Z parser.add_argument( 2025-09-07T06:09:29.5391600Z "--github-repo", 2025-09-07T06:09:29.5392021Z type=str, 2025-09-07T06:09:29.5392411Z required=True, 2025-09-07T06:09:29.5392860Z help="GitHub repo where CI is running", 2025-09-07T06:09:29.5393380Z ) 2025-09-07T06:09:29.5393746Z parser.add_argument( 2025-09-07T06:09:29.5394337Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T06:09:29.5394988Z ) 2025-09-07T06:09:29.5395343Z parser.add_argument( 2025-09-07T06:09:29.5395954Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T06:09:29.5447464Z ) 2025-09-07T06:09:29.5448286Z parser.add_argument( 2025-09-07T06:09:29.5449477Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T06:09:29.5450406Z ) 2025-09-07T06:09:29.5450792Z parser.add_argument( 2025-09-07T06:09:29.5451446Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T06:09:29.5452165Z ) 2025-09-07T06:09:29.5452529Z parser.add_argument( 2025-09-07T06:09:29.5452978Z "--github-ref-type", 2025-09-07T06:09:29.5453416Z type=str, 2025-09-07T06:09:29.5453802Z required=True, 2025-09-07T06:09:29.5454277Z help="Current GitHub ref type, branch or tag", 2025-09-07T06:09:29.5454820Z ) 2025-09-07T06:09:29.5455195Z parser.add_argument( 2025-09-07T06:09:29.5455648Z "--eligible-experiments", 2025-09-07T06:09:29.5456159Z type=_str_comma_separated_to_set, 2025-09-07T06:09:29.5456933Z required=False, 2025-09-07T06:09:29.5457355Z default="", 2025-09-07T06:09:29.5458190Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T06:09:29.5459106Z ) 2025-09-07T06:09:29.5459465Z parser.add_argument( 2025-09-07T06:09:29.5459913Z "--opt-out-experiments", 2025-09-07T06:09:29.5460403Z type=_str_comma_separated_to_set, 2025-09-07T06:09:29.5460908Z required=False, 2025-09-07T06:09:29.5461320Z default="", 2025-09-07T06:09:29.5461701Z help=( 2025-09-07T06:09:29.5462358Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T06:09:29.5463459Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T06:09:29.5464271Z ), 2025-09-07T06:09:29.5464614Z ) 2025-09-07T06:09:29.5464978Z parser.add_argument( 2025-09-07T06:09:29.5465400Z "--pr-number", 2025-09-07T06:09:29.5465807Z type=str, 2025-09-07T06:09:29.5466190Z required=False, 2025-09-07T06:09:29.5466799Z default="", 2025-09-07T06:09:29.5467405Z help="the optional PR number where this is run", 2025-09-07T06:09:29.5467960Z ) 2025-09-07T06:09:29.5468156Z 2025-09-07T06:09:29.5468349Z return parser.parse_args() 2025-09-07T06:09:29.5468650Z 2025-09-07T06:09:29.5468657Z 2025-09-07T06:09:29.5469050Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.5469796Z auth = Auth.Token(github_token) 2025-09-07T06:09:29.5470290Z return Github(auth=auth) 2025-09-07T06:09:29.5470581Z 2025-09-07T06:09:29.5470589Z 2025-09-07T06:09:29.5471029Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T06:09:29.5471814Z repo = gh.get_repo(repo) 2025-09-07T06:09:29.5472296Z return repo.get_issue(number=issue_num) 2025-09-07T06:09:29.5472660Z 2025-09-07T06:09:29.5472667Z 2025-09-07T06:09:29.5472850Z def get_potential_pr_author( 2025-09-07T06:09:29.5473476Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T06:09:29.5474139Z ) -> str: 2025-09-07T06:09:29.5474645Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T06:09:29.5475418Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T06:09:29.5476145Z # embedded in the tag name: ciflow// 2025-09-07T06:09:29.5476750Z 2025-09-07T06:09:29.5476942Z gh = get_gh_client(github_token) 2025-09-07T06:09:29.5477276Z 2025-09-07T06:09:29.5477538Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T06:09:29.5478142Z split_tag = ref_name.split("/") 2025-09-07T06:09:29.5478640Z if ( 2025-09-07T06:09:29.5479025Z len(split_tag) == 3 2025-09-07T06:09:29.5479490Z and split_tag[0] == "ciflow" 2025-09-07T06:09:29.5480004Z and split_tag[2].isnumeric() 2025-09-07T06:09:29.5480478Z ): 2025-09-07T06:09:29.5480858Z pr_number = split_tag[2] 2025-09-07T06:09:29.5481320Z try: 2025-09-07T06:09:29.5481970Z repository = gh.get_repo(repo) 2025-09-07T06:09:29.5482563Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T06:09:29.5483151Z except Exception as e: 2025-09-07T06:09:29.5483653Z raise Exception( # noqa: TRY002 2025-09-07T06:09:29.5484308Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T06:09:29.5484936Z ) from e 2025-09-07T06:09:29.5485449Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T06:09:29.5486127Z # In all other cases, return the original input username 2025-09-07T06:09:29.5486957Z return username 2025-09-07T06:09:29.5487200Z 2025-09-07T06:09:29.5487207Z 2025-09-07T06:09:29.5487424Z def is_exception_branch(branch: str) -> bool: 2025-09-07T06:09:29.5487944Z """ 2025-09-07T06:09:29.5488567Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T06:09:29.5489328Z """ 2025-09-07T06:09:29.5489851Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T06:09:29.5490357Z 2025-09-07T06:09:29.5490365Z 2025-09-07T06:09:29.5490560Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T06:09:29.5491037Z try: 2025-09-07T06:09:29.5491413Z data = yaml.safe_load(yaml_text) 2025-09-07T06:09:29.5491906Z return data 2025-09-07T06:09:29.5492313Z except yaml.YAMLError: 2025-09-07T06:09:29.5492779Z log.exception("Error loading YAML") 2025-09-07T06:09:29.5493280Z raise 2025-09-07T06:09:29.5493489Z 2025-09-07T06:09:29.5493496Z 2025-09-07T06:09:29.5493910Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T06:09:29.5494633Z """ 2025-09-07T06:09:29.5495242Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T06:09:29.5495826Z 2025-09-07T06:09:29.5496485Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.5497313Z and the text below is the list of opted in users. 2025-09-07T06:09:29.5497711Z 2025-09-07T06:09:29.5498092Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T06:09:29.5498775Z """ 2025-09-07T06:09:29.5499218Z rollout_state_parts = rollout_state.split("---") 2025-09-07T06:09:29.5499815Z if len(rollout_state_parts) >= 2: 2025-09-07T06:09:29.5500405Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T06:09:29.5500977Z else: 2025-09-07T06:09:29.5501362Z return "", rollout_state 2025-09-07T06:09:29.5501663Z 2025-09-07T06:09:29.5501670Z 2025-09-07T06:09:29.5501877Z class UserOptins(dict[str, list[str]]): 2025-09-07T06:09:29.5502409Z """ 2025-09-07T06:09:29.5502924Z Dictionary of users with a list of features they have opted into 2025-09-07T06:09:29.5503551Z """ 2025-09-07T06:09:29.5503743Z 2025-09-07T06:09:29.5503751Z 2025-09-07T06:09:29.5504101Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T06:09:29.5504735Z """ 2025-09-07T06:09:29.5505441Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T06:09:29.5506109Z 2025-09-07T06:09:29.5506920Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T06:09:29.5507899Z - Example line: "@User1,lf,split_build" 2025-09-07T06:09:29.5508567Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T06:09:29.5509032Z 2025-09-07T06:09:29.5509039Z 2025-09-07T06:09:29.5509197Z """ 2025-09-07T06:09:29.5509572Z optins = UserOptins() 2025-09-07T06:09:29.5510044Z for user in user_optin_text.split("\n"): 2025-09-07T06:09:29.5510585Z user = user.strip("\r\n\t -") 2025-09-07T06:09:29.5511116Z if not user or not user.startswith("@"): 2025-09-07T06:09:29.5511663Z # Not a valid user. Skip 2025-09-07T06:09:29.5512288Z continue 2025-09-07T06:09:29.5512525Z 2025-09-07T06:09:29.5512681Z if user: 2025-09-07T06:09:29.5513112Z usr_name = user.split(",")[0].strip("@") 2025-09-07T06:09:29.5513781Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T06:09:29.5514267Z 2025-09-07T06:09:29.5514431Z return optins 2025-09-07T06:09:29.5514664Z 2025-09-07T06:09:29.5514672Z 2025-09-07T06:09:29.5514958Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T06:09:29.5515541Z """ 2025-09-07T06:09:29.5515931Z Check if the experiment name is valid. 2025-09-07T06:09:29.5516622Z A valid name: 2025-09-07T06:09:29.5517268Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T06:09:29.5518217Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T06:09:29.5518936Z - Cannot contain spaces 2025-09-07T06:09:29.5519391Z """ 2025-09-07T06:09:29.5519597Z 2025-09-07T06:09:29.5519857Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T06:09:29.5520543Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T06:09:29.5520981Z 2025-09-07T06:09:29.5521139Z if valid: 2025-09-07T06:09:29.5521517Z return True 2025-09-07T06:09:29.5521750Z 2025-09-07T06:09:29.5521908Z log.error( 2025-09-07T06:09:29.5523342Z 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-09-07T06:09:29.5524933Z ) 2025-09-07T06:09:29.5525280Z return False 2025-09-07T06:09:29.5525518Z 2025-09-07T06:09:29.5525525Z 2025-09-07T06:09:29.5525823Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T06:09:29.5526747Z """ 2025-09-07T06:09:29.5527544Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T06:09:29.5528278Z """ 2025-09-07T06:09:29.5528624Z try: 2025-09-07T06:09:29.5528993Z if settings_text: 2025-09-07T06:09:29.5529701Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T06:09:29.5530480Z # for easy reading 2025-09-07T06:09:29.5531236Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T06:09:29.5532105Z # the backtick character in shell commands. 2025-09-07T06:09:29.5532692Z backtick = chr(96) # backtick character 2025-09-07T06:09:29.5533348Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T06:09:29.5533999Z settings = load_yaml(settings_text) 2025-09-07T06:09:29.5534374Z 2025-09-07T06:09:29.5534784Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T06:09:29.5535531Z experiments = {} 2025-09-07T06:09:29.5535823Z 2025-09-07T06:09:29.5536193Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T06:09:29.5537176Z if not is_valid_experiment_name(exp_name): 2025-09-07T06:09:29.5538260Z # 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-09-07T06:09:29.5539279Z continue 2025-09-07T06:09:29.5539560Z 2025-09-07T06:09:29.5539752Z valid_settings = {} 2025-09-07T06:09:29.5540261Z for setting in exp_settings: 2025-09-07T06:09:29.5540818Z if setting not in Experiment._fields: 2025-09-07T06:09:29.5541354Z log.warning( 2025-09-07T06:09:29.5542040Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T06:09:29.5542752Z ) 2025-09-07T06:09:29.5543304Z else: 2025-09-07T06:09:29.5543801Z valid_settings[setting] = exp_settings[setting] 2025-09-07T06:09:29.5544214Z 2025-09-07T06:09:29.5544479Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T06:09:29.5545095Z return Settings(experiments) 2025-09-07T06:09:29.5545437Z 2025-09-07T06:09:29.5545605Z except Exception: 2025-09-07T06:09:29.5546074Z log.exception("Failed to parse settings") 2025-09-07T06:09:29.5546645Z 2025-09-07T06:09:29.5546827Z return Settings() 2025-09-07T06:09:29.5547081Z 2025-09-07T06:09:29.5547087Z 2025-09-07T06:09:29.5547328Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T06:09:29.5547881Z """ 2025-09-07T06:09:29.5548313Z Parse settings, if any, from the rollout state. 2025-09-07T06:09:29.5548708Z 2025-09-07T06:09:29.5549049Z If the issue body contains "---" then the text above that is the settings 2025-09-07T06:09:29.5549791Z and the text below is the list of opted in users. 2025-09-07T06:09:29.5550194Z 2025-09-07T06:09:29.5550590Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T06:09:29.5551302Z """ 2025-09-07T06:09:29.5551837Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.5552580Z return parse_settings_from_text(settings_text) 2025-09-07T06:09:29.5552964Z 2025-09-07T06:09:29.5552970Z 2025-09-07T06:09:29.5553205Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T06:09:29.5553749Z """ 2025-09-07T06:09:29.5554121Z Parse users from the rollout state. 2025-09-07T06:09:29.5554465Z 2025-09-07T06:09:29.5554619Z """ 2025-09-07T06:09:29.5555133Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T06:09:29.5555859Z return parse_user_opt_in_from_text(users_text) 2025-09-07T06:09:29.5556251Z 2025-09-07T06:09:29.5556432Z 2025-09-07T06:09:29.5557010Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.5557758Z """ 2025-09-07T06:09:29.5558167Z Check if a user is opted into an experiment 2025-09-07T06:09:29.5558689Z """ 2025-09-07T06:09:29.5559138Z return experiment_name in user_optins.get(user, []) 2025-09-07T06:09:29.5559553Z 2025-09-07T06:09:29.5559560Z 2025-09-07T06:09:29.5559973Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T06:09:29.5560698Z """ 2025-09-07T06:09:29.5561147Z Check if a user explicitly opted out of an experiment 2025-09-07T06:09:29.5561705Z """ 2025-09-07T06:09:29.5562195Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T06:09:29.5562854Z experiment_optout = "-" + experiment_name 2025-09-07T06:09:29.5563478Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T06:09:29.5564071Z return False 2025-09-07T06:09:29.5564320Z 2025-09-07T06:09:29.5564599Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T06:09:29.5565199Z log.warning( 2025-09-07T06:09:29.5565981Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T06:09:29.5567093Z ) 2025-09-07T06:09:29.5567305Z 2025-09-07T06:09:29.5567468Z return True 2025-09-07T06:09:29.5567710Z 2025-09-07T06:09:29.5567716Z 2025-09-07T06:09:29.5567893Z def get_runner_prefix( 2025-09-07T06:09:29.5568331Z rollout_state: str, 2025-09-07T06:09:29.5568782Z workflow_requestors: Iterable[str], 2025-09-07T06:09:29.5569303Z branch: str, 2025-09-07T06:09:29.5569781Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.5570437Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T06:09:29.5571008Z is_canary: bool = False, 2025-09-07T06:09:29.5571462Z ) -> str: 2025-09-07T06:09:29.5571876Z settings = parse_settings(rollout_state) 2025-09-07T06:09:29.5572604Z user_optins = parse_users(rollout_state) 2025-09-07T06:09:29.5572967Z 2025-09-07T06:09:29.5573143Z fleet_prefix = "" 2025-09-07T06:09:29.5573555Z prefixes = [] 2025-09-07T06:09:29.5574166Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T06:09:29.5575082Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T06:09:29.5575785Z log.info( 2025-09-07T06:09:29.5576981Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T06:09:29.5577755Z ) 2025-09-07T06:09:29.5578134Z continue 2025-09-07T06:09:29.5578379Z 2025-09-07T06:09:29.5578561Z if opt_out_experiments: 2025-09-07T06:09:29.5579095Z if experiment_name in opt_out_experiments: 2025-09-07T06:09:29.5579718Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T06:09:29.5580289Z log.info( 2025-09-07T06:09:29.5581212Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T06:09:29.5582166Z ) 2025-09-07T06:09:29.5582553Z continue 2025-09-07T06:09:29.5582820Z 2025-09-07T06:09:29.5582999Z if eligible_experiments: 2025-09-07T06:09:29.5583570Z if experiment_name not in eligible_experiments: 2025-09-07T06:09:29.5584187Z exp_list = ", ".join(eligible_experiments) 2025-09-07T06:09:29.5584737Z log.info( 2025-09-07T06:09:29.5585498Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T06:09:29.5586437Z ) 2025-09-07T06:09:29.5586833Z continue 2025-09-07T06:09:29.5587304Z elif not experiment_settings.default: 2025-09-07T06:09:29.5587833Z log.info( 2025-09-07T06:09:29.5588613Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T06:09:29.5589354Z ) 2025-09-07T06:09:29.5589721Z continue 2025-09-07T06:09:29.5589969Z 2025-09-07T06:09:29.5590239Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T06:09:29.5590839Z opted_out_users = [ 2025-09-07T06:09:29.5591283Z requestor 2025-09-07T06:09:29.5591726Z for requestor in workflow_requestors 2025-09-07T06:09:29.5592382Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.5592999Z ] 2025-09-07T06:09:29.5593202Z 2025-09-07T06:09:29.5593377Z if opted_out_users: 2025-09-07T06:09:29.5593818Z log.info( 2025-09-07T06:09:29.5594418Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T06:09:29.5595093Z ) 2025-09-07T06:09:29.5595458Z continue 2025-09-07T06:09:29.5595699Z 2025-09-07T06:09:29.5595964Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T06:09:29.5596697Z opted_in_users = [ 2025-09-07T06:09:29.5597137Z requestor 2025-09-07T06:09:29.5597587Z for requestor in workflow_requestors 2025-09-07T06:09:29.5598240Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T06:09:29.5598847Z ] 2025-09-07T06:09:29.5599045Z 2025-09-07T06:09:29.5599213Z enabled = False 2025-09-07T06:09:29.5599642Z if opted_in_users: 2025-09-07T06:09:29.5600067Z log.info( 2025-09-07T06:09:29.5600651Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T06:09:29.5601321Z ) 2025-09-07T06:09:29.5601696Z enabled = True 2025-09-07T06:09:29.5601968Z 2025-09-07T06:09:29.5602188Z elif experiment_settings.rollout_perc: 2025-09-07T06:09:29.5603043Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T06:09:29.5604096Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T06:09:29.5604741Z log.info( 2025-09-07T06:09:29.5605592Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T06:09:29.5606603Z ) 2025-09-07T06:09:29.5606999Z enabled = True 2025-09-07T06:09:29.5607292Z 2025-09-07T06:09:29.5607460Z if enabled: 2025-09-07T06:09:29.5607872Z label = experiment_name 2025-09-07T06:09:29.5608419Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T06:09:29.5609235Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T06:09:29.5610113Z # - If it's enabled, then we always list it's prefix first 2025-09-07T06:09:29.5610857Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T06:09:29.5611538Z if is_canary: 2025-09-07T06:09:29.5612023Z label += CANARY_FLEET_SUFFIX 2025-09-07T06:09:29.5612562Z fleet_prefix = label 2025-09-07T06:09:29.5613047Z else: 2025-09-07T06:09:29.5613465Z prefixes.append(label) 2025-09-07T06:09:29.5613811Z 2025-09-07T06:09:29.5613990Z if len(prefixes) > 1: 2025-09-07T06:09:29.5614420Z log.error( 2025-09-07T06:09:29.5615439Z 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-09-07T06:09:29.5616641Z ) 2025-09-07T06:09:29.5617033Z prefixes = prefixes[:1] 2025-09-07T06:09:29.5617336Z 2025-09-07T06:09:29.5617526Z # Fleet always comes first 2025-09-07T06:09:29.5617983Z if fleet_prefix: 2025-09-07T06:09:29.5618419Z prefixes.insert(0, fleet_prefix) 2025-09-07T06:09:29.5618771Z 2025-09-07T06:09:29.5619156Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T06:09:29.5619580Z 2025-09-07T06:09:29.5619588Z 2025-09-07T06:09:29.5620028Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T06:09:29.5620792Z """ 2025-09-07T06:09:29.5621362Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T06:09:29.5621917Z 2025-09-07T06:09:29.5622299Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T06:09:29.5622988Z """ 2025-09-07T06:09:29.5623368Z gh = get_gh_client(github_token) 2025-09-07T06:09:29.5623888Z issue = get_issue(gh, repo, issue_num) 2025-09-07T06:09:29.5624509Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T06:09:29.5624945Z 2025-09-07T06:09:29.5624952Z 2025-09-07T06:09:29.5625352Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T06:09:29.5626100Z for _ in range(num_retries): 2025-09-07T06:09:29.5626692Z try: 2025-09-07T06:09:29.5627116Z req = Request(url=url, headers=headers) 2025-09-07T06:09:29.5627773Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T06:09:29.5628399Z return json.loads(content) 2025-09-07T06:09:29.5628918Z except Exception as e: 2025-09-07T06:09:29.5629441Z log.warning(f"Could not download {url}: {e}") 2025-09-07T06:09:29.5629849Z 2025-09-07T06:09:29.5630221Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T06:09:29.5630925Z return {} 2025-09-07T06:09:29.5631144Z 2025-09-07T06:09:29.5631150Z 2025-09-07T06:09:29.5631306Z @cache 2025-09-07T06:09:29.5631917Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T06:09:29.5632659Z """ 2025-09-07T06:09:29.5633044Z Dynamically get PR information 2025-09-07T06:09:29.5633533Z """ 2025-09-07T06:09:29.5634026Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T06:09:29.5634778Z headers = { 2025-09-07T06:09:29.5635224Z "Accept": "application/vnd.github.v3+json", 2025-09-07T06:09:29.5635824Z "Authorization": f"token {github_token}", 2025-09-07T06:09:29.5636444Z } 2025-09-07T06:09:29.5636874Z json_response: dict[str, Any] = download_json( 2025-09-07T06:09:29.5637467Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T06:09:29.5638014Z headers=headers, 2025-09-07T06:09:29.5638428Z ) 2025-09-07T06:09:29.5638630Z 2025-09-07T06:09:29.5638810Z if not json_response: 2025-09-07T06:09:29.5639370Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T06:09:29.5639970Z return {} 2025-09-07T06:09:29.5640204Z 2025-09-07T06:09:29.5640386Z return json_response 2025-09-07T06:09:29.5640659Z 2025-09-07T06:09:29.5640666Z 2025-09-07T06:09:29.5641060Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T06:09:29.5641785Z """ 2025-09-07T06:09:29.5642294Z Dynamically get the latest list of labels from the pull request 2025-09-07T06:09:29.5642940Z """ 2025-09-07T06:09:29.5643411Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T06:09:29.5644004Z return { 2025-09-07T06:09:29.5644586Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T06:09:29.5645268Z } 2025-09-07T06:09:29.5645468Z 2025-09-07T06:09:29.5645479Z 2025-09-07T06:09:29.5645647Z def main() -> None: 2025-09-07T06:09:29.5646053Z args = parse_args() 2025-09-07T06:09:29.5646411Z 2025-09-07T06:09:29.5646632Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T06:09:29.5647010Z 2025-09-07T06:09:29.5647207Z # Check if the PR is opt-out 2025-09-07T06:09:29.5647681Z if args.pr_number: 2025-09-07T06:09:29.5648325Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T06:09:29.5649187Z if OPT_OUT_LABEL in labels: 2025-09-07T06:09:29.5649692Z log.info( 2025-09-07T06:09:29.5650363Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T06:09:29.5651117Z ) 2025-09-07T06:09:29.5651646Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.5652306Z sys.exit() 2025-09-07T06:09:29.5652559Z 2025-09-07T06:09:29.5652723Z try: 2025-09-07T06:09:29.5653146Z rollout_state = get_rollout_state_from_issue( 2025-09-07T06:09:29.5653846Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T06:09:29.5654470Z ) 2025-09-07T06:09:29.5654679Z 2025-09-07T06:09:29.5654881Z username = get_potential_pr_author( 2025-09-07T06:09:29.5655409Z args.github_token, 2025-09-07T06:09:29.5655879Z args.github_repo, 2025-09-07T06:09:29.5656440Z args.github_actor, 2025-09-07T06:09:29.5656917Z args.github_ref_type, 2025-09-07T06:09:29.5657415Z args.github_branch, 2025-09-07T06:09:29.5657856Z ) 2025-09-07T06:09:29.5658063Z 2025-09-07T06:09:29.5658347Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T06:09:29.5658794Z 2025-09-07T06:09:29.5659007Z runner_label_prefix = get_runner_prefix( 2025-09-07T06:09:29.5659549Z rollout_state, 2025-09-07T06:09:29.5660015Z (args.github_issue_owner, username), 2025-09-07T06:09:29.5660556Z args.github_branch, 2025-09-07T06:09:29.5661038Z args.eligible_experiments, 2025-09-07T06:09:29.5661569Z args.opt_out_experiments, 2025-09-07T06:09:29.5662062Z is_canary, 2025-09-07T06:09:29.5662463Z ) 2025-09-07T06:09:29.5662665Z 2025-09-07T06:09:29.5662854Z except Exception as e: 2025-09-07T06:09:29.5663291Z log.error( 2025-09-07T06:09:29.5663944Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T06:09:29.5664820Z ) 2025-09-07T06:09:29.5665025Z 2025-09-07T06:09:29.5665344Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T06:09:29.5665831Z 2025-09-07T06:09:29.5665838Z 2025-09-07T06:09:29.5666017Z if __name__ == "__main__": 2025-09-07T06:09:29.5666550Z main() 2025-09-07T06:09:29.5666757Z 2025-09-07T06:09:29.5760248Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:29.5761134Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T06:09:29.5790874Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:29.5791336Z env: 2025-09-07T06:09:29.5791929Z GITHUB_TOKEN: *** 2025-09-07T06:09:29.5792324Z ISSUE_NUMBER: 5132 2025-09-07T06:09:29.5792748Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:29.5793239Z ISSUE_OWNER: 2025-09-07T06:09:29.5793628Z CHECK_EXPERIMENTS: 2025-09-07T06:09:29.5794046Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:29.5794460Z PR_NUMBER: 2025-09-07T06:09:29.5794827Z ##[endgroup] 2025-09-07T06:09:31.2539456Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T06:09:32.3152414Z Collecting urllib3==1.26.18 2025-09-07T06:09:32.3893120Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T06:09:32.4158223Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.0 MB/s eta 0:00:00 2025-09-07T06:09:32.4476893Z Collecting PyGithub==2.3.0 2025-09-07T06:09:32.4620853Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T06:09:32.5114800Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T06:09:32.5247559Z 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-09-07T06:09:32.5291301Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T06:09:32.5303807Z 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-09-07T06:09:32.5323237Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T06:09:32.5651018Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T06:09:32.5781479Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T06:09:32.6004736Z 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-09-07T06:09:32.7340106Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.7473774Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T06:09:32.8752547Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T06:09:32.8886000Z 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-09-07T06:09:32.9141449Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T06:09:32.9271275Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T06:09:32.9618962Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T06:09:32.9780948Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 9.4 MB/s eta 0:00:00 2025-09-07T06:09:32.9911784Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T06:09:33.0071988Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 24.2 MB/s eta 0:00:00 2025-09-07T06:09:33.0206456Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-09-07T06:09:33.0374334Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 56.4 MB/s eta 0:00:00 2025-09-07T06:09:33.0509027Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T06:09:33.0661697Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T06:09:33.0727752Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 106.6 MB/s eta 0:00:00 2025-09-07T06:09:33.0858058Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-09-07T06:09:33.0898671Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 32.2 MB/s eta 0:00:00 2025-09-07T06:09:33.1030235Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T06:09:33.1073342Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.1 MB/s eta 0:00:00 2025-09-07T06:09:33.4436204Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T06:09:33.9694253Z 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-09-07T06:09:34.0460766Z ##[group]Run curr_branch="main" 2025-09-07T06:09:34.0461075Z curr_branch="main" 2025-09-07T06:09:34.0461293Z curr_ref_type="branch" 2025-09-07T06:09:34.0461547Z echo "Current branch is '$curr_branch'" 2025-09-07T06:09:34.0461827Z  2025-09-07T06:09:34.0462017Z python3 runner_determinator.py \ 2025-09-07T06:09:34.0462289Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T06:09:34.0462557Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T06:09:34.0462811Z  --github-branch "$curr_branch" \ 2025-09-07T06:09:34.0463076Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T06:09:34.0463357Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T06:09:34.0463633Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T06:09:34.0463906Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T06:09:34.0464200Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T06:09:34.0464564Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T06:09:34.0464857Z  --pr-number "${PR_NUMBER}" 2025-09-07T06:09:34.0495585Z shell: /usr/bin/bash -e {0} 2025-09-07T06:09:34.0495822Z env: 2025-09-07T06:09:34.0496557Z GITHUB_TOKEN: *** 2025-09-07T06:09:34.0496768Z ISSUE_NUMBER: 5132 2025-09-07T06:09:34.0496973Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T06:09:34.0497206Z ISSUE_OWNER: 2025-09-07T06:09:34.0497377Z CHECK_EXPERIMENTS: 2025-09-07T06:09:34.0497568Z OPT_OUT_EXPERIMENTS: 2025-09-07T06:09:34.0497762Z PR_NUMBER: 2025-09-07T06:09:34.0497930Z ##[endgroup] 2025-09-07T06:09:34.0546765Z Current branch is 'main' 2025-09-07T06:09:35.5633760Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-09-07T06:09:35.5634719Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T06:09:35.5635500Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T06:09:35.5636219Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T06:09:35.5637168Z INFO : Setting output: label-type='lf.' 2025-09-07T06:09:35.5940635Z Evaluate and set job outputs 2025-09-07T06:09:35.5947086Z Set output 'label-type' 2025-09-07T06:09:35.5948892Z Cleaning up orphan processes