2025-09-07T07:06:29.7060014Z Current runner version: '2.328.0' 2025-09-07T07:06:29.7087017Z ##[group]Runner Image Provisioner 2025-09-07T07:06:29.7087876Z Hosted Compute Agent 2025-09-07T07:06:29.7088783Z Version: 20250829.383 2025-09-07T07:06:29.7089405Z Commit: 27cb235aab5b0e52e153a26cd86b4742e89dac5d 2025-09-07T07:06:29.7090050Z Build Date: 2025-08-29T13:48:48Z 2025-09-07T07:06:29.7090678Z ##[endgroup] 2025-09-07T07:06:29.7091211Z ##[group]Operating System 2025-09-07T07:06:29.7091763Z Ubuntu 2025-09-07T07:06:29.7092180Z 24.04.3 2025-09-07T07:06:29.7092698Z LTS 2025-09-07T07:06:29.7093106Z ##[endgroup] 2025-09-07T07:06:29.7093564Z ##[group]Runner Image 2025-09-07T07:06:29.7094203Z Image: ubuntu-24.04 2025-09-07T07:06:29.7094664Z Version: 20250831.1.0 2025-09-07T07:06:29.7095643Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250831.1/images/ubuntu/Ubuntu2404-Readme.md 2025-09-07T07:06:29.7097242Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250831.1 2025-09-07T07:06:29.7098370Z ##[endgroup] 2025-09-07T07:06:29.7099490Z ##[group]GITHUB_TOKEN Permissions 2025-09-07T07:06:29.7101891Z Contents: read 2025-09-07T07:06:29.7102519Z Metadata: read 2025-09-07T07:06:29.7102994Z ##[endgroup] 2025-09-07T07:06:29.7105206Z Secret source: Actions 2025-09-07T07:06:29.7105933Z Prepare workflow directory 2025-09-07T07:06:29.7859097Z Prepare all required actions 2025-09-07T07:06:29.7944390Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (93fb23d6fae7c4e82c4239a1033e522088742634) 2025-09-07T07:06:29.7951738Z ##[group] Inputs 2025-09-07T07:06:29.7952644Z check_experiments: 2025-09-07T07:06:29.7953695Z opt_out_experiments: lf 2025-09-07T07:06:29.7954566Z triggering_actor: pytorchmergebot 2025-09-07T07:06:29.7955662Z issue_owner: 2025-09-07T07:06:29.7956466Z curr_branch: main 2025-09-07T07:06:29.7957285Z curr_ref_type: branch 2025-09-07T07:06:29.7958565Z issue_number: 5132 2025-09-07T07:06:29.7959485Z ##[endgroup] 2025-09-07T07:06:29.7960450Z Complete job name: get-label-type / runner-determinator 2025-09-07T07:06:30.3301995Z ##[group]Run cat < runner_determinator.py 2025-09-07T07:06:30.3304610Z cat < runner_determinator.py 2025-09-07T07:06:30.3305300Z # flake8: noqa: G004 2025-09-07T07:06:30.3305871Z  2025-09-07T07:06:30.3306692Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:06:30.3307833Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:06:30.3309166Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:06:30.3309919Z  2025-09-07T07:06:30.3310398Z """ 2025-09-07T07:06:30.3311113Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:06:30.3312199Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:06:30.3313469Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:06:30.3314457Z of which runners should be used to run which job. 2025-09-07T07:06:30.3315264Z  2025-09-07T07:06:30.3315972Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:06:30.3317065Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:06:30.3318292Z settings are considered to be empty with only the second part, the user 2025-09-07T07:06:30.3319199Z list, defined. 2025-09-07T07:06:30.3319695Z  2025-09-07T07:06:30.3320490Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:06:30.3321594Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:06:30.3322576Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:06:30.3323393Z  2025-09-07T07:06:30.3324456Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:06:30.3325514Z The user list is also a comma separated list of additional features or 2025-09-07T07:06:30.3326502Z experiments which the user could be opted in to. 2025-09-07T07:06:30.3327175Z  2025-09-07T07:06:30.3327699Z The user list has the following rules: 2025-09-07T07:06:30.3328485Z  2025-09-07T07:06:30.3329253Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:06:30.3330299Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:06:30.3331257Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:06:30.3331964Z  2025-09-07T07:06:30.3332420Z Example config: 2025-09-07T07:06:30.3333094Z  # A list of experiments that can be opted into. 2025-09-07T07:06:30.3333945Z  # This defines the behavior they'll induce when opted into. 2025-09-07T07:06:30.3334750Z  # Expected syntax is: 2025-09-07T07:06:30.3335611Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:06:30.3336730Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:06:30.3337624Z  2025-09-07T07:06:30.3338247Z  experiments: 2025-09-07T07:06:30.3338923Z  lf: 2025-09-07T07:06:30.3339433Z  rollout_percent: 25 2025-09-07T07:06:30.3340038Z  all_branches: false 2025-09-07T07:06:30.3340713Z  default: true 2025-09-07T07:06:30.3341250Z  --- 2025-09-07T07:06:30.3341717Z  2025-09-07T07:06:30.3342254Z  # Opt-ins: 2025-09-07T07:06:30.3343029Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:06:30.3344250Z  # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:06:30.3345311Z  # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:06:30.3346152Z  # Experiments should be from the above list. 2025-09-07T07:06:30.3346805Z  2025-09-07T07:06:30.3347404Z  @User1,-lf,split_build 2025-09-07T07:06:30.3348103Z  @User2,lf 2025-09-07T07:06:30.3348674Z  @User3,split_build 2025-09-07T07:06:30.3349346Z """ 2025-09-07T07:06:30.3349803Z  2025-09-07T07:06:30.3350311Z import json 2025-09-07T07:06:30.3447386Z import logging 2025-09-07T07:06:30.3448416Z import os 2025-09-07T07:06:30.3448911Z import random 2025-09-07T07:06:30.3449351Z import re 2025-09-07T07:06:30.3449791Z import sys 2025-09-07T07:06:30.3450284Z from argparse import ArgumentParser 2025-09-07T07:06:30.3450986Z from collections.abc import Iterable 2025-09-07T07:06:30.3451652Z from functools import cache 2025-09-07T07:06:30.3452195Z from logging import LogRecord 2025-09-07T07:06:30.3452778Z from typing import Any, NamedTuple 2025-09-07T07:06:30.3453402Z from urllib.request import Request, urlopen 2025-09-07T07:06:30.3454000Z  2025-09-07T07:06:30.3454382Z import yaml 2025-09-07T07:06:30.3454849Z from github import Auth, Github 2025-09-07T07:06:30.3455414Z from github.Issue import Issue 2025-09-07T07:06:30.3455940Z  2025-09-07T07:06:30.3456312Z  2025-09-07T07:06:30.3456770Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:06:30.3457538Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:06:30.3458653Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:06:30.3459417Z  2025-09-07T07:06:30.3460276Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:06:30.3460925Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:06:30.3461519Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:06:30.3462172Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:06:30.3462749Z  2025-09-07T07:06:30.3463177Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:06:30.3463731Z  2025-09-07T07:06:30.3464138Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:06:30.3464679Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:06:30.3465173Z  2025-09-07T07:06:30.3465545Z  2025-09-07T07:06:30.3465961Z class Experiment(NamedTuple): 2025-09-07T07:06:30.3466513Z  rollout_perc: float = ( 2025-09-07T07:06:30.3467259Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:06:30.3468153Z  ) 2025-09-07T07:06:30.3468590Z  all_branches: bool = ( 2025-09-07T07:06:30.3469321Z  False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:06:30.3470042Z  ) 2025-09-07T07:06:30.3470465Z  default: bool = ( 2025-09-07T07:06:30.3471114Z  True # If True, the experiment is enabled by default for all queries 2025-09-07T07:06:30.3471813Z  ) 2025-09-07T07:06:30.3472208Z  2025-09-07T07:06:30.3472613Z  # Add more fields as needed 2025-09-07T07:06:30.3473128Z  2025-09-07T07:06:30.3473501Z  2025-09-07T07:06:30.3473899Z class Settings(NamedTuple): 2025-09-07T07:06:30.3474418Z  """ 2025-09-07T07:06:30.3474970Z  Settings for the experiments that can be opted into. 2025-09-07T07:06:30.3475602Z  """ 2025-09-07T07:06:30.3476005Z  2025-09-07T07:06:30.3476438Z  experiments: dict[str, Experiment] = {} 2025-09-07T07:06:30.3476997Z  2025-09-07T07:06:30.3477560Z  2025-09-07T07:06:30.3478134Z class ColorFormatter(logging.Formatter): 2025-09-07T07:06:30.3478839Z  """Color codes the log messages based on the log level""" 2025-09-07T07:06:30.3479478Z  2025-09-07T07:06:30.3479858Z  COLORS = { 2025-09-07T07:06:30.3480342Z  "WARNING": "\033[33m", # Yellow 2025-09-07T07:06:30.3480907Z  "ERROR": "\033[31m", # Red 2025-09-07T07:06:30.3481456Z  "CRITICAL": "\033[31m", # Red 2025-09-07T07:06:30.3482014Z  "INFO": "\033[0m", # Reset 2025-09-07T07:06:30.3482558Z  "DEBUG": "\033[0m", # Reset 2025-09-07T07:06:30.3483081Z  } 2025-09-07T07:06:30.3483466Z  2025-09-07T07:06:30.3483929Z  def format(self, record: LogRecord) -> str: 2025-09-07T07:06:30.3484752Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:06:30.3485599Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:06:30.3486236Z  return super().format(record) 2025-09-07T07:06:30.3486764Z  2025-09-07T07:06:30.3487132Z  2025-09-07T07:06:30.3487553Z handler = logging.StreamHandler() 2025-09-07T07:06:30.3488493Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:06:30.3489261Z  2025-09-07T07:06:30.3489755Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:06:30.3490409Z log.addHandler(handler) 2025-09-07T07:06:30.3490928Z log.setLevel(logging.INFO) 2025-09-07T07:06:30.3491438Z  2025-09-07T07:06:30.3491806Z  2025-09-07T07:06:30.3492308Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:06:30.3492927Z  """ 2025-09-07T07:06:30.3493502Z  Defines outputs of the github action that invokes this script 2025-09-07T07:06:30.3494393Z  """ 2025-09-07T07:06:30.3494822Z  if not GITHUB_OUTPUT: 2025-09-07T07:06:30.3495980Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:06:30.3497179Z  log.warning( 2025-09-07T07:06:30.3498259Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:06:30.3499242Z  ) 2025-09-07T07:06:30.3499746Z  print(f"::set-output name={key}::{value}") 2025-09-07T07:06:30.3500344Z  return 2025-09-07T07:06:30.3500775Z  2025-09-07T07:06:30.3501207Z  with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:06:30.3501834Z  log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:06:30.3502460Z  f.write(f"{key}={value}\n") 2025-09-07T07:06:30.3502997Z  2025-09-07T07:06:30.3503381Z  2025-09-07T07:06:30.3503942Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:06:30.3504651Z  return frozenset( 2025-09-07T07:06:30.3505357Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:06:30.3506086Z  ) 2025-09-07T07:06:30.3506503Z  2025-09-07T07:06:30.3506882Z  2025-09-07T07:06:30.3507290Z def parse_args() -> Any: 2025-09-07T07:06:30.3508577Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:06:30.3509571Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:06:30.3510401Z  parser.add_argument( 2025-09-07T07:06:30.3510939Z  "--github-issue-repo", 2025-09-07T07:06:30.3511479Z  type=str, 2025-09-07T07:06:30.3511951Z  required=False, 2025-09-07T07:06:30.3512668Z  default="pytorch/test-infra", 2025-09-07T07:06:30.3513311Z  help="GitHub repo to get the issue", 2025-09-07T07:06:30.3513936Z  ) 2025-09-07T07:06:30.3514368Z  parser.add_argument( 2025-09-07T07:06:30.3514886Z  "--github-repo", 2025-09-07T07:06:30.3515395Z  type=str, 2025-09-07T07:06:30.3515867Z  required=True, 2025-09-07T07:06:30.3516428Z  help="GitHub repo where CI is running", 2025-09-07T07:06:30.3516999Z  ) 2025-09-07T07:06:30.3517429Z  parser.add_argument( 2025-09-07T07:06:30.3518248Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:06:30.3518964Z  ) 2025-09-07T07:06:30.3519393Z  parser.add_argument( 2025-09-07T07:06:30.3520115Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:06:30.3520869Z  ) 2025-09-07T07:06:30.3521293Z  parser.add_argument( 2025-09-07T07:06:30.3522031Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:06:30.3522773Z  ) 2025-09-07T07:06:30.3523194Z  parser.add_argument( 2025-09-07T07:06:30.3523953Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:06:30.3524707Z  ) 2025-09-07T07:06:30.3525161Z  parser.add_argument( 2025-09-07T07:06:30.3525695Z  "--github-ref-type", 2025-09-07T07:06:30.3526229Z  type=str, 2025-09-07T07:06:30.3526707Z  required=True, 2025-09-07T07:06:30.3527336Z  help="Current GitHub ref type, branch or tag", 2025-09-07T07:06:30.3528074Z  ) 2025-09-07T07:06:30.3528508Z  parser.add_argument( 2025-09-07T07:06:30.3529051Z  "--eligible-experiments", 2025-09-07T07:06:30.3529812Z  type=_str_comma_separated_to_set, 2025-09-07T07:06:30.3530392Z  required=False, 2025-09-07T07:06:30.3530910Z  default="", 2025-09-07T07:06:30.3531870Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:06:30.3532856Z  ) 2025-09-07T07:06:30.3533288Z  parser.add_argument( 2025-09-07T07:06:30.3533829Z  "--opt-out-experiments", 2025-09-07T07:06:30.3534424Z  type=_str_comma_separated_to_set, 2025-09-07T07:06:30.3535006Z  required=False, 2025-09-07T07:06:30.3535531Z  default="", 2025-09-07T07:06:30.3536017Z  help=( 2025-09-07T07:06:30.3536790Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:06:30.3538174Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:06:30.3539078Z  ), 2025-09-07T07:06:30.3539507Z  ) 2025-09-07T07:06:30.3539940Z  parser.add_argument( 2025-09-07T07:06:30.3540465Z  "--pr-number", 2025-09-07T07:06:30.3540963Z  type=str, 2025-09-07T07:06:30.3541452Z  required=False, 2025-09-07T07:06:30.3541960Z  default="", 2025-09-07T07:06:30.3542533Z  help="the optional PR number where this is run", 2025-09-07T07:06:30.3543149Z  ) 2025-09-07T07:06:30.3543546Z  2025-09-07T07:06:30.3543971Z  return parser.parse_args() 2025-09-07T07:06:30.3544500Z  2025-09-07T07:06:30.3544876Z  2025-09-07T07:06:30.3545528Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:06:30.3546515Z  auth = Auth.Token(github_token) 2025-09-07T07:06:30.3547136Z  return Github(auth=auth) 2025-09-07T07:06:30.3547649Z  2025-09-07T07:06:30.3548421Z  2025-09-07T07:06:30.3549144Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:06:30.3550017Z  repo = gh.get_repo(repo) 2025-09-07T07:06:30.3550617Z  return repo.get_issue(number=issue_num) 2025-09-07T07:06:30.3551203Z  2025-09-07T07:06:30.3551583Z  2025-09-07T07:06:30.3551992Z def get_potential_pr_author( 2025-09-07T07:06:30.3552741Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:06:30.3553474Z ) -> str: 2025-09-07T07:06:30.3554081Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:06:30.3554976Z  # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:06:30.3555830Z  # embedded in the tag name: ciflow// 2025-09-07T07:06:30.3556467Z  2025-09-07T07:06:30.3556898Z  gh = get_gh_client(github_token) 2025-09-07T07:06:30.3557448Z  2025-09-07T07:06:30.3558164Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:06:30.3558880Z  split_tag = ref_name.split("/") 2025-09-07T07:06:30.3559439Z  if ( 2025-09-07T07:06:30.3559910Z  len(split_tag) == 3 2025-09-07T07:06:30.3560482Z  and split_tag[0] == "ciflow" 2025-09-07T07:06:30.3561084Z  and split_tag[2].isnumeric() 2025-09-07T07:06:30.3561648Z  ): 2025-09-07T07:06:30.3562110Z  pr_number = split_tag[2] 2025-09-07T07:06:30.3562677Z  try: 2025-09-07T07:06:30.3563197Z  repository = gh.get_repo(repo) 2025-09-07T07:06:30.3564061Z  pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:06:30.3564742Z  except Exception as e: 2025-09-07T07:06:30.3565358Z  raise Exception( # noqa: TRY002 2025-09-07T07:06:30.3566114Z  f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:06:30.3566826Z  ) from e 2025-09-07T07:06:30.3567494Z  return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:06:30.3568974Z  # In all other cases, return the original input username 2025-09-07T07:06:30.3569663Z  return username 2025-09-07T07:06:30.3570137Z  2025-09-07T07:06:30.3570501Z  2025-09-07T07:06:30.3570975Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:06:30.3571558Z  """ 2025-09-07T07:06:30.3572295Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:06:30.3573129Z  """ 2025-09-07T07:06:30.3573744Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:06:30.3574450Z  2025-09-07T07:06:30.3574816Z  2025-09-07T07:06:30.3575245Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:06:30.3575781Z  try: 2025-09-07T07:06:30.3576232Z  data = yaml.safe_load(yaml_text) 2025-09-07T07:06:30.3576790Z  return data 2025-09-07T07:06:30.3577279Z  except yaml.YAMLError: 2025-09-07T07:06:30.3577840Z  log.exception("Error loading YAML") 2025-09-07T07:06:30.3578680Z  raise 2025-09-07T07:06:30.3579119Z  2025-09-07T07:06:30.3579475Z  2025-09-07T07:06:30.3580138Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:06:30.3580920Z  """ 2025-09-07T07:06:30.3581817Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:06:30.3582614Z  2025-09-07T07:06:30.3583199Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:06:30.3584059Z  and the text below is the list of opted in users. 2025-09-07T07:06:30.3584656Z  2025-09-07T07:06:30.3585270Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:06:30.3586004Z  """ 2025-09-07T07:06:30.3586510Z  rollout_state_parts = rollout_state.split("---") 2025-09-07T07:06:30.3587153Z  if len(rollout_state_parts) >= 2: 2025-09-07T07:06:30.3587831Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:06:30.3588720Z  else: 2025-09-07T07:06:30.3589161Z  return "", rollout_state 2025-09-07T07:06:30.3589978Z  2025-09-07T07:06:30.3590358Z  2025-09-07T07:06:30.3590794Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:06:30.3591337Z  """ 2025-09-07T07:06:30.3591916Z  Dictionary of users with a list of features they have opted into 2025-09-07T07:06:30.3592597Z  """ 2025-09-07T07:06:30.3592992Z  2025-09-07T07:06:30.3593354Z  2025-09-07T07:06:30.3593918Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:06:30.3594622Z  """ 2025-09-07T07:06:30.3595381Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:06:30.3596249Z  2025-09-07T07:06:30.3597086Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:06:30.3598425Z  - Example line: "@User1,lf,split_build" 2025-09-07T07:06:30.3599375Z  - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:06:30.3600037Z  2025-09-07T07:06:30.3600400Z  2025-09-07T07:06:30.3600755Z  """ 2025-09-07T07:06:30.3601170Z  optins = UserOptins() 2025-09-07T07:06:30.3601729Z  for user in user_optin_text.split("\n"): 2025-09-07T07:06:30.3602344Z  user = user.strip("\r\n\t -") 2025-09-07T07:06:30.3602951Z  if not user or not user.startswith("@"): 2025-09-07T07:06:30.3603552Z  # Not a valid user. Skip 2025-09-07T07:06:30.3604095Z  continue 2025-09-07T07:06:30.3604544Z  2025-09-07T07:06:30.3604922Z  if user: 2025-09-07T07:06:30.3605432Z  usr_name = user.split(",")[0].strip("@") 2025-09-07T07:06:30.3606209Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:06:30.3606889Z  2025-09-07T07:06:30.3607280Z  return optins 2025-09-07T07:06:30.3607729Z  2025-09-07T07:06:30.3608234Z  2025-09-07T07:06:30.3608767Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:06:30.3609416Z  """ 2025-09-07T07:06:30.3609878Z  Check if the experiment name is valid. 2025-09-07T07:06:30.3610436Z  A valid name: 2025-09-07T07:06:30.3611152Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:06:30.3612134Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:06:30.3612885Z  - Cannot contain spaces 2025-09-07T07:06:30.3613394Z  """ 2025-09-07T07:06:30.3613823Z  2025-09-07T07:06:30.3614326Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:06:30.3615093Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:06:30.3615877Z  2025-09-07T07:06:30.3616251Z  if valid: 2025-09-07T07:06:30.3616692Z  return True 2025-09-07T07:06:30.3617146Z  2025-09-07T07:06:30.3617504Z  log.error( 2025-09-07T07:06:30.3619146Z  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-07T07:06:30.3620745Z  ) 2025-09-07T07:06:30.3621150Z  return False 2025-09-07T07:06:30.3621609Z  2025-09-07T07:06:30.3621962Z  2025-09-07T07:06:30.3622527Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:06:30.3623201Z  """ 2025-09-07T07:06:30.3623848Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:06:30.3624605Z  """ 2025-09-07T07:06:30.3625004Z  try: 2025-09-07T07:06:30.3625413Z  if settings_text: 2025-09-07T07:06:30.3626212Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:06:30.3627038Z  # for easy reading 2025-09-07T07:06:30.3627889Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:06:30.3628959Z  # the backtick character in shell commands. 2025-09-07T07:06:30.3629619Z  backtick = chr(96) # backtick character 2025-09-07T07:06:30.3630369Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:06:30.3631096Z  settings = load_yaml(settings_text) 2025-09-07T07:06:30.3631644Z  2025-09-07T07:06:30.3632289Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:06:30.3633216Z  experiments = {} 2025-09-07T07:06:30.3633724Z  2025-09-07T07:06:30.3634316Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:06:30.3635141Z  if not is_valid_experiment_name(exp_name): 2025-09-07T07:06:30.3636317Z  # 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-07T07:06:30.3637426Z  continue 2025-09-07T07:06:30.3638121Z  2025-09-07T07:06:30.3638551Z  valid_settings = {} 2025-09-07T07:06:30.3639137Z  for setting in exp_settings: 2025-09-07T07:06:30.3639763Z  if setting not in Experiment._fields: 2025-09-07T07:06:30.3640368Z  log.warning( 2025-09-07T07:06:30.3641180Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:06:30.3641943Z  ) 2025-09-07T07:06:30.3642437Z  else: 2025-09-07T07:06:30.3643038Z  valid_settings[setting] = exp_settings[setting] 2025-09-07T07:06:30.3643655Z  2025-09-07T07:06:30.3644174Z  experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:06:30.3644881Z  return Settings(experiments) 2025-09-07T07:06:30.3645430Z  2025-09-07T07:06:30.3645817Z  except Exception: 2025-09-07T07:06:30.3646385Z  log.exception("Failed to parse settings") 2025-09-07T07:06:30.3646962Z  2025-09-07T07:06:30.3647355Z  return Settings() 2025-09-07T07:06:30.3647824Z  2025-09-07T07:06:30.3648289Z  2025-09-07T07:06:30.3648940Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:06:30.3649581Z  """ 2025-09-07T07:06:30.3650095Z  Parse settings, if any, from the rollout state. 2025-09-07T07:06:30.3650691Z  2025-09-07T07:06:30.3651279Z  If the issue body contains "---" then the text above that is the settings 2025-09-07T07:06:30.3652097Z  and the text below is the list of opted in users. 2025-09-07T07:06:30.3652711Z  2025-09-07T07:06:30.3653364Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:06:30.3654136Z  """ 2025-09-07T07:06:30.3654764Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:06:30.3655611Z  return parse_settings_from_text(settings_text) 2025-09-07T07:06:30.3656216Z  2025-09-07T07:06:30.3656580Z  2025-09-07T07:06:30.3657083Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:06:30.3657699Z  """ 2025-09-07T07:06:30.3658266Z  Parse users from the rollout state. 2025-09-07T07:06:30.3658818Z  2025-09-07T07:06:30.3659185Z  """ 2025-09-07T07:06:30.3659797Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:06:30.3660603Z  return parse_user_opt_in_from_text(users_text) 2025-09-07T07:06:30.3661195Z  2025-09-07T07:06:30.3661552Z  2025-09-07T07:06:30.3662234Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:06:30.3663043Z  """ 2025-09-07T07:06:30.3663540Z  Check if a user is opted into an experiment 2025-09-07T07:06:30.3664131Z  """ 2025-09-07T07:06:30.3664654Z  return experiment_name in user_optins.get(user, []) 2025-09-07T07:06:30.3665290Z  2025-09-07T07:06:30.3665809Z  2025-09-07T07:06:30.3666502Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:06:30.3667314Z  """ 2025-09-07T07:06:30.3667837Z  Check if a user explicitly opted out of an experiment 2025-09-07T07:06:30.3668578Z  """ 2025-09-07T07:06:30.3669154Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:06:30.3669918Z  experiment_optout = "-" + experiment_name 2025-09-07T07:06:30.3670619Z  if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:06:30.3671272Z  return False 2025-09-07T07:06:30.3671727Z  2025-09-07T07:06:30.3672232Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:06:30.3672884Z  log.warning( 2025-09-07T07:06:30.3673789Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:06:30.3674724Z  ) 2025-09-07T07:06:30.3675124Z  2025-09-07T07:06:30.3675512Z  return True 2025-09-07T07:06:30.3675953Z  2025-09-07T07:06:30.3676313Z  2025-09-07T07:06:30.3676703Z def get_runner_prefix( 2025-09-07T07:06:30.3677207Z  rollout_state: str, 2025-09-07T07:06:30.3677746Z  workflow_requestors: Iterable[str], 2025-09-07T07:06:30.3678410Z  branch: str, 2025-09-07T07:06:30.3678993Z  eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:06:30.3679733Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:06:30.3680371Z  is_canary: bool = False, 2025-09-07T07:06:30.3680880Z ) -> str: 2025-09-07T07:06:30.3681374Z  settings = parse_settings(rollout_state) 2025-09-07T07:06:30.3682016Z  user_optins = parse_users(rollout_state) 2025-09-07T07:06:30.3682579Z  2025-09-07T07:06:30.3683104Z  fleet_prefix = "" 2025-09-07T07:06:30.3683597Z  prefixes = [] 2025-09-07T07:06:30.3684317Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:06:30.3685329Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:06:30.3686087Z  log.info( 2025-09-07T07:06:30.3686844Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:06:30.3687645Z  ) 2025-09-07T07:06:30.3688227Z  continue 2025-09-07T07:06:30.3688686Z  2025-09-07T07:06:30.3689097Z  if opt_out_experiments: 2025-09-07T07:06:30.3689715Z  if experiment_name in opt_out_experiments: 2025-09-07T07:06:30.3690432Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:06:30.3691085Z  log.info( 2025-09-07T07:06:30.3692097Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:06:30.3693148Z  ) 2025-09-07T07:06:30.3693612Z  continue 2025-09-07T07:06:30.3694101Z  2025-09-07T07:06:30.3694570Z  if eligible_experiments: 2025-09-07T07:06:30.3695215Z  if experiment_name not in eligible_experiments: 2025-09-07T07:06:30.3695923Z  exp_list = ", ".join(eligible_experiments) 2025-09-07T07:06:30.3696527Z  log.info( 2025-09-07T07:06:30.3697390Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:06:30.3698448Z  ) 2025-09-07T07:06:30.3698920Z  continue 2025-09-07T07:06:30.3699635Z  elif not experiment_settings.default: 2025-09-07T07:06:30.3700221Z  log.info( 2025-09-07T07:06:30.3700969Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:06:30.3701747Z  ) 2025-09-07T07:06:30.3702189Z  continue 2025-09-07T07:06:30.3702639Z  2025-09-07T07:06:30.3703150Z  # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:06:30.3703818Z  opted_out_users = [ 2025-09-07T07:06:30.3704337Z  requestor 2025-09-07T07:06:30.3704883Z  for requestor in workflow_requestors 2025-09-07T07:06:30.3705619Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:06:30.3706301Z  ] 2025-09-07T07:06:30.3706704Z  2025-09-07T07:06:30.3707103Z  if opted_out_users: 2025-09-07T07:06:30.3707655Z  log.info( 2025-09-07T07:06:30.3708469Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:06:30.3709218Z  ) 2025-09-07T07:06:30.3709658Z  continue 2025-09-07T07:06:30.3710122Z  2025-09-07T07:06:30.3710630Z  # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:06:30.3711294Z  opted_in_users = [ 2025-09-07T07:06:30.3711840Z  requestor 2025-09-07T07:06:30.3712393Z  for requestor in workflow_requestors 2025-09-07T07:06:30.3713140Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:06:30.3713843Z  ] 2025-09-07T07:06:30.3714255Z  2025-09-07T07:06:30.3714644Z  enabled = False 2025-09-07T07:06:30.3715159Z  if opted_in_users: 2025-09-07T07:06:30.3715822Z  log.info( 2025-09-07T07:06:30.3716529Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:06:30.3717267Z  ) 2025-09-07T07:06:30.3717713Z  enabled = True 2025-09-07T07:06:30.3718318Z  2025-09-07T07:06:30.3718775Z  elif experiment_settings.rollout_perc: 2025-09-07T07:06:30.3719681Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:06:30.3720700Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:06:30.3721407Z  log.info( 2025-09-07T07:06:30.3722358Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:06:30.3723329Z  ) 2025-09-07T07:06:30.3723827Z  enabled = True 2025-09-07T07:06:30.3724344Z  2025-09-07T07:06:30.3724741Z  if enabled: 2025-09-07T07:06:30.3725254Z  label = experiment_name 2025-09-07T07:06:30.3725872Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:06:30.3726774Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:06:30.3727712Z  # - If it's enabled, then we always list it's prefix first 2025-09-07T07:06:30.3728783Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:06:30.3729518Z  if is_canary: 2025-09-07T07:06:30.3730087Z  label += CANARY_FLEET_SUFFIX 2025-09-07T07:06:30.3730697Z  fleet_prefix = label 2025-09-07T07:06:30.3731235Z  else: 2025-09-07T07:06:30.3731995Z  prefixes.append(label) 2025-09-07T07:06:30.3732542Z  2025-09-07T07:06:30.3732939Z  if len(prefixes) > 1: 2025-09-07T07:06:30.3733452Z  log.error( 2025-09-07T07:06:30.3734577Z  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-07T07:06:30.3735760Z  ) 2025-09-07T07:06:30.3736204Z  prefixes = prefixes[:1] 2025-09-07T07:06:30.3736723Z  2025-09-07T07:06:30.3737120Z  # Fleet always comes first 2025-09-07T07:06:30.3737657Z  if fleet_prefix: 2025-09-07T07:06:30.3738398Z  prefixes.insert(0, fleet_prefix) 2025-09-07T07:06:30.3738956Z  2025-09-07T07:06:30.3739451Z  return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:06:30.3740059Z  2025-09-07T07:06:30.3740435Z  2025-09-07T07:06:30.3741135Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:06:30.3741955Z  """ 2025-09-07T07:06:30.3742605Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:06:30.3743365Z  2025-09-07T07:06:30.3743995Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:06:30.3744742Z  """ 2025-09-07T07:06:30.3745198Z  gh = get_gh_client(github_token) 2025-09-07T07:06:30.3745816Z  issue = get_issue(gh, repo, issue_num) 2025-09-07T07:06:30.3746524Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:06:30.3747162Z  2025-09-07T07:06:30.3747535Z  2025-09-07T07:06:30.3748293Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:06:30.3749256Z  for _ in range(num_retries): 2025-09-07T07:06:30.3749797Z  try: 2025-09-07T07:06:30.3750288Z  req = Request(url=url, headers=headers) 2025-09-07T07:06:30.3751023Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:06:30.3751725Z  return json.loads(content) 2025-09-07T07:06:30.3752311Z  except Exception as e: 2025-09-07T07:06:30.3752937Z  log.warning(f"Could not download {url}: {e}") 2025-09-07T07:06:30.3753528Z  2025-09-07T07:06:30.3754155Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:06:30.3754916Z  return {} 2025-09-07T07:06:30.3755349Z  2025-09-07T07:06:30.3755719Z  2025-09-07T07:06:30.3756095Z @cache 2025-09-07T07:06:30.3756794Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:06:30.3757616Z  """ 2025-09-07T07:06:30.3758168Z  Dynamically get PR information 2025-09-07T07:06:30.3758861Z  """ 2025-09-07T07:06:30.3759442Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:06:30.3760111Z  headers = { 2025-09-07T07:06:30.3760656Z  "Accept": "application/vnd.github.v3+json", 2025-09-07T07:06:30.3761328Z  "Authorization": f"token {github_token}", 2025-09-07T07:06:30.3761905Z  } 2025-09-07T07:06:30.3762404Z  json_response: dict[str, Any] = download_json( 2025-09-07T07:06:30.3763062Z  url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:06:30.3763659Z  headers=headers, 2025-09-07T07:06:30.3764143Z  ) 2025-09-07T07:06:30.3764535Z  2025-09-07T07:06:30.3764949Z  if not json_response: 2025-09-07T07:06:30.3765614Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:06:30.3766628Z  return {} 2025-09-07T07:06:30.3767079Z  2025-09-07T07:06:30.3767485Z  return json_response 2025-09-07T07:06:30.3768081Z  2025-09-07T07:06:30.3768452Z  2025-09-07T07:06:30.3769090Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:06:30.3769875Z  """ 2025-09-07T07:06:30.3770473Z  Dynamically get the latest list of labels from the pull request 2025-09-07T07:06:30.3771172Z  """ 2025-09-07T07:06:30.3771719Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:06:30.3772387Z  return { 2025-09-07T07:06:30.3773045Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:06:30.3773775Z  } 2025-09-07T07:06:30.3774169Z  2025-09-07T07:06:30.3774533Z  2025-09-07T07:06:30.3774946Z def main() -> None: 2025-09-07T07:06:30.3775446Z  args = parse_args() 2025-09-07T07:06:30.3775935Z  2025-09-07T07:06:30.3776396Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:06:30.3776983Z  2025-09-07T07:06:30.3777398Z  # Check if the PR is opt-out 2025-09-07T07:06:30.3778041Z  if args.pr_number: 2025-09-07T07:06:30.3778793Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:06:30.3779598Z  if OPT_OUT_LABEL in labels: 2025-09-07T07:06:30.3780152Z  log.info( 2025-09-07T07:06:30.3780928Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:06:30.3781738Z  ) 2025-09-07T07:06:30.3782377Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:06:30.3783119Z  sys.exit() 2025-09-07T07:06:30.3783730Z  2025-09-07T07:06:30.3784109Z  try: 2025-09-07T07:06:30.3784623Z  rollout_state = get_rollout_state_from_issue( 2025-09-07T07:06:30.3785397Z  args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:06:30.3786100Z  ) 2025-09-07T07:06:30.3786514Z  2025-09-07T07:06:30.3786947Z  username = get_potential_pr_author( 2025-09-07T07:06:30.3787545Z  args.github_token, 2025-09-07T07:06:30.3788230Z  args.github_repo, 2025-09-07T07:06:30.3788782Z  args.github_actor, 2025-09-07T07:06:30.3789339Z  args.github_ref_type, 2025-09-07T07:06:30.3789906Z  args.github_branch, 2025-09-07T07:06:30.3790426Z  ) 2025-09-07T07:06:30.3790828Z  2025-09-07T07:06:30.3791363Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:06:30.3792018Z  2025-09-07T07:06:30.3792481Z  runner_label_prefix = get_runner_prefix( 2025-09-07T07:06:30.3793080Z  rollout_state, 2025-09-07T07:06:30.3793653Z  (args.github_issue_owner, username), 2025-09-07T07:06:30.3794247Z  args.github_branch, 2025-09-07T07:06:30.3794826Z  args.eligible_experiments, 2025-09-07T07:06:30.3795431Z  args.opt_out_experiments, 2025-09-07T07:06:30.3795987Z  is_canary, 2025-09-07T07:06:30.3796467Z  ) 2025-09-07T07:06:30.3796871Z  2025-09-07T07:06:30.3797276Z  except Exception as e: 2025-09-07T07:06:30.3797786Z  log.error( 2025-09-07T07:06:30.3798665Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:06:30.3799472Z  ) 2025-09-07T07:06:30.3800053Z  2025-09-07T07:06:30.3800625Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:06:30.3801314Z  2025-09-07T07:06:30.3801687Z  2025-09-07T07:06:30.3802076Z if __name__ == "__main__": 2025-09-07T07:06:30.3802584Z  main() 2025-09-07T07:06:30.3802995Z  2025-09-07T07:06:30.3803370Z EOF 2025-09-07T07:06:30.3803748Z  2025-09-07T07:06:30.3804162Z cat runner_determinator.py 2025-09-07T07:06:30.8796237Z shell: /usr/bin/bash -e {0} 2025-09-07T07:06:30.8798198Z env: 2025-09-07T07:06:30.8799944Z GITHUB_TOKEN: *** 2025-09-07T07:06:30.8800992Z ISSUE_NUMBER: 5132 2025-09-07T07:06:30.8802107Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:06:30.8803381Z ISSUE_OWNER: 2025-09-07T07:06:30.8804344Z CHECK_EXPERIMENTS: 2025-09-07T07:06:30.8805454Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:06:30.8806583Z PR_NUMBER: 2025-09-07T07:06:30.8807533Z ##[endgroup] 2025-09-07T07:06:30.9031536Z # flake8: noqa: G004 2025-09-07T07:06:30.9032226Z 2025-09-07T07:06:30.9033131Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-09-07T07:06:30.9035192Z # must be kept in sync. You can do it easily by running the following command: 2025-09-07T07:06:30.9036984Z # python .github/scripts/update_runner_determinator.py 2025-09-07T07:06:30.9038323Z 2025-09-07T07:06:30.9038762Z """ 2025-09-07T07:06:30.9040102Z This runner determinator is used to determine which set of runners to run a 2025-09-07T07:06:30.9042047Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-09-07T07:06:30.9044097Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-09-07T07:06:30.9046005Z of which runners should be used to run which job. 2025-09-07T07:06:30.9046935Z 2025-09-07T07:06:30.9047821Z The configuration has two parts, the settings and a list of opted-in users, 2025-09-07T07:06:30.9050409Z separated by a line containing "---". If the line is not present, the 2025-09-07T07:06:30.9052717Z settings are considered to be empty with only the second part, the user 2025-09-07T07:06:30.9054510Z list, defined. 2025-09-07T07:06:30.9055075Z 2025-09-07T07:06:30.9056005Z The first part is a YAML block that defines the rollout settings. This can be 2025-09-07T07:06:30.9059282Z used to define any settings that are needed to determine which runners to use. 2025-09-07T07:06:30.9061475Z It's fields are defined by the RolloutSettings class below. 2025-09-07T07:06:30.9062620Z 2025-09-07T07:06:30.9063551Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-09-07T07:06:30.9065753Z The user list is also a comma separated list of additional features or 2025-09-07T07:06:30.9067641Z experiments which the user could be opted in to. 2025-09-07T07:06:30.9068959Z 2025-09-07T07:06:30.9069455Z The user list has the following rules: 2025-09-07T07:06:30.9070348Z 2025-09-07T07:06:30.9071151Z - Users are GitHub usernames, which must start with the @ prefix 2025-09-07T07:06:30.9073373Z - Each user is also a comma-separated list of features/experiments to enable 2025-09-07T07:06:30.9075320Z - A "#" prefix opts the user out of all experiments 2025-09-07T07:06:30.9076337Z 2025-09-07T07:06:30.9076776Z Example config: 2025-09-07T07:06:30.9077876Z # A list of experiments that can be opted into. 2025-09-07T07:06:30.9079712Z # This defines the behavior they'll induce when opted into. 2025-09-07T07:06:30.9081261Z # Expected syntax is: 2025-09-07T07:06:30.9082792Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-09-07T07:06:30.9085268Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-09-07T07:06:30.9086820Z 2025-09-07T07:06:30.9087202Z experiments: 2025-09-07T07:06:30.9088253Z lf: 2025-09-07T07:06:30.9089104Z rollout_percent: 25 2025-09-07T07:06:30.9090157Z all_branches: false 2025-09-07T07:06:30.9091418Z default: true 2025-09-07T07:06:30.9092331Z --- 2025-09-07T07:06:30.9092762Z 2025-09-07T07:06:30.9093105Z # Opt-ins: 2025-09-07T07:06:30.9094426Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-09-07T07:06:30.9096503Z # and specifying experiments to enable in a comma-separated list. 2025-09-07T07:06:30.9098582Z # To always opt out of an experiment, prefix it with a "-". 2025-09-07T07:06:30.9100166Z # Experiments should be from the above list. 2025-09-07T07:06:30.9101089Z 2025-09-07T07:06:30.9101476Z @User1,-lf,split_build 2025-09-07T07:06:30.9102483Z @User2,lf 2025-09-07T07:06:30.9103328Z @User3,split_build 2025-09-07T07:06:30.9104247Z """ 2025-09-07T07:06:30.9104659Z 2025-09-07T07:06:30.9105016Z import json 2025-09-07T07:06:30.9105827Z import logging 2025-09-07T07:06:30.9106671Z import os 2025-09-07T07:06:30.9107478Z import random 2025-09-07T07:06:30.9108517Z import re 2025-09-07T07:06:30.9109319Z import sys 2025-09-07T07:06:30.9110210Z from argparse import ArgumentParser 2025-09-07T07:06:30.9111424Z from collections.abc import Iterable 2025-09-07T07:06:30.9112617Z from functools import cache 2025-09-07T07:06:30.9113656Z from logging import LogRecord 2025-09-07T07:06:30.9114757Z from typing import Any, NamedTuple 2025-09-07T07:06:30.9115979Z from urllib.request import Request, urlopen 2025-09-07T07:06:30.9116849Z 2025-09-07T07:06:30.9117195Z import yaml 2025-09-07T07:06:30.9118138Z from github import Auth, Github 2025-09-07T07:06:30.9119247Z from github.Issue import Issue 2025-09-07T07:06:30.9119957Z 2025-09-07T07:06:30.9119966Z 2025-09-07T07:06:30.9120445Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-09-07T07:06:30.9122036Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-09-07T07:06:30.9124063Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-09-07T07:06:30.9125437Z 2025-09-07T07:06:30.9125950Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-09-07T07:06:30.9127555Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-09-07T07:06:30.9128863Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-09-07T07:06:30.9130163Z OPT_OUT_LABEL = "no-runner-experiments" 2025-09-07T07:06:30.9131022Z 2025-09-07T07:06:30.9131452Z SETTING_EXPERIMENTS = "experiments" 2025-09-07T07:06:30.9132247Z 2025-09-07T07:06:30.9132640Z LF_FLEET_EXPERIMENT = "lf" 2025-09-07T07:06:30.9133701Z CANARY_FLEET_SUFFIX = ".c" 2025-09-07T07:06:30.9134352Z 2025-09-07T07:06:30.9134359Z 2025-09-07T07:06:30.9134772Z class Experiment(NamedTuple): 2025-09-07T07:06:30.9135863Z rollout_perc: float = ( 2025-09-07T07:06:30.9137354Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-09-07T07:06:30.9139208Z ) 2025-09-07T07:06:30.9140042Z all_branches: bool = ( 2025-09-07T07:06:30.9142163Z False # If True, the experiment is also enabled on the exception branches 2025-09-07T07:06:30.9143999Z ) 2025-09-07T07:06:30.9144786Z default: bool = ( 2025-09-07T07:06:30.9146086Z True # If True, the experiment is enabled by default for all queries 2025-09-07T07:06:30.9147610Z ) 2025-09-07T07:06:30.9148160Z 2025-09-07T07:06:30.9148524Z # Add more fields as needed 2025-09-07T07:06:30.9149210Z 2025-09-07T07:06:30.9149218Z 2025-09-07T07:06:30.9149608Z class Settings(NamedTuple): 2025-09-07T07:06:30.9150567Z """ 2025-09-07T07:06:30.9151547Z Settings for the experiments that can be opted into. 2025-09-07T07:06:30.9152858Z """ 2025-09-07T07:06:30.9153267Z 2025-09-07T07:06:30.9153696Z experiments: dict[str, Experiment] = {} 2025-09-07T07:06:30.9154544Z 2025-09-07T07:06:30.9154551Z 2025-09-07T07:06:30.9155002Z class ColorFormatter(logging.Formatter): 2025-09-07T07:06:30.9156440Z """Color codes the log messages based on the log level""" 2025-09-07T07:06:30.9157488Z 2025-09-07T07:06:30.9157822Z COLORS = { 2025-09-07T07:06:30.9158795Z "WARNING": "\033[33m", # Yellow 2025-09-07T07:06:30.9160132Z "ERROR": "\033[31m", # Red 2025-09-07T07:06:30.9161233Z "CRITICAL": "\033[31m", # Red 2025-09-07T07:06:30.9162330Z "INFO": "\033[0m", # Reset 2025-09-07T07:06:30.9163371Z "DEBUG": "\033[0m", # Reset 2025-09-07T07:06:30.9164381Z } 2025-09-07T07:06:30.9164775Z 2025-09-07T07:06:30.9165217Z def format(self, record: LogRecord) -> str: 2025-09-07T07:06:30.9166957Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-09-07T07:06:30.9168897Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-09-07T07:06:30.9170205Z return super().format(record) 2025-09-07T07:06:30.9170968Z 2025-09-07T07:06:30.9170976Z 2025-09-07T07:06:30.9171387Z handler = logging.StreamHandler() 2025-09-07T07:06:30.9173060Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-09-07T07:06:30.9174444Z 2025-09-07T07:06:30.9174966Z log = logging.getLogger(os.path.basename(__file__)) 2025-09-07T07:06:30.9176255Z log.addHandler(handler) 2025-09-07T07:06:30.9177204Z log.setLevel(logging.INFO) 2025-09-07T07:06:30.9177839Z 2025-09-07T07:06:30.9177846Z 2025-09-07T07:06:30.9178472Z def set_github_output(key: str, value: str) -> None: 2025-09-07T07:06:30.9179724Z """ 2025-09-07T07:06:30.9180805Z Defines outputs of the github action that invokes this script 2025-09-07T07:06:30.9182222Z """ 2025-09-07T07:06:30.9182975Z if not GITHUB_OUTPUT: 2025-09-07T07:06:30.9185616Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-09-07T07:06:30.9188749Z log.warning( 2025-09-07T07:06:30.9190869Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-09-07T07:06:30.9193090Z ) 2025-09-07T07:06:30.9206805Z print(f"::set-output name={key}::{value}") 2025-09-07T07:06:30.9208287Z return 2025-09-07T07:06:30.9208777Z 2025-09-07T07:06:30.9209402Z with open(GITHUB_OUTPUT, "a") as f: 2025-09-07T07:06:30.9210671Z log.info(f"Setting output: {key}='{value}'") 2025-09-07T07:06:30.9211942Z f.write(f"{key}={value}\n") 2025-09-07T07:06:30.9212664Z 2025-09-07T07:06:30.9212673Z 2025-09-07T07:06:30.9213334Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-09-07T07:06:30.9214735Z return frozenset( 2025-09-07T07:06:30.9216079Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-09-07T07:06:30.9217623Z ) 2025-09-07T07:06:30.9218147Z 2025-09-07T07:06:30.9218155Z 2025-09-07T07:06:30.9218513Z def parse_args() -> Any: 2025-09-07T07:06:30.9219692Z parser = ArgumentParser("Get dynamic rollout settings") 2025-09-07T07:06:30.9221663Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-09-07T07:06:30.9223419Z parser.add_argument( 2025-09-07T07:06:30.9224364Z "--github-issue-repo", 2025-09-07T07:06:30.9225343Z type=str, 2025-09-07T07:06:30.9226167Z required=False, 2025-09-07T07:06:30.9227089Z default="pytorch/test-infra", 2025-09-07T07:06:30.9228347Z help="GitHub repo to get the issue", 2025-09-07T07:06:30.9229463Z ) 2025-09-07T07:06:30.9230208Z parser.add_argument( 2025-09-07T07:06:30.9231128Z "--github-repo", 2025-09-07T07:06:30.9231999Z type=str, 2025-09-07T07:06:30.9232809Z required=True, 2025-09-07T07:06:30.9233756Z help="GitHub repo where CI is running", 2025-09-07T07:06:30.9234892Z ) 2025-09-07T07:06:30.9235625Z parser.add_argument( 2025-09-07T07:06:30.9236945Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-09-07T07:06:30.9295207Z ) 2025-09-07T07:06:30.9296625Z parser.add_argument( 2025-09-07T07:06:30.9299076Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-09-07T07:06:30.9300913Z ) 2025-09-07T07:06:30.9301665Z parser.add_argument( 2025-09-07T07:06:30.9303511Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-09-07T07:06:30.9305083Z ) 2025-09-07T07:06:30.9305813Z parser.add_argument( 2025-09-07T07:06:30.9307255Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-09-07T07:06:30.9309111Z ) 2025-09-07T07:06:30.9309841Z parser.add_argument( 2025-09-07T07:06:30.9310759Z "--github-ref-type", 2025-09-07T07:06:30.9311687Z type=str, 2025-09-07T07:06:30.9312481Z required=True, 2025-09-07T07:06:30.9313506Z help="Current GitHub ref type, branch or tag", 2025-09-07T07:06:30.9314675Z ) 2025-09-07T07:06:30.9315407Z parser.add_argument( 2025-09-07T07:06:30.9316356Z "--eligible-experiments", 2025-09-07T07:06:30.9317422Z type=_str_comma_separated_to_set, 2025-09-07T07:06:30.9318638Z required=False, 2025-09-07T07:06:30.9319486Z default="", 2025-09-07T07:06:30.9321360Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-09-07T07:06:30.9323468Z ) 2025-09-07T07:06:30.9324196Z parser.add_argument( 2025-09-07T07:06:30.9325122Z "--opt-out-experiments", 2025-09-07T07:06:30.9326166Z type=_str_comma_separated_to_set, 2025-09-07T07:06:30.9327281Z required=False, 2025-09-07T07:06:30.9328224Z default="", 2025-09-07T07:06:30.9329011Z help=( 2025-09-07T07:06:30.9330440Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-09-07T07:06:30.9333053Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-09-07T07:06:30.9334925Z ), 2025-09-07T07:06:30.9335633Z ) 2025-09-07T07:06:30.9336360Z parser.add_argument( 2025-09-07T07:06:30.9337245Z "--pr-number", 2025-09-07T07:06:30.9338170Z type=str, 2025-09-07T07:06:30.9338964Z required=False, 2025-09-07T07:06:30.9339821Z default="", 2025-09-07T07:06:30.9340975Z help="the optional PR number where this is run", 2025-09-07T07:06:30.9342176Z ) 2025-09-07T07:06:30.9342601Z 2025-09-07T07:06:30.9342971Z return parser.parse_args() 2025-09-07T07:06:30.9343631Z 2025-09-07T07:06:30.9343639Z 2025-09-07T07:06:30.9344493Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-09-07T07:06:30.9346133Z auth = Auth.Token(github_token) 2025-09-07T07:06:30.9347162Z return Github(auth=auth) 2025-09-07T07:06:30.9347774Z 2025-09-07T07:06:30.9347782Z 2025-09-07T07:06:30.9349518Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-09-07T07:06:30.9351300Z repo = gh.get_repo(repo) 2025-09-07T07:06:30.9352298Z return repo.get_issue(number=issue_num) 2025-09-07T07:06:30.9353067Z 2025-09-07T07:06:30.9353074Z 2025-09-07T07:06:30.9353448Z def get_potential_pr_author( 2025-09-07T07:06:30.9354829Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-09-07T07:06:30.9356290Z ) -> str: 2025-09-07T07:06:30.9357346Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-09-07T07:06:30.9359303Z # Fetch the actual username from the original PR. The PR number is 2025-09-07T07:06:30.9360871Z # embedded in the tag name: ciflow// 2025-09-07T07:06:30.9361749Z 2025-09-07T07:06:30.9362114Z gh = get_gh_client(github_token) 2025-09-07T07:06:30.9362799Z 2025-09-07T07:06:30.9363332Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-09-07T07:06:30.9364625Z split_tag = ref_name.split("/") 2025-09-07T07:06:30.9365641Z if ( 2025-09-07T07:06:30.9366378Z len(split_tag) == 3 2025-09-07T07:06:30.9367342Z and split_tag[0] == "ciflow" 2025-09-07T07:06:30.9368536Z and split_tag[2].isnumeric() 2025-09-07T07:06:30.9369547Z ): 2025-09-07T07:06:30.9370288Z pr_number = split_tag[2] 2025-09-07T07:06:30.9371524Z try: 2025-09-07T07:06:30.9372433Z repository = gh.get_repo(repo) 2025-09-07T07:06:30.9373735Z pull = repository.get_pull(number=int(pr_number)) 2025-09-07T07:06:30.9375051Z except Exception as e: 2025-09-07T07:06:30.9376124Z raise Exception( # noqa: TRY002 2025-09-07T07:06:30.9377543Z f"issue with pull request {pr_number} from repo {repository}" 2025-09-07T07:06:30.9379121Z ) from e 2025-09-07T07:06:30.9380235Z return pull.user.login # type: ignore[no-any-return] 2025-09-07T07:06:30.9381752Z # In all other cases, return the original input username 2025-09-07T07:06:30.9382986Z return username 2025-09-07T07:06:30.9383485Z 2025-09-07T07:06:30.9383493Z 2025-09-07T07:06:30.9383949Z def is_exception_branch(branch: str) -> bool: 2025-09-07T07:06:30.9385060Z """ 2025-09-07T07:06:30.9386413Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-09-07T07:06:30.9388333Z """ 2025-09-07T07:06:30.9389493Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-09-07T07:06:30.9390636Z 2025-09-07T07:06:30.9390644Z 2025-09-07T07:06:30.9391038Z def load_yaml(yaml_text: str) -> Any: 2025-09-07T07:06:30.9392060Z try: 2025-09-07T07:06:30.9392826Z data = yaml.safe_load(yaml_text) 2025-09-07T07:06:30.9393869Z return data 2025-09-07T07:06:30.9394682Z except yaml.YAMLError: 2025-09-07T07:06:30.9395681Z log.exception("Error loading YAML") 2025-09-07T07:06:30.9397032Z raise 2025-09-07T07:06:30.9397635Z 2025-09-07T07:06:30.9397645Z 2025-09-07T07:06:30.9398769Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-09-07T07:06:30.9400371Z """ 2025-09-07T07:06:30.9401674Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-09-07T07:06:30.9403034Z 2025-09-07T07:06:30.9403959Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:06:30.9405591Z and the text below is the list of opted in users. 2025-09-07T07:06:30.9406469Z 2025-09-07T07:06:30.9407272Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-09-07T07:06:30.9408907Z """ 2025-09-07T07:06:30.9409788Z rollout_state_parts = rollout_state.split("---") 2025-09-07T07:06:30.9411042Z if len(rollout_state_parts) >= 2: 2025-09-07T07:06:30.9412304Z return rollout_state_parts[0], rollout_state_parts[1] 2025-09-07T07:06:30.9413545Z else: 2025-09-07T07:06:30.9414322Z return "", rollout_state 2025-09-07T07:06:30.9414953Z 2025-09-07T07:06:30.9414968Z 2025-09-07T07:06:30.9415373Z class UserOptins(dict[str, list[str]]): 2025-09-07T07:06:30.9416413Z """ 2025-09-07T07:06:30.9417507Z Dictionary of users with a list of features they have opted into 2025-09-07T07:06:30.9419029Z """ 2025-09-07T07:06:30.9419432Z 2025-09-07T07:06:30.9419457Z 2025-09-07T07:06:30.9420161Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-09-07T07:06:30.9421546Z """ 2025-09-07T07:06:30.9423073Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-09-07T07:06:30.9424635Z 2025-09-07T07:06:30.9425988Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-09-07T07:06:30.9428379Z - Example line: "@User1,lf,split_build" 2025-09-07T07:06:30.9429811Z - A "#" prefix indicates the user is opted out of all experiments 2025-09-07T07:06:30.9430860Z 2025-09-07T07:06:30.9430866Z 2025-09-07T07:06:30.9431180Z """ 2025-09-07T07:06:30.9431904Z optins = UserOptins() 2025-09-07T07:06:30.9432901Z for user in user_optin_text.split("\n"): 2025-09-07T07:06:30.9434046Z user = user.strip("\r\n\t -") 2025-09-07T07:06:30.9435158Z if not user or not user.startswith("@"): 2025-09-07T07:06:30.9436513Z # Not a valid user. Skip 2025-09-07T07:06:30.9437510Z continue 2025-09-07T07:06:30.9438110Z 2025-09-07T07:06:30.9438426Z if user: 2025-09-07T07:06:30.9439283Z usr_name = user.split(",")[0].strip("@") 2025-09-07T07:06:30.9440721Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-09-07T07:06:30.9441769Z 2025-09-07T07:06:30.9442095Z return optins 2025-09-07T07:06:30.9442565Z 2025-09-07T07:06:30.9442573Z 2025-09-07T07:06:30.9443143Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-09-07T07:06:30.9444411Z """ 2025-09-07T07:06:30.9445191Z Check if the experiment name is valid. 2025-09-07T07:06:30.9446261Z A valid name: 2025-09-07T07:06:30.9447556Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-09-07T07:06:30.9449667Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-09-07T07:06:30.9451189Z - Cannot contain spaces 2025-09-07T07:06:30.9452118Z """ 2025-09-07T07:06:30.9452510Z 2025-09-07T07:06:30.9453019Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-09-07T07:06:30.9454466Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-09-07T07:06:30.9455406Z 2025-09-07T07:06:30.9455717Z if valid: 2025-09-07T07:06:30.9456458Z return True 2025-09-07T07:06:30.9456924Z 2025-09-07T07:06:30.9457245Z log.error( 2025-09-07T07:06:30.9460554Z 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-07T07:06:30.9464038Z ) 2025-09-07T07:06:30.9464732Z return False 2025-09-07T07:06:30.9465194Z 2025-09-07T07:06:30.9465202Z 2025-09-07T07:06:30.9465808Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-09-07T07:06:30.9467087Z """ 2025-09-07T07:06:30.9468704Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-09-07T07:06:30.9470274Z """ 2025-09-07T07:06:30.9470955Z try: 2025-09-07T07:06:30.9471705Z if settings_text: 2025-09-07T07:06:30.9473573Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-09-07T07:06:30.9475524Z # for easy reading 2025-09-07T07:06:30.9477180Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-09-07T07:06:30.9479262Z # the backtick character in shell commands. 2025-09-07T07:06:30.9480503Z backtick = chr(96) # backtick character 2025-09-07T07:06:30.9481852Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-09-07T07:06:30.9483222Z settings = load_yaml(settings_text) 2025-09-07T07:06:30.9484042Z 2025-09-07T07:06:30.9485072Z # For now we just load experiments. We can expand this if/when we add more settings 2025-09-07T07:06:30.9486665Z experiments = {} 2025-09-07T07:06:30.9487247Z 2025-09-07T07:06:30.9488228Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-09-07T07:06:30.9489825Z if not is_valid_experiment_name(exp_name): 2025-09-07T07:06:30.9492186Z # 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-07T07:06:30.9494433Z continue 2025-09-07T07:06:30.9495010Z 2025-09-07T07:06:30.9495356Z valid_settings = {} 2025-09-07T07:06:30.9496407Z for setting in exp_settings: 2025-09-07T07:06:30.9497558Z if setting not in Experiment._fields: 2025-09-07T07:06:30.9498840Z log.warning( 2025-09-07T07:06:30.9500271Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-09-07T07:06:30.9502027Z ) 2025-09-07T07:06:30.9502862Z else: 2025-09-07T07:06:30.9503892Z valid_settings[setting] = exp_settings[setting] 2025-09-07T07:06:30.9504759Z 2025-09-07T07:06:30.9505314Z experiments[exp_name] = Experiment(**valid_settings) 2025-09-07T07:06:30.9506614Z return Settings(experiments) 2025-09-07T07:06:30.9507329Z 2025-09-07T07:06:30.9507666Z except Exception: 2025-09-07T07:06:30.9508825Z log.exception("Failed to parse settings") 2025-09-07T07:06:30.9509630Z 2025-09-07T07:06:30.9509958Z return Settings() 2025-09-07T07:06:30.9510471Z 2025-09-07T07:06:30.9510478Z 2025-09-07T07:06:30.9510970Z def parse_settings(rollout_state: str) -> Settings: 2025-09-07T07:06:30.9512096Z """ 2025-09-07T07:06:30.9512935Z Parse settings, if any, from the rollout state. 2025-09-07T07:06:30.9513751Z 2025-09-07T07:06:30.9514450Z If the issue body contains "---" then the text above that is the settings 2025-09-07T07:06:30.9516000Z and the text below is the list of opted in users. 2025-09-07T07:06:30.9516825Z 2025-09-07T07:06:30.9517651Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-09-07T07:06:30.9519281Z """ 2025-09-07T07:06:30.9520380Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:06:30.9521913Z return parse_settings_from_text(settings_text) 2025-09-07T07:06:30.9522727Z 2025-09-07T07:06:30.9522735Z 2025-09-07T07:06:30.9523225Z def parse_users(rollout_state: str) -> UserOptins: 2025-09-07T07:06:30.9524352Z """ 2025-09-07T07:06:30.9525115Z Parse users from the rollout state. 2025-09-07T07:06:30.9525829Z 2025-09-07T07:06:30.9526126Z """ 2025-09-07T07:06:30.9527172Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-09-07T07:06:30.9528742Z return parse_user_opt_in_from_text(users_text) 2025-09-07T07:06:30.9529547Z 2025-09-07T07:06:30.9529563Z 2025-09-07T07:06:30.9530559Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:06:30.9532100Z """ 2025-09-07T07:06:30.9532900Z Check if a user is opted into an experiment 2025-09-07T07:06:30.9533978Z """ 2025-09-07T07:06:30.9534870Z return experiment_name in user_optins.get(user, []) 2025-09-07T07:06:30.9535728Z 2025-09-07T07:06:30.9535736Z 2025-09-07T07:06:30.9536589Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-09-07T07:06:30.9538282Z """ 2025-09-07T07:06:30.9539173Z Check if a user explicitly opted out of an experiment 2025-09-07T07:06:30.9540345Z """ 2025-09-07T07:06:30.9541327Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-09-07T07:06:30.9542713Z experiment_optout = "-" + experiment_name 2025-09-07T07:06:30.9544000Z if experiment_optout not in user_optins.get(user, []): 2025-09-07T07:06:30.9545192Z return False 2025-09-07T07:06:30.9545688Z 2025-09-07T07:06:30.9546223Z if is_user_opted_in(user, user_optins, experiment_name): 2025-09-07T07:06:30.9547419Z log.warning( 2025-09-07T07:06:30.9549306Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-09-07T07:06:30.9551128Z ) 2025-09-07T07:06:30.9551530Z 2025-09-07T07:06:30.9551844Z return True 2025-09-07T07:06:30.9552292Z 2025-09-07T07:06:30.9552299Z 2025-09-07T07:06:30.9552634Z def get_runner_prefix( 2025-09-07T07:06:30.9553465Z rollout_state: str, 2025-09-07T07:06:30.9554362Z workflow_requestors: Iterable[str], 2025-09-07T07:06:30.9555368Z branch: str, 2025-09-07T07:06:30.9556312Z eligible_experiments: frozenset[str] = frozenset(), 2025-09-07T07:06:30.9557614Z opt_out_experiments: frozenset[str] = frozenset(), 2025-09-07T07:06:30.9558903Z is_canary: bool = False, 2025-09-07T07:06:30.9559778Z ) -> str: 2025-09-07T07:06:30.9560577Z settings = parse_settings(rollout_state) 2025-09-07T07:06:30.9561920Z user_optins = parse_users(rollout_state) 2025-09-07T07:06:30.9562662Z 2025-09-07T07:06:30.9562993Z fleet_prefix = "" 2025-09-07T07:06:30.9563815Z prefixes = [] 2025-09-07T07:06:30.9565028Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-09-07T07:06:30.9566905Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-09-07T07:06:30.9568474Z log.info( 2025-09-07T07:06:30.9569815Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-09-07T07:06:30.9571345Z ) 2025-09-07T07:06:30.9572110Z continue 2025-09-07T07:06:30.9572588Z 2025-09-07T07:06:30.9572936Z if opt_out_experiments: 2025-09-07T07:06:30.9573956Z if experiment_name in opt_out_experiments: 2025-09-07T07:06:30.9575206Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-09-07T07:06:30.9576380Z log.info( 2025-09-07T07:06:30.9578420Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-09-07T07:06:30.9580413Z ) 2025-09-07T07:06:30.9581168Z continue 2025-09-07T07:06:30.9581677Z 2025-09-07T07:06:30.9582043Z if eligible_experiments: 2025-09-07T07:06:30.9583124Z if experiment_name not in eligible_experiments: 2025-09-07T07:06:30.9584372Z exp_list = ", ".join(eligible_experiments) 2025-09-07T07:06:30.9585459Z log.info( 2025-09-07T07:06:30.9587026Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-09-07T07:06:30.9589037Z ) 2025-09-07T07:06:30.9589802Z continue 2025-09-07T07:06:30.9590710Z elif not experiment_settings.default: 2025-09-07T07:06:30.9591757Z log.info( 2025-09-07T07:06:30.9593218Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-09-07T07:06:30.9594721Z ) 2025-09-07T07:06:30.9595455Z continue 2025-09-07T07:06:30.9595928Z 2025-09-07T07:06:30.9596469Z # Is any workflow_requestor opted out to this experiment? 2025-09-07T07:06:30.9597695Z opted_out_users = [ 2025-09-07T07:06:30.9598800Z requestor 2025-09-07T07:06:30.9599682Z for requestor in workflow_requestors 2025-09-07T07:06:30.9600993Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-09-07T07:06:30.9602237Z ] 2025-09-07T07:06:30.9602623Z 2025-09-07T07:06:30.9602967Z if opted_out_users: 2025-09-07T07:06:30.9603818Z log.info( 2025-09-07T07:06:30.9605022Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-09-07T07:06:30.9606401Z ) 2025-09-07T07:06:30.9607121Z continue 2025-09-07T07:06:30.9607616Z 2025-09-07T07:06:30.9608253Z # Is any workflow_requestor opted in to this experiment? 2025-09-07T07:06:30.9609468Z opted_in_users = [ 2025-09-07T07:06:30.9610326Z requestor 2025-09-07T07:06:30.9611182Z for requestor in workflow_requestors 2025-09-07T07:06:30.9612492Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-09-07T07:06:30.9613715Z ] 2025-09-07T07:06:30.9614101Z 2025-09-07T07:06:30.9614422Z enabled = False 2025-09-07T07:06:30.9615237Z if opted_in_users: 2025-09-07T07:06:30.9616088Z log.info( 2025-09-07T07:06:30.9617239Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-09-07T07:06:30.9618720Z ) 2025-09-07T07:06:30.9619442Z enabled = True 2025-09-07T07:06:30.9620006Z 2025-09-07T07:06:30.9620421Z elif experiment_settings.rollout_perc: 2025-09-07T07:06:30.9622083Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-09-07T07:06:30.9624142Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-09-07T07:06:30.9625423Z log.info( 2025-09-07T07:06:30.9627108Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-09-07T07:06:30.9629040Z ) 2025-09-07T07:06:30.9629801Z enabled = True 2025-09-07T07:06:30.9630371Z 2025-09-07T07:06:30.9630675Z if enabled: 2025-09-07T07:06:30.9631461Z label = experiment_name 2025-09-07T07:06:30.9632500Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-09-07T07:06:30.9634131Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-09-07T07:06:30.9635862Z # - If it's enabled, then we always list it's prefix first 2025-09-07T07:06:30.9637342Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-09-07T07:06:30.9638797Z if is_canary: 2025-09-07T07:06:30.9639726Z label += CANARY_FLEET_SUFFIX 2025-09-07T07:06:30.9640767Z fleet_prefix = label 2025-09-07T07:06:30.9641695Z else: 2025-09-07T07:06:30.9642501Z prefixes.append(label) 2025-09-07T07:06:30.9643171Z 2025-09-07T07:06:30.9643508Z if len(prefixes) > 1: 2025-09-07T07:06:30.9644345Z log.error( 2025-09-07T07:06:30.9646402Z 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-07T07:06:30.9648762Z ) 2025-09-07T07:06:30.9649491Z prefixes = prefixes[:1] 2025-09-07T07:06:30.9650081Z 2025-09-07T07:06:30.9650435Z # Fleet always comes first 2025-09-07T07:06:30.9651333Z if fleet_prefix: 2025-09-07T07:06:30.9652175Z prefixes.insert(0, fleet_prefix) 2025-09-07T07:06:30.9652889Z 2025-09-07T07:06:30.9653497Z return ".".join(prefixes) + "." if prefixes else "" 2025-09-07T07:06:30.9654312Z 2025-09-07T07:06:30.9654320Z 2025-09-07T07:06:30.9655173Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-09-07T07:06:30.9656682Z """ 2025-09-07T07:06:30.9657808Z Gets the first comment of the issue, which contains the desired rollout state. 2025-09-07T07:06:30.9659011Z 2025-09-07T07:06:30.9659752Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-09-07T07:06:30.9661134Z """ 2025-09-07T07:06:30.9661859Z gh = get_gh_client(github_token) 2025-09-07T07:06:30.9662888Z issue = get_issue(gh, repo, issue_num) 2025-09-07T07:06:30.9664075Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-09-07T07:06:30.9664938Z 2025-09-07T07:06:30.9664947Z 2025-09-07T07:06:30.9665702Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-09-07T07:06:30.9667179Z for _ in range(num_retries): 2025-09-07T07:06:30.9668164Z try: 2025-09-07T07:06:30.9668959Z req = Request(url=url, headers=headers) 2025-09-07T07:06:30.9670219Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-09-07T07:06:30.9671448Z return json.loads(content) 2025-09-07T07:06:30.9672472Z except Exception as e: 2025-09-07T07:06:30.9673496Z log.warning(f"Could not download {url}: {e}") 2025-09-07T07:06:30.9674274Z 2025-09-07T07:06:30.9675006Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-09-07T07:06:30.9676372Z return {} 2025-09-07T07:06:30.9676781Z 2025-09-07T07:06:30.9676789Z 2025-09-07T07:06:30.9677075Z @cache 2025-09-07T07:06:30.9678340Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-09-07T07:06:30.9679845Z """ 2025-09-07T07:06:30.9680580Z Dynamically get PR information 2025-09-07T07:06:30.9681506Z """ 2025-09-07T07:06:30.9682648Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-09-07T07:06:30.9683853Z headers = { 2025-09-07T07:06:30.9684698Z "Accept": "application/vnd.github.v3+json", 2025-09-07T07:06:30.9685844Z "Authorization": f"token {github_token}", 2025-09-07T07:06:30.9686849Z } 2025-09-07T07:06:30.9687635Z json_response: dict[str, Any] = download_json( 2025-09-07T07:06:30.9688963Z url=f"{github_api}/issues/{pr_number}", 2025-09-07T07:06:30.9689989Z headers=headers, 2025-09-07T07:06:30.9690793Z ) 2025-09-07T07:06:30.9691155Z 2025-09-07T07:06:30.9691479Z if not json_response: 2025-09-07T07:06:30.9692545Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-09-07T07:06:30.9693721Z return {} 2025-09-07T07:06:30.9694158Z 2025-09-07T07:06:30.9694480Z return json_response 2025-09-07T07:06:30.9695000Z 2025-09-07T07:06:30.9695008Z 2025-09-07T07:06:30.9695892Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-09-07T07:06:30.9697306Z """ 2025-09-07T07:06:30.9698405Z Dynamically get the latest list of labels from the pull request 2025-09-07T07:06:30.9699639Z """ 2025-09-07T07:06:30.9700539Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-09-07T07:06:30.9701703Z return { 2025-09-07T07:06:30.9702796Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-09-07T07:06:30.9704142Z } 2025-09-07T07:06:30.9704513Z 2025-09-07T07:06:30.9704521Z 2025-09-07T07:06:30.9704834Z def main() -> None: 2025-09-07T07:06:30.9705610Z args = parse_args() 2025-09-07T07:06:30.9706112Z 2025-09-07T07:06:30.9706515Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-09-07T07:06:30.9707259Z 2025-09-07T07:06:30.9707604Z # Check if the PR is opt-out 2025-09-07T07:06:30.9708614Z if args.pr_number: 2025-09-07T07:06:30.9709872Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-09-07T07:06:30.9711498Z if OPT_OUT_LABEL in labels: 2025-09-07T07:06:30.9712448Z log.info( 2025-09-07T07:06:30.9713738Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-09-07T07:06:30.9715231Z ) 2025-09-07T07:06:30.9716262Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:06:30.9717551Z sys.exit() 2025-09-07T07:06:30.9718152Z 2025-09-07T07:06:30.9718444Z try: 2025-09-07T07:06:30.9719263Z rollout_state = get_rollout_state_from_issue( 2025-09-07T07:06:30.9720623Z args.github_token, args.github_issue_repo, args.github_issue 2025-09-07T07:06:30.9721853Z ) 2025-09-07T07:06:30.9722238Z 2025-09-07T07:06:30.9722614Z username = get_potential_pr_author( 2025-09-07T07:06:30.9723624Z args.github_token, 2025-09-07T07:06:30.9724531Z args.github_repo, 2025-09-07T07:06:30.9725427Z args.github_actor, 2025-09-07T07:06:30.9726350Z args.github_ref_type, 2025-09-07T07:06:30.9727300Z args.github_branch, 2025-09-07T07:06:30.9728246Z ) 2025-09-07T07:06:30.9728626Z 2025-09-07T07:06:30.9729163Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-09-07T07:06:30.9730040Z 2025-09-07T07:06:30.9730449Z runner_label_prefix = get_runner_prefix( 2025-09-07T07:06:30.9731501Z rollout_state, 2025-09-07T07:06:30.9732426Z (args.github_issue_owner, username), 2025-09-07T07:06:30.9733467Z args.github_branch, 2025-09-07T07:06:30.9734406Z args.eligible_experiments, 2025-09-07T07:06:30.9735431Z args.opt_out_experiments, 2025-09-07T07:06:30.9736378Z is_canary, 2025-09-07T07:06:30.9737141Z ) 2025-09-07T07:06:30.9737516Z 2025-09-07T07:06:30.9737853Z except Exception as e: 2025-09-07T07:06:30.9738790Z log.error( 2025-09-07T07:06:30.9740065Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-09-07T07:06:30.9741752Z ) 2025-09-07T07:06:30.9742140Z 2025-09-07T07:06:30.9742767Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-09-07T07:06:30.9743749Z 2025-09-07T07:06:30.9743756Z 2025-09-07T07:06:30.9744088Z if __name__ == "__main__": 2025-09-07T07:06:30.9744926Z main() 2025-09-07T07:06:30.9745324Z 2025-09-07T07:06:30.9862969Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:06:30.9864799Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-09-07T07:06:30.9897528Z shell: /usr/bin/bash -e {0} 2025-09-07T07:06:30.9898521Z env: 2025-09-07T07:06:30.9899674Z GITHUB_TOKEN: *** 2025-09-07T07:06:30.9900444Z ISSUE_NUMBER: 5132 2025-09-07T07:06:30.9901286Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:06:30.9902252Z ISSUE_OWNER: 2025-09-07T07:06:30.9903005Z CHECK_EXPERIMENTS: 2025-09-07T07:06:30.9903830Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:06:30.9904656Z PR_NUMBER: 2025-09-07T07:06:30.9905385Z ##[endgroup] 2025-09-07T07:06:33.4394527Z Defaulting to user installation because normal site-packages is not writeable 2025-09-07T07:06:34.6947147Z Collecting urllib3==1.26.18 2025-09-07T07:06:34.7283270Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-09-07T07:06:34.7704407Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.0 MB/s eta 0:00:00 2025-09-07T07:06:34.7830288Z Collecting PyGithub==2.3.0 2025-09-07T07:06:34.7867889Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-09-07T07:06:34.8301383Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-09-07T07:06:34.8337006Z 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-07T07:06:34.8383662Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-09-07T07:06:34.8397288Z 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-07T07:06:34.8419755Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-09-07T07:06:34.8693651Z Collecting Deprecated (from PyGithub==2.3.0) 2025-09-07T07:06:34.8727847Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-09-07T07:06:34.8965140Z 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-07T07:06:35.0157909Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:06:35.0192528Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-09-07T07:06:35.1451470Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-09-07T07:06:35.1489580Z 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-07T07:06:35.1676824Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-09-07T07:06:35.1712552Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-09-07T07:06:35.1960101Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-09-07T07:06:35.2029131Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 27.5 MB/s eta 0:00:00 2025-09-07T07:06:35.2065291Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-09-07T07:06:35.2128495Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 82.1 MB/s eta 0:00:00 2025-09-07T07:06:35.2161826Z 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-07T07:06:35.2263376Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 108.8 MB/s eta 0:00:00 2025-09-07T07:06:35.2311033Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-09-07T07:06:35.2369908Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-09-07T07:06:35.2438738Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 97.2 MB/s eta 0:00:00 2025-09-07T07:06:35.2479318Z 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-07T07:06:35.2526996Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 28.0 MB/s eta 0:00:00 2025-09-07T07:06:35.2561678Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-09-07T07:06:35.2609725Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 37.7 MB/s eta 0:00:00 2025-09-07T07:06:35.6534618Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-09-07T07:06:36.2103613Z 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-07T07:06:36.3350008Z ##[group]Run curr_branch="main" 2025-09-07T07:06:36.3350312Z curr_branch="main" 2025-09-07T07:06:36.3350531Z curr_ref_type="branch" 2025-09-07T07:06:36.3350816Z echo "Current branch is '$curr_branch'" 2025-09-07T07:06:36.3351075Z  2025-09-07T07:06:36.3351258Z python3 runner_determinator.py \ 2025-09-07T07:06:36.3351549Z  --github-token "$GITHUB_TOKEN" \ 2025-09-07T07:06:36.3351825Z  --github-issue "$ISSUE_NUMBER" \ 2025-09-07T07:06:36.3352073Z  --github-branch "$curr_branch" \ 2025-09-07T07:06:36.3352344Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-09-07T07:06:36.3352639Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-09-07T07:06:36.3352918Z  --github-ref-type "$curr_ref_type" \ 2025-09-07T07:06:36.3353179Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-09-07T07:06:36.3353475Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-09-07T07:06:36.3353835Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-09-07T07:06:36.3354125Z  --pr-number "${PR_NUMBER}" 2025-09-07T07:06:36.3385652Z shell: /usr/bin/bash -e {0} 2025-09-07T07:06:36.3385875Z env: 2025-09-07T07:06:36.3386323Z GITHUB_TOKEN: *** 2025-09-07T07:06:36.3386513Z ISSUE_NUMBER: 5132 2025-09-07T07:06:36.3386718Z TRIGGERING_ACTOR: pytorchmergebot 2025-09-07T07:06:36.3386950Z ISSUE_OWNER: 2025-09-07T07:06:36.3387131Z CHECK_EXPERIMENTS: 2025-09-07T07:06:36.3387324Z OPT_OUT_EXPERIMENTS: lf 2025-09-07T07:06:36.3387522Z PR_NUMBER: 2025-09-07T07:06:36.3387685Z ##[endgroup] 2025-09-07T07:06:36.3437423Z Current branch is 'main' 2025-09-07T07:06:38.1955829Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-09-07T07:06:38.1957262Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-09-07T07:06:38.1958428Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-09-07T07:06:38.1959298Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-09-07T07:06:38.1960004Z INFO : Setting output: label-type='' 2025-09-07T07:06:38.2318735Z Evaluate and set job outputs 2025-09-07T07:06:38.2326098Z Cleaning up orphan processes