2025-08-14T20:50:51.5687897Z Current runner version: '2.327.1' 2025-08-14T20:50:51.5710625Z ##[group]Runner Image Provisioner 2025-08-14T20:50:51.5711436Z Hosted Compute Agent 2025-08-14T20:50:51.5711955Z Version: 20250812.370 2025-08-14T20:50:51.5712618Z Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32 2025-08-14T20:50:51.5713307Z Build Date: 2025-08-12T16:08:14Z 2025-08-14T20:50:51.5713857Z ##[endgroup] 2025-08-14T20:50:51.5714463Z ##[group]Operating System 2025-08-14T20:50:51.5715178Z Ubuntu 2025-08-14T20:50:51.5715674Z 24.04.2 2025-08-14T20:50:51.5716142Z LTS 2025-08-14T20:50:51.5716633Z ##[endgroup] 2025-08-14T20:50:51.5717147Z ##[group]Runner Image 2025-08-14T20:50:51.5717684Z Image: ubuntu-24.04 2025-08-14T20:50:51.5718232Z Version: 20250804.2.0 2025-08-14T20:50:51.5719177Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250804.2/images/ubuntu/Ubuntu2404-Readme.md 2025-08-14T20:50:51.5720706Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250804.2 2025-08-14T20:50:51.5721685Z ##[endgroup] 2025-08-14T20:50:51.5722720Z ##[group]GITHUB_TOKEN Permissions 2025-08-14T20:50:51.5724789Z Contents: read 2025-08-14T20:50:51.5725623Z Metadata: read 2025-08-14T20:50:51.5726212Z ##[endgroup] 2025-08-14T20:50:51.5728258Z Secret source: Actions 2025-08-14T20:50:51.5728904Z Prepare workflow directory 2025-08-14T20:50:51.6276940Z Prepare all required actions 2025-08-14T20:50:51.6339778Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (1fc683cf17c8c673044538d10266c00f92987be2) 2025-08-14T20:50:51.6344428Z ##[group] Inputs 2025-08-14T20:50:51.6345364Z check_experiments: 2025-08-14T20:50:51.6345893Z opt_out_experiments: 2025-08-14T20:50:51.6346563Z triggering_actor: pytorchmergebot 2025-08-14T20:50:51.6347169Z issue_owner: 2025-08-14T20:50:51.6347617Z curr_branch: main 2025-08-14T20:50:51.6348208Z curr_ref_type: branch 2025-08-14T20:50:51.6348851Z issue_number: 5132 2025-08-14T20:50:51.6349363Z ##[endgroup] 2025-08-14T20:50:51.6350084Z Complete job name: before-test / get-label-type / runner-determinator 2025-08-14T20:50:52.3544384Z ##[group]Run cat < runner_determinator.py 2025-08-14T20:50:52.3547002Z cat < runner_determinator.py 2025-08-14T20:50:52.3547751Z # flake8: noqa: G004 2025-08-14T20:50:52.3548261Z  2025-08-14T20:50:52.3548990Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:50:52.3550102Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:50:52.3551001Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:50:52.3552031Z  2025-08-14T20:50:52.3552507Z """ 2025-08-14T20:50:52.3553221Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:50:52.3554204Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:50:52.3555522Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:50:52.3556467Z of which runners should be used to run which job. 2025-08-14T20:50:52.3557163Z  2025-08-14T20:50:52.3557865Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:50:52.3558843Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:50:52.3559858Z settings are considered to be empty with only the second part, the user 2025-08-14T20:50:52.3560719Z list, defined. 2025-08-14T20:50:52.3561187Z  2025-08-14T20:50:52.3561875Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:50:52.3562879Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:50:52.3563849Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:50:52.3564492Z  2025-08-14T20:50:52.3565638Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:50:52.3566630Z The user list is also a comma separated list of additional features or 2025-08-14T20:50:52.3567438Z experiments which the user could be opted in to. 2025-08-14T20:50:52.3568164Z  2025-08-14T20:50:52.3568619Z The user list has the following rules: 2025-08-14T20:50:52.3569202Z  2025-08-14T20:50:52.3569901Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:50:52.3570810Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:50:52.3571670Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:50:52.3572350Z  2025-08-14T20:50:52.3572792Z Example config: 2025-08-14T20:50:52.3573350Z  # A list of experiments that can be opted into. 2025-08-14T20:50:52.3574219Z  # This defines the behavior they'll induce when opted into. 2025-08-14T20:50:52.3574952Z  # Expected syntax is: 2025-08-14T20:50:52.3576014Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:50:52.3577140Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:50:52.3577942Z  2025-08-14T20:50:52.3578390Z  experiments: 2025-08-14T20:50:52.3653950Z  lf: 2025-08-14T20:50:52.3654736Z  rollout_percent: 25 2025-08-14T20:50:52.3655790Z  all_branches: false 2025-08-14T20:50:52.3656648Z  default: true 2025-08-14T20:50:52.3657440Z  --- 2025-08-14T20:50:52.3658065Z  2025-08-14T20:50:52.3658652Z  # Opt-ins: 2025-08-14T20:50:52.3659501Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:50:52.3660695Z  # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:50:52.3661512Z  # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:50:52.3662201Z  # Experiments should be from the above list. 2025-08-14T20:50:52.3662750Z  2025-08-14T20:50:52.3663137Z  @User1,-lf,split_build 2025-08-14T20:50:52.3663620Z  @User2,lf 2025-08-14T20:50:52.3664060Z  @User3,split_build 2025-08-14T20:50:52.3664502Z """ 2025-08-14T20:50:52.3664864Z  2025-08-14T20:50:52.3665491Z import json 2025-08-14T20:50:52.3665912Z import logging 2025-08-14T20:50:52.3666330Z import os 2025-08-14T20:50:52.3666719Z import random 2025-08-14T20:50:52.3667131Z import re 2025-08-14T20:50:52.3667510Z import sys 2025-08-14T20:50:52.3667948Z from argparse import ArgumentParser 2025-08-14T20:50:52.3668567Z from collections.abc import Iterable 2025-08-14T20:50:52.3669117Z from functools import cache 2025-08-14T20:50:52.3669619Z from logging import LogRecord 2025-08-14T20:50:52.3670145Z from typing import Any, NamedTuple 2025-08-14T20:50:52.3670725Z from urllib.request import Request, urlopen 2025-08-14T20:50:52.3671271Z  2025-08-14T20:50:52.3671630Z import yaml 2025-08-14T20:50:52.3672059Z from github import Auth, Github 2025-08-14T20:50:52.3672595Z from github.Issue import Issue 2025-08-14T20:50:52.3673069Z  2025-08-14T20:50:52.3673405Z  2025-08-14T20:50:52.3673836Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:50:52.3674558Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:50:52.3675799Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:50:52.3676496Z  2025-08-14T20:50:52.3677125Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:50:52.3677717Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:50:52.3678267Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:50:52.3678862Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:50:52.3679383Z  2025-08-14T20:50:52.3679785Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:50:52.3680279Z  2025-08-14T20:50:52.3680661Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:50:52.3681150Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:50:52.3681607Z  2025-08-14T20:50:52.3681948Z  2025-08-14T20:50:52.3682328Z class Experiment(NamedTuple): 2025-08-14T20:50:52.3682831Z  rollout_perc: float = ( 2025-08-14T20:50:52.3683511Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:50:52.3684195Z  ) 2025-08-14T20:50:52.3684583Z  all_branches: bool = ( 2025-08-14T20:50:52.3685456Z  False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:50:52.3686128Z  ) 2025-08-14T20:50:52.3686520Z  default: bool = ( 2025-08-14T20:50:52.3687133Z  True # If True, the experiment is enabled by default for all queries 2025-08-14T20:50:52.3687766Z  ) 2025-08-14T20:50:52.3688122Z  2025-08-14T20:50:52.3688494Z  # Add more fields as needed 2025-08-14T20:50:52.3688965Z  2025-08-14T20:50:52.3689328Z  2025-08-14T20:50:52.3689694Z class Settings(NamedTuple): 2025-08-14T20:50:52.3690164Z  """ 2025-08-14T20:50:52.3690654Z  Settings for the experiments that can be opted into. 2025-08-14T20:50:52.3691225Z  """ 2025-08-14T20:50:52.3691582Z  2025-08-14T20:50:52.3691990Z  experiments: dict[str, Experiment] = {} 2025-08-14T20:50:52.3692512Z  2025-08-14T20:50:52.3692995Z  2025-08-14T20:50:52.3693424Z class ColorFormatter(logging.Formatter): 2025-08-14T20:50:52.3694082Z  """Color codes the log messages based on the log level""" 2025-08-14T20:50:52.3694663Z  2025-08-14T20:50:52.3695197Z  COLORS = { 2025-08-14T20:50:52.3695677Z  "WARNING": "\033[33m", # Yellow 2025-08-14T20:50:52.3696191Z  "ERROR": "\033[31m", # Red 2025-08-14T20:50:52.3696710Z  "CRITICAL": "\033[31m", # Red 2025-08-14T20:50:52.3697233Z  "INFO": "\033[0m", # Reset 2025-08-14T20:50:52.3697749Z  "DEBUG": "\033[0m", # Reset 2025-08-14T20:50:52.3698226Z  } 2025-08-14T20:50:52.3698579Z  2025-08-14T20:50:52.3698997Z  def format(self, record: LogRecord) -> str: 2025-08-14T20:50:52.3699763Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:50:52.3700556Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:50:52.3701145Z  return super().format(record) 2025-08-14T20:50:52.3701642Z  2025-08-14T20:50:52.3701970Z  2025-08-14T20:50:52.3702357Z handler = logging.StreamHandler() 2025-08-14T20:50:52.3703095Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:50:52.3703810Z  2025-08-14T20:50:52.3704283Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:50:52.3704878Z log.addHandler(handler) 2025-08-14T20:50:52.3705613Z log.setLevel(logging.INFO) 2025-08-14T20:50:52.3706074Z  2025-08-14T20:50:52.3706427Z  2025-08-14T20:50:52.3706885Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:50:52.3707458Z  """ 2025-08-14T20:50:52.3707994Z  Defines outputs of the github action that invokes this script 2025-08-14T20:50:52.3708767Z  """ 2025-08-14T20:50:52.3709156Z  if not GITHUB_OUTPUT: 2025-08-14T20:50:52.3710240Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:50:52.3711326Z  log.warning( 2025-08-14T20:50:52.3712197Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:50:52.3713091Z  ) 2025-08-14T20:50:52.3713566Z  print(f"::set-output name={key}::{value}") 2025-08-14T20:50:52.3714113Z  return 2025-08-14T20:50:52.3714519Z  2025-08-14T20:50:52.3714922Z  with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:50:52.3715719Z  log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:50:52.3716300Z  f.write(f"{key}={value}\n") 2025-08-14T20:50:52.3716801Z  2025-08-14T20:50:52.3717143Z  2025-08-14T20:50:52.3717661Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:50:52.3718318Z  return frozenset( 2025-08-14T20:50:52.3718969Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:50:52.3719640Z  ) 2025-08-14T20:50:52.3719998Z  2025-08-14T20:50:52.3720337Z  2025-08-14T20:50:52.3720704Z def parse_args() -> Any: 2025-08-14T20:50:52.3721303Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:50:52.3722175Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:50:52.3722933Z  parser.add_argument( 2025-08-14T20:50:52.3723421Z  "--github-issue-repo", 2025-08-14T20:50:52.3723912Z  type=str, 2025-08-14T20:50:52.3724358Z  required=False, 2025-08-14T20:50:52.3725138Z  default="pytorch/test-infra", 2025-08-14T20:50:52.3725771Z  help="GitHub repo to get the issue", 2025-08-14T20:50:52.3726289Z  ) 2025-08-14T20:50:52.3726676Z  parser.add_argument( 2025-08-14T20:50:52.3727154Z  "--github-repo", 2025-08-14T20:50:52.3727614Z  type=str, 2025-08-14T20:50:52.3728053Z  required=True, 2025-08-14T20:50:52.3728555Z  help="GitHub repo where CI is running", 2025-08-14T20:50:52.3729074Z  ) 2025-08-14T20:50:52.3729463Z  parser.add_argument( 2025-08-14T20:50:52.3730111Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:50:52.3730762Z  ) 2025-08-14T20:50:52.3731146Z  parser.add_argument( 2025-08-14T20:50:52.3731801Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:50:52.3732494Z  ) 2025-08-14T20:50:52.3732879Z  parser.add_argument( 2025-08-14T20:50:52.3733558Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:50:52.3734236Z  ) 2025-08-14T20:50:52.3734624Z  parser.add_argument( 2025-08-14T20:50:52.3735469Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:50:52.3736184Z  ) 2025-08-14T20:50:52.3736571Z  parser.add_argument( 2025-08-14T20:50:52.3737050Z  "--github-ref-type", 2025-08-14T20:50:52.3737526Z  type=str, 2025-08-14T20:50:52.3737961Z  required=True, 2025-08-14T20:50:52.3738500Z  help="Current GitHub ref type, branch or tag", 2025-08-14T20:50:52.3739055Z  ) 2025-08-14T20:50:52.3739434Z  parser.add_argument( 2025-08-14T20:50:52.3740072Z  "--eligible-experiments", 2025-08-14T20:50:52.3740613Z  type=_str_comma_separated_to_set, 2025-08-14T20:50:52.3741145Z  required=False, 2025-08-14T20:50:52.3741601Z  default="", 2025-08-14T20:50:52.3742474Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:50:52.3743375Z  ) 2025-08-14T20:50:52.3743760Z  parser.add_argument( 2025-08-14T20:50:52.3744246Z  "--opt-out-experiments", 2025-08-14T20:50:52.3744778Z  type=_str_comma_separated_to_set, 2025-08-14T20:50:52.3745538Z  required=False, 2025-08-14T20:50:52.3745993Z  default="", 2025-08-14T20:50:52.3746421Z  help=( 2025-08-14T20:50:52.3747120Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:50:52.3748273Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:50:52.3749082Z  ), 2025-08-14T20:50:52.3749451Z  ) 2025-08-14T20:50:52.3749840Z  parser.add_argument( 2025-08-14T20:50:52.3750312Z  "--pr-number", 2025-08-14T20:50:52.3750765Z  type=str, 2025-08-14T20:50:52.3751195Z  required=False, 2025-08-14T20:50:52.3751651Z  default="", 2025-08-14T20:50:52.3752172Z  help="the optional PR number where this is run", 2025-08-14T20:50:52.3752722Z  ) 2025-08-14T20:50:52.3753070Z  2025-08-14T20:50:52.3753448Z  return parser.parse_args() 2025-08-14T20:50:52.3753931Z  2025-08-14T20:50:52.3754257Z  2025-08-14T20:50:52.3754864Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:50:52.3756143Z  auth = Auth.Token(github_token) 2025-08-14T20:50:52.3756676Z  return Github(auth=auth) 2025-08-14T20:50:52.3757142Z  2025-08-14T20:50:52.3757473Z  2025-08-14T20:50:52.3758123Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:50:52.3758908Z  repo = gh.get_repo(repo) 2025-08-14T20:50:52.3759446Z  return repo.get_issue(number=issue_num) 2025-08-14T20:50:52.3759956Z  2025-08-14T20:50:52.3760296Z  2025-08-14T20:50:52.3760662Z def get_potential_pr_author( 2025-08-14T20:50:52.3761333Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:50:52.3762000Z ) -> str: 2025-08-14T20:50:52.3762543Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:50:52.3763354Z  # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:50:52.3764123Z  # embedded in the tag name: ciflow// 2025-08-14T20:50:52.3764693Z  2025-08-14T20:50:52.3765261Z  gh = get_gh_client(github_token) 2025-08-14T20:50:52.3765764Z  2025-08-14T20:50:52.3766238Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:50:52.3766866Z  split_tag = ref_name.split("/") 2025-08-14T20:50:52.3767373Z  if ( 2025-08-14T20:50:52.3767790Z  len(split_tag) == 3 2025-08-14T20:50:52.3768304Z  and split_tag[0] == "ciflow" 2025-08-14T20:50:52.3768849Z  and split_tag[2].isnumeric() 2025-08-14T20:50:52.3769345Z  ): 2025-08-14T20:50:52.3769772Z  pr_number = split_tag[2] 2025-08-14T20:50:52.3770273Z  try: 2025-08-14T20:50:52.3770739Z  repository = gh.get_repo(repo) 2025-08-14T20:50:52.3771501Z  pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:50:52.3772120Z  except Exception as e: 2025-08-14T20:50:52.3772667Z  raise Exception( # noqa: TRY002 2025-08-14T20:50:52.3773339Z  f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:50:52.3773990Z  ) from e 2025-08-14T20:50:52.3774567Z  return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:50:52.3775458Z  # In all other cases, return the original input username 2025-08-14T20:50:52.3776052Z  return username 2025-08-14T20:50:52.3776485Z  2025-08-14T20:50:52.3776822Z  2025-08-14T20:50:52.3777243Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:50:52.3777778Z  """ 2025-08-14T20:50:52.3778445Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:50:52.3779217Z  """ 2025-08-14T20:50:52.3779777Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:50:52.3780442Z  2025-08-14T20:50:52.3780773Z  2025-08-14T20:50:52.3781160Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:50:52.3781661Z  try: 2025-08-14T20:50:52.3782070Z  data = yaml.safe_load(yaml_text) 2025-08-14T20:50:52.3782588Z  return data 2025-08-14T20:50:52.3783050Z  except yaml.YAMLError: 2025-08-14T20:50:52.3783584Z  log.exception("Error loading YAML") 2025-08-14T20:50:52.3784096Z  raise 2025-08-14T20:50:52.3784481Z  2025-08-14T20:50:52.3784814Z  2025-08-14T20:50:52.3785663Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:50:52.3786389Z  """ 2025-08-14T20:50:52.3787157Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:50:52.3787892Z  2025-08-14T20:50:52.3788427Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:52.3789225Z  and the text below is the list of opted in users. 2025-08-14T20:50:52.3789777Z  2025-08-14T20:50:52.3790342Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:50:52.3791029Z  """ 2025-08-14T20:50:52.3791499Z  rollout_state_parts = rollout_state.split("---") 2025-08-14T20:50:52.3792093Z  if len(rollout_state_parts) >= 2: 2025-08-14T20:50:52.3792718Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:50:52.3793296Z  else: 2025-08-14T20:50:52.3793825Z  return "", rollout_state 2025-08-14T20:50:52.3794416Z  2025-08-14T20:50:52.3794745Z  2025-08-14T20:50:52.3795331Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:50:52.3795857Z  """ 2025-08-14T20:50:52.3796400Z  Dictionary of users with a list of features they have opted into 2025-08-14T20:50:52.3797029Z  """ 2025-08-14T20:50:52.3797380Z  2025-08-14T20:50:52.3797711Z  2025-08-14T20:50:52.3798236Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:50:52.3798894Z  """ 2025-08-14T20:50:52.3799614Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:50:52.3800412Z  2025-08-14T20:50:52.3801192Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:50:52.3802154Z  - Example line: "@User1,lf,split_build" 2025-08-14T20:50:52.3803650Z  - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:50:52.3804264Z  2025-08-14T20:50:52.3804586Z  2025-08-14T20:50:52.3804914Z  """ 2025-08-14T20:50:52.3805490Z  optins = UserOptins() 2025-08-14T20:50:52.3806019Z  for user in user_optin_text.split("\n"): 2025-08-14T20:50:52.3806583Z  user = user.strip("\r\n\t -") 2025-08-14T20:50:52.3807148Z  if not user or not user.startswith("@"): 2025-08-14T20:50:52.3807709Z  # Not a valid user. Skip 2025-08-14T20:50:52.3808199Z  continue 2025-08-14T20:50:52.3808608Z  2025-08-14T20:50:52.3808944Z  if user: 2025-08-14T20:50:52.3809418Z  usr_name = user.split(",")[0].strip("@") 2025-08-14T20:50:52.3810153Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:50:52.3810796Z  2025-08-14T20:50:52.3811154Z  return optins 2025-08-14T20:50:52.3811567Z  2025-08-14T20:50:52.3811900Z  2025-08-14T20:50:52.3812388Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:50:52.3812991Z  """ 2025-08-14T20:50:52.3813412Z  Check if the experiment name is valid. 2025-08-14T20:50:52.3813930Z  A valid name: 2025-08-14T20:50:52.3814593Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:50:52.3815673Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:50:52.3816373Z  - Cannot contain spaces 2025-08-14T20:50:52.3816838Z  """ 2025-08-14T20:50:52.3817235Z  2025-08-14T20:50:52.3817716Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:50:52.3818422Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:50:52.3819143Z  2025-08-14T20:50:52.3819490Z  if valid: 2025-08-14T20:50:52.3819895Z  return True 2025-08-14T20:50:52.3820300Z  2025-08-14T20:50:52.3820636Z  log.error( 2025-08-14T20:50:52.3822024Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:50:52.3823468Z  ) 2025-08-14T20:50:52.3823837Z  return False 2025-08-14T20:50:52.3824236Z  2025-08-14T20:50:52.3824568Z  2025-08-14T20:50:52.3825287Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:50:52.3825926Z  """ 2025-08-14T20:50:52.3826531Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:50:52.3827225Z  """ 2025-08-14T20:50:52.3827583Z  try: 2025-08-14T20:50:52.3827958Z  if settings_text: 2025-08-14T20:50:52.3828690Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:50:52.3829462Z  # for easy reading 2025-08-14T20:50:52.3830274Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:50:52.3831139Z  # the backtick character in shell commands. 2025-08-14T20:50:52.3831746Z  backtick = chr(96) # backtick character 2025-08-14T20:50:52.3832421Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:50:52.3833077Z  settings = load_yaml(settings_text) 2025-08-14T20:50:52.3833585Z  2025-08-14T20:50:52.3834170Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:50:52.3835580Z  experiments = {} 2025-08-14T20:50:52.3836105Z  2025-08-14T20:50:52.3836663Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:50:52.3837412Z  if not is_valid_experiment_name(exp_name): 2025-08-14T20:50:52.3838477Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:50:52.3839472Z  continue 2025-08-14T20:50:52.3839909Z  2025-08-14T20:50:52.3840279Z  valid_settings = {} 2025-08-14T20:50:52.3840806Z  for setting in exp_settings: 2025-08-14T20:50:52.3841389Z  if setting not in Experiment._fields: 2025-08-14T20:50:52.3841949Z  log.warning( 2025-08-14T20:50:52.3842669Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:50:52.3843357Z  ) 2025-08-14T20:50:52.3843799Z  else: 2025-08-14T20:50:52.3844341Z  valid_settings[setting] = exp_settings[setting] 2025-08-14T20:50:52.3844910Z  2025-08-14T20:50:52.3845517Z  experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:50:52.3846163Z  return Settings(experiments) 2025-08-14T20:50:52.3846654Z  2025-08-14T20:50:52.3847014Z  except Exception: 2025-08-14T20:50:52.3847525Z  log.exception("Failed to parse settings") 2025-08-14T20:50:52.3848048Z  2025-08-14T20:50:52.3848395Z  return Settings() 2025-08-14T20:50:52.3848821Z  2025-08-14T20:50:52.3849149Z  2025-08-14T20:50:52.3849778Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:50:52.3850366Z  """ 2025-08-14T20:50:52.3850824Z  Parse settings, if any, from the rollout state. 2025-08-14T20:50:52.3851370Z  2025-08-14T20:50:52.3851905Z  If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:52.3852661Z  and the text below is the list of opted in users. 2025-08-14T20:50:52.3853204Z  2025-08-14T20:50:52.3853794Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:50:52.3854496Z  """ 2025-08-14T20:50:52.3855168Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:52.3855933Z  return parse_settings_from_text(settings_text) 2025-08-14T20:50:52.3856459Z  2025-08-14T20:50:52.3856788Z  2025-08-14T20:50:52.3857244Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:50:52.3857810Z  """ 2025-08-14T20:50:52.3858227Z  Parse users from the rollout state. 2025-08-14T20:50:52.3858721Z  2025-08-14T20:50:52.3859054Z  """ 2025-08-14T20:50:52.3859607Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:52.3860350Z  return parse_user_opt_in_from_text(users_text) 2025-08-14T20:50:52.3860876Z  2025-08-14T20:50:52.3861209Z  2025-08-14T20:50:52.3861820Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:52.3862543Z  """ 2025-08-14T20:50:52.3862988Z  Check if a user is opted into an experiment 2025-08-14T20:50:52.3863513Z  """ 2025-08-14T20:50:52.3863994Z  return experiment_name in user_optins.get(user, []) 2025-08-14T20:50:52.3864553Z  2025-08-14T20:50:52.3865106Z  2025-08-14T20:50:52.3865726Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:52.3866462Z  """ 2025-08-14T20:50:52.3866947Z  Check if a user explicitly opted out of an experiment 2025-08-14T20:50:52.3867509Z  """ 2025-08-14T20:50:52.3868044Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:50:52.3868736Z  experiment_optout = "-" + experiment_name 2025-08-14T20:50:52.3869389Z  if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:50:52.3869978Z  return False 2025-08-14T20:50:52.3870395Z  2025-08-14T20:50:52.3870860Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:50:52.3871456Z  log.warning( 2025-08-14T20:50:52.3872273Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:50:52.3873119Z  ) 2025-08-14T20:50:52.3873482Z  2025-08-14T20:50:52.3873825Z  return True 2025-08-14T20:50:52.3874221Z  2025-08-14T20:50:52.3874548Z  2025-08-14T20:50:52.3874902Z def get_runner_prefix( 2025-08-14T20:50:52.3875457Z  rollout_state: str, 2025-08-14T20:50:52.3875951Z  workflow_requestors: Iterable[str], 2025-08-14T20:50:52.3876472Z  branch: str, 2025-08-14T20:50:52.3876998Z  eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:52.3877693Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:52.3878266Z  is_canary: bool = False, 2025-08-14T20:50:52.3878739Z ) -> str: 2025-08-14T20:50:52.3879186Z  settings = parse_settings(rollout_state) 2025-08-14T20:50:52.3879765Z  user_optins = parse_users(rollout_state) 2025-08-14T20:50:52.3880281Z  2025-08-14T20:50:52.3880753Z  fleet_prefix = "" 2025-08-14T20:50:52.3881197Z  prefixes = [] 2025-08-14T20:50:52.3881852Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:50:52.3882769Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:50:52.3883459Z  log.info( 2025-08-14T20:50:52.3884155Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:50:52.3884876Z  ) 2025-08-14T20:50:52.3885379Z  continue 2025-08-14T20:50:52.3885792Z  2025-08-14T20:50:52.3886156Z  if opt_out_experiments: 2025-08-14T20:50:52.3886719Z  if experiment_name in opt_out_experiments: 2025-08-14T20:50:52.3887356Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:50:52.3887934Z  log.info( 2025-08-14T20:50:52.3888859Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:50:52.3889809Z  ) 2025-08-14T20:50:52.3890231Z  continue 2025-08-14T20:50:52.3890693Z  2025-08-14T20:50:52.3891069Z  if eligible_experiments: 2025-08-14T20:50:52.3891648Z  if experiment_name not in eligible_experiments: 2025-08-14T20:50:52.3892276Z  exp_list = ", ".join(eligible_experiments) 2025-08-14T20:50:52.3892817Z  log.info( 2025-08-14T20:50:52.3893597Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:50:52.3894398Z  ) 2025-08-14T20:50:52.3894943Z  continue 2025-08-14T20:50:52.3895550Z  elif not experiment_settings.default: 2025-08-14T20:50:52.3896073Z  log.info( 2025-08-14T20:50:52.3896754Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:50:52.3897459Z  ) 2025-08-14T20:50:52.3897854Z  continue 2025-08-14T20:50:52.3898267Z  2025-08-14T20:50:52.3898740Z  # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:50:52.3899343Z  opted_out_users = [ 2025-08-14T20:50:52.3899813Z  requestor 2025-08-14T20:50:52.3900302Z  for requestor in workflow_requestors 2025-08-14T20:50:52.3900986Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:50:52.3901592Z  ] 2025-08-14T20:50:52.3901963Z  2025-08-14T20:50:52.3902325Z  if opted_out_users: 2025-08-14T20:50:52.3902805Z  log.info( 2025-08-14T20:50:52.3903442Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:50:52.3904099Z  ) 2025-08-14T20:50:52.3904496Z  continue 2025-08-14T20:50:52.3904899Z  2025-08-14T20:50:52.3905702Z  # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:50:52.3906311Z  opted_in_users = [ 2025-08-14T20:50:52.3906779Z  requestor 2025-08-14T20:50:52.3907274Z  for requestor in workflow_requestors 2025-08-14T20:50:52.3907935Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:50:52.3908540Z  ] 2025-08-14T20:50:52.3908904Z  2025-08-14T20:50:52.3909258Z  enabled = False 2025-08-14T20:50:52.3909719Z  if opted_in_users: 2025-08-14T20:50:52.3910314Z  log.info( 2025-08-14T20:50:52.3910963Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:50:52.3911623Z  ) 2025-08-14T20:50:52.3912026Z  enabled = True 2025-08-14T20:50:52.3912467Z  2025-08-14T20:50:52.3912881Z  elif experiment_settings.rollout_perc: 2025-08-14T20:50:52.3913693Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:50:52.3914788Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:50:52.3915538Z  log.info( 2025-08-14T20:50:52.3916648Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:50:52.3917574Z  ) 2025-08-14T20:50:52.3918013Z  enabled = True 2025-08-14T20:50:52.3918473Z  2025-08-14T20:50:52.3918820Z  if enabled: 2025-08-14T20:50:52.3919281Z  label = experiment_name 2025-08-14T20:50:52.3919858Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:50:52.3920664Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:50:52.3921524Z  # - If it's enabled, then we always list it's prefix first 2025-08-14T20:50:52.3922269Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:50:52.3922925Z  if is_canary: 2025-08-14T20:50:52.3923439Z  label += CANARY_FLEET_SUFFIX 2025-08-14T20:50:52.3923977Z  fleet_prefix = label 2025-08-14T20:50:52.3924471Z  else: 2025-08-14T20:50:52.3925191Z  prefixes.append(label) 2025-08-14T20:50:52.3925694Z  2025-08-14T20:50:52.3926054Z  if len(prefixes) > 1: 2025-08-14T20:50:52.3926526Z  log.error( 2025-08-14T20:50:52.3927550Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:50:52.3928588Z  ) 2025-08-14T20:50:52.3929001Z  prefixes = prefixes[:1] 2025-08-14T20:50:52.3929471Z  2025-08-14T20:50:52.3929836Z  # Fleet always comes first 2025-08-14T20:50:52.3930316Z  if fleet_prefix: 2025-08-14T20:50:52.3930791Z  prefixes.insert(0, fleet_prefix) 2025-08-14T20:50:52.3931290Z  2025-08-14T20:50:52.3931743Z  return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:50:52.3932299Z  2025-08-14T20:50:52.3932631Z  2025-08-14T20:50:52.3933262Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:50:52.3933997Z  """ 2025-08-14T20:50:52.3934591Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:50:52.3935362Z  2025-08-14T20:50:52.3935939Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:50:52.3936624Z  """ 2025-08-14T20:50:52.3937029Z  gh = get_gh_client(github_token) 2025-08-14T20:50:52.3937582Z  issue = get_issue(gh, repo, issue_num) 2025-08-14T20:50:52.3938223Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:50:52.3938800Z  2025-08-14T20:50:52.3939126Z  2025-08-14T20:50:52.3939714Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:50:52.3940573Z  for _ in range(num_retries): 2025-08-14T20:50:52.3941055Z  try: 2025-08-14T20:50:52.3941505Z  req = Request(url=url, headers=headers) 2025-08-14T20:50:52.3942163Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:50:52.3942808Z  return json.loads(content) 2025-08-14T20:50:52.3943335Z  except Exception as e: 2025-08-14T20:50:52.3943901Z  log.warning(f"Could not download {url}: {e}") 2025-08-14T20:50:52.3944436Z  2025-08-14T20:50:52.3945097Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:50:52.3945803Z  return {} 2025-08-14T20:50:52.3946188Z  2025-08-14T20:50:52.3946514Z  2025-08-14T20:50:52.3946839Z @cache 2025-08-14T20:50:52.3947478Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:50:52.3948210Z  """ 2025-08-14T20:50:52.3948622Z  Dynamically get PR information 2025-08-14T20:50:52.3949107Z  """ 2025-08-14T20:50:52.3949617Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:50:52.3950235Z  headers = { 2025-08-14T20:50:52.3950714Z  "Accept": "application/vnd.github.v3+json", 2025-08-14T20:50:52.3951327Z  "Authorization": f"token {github_token}", 2025-08-14T20:50:52.3951840Z  } 2025-08-14T20:50:52.3952284Z  json_response: dict[str, Any] = download_json( 2025-08-14T20:50:52.3952890Z  url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:50:52.3953425Z  headers=headers, 2025-08-14T20:50:52.3953868Z  ) 2025-08-14T20:50:52.3954215Z  2025-08-14T20:50:52.3954572Z  if not json_response: 2025-08-14T20:50:52.3955260Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:50:52.3955999Z  return {} 2025-08-14T20:50:52.3956408Z  2025-08-14T20:50:52.3956774Z  return json_response 2025-08-14T20:50:52.3957221Z  2025-08-14T20:50:52.3957538Z  2025-08-14T20:50:52.3958117Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:50:52.3958811Z  """ 2025-08-14T20:50:52.3959345Z  Dynamically get the latest list of labels from the pull request 2025-08-14T20:50:52.3959971Z  """ 2025-08-14T20:50:52.3960467Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:50:52.3961063Z  return { 2025-08-14T20:50:52.3961654Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:50:52.3962318Z  } 2025-08-14T20:50:52.3962663Z  2025-08-14T20:50:52.3962999Z  2025-08-14T20:50:52.3963346Z def main() -> None: 2025-08-14T20:50:52.3963801Z  args = parse_args() 2025-08-14T20:50:52.3964236Z  2025-08-14T20:50:52.3964659Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:50:52.3965271Z  2025-08-14T20:50:52.3965646Z  # Check if the PR is opt-out 2025-08-14T20:50:52.3966152Z  if args.pr_number: 2025-08-14T20:50:52.3966827Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:50:52.3967584Z  if OPT_OUT_LABEL in labels: 2025-08-14T20:50:52.3968099Z  log.info( 2025-08-14T20:50:52.3968810Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:50:52.3969541Z  ) 2025-08-14T20:50:52.3970118Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:52.3970785Z  sys.exit() 2025-08-14T20:50:52.3971318Z  2025-08-14T20:50:52.3971661Z  try: 2025-08-14T20:50:52.3972123Z  rollout_state = get_rollout_state_from_issue( 2025-08-14T20:50:52.3972833Z  args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:50:52.3973446Z  ) 2025-08-14T20:50:52.3973815Z  2025-08-14T20:50:52.3974218Z  username = get_potential_pr_author( 2025-08-14T20:50:52.3974752Z  args.github_token, 2025-08-14T20:50:52.3975349Z  args.github_repo, 2025-08-14T20:50:52.3975838Z  args.github_actor, 2025-08-14T20:50:52.3976340Z  args.github_ref_type, 2025-08-14T20:50:52.3976842Z  args.github_branch, 2025-08-14T20:50:52.3977321Z  ) 2025-08-14T20:50:52.3977678Z  2025-08-14T20:50:52.3978167Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:50:52.3978764Z  2025-08-14T20:50:52.3979172Z  runner_label_prefix = get_runner_prefix( 2025-08-14T20:50:52.3979725Z  rollout_state, 2025-08-14T20:50:52.3980238Z  (args.github_issue_owner, username), 2025-08-14T20:50:52.3980787Z  args.github_branch, 2025-08-14T20:50:52.3981305Z  args.eligible_experiments, 2025-08-14T20:50:52.3981850Z  args.opt_out_experiments, 2025-08-14T20:50:52.3982355Z  is_canary, 2025-08-14T20:50:52.3982779Z  ) 2025-08-14T20:50:52.3983154Z  2025-08-14T20:50:52.3983516Z  except Exception as e: 2025-08-14T20:50:52.3983993Z  log.error( 2025-08-14T20:50:52.3984674Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:50:52.3985642Z  ) 2025-08-14T20:50:52.3986009Z  2025-08-14T20:50:52.3986529Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:52.3987165Z  2025-08-14T20:50:52.3987491Z  2025-08-14T20:50:52.3987843Z if __name__ == "__main__": 2025-08-14T20:50:52.3988285Z  main() 2025-08-14T20:50:52.3988658Z  2025-08-14T20:50:52.3988984Z EOF 2025-08-14T20:50:52.3989361Z  2025-08-14T20:50:52.3989726Z cat runner_determinator.py 2025-08-14T20:50:52.4306945Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:52.4308106Z env: 2025-08-14T20:50:52.4308743Z GITHUB_TOKEN: *** 2025-08-14T20:50:52.4309130Z ISSUE_NUMBER: 5132 2025-08-14T20:50:52.4309552Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:52.4310021Z ISSUE_OWNER: 2025-08-14T20:50:52.4310400Z CHECK_EXPERIMENTS: 2025-08-14T20:50:52.4310798Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:52.4311194Z PR_NUMBER: 2025-08-14T20:50:52.4311556Z ##[endgroup] 2025-08-14T20:50:52.4516945Z # flake8: noqa: G004 2025-08-14T20:50:52.4517261Z 2025-08-14T20:50:52.4517670Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-08-14T20:50:52.4518576Z # must be kept in sync. You can do it easily by running the following command: 2025-08-14T20:50:52.4519334Z # python .github/scripts/update_runner_determinator.py 2025-08-14T20:50:52.4519742Z 2025-08-14T20:50:52.4519888Z """ 2025-08-14T20:50:52.4520426Z This runner determinator is used to determine which set of runners to run a 2025-08-14T20:50:52.4521237Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-08-14T20:50:52.4522078Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-08-14T20:50:52.4522821Z of which runners should be used to run which job. 2025-08-14T20:50:52.4523191Z 2025-08-14T20:50:52.4523546Z The configuration has two parts, the settings and a list of opted-in users, 2025-08-14T20:50:52.4524558Z separated by a line containing "---". If the line is not present, the 2025-08-14T20:50:52.4525791Z settings are considered to be empty with only the second part, the user 2025-08-14T20:50:52.4526443Z list, defined. 2025-08-14T20:50:52.4526656Z 2025-08-14T20:50:52.4527000Z The first part is a YAML block that defines the rollout settings. This can be 2025-08-14T20:50:52.4527855Z used to define any settings that are needed to determine which runners to use. 2025-08-14T20:50:52.4528622Z It's fields are defined by the RolloutSettings class below. 2025-08-14T20:50:52.4529034Z 2025-08-14T20:50:52.4529379Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-08-14T20:50:52.4530180Z The user list is also a comma separated list of additional features or 2025-08-14T20:50:52.4530865Z experiments which the user could be opted in to. 2025-08-14T20:50:52.4531243Z 2025-08-14T20:50:52.4531429Z The user list has the following rules: 2025-08-14T20:50:52.4531745Z 2025-08-14T20:50:52.4532055Z - Users are GitHub usernames, which must start with the @ prefix 2025-08-14T20:50:52.4532856Z - Each user is also a comma-separated list of features/experiments to enable 2025-08-14T20:50:52.4533562Z - A "#" prefix opts the user out of all experiments 2025-08-14T20:50:52.4533931Z 2025-08-14T20:50:52.4534089Z Example config: 2025-08-14T20:50:52.4534521Z # A list of experiments that can be opted into. 2025-08-14T20:50:52.4535723Z # This defines the behavior they'll induce when opted into. 2025-08-14T20:50:52.4536321Z # Expected syntax is: 2025-08-14T20:50:52.4536919Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-08-14T20:50:52.4537836Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-08-14T20:50:52.4538401Z 2025-08-14T20:50:52.4538560Z experiments: 2025-08-14T20:50:52.4538919Z lf: 2025-08-14T20:50:52.4539273Z rollout_percent: 25 2025-08-14T20:50:52.4539876Z all_branches: false 2025-08-14T20:50:52.4540304Z default: true 2025-08-14T20:50:52.4540719Z --- 2025-08-14T20:50:52.4540912Z 2025-08-14T20:50:52.4541068Z # Opt-ins: 2025-08-14T20:50:52.4541615Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-08-14T20:50:52.4542426Z # and specifying experiments to enable in a comma-separated list. 2025-08-14T20:50:52.4543142Z # To always opt out of an experiment, prefix it with a "-". 2025-08-14T20:50:52.4543750Z # Experiments should be from the above list. 2025-08-14T20:50:52.4544106Z 2025-08-14T20:50:52.4544285Z @User1,-lf,split_build 2025-08-14T20:50:52.4544692Z @User2,lf 2025-08-14T20:50:52.4545260Z @User3,split_build 2025-08-14T20:50:52.4545654Z """ 2025-08-14T20:50:52.4545844Z 2025-08-14T20:50:52.4545997Z import json 2025-08-14T20:50:52.4546338Z import logging 2025-08-14T20:50:52.4546697Z import os 2025-08-14T20:50:52.4547033Z import random 2025-08-14T20:50:52.4547379Z import re 2025-08-14T20:50:52.4547721Z import sys 2025-08-14T20:50:52.4548093Z from argparse import ArgumentParser 2025-08-14T20:50:52.4548585Z from collections.abc import Iterable 2025-08-14T20:50:52.4549066Z from functools import cache 2025-08-14T20:50:52.4549503Z from logging import LogRecord 2025-08-14T20:50:52.4549957Z from typing import Any, NamedTuple 2025-08-14T20:50:52.4550457Z from urllib.request import Request, urlopen 2025-08-14T20:50:52.4550801Z 2025-08-14T20:50:52.4550954Z import yaml 2025-08-14T20:50:52.4551320Z from github import Auth, Github 2025-08-14T20:50:52.4551764Z from github.Issue import Issue 2025-08-14T20:50:52.4552050Z 2025-08-14T20:50:52.4552057Z 2025-08-14T20:50:52.4552265Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-08-14T20:50:52.4552905Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-08-14T20:50:52.4553709Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-08-14T20:50:52.4554230Z 2025-08-14T20:50:52.4554442Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-08-14T20:50:52.4555288Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-08-14T20:50:52.4555808Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-08-14T20:50:52.4556314Z OPT_OUT_LABEL = "no-runner-experiments" 2025-08-14T20:50:52.4556651Z 2025-08-14T20:50:52.4556831Z SETTING_EXPERIMENTS = "experiments" 2025-08-14T20:50:52.4557139Z 2025-08-14T20:50:52.4557314Z LF_FLEET_EXPERIMENT = "lf" 2025-08-14T20:50:52.4557741Z CANARY_FLEET_SUFFIX = ".c" 2025-08-14T20:50:52.4558007Z 2025-08-14T20:50:52.4558014Z 2025-08-14T20:50:52.4558197Z class Experiment(NamedTuple): 2025-08-14T20:50:52.4558639Z rollout_perc: float = ( 2025-08-14T20:50:52.4559236Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-08-14T20:50:52.4559861Z ) 2025-08-14T20:50:52.4560208Z all_branches: bool = ( 2025-08-14T20:50:52.4560796Z False # If True, the experiment is also enabled on the exception branches 2025-08-14T20:50:52.4561415Z ) 2025-08-14T20:50:52.4561755Z default: bool = ( 2025-08-14T20:50:52.4562287Z True # If True, the experiment is enabled by default for all queries 2025-08-14T20:50:52.4562879Z ) 2025-08-14T20:50:52.4563061Z 2025-08-14T20:50:52.4563228Z # Add more fields as needed 2025-08-14T20:50:52.4563512Z 2025-08-14T20:50:52.4563518Z 2025-08-14T20:50:52.4563692Z class Settings(NamedTuple): 2025-08-14T20:50:52.4564136Z """ 2025-08-14T20:50:52.4564561Z Settings for the experiments that can be opted into. 2025-08-14T20:50:52.4565305Z """ 2025-08-14T20:50:52.4565500Z 2025-08-14T20:50:52.4565698Z experiments: dict[str, Experiment] = {} 2025-08-14T20:50:52.4566045Z 2025-08-14T20:50:52.4566051Z 2025-08-14T20:50:52.4566252Z class ColorFormatter(logging.Formatter): 2025-08-14T20:50:52.4566840Z """Color codes the log messages based on the log level""" 2025-08-14T20:50:52.4567247Z 2025-08-14T20:50:52.4567399Z COLORS = { 2025-08-14T20:50:52.4567773Z "WARNING": "\033[33m", # Yellow 2025-08-14T20:50:52.4568388Z "ERROR": "\033[31m", # Red 2025-08-14T20:50:52.4568859Z "CRITICAL": "\033[31m", # Red 2025-08-14T20:50:52.4569318Z "INFO": "\033[0m", # Reset 2025-08-14T20:50:52.4569769Z "DEBUG": "\033[0m", # Reset 2025-08-14T20:50:52.4570200Z } 2025-08-14T20:50:52.4570381Z 2025-08-14T20:50:52.4570588Z def format(self, record: LogRecord) -> str: 2025-08-14T20:50:52.4571283Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-08-14T20:50:52.4572001Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-08-14T20:50:52.4572545Z return super().format(record) 2025-08-14T20:50:52.4572853Z 2025-08-14T20:50:52.4572860Z 2025-08-14T20:50:52.4573045Z handler = logging.StreamHandler() 2025-08-14T20:50:52.4573702Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-08-14T20:50:52.4574215Z 2025-08-14T20:50:52.4574440Z log = logging.getLogger(os.path.basename(__file__)) 2025-08-14T20:50:52.4575196Z log.addHandler(handler) 2025-08-14T20:50:52.4575668Z log.setLevel(logging.INFO) 2025-08-14T20:50:52.4575942Z 2025-08-14T20:50:52.4575949Z 2025-08-14T20:50:52.4576181Z def set_github_output(key: str, value: str) -> None: 2025-08-14T20:50:52.4576697Z """ 2025-08-14T20:50:52.4577182Z Defines outputs of the github action that invokes this script 2025-08-14T20:50:52.4577758Z """ 2025-08-14T20:50:52.4578094Z if not GITHUB_OUTPUT: 2025-08-14T20:50:52.4579087Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-08-14T20:50:52.4580105Z log.warning( 2025-08-14T20:50:52.4580896Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-08-14T20:50:52.4581747Z ) 2025-08-14T20:50:52.4591514Z print(f"::set-output name={key}::{value}") 2025-08-14T20:50:52.4592143Z return 2025-08-14T20:50:52.4592357Z 2025-08-14T20:50:52.4592745Z with open(GITHUB_OUTPUT, "a") as f: 2025-08-14T20:50:52.4593308Z log.info(f"Setting output: {key}='{value}'") 2025-08-14T20:50:52.4593836Z f.write(f"{key}={value}\n") 2025-08-14T20:50:52.4594148Z 2025-08-14T20:50:52.4594155Z 2025-08-14T20:50:52.4594449Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-08-14T20:50:52.4595319Z return frozenset( 2025-08-14T20:50:52.4595917Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-08-14T20:50:52.4596553Z ) 2025-08-14T20:50:52.4596734Z 2025-08-14T20:50:52.4596741Z 2025-08-14T20:50:52.4596914Z def parse_args() -> Any: 2025-08-14T20:50:52.4597438Z parser = ArgumentParser("Get dynamic rollout settings") 2025-08-14T20:50:52.4598233Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-08-14T20:50:52.4598950Z parser.add_argument( 2025-08-14T20:50:52.4599376Z "--github-issue-repo", 2025-08-14T20:50:52.4599806Z type=str, 2025-08-14T20:50:52.4600183Z required=False, 2025-08-14T20:50:52.4600597Z default="pytorch/test-infra", 2025-08-14T20:50:52.4601094Z help="GitHub repo to get the issue", 2025-08-14T20:50:52.4601561Z ) 2025-08-14T20:50:52.4601901Z parser.add_argument( 2025-08-14T20:50:52.4602301Z "--github-repo", 2025-08-14T20:50:52.4602701Z type=str, 2025-08-14T20:50:52.4603057Z required=True, 2025-08-14T20:50:52.4603485Z help="GitHub repo where CI is running", 2025-08-14T20:50:52.4603969Z ) 2025-08-14T20:50:52.4604306Z parser.add_argument( 2025-08-14T20:50:52.4604874Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-08-14T20:50:52.4605729Z ) 2025-08-14T20:50:52.4606078Z parser.add_argument( 2025-08-14T20:50:52.4606661Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-08-14T20:50:52.4607283Z ) 2025-08-14T20:50:52.4656588Z parser.add_argument( 2025-08-14T20:50:52.4657541Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-08-14T20:50:52.4658232Z ) 2025-08-14T20:50:52.4658585Z parser.add_argument( 2025-08-14T20:50:52.4659216Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-08-14T20:50:52.4659882Z ) 2025-08-14T20:50:52.4660227Z parser.add_argument( 2025-08-14T20:50:52.4660656Z "--github-ref-type", 2025-08-14T20:50:52.4661068Z type=str, 2025-08-14T20:50:52.4661435Z required=True, 2025-08-14T20:50:52.4661885Z help="Current GitHub ref type, branch or tag", 2025-08-14T20:50:52.4662392Z ) 2025-08-14T20:50:52.4662729Z parser.add_argument( 2025-08-14T20:50:52.4663159Z "--eligible-experiments", 2025-08-14T20:50:52.4663630Z type=_str_comma_separated_to_set, 2025-08-14T20:50:52.4664148Z required=False, 2025-08-14T20:50:52.4664535Z default="", 2025-08-14T20:50:52.4665540Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-08-14T20:50:52.4666419Z ) 2025-08-14T20:50:52.4666756Z parser.add_argument( 2025-08-14T20:50:52.4667176Z "--opt-out-experiments", 2025-08-14T20:50:52.4667635Z type=_str_comma_separated_to_set, 2025-08-14T20:50:52.4668138Z required=False, 2025-08-14T20:50:52.4668520Z default="", 2025-08-14T20:50:52.4668887Z help=( 2025-08-14T20:50:52.4669513Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-08-14T20:50:52.4670567Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-08-14T20:50:52.4671344Z ), 2025-08-14T20:50:52.4671671Z ) 2025-08-14T20:50:52.4672013Z parser.add_argument( 2025-08-14T20:50:52.4672409Z "--pr-number", 2025-08-14T20:50:52.4672794Z type=str, 2025-08-14T20:50:52.4673161Z required=False, 2025-08-14T20:50:52.4673553Z default="", 2025-08-14T20:50:52.4674120Z help="the optional PR number where this is run", 2025-08-14T20:50:52.4674647Z ) 2025-08-14T20:50:52.4674834Z 2025-08-14T20:50:52.4675135Z return parser.parse_args() 2025-08-14T20:50:52.4675442Z 2025-08-14T20:50:52.4675449Z 2025-08-14T20:50:52.4675830Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-08-14T20:50:52.4676536Z auth = Auth.Token(github_token) 2025-08-14T20:50:52.4677010Z return Github(auth=auth) 2025-08-14T20:50:52.4677294Z 2025-08-14T20:50:52.4677300Z 2025-08-14T20:50:52.4677722Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-08-14T20:50:52.4678466Z repo = gh.get_repo(repo) 2025-08-14T20:50:52.4678927Z return repo.get_issue(number=issue_num) 2025-08-14T20:50:52.4679264Z 2025-08-14T20:50:52.4679270Z 2025-08-14T20:50:52.4679452Z def get_potential_pr_author( 2025-08-14T20:50:52.4680053Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-08-14T20:50:52.4680686Z ) -> str: 2025-08-14T20:50:52.4681165Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-08-14T20:50:52.4681915Z # Fetch the actual username from the original PR. The PR number is 2025-08-14T20:50:52.4682609Z # embedded in the tag name: ciflow// 2025-08-14T20:50:52.4682995Z 2025-08-14T20:50:52.4683173Z gh = get_gh_client(github_token) 2025-08-14T20:50:52.4683480Z 2025-08-14T20:50:52.4683735Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-08-14T20:50:52.4684305Z split_tag = ref_name.split("/") 2025-08-14T20:50:52.4684775Z if ( 2025-08-14T20:50:52.4685408Z len(split_tag) == 3 2025-08-14T20:50:52.4685868Z and split_tag[0] == "ciflow" 2025-08-14T20:50:52.4686346Z and split_tag[2].isnumeric() 2025-08-14T20:50:52.4686800Z ): 2025-08-14T20:50:52.4687163Z pr_number = split_tag[2] 2025-08-14T20:50:52.4687757Z try: 2025-08-14T20:50:52.4688159Z repository = gh.get_repo(repo) 2025-08-14T20:50:52.4688730Z pull = repository.get_pull(number=int(pr_number)) 2025-08-14T20:50:52.4689295Z except Exception as e: 2025-08-14T20:50:52.4689777Z raise Exception( # noqa: TRY002 2025-08-14T20:50:52.4690398Z f"issue with pull request {pr_number} from repo {repository}" 2025-08-14T20:50:52.4690993Z ) from e 2025-08-14T20:50:52.4691497Z return pull.user.login # type: ignore[no-any-return] 2025-08-14T20:50:52.4692145Z # In all other cases, return the original input username 2025-08-14T20:50:52.4692684Z return username 2025-08-14T20:50:52.4692909Z 2025-08-14T20:50:52.4692915Z 2025-08-14T20:50:52.4693131Z def is_exception_branch(branch: str) -> bool: 2025-08-14T20:50:52.4693619Z """ 2025-08-14T20:50:52.4694214Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-08-14T20:50:52.4694933Z """ 2025-08-14T20:50:52.4695589Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-08-14T20:50:52.4696071Z 2025-08-14T20:50:52.4696078Z 2025-08-14T20:50:52.4696269Z def load_yaml(yaml_text: str) -> Any: 2025-08-14T20:50:52.4696724Z try: 2025-08-14T20:50:52.4697091Z data = yaml.safe_load(yaml_text) 2025-08-14T20:50:52.4697556Z return data 2025-08-14T20:50:52.4697939Z except yaml.YAMLError: 2025-08-14T20:50:52.4698385Z log.exception("Error loading YAML") 2025-08-14T20:50:52.4698857Z raise 2025-08-14T20:50:52.4699057Z 2025-08-14T20:50:52.4699063Z 2025-08-14T20:50:52.4699450Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-08-14T20:50:52.4700130Z """ 2025-08-14T20:50:52.4700709Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-08-14T20:50:52.4701256Z 2025-08-14T20:50:52.4701703Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:52.4702411Z and the text below is the list of opted in users. 2025-08-14T20:50:52.4702781Z 2025-08-14T20:50:52.4703129Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-08-14T20:50:52.4703780Z """ 2025-08-14T20:50:52.4704199Z rollout_state_parts = rollout_state.split("---") 2025-08-14T20:50:52.4704761Z if len(rollout_state_parts) >= 2: 2025-08-14T20:50:52.4705428Z return rollout_state_parts[0], rollout_state_parts[1] 2025-08-14T20:50:52.4705973Z else: 2025-08-14T20:50:52.4706332Z return "", rollout_state 2025-08-14T20:50:52.4706617Z 2025-08-14T20:50:52.4706625Z 2025-08-14T20:50:52.4706810Z class UserOptins(dict[str, list[str]]): 2025-08-14T20:50:52.4707283Z """ 2025-08-14T20:50:52.4707762Z Dictionary of users with a list of features they have opted into 2025-08-14T20:50:52.4708363Z """ 2025-08-14T20:50:52.4708551Z 2025-08-14T20:50:52.4708557Z 2025-08-14T20:50:52.4708885Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-08-14T20:50:52.4709485Z """ 2025-08-14T20:50:52.4710142Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-08-14T20:50:52.4710775Z 2025-08-14T20:50:52.4711355Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-08-14T20:50:52.4712282Z - Example line: "@User1,lf,split_build" 2025-08-14T20:50:52.4712913Z - A "#" prefix indicates the user is opted out of all experiments 2025-08-14T20:50:52.4713350Z 2025-08-14T20:50:52.4713356Z 2025-08-14T20:50:52.4713500Z """ 2025-08-14T20:50:52.4713853Z optins = UserOptins() 2025-08-14T20:50:52.4714300Z for user in user_optin_text.split("\n"): 2025-08-14T20:50:52.4714816Z user = user.strip("\r\n\t -") 2025-08-14T20:50:52.4715414Z if not user or not user.startswith("@"): 2025-08-14T20:50:52.4716064Z # Not a valid user. Skip 2025-08-14T20:50:52.4716508Z continue 2025-08-14T20:50:52.4716740Z 2025-08-14T20:50:52.4716887Z if user: 2025-08-14T20:50:52.4717295Z usr_name = user.split(",")[0].strip("@") 2025-08-14T20:50:52.4717938Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-08-14T20:50:52.4718390Z 2025-08-14T20:50:52.4718549Z return optins 2025-08-14T20:50:52.4718766Z 2025-08-14T20:50:52.4718773Z 2025-08-14T20:50:52.4719044Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-08-14T20:50:52.4719601Z """ 2025-08-14T20:50:52.4719964Z Check if the experiment name is valid. 2025-08-14T20:50:52.4720453Z A valid name: 2025-08-14T20:50:52.4721044Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-08-14T20:50:52.4721900Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-08-14T20:50:52.4722571Z - Cannot contain spaces 2025-08-14T20:50:52.4722994Z """ 2025-08-14T20:50:52.4723177Z 2025-08-14T20:50:52.4723420Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-08-14T20:50:52.4724062Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-08-14T20:50:52.4724477Z 2025-08-14T20:50:52.4724623Z if valid: 2025-08-14T20:50:52.4725136Z return True 2025-08-14T20:50:52.4725454Z 2025-08-14T20:50:52.4725609Z log.error( 2025-08-14T20:50:52.4726941Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-08-14T20:50:52.4728438Z ) 2025-08-14T20:50:52.4728757Z return False 2025-08-14T20:50:52.4728974Z 2025-08-14T20:50:52.4728981Z 2025-08-14T20:50:52.4729267Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-08-14T20:50:52.4729833Z """ 2025-08-14T20:50:52.4730518Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-08-14T20:50:52.4731182Z """ 2025-08-14T20:50:52.4731511Z try: 2025-08-14T20:50:52.4731846Z if settings_text: 2025-08-14T20:50:52.4732516Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-08-14T20:50:52.4733243Z # for easy reading 2025-08-14T20:50:52.4733970Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-08-14T20:50:52.4734793Z # the backtick character in shell commands. 2025-08-14T20:50:52.4735471Z backtick = chr(96) # backtick character 2025-08-14T20:50:52.4736090Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-08-14T20:50:52.4736701Z settings = load_yaml(settings_text) 2025-08-14T20:50:52.4737071Z 2025-08-14T20:50:52.4737457Z # For now we just load experiments. We can expand this if/when we add more settings 2025-08-14T20:50:52.4738169Z experiments = {} 2025-08-14T20:50:52.4738439Z 2025-08-14T20:50:52.4738793Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-08-14T20:50:52.4739503Z if not is_valid_experiment_name(exp_name): 2025-08-14T20:50:52.4740514Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-08-14T20:50:52.4741471Z continue 2025-08-14T20:50:52.4741733Z 2025-08-14T20:50:52.4741912Z valid_settings = {} 2025-08-14T20:50:52.4742389Z for setting in exp_settings: 2025-08-14T20:50:52.4742923Z if setting not in Experiment._fields: 2025-08-14T20:50:52.4743428Z log.warning( 2025-08-14T20:50:52.4744083Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-08-14T20:50:52.4744914Z ) 2025-08-14T20:50:52.4745414Z else: 2025-08-14T20:50:52.4745884Z valid_settings[setting] = exp_settings[setting] 2025-08-14T20:50:52.4746279Z 2025-08-14T20:50:52.4746543Z experiments[exp_name] = Experiment(**valid_settings) 2025-08-14T20:50:52.4747127Z return Settings(experiments) 2025-08-14T20:50:52.4747448Z 2025-08-14T20:50:52.4747613Z except Exception: 2025-08-14T20:50:52.4748057Z log.exception("Failed to parse settings") 2025-08-14T20:50:52.4748411Z 2025-08-14T20:50:52.4748568Z return Settings() 2025-08-14T20:50:52.4748804Z 2025-08-14T20:50:52.4748811Z 2025-08-14T20:50:52.4749040Z def parse_settings(rollout_state: str) -> Settings: 2025-08-14T20:50:52.4749551Z """ 2025-08-14T20:50:52.4749939Z Parse settings, if any, from the rollout state. 2025-08-14T20:50:52.4750305Z 2025-08-14T20:50:52.4750640Z If the issue body contains "---" then the text above that is the settings 2025-08-14T20:50:52.4751350Z and the text below is the list of opted in users. 2025-08-14T20:50:52.4751722Z 2025-08-14T20:50:52.4752097Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-08-14T20:50:52.4752828Z """ 2025-08-14T20:50:52.4753341Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:52.4754034Z return parse_settings_from_text(settings_text) 2025-08-14T20:50:52.4754394Z 2025-08-14T20:50:52.4754401Z 2025-08-14T20:50:52.4754625Z def parse_users(rollout_state: str) -> UserOptins: 2025-08-14T20:50:52.4755220Z """ 2025-08-14T20:50:52.4755574Z Parse users from the rollout state. 2025-08-14T20:50:52.4755902Z 2025-08-14T20:50:52.4756050Z """ 2025-08-14T20:50:52.4756536Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-08-14T20:50:52.4757211Z return parse_user_opt_in_from_text(users_text) 2025-08-14T20:50:52.4757577Z 2025-08-14T20:50:52.4757583Z 2025-08-14T20:50:52.4758083Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:52.4758759Z """ 2025-08-14T20:50:52.4759139Z Check if a user is opted into an experiment 2025-08-14T20:50:52.4759621Z """ 2025-08-14T20:50:52.4760038Z return experiment_name in user_optins.get(user, []) 2025-08-14T20:50:52.4760419Z 2025-08-14T20:50:52.4760427Z 2025-08-14T20:50:52.4760813Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-08-14T20:50:52.4761483Z """ 2025-08-14T20:50:52.4761903Z Check if a user explicitly opted out of an experiment 2025-08-14T20:50:52.4762431Z """ 2025-08-14T20:50:52.4762887Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-08-14T20:50:52.4763515Z experiment_optout = "-" + experiment_name 2025-08-14T20:50:52.4764135Z if experiment_optout not in user_optins.get(user, []): 2025-08-14T20:50:52.4764674Z return False 2025-08-14T20:50:52.4764912Z 2025-08-14T20:50:52.4765448Z if is_user_opted_in(user, user_optins, experiment_name): 2025-08-14T20:50:52.4766022Z log.warning( 2025-08-14T20:50:52.4766760Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-08-14T20:50:52.4767568Z ) 2025-08-14T20:50:52.4767757Z 2025-08-14T20:50:52.4767909Z return True 2025-08-14T20:50:52.4768127Z 2025-08-14T20:50:52.4768133Z 2025-08-14T20:50:52.4768296Z def get_runner_prefix( 2025-08-14T20:50:52.4768699Z rollout_state: str, 2025-08-14T20:50:52.4769129Z workflow_requestors: Iterable[str], 2025-08-14T20:50:52.4769598Z branch: str, 2025-08-14T20:50:52.4770050Z eligible_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:52.4770668Z opt_out_experiments: frozenset[str] = frozenset(), 2025-08-14T20:50:52.4771199Z is_canary: bool = False, 2025-08-14T20:50:52.4771612Z ) -> str: 2025-08-14T20:50:52.4772147Z settings = parse_settings(rollout_state) 2025-08-14T20:50:52.4772716Z user_optins = parse_users(rollout_state) 2025-08-14T20:50:52.4773066Z 2025-08-14T20:50:52.4773223Z fleet_prefix = "" 2025-08-14T20:50:52.4773608Z prefixes = [] 2025-08-14T20:50:52.4774186Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-08-14T20:50:52.4775354Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-08-14T20:50:52.4776015Z log.info( 2025-08-14T20:50:52.4776635Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-08-14T20:50:52.4777326Z ) 2025-08-14T20:50:52.4777666Z continue 2025-08-14T20:50:52.4777898Z 2025-08-14T20:50:52.4778068Z if opt_out_experiments: 2025-08-14T20:50:52.4778553Z if experiment_name in opt_out_experiments: 2025-08-14T20:50:52.4779135Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-08-14T20:50:52.4779669Z log.info( 2025-08-14T20:50:52.4780508Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-08-14T20:50:52.4781403Z ) 2025-08-14T20:50:52.4781760Z continue 2025-08-14T20:50:52.4782011Z 2025-08-14T20:50:52.4782182Z if eligible_experiments: 2025-08-14T20:50:52.4782709Z if experiment_name not in eligible_experiments: 2025-08-14T20:50:52.4783286Z exp_list = ", ".join(eligible_experiments) 2025-08-14T20:50:52.4783797Z log.info( 2025-08-14T20:50:52.4784510Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-08-14T20:50:52.4785565Z ) 2025-08-14T20:50:52.4785968Z continue 2025-08-14T20:50:52.4786410Z elif not experiment_settings.default: 2025-08-14T20:50:52.4786890Z log.info( 2025-08-14T20:50:52.4787641Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-08-14T20:50:52.4788336Z ) 2025-08-14T20:50:52.4788670Z continue 2025-08-14T20:50:52.4788894Z 2025-08-14T20:50:52.4789158Z # Is any workflow_requestor opted out to this experiment? 2025-08-14T20:50:52.4789724Z opted_out_users = [ 2025-08-14T20:50:52.4790131Z requestor 2025-08-14T20:50:52.4790544Z for requestor in workflow_requestors 2025-08-14T20:50:52.4791163Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-08-14T20:50:52.4791737Z ] 2025-08-14T20:50:52.4791929Z 2025-08-14T20:50:52.4792094Z if opted_out_users: 2025-08-14T20:50:52.4792501Z log.info( 2025-08-14T20:50:52.4793072Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-08-14T20:50:52.4793713Z ) 2025-08-14T20:50:52.4794053Z continue 2025-08-14T20:50:52.4794288Z 2025-08-14T20:50:52.4794550Z # Is any workflow_requestor opted in to this experiment? 2025-08-14T20:50:52.4795378Z opted_in_users = [ 2025-08-14T20:50:52.4795805Z requestor 2025-08-14T20:50:52.4796222Z for requestor in workflow_requestors 2025-08-14T20:50:52.4796831Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-08-14T20:50:52.4797394Z ] 2025-08-14T20:50:52.4797580Z 2025-08-14T20:50:52.4797738Z enabled = False 2025-08-14T20:50:52.4798137Z if opted_in_users: 2025-08-14T20:50:52.4798537Z log.info( 2025-08-14T20:50:52.4799091Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-08-14T20:50:52.4799711Z ) 2025-08-14T20:50:52.4800062Z enabled = True 2025-08-14T20:50:52.4800315Z 2025-08-14T20:50:52.4800518Z elif experiment_settings.rollout_perc: 2025-08-14T20:50:52.4801283Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-08-14T20:50:52.4802311Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-08-14T20:50:52.4802899Z log.info( 2025-08-14T20:50:52.4803695Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-08-14T20:50:52.4804539Z ) 2025-08-14T20:50:52.4804911Z enabled = True 2025-08-14T20:50:52.4805305Z 2025-08-14T20:50:52.4805462Z if enabled: 2025-08-14T20:50:52.4805853Z label = experiment_name 2025-08-14T20:50:52.4806359Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-08-14T20:50:52.4807115Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-08-14T20:50:52.4807918Z # - If it's enabled, then we always list it's prefix first 2025-08-14T20:50:52.4808615Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-08-14T20:50:52.4809224Z if is_canary: 2025-08-14T20:50:52.4809676Z label += CANARY_FLEET_SUFFIX 2025-08-14T20:50:52.4810177Z fleet_prefix = label 2025-08-14T20:50:52.4810620Z else: 2025-08-14T20:50:52.4811004Z prefixes.append(label) 2025-08-14T20:50:52.4811319Z 2025-08-14T20:50:52.4811492Z if len(prefixes) > 1: 2025-08-14T20:50:52.4811885Z log.error( 2025-08-14T20:50:52.4812830Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-08-14T20:50:52.4813837Z ) 2025-08-14T20:50:52.4814190Z prefixes = prefixes[:1] 2025-08-14T20:50:52.4814467Z 2025-08-14T20:50:52.4814641Z # Fleet always comes first 2025-08-14T20:50:52.4815154Z if fleet_prefix: 2025-08-14T20:50:52.4815561Z prefixes.insert(0, fleet_prefix) 2025-08-14T20:50:52.4815886Z 2025-08-14T20:50:52.4816235Z return ".".join(prefixes) + "." if prefixes else "" 2025-08-14T20:50:52.4816620Z 2025-08-14T20:50:52.4816627Z 2025-08-14T20:50:52.4817040Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-08-14T20:50:52.4817745Z """ 2025-08-14T20:50:52.4818279Z Gets the first comment of the issue, which contains the desired rollout state. 2025-08-14T20:50:52.4818786Z 2025-08-14T20:50:52.4819140Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-08-14T20:50:52.4819787Z """ 2025-08-14T20:50:52.4820144Z gh = get_gh_client(github_token) 2025-08-14T20:50:52.4820639Z issue = get_issue(gh, repo, issue_num) 2025-08-14T20:50:52.4821225Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-08-14T20:50:52.4821628Z 2025-08-14T20:50:52.4821634Z 2025-08-14T20:50:52.4821999Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-08-14T20:50:52.4822694Z for _ in range(num_retries): 2025-08-14T20:50:52.4823129Z try: 2025-08-14T20:50:52.4823535Z req = Request(url=url, headers=headers) 2025-08-14T20:50:52.4824134Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-08-14T20:50:52.4824718Z return json.loads(content) 2025-08-14T20:50:52.4825304Z except Exception as e: 2025-08-14T20:50:52.4825787Z log.warning(f"Could not download {url}: {e}") 2025-08-14T20:50:52.4826160Z 2025-08-14T20:50:52.4826511Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-08-14T20:50:52.4827160Z return {} 2025-08-14T20:50:52.4827361Z 2025-08-14T20:50:52.4827367Z 2025-08-14T20:50:52.4827517Z @cache 2025-08-14T20:50:52.4828091Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-08-14T20:50:52.4828770Z """ 2025-08-14T20:50:52.4829130Z Dynamically get PR information 2025-08-14T20:50:52.4829571Z """ 2025-08-14T20:50:52.4830205Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-08-14T20:50:52.4830768Z headers = { 2025-08-14T20:50:52.4831186Z "Accept": "application/vnd.github.v3+json", 2025-08-14T20:50:52.4831739Z "Authorization": f"token {github_token}", 2025-08-14T20:50:52.4832218Z } 2025-08-14T20:50:52.4832603Z json_response: dict[str, Any] = download_json( 2025-08-14T20:50:52.4833138Z url=f"{github_api}/issues/{pr_number}", 2025-08-14T20:50:52.4833632Z headers=headers, 2025-08-14T20:50:52.4834015Z ) 2025-08-14T20:50:52.4834196Z 2025-08-14T20:50:52.4834370Z if not json_response: 2025-08-14T20:50:52.4834881Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-08-14T20:50:52.4835554Z return {} 2025-08-14T20:50:52.4835767Z 2025-08-14T20:50:52.4835930Z return json_response 2025-08-14T20:50:52.4836179Z 2025-08-14T20:50:52.4836185Z 2025-08-14T20:50:52.4836549Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-08-14T20:50:52.4837220Z """ 2025-08-14T20:50:52.4837693Z Dynamically get the latest list of labels from the pull request 2025-08-14T20:50:52.4838285Z """ 2025-08-14T20:50:52.4838717Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-08-14T20:50:52.4839266Z return { 2025-08-14T20:50:52.4839788Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-08-14T20:50:52.4840423Z } 2025-08-14T20:50:52.4840602Z 2025-08-14T20:50:52.4840609Z 2025-08-14T20:50:52.4840769Z def main() -> None: 2025-08-14T20:50:52.4841142Z args = parse_args() 2025-08-14T20:50:52.4841384Z 2025-08-14T20:50:52.4841589Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-08-14T20:50:52.4841940Z 2025-08-14T20:50:52.4842111Z # Check if the PR is opt-out 2025-08-14T20:50:52.4842553Z if args.pr_number: 2025-08-14T20:50:52.4843136Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-08-14T20:50:52.4843947Z if OPT_OUT_LABEL in labels: 2025-08-14T20:50:52.4844397Z log.info( 2025-08-14T20:50:52.4845121Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-08-14T20:50:52.4845819Z ) 2025-08-14T20:50:52.4846314Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:52.4846917Z sys.exit() 2025-08-14T20:50:52.4847155Z 2025-08-14T20:50:52.4847301Z try: 2025-08-14T20:50:52.4847701Z rollout_state = get_rollout_state_from_issue( 2025-08-14T20:50:52.4848348Z args.github_token, args.github_issue_repo, args.github_issue 2025-08-14T20:50:52.4848918Z ) 2025-08-14T20:50:52.4849102Z 2025-08-14T20:50:52.4849299Z username = get_potential_pr_author( 2025-08-14T20:50:52.4849789Z args.github_token, 2025-08-14T20:50:52.4850227Z args.github_repo, 2025-08-14T20:50:52.4850654Z args.github_actor, 2025-08-14T20:50:52.4851097Z args.github_ref_type, 2025-08-14T20:50:52.4851542Z args.github_branch, 2025-08-14T20:50:52.4851958Z ) 2025-08-14T20:50:52.4852143Z 2025-08-14T20:50:52.4852404Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-08-14T20:50:52.4852813Z 2025-08-14T20:50:52.4853011Z runner_label_prefix = get_runner_prefix( 2025-08-14T20:50:52.4853515Z rollout_state, 2025-08-14T20:50:52.4853955Z (args.github_issue_owner, username), 2025-08-14T20:50:52.4854462Z args.github_branch, 2025-08-14T20:50:52.4854907Z args.eligible_experiments, 2025-08-14T20:50:52.4855500Z args.opt_out_experiments, 2025-08-14T20:50:52.4855944Z is_canary, 2025-08-14T20:50:52.4856317Z ) 2025-08-14T20:50:52.4856503Z 2025-08-14T20:50:52.4856671Z except Exception as e: 2025-08-14T20:50:52.4857077Z log.error( 2025-08-14T20:50:52.4857684Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-08-14T20:50:52.4858501Z ) 2025-08-14T20:50:52.4858691Z 2025-08-14T20:50:52.4859001Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-08-14T20:50:52.4859447Z 2025-08-14T20:50:52.4859452Z 2025-08-14T20:50:52.4859610Z if __name__ == "__main__": 2025-08-14T20:50:52.4860005Z main() 2025-08-14T20:50:52.4860192Z 2025-08-14T20:50:52.4947839Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:50:52.4948659Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-08-14T20:50:52.4988040Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:52.4988480Z env: 2025-08-14T20:50:52.4989038Z GITHUB_TOKEN: *** 2025-08-14T20:50:52.4989421Z ISSUE_NUMBER: 5132 2025-08-14T20:50:52.4989831Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:52.4990295Z ISSUE_OWNER: 2025-08-14T20:50:52.4990658Z CHECK_EXPERIMENTS: 2025-08-14T20:50:52.4991044Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:52.4991436Z PR_NUMBER: 2025-08-14T20:50:52.4991774Z ##[endgroup] 2025-08-14T20:50:53.4339185Z Defaulting to user installation because normal site-packages is not writeable 2025-08-14T20:50:54.0531400Z Collecting urllib3==1.26.18 2025-08-14T20:50:54.0839916Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-08-14T20:50:54.1043120Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.1 MB/s eta 0:00:00 2025-08-14T20:50:54.1259003Z Collecting PyGithub==2.3.0 2025-08-14T20:50:54.1285378Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-08-14T20:50:54.1714103Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-08-14T20:50:54.1739635Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-08-14T20:50:54.1787422Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-08-14T20:50:54.1805928Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-08-14T20:50:54.1822284Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-08-14T20:50:54.2066197Z Collecting Deprecated (from PyGithub==2.3.0) 2025-08-14T20:50:54.2091720Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-08-14T20:50:54.2321383Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-08-14T20:50:54.3423084Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:50:54.3448626Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-08-14T20:50:54.4601309Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-08-14T20:50:54.4627616Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-08-14T20:50:54.4808073Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-08-14T20:50:54.4831320Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-08-14T20:50:54.5043644Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-08-14T20:50:54.5106724Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 29.7 MB/s eta 0:00:00 2025-08-14T20:50:54.5128707Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-08-14T20:50:54.5186971Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 83.5 MB/s eta 0:00:00 2025-08-14T20:50:54.5208700Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-08-14T20:50:54.5288534Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 134.7 MB/s eta 0:00:00 2025-08-14T20:50:54.5310598Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-08-14T20:50:54.5355912Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-08-14T20:50:54.5421098Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 104.2 MB/s eta 0:00:00 2025-08-14T20:50:54.5446238Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-08-14T20:50:54.5488183Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 29.9 MB/s eta 0:00:00 2025-08-14T20:50:54.5511659Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-08-14T20:50:54.5554903Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 39.6 MB/s eta 0:00:00 2025-08-14T20:50:54.8518942Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-08-14T20:50:55.3826066Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.3 2025-08-14T20:50:55.4794060Z ##[group]Run curr_branch="main" 2025-08-14T20:50:55.4794395Z curr_branch="main" 2025-08-14T20:50:55.4794622Z curr_ref_type="branch" 2025-08-14T20:50:55.4794900Z echo "Current branch is '$curr_branch'" 2025-08-14T20:50:55.4795414Z  2025-08-14T20:50:55.4795631Z python3 runner_determinator.py \ 2025-08-14T20:50:55.4795931Z  --github-token "$GITHUB_TOKEN" \ 2025-08-14T20:50:55.4796210Z  --github-issue "$ISSUE_NUMBER" \ 2025-08-14T20:50:55.4796464Z  --github-branch "$curr_branch" \ 2025-08-14T20:50:55.4796736Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-08-14T20:50:55.4797019Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-08-14T20:50:55.4797296Z  --github-ref-type "$curr_ref_type" \ 2025-08-14T20:50:55.4797561Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-08-14T20:50:55.4797869Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-08-14T20:50:55.4798248Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-08-14T20:50:55.4798537Z  --pr-number "${PR_NUMBER}" 2025-08-14T20:50:55.4839364Z shell: /usr/bin/bash -e {0} 2025-08-14T20:50:55.4839596Z env: 2025-08-14T20:50:55.4840193Z GITHUB_TOKEN: *** 2025-08-14T20:50:55.4840398Z ISSUE_NUMBER: 5132 2025-08-14T20:50:55.4840614Z TRIGGERING_ACTOR: pytorchmergebot 2025-08-14T20:50:55.4840853Z ISSUE_OWNER: 2025-08-14T20:50:55.4841032Z CHECK_EXPERIMENTS: 2025-08-14T20:50:55.4841236Z OPT_OUT_EXPERIMENTS: 2025-08-14T20:50:55.4841431Z PR_NUMBER: 2025-08-14T20:50:55.4841608Z ##[endgroup] 2025-08-14T20:50:55.4898011Z Current branch is 'main' 2025-08-14T20:50:57.2136570Z INFO : Based on rollout percentage of 50%, enabling experiment lf. 2025-08-14T20:50:57.2137990Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-08-14T20:50:57.2138934Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-08-14T20:50:57.2139624Z INFO : Setting output: label-type='lf.' 2025-08-14T20:50:57.2453085Z Evaluate and set job outputs 2025-08-14T20:50:57.2460672Z Set output 'label-type' 2025-08-14T20:50:57.2462493Z Cleaning up orphan processes