2025-07-17T06:33:20.1486380Z Current runner version: '2.326.0' 2025-07-17T06:33:20.1510655Z ##[group]Runner Image Provisioner 2025-07-17T06:33:20.1511492Z Hosted Compute Agent 2025-07-17T06:33:20.1512095Z Version: 20250711.363 2025-07-17T06:33:20.1512705Z Commit: 6785254374ce925a23743850c1cb91912ce5c14c 2025-07-17T06:33:20.1513388Z Build Date: 2025-07-11T20:04:25Z 2025-07-17T06:33:20.1513932Z ##[endgroup] 2025-07-17T06:33:20.1514533Z ##[group]Operating System 2025-07-17T06:33:20.1515262Z Ubuntu 2025-07-17T06:33:20.1515780Z 24.04.2 2025-07-17T06:33:20.1516298Z LTS 2025-07-17T06:33:20.1516745Z ##[endgroup] 2025-07-17T06:33:20.1517264Z ##[group]Runner Image 2025-07-17T06:33:20.1517801Z Image: ubuntu-24.04 2025-07-17T06:33:20.1518375Z Version: 20250710.1.0 2025-07-17T06:33:20.1519329Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250710.1/images/ubuntu/Ubuntu2404-Readme.md 2025-07-17T06:33:20.1520897Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250710.1 2025-07-17T06:33:20.1521872Z ##[endgroup] 2025-07-17T06:33:20.1522994Z ##[group]GITHUB_TOKEN Permissions 2025-07-17T06:33:20.1525250Z Contents: read 2025-07-17T06:33:20.1525780Z Metadata: read 2025-07-17T06:33:20.1526378Z Packages: read 2025-07-17T06:33:20.1526843Z ##[endgroup] 2025-07-17T06:33:20.1529205Z Secret source: Actions 2025-07-17T06:33:20.1530162Z Prepare workflow directory 2025-07-17T06:33:20.2052114Z Prepare all required actions 2025-07-17T06:33:20.2108083Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (a38f433be2e94a64b095a44ba39879d02d0c2316) 2025-07-17T06:33:20.2112883Z ##[group] Inputs 2025-07-17T06:33:20.2113674Z check_experiments: 2025-07-17T06:33:20.2114339Z opt_out_experiments: 2025-07-17T06:33:20.2115115Z triggering_actor: pytorchmergebot 2025-07-17T06:33:20.2115856Z issue_owner: 2025-07-17T06:33:20.2116403Z curr_branch: main 2025-07-17T06:33:20.2117085Z curr_ref_type: branch 2025-07-17T06:33:20.2117628Z issue_number: 5132 2025-07-17T06:33:20.2118188Z ##[endgroup] 2025-07-17T06:33:20.2118818Z Complete job name: get-label-type / runner-determinator 2025-07-17T06:33:20.2717085Z ##[group]Run cat < runner_determinator.py 2025-07-17T06:33:20.2719767Z cat < runner_determinator.py 2025-07-17T06:33:20.2720460Z # flake8: noqa: G004 2025-07-17T06:33:20.2721049Z  2025-07-17T06:33:20.2721790Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.2722831Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.2723751Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.2724708Z  2025-07-17T06:33:20.2725791Z """ 2025-07-17T06:33:20.2726954Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.2728171Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.2729410Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.2730339Z of which runners should be used to run which job. 2025-07-17T06:33:20.2731020Z  2025-07-17T06:33:20.2731744Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.2732747Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.2733712Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.2734531Z list, defined. 2025-07-17T06:33:20.2735338Z  2025-07-17T06:33:20.2735995Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.2737069Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.2737982Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.2738948Z  2025-07-17T06:33:20.2739705Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.2740701Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.2741566Z experiments which the user could be opted in to. 2025-07-17T06:33:20.2742221Z  2025-07-17T06:33:20.2742747Z The user list has the following rules: 2025-07-17T06:33:20.2743353Z  2025-07-17T06:33:20.2743976Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.2745118Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.2745977Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.2746678Z  2025-07-17T06:33:20.2747134Z Example config: 2025-07-17T06:33:20.2747759Z  # A list of experiments that can be opted into. 2025-07-17T06:33:20.2748590Z  # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.2749336Z  # Expected syntax is: 2025-07-17T06:33:20.2750122Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.2751161Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.2752117Z  2025-07-17T06:33:20.2752572Z  experiments: 2025-07-17T06:33:20.2753043Z  lf: 2025-07-17T06:33:20.2753670Z  rollout_percent: 25 2025-07-17T06:33:20.2754234Z  all_branches: false 2025-07-17T06:33:20.2754817Z  default: true 2025-07-17T06:33:20.2755667Z  --- 2025-07-17T06:33:20.2756158Z  2025-07-17T06:33:20.2756603Z  # Opt-ins: 2025-07-17T06:33:20.2757398Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.2758571Z  # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.2759450Z  # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.2760319Z  # Experiments should be from the above list. 2025-07-17T06:33:20.2760971Z  2025-07-17T06:33:20.2761402Z  @User1,-lf,split_build 2025-07-17T06:33:20.2762093Z  @User2,lf 2025-07-17T06:33:20.2762600Z  @User3,split_build 2025-07-17T06:33:20.2763141Z """ 2025-07-17T06:33:20.2763647Z  2025-07-17T06:33:20.2764109Z import json 2025-07-17T06:33:20.2764597Z import logging 2025-07-17T06:33:20.2765639Z import os 2025-07-17T06:33:20.2766210Z import random 2025-07-17T06:33:20.2766707Z import re 2025-07-17T06:33:20.2767277Z import sys 2025-07-17T06:33:20.2767802Z from argparse import ArgumentParser 2025-07-17T06:33:20.2768485Z from collections.abc import Iterable 2025-07-17T06:33:20.2769223Z from functools import cache 2025-07-17T06:33:20.2769804Z from logging import LogRecord 2025-07-17T06:33:20.2770449Z from typing import Any, NamedTuple 2025-07-17T06:33:20.2771132Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.2771796Z  2025-07-17T06:33:20.2772249Z import yaml 2025-07-17T06:33:20.2772856Z from github import Auth, Github 2025-07-17T06:33:20.2773499Z from github.Issue import Issue 2025-07-17T06:33:20.2774051Z  2025-07-17T06:33:20.2774554Z  2025-07-17T06:33:20.2775358Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.2776196Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.2777156Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.2778476Z  2025-07-17T06:33:20.2779324Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.2779977Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.2780705Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.2781398Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.2782015Z  2025-07-17T06:33:20.2782548Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.2783156Z  2025-07-17T06:33:20.2783620Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.2784243Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.2784844Z  2025-07-17T06:33:20.2785409Z  2025-07-17T06:33:20.2785968Z class Experiment(NamedTuple): 2025-07-17T06:33:20.2786557Z  rollout_perc: float = ( 2025-07-17T06:33:20.2787348Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.2788183Z  ) 2025-07-17T06:33:20.2788696Z  all_branches: bool = ( 2025-07-17T06:33:20.2789476Z  False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.2790274Z  ) 2025-07-17T06:33:20.2790782Z  default: bool = ( 2025-07-17T06:33:20.2791456Z  True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.2792260Z  ) 2025-07-17T06:33:20.2792769Z  2025-07-17T06:33:20.2793217Z  # Add more fields as needed 2025-07-17T06:33:20.2793844Z  2025-07-17T06:33:20.2794266Z  2025-07-17T06:33:20.2794749Z class Settings(NamedTuple): 2025-07-17T06:33:20.2795698Z  """ 2025-07-17T06:33:20.2796378Z  Settings for the experiments that can be opted into. 2025-07-17T06:33:20.2797052Z  """ 2025-07-17T06:33:20.2797552Z  2025-07-17T06:33:20.2798072Z  experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.2798686Z  2025-07-17T06:33:20.2799335Z  2025-07-17T06:33:20.2799885Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.2800859Z  """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.2801726Z  2025-07-17T06:33:20.2802385Z  COLORS = { 2025-07-17T06:33:20.2803073Z  "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.2803845Z  "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.2804626Z  "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.2805504Z  "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.2806425Z  "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.2807215Z  } 2025-07-17T06:33:20.2807696Z  2025-07-17T06:33:20.2808294Z  def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.2809192Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.2810096Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.2810742Z  return super().format(record) 2025-07-17T06:33:20.2811414Z  2025-07-17T06:33:20.2811834Z  2025-07-17T06:33:20.2812313Z handler = logging.StreamHandler() 2025-07-17T06:33:20.2813319Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.2814110Z  2025-07-17T06:33:20.2814708Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.2815618Z log.addHandler(handler) 2025-07-17T06:33:20.2816208Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.2816816Z  2025-07-17T06:33:20.2817276Z  2025-07-17T06:33:20.2817844Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.2818473Z  """ 2025-07-17T06:33:20.2819176Z  Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.2820052Z  """ 2025-07-17T06:33:20.2820539Z  if not GITHUB_OUTPUT: 2025-07-17T06:33:20.2821813Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.2822961Z  log.warning( 2025-07-17T06:33:20.2823974Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.2825116Z  ) 2025-07-17T06:33:20.2825701Z  print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.2826390Z  return 2025-07-17T06:33:20.2826907Z  2025-07-17T06:33:20.2827416Z  with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.2828063Z  log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.2828804Z  f.write(f"{key}={value}\n") 2025-07-17T06:33:20.2829375Z  2025-07-17T06:33:20.2829813Z  2025-07-17T06:33:20.2830534Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.2831254Z  return frozenset( 2025-07-17T06:33:20.2832037Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.2832794Z  ) 2025-07-17T06:33:20.2833262Z  2025-07-17T06:33:20.2833656Z  2025-07-17T06:33:20.2834224Z def parse_args() -> Any: 2025-07-17T06:33:20.2835142Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.2836119Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.2837043Z  parser.add_argument( 2025-07-17T06:33:20.2837604Z  "--github-issue-repo", 2025-07-17T06:33:20.2838186Z  type=str, 2025-07-17T06:33:20.2838800Z  required=False, 2025-07-17T06:33:20.2839536Z  default="pytorch/test-infra", 2025-07-17T06:33:20.2840210Z  help="GitHub repo to get the issue", 2025-07-17T06:33:20.2840868Z  ) 2025-07-17T06:33:20.2841359Z  parser.add_argument( 2025-07-17T06:33:20.2841932Z  "--github-repo", 2025-07-17T06:33:20.2842554Z  type=str, 2025-07-17T06:33:20.2843068Z  required=True, 2025-07-17T06:33:20.2843676Z  help="GitHub repo where CI is running", 2025-07-17T06:33:20.2844353Z  ) 2025-07-17T06:33:20.2844817Z  parser.add_argument( 2025-07-17T06:33:20.2845912Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.2846722Z  ) 2025-07-17T06:33:20.2847220Z  parser.add_argument( 2025-07-17T06:33:20.2847953Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.2848794Z  ) 2025-07-17T06:33:20.2849291Z  parser.add_argument( 2025-07-17T06:33:20.2850059Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.2850891Z  ) 2025-07-17T06:33:20.2851357Z  parser.add_argument( 2025-07-17T06:33:20.2852151Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.2853015Z  ) 2025-07-17T06:33:20.2853511Z  parser.add_argument( 2025-07-17T06:33:20.2854092Z  "--github-ref-type", 2025-07-17T06:33:20.2855326Z  type=str, 2025-07-17T06:33:20.2931829Z  required=True, 2025-07-17T06:33:20.2932967Z  help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.2933952Z  ) 2025-07-17T06:33:20.2934661Z  parser.add_argument( 2025-07-17T06:33:20.2936141Z  "--eligible-experiments", 2025-07-17T06:33:20.2937165Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.2937771Z  required=False, 2025-07-17T06:33:20.2938243Z  default="", 2025-07-17T06:33:20.2939146Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.2940072Z  ) 2025-07-17T06:33:20.2940479Z  parser.add_argument( 2025-07-17T06:33:20.2940982Z  "--opt-out-experiments", 2025-07-17T06:33:20.2941561Z  type=_str_comma_separated_to_set, 2025-07-17T06:33:20.2942111Z  required=False, 2025-07-17T06:33:20.2942578Z  default="", 2025-07-17T06:33:20.2943049Z  help=( 2025-07-17T06:33:20.2943756Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.2945213Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.2946053Z  ), 2025-07-17T06:33:20.2946448Z  ) 2025-07-17T06:33:20.2946853Z  parser.add_argument( 2025-07-17T06:33:20.2947343Z  "--pr-number", 2025-07-17T06:33:20.2947811Z  type=str, 2025-07-17T06:33:20.2948256Z  required=False, 2025-07-17T06:33:20.2948722Z  default="", 2025-07-17T06:33:20.2949261Z  help="the optional PR number where this is run", 2025-07-17T06:33:20.2949828Z  ) 2025-07-17T06:33:20.2950196Z  2025-07-17T06:33:20.2950594Z  return parser.parse_args() 2025-07-17T06:33:20.2951100Z  2025-07-17T06:33:20.2951450Z  2025-07-17T06:33:20.2952078Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.2953032Z  auth = Auth.Token(github_token) 2025-07-17T06:33:20.2953592Z  return Github(auth=auth) 2025-07-17T06:33:20.2954073Z  2025-07-17T06:33:20.2954430Z  2025-07-17T06:33:20.2955356Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.2956177Z  repo = gh.get_repo(repo) 2025-07-17T06:33:20.2956726Z  return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.2957253Z  2025-07-17T06:33:20.2957603Z  2025-07-17T06:33:20.2957984Z def get_potential_pr_author( 2025-07-17T06:33:20.2958656Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.2959328Z ) -> str: 2025-07-17T06:33:20.2959888Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.2960699Z  # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.2961464Z  # embedded in the tag name: ciflow// 2025-07-17T06:33:20.2962051Z  2025-07-17T06:33:20.2962449Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.2962959Z  2025-07-17T06:33:20.2963434Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.2964074Z  split_tag = ref_name.split("/") 2025-07-17T06:33:20.2964584Z  if ( 2025-07-17T06:33:20.2965542Z  len(split_tag) == 3 2025-07-17T06:33:20.2966088Z  and split_tag[0] == "ciflow" 2025-07-17T06:33:20.2966633Z  and split_tag[2].isnumeric() 2025-07-17T06:33:20.2967131Z  ): 2025-07-17T06:33:20.2967551Z  pr_number = split_tag[2] 2025-07-17T06:33:20.2968052Z  try: 2025-07-17T06:33:20.2968525Z  repository = gh.get_repo(repo) 2025-07-17T06:33:20.2969310Z  pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.2969930Z  except Exception as e: 2025-07-17T06:33:20.2970467Z  raise Exception( # noqa: TRY002 2025-07-17T06:33:20.2971145Z  f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.2971782Z  ) from e 2025-07-17T06:33:20.2972364Z  return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.2973086Z  # In all other cases, return the original input username 2025-07-17T06:33:20.2973675Z  return username 2025-07-17T06:33:20.2974109Z  2025-07-17T06:33:20.2974446Z  2025-07-17T06:33:20.2975067Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.2975654Z  """ 2025-07-17T06:33:20.2976337Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.2977103Z  """ 2025-07-17T06:33:20.2977676Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.2978347Z  2025-07-17T06:33:20.2978691Z  2025-07-17T06:33:20.2979093Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.2979593Z  try: 2025-07-17T06:33:20.2980014Z  data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.2980528Z  return data 2025-07-17T06:33:20.2980992Z  except yaml.YAMLError: 2025-07-17T06:33:20.2981512Z  log.exception("Error loading YAML") 2025-07-17T06:33:20.2982029Z  raise 2025-07-17T06:33:20.2982440Z  2025-07-17T06:33:20.2982784Z  2025-07-17T06:33:20.2983407Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.2984149Z  """ 2025-07-17T06:33:20.2985048Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.2985962Z  2025-07-17T06:33:20.2986500Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.2987258Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.2987801Z  2025-07-17T06:33:20.2988371Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.2989047Z  """ 2025-07-17T06:33:20.2989520Z  rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.2990131Z  if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.2990753Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.2991354Z  else: 2025-07-17T06:33:20.2991759Z  return "", rollout_state 2025-07-17T06:33:20.2992248Z  2025-07-17T06:33:20.2992588Z  2025-07-17T06:33:20.2992999Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.2993527Z  """ 2025-07-17T06:33:20.2994071Z  Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.2994706Z  """ 2025-07-17T06:33:20.2995308Z  2025-07-17T06:33:20.2995663Z  2025-07-17T06:33:20.2996198Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.2996848Z  """ 2025-07-17T06:33:20.2997563Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.2998368Z  2025-07-17T06:33:20.2999149Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.3000117Z  - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.3000958Z  - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.3001579Z  2025-07-17T06:33:20.3001916Z  2025-07-17T06:33:20.3002251Z  """ 2025-07-17T06:33:20.3002643Z  optins = UserOptins() 2025-07-17T06:33:20.3003170Z  for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.3003733Z  user = user.strip("\r\n\t -") 2025-07-17T06:33:20.3004301Z  if not user or not user.startswith("@"): 2025-07-17T06:33:20.3004857Z  # Not a valid user. Skip 2025-07-17T06:33:20.3005591Z  continue 2025-07-17T06:33:20.3006020Z  2025-07-17T06:33:20.3006378Z  if user: 2025-07-17T06:33:20.3006850Z  usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.3007544Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.3008176Z  2025-07-17T06:33:20.3008537Z  return optins 2025-07-17T06:33:20.3008970Z  2025-07-17T06:33:20.3009311Z  2025-07-17T06:33:20.3009820Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.3010434Z  """ 2025-07-17T06:33:20.3010871Z  Check if the experiment name is valid. 2025-07-17T06:33:20.3011405Z  A valid name: 2025-07-17T06:33:20.3012080Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.3013013Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.3013748Z  - Cannot contain spaces 2025-07-17T06:33:20.3014233Z  """ 2025-07-17T06:33:20.3014594Z  2025-07-17T06:33:20.3015259Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.3015985Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.3016700Z  2025-07-17T06:33:20.3017063Z  if valid: 2025-07-17T06:33:20.3017478Z  return True 2025-07-17T06:33:20.3017904Z  2025-07-17T06:33:20.3018251Z  log.error( 2025-07-17T06:33:20.3019643Z  f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:33:20.3021089Z  ) 2025-07-17T06:33:20.3021465Z  return False 2025-07-17T06:33:20.3021870Z  2025-07-17T06:33:20.3022204Z  2025-07-17T06:33:20.3022720Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.3023346Z  """ 2025-07-17T06:33:20.3023960Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.3024659Z  """ 2025-07-17T06:33:20.3025141Z  try: 2025-07-17T06:33:20.3025530Z  if settings_text: 2025-07-17T06:33:20.3026263Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.3027028Z  # for easy reading 2025-07-17T06:33:20.3027817Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.3028678Z  # the backtick character in shell commands. 2025-07-17T06:33:20.3029289Z  backtick = chr(96) # backtick character 2025-07-17T06:33:20.3029953Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.3030612Z  settings = load_yaml(settings_text) 2025-07-17T06:33:20.3031118Z  2025-07-17T06:33:20.3031839Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.3032560Z  experiments = {} 2025-07-17T06:33:20.3033023Z  2025-07-17T06:33:20.3033579Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.3034325Z  if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.3035620Z  # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:33:20.3036614Z  continue 2025-07-17T06:33:20.3037075Z  2025-07-17T06:33:20.3037451Z  valid_settings = {} 2025-07-17T06:33:20.3037978Z  for setting in exp_settings: 2025-07-17T06:33:20.3038553Z  if setting not in Experiment._fields: 2025-07-17T06:33:20.3039124Z  log.warning( 2025-07-17T06:33:20.3039833Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.3040525Z  ) 2025-07-17T06:33:20.3040978Z  else: 2025-07-17T06:33:20.3041516Z  valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.3042075Z  2025-07-17T06:33:20.3042558Z  experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.3043184Z  return Settings(experiments) 2025-07-17T06:33:20.3043701Z  2025-07-17T06:33:20.3044064Z  except Exception: 2025-07-17T06:33:20.3044589Z  log.exception("Failed to parse settings") 2025-07-17T06:33:20.3045400Z  2025-07-17T06:33:20.3045777Z  return Settings() 2025-07-17T06:33:20.3046220Z  2025-07-17T06:33:20.3046578Z  2025-07-17T06:33:20.3047194Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.3047770Z  """ 2025-07-17T06:33:20.3048237Z  Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.3048780Z  2025-07-17T06:33:20.3049306Z  If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3050055Z  and the text below is the list of opted in users. 2025-07-17T06:33:20.3050593Z  2025-07-17T06:33:20.3051185Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.3051892Z  """ 2025-07-17T06:33:20.3052469Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3053235Z  return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.3053770Z  2025-07-17T06:33:20.3054113Z  2025-07-17T06:33:20.3054569Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.3055251Z  """ 2025-07-17T06:33:20.3055669Z  Parse users from the rollout state. 2025-07-17T06:33:20.3056164Z  2025-07-17T06:33:20.3056500Z  """ 2025-07-17T06:33:20.3057049Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3057789Z  return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.3058323Z  2025-07-17T06:33:20.3058664Z  2025-07-17T06:33:20.3059273Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3059998Z  """ 2025-07-17T06:33:20.3060435Z  Check if a user is opted into an experiment 2025-07-17T06:33:20.3060962Z  """ 2025-07-17T06:33:20.3061446Z  return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.3062198Z  2025-07-17T06:33:20.3062537Z  2025-07-17T06:33:20.3063163Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3063904Z  """ 2025-07-17T06:33:20.3064385Z  Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.3065076Z  """ 2025-07-17T06:33:20.3065610Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.3066293Z  experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.3066940Z  if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.3067529Z  return False 2025-07-17T06:33:20.3067956Z  2025-07-17T06:33:20.3068418Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.3069013Z  log.warning( 2025-07-17T06:33:20.3069820Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.3070655Z  ) 2025-07-17T06:33:20.3071030Z  2025-07-17T06:33:20.3071385Z  return True 2025-07-17T06:33:20.3071796Z  2025-07-17T06:33:20.3072131Z  2025-07-17T06:33:20.3072503Z def get_runner_prefix( 2025-07-17T06:33:20.3072963Z  rollout_state: str, 2025-07-17T06:33:20.3073468Z  workflow_requestors: Iterable[str], 2025-07-17T06:33:20.3073987Z  branch: str, 2025-07-17T06:33:20.3074515Z  eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3075410Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3075995Z  is_canary: bool = False, 2025-07-17T06:33:20.3076471Z ) -> str: 2025-07-17T06:33:20.3076925Z  settings = parse_settings(rollout_state) 2025-07-17T06:33:20.3077517Z  user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.3078037Z  2025-07-17T06:33:20.3078526Z  fleet_prefix = "" 2025-07-17T06:33:20.3078990Z  prefixes = [] 2025-07-17T06:33:20.3079667Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.3080591Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.3081281Z  log.info( 2025-07-17T06:33:20.3081970Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.3082701Z  ) 2025-07-17T06:33:20.3083100Z  continue 2025-07-17T06:33:20.3083527Z  2025-07-17T06:33:20.3083904Z  if opt_out_experiments: 2025-07-17T06:33:20.3084472Z  if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.3085366Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.3085976Z  log.info( 2025-07-17T06:33:20.3086892Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.3087811Z  ) 2025-07-17T06:33:20.3088236Z  continue 2025-07-17T06:33:20.3088676Z  2025-07-17T06:33:20.3089056Z  if eligible_experiments: 2025-07-17T06:33:20.3089633Z  if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.3090266Z  exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.3090818Z  log.info( 2025-07-17T06:33:20.3091596Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.3092398Z  ) 2025-07-17T06:33:20.3092960Z  continue 2025-07-17T06:33:20.3093480Z  elif not experiment_settings.default: 2025-07-17T06:33:20.3094004Z  log.info( 2025-07-17T06:33:20.3094682Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.3095512Z  ) 2025-07-17T06:33:20.3095913Z  continue 2025-07-17T06:33:20.3096333Z  2025-07-17T06:33:20.3096801Z  # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.3097412Z  opted_out_users = [ 2025-07-17T06:33:20.3097884Z  requestor 2025-07-17T06:33:20.3098377Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3099050Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3099661Z  ] 2025-07-17T06:33:20.3100049Z  2025-07-17T06:33:20.3100414Z  if opted_out_users: 2025-07-17T06:33:20.3100893Z  log.info( 2025-07-17T06:33:20.3101530Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.3102210Z  ) 2025-07-17T06:33:20.3102618Z  continue 2025-07-17T06:33:20.3103030Z  2025-07-17T06:33:20.3103504Z  # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.3104093Z  opted_in_users = [ 2025-07-17T06:33:20.3104563Z  requestor 2025-07-17T06:33:20.3105160Z  for requestor in workflow_requestors 2025-07-17T06:33:20.3105828Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3106433Z  ] 2025-07-17T06:33:20.3106809Z  2025-07-17T06:33:20.3107184Z  enabled = False 2025-07-17T06:33:20.3107656Z  if opted_in_users: 2025-07-17T06:33:20.3108245Z  log.info( 2025-07-17T06:33:20.3108872Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.3109535Z  ) 2025-07-17T06:33:20.3109942Z  enabled = True 2025-07-17T06:33:20.3110397Z  2025-07-17T06:33:20.3110804Z  elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.3111607Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.3112513Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.3113146Z  log.info( 2025-07-17T06:33:20.3114040Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.3115109Z  ) 2025-07-17T06:33:20.3115580Z  enabled = True 2025-07-17T06:33:20.3116053Z  2025-07-17T06:33:20.3116401Z  if enabled: 2025-07-17T06:33:20.3116867Z  label = experiment_name 2025-07-17T06:33:20.3117424Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.3118230Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.3119081Z  # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.3119827Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.3120471Z  if is_canary: 2025-07-17T06:33:20.3120982Z  label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.3121529Z  fleet_prefix = label 2025-07-17T06:33:20.3122166Z  else: 2025-07-17T06:33:20.3122626Z  prefixes.append(label) 2025-07-17T06:33:20.3123122Z  2025-07-17T06:33:20.3123484Z  if len(prefixes) > 1: 2025-07-17T06:33:20.3123952Z  log.error( 2025-07-17T06:33:20.3125182Z  f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:33:20.3126274Z  ) 2025-07-17T06:33:20.3126684Z  prefixes = prefixes[:1] 2025-07-17T06:33:20.3127158Z  2025-07-17T06:33:20.3127532Z  # Fleet always comes first 2025-07-17T06:33:20.3128022Z  if fleet_prefix: 2025-07-17T06:33:20.3128505Z  prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.3129003Z  2025-07-17T06:33:20.3129458Z  return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.3130026Z  2025-07-17T06:33:20.3130371Z  2025-07-17T06:33:20.3131003Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.3131748Z  """ 2025-07-17T06:33:20.3132353Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.3133041Z  2025-07-17T06:33:20.3133626Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.3134303Z  """ 2025-07-17T06:33:20.3134722Z  gh = get_gh_client(github_token) 2025-07-17T06:33:20.3135386Z  issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.3136030Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.3136615Z  2025-07-17T06:33:20.3136951Z  2025-07-17T06:33:20.3137540Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.3138414Z  for _ in range(num_retries): 2025-07-17T06:33:20.3138910Z  try: 2025-07-17T06:33:20.3139355Z  req = Request(url=url, headers=headers) 2025-07-17T06:33:20.3140007Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.3140645Z  return json.loads(content) 2025-07-17T06:33:20.3141168Z  except Exception as e: 2025-07-17T06:33:20.3141727Z  log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.3142259Z  2025-07-17T06:33:20.3142825Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.3143523Z  return {} 2025-07-17T06:33:20.3143924Z  2025-07-17T06:33:20.3144261Z  2025-07-17T06:33:20.3144599Z @cache 2025-07-17T06:33:20.3145346Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.3146081Z  """ 2025-07-17T06:33:20.3146493Z  Dynamically get PR information 2025-07-17T06:33:20.3146976Z  """ 2025-07-17T06:33:20.3147484Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.3148103Z  headers = { 2025-07-17T06:33:20.3148584Z  "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.3149190Z  "Authorization": f"token {github_token}", 2025-07-17T06:33:20.3149705Z  } 2025-07-17T06:33:20.3150163Z  json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.3150766Z  url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.3151308Z  headers=headers, 2025-07-17T06:33:20.3151758Z  ) 2025-07-17T06:33:20.3152113Z  2025-07-17T06:33:20.3152475Z  if not json_response: 2025-07-17T06:33:20.3153201Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.3153832Z  return {} 2025-07-17T06:33:20.3154242Z  2025-07-17T06:33:20.3154605Z  return json_response 2025-07-17T06:33:20.3155263Z  2025-07-17T06:33:20.3155609Z  2025-07-17T06:33:20.3156201Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.3156908Z  """ 2025-07-17T06:33:20.3157466Z  Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.3158095Z  """ 2025-07-17T06:33:20.3158592Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.3159184Z  return { 2025-07-17T06:33:20.3159774Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.3160443Z  } 2025-07-17T06:33:20.3160805Z  2025-07-17T06:33:20.3161237Z  2025-07-17T06:33:20.3161603Z def main() -> None: 2025-07-17T06:33:20.3162055Z  args = parse_args() 2025-07-17T06:33:20.3162491Z  2025-07-17T06:33:20.3162921Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.3163443Z  2025-07-17T06:33:20.3163815Z  # Check if the PR is opt-out 2025-07-17T06:33:20.3164308Z  if args.pr_number: 2025-07-17T06:33:20.3165307Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.3166067Z  if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.3166562Z  log.info( 2025-07-17T06:33:20.3167269Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.3167996Z  ) 2025-07-17T06:33:20.3168577Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3169243Z  sys.exit() 2025-07-17T06:33:20.3169805Z  2025-07-17T06:33:20.3170162Z  try: 2025-07-17T06:33:20.3170618Z  rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.3171324Z  args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.3171946Z  ) 2025-07-17T06:33:20.3172327Z  2025-07-17T06:33:20.3172721Z  username = get_potential_pr_author( 2025-07-17T06:33:20.3173257Z  args.github_token, 2025-07-17T06:33:20.3173770Z  args.github_repo, 2025-07-17T06:33:20.3174256Z  args.github_actor, 2025-07-17T06:33:20.3174761Z  args.github_ref_type, 2025-07-17T06:33:20.3175383Z  args.github_branch, 2025-07-17T06:33:20.3175856Z  ) 2025-07-17T06:33:20.3176221Z  2025-07-17T06:33:20.3176713Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.3177298Z  2025-07-17T06:33:20.3177718Z  runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.3178261Z  rollout_state, 2025-07-17T06:33:20.3178773Z  (args.github_issue_owner, username), 2025-07-17T06:33:20.3179312Z  args.github_branch, 2025-07-17T06:33:20.3179833Z  args.eligible_experiments, 2025-07-17T06:33:20.3180375Z  args.opt_out_experiments, 2025-07-17T06:33:20.3180876Z  is_canary, 2025-07-17T06:33:20.3181314Z  ) 2025-07-17T06:33:20.3181691Z  2025-07-17T06:33:20.3182060Z  except Exception as e: 2025-07-17T06:33:20.3182535Z  log.error( 2025-07-17T06:33:20.3183223Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.3184086Z  ) 2025-07-17T06:33:20.3184464Z  2025-07-17T06:33:20.3185102Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3185732Z  2025-07-17T06:33:20.3186073Z  2025-07-17T06:33:20.3186433Z if __name__ == "__main__": 2025-07-17T06:33:20.3186885Z  main() 2025-07-17T06:33:20.3187270Z  2025-07-17T06:33:20.3187607Z EOF 2025-07-17T06:33:20.3187960Z  2025-07-17T06:33:20.3188327Z cat runner_determinator.py 2025-07-17T06:33:20.3398291Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.3399118Z env: 2025-07-17T06:33:20.3399876Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.3400317Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.3400781Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.3401306Z ISSUE_OWNER: 2025-07-17T06:33:20.3401718Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.3402164Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.3402635Z PR_NUMBER: 2025-07-17T06:33:20.3403027Z ##[endgroup] 2025-07-17T06:33:20.3639475Z # flake8: noqa: G004 2025-07-17T06:33:20.3639801Z 2025-07-17T06:33:20.3640222Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-07-17T06:33:20.3641099Z # must be kept in sync. You can do it easily by running the following command: 2025-07-17T06:33:20.3641848Z # python .github/scripts/update_runner_determinator.py 2025-07-17T06:33:20.3642264Z 2025-07-17T06:33:20.3642427Z """ 2025-07-17T06:33:20.3642965Z This runner determinator is used to determine which set of runners to run a 2025-07-17T06:33:20.3643777Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-07-17T06:33:20.3644612Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-07-17T06:33:20.3645662Z of which runners should be used to run which job. 2025-07-17T06:33:20.3646055Z 2025-07-17T06:33:20.3646428Z The configuration has two parts, the settings and a list of opted-in users, 2025-07-17T06:33:20.3647485Z separated by a line containing "---". If the line is not present, the 2025-07-17T06:33:20.3648309Z settings are considered to be empty with only the second part, the user 2025-07-17T06:33:20.3648947Z list, defined. 2025-07-17T06:33:20.3649166Z 2025-07-17T06:33:20.3649503Z The first part is a YAML block that defines the rollout settings. This can be 2025-07-17T06:33:20.3650346Z used to define any settings that are needed to determine which runners to use. 2025-07-17T06:33:20.3651114Z It's fields are defined by the RolloutSettings class below. 2025-07-17T06:33:20.3651521Z 2025-07-17T06:33:20.3651872Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-07-17T06:33:20.3652660Z The user list is also a comma separated list of additional features or 2025-07-17T06:33:20.3653337Z experiments which the user could be opted in to. 2025-07-17T06:33:20.3653709Z 2025-07-17T06:33:20.3653896Z The user list has the following rules: 2025-07-17T06:33:20.3654244Z 2025-07-17T06:33:20.3654544Z - Users are GitHub usernames, which must start with the @ prefix 2025-07-17T06:33:20.3655614Z - Each user is also a comma-separated list of features/experiments to enable 2025-07-17T06:33:20.3656331Z - A "#" prefix opts the user out of all experiments 2025-07-17T06:33:20.3656700Z 2025-07-17T06:33:20.3656868Z Example config: 2025-07-17T06:33:20.3657290Z # A list of experiments that can be opted into. 2025-07-17T06:33:20.3657920Z # This defines the behavior they'll induce when opted into. 2025-07-17T06:33:20.3658499Z # Expected syntax is: 2025-07-17T06:33:20.3659100Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-07-17T06:33:20.3659997Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-07-17T06:33:20.3660563Z 2025-07-17T06:33:20.3660732Z experiments: 2025-07-17T06:33:20.3661114Z lf: 2025-07-17T06:33:20.3661468Z rollout_percent: 25 2025-07-17T06:33:20.3662078Z all_branches: false 2025-07-17T06:33:20.3662502Z default: true 2025-07-17T06:33:20.3662904Z --- 2025-07-17T06:33:20.3663096Z 2025-07-17T06:33:20.3663256Z # Opt-ins: 2025-07-17T06:33:20.3663802Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-07-17T06:33:20.3664753Z # and specifying experiments to enable in a comma-separated list. 2025-07-17T06:33:20.3665888Z # To always opt out of an experiment, prefix it with a "-". 2025-07-17T06:33:20.3666539Z # Experiments should be from the above list. 2025-07-17T06:33:20.3666892Z 2025-07-17T06:33:20.3667066Z @User1,-lf,split_build 2025-07-17T06:33:20.3667482Z @User2,lf 2025-07-17T06:33:20.3667845Z @User3,split_build 2025-07-17T06:33:20.3668233Z """ 2025-07-17T06:33:20.3668415Z 2025-07-17T06:33:20.3668572Z import json 2025-07-17T06:33:20.3668927Z import logging 2025-07-17T06:33:20.3669278Z import os 2025-07-17T06:33:20.3669629Z import random 2025-07-17T06:33:20.3670002Z import re 2025-07-17T06:33:20.3670347Z import sys 2025-07-17T06:33:20.3670731Z from argparse import ArgumentParser 2025-07-17T06:33:20.3671224Z from collections.abc import Iterable 2025-07-17T06:33:20.3671719Z from functools import cache 2025-07-17T06:33:20.3672160Z from logging import LogRecord 2025-07-17T06:33:20.3672614Z from typing import Any, NamedTuple 2025-07-17T06:33:20.3673107Z from urllib.request import Request, urlopen 2025-07-17T06:33:20.3673456Z 2025-07-17T06:33:20.3673613Z import yaml 2025-07-17T06:33:20.3673982Z from github import Auth, Github 2025-07-17T06:33:20.3674449Z from github.Issue import Issue 2025-07-17T06:33:20.3674728Z 2025-07-17T06:33:20.3674734Z 2025-07-17T06:33:20.3675240Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-07-17T06:33:20.3675894Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-07-17T06:33:20.3676699Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-07-17T06:33:20.3677209Z 2025-07-17T06:33:20.3677482Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-07-17T06:33:20.3678572Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-07-17T06:33:20.3679396Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-07-17T06:33:20.3680401Z OPT_OUT_LABEL = "no-runner-experiments" 2025-07-17T06:33:20.3681022Z 2025-07-17T06:33:20.3681360Z SETTING_EXPERIMENTS = "experiments" 2025-07-17T06:33:20.3681949Z 2025-07-17T06:33:20.3682277Z LF_FLEET_EXPERIMENT = "lf" 2025-07-17T06:33:20.3683082Z CANARY_FLEET_SUFFIX = ".c" 2025-07-17T06:33:20.3683577Z 2025-07-17T06:33:20.3683590Z 2025-07-17T06:33:20.3683920Z class Experiment(NamedTuple): 2025-07-17T06:33:20.3684841Z rollout_perc: float = ( 2025-07-17T06:33:20.3686159Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-07-17T06:33:20.3687211Z ) 2025-07-17T06:33:20.3687921Z all_branches: bool = ( 2025-07-17T06:33:20.3689056Z False # If True, the experiment is also enabled on the exception branches 2025-07-17T06:33:20.3690306Z ) 2025-07-17T06:33:20.3690988Z default: bool = ( 2025-07-17T06:33:20.3692003Z True # If True, the experiment is enabled by default for all queries 2025-07-17T06:33:20.3693168Z ) 2025-07-17T06:33:20.3693545Z 2025-07-17T06:33:20.3693867Z # Add more fields as needed 2025-07-17T06:33:20.3694399Z 2025-07-17T06:33:20.3694410Z 2025-07-17T06:33:20.3694735Z class Settings(NamedTuple): 2025-07-17T06:33:20.3695702Z """ 2025-07-17T06:33:20.3696476Z Settings for the experiments that can be opted into. 2025-07-17T06:33:20.3697432Z """ 2025-07-17T06:33:20.3697798Z 2025-07-17T06:33:20.3698154Z experiments: dict[str, Experiment] = {} 2025-07-17T06:33:20.3698772Z 2025-07-17T06:33:20.3698782Z 2025-07-17T06:33:20.3699128Z class ColorFormatter(logging.Formatter): 2025-07-17T06:33:20.3700148Z """Color codes the log messages based on the log level""" 2025-07-17T06:33:20.3700864Z 2025-07-17T06:33:20.3701157Z COLORS = { 2025-07-17T06:33:20.3701812Z "WARNING": "\033[33m", # Yellow 2025-07-17T06:33:20.3702895Z "ERROR": "\033[31m", # Red 2025-07-17T06:33:20.3703712Z "CRITICAL": "\033[31m", # Red 2025-07-17T06:33:20.3704526Z "INFO": "\033[0m", # Reset 2025-07-17T06:33:20.3705637Z "DEBUG": "\033[0m", # Reset 2025-07-17T06:33:20.3706476Z } 2025-07-17T06:33:20.3706826Z 2025-07-17T06:33:20.3707201Z def format(self, record: LogRecord) -> str: 2025-07-17T06:33:20.3708466Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-07-17T06:33:20.3709873Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-07-17T06:33:20.3710918Z return super().format(record) 2025-07-17T06:33:20.3711506Z 2025-07-17T06:33:20.3711527Z 2025-07-17T06:33:20.3711863Z handler = logging.StreamHandler() 2025-07-17T06:33:20.3713084Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-07-17T06:33:20.3714110Z 2025-07-17T06:33:20.3714542Z log = logging.getLogger(os.path.basename(__file__)) 2025-07-17T06:33:20.3715794Z log.addHandler(handler) 2025-07-17T06:33:20.3716505Z log.setLevel(logging.INFO) 2025-07-17T06:33:20.3716945Z 2025-07-17T06:33:20.3716954Z 2025-07-17T06:33:20.3717334Z def set_github_output(key: str, value: str) -> None: 2025-07-17T06:33:20.3718187Z """ 2025-07-17T06:33:20.3718885Z Defines outputs of the github action that invokes this script 2025-07-17T06:33:20.3719475Z """ 2025-07-17T06:33:20.3719833Z if not GITHUB_OUTPUT: 2025-07-17T06:33:20.3720828Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-07-17T06:33:20.3721865Z log.warning( 2025-07-17T06:33:20.3722670Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-07-17T06:33:20.3723519Z ) 2025-07-17T06:33:20.3733952Z print(f"::set-output name={key}::{value}") 2025-07-17T06:33:20.3734519Z return 2025-07-17T06:33:20.3734764Z 2025-07-17T06:33:20.3735372Z with open(GITHUB_OUTPUT, "a") as f: 2025-07-17T06:33:20.3735960Z log.info(f"Setting output: {key}='{value}'") 2025-07-17T06:33:20.3736501Z f.write(f"{key}={value}\n") 2025-07-17T06:33:20.3736801Z 2025-07-17T06:33:20.3736807Z 2025-07-17T06:33:20.3737096Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-07-17T06:33:20.3737686Z return frozenset( 2025-07-17T06:33:20.3738256Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-07-17T06:33:20.3738892Z ) 2025-07-17T06:33:20.3739088Z 2025-07-17T06:33:20.3739095Z 2025-07-17T06:33:20.3739271Z def parse_args() -> Any: 2025-07-17T06:33:20.3739783Z parser = ArgumentParser("Get dynamic rollout settings") 2025-07-17T06:33:20.3740583Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-07-17T06:33:20.3741302Z parser.add_argument( 2025-07-17T06:33:20.3741727Z "--github-issue-repo", 2025-07-17T06:33:20.3742183Z type=str, 2025-07-17T06:33:20.3742569Z required=False, 2025-07-17T06:33:20.3743005Z default="pytorch/test-infra", 2025-07-17T06:33:20.3743512Z help="GitHub repo to get the issue", 2025-07-17T06:33:20.3743999Z ) 2025-07-17T06:33:20.3744353Z parser.add_argument( 2025-07-17T06:33:20.3744775Z "--github-repo", 2025-07-17T06:33:20.3745371Z type=str, 2025-07-17T06:33:20.3745757Z required=True, 2025-07-17T06:33:20.3746193Z help="GitHub repo where CI is running", 2025-07-17T06:33:20.3746683Z ) 2025-07-17T06:33:20.3747054Z parser.add_argument( 2025-07-17T06:33:20.3747619Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-07-17T06:33:20.3748230Z ) 2025-07-17T06:33:20.3748574Z parser.add_argument( 2025-07-17T06:33:20.3749158Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-07-17T06:33:20.3749781Z ) 2025-07-17T06:33:20.3750284Z parser.add_argument( 2025-07-17T06:33:20.3750895Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-07-17T06:33:20.3751540Z ) 2025-07-17T06:33:20.3751894Z parser.add_argument( 2025-07-17T06:33:20.3752505Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-07-17T06:33:20.3753172Z ) 2025-07-17T06:33:20.3753550Z parser.add_argument( 2025-07-17T06:33:20.3753977Z "--github-ref-type", 2025-07-17T06:33:20.3754402Z type=str, 2025-07-17T06:33:20.3754783Z required=True, 2025-07-17T06:33:20.3755497Z help="Current GitHub ref type, branch or tag", 2025-07-17T06:33:20.3756020Z ) 2025-07-17T06:33:20.3756374Z parser.add_argument( 2025-07-17T06:33:20.3756801Z "--eligible-experiments", 2025-07-17T06:33:20.3757298Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3757792Z required=False, 2025-07-17T06:33:20.3758197Z default="", 2025-07-17T06:33:20.3758992Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-07-17T06:33:20.3759857Z ) 2025-07-17T06:33:20.3760208Z parser.add_argument( 2025-07-17T06:33:20.3760652Z "--opt-out-experiments", 2025-07-17T06:33:20.3761120Z type=_str_comma_separated_to_set, 2025-07-17T06:33:20.3761616Z required=False, 2025-07-17T06:33:20.3762010Z default="", 2025-07-17T06:33:20.3762369Z help=( 2025-07-17T06:33:20.3762985Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-07-17T06:33:20.3764021Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-07-17T06:33:20.3764796Z ), 2025-07-17T06:33:20.3765377Z ) 2025-07-17T06:33:20.3765745Z parser.add_argument( 2025-07-17T06:33:20.3766191Z "--pr-number", 2025-07-17T06:33:20.3766589Z type=str, 2025-07-17T06:33:20.3766972Z required=False, 2025-07-17T06:33:20.3767371Z default="", 2025-07-17T06:33:20.3767956Z help="the optional PR number where this is run", 2025-07-17T06:33:20.3768477Z ) 2025-07-17T06:33:20.3768662Z 2025-07-17T06:33:20.3768853Z return parser.parse_args() 2025-07-17T06:33:20.3769139Z 2025-07-17T06:33:20.3769145Z 2025-07-17T06:33:20.3769517Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3770217Z auth = Auth.Token(github_token) 2025-07-17T06:33:20.3770690Z return Github(auth=auth) 2025-07-17T06:33:20.3770970Z 2025-07-17T06:33:20.3770977Z 2025-07-17T06:33:20.3771392Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-07-17T06:33:20.3772133Z repo = gh.get_repo(repo) 2025-07-17T06:33:20.3772596Z return repo.get_issue(number=issue_num) 2025-07-17T06:33:20.3772936Z 2025-07-17T06:33:20.3772941Z 2025-07-17T06:33:20.3773122Z def get_potential_pr_author( 2025-07-17T06:33:20.3773722Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-07-17T06:33:20.3774355Z ) -> str: 2025-07-17T06:33:20.3774835Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-07-17T06:33:20.3775959Z # Fetch the actual username from the original PR. The PR number is 2025-07-17T06:33:20.3776646Z # embedded in the tag name: ciflow// 2025-07-17T06:33:20.3777029Z 2025-07-17T06:33:20.3777209Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.3777534Z 2025-07-17T06:33:20.3777783Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-07-17T06:33:20.3778385Z split_tag = ref_name.split("/") 2025-07-17T06:33:20.3778860Z if ( 2025-07-17T06:33:20.3779234Z len(split_tag) == 3 2025-07-17T06:33:20.3779680Z and split_tag[0] == "ciflow" 2025-07-17T06:33:20.3780176Z and split_tag[2].isnumeric() 2025-07-17T06:33:20.3780640Z ): 2025-07-17T06:33:20.3781143Z pr_number = split_tag[2] 2025-07-17T06:33:20.3781600Z try: 2025-07-17T06:33:20.3782010Z repository = gh.get_repo(repo) 2025-07-17T06:33:20.3782583Z pull = repository.get_pull(number=int(pr_number)) 2025-07-17T06:33:20.3783142Z except Exception as e: 2025-07-17T06:33:20.3783628Z raise Exception( # noqa: TRY002 2025-07-17T06:33:20.3784260Z f"issue with pull request {pr_number} from repo {repository}" 2025-07-17T06:33:20.3785057Z ) from e 2025-07-17T06:33:20.3785691Z return pull.user.login # type: ignore[no-any-return] 2025-07-17T06:33:20.3786335Z # In all other cases, return the original input username 2025-07-17T06:33:20.3786883Z return username 2025-07-17T06:33:20.3787117Z 2025-07-17T06:33:20.3787123Z 2025-07-17T06:33:20.3787334Z def is_exception_branch(branch: str) -> bool: 2025-07-17T06:33:20.3787831Z """ 2025-07-17T06:33:20.3788429Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-07-17T06:33:20.3789166Z """ 2025-07-17T06:33:20.3789672Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-07-17T06:33:20.3790147Z 2025-07-17T06:33:20.3790154Z 2025-07-17T06:33:20.3790345Z def load_yaml(yaml_text: str) -> Any: 2025-07-17T06:33:20.3790804Z try: 2025-07-17T06:33:20.3791175Z data = yaml.safe_load(yaml_text) 2025-07-17T06:33:20.3791651Z return data 2025-07-17T06:33:20.3792048Z except yaml.YAMLError: 2025-07-17T06:33:20.3792498Z log.exception("Error loading YAML") 2025-07-17T06:33:20.3792985Z raise 2025-07-17T06:33:20.3793190Z 2025-07-17T06:33:20.3793196Z 2025-07-17T06:33:20.3793584Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-07-17T06:33:20.3794263Z """ 2025-07-17T06:33:20.3794842Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-07-17T06:33:20.3795690Z 2025-07-17T06:33:20.3796169Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3796884Z and the text below is the list of opted in users. 2025-07-17T06:33:20.3797255Z 2025-07-17T06:33:20.3797605Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-07-17T06:33:20.3798245Z """ 2025-07-17T06:33:20.3798661Z rollout_state_parts = rollout_state.split("---") 2025-07-17T06:33:20.3799217Z if len(rollout_state_parts) >= 2: 2025-07-17T06:33:20.3799772Z return rollout_state_parts[0], rollout_state_parts[1] 2025-07-17T06:33:20.3800313Z else: 2025-07-17T06:33:20.3800675Z return "", rollout_state 2025-07-17T06:33:20.3800957Z 2025-07-17T06:33:20.3800963Z 2025-07-17T06:33:20.3801155Z class UserOptins(dict[str, list[str]]): 2025-07-17T06:33:20.3801616Z """ 2025-07-17T06:33:20.3802094Z Dictionary of users with a list of features they have opted into 2025-07-17T06:33:20.3802685Z """ 2025-07-17T06:33:20.3802873Z 2025-07-17T06:33:20.3802879Z 2025-07-17T06:33:20.3803194Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-07-17T06:33:20.3803797Z """ 2025-07-17T06:33:20.3804444Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-07-17T06:33:20.3805318Z 2025-07-17T06:33:20.3805896Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-07-17T06:33:20.3806814Z - Example line: "@User1,lf,split_build" 2025-07-17T06:33:20.3807449Z - A "#" prefix indicates the user is opted out of all experiments 2025-07-17T06:33:20.3807883Z 2025-07-17T06:33:20.3807890Z 2025-07-17T06:33:20.3808039Z """ 2025-07-17T06:33:20.3808394Z optins = UserOptins() 2025-07-17T06:33:20.3808844Z for user in user_optin_text.split("\n"): 2025-07-17T06:33:20.3809363Z user = user.strip("\r\n\t -") 2025-07-17T06:33:20.3810007Z if not user or not user.startswith("@"): 2025-07-17T06:33:20.3810524Z # Not a valid user. Skip 2025-07-17T06:33:20.3810978Z continue 2025-07-17T06:33:20.3811207Z 2025-07-17T06:33:20.3811362Z if user: 2025-07-17T06:33:20.3811771Z usr_name = user.split(",")[0].strip("@") 2025-07-17T06:33:20.3812403Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-07-17T06:33:20.3812863Z 2025-07-17T06:33:20.3813022Z return optins 2025-07-17T06:33:20.3813242Z 2025-07-17T06:33:20.3813248Z 2025-07-17T06:33:20.3813518Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-07-17T06:33:20.3814065Z """ 2025-07-17T06:33:20.3814440Z Check if the experiment name is valid. 2025-07-17T06:33:20.3815135Z A valid name: 2025-07-17T06:33:20.3815762Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-07-17T06:33:20.3816620Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-07-17T06:33:20.3817304Z - Cannot contain spaces 2025-07-17T06:33:20.3817730Z """ 2025-07-17T06:33:20.3817924Z 2025-07-17T06:33:20.3818164Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-07-17T06:33:20.3818807Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-07-17T06:33:20.3819211Z 2025-07-17T06:33:20.3819362Z if valid: 2025-07-17T06:33:20.3819725Z return True 2025-07-17T06:33:20.3819944Z 2025-07-17T06:33:20.3820098Z log.error( 2025-07-17T06:33:20.3871467Z f"Invalid experiment name: {experiment_name}. Experiment names should only contain alphanumeric characters, '_', and '-'. They cannot contain spaces, and the special characters '_' and '-' cannot be the first or last characters." 2025-07-17T06:33:20.3873149Z ) 2025-07-17T06:33:20.3873504Z return False 2025-07-17T06:33:20.3873732Z 2025-07-17T06:33:20.3873749Z 2025-07-17T06:33:20.3874044Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-07-17T06:33:20.3874660Z """ 2025-07-17T06:33:20.3875769Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-07-17T06:33:20.3876475Z """ 2025-07-17T06:33:20.3876817Z try: 2025-07-17T06:33:20.3877169Z if settings_text: 2025-07-17T06:33:20.3877832Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-07-17T06:33:20.3878577Z # for easy reading 2025-07-17T06:33:20.3879299Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-07-17T06:33:20.3880115Z # the backtick character in shell commands. 2025-07-17T06:33:20.3880671Z backtick = chr(96) # backtick character 2025-07-17T06:33:20.3881301Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-07-17T06:33:20.3881918Z settings = load_yaml(settings_text) 2025-07-17T06:33:20.3882261Z 2025-07-17T06:33:20.3882649Z # For now we just load experiments. We can expand this if/when we add more settings 2025-07-17T06:33:20.3883361Z experiments = {} 2025-07-17T06:33:20.3883635Z 2025-07-17T06:33:20.3883994Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-07-17T06:33:20.3884699Z if not is_valid_experiment_name(exp_name): 2025-07-17T06:33:20.3886017Z # Exclude invalid experiments from the list. We log an error, but don't raise an exception so that other experiments can still be processed. 2025-07-17T06:33:20.3886984Z continue 2025-07-17T06:33:20.3887251Z 2025-07-17T06:33:20.3887431Z valid_settings = {} 2025-07-17T06:33:20.3887915Z for setting in exp_settings: 2025-07-17T06:33:20.3888452Z if setting not in Experiment._fields: 2025-07-17T06:33:20.3888964Z log.warning( 2025-07-17T06:33:20.3889620Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-07-17T06:33:20.3890430Z ) 2025-07-17T06:33:20.3890839Z else: 2025-07-17T06:33:20.3891321Z valid_settings[setting] = exp_settings[setting] 2025-07-17T06:33:20.3891712Z 2025-07-17T06:33:20.3891961Z experiments[exp_name] = Experiment(**valid_settings) 2025-07-17T06:33:20.3892557Z return Settings(experiments) 2025-07-17T06:33:20.3892880Z 2025-07-17T06:33:20.3893047Z except Exception: 2025-07-17T06:33:20.3893486Z log.exception("Failed to parse settings") 2025-07-17T06:33:20.3893841Z 2025-07-17T06:33:20.3894008Z return Settings() 2025-07-17T06:33:20.3894244Z 2025-07-17T06:33:20.3894250Z 2025-07-17T06:33:20.3894483Z def parse_settings(rollout_state: str) -> Settings: 2025-07-17T06:33:20.3895304Z """ 2025-07-17T06:33:20.3895742Z Parse settings, if any, from the rollout state. 2025-07-17T06:33:20.3896118Z 2025-07-17T06:33:20.3896447Z If the issue body contains "---" then the text above that is the settings 2025-07-17T06:33:20.3897145Z and the text below is the list of opted in users. 2025-07-17T06:33:20.3897529Z 2025-07-17T06:33:20.3897900Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-07-17T06:33:20.3898579Z """ 2025-07-17T06:33:20.3899085Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3899775Z return parse_settings_from_text(settings_text) 2025-07-17T06:33:20.3900136Z 2025-07-17T06:33:20.3900142Z 2025-07-17T06:33:20.3900370Z def parse_users(rollout_state: str) -> UserOptins: 2025-07-17T06:33:20.3900888Z """ 2025-07-17T06:33:20.3901251Z Parse users from the rollout state. 2025-07-17T06:33:20.3901586Z 2025-07-17T06:33:20.3901740Z """ 2025-07-17T06:33:20.3902232Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-07-17T06:33:20.3902906Z return parse_user_opt_in_from_text(users_text) 2025-07-17T06:33:20.3903269Z 2025-07-17T06:33:20.3903276Z 2025-07-17T06:33:20.3903784Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3904476Z """ 2025-07-17T06:33:20.3905023Z Check if a user is opted into an experiment 2025-07-17T06:33:20.3905561Z """ 2025-07-17T06:33:20.3905982Z return experiment_name in user_optins.get(user, []) 2025-07-17T06:33:20.3906365Z 2025-07-17T06:33:20.3906370Z 2025-07-17T06:33:20.3906758Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-07-17T06:33:20.3907436Z """ 2025-07-17T06:33:20.3907899Z Check if a user explicitly opted out of an experiment 2025-07-17T06:33:20.3908426Z """ 2025-07-17T06:33:20.3908896Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-07-17T06:33:20.3909533Z experiment_optout = "-" + experiment_name 2025-07-17T06:33:20.3910137Z if experiment_optout not in user_optins.get(user, []): 2025-07-17T06:33:20.3910694Z return False 2025-07-17T06:33:20.3910926Z 2025-07-17T06:33:20.3911181Z if is_user_opted_in(user, user_optins, experiment_name): 2025-07-17T06:33:20.3911729Z log.warning( 2025-07-17T06:33:20.3912461Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-07-17T06:33:20.3913271Z ) 2025-07-17T06:33:20.3913462Z 2025-07-17T06:33:20.3913619Z return True 2025-07-17T06:33:20.3913840Z 2025-07-17T06:33:20.3913845Z 2025-07-17T06:33:20.3914012Z def get_runner_prefix( 2025-07-17T06:33:20.3914419Z rollout_state: str, 2025-07-17T06:33:20.3914844Z workflow_requestors: Iterable[str], 2025-07-17T06:33:20.3915638Z branch: str, 2025-07-17T06:33:20.3916086Z eligible_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3916697Z opt_out_experiments: frozenset[str] = frozenset(), 2025-07-17T06:33:20.3917242Z is_canary: bool = False, 2025-07-17T06:33:20.3917673Z ) -> str: 2025-07-17T06:33:20.3918244Z settings = parse_settings(rollout_state) 2025-07-17T06:33:20.3918786Z user_optins = parse_users(rollout_state) 2025-07-17T06:33:20.3919121Z 2025-07-17T06:33:20.3919292Z fleet_prefix = "" 2025-07-17T06:33:20.3919688Z prefixes = [] 2025-07-17T06:33:20.3920272Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-07-17T06:33:20.3921124Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-07-17T06:33:20.3921779Z log.info( 2025-07-17T06:33:20.3922399Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-07-17T06:33:20.3923095Z ) 2025-07-17T06:33:20.3923447Z continue 2025-07-17T06:33:20.3923682Z 2025-07-17T06:33:20.3923857Z if opt_out_experiments: 2025-07-17T06:33:20.3924347Z if experiment_name in opt_out_experiments: 2025-07-17T06:33:20.3925139Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-07-17T06:33:20.3925710Z log.info( 2025-07-17T06:33:20.3926553Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-07-17T06:33:20.3927443Z ) 2025-07-17T06:33:20.3927812Z continue 2025-07-17T06:33:20.3928060Z 2025-07-17T06:33:20.3928235Z if eligible_experiments: 2025-07-17T06:33:20.3928751Z if experiment_name not in eligible_experiments: 2025-07-17T06:33:20.3929327Z exp_list = ", ".join(eligible_experiments) 2025-07-17T06:33:20.3929848Z log.info( 2025-07-17T06:33:20.3930552Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-07-17T06:33:20.3931318Z ) 2025-07-17T06:33:20.3931690Z continue 2025-07-17T06:33:20.3932140Z elif not experiment_settings.default: 2025-07-17T06:33:20.3932637Z log.info( 2025-07-17T06:33:20.3933361Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-07-17T06:33:20.3934041Z ) 2025-07-17T06:33:20.3934394Z continue 2025-07-17T06:33:20.3934626Z 2025-07-17T06:33:20.3935048Z # Is any workflow_requestor opted out to this experiment? 2025-07-17T06:33:20.3935730Z opted_out_users = [ 2025-07-17T06:33:20.3936142Z requestor 2025-07-17T06:33:20.3936563Z for requestor in workflow_requestors 2025-07-17T06:33:20.3937185Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3937762Z ] 2025-07-17T06:33:20.3937960Z 2025-07-17T06:33:20.3938129Z if opted_out_users: 2025-07-17T06:33:20.3938546Z log.info( 2025-07-17T06:33:20.3939112Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-07-17T06:33:20.3939760Z ) 2025-07-17T06:33:20.3940116Z continue 2025-07-17T06:33:20.3940347Z 2025-07-17T06:33:20.3940599Z # Is any workflow_requestor opted in to this experiment? 2025-07-17T06:33:20.3941158Z opted_in_users = [ 2025-07-17T06:33:20.3941565Z requestor 2025-07-17T06:33:20.3941982Z for requestor in workflow_requestors 2025-07-17T06:33:20.3942590Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-07-17T06:33:20.3943160Z ] 2025-07-17T06:33:20.3943355Z 2025-07-17T06:33:20.3943518Z enabled = False 2025-07-17T06:33:20.3943928Z if opted_in_users: 2025-07-17T06:33:20.3944337Z log.info( 2025-07-17T06:33:20.3945523Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-07-17T06:33:20.3946180Z ) 2025-07-17T06:33:20.3946551Z enabled = True 2025-07-17T06:33:20.3946815Z 2025-07-17T06:33:20.3947024Z elif experiment_settings.rollout_perc: 2025-07-17T06:33:20.3947775Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-07-17T06:33:20.3948798Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-07-17T06:33:20.3949401Z log.info( 2025-07-17T06:33:20.3950194Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-07-17T06:33:20.3951023Z ) 2025-07-17T06:33:20.3951401Z enabled = True 2025-07-17T06:33:20.3951672Z 2025-07-17T06:33:20.3951833Z if enabled: 2025-07-17T06:33:20.3952223Z label = experiment_name 2025-07-17T06:33:20.3952728Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-07-17T06:33:20.3953478Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-07-17T06:33:20.3954281Z # - If it's enabled, then we always list it's prefix first 2025-07-17T06:33:20.3955204Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-07-17T06:33:20.3955832Z if is_canary: 2025-07-17T06:33:20.3956289Z label += CANARY_FLEET_SUFFIX 2025-07-17T06:33:20.3956801Z fleet_prefix = label 2025-07-17T06:33:20.3957256Z else: 2025-07-17T06:33:20.3957649Z prefixes.append(label) 2025-07-17T06:33:20.3957965Z 2025-07-17T06:33:20.3958141Z if len(prefixes) > 1: 2025-07-17T06:33:20.3958550Z log.error( 2025-07-17T06:33:20.3959494Z f"Only a fleet and one other experiment can be enabled for a job at any time. Enabling {prefixes[0]} and ignoring the rest, which are {', '.join(prefixes[1:])}" 2025-07-17T06:33:20.3960507Z ) 2025-07-17T06:33:20.3960985Z prefixes = prefixes[:1] 2025-07-17T06:33:20.3961458Z 2025-07-17T06:33:20.3961654Z # Fleet always comes first 2025-07-17T06:33:20.3962092Z if fleet_prefix: 2025-07-17T06:33:20.3962510Z prefixes.insert(0, fleet_prefix) 2025-07-17T06:33:20.3962850Z 2025-07-17T06:33:20.3963251Z return ".".join(prefixes) + "." if prefixes else "" 2025-07-17T06:33:20.3963640Z 2025-07-17T06:33:20.3963646Z 2025-07-17T06:33:20.3964050Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-07-17T06:33:20.3964756Z """ 2025-07-17T06:33:20.3965590Z Gets the first comment of the issue, which contains the desired rollout state. 2025-07-17T06:33:20.3966160Z 2025-07-17T06:33:20.3966525Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-07-17T06:33:20.3967167Z """ 2025-07-17T06:33:20.3967534Z gh = get_gh_client(github_token) 2025-07-17T06:33:20.3968036Z issue = get_issue(gh, repo, issue_num) 2025-07-17T06:33:20.3968623Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-07-17T06:33:20.3969024Z 2025-07-17T06:33:20.3969030Z 2025-07-17T06:33:20.3969397Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-07-17T06:33:20.3970100Z for _ in range(num_retries): 2025-07-17T06:33:20.3970546Z try: 2025-07-17T06:33:20.3970939Z req = Request(url=url, headers=headers) 2025-07-17T06:33:20.3971552Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-07-17T06:33:20.3972139Z return json.loads(content) 2025-07-17T06:33:20.3972634Z except Exception as e: 2025-07-17T06:33:20.3973135Z log.warning(f"Could not download {url}: {e}") 2025-07-17T06:33:20.3973508Z 2025-07-17T06:33:20.3973853Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-07-17T06:33:20.3974505Z return {} 2025-07-17T06:33:20.3974714Z 2025-07-17T06:33:20.3974720Z 2025-07-17T06:33:20.3975040Z @cache 2025-07-17T06:33:20.3975683Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-07-17T06:33:20.3976370Z """ 2025-07-17T06:33:20.3976738Z Dynamically get PR information 2025-07-17T06:33:20.3977332Z """ 2025-07-17T06:33:20.3977809Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-07-17T06:33:20.3978375Z headers = { 2025-07-17T06:33:20.3978806Z "Accept": "application/vnd.github.v3+json", 2025-07-17T06:33:20.3979365Z "Authorization": f"token {github_token}", 2025-07-17T06:33:20.3979861Z } 2025-07-17T06:33:20.3980257Z json_response: dict[str, Any] = download_json( 2025-07-17T06:33:20.3980818Z url=f"{github_api}/issues/{pr_number}", 2025-07-17T06:33:20.3981321Z headers=headers, 2025-07-17T06:33:20.3981713Z ) 2025-07-17T06:33:20.3981903Z 2025-07-17T06:33:20.3982070Z if not json_response: 2025-07-17T06:33:20.3982584Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-07-17T06:33:20.3983151Z return {} 2025-07-17T06:33:20.3983365Z 2025-07-17T06:33:20.3983544Z return json_response 2025-07-17T06:33:20.3983799Z 2025-07-17T06:33:20.3983806Z 2025-07-17T06:33:20.3984165Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-07-17T06:33:20.3984841Z """ 2025-07-17T06:33:20.3985462Z Dynamically get the latest list of labels from the pull request 2025-07-17T06:33:20.3986056Z """ 2025-07-17T06:33:20.3986500Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-07-17T06:33:20.3987066Z return { 2025-07-17T06:33:20.3987603Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-07-17T06:33:20.3988236Z } 2025-07-17T06:33:20.3988421Z 2025-07-17T06:33:20.3988432Z 2025-07-17T06:33:20.3988600Z def main() -> None: 2025-07-17T06:33:20.3988983Z args = parse_args() 2025-07-17T06:33:20.3989233Z 2025-07-17T06:33:20.3989438Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-07-17T06:33:20.3989787Z 2025-07-17T06:33:20.3989979Z # Check if the PR is opt-out 2025-07-17T06:33:20.3990427Z if args.pr_number: 2025-07-17T06:33:20.3991019Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-07-17T06:33:20.3991901Z if OPT_OUT_LABEL in labels: 2025-07-17T06:33:20.3992375Z log.info( 2025-07-17T06:33:20.3993001Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-07-17T06:33:20.3993695Z ) 2025-07-17T06:33:20.3994187Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.3994809Z sys.exit() 2025-07-17T06:33:20.3995274Z 2025-07-17T06:33:20.3995436Z try: 2025-07-17T06:33:20.3995834Z rollout_state = get_rollout_state_from_issue( 2025-07-17T06:33:20.3996477Z args.github_token, args.github_issue_repo, args.github_issue 2025-07-17T06:33:20.3997053Z ) 2025-07-17T06:33:20.3997247Z 2025-07-17T06:33:20.3997437Z username = get_potential_pr_author( 2025-07-17T06:33:20.3997928Z args.github_token, 2025-07-17T06:33:20.3998370Z args.github_repo, 2025-07-17T06:33:20.3998809Z args.github_actor, 2025-07-17T06:33:20.3999261Z args.github_ref_type, 2025-07-17T06:33:20.3999725Z args.github_branch, 2025-07-17T06:33:20.4000141Z ) 2025-07-17T06:33:20.4000334Z 2025-07-17T06:33:20.4000598Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-07-17T06:33:20.4001005Z 2025-07-17T06:33:20.4001203Z runner_label_prefix = get_runner_prefix( 2025-07-17T06:33:20.4001708Z rollout_state, 2025-07-17T06:33:20.4002147Z (args.github_issue_owner, username), 2025-07-17T06:33:20.4002647Z args.github_branch, 2025-07-17T06:33:20.4003100Z args.eligible_experiments, 2025-07-17T06:33:20.4003594Z args.opt_out_experiments, 2025-07-17T06:33:20.4004058Z is_canary, 2025-07-17T06:33:20.4004435Z ) 2025-07-17T06:33:20.4004625Z 2025-07-17T06:33:20.4004803Z except Exception as e: 2025-07-17T06:33:20.4005506Z log.error( 2025-07-17T06:33:20.4006116Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-07-17T06:33:20.4006954Z ) 2025-07-17T06:33:20.4007155Z 2025-07-17T06:33:20.4007455Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-07-17T06:33:20.4007899Z 2025-07-17T06:33:20.4007905Z 2025-07-17T06:33:20.4008076Z if __name__ == "__main__": 2025-07-17T06:33:20.4008475Z main() 2025-07-17T06:33:20.4008666Z 2025-07-17T06:33:20.4097335Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4098156Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-07-17T06:33:20.4126391Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:20.4126846Z env: 2025-07-17T06:33:20.4127431Z GITHUB_TOKEN: *** 2025-07-17T06:33:20.4127825Z ISSUE_NUMBER: 5132 2025-07-17T06:33:20.4128252Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:20.4128712Z ISSUE_OWNER: 2025-07-17T06:33:20.4129106Z CHECK_EXPERIMENTS: 2025-07-17T06:33:20.4129512Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:20.4129934Z PR_NUMBER: 2025-07-17T06:33:20.4130293Z ##[endgroup] 2025-07-17T06:33:20.7725645Z Defaulting to user installation because normal site-packages is not writeable 2025-07-17T06:33:21.4882832Z Collecting urllib3==1.26.18 2025-07-17T06:33:21.5227461Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-07-17T06:33:21.5450443Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 4.3 MB/s eta 0:00:00 2025-07-17T06:33:21.5638585Z Collecting PyGithub==2.3.0 2025-07-17T06:33:21.5684228Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-07-17T06:33:21.6125539Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-07-17T06:33:21.6155189Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl.metadata (8.6 kB) 2025-07-17T06:33:21.6201084Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-07-17T06:33:21.6218068Z Requirement already satisfied: pyjwt>=2.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (2.7.0) 2025-07-17T06:33:21.6232295Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-07-17T06:33:21.6479954Z Collecting Deprecated (from PyGithub==2.3.0) 2025-07-17T06:33:21.6512226Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-07-17T06:33:21.6737276Z Requirement already satisfied: cryptography>=3.4.0 in /usr/lib/python3/dist-packages (from pyjwt[crypto]>=2.4.0->PyGithub==2.3.0) (41.0.7) 2025-07-17T06:33:21.7782019Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.7813916Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (1.5 kB) 2025-07-17T06:33:21.8834056Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-07-17T06:33:21.8867239Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.4 kB) 2025-07-17T06:33:21.9039587Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-07-17T06:33:21.9070963Z Downloading pycparser-2.22-py3-none-any.whl.metadata (943 bytes) 2025-07-17T06:33:21.9292049Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-07-17T06:33:21.9362156Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 26.3 MB/s eta 0:00:00 2025-07-17T06:33:21.9438245Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-07-17T06:33:21.9496107Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 88.3 MB/s eta 0:00:00 2025-07-17T06:33:21.9526442Z Downloading PyNaCl-1.5.0-cp36-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (856 kB) 2025-07-17T06:33:21.9611714Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 856.7/856.7 kB 127.9 MB/s eta 0:00:00 2025-07-17T06:33:21.9644038Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-07-17T06:33:21.9698339Z Downloading cffi-1.17.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (479 kB) 2025-07-17T06:33:21.9762904Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 479.4/479.4 kB 101.9 MB/s eta 0:00:00 2025-07-17T06:33:21.9796183Z Downloading wrapt-1.17.2-cp312-cp312-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (89 kB) 2025-07-17T06:33:21.9837031Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.2/89.2 kB 32.7 MB/s eta 0:00:00 2025-07-17T06:33:21.9867926Z Downloading pycparser-2.22-py3-none-any.whl (117 kB) 2025-07-17T06:33:21.9909433Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.6/117.6 kB 41.4 MB/s eta 0:00:00 2025-07-17T06:33:22.2756012Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-07-17T06:33:22.8193199Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-1.17.1 pycparser-2.22 pynacl-1.5.0 urllib3-1.26.18 wrapt-1.17.2 2025-07-17T06:33:22.9127714Z ##[group]Run curr_branch="main" 2025-07-17T06:33:22.9128117Z curr_branch="main" 2025-07-17T06:33:22.9128386Z curr_ref_type="branch" 2025-07-17T06:33:22.9128684Z echo "Current branch is '$curr_branch'" 2025-07-17T06:33:22.9128990Z  2025-07-17T06:33:22.9129227Z python3 runner_determinator.py \ 2025-07-17T06:33:22.9129546Z  --github-token "$GITHUB_TOKEN" \ 2025-07-17T06:33:22.9129869Z  --github-issue "$ISSUE_NUMBER" \ 2025-07-17T06:33:22.9130176Z  --github-branch "$curr_branch" \ 2025-07-17T06:33:22.9130481Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-07-17T06:33:22.9130809Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-07-17T06:33:22.9131129Z  --github-ref-type "$curr_ref_type" \ 2025-07-17T06:33:22.9131446Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-07-17T06:33:22.9131799Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-07-17T06:33:22.9132240Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-07-17T06:33:22.9132581Z  --pr-number "${PR_NUMBER}" 2025-07-17T06:33:22.9161868Z shell: /usr/bin/bash -e {0} 2025-07-17T06:33:22.9162140Z env: 2025-07-17T06:33:22.9162728Z GITHUB_TOKEN: *** 2025-07-17T06:33:22.9162972Z ISSUE_NUMBER: 5132 2025-07-17T06:33:22.9163219Z TRIGGERING_ACTOR: pytorchmergebot 2025-07-17T06:33:22.9163486Z ISSUE_OWNER: 2025-07-17T06:33:22.9163711Z CHECK_EXPERIMENTS: 2025-07-17T06:33:22.9163939Z OPT_OUT_EXPERIMENTS: 2025-07-17T06:33:22.9164169Z PR_NUMBER: 2025-07-17T06:33:22.9164383Z ##[endgroup] 2025-07-17T06:33:22.9214192Z Current branch is 'main' 2025-07-17T06:33:24.2993731Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-07-17T06:33:24.2994869Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-07-17T06:33:24.2996130Z INFO : Setting output: label-type='' 2025-07-17T06:33:24.3323500Z Evaluate and set job outputs 2025-07-17T06:33:24.3330775Z Cleaning up orphan processes