2025-11-03T15:43:06.2282636Z Current runner version: '2.329.0' 2025-11-03T15:43:06.2306542Z ##[group]Runner Image Provisioner 2025-11-03T15:43:06.2307388Z Hosted Compute Agent 2025-11-03T15:43:06.2308046Z Version: 20251016.436 2025-11-03T15:43:06.2308630Z Commit: 8ab8ac8bfd662a3739dab9fe09456aba92132568 2025-11-03T15:43:06.2309352Z Build Date: 2025-10-15T20:44:12Z 2025-11-03T15:43:06.2309968Z ##[endgroup] 2025-11-03T15:43:06.2310558Z ##[group]Operating System 2025-11-03T15:43:06.2311102Z Ubuntu 2025-11-03T15:43:06.2311629Z 24.04.3 2025-11-03T15:43:06.2312119Z LTS 2025-11-03T15:43:06.2312550Z ##[endgroup] 2025-11-03T15:43:06.2313084Z ##[group]Runner Image 2025-11-03T15:43:06.2313665Z Image: ubuntu-24.04 2025-11-03T15:43:06.2314204Z Version: 20251030.96.2 2025-11-03T15:43:06.2315360Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251030.96/images/ubuntu/Ubuntu2404-Readme.md 2025-11-03T15:43:06.2317032Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251030.96 2025-11-03T15:43:06.2318087Z ##[endgroup] 2025-11-03T15:43:06.2319232Z ##[group]GITHUB_TOKEN Permissions 2025-11-03T15:43:06.2321455Z Contents: read 2025-11-03T15:43:06.2322183Z Metadata: read 2025-11-03T15:43:06.2322716Z Packages: read 2025-11-03T15:43:06.2323195Z ##[endgroup] 2025-11-03T15:43:06.2325717Z Secret source: Actions 2025-11-03T15:43:06.2326733Z Prepare workflow directory 2025-11-03T15:43:06.2839507Z Prepare all required actions 2025-11-03T15:43:06.2898201Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (3f6538febd727b782e6e13cfd026a309fb14351d) 2025-11-03T15:43:06.2904188Z ##[group] Inputs 2025-11-03T15:43:06.2904794Z check_experiments: 2025-11-03T15:43:06.2905586Z opt_out_experiments: 2025-11-03T15:43:06.2906284Z triggering_actor: pytorchmergebot 2025-11-03T15:43:06.2906888Z issue_owner: 2025-11-03T15:43:06.2907469Z curr_branch: main 2025-11-03T15:43:06.2908198Z curr_ref_type: branch 2025-11-03T15:43:06.2908832Z issue_number: 5132 2025-11-03T15:43:06.2909386Z ##[endgroup] 2025-11-03T15:43:06.2910107Z Complete job name: get-label-type / runner-determinator 2025-11-03T15:43:06.3500110Z ##[group]Run cat < runner_determinator.py 2025-11-03T15:43:06.3502441Z cat < runner_determinator.py 2025-11-03T15:43:06.3503141Z # flake8: noqa: G004 2025-11-03T15:43:06.3503660Z  2025-11-03T15:43:06.3504502Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:06.3505795Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:06.3506750Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:06.3507577Z  2025-11-03T15:43:06.3508040Z """ 2025-11-03T15:43:06.3508765Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:06.3509875Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:06.3511047Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:06.3512077Z of which runners should be used to run which job. 2025-11-03T15:43:06.3512745Z  2025-11-03T15:43:06.3513457Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:06.3514544Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:06.3515961Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:06.3516829Z list, defined. 2025-11-03T15:43:06.3517507Z  2025-11-03T15:43:06.3518224Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:06.3519282Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:06.3520338Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:06.3521348Z  2025-11-03T15:43:06.3522047Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:06.3523160Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:06.3524031Z experiments which the user could be opted in to. 2025-11-03T15:43:06.3524697Z  2025-11-03T15:43:06.3525447Z The user list has the following rules: 2025-11-03T15:43:06.3526128Z  2025-11-03T15:43:06.3526756Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:06.3527783Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:06.3528705Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:06.3529355Z  2025-11-03T15:43:06.3529883Z Example config: 2025-11-03T15:43:06.3530542Z  # A list of experiments that can be opted into. 2025-11-03T15:43:06.3531312Z  # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:06.3532143Z  # Expected syntax is: 2025-11-03T15:43:06.3532933Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:06.3534020Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:06.3535162Z  2025-11-03T15:43:06.3535670Z  experiments: 2025-11-03T15:43:06.3536188Z  lf: 2025-11-03T15:43:06.3536749Z  rollout_percent: 25 2025-11-03T15:43:06.3537363Z  all_branches: false 2025-11-03T15:43:06.3537928Z  default: true 2025-11-03T15:43:06.3538547Z  --- 2025-11-03T15:43:06.3539024Z  2025-11-03T15:43:06.3539465Z  # Opt-ins: 2025-11-03T15:43:06.3540276Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:06.3541437Z  # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:06.3542371Z  # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:06.3543212Z  # Experiments should be from the above list. 2025-11-03T15:43:06.3543903Z  2025-11-03T15:43:06.3544406Z  @User1,-lf,split_build 2025-11-03T15:43:06.3545152Z  @User2,lf 2025-11-03T15:43:06.3545711Z  @User3,split_build 2025-11-03T15:43:06.3546252Z """ 2025-11-03T15:43:06.3546799Z  2025-11-03T15:43:06.3547303Z import json 2025-11-03T15:43:06.3547827Z import logging 2025-11-03T15:43:06.3548485Z import os 2025-11-03T15:43:06.3548968Z import random 2025-11-03T15:43:06.3549484Z import re 2025-11-03T15:43:06.3550026Z import sys 2025-11-03T15:43:06.3550622Z from argparse import ArgumentParser 2025-11-03T15:43:06.3551302Z from collections.abc import Iterable 2025-11-03T15:43:06.3552295Z from functools import cache 2025-11-03T15:43:06.3552927Z from logging import LogRecord 2025-11-03T15:43:06.3553557Z from typing import Any, NamedTuple 2025-11-03T15:43:06.3554320Z from urllib.request import Request, urlopen 2025-11-03T15:43:06.3555216Z  2025-11-03T15:43:06.3555767Z import yaml 2025-11-03T15:43:06.3556381Z from github import Auth, Github 2025-11-03T15:43:06.3557012Z from github.Issue import Issue 2025-11-03T15:43:06.3557627Z  2025-11-03T15:43:06.3558187Z  2025-11-03T15:43:06.3558771Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:06.3559600Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:06.3560694Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:06.3561782Z  2025-11-03T15:43:06.3562316Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:06.3563144Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:06.3563788Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:06.3564504Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:06.3565287Z  2025-11-03T15:43:06.3565839Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:06.3566452Z  2025-11-03T15:43:06.3567012Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:06.3567633Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:06.3568180Z  2025-11-03T15:43:06.3568714Z  2025-11-03T15:43:06.3569170Z class Experiment(NamedTuple): 2025-11-03T15:43:06.3569803Z  rollout_perc: float = ( 2025-11-03T15:43:06.3570643Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:06.3571497Z  ) 2025-11-03T15:43:06.3572012Z  all_branches: bool = ( 2025-11-03T15:43:06.3572867Z  False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:06.3573693Z  ) 2025-11-03T15:43:06.3574159Z  default: bool = ( 2025-11-03T15:43:06.3575175Z  True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:06.3576052Z  ) 2025-11-03T15:43:06.3576501Z  2025-11-03T15:43:06.3577040Z  # Add more fields as needed 2025-11-03T15:43:06.3577630Z  2025-11-03T15:43:06.3578107Z  2025-11-03T15:43:06.3578585Z class Settings(NamedTuple): 2025-11-03T15:43:06.3579220Z  """ 2025-11-03T15:43:06.3579802Z  Settings for the experiments that can be opted into. 2025-11-03T15:43:06.3580543Z  """ 2025-11-03T15:43:06.3581034Z  2025-11-03T15:43:06.3581534Z  experiments: dict[str, Experiment] = {} 2025-11-03T15:43:06.3582258Z  2025-11-03T15:43:06.3582843Z  2025-11-03T15:43:06.3583391Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:06.3584130Z  """Color codes the log messages based on the log level""" 2025-11-03T15:43:06.3585040Z  2025-11-03T15:43:06.3585519Z  COLORS = { 2025-11-03T15:43:06.3586077Z  "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:06.3586802Z  "ERROR": "\033[31m", # Red 2025-11-03T15:43:06.3587407Z  "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:06.3588081Z  "INFO": "\033[0m", # Reset 2025-11-03T15:43:06.3588741Z  "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:06.3589344Z  } 2025-11-03T15:43:06.3589901Z  2025-11-03T15:43:06.3590431Z  def format(self, record: LogRecord) -> str: 2025-11-03T15:43:06.3591335Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:06.3592215Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:06.3592999Z  return super().format(record) 2025-11-03T15:43:06.3593623Z  2025-11-03T15:43:06.3594101Z  2025-11-03T15:43:06.3594666Z handler = logging.StreamHandler() 2025-11-03T15:43:06.3595860Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:06.3596846Z  2025-11-03T15:43:06.3597421Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:06.3598153Z log.addHandler(handler) 2025-11-03T15:43:06.3598758Z log.setLevel(logging.INFO) 2025-11-03T15:43:06.3599409Z  2025-11-03T15:43:06.3599853Z  2025-11-03T15:43:06.3600383Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:06.3601142Z  """ 2025-11-03T15:43:06.3601773Z  Defines outputs of the github action that invokes this script 2025-11-03T15:43:06.3602727Z  """ 2025-11-03T15:43:06.3603273Z  if not GITHUB_OUTPUT: 2025-11-03T15:43:06.3604549Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:06.3606089Z  log.warning( 2025-11-03T15:43:06.3607089Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:06.3608185Z  ) 2025-11-03T15:43:06.3608711Z  print(f"::set-output name={key}::{value}") 2025-11-03T15:43:06.3609451Z  return 2025-11-03T15:43:06.3609966Z  2025-11-03T15:43:06.3610421Z  with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:06.3611197Z  log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:06.3611868Z  f.write(f"{key}={value}\n") 2025-11-03T15:43:06.3612510Z  2025-11-03T15:43:06.3613028Z  2025-11-03T15:43:06.3613666Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:06.3614412Z  return frozenset( 2025-11-03T15:43:06.3688041Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:06.3689301Z  ) 2025-11-03T15:43:06.3689984Z  2025-11-03T15:43:06.3690592Z  2025-11-03T15:43:06.3691306Z def parse_args() -> Any: 2025-11-03T15:43:06.3692278Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:06.3693254Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:06.3694068Z  parser.add_argument( 2025-11-03T15:43:06.3694590Z  "--github-issue-repo", 2025-11-03T15:43:06.3695455Z  type=str, 2025-11-03T15:43:06.3696002Z  required=False, 2025-11-03T15:43:06.3696725Z  default="pytorch/test-infra", 2025-11-03T15:43:06.3697337Z  help="GitHub repo to get the issue", 2025-11-03T15:43:06.3697889Z  ) 2025-11-03T15:43:06.3698302Z  parser.add_argument( 2025-11-03T15:43:06.3698813Z  "--github-repo", 2025-11-03T15:43:06.3699321Z  type=str, 2025-11-03T15:43:06.3699789Z  required=True, 2025-11-03T15:43:06.3700333Z  help="GitHub repo where CI is running", 2025-11-03T15:43:06.3700886Z  ) 2025-11-03T15:43:06.3701309Z  parser.add_argument( 2025-11-03T15:43:06.3701988Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:06.3702688Z  ) 2025-11-03T15:43:06.3703094Z  parser.add_argument( 2025-11-03T15:43:06.3703812Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:06.3704530Z  ) 2025-11-03T15:43:06.3705493Z  parser.add_argument( 2025-11-03T15:43:06.3706249Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:06.3706990Z  ) 2025-11-03T15:43:06.3707404Z  parser.add_argument( 2025-11-03T15:43:06.3708133Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:06.3708897Z  ) 2025-11-03T15:43:06.3709301Z  parser.add_argument( 2025-11-03T15:43:06.3709807Z  "--github-ref-type", 2025-11-03T15:43:06.3710313Z  type=str, 2025-11-03T15:43:06.3710776Z  required=True, 2025-11-03T15:43:06.3711333Z  help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:06.3711910Z  ) 2025-11-03T15:43:06.3712313Z  parser.add_argument( 2025-11-03T15:43:06.3713020Z  "--eligible-experiments", 2025-11-03T15:43:06.3713597Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.3714152Z  required=False, 2025-11-03T15:43:06.3714663Z  default="", 2025-11-03T15:43:06.3715896Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:06.3716897Z  ) 2025-11-03T15:43:06.3717315Z  parser.add_argument( 2025-11-03T15:43:06.3717847Z  "--opt-out-experiments", 2025-11-03T15:43:06.3718407Z  type=_str_comma_separated_to_set, 2025-11-03T15:43:06.3718955Z  required=False, 2025-11-03T15:43:06.3719460Z  default="", 2025-11-03T15:43:06.3719913Z  help=( 2025-11-03T15:43:06.3720649Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:06.3721826Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:06.3722693Z  ), 2025-11-03T15:43:06.3723097Z  ) 2025-11-03T15:43:06.3723494Z  parser.add_argument( 2025-11-03T15:43:06.3724014Z  "--pr-number", 2025-11-03T15:43:06.3724482Z  type=str, 2025-11-03T15:43:06.3725515Z  required=False, 2025-11-03T15:43:06.3726015Z  default="", 2025-11-03T15:43:06.3726567Z  help="the optional PR number where this is run", 2025-11-03T15:43:06.3727159Z  ) 2025-11-03T15:43:06.3727553Z  2025-11-03T15:43:06.3727956Z  return parser.parse_args() 2025-11-03T15:43:06.3728448Z  2025-11-03T15:43:06.3728817Z  2025-11-03T15:43:06.3729449Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.3730414Z  auth = Auth.Token(github_token) 2025-11-03T15:43:06.3730966Z  return Github(auth=auth) 2025-11-03T15:43:06.3731462Z  2025-11-03T15:43:06.3731819Z  2025-11-03T15:43:06.3732494Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.3733335Z  repo = gh.get_repo(repo) 2025-11-03T15:43:06.3733902Z  return repo.get_issue(number=issue_num) 2025-11-03T15:43:06.3734460Z  2025-11-03T15:43:06.3734810Z  2025-11-03T15:43:06.3735438Z def get_potential_pr_author( 2025-11-03T15:43:06.3736148Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:06.3736868Z ) -> str: 2025-11-03T15:43:06.3737446Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:06.3738334Z  # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:06.3739152Z  # embedded in the tag name: ciflow// 2025-11-03T15:43:06.3739748Z  2025-11-03T15:43:06.3740161Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.3740687Z  2025-11-03T15:43:06.3741181Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:06.3741859Z  split_tag = ref_name.split("/") 2025-11-03T15:43:06.3742392Z  if ( 2025-11-03T15:43:06.3742830Z  len(split_tag) == 3 2025-11-03T15:43:06.3743363Z  and split_tag[0] == "ciflow" 2025-11-03T15:43:06.3743939Z  and split_tag[2].isnumeric() 2025-11-03T15:43:06.3744517Z  ): 2025-11-03T15:43:06.3745057Z  pr_number = split_tag[2] 2025-11-03T15:43:06.3745708Z  try: 2025-11-03T15:43:06.3746201Z  repository = gh.get_repo(repo) 2025-11-03T15:43:06.3747038Z  pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:06.3747688Z  except Exception as e: 2025-11-03T15:43:06.3748266Z  raise Exception( # noqa: TRY002 2025-11-03T15:43:06.3748976Z  f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:06.3749690Z  ) from e 2025-11-03T15:43:06.3750299Z  return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:06.3751046Z  # In all other cases, return the original input username 2025-11-03T15:43:06.3751665Z  return username 2025-11-03T15:43:06.3752103Z  2025-11-03T15:43:06.3752458Z  2025-11-03T15:43:06.3752897Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:06.3753461Z  """ 2025-11-03T15:43:06.3754168Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:06.3755111Z  """ 2025-11-03T15:43:06.3755734Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:06.3756416Z  2025-11-03T15:43:06.3756787Z  2025-11-03T15:43:06.3757190Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:06.3757714Z  try: 2025-11-03T15:43:06.3758162Z  data = yaml.safe_load(yaml_text) 2025-11-03T15:43:06.3758709Z  return data 2025-11-03T15:43:06.3759189Z  except yaml.YAMLError: 2025-11-03T15:43:06.3759729Z  log.exception("Error loading YAML") 2025-11-03T15:43:06.3760272Z  raise 2025-11-03T15:43:06.3760678Z  2025-11-03T15:43:06.3761030Z  2025-11-03T15:43:06.3761680Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:06.3762450Z  """ 2025-11-03T15:43:06.3763243Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:06.3764026Z  2025-11-03T15:43:06.3764601Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.3765513Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.3766096Z  2025-11-03T15:43:06.3766688Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:06.3767414Z  """ 2025-11-03T15:43:06.3767916Z  rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:06.3768544Z  if len(rollout_state_parts) >= 2: 2025-11-03T15:43:06.3769197Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:06.3769814Z  else: 2025-11-03T15:43:06.3770246Z  return "", rollout_state 2025-11-03T15:43:06.3770761Z  2025-11-03T15:43:06.3771112Z  2025-11-03T15:43:06.3771531Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:06.3772062Z  """ 2025-11-03T15:43:06.3772631Z  Dictionary of users with a list of features they have opted into 2025-11-03T15:43:06.3773298Z  """ 2025-11-03T15:43:06.3773685Z  2025-11-03T15:43:06.3774037Z  2025-11-03T15:43:06.3774592Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:06.3775487Z  """ 2025-11-03T15:43:06.3776259Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:06.3777118Z  2025-11-03T15:43:06.3777942Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:06.3778966Z  - Example line: "@User1,lf,split_build" 2025-11-03T15:43:06.3779832Z  - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:06.3780481Z  2025-11-03T15:43:06.3780832Z  2025-11-03T15:43:06.3781196Z  """ 2025-11-03T15:43:06.3781604Z  optins = UserOptins() 2025-11-03T15:43:06.3782148Z  for user in user_optin_text.split("\n"): 2025-11-03T15:43:06.3782747Z  user = user.strip("\r\n\t -") 2025-11-03T15:43:06.3783332Z  if not user or not user.startswith("@"): 2025-11-03T15:43:06.3783920Z  # Not a valid user. Skip 2025-11-03T15:43:06.3784434Z  continue 2025-11-03T15:43:06.3784866Z  2025-11-03T15:43:06.3785480Z  if user: 2025-11-03T15:43:06.3785975Z  usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:06.3786705Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:06.3787366Z  2025-11-03T15:43:06.3787735Z  return optins 2025-11-03T15:43:06.3788164Z  2025-11-03T15:43:06.3788508Z  2025-11-03T15:43:06.3789025Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:06.3789665Z  """ 2025-11-03T15:43:06.3790104Z  Check if the experiment name is valid. 2025-11-03T15:43:06.3790647Z  A valid name: 2025-11-03T15:43:06.3791352Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:06.3792339Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:06.3793085Z  - Cannot contain spaces 2025-11-03T15:43:06.3793583Z  """ 2025-11-03T15:43:06.3793961Z  2025-11-03T15:43:06.3794460Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:06.3795335Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:06.3796101Z  2025-11-03T15:43:06.3796460Z  if valid: 2025-11-03T15:43:06.3796894Z  return True 2025-11-03T15:43:06.3797335Z  2025-11-03T15:43:06.3797700Z  log.error( 2025-11-03T15:43:06.3799177Z  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-11-03T15:43:06.3800712Z  ) 2025-11-03T15:43:06.3801098Z  return False 2025-11-03T15:43:06.3801532Z  2025-11-03T15:43:06.3801883Z  2025-11-03T15:43:06.3802423Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:06.3803093Z  """ 2025-11-03T15:43:06.3803716Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:06.3804451Z  """ 2025-11-03T15:43:06.3804837Z  try: 2025-11-03T15:43:06.3805361Z  if settings_text: 2025-11-03T15:43:06.3806145Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:06.3806943Z  # for easy reading 2025-11-03T15:43:06.3807789Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:06.3808721Z  # the backtick character in shell commands. 2025-11-03T15:43:06.3809362Z  backtick = chr(96) # backtick character 2025-11-03T15:43:06.3810075Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:06.3810762Z  settings = load_yaml(settings_text) 2025-11-03T15:43:06.3811297Z  2025-11-03T15:43:06.3812041Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:06.3812812Z  experiments = {} 2025-11-03T15:43:06.3813289Z  2025-11-03T15:43:06.3813856Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:06.3814674Z  if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:06.3816101Z  # 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-11-03T15:43:06.3817190Z  continue 2025-11-03T15:43:06.3817669Z  2025-11-03T15:43:06.3818042Z  valid_settings = {} 2025-11-03T15:43:06.3818603Z  for setting in exp_settings: 2025-11-03T15:43:06.3819199Z  if setting not in Experiment._fields: 2025-11-03T15:43:06.3819788Z  log.warning( 2025-11-03T15:43:06.3820556Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:06.3821283Z  ) 2025-11-03T15:43:06.3821746Z  else: 2025-11-03T15:43:06.3822302Z  valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:06.3822890Z  2025-11-03T15:43:06.3823375Z  experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:06.3824032Z  return Settings(experiments) 2025-11-03T15:43:06.3824551Z  2025-11-03T15:43:06.3825084Z  except Exception: 2025-11-03T15:43:06.3825704Z  log.exception("Failed to parse settings") 2025-11-03T15:43:06.3826262Z  2025-11-03T15:43:06.3826639Z  return Settings() 2025-11-03T15:43:06.3827071Z  2025-11-03T15:43:06.3827420Z  2025-11-03T15:43:06.3828023Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:06.3828631Z  """ 2025-11-03T15:43:06.3829123Z  Parse settings, if any, from the rollout state. 2025-11-03T15:43:06.3829699Z  2025-11-03T15:43:06.3830251Z  If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.3831038Z  and the text below is the list of opted in users. 2025-11-03T15:43:06.3831602Z  2025-11-03T15:43:06.3832207Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:06.3832951Z  """ 2025-11-03T15:43:06.3833556Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.3834347Z  return parse_settings_from_text(settings_text) 2025-11-03T15:43:06.3835054Z  2025-11-03T15:43:06.3835400Z  2025-11-03T15:43:06.3835872Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:06.3836461Z  """ 2025-11-03T15:43:06.3836906Z  Parse users from the rollout state. 2025-11-03T15:43:06.3837450Z  2025-11-03T15:43:06.3837791Z  """ 2025-11-03T15:43:06.3838365Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.3839150Z  return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:06.3839715Z  2025-11-03T15:43:06.3840060Z  2025-11-03T15:43:06.3840701Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.3841470Z  """ 2025-11-03T15:43:06.3841928Z  Check if a user is opted into an experiment 2025-11-03T15:43:06.3842482Z  """ 2025-11-03T15:43:06.3842976Z  return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:06.3843699Z  2025-11-03T15:43:06.3844073Z  2025-11-03T15:43:06.3844721Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.3845588Z  """ 2025-11-03T15:43:06.3846091Z  Check if a user explicitly opted out of an experiment 2025-11-03T15:43:06.3846684Z  """ 2025-11-03T15:43:06.3847224Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:06.3847970Z  experiment_optout = "-" + experiment_name 2025-11-03T15:43:06.3848634Z  if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:06.3849247Z  return False 2025-11-03T15:43:06.3849680Z  2025-11-03T15:43:06.3850160Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:06.3850806Z  log.warning( 2025-11-03T15:43:06.3851665Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:06.3852552Z  ) 2025-11-03T15:43:06.3852958Z  2025-11-03T15:43:06.3853325Z  return True 2025-11-03T15:43:06.3853759Z  2025-11-03T15:43:06.3854136Z  2025-11-03T15:43:06.3854503Z def get_runner_prefix( 2025-11-03T15:43:06.3855184Z  rollout_state: str, 2025-11-03T15:43:06.3855712Z  workflow_requestors: Iterable[str], 2025-11-03T15:43:06.3856268Z  branch: str, 2025-11-03T15:43:06.3856818Z  eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.3857529Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.3858137Z  is_canary: bool = False, 2025-11-03T15:43:06.3858624Z ) -> str: 2025-11-03T15:43:06.3859092Z  settings = parse_settings(rollout_state) 2025-11-03T15:43:06.3859704Z  user_optins = parse_users(rollout_state) 2025-11-03T15:43:06.3860253Z  2025-11-03T15:43:06.3860748Z  fleet_prefix = "" 2025-11-03T15:43:06.3861214Z  prefixes = [] 2025-11-03T15:43:06.3861945Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:06.3862940Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:06.3863699Z  log.info( 2025-11-03T15:43:06.3864437Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:06.3865450Z  ) 2025-11-03T15:43:06.3865884Z  continue 2025-11-03T15:43:06.3866318Z  2025-11-03T15:43:06.3866714Z  if opt_out_experiments: 2025-11-03T15:43:06.3867302Z  if experiment_name in opt_out_experiments: 2025-11-03T15:43:06.3867971Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:06.3868596Z  log.info( 2025-11-03T15:43:06.3869570Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:06.3870569Z  ) 2025-11-03T15:43:06.3871003Z  continue 2025-11-03T15:43:06.3871466Z  2025-11-03T15:43:06.3871859Z  if eligible_experiments: 2025-11-03T15:43:06.3872481Z  if experiment_name not in eligible_experiments: 2025-11-03T15:43:06.3873157Z  exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:06.3873717Z  log.info( 2025-11-03T15:43:06.3874542Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:06.3875522Z  ) 2025-11-03T15:43:06.3876120Z  continue 2025-11-03T15:43:06.3876660Z  elif not experiment_settings.default: 2025-11-03T15:43:06.3877213Z  log.info( 2025-11-03T15:43:06.3877934Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:06.3878693Z  ) 2025-11-03T15:43:06.3879111Z  continue 2025-11-03T15:43:06.3879554Z  2025-11-03T15:43:06.3880042Z  # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:06.3880682Z  opted_out_users = [ 2025-11-03T15:43:06.3881191Z  requestor 2025-11-03T15:43:06.3881713Z  for requestor in workflow_requestors 2025-11-03T15:43:06.3882422Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.3883061Z  ] 2025-11-03T15:43:06.3883476Z  2025-11-03T15:43:06.3883863Z  if opted_out_users: 2025-11-03T15:43:06.3884355Z  log.info( 2025-11-03T15:43:06.3885138Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:06.3885878Z  ) 2025-11-03T15:43:06.3886290Z  continue 2025-11-03T15:43:06.3886752Z  2025-11-03T15:43:06.3887228Z  # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:06.3887883Z  opted_in_users = [ 2025-11-03T15:43:06.3888382Z  requestor 2025-11-03T15:43:06.3888890Z  for requestor in workflow_requestors 2025-11-03T15:43:06.3889585Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.3890211Z  ] 2025-11-03T15:43:06.3890609Z  2025-11-03T15:43:06.3890972Z  enabled = False 2025-11-03T15:43:06.3891470Z  if opted_in_users: 2025-11-03T15:43:06.3892072Z  log.info( 2025-11-03T15:43:06.3892728Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:06.3893427Z  ) 2025-11-03T15:43:06.3893848Z  enabled = True 2025-11-03T15:43:06.3894335Z  2025-11-03T15:43:06.3894764Z  elif experiment_settings.rollout_perc: 2025-11-03T15:43:06.3895862Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:06.3896816Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:06.3897476Z  log.info( 2025-11-03T15:43:06.3898384Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:06.3899315Z  ) 2025-11-03T15:43:06.3899772Z  enabled = True 2025-11-03T15:43:06.3900265Z  2025-11-03T15:43:06.3900629Z  if enabled: 2025-11-03T15:43:06.3901118Z  label = experiment_name 2025-11-03T15:43:06.3901705Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:06.3902551Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:06.3903441Z  # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:06.3904227Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:06.3905050Z  if is_canary: 2025-11-03T15:43:06.3905690Z  label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:06.3906294Z  fleet_prefix = label 2025-11-03T15:43:06.3906951Z  else: 2025-11-03T15:43:06.3907433Z  prefixes.append(label) 2025-11-03T15:43:06.3907943Z  2025-11-03T15:43:06.3908319Z  if len(prefixes) > 1: 2025-11-03T15:43:06.3908803Z  log.error( 2025-11-03T15:43:06.3909900Z  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-11-03T15:43:06.3911020Z  ) 2025-11-03T15:43:06.3911438Z  prefixes = prefixes[:1] 2025-11-03T15:43:06.3911958Z  2025-11-03T15:43:06.3912346Z  # Fleet always comes first 2025-11-03T15:43:06.3912858Z  if fleet_prefix: 2025-11-03T15:43:06.3913352Z  prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:06.3913886Z  2025-11-03T15:43:06.3914372Z  return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:06.3915076Z  2025-11-03T15:43:06.3915429Z  2025-11-03T15:43:06.3916077Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:06.3916881Z  """ 2025-11-03T15:43:06.3917494Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:06.3918220Z  2025-11-03T15:43:06.3918810Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:06.3919540Z  """ 2025-11-03T15:43:06.3919981Z  gh = get_gh_client(github_token) 2025-11-03T15:43:06.3920574Z  issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:06.3921247Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:06.3921848Z  2025-11-03T15:43:06.3922206Z  2025-11-03T15:43:06.3922834Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:06.3923730Z  for _ in range(num_retries): 2025-11-03T15:43:06.3924241Z  try: 2025-11-03T15:43:06.3924715Z  req = Request(url=url, headers=headers) 2025-11-03T15:43:06.3925518Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:06.3926202Z  return json.loads(content) 2025-11-03T15:43:06.3926740Z  except Exception as e: 2025-11-03T15:43:06.3927322Z  log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:06.3927913Z  2025-11-03T15:43:06.3928494Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:06.3929222Z  return {} 2025-11-03T15:43:06.3929636Z  2025-11-03T15:43:06.3929978Z  2025-11-03T15:43:06.3930339Z @cache 2025-11-03T15:43:06.3931001Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:06.3931777Z  """ 2025-11-03T15:43:06.3932202Z  Dynamically get PR information 2025-11-03T15:43:06.3932707Z  """ 2025-11-03T15:43:06.3933237Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:06.3933877Z  headers = { 2025-11-03T15:43:06.3934458Z  "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:06.3935350Z  "Authorization": f"token {github_token}", 2025-11-03T15:43:06.3935996Z  } 2025-11-03T15:43:06.3936454Z  json_response: dict[str, Any] = download_json( 2025-11-03T15:43:06.3937082Z  url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:06.3937640Z  headers=headers, 2025-11-03T15:43:06.3938094Z  ) 2025-11-03T15:43:06.3938462Z  2025-11-03T15:43:06.3938827Z  if not json_response: 2025-11-03T15:43:06.3939587Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:06.3940231Z  return {} 2025-11-03T15:43:06.3940661Z  2025-11-03T15:43:06.3941030Z  return json_response 2025-11-03T15:43:06.3941489Z  2025-11-03T15:43:06.3941867Z  2025-11-03T15:43:06.3942464Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:06.3943401Z  """ 2025-11-03T15:43:06.3943965Z  Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:06.3944665Z  """ 2025-11-03T15:43:06.3945411Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:06.3946049Z  return { 2025-11-03T15:43:06.3946684Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:06.3947377Z  } 2025-11-03T15:43:06.3947744Z  2025-11-03T15:43:06.3948094Z  2025-11-03T15:43:06.3948463Z def main() -> None: 2025-11-03T15:43:06.3948928Z  args = parse_args() 2025-11-03T15:43:06.3949391Z  2025-11-03T15:43:06.3949822Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:06.3950415Z  2025-11-03T15:43:06.3950931Z  # Check if the PR is opt-out 2025-11-03T15:43:06.3951451Z  if args.pr_number: 2025-11-03T15:43:06.3952165Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:06.3952927Z  if OPT_OUT_LABEL in labels: 2025-11-03T15:43:06.3953493Z  log.info( 2025-11-03T15:43:06.3954477Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:06.3955396Z  ) 2025-11-03T15:43:06.3956006Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.3956710Z  sys.exit() 2025-11-03T15:43:06.3957306Z  2025-11-03T15:43:06.3957676Z  try: 2025-11-03T15:43:06.3958149Z  rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:06.3958891Z  args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:06.3959555Z  ) 2025-11-03T15:43:06.3959938Z  2025-11-03T15:43:06.3960344Z  username = get_potential_pr_author( 2025-11-03T15:43:06.3960898Z  args.github_token, 2025-11-03T15:43:06.3961407Z  args.github_repo, 2025-11-03T15:43:06.3961919Z  args.github_actor, 2025-11-03T15:43:06.3962435Z  args.github_ref_type, 2025-11-03T15:43:06.3962967Z  args.github_branch, 2025-11-03T15:43:06.3963455Z  ) 2025-11-03T15:43:06.3963835Z  2025-11-03T15:43:06.3964339Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:06.3965070Z  2025-11-03T15:43:06.3965499Z  runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:06.3966059Z  rollout_state, 2025-11-03T15:43:06.3966597Z  (args.github_issue_owner, username), 2025-11-03T15:43:06.3967154Z  args.github_branch, 2025-11-03T15:43:06.3967686Z  args.eligible_experiments, 2025-11-03T15:43:06.3968252Z  args.opt_out_experiments, 2025-11-03T15:43:06.3968787Z  is_canary, 2025-11-03T15:43:06.3969237Z  ) 2025-11-03T15:43:06.3969616Z  2025-11-03T15:43:06.3969997Z  except Exception as e: 2025-11-03T15:43:06.3970478Z  log.error( 2025-11-03T15:43:06.3971195Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:06.3972079Z  ) 2025-11-03T15:43:06.3972470Z  2025-11-03T15:43:06.3973018Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.3973676Z  2025-11-03T15:43:06.3974022Z  2025-11-03T15:43:06.3974380Z if __name__ == "__main__": 2025-11-03T15:43:06.3974848Z  main() 2025-11-03T15:43:06.3975455Z  2025-11-03T15:43:06.3975842Z EOF 2025-11-03T15:43:06.3976198Z  2025-11-03T15:43:06.3976577Z cat runner_determinator.py 2025-11-03T15:43:06.4894551Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:06.4895708Z env: 2025-11-03T15:43:06.4896395Z GITHUB_TOKEN: *** 2025-11-03T15:43:06.4896823Z ISSUE_NUMBER: 5132 2025-11-03T15:43:06.4897309Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:06.4897831Z ISSUE_OWNER: 2025-11-03T15:43:06.4898237Z CHECK_EXPERIMENTS: 2025-11-03T15:43:06.4898695Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:06.4899163Z PR_NUMBER: 2025-11-03T15:43:06.4899566Z ##[endgroup] 2025-11-03T15:43:06.5122153Z # flake8: noqa: G004 2025-11-03T15:43:06.5122491Z 2025-11-03T15:43:06.5122921Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-11-03T15:43:06.5123857Z # must be kept in sync. You can do it easily by running the following command: 2025-11-03T15:43:06.5124666Z # python .github/scripts/update_runner_determinator.py 2025-11-03T15:43:06.5125339Z 2025-11-03T15:43:06.5125501Z """ 2025-11-03T15:43:06.5126070Z This runner determinator is used to determine which set of runners to run a 2025-11-03T15:43:06.5126927Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-11-03T15:43:06.5127813Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-11-03T15:43:06.5128603Z of which runners should be used to run which job. 2025-11-03T15:43:06.5128999Z 2025-11-03T15:43:06.5129373Z The configuration has two parts, the settings and a list of opted-in users, 2025-11-03T15:43:06.5130463Z separated by a line containing "---". If the line is not present, the 2025-11-03T15:43:06.5131329Z settings are considered to be empty with only the second part, the user 2025-11-03T15:43:06.5132010Z list, defined. 2025-11-03T15:43:06.5132227Z 2025-11-03T15:43:06.5132587Z The first part is a YAML block that defines the rollout settings. This can be 2025-11-03T15:43:06.5133475Z used to define any settings that are needed to determine which runners to use. 2025-11-03T15:43:06.5134283Z It's fields are defined by the RolloutSettings class below. 2025-11-03T15:43:06.5134716Z 2025-11-03T15:43:06.5135251Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-11-03T15:43:06.5136111Z The user list is also a comma separated list of additional features or 2025-11-03T15:43:06.5136831Z experiments which the user could be opted in to. 2025-11-03T15:43:06.5137226Z 2025-11-03T15:43:06.5137432Z The user list has the following rules: 2025-11-03T15:43:06.5137781Z 2025-11-03T15:43:06.5138097Z - Users are GitHub usernames, which must start with the @ prefix 2025-11-03T15:43:06.5138931Z - Each user is also a comma-separated list of features/experiments to enable 2025-11-03T15:43:06.5139679Z - A "#" prefix opts the user out of all experiments 2025-11-03T15:43:06.5140062Z 2025-11-03T15:43:06.5140240Z Example config: 2025-11-03T15:43:06.5140699Z # A list of experiments that can be opted into. 2025-11-03T15:43:06.5141364Z # This defines the behavior they'll induce when opted into. 2025-11-03T15:43:06.5141983Z # Expected syntax is: 2025-11-03T15:43:06.5142617Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-11-03T15:43:06.5143577Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-11-03T15:43:06.5144183Z 2025-11-03T15:43:06.5144350Z experiments: 2025-11-03T15:43:06.5144735Z lf: 2025-11-03T15:43:06.5145351Z rollout_percent: 25 2025-11-03T15:43:06.5145978Z all_branches: false 2025-11-03T15:43:06.5146432Z default: true 2025-11-03T15:43:06.5146830Z --- 2025-11-03T15:43:06.5147040Z 2025-11-03T15:43:06.5147218Z # Opt-ins: 2025-11-03T15:43:06.5147794Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-11-03T15:43:06.5148643Z # and specifying experiments to enable in a comma-separated list. 2025-11-03T15:43:06.5149417Z # To always opt out of an experiment, prefix it with a "-". 2025-11-03T15:43:06.5150052Z # Experiments should be from the above list. 2025-11-03T15:43:06.5150430Z 2025-11-03T15:43:06.5150606Z @User1,-lf,split_build 2025-11-03T15:43:06.5151028Z @User2,lf 2025-11-03T15:43:06.5151403Z @User3,split_build 2025-11-03T15:43:06.5151802Z """ 2025-11-03T15:43:06.5151988Z 2025-11-03T15:43:06.5152155Z import json 2025-11-03T15:43:06.5152517Z import logging 2025-11-03T15:43:06.5152889Z import os 2025-11-03T15:43:06.5153265Z import random 2025-11-03T15:43:06.5153636Z import re 2025-11-03T15:43:06.5153990Z import sys 2025-11-03T15:43:06.5154380Z from argparse import ArgumentParser 2025-11-03T15:43:06.5155054Z from collections.abc import Iterable 2025-11-03T15:43:06.5155609Z from functools import cache 2025-11-03T15:43:06.5156075Z from logging import LogRecord 2025-11-03T15:43:06.5156551Z from typing import Any, NamedTuple 2025-11-03T15:43:06.5157083Z from urllib.request import Request, urlopen 2025-11-03T15:43:06.5157443Z 2025-11-03T15:43:06.5157612Z import yaml 2025-11-03T15:43:06.5157993Z from github import Auth, Github 2025-11-03T15:43:06.5158505Z from github.Issue import Issue 2025-11-03T15:43:06.5158800Z 2025-11-03T15:43:06.5158806Z 2025-11-03T15:43:06.5159015Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-11-03T15:43:06.5159687Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-11-03T15:43:06.5160531Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-11-03T15:43:06.5161096Z 2025-11-03T15:43:06.5161315Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-11-03T15:43:06.5162013Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-11-03T15:43:06.5162516Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-11-03T15:43:06.5163063Z OPT_OUT_LABEL = "no-runner-experiments" 2025-11-03T15:43:06.5163404Z 2025-11-03T15:43:06.5163600Z SETTING_EXPERIMENTS = "experiments" 2025-11-03T15:43:06.5163933Z 2025-11-03T15:43:06.5164117Z LF_FLEET_EXPERIMENT = "lf" 2025-11-03T15:43:06.5164576Z CANARY_FLEET_SUFFIX = ".c" 2025-11-03T15:43:06.5164858Z 2025-11-03T15:43:06.5164864Z 2025-11-03T15:43:06.5165257Z class Experiment(NamedTuple): 2025-11-03T15:43:06.5165735Z rollout_perc: float = ( 2025-11-03T15:43:06.5166360Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-11-03T15:43:06.5167030Z ) 2025-11-03T15:43:06.5167392Z all_branches: bool = ( 2025-11-03T15:43:06.5168013Z False # If True, the experiment is also enabled on the exception branches 2025-11-03T15:43:06.5168680Z ) 2025-11-03T15:43:06.5169033Z default: bool = ( 2025-11-03T15:43:06.5169586Z True # If True, the experiment is enabled by default for all queries 2025-11-03T15:43:06.5170251Z ) 2025-11-03T15:43:06.5170439Z 2025-11-03T15:43:06.5170622Z # Add more fields as needed 2025-11-03T15:43:06.5170911Z 2025-11-03T15:43:06.5170918Z 2025-11-03T15:43:06.5171097Z class Settings(NamedTuple): 2025-11-03T15:43:06.5171527Z """ 2025-11-03T15:43:06.5171973Z Settings for the experiments that can be opted into. 2025-11-03T15:43:06.5172549Z """ 2025-11-03T15:43:06.5172740Z 2025-11-03T15:43:06.5172942Z experiments: dict[str, Experiment] = {} 2025-11-03T15:43:06.5173295Z 2025-11-03T15:43:06.5173302Z 2025-11-03T15:43:06.5173510Z class ColorFormatter(logging.Formatter): 2025-11-03T15:43:06.5174117Z """Color codes the log messages based on the log level""" 2025-11-03T15:43:06.5174545Z 2025-11-03T15:43:06.5174707Z COLORS = { 2025-11-03T15:43:06.5175288Z "WARNING": "\033[33m", # Yellow 2025-11-03T15:43:06.5175940Z "ERROR": "\033[31m", # Red 2025-11-03T15:43:06.5176447Z "CRITICAL": "\033[31m", # Red 2025-11-03T15:43:06.5176966Z "INFO": "\033[0m", # Reset 2025-11-03T15:43:06.5177441Z "DEBUG": "\033[0m", # Reset 2025-11-03T15:43:06.5177901Z } 2025-11-03T15:43:06.5178086Z 2025-11-03T15:43:06.5178299Z def format(self, record: LogRecord) -> str: 2025-11-03T15:43:06.5179048Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-11-03T15:43:06.5179805Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-11-03T15:43:06.5180384Z return super().format(record) 2025-11-03T15:43:06.5180710Z 2025-11-03T15:43:06.5180717Z 2025-11-03T15:43:06.5180907Z handler = logging.StreamHandler() 2025-11-03T15:43:06.5181600Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-11-03T15:43:06.5182144Z 2025-11-03T15:43:06.5182391Z log = logging.getLogger(os.path.basename(__file__)) 2025-11-03T15:43:06.5182958Z log.addHandler(handler) 2025-11-03T15:43:06.5183399Z log.setLevel(logging.INFO) 2025-11-03T15:43:06.5183680Z 2025-11-03T15:43:06.5183687Z 2025-11-03T15:43:06.5183929Z def set_github_output(key: str, value: str) -> None: 2025-11-03T15:43:06.5184485Z """ 2025-11-03T15:43:06.5185164Z Defines outputs of the github action that invokes this script 2025-11-03T15:43:06.5185799Z """ 2025-11-03T15:43:06.5186162Z if not GITHUB_OUTPUT: 2025-11-03T15:43:06.5187220Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-11-03T15:43:06.5188331Z log.warning( 2025-11-03T15:43:06.5189168Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-11-03T15:43:06.5190086Z ) 2025-11-03T15:43:06.5199924Z print(f"::set-output name={key}::{value}") 2025-11-03T15:43:06.5200533Z return 2025-11-03T15:43:06.5200777Z 2025-11-03T15:43:06.5201151Z with open(GITHUB_OUTPUT, "a") as f: 2025-11-03T15:43:06.5201742Z log.info(f"Setting output: {key}='{value}'") 2025-11-03T15:43:06.5202300Z f.write(f"{key}={value}\n") 2025-11-03T15:43:06.5202617Z 2025-11-03T15:43:06.5202624Z 2025-11-03T15:43:06.5202927Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-11-03T15:43:06.5203557Z return frozenset( 2025-11-03T15:43:06.5204146Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-11-03T15:43:06.5205148Z ) 2025-11-03T15:43:06.5205360Z 2025-11-03T15:43:06.5205367Z 2025-11-03T15:43:06.5205549Z def parse_args() -> Any: 2025-11-03T15:43:06.5206091Z parser = ArgumentParser("Get dynamic rollout settings") 2025-11-03T15:43:06.5206940Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-11-03T15:43:06.5207692Z parser.add_argument( 2025-11-03T15:43:06.5208135Z "--github-issue-repo", 2025-11-03T15:43:06.5208580Z type=str, 2025-11-03T15:43:06.5208985Z required=False, 2025-11-03T15:43:06.5209442Z default="pytorch/test-infra", 2025-11-03T15:43:06.5209984Z help="GitHub repo to get the issue", 2025-11-03T15:43:06.5210480Z ) 2025-11-03T15:43:06.5210848Z parser.add_argument( 2025-11-03T15:43:06.5211287Z "--github-repo", 2025-11-03T15:43:06.5211703Z type=str, 2025-11-03T15:43:06.5212083Z required=True, 2025-11-03T15:43:06.5212534Z help="GitHub repo where CI is running", 2025-11-03T15:43:06.5213044Z ) 2025-11-03T15:43:06.5213401Z parser.add_argument( 2025-11-03T15:43:06.5213988Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-11-03T15:43:06.5214631Z ) 2025-11-03T15:43:06.5215190Z parser.add_argument( 2025-11-03T15:43:06.5215818Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-11-03T15:43:06.5216490Z ) 2025-11-03T15:43:06.5217012Z parser.add_argument( 2025-11-03T15:43:06.5217636Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-11-03T15:43:06.5218316Z ) 2025-11-03T15:43:06.5218694Z parser.add_argument( 2025-11-03T15:43:06.5219340Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-11-03T15:43:06.5220060Z ) 2025-11-03T15:43:06.5220422Z parser.add_argument( 2025-11-03T15:43:06.5220856Z "--github-ref-type", 2025-11-03T15:43:06.5221293Z type=str, 2025-11-03T15:43:06.5221675Z required=True, 2025-11-03T15:43:06.5222301Z help="Current GitHub ref type, branch or tag", 2025-11-03T15:43:06.5222841Z ) 2025-11-03T15:43:06.5223212Z parser.add_argument( 2025-11-03T15:43:06.5223670Z "--eligible-experiments", 2025-11-03T15:43:06.5224163Z type=_str_comma_separated_to_set, 2025-11-03T15:43:06.5224679Z required=False, 2025-11-03T15:43:06.5225303Z default="", 2025-11-03T15:43:06.5226170Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-11-03T15:43:06.5227074Z ) 2025-11-03T15:43:06.5227429Z parser.add_argument( 2025-11-03T15:43:06.5227867Z "--opt-out-experiments", 2025-11-03T15:43:06.5228351Z type=_str_comma_separated_to_set, 2025-11-03T15:43:06.5228876Z required=False, 2025-11-03T15:43:06.5229309Z default="", 2025-11-03T15:43:06.5229688Z help=( 2025-11-03T15:43:06.5230330Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-11-03T15:43:06.5231439Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-11-03T15:43:06.5232239Z ), 2025-11-03T15:43:06.5232615Z ) 2025-11-03T15:43:06.5232985Z parser.add_argument( 2025-11-03T15:43:06.5233409Z "--pr-number", 2025-11-03T15:43:06.5233828Z type=str, 2025-11-03T15:43:06.5234250Z required=False, 2025-11-03T15:43:06.5234662Z default="", 2025-11-03T15:43:06.5235485Z help="the optional PR number where this is run", 2025-11-03T15:43:06.5236069Z ) 2025-11-03T15:43:06.5236274Z 2025-11-03T15:43:06.5236480Z return parser.parse_args() 2025-11-03T15:43:06.5236782Z 2025-11-03T15:43:06.5236789Z 2025-11-03T15:43:06.5237193Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.5237924Z auth = Auth.Token(github_token) 2025-11-03T15:43:06.5238410Z return Github(auth=auth) 2025-11-03T15:43:06.5238690Z 2025-11-03T15:43:06.5238697Z 2025-11-03T15:43:06.5239143Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-11-03T15:43:06.5239915Z repo = gh.get_repo(repo) 2025-11-03T15:43:06.5240402Z return repo.get_issue(number=issue_num) 2025-11-03T15:43:06.5240754Z 2025-11-03T15:43:06.5240760Z 2025-11-03T15:43:06.5240936Z def get_potential_pr_author( 2025-11-03T15:43:06.5241584Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-11-03T15:43:06.5242259Z ) -> str: 2025-11-03T15:43:06.5242754Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-11-03T15:43:06.5243549Z # Fetch the actual username from the original PR. The PR number is 2025-11-03T15:43:06.5244272Z # embedded in the tag name: ciflow// 2025-11-03T15:43:06.5244697Z 2025-11-03T15:43:06.5245078Z gh = get_gh_client(github_token) 2025-11-03T15:43:06.5245412Z 2025-11-03T15:43:06.5245695Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-11-03T15:43:06.5246317Z split_tag = ref_name.split("/") 2025-11-03T15:43:06.5246807Z if ( 2025-11-03T15:43:06.5247175Z len(split_tag) == 3 2025-11-03T15:43:06.5247633Z and split_tag[0] == "ciflow" 2025-11-03T15:43:06.5248140Z and split_tag[2].isnumeric() 2025-11-03T15:43:06.5248622Z ): 2025-11-03T15:43:06.5249134Z pr_number = split_tag[2] 2025-11-03T15:43:06.5249611Z try: 2025-11-03T15:43:06.5297011Z repository = gh.get_repo(repo) 2025-11-03T15:43:06.5298328Z pull = repository.get_pull(number=int(pr_number)) 2025-11-03T15:43:06.5299384Z except Exception as e: 2025-11-03T15:43:06.5300259Z raise Exception( # noqa: TRY002 2025-11-03T15:43:06.5301351Z f"issue with pull request {pr_number} from repo {repository}" 2025-11-03T15:43:06.5302027Z ) from e 2025-11-03T15:43:06.5302566Z return pull.user.login # type: ignore[no-any-return] 2025-11-03T15:43:06.5303266Z # In all other cases, return the original input username 2025-11-03T15:43:06.5303845Z return username 2025-11-03T15:43:06.5304079Z 2025-11-03T15:43:06.5304086Z 2025-11-03T15:43:06.5304305Z def is_exception_branch(branch: str) -> bool: 2025-11-03T15:43:06.5304844Z """ 2025-11-03T15:43:06.5306042Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-11-03T15:43:06.5307326Z """ 2025-11-03T15:43:06.5308169Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-11-03T15:43:06.5308822Z 2025-11-03T15:43:06.5308830Z 2025-11-03T15:43:06.5309031Z def load_yaml(yaml_text: str) -> Any: 2025-11-03T15:43:06.5309517Z try: 2025-11-03T15:43:06.5309889Z data = yaml.safe_load(yaml_text) 2025-11-03T15:43:06.5310385Z return data 2025-11-03T15:43:06.5310791Z except yaml.YAMLError: 2025-11-03T15:43:06.5311267Z log.exception("Error loading YAML") 2025-11-03T15:43:06.5311807Z raise 2025-11-03T15:43:06.5312052Z 2025-11-03T15:43:06.5312061Z 2025-11-03T15:43:06.5312494Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-11-03T15:43:06.5313229Z """ 2025-11-03T15:43:06.5313835Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-11-03T15:43:06.5314430Z 2025-11-03T15:43:06.5315190Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.5316056Z and the text below is the list of opted in users. 2025-11-03T15:43:06.5316464Z 2025-11-03T15:43:06.5316832Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-11-03T15:43:06.5317525Z """ 2025-11-03T15:43:06.5317964Z rollout_state_parts = rollout_state.split("---") 2025-11-03T15:43:06.5318563Z if len(rollout_state_parts) >= 2: 2025-11-03T15:43:06.5319153Z return rollout_state_parts[0], rollout_state_parts[1] 2025-11-03T15:43:06.5319756Z else: 2025-11-03T15:43:06.5320161Z return "", rollout_state 2025-11-03T15:43:06.5320464Z 2025-11-03T15:43:06.5320471Z 2025-11-03T15:43:06.5320667Z class UserOptins(dict[str, list[str]]): 2025-11-03T15:43:06.5321159Z """ 2025-11-03T15:43:06.5321664Z Dictionary of users with a list of features they have opted into 2025-11-03T15:43:06.5322300Z """ 2025-11-03T15:43:06.5322497Z 2025-11-03T15:43:06.5322504Z 2025-11-03T15:43:06.5322842Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-11-03T15:43:06.5323504Z """ 2025-11-03T15:43:06.5324194Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-11-03T15:43:06.5324872Z 2025-11-03T15:43:06.5325692Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-11-03T15:43:06.5326679Z - Example line: "@User1,lf,split_build" 2025-11-03T15:43:06.5327374Z - A "#" prefix indicates the user is opted out of all experiments 2025-11-03T15:43:06.5327850Z 2025-11-03T15:43:06.5327857Z 2025-11-03T15:43:06.5328011Z """ 2025-11-03T15:43:06.5328370Z optins = UserOptins() 2025-11-03T15:43:06.5328854Z for user in user_optin_text.split("\n"): 2025-11-03T15:43:06.5329395Z user = user.strip("\r\n\t -") 2025-11-03T15:43:06.5330077Z if not user or not user.startswith("@"): 2025-11-03T15:43:06.5330623Z # Not a valid user. Skip 2025-11-03T15:43:06.5331088Z continue 2025-11-03T15:43:06.5331324Z 2025-11-03T15:43:06.5331494Z if user: 2025-11-03T15:43:06.5331919Z usr_name = user.split(",")[0].strip("@") 2025-11-03T15:43:06.5332612Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-11-03T15:43:06.5333106Z 2025-11-03T15:43:06.5333270Z return optins 2025-11-03T15:43:06.5333510Z 2025-11-03T15:43:06.5333517Z 2025-11-03T15:43:06.5333800Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-11-03T15:43:06.5334383Z """ 2025-11-03T15:43:06.5334763Z Check if the experiment name is valid. 2025-11-03T15:43:06.5335525Z A valid name: 2025-11-03T15:43:06.5336168Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-11-03T15:43:06.5337095Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-11-03T15:43:06.5337793Z - Cannot contain spaces 2025-11-03T15:43:06.5338240Z """ 2025-11-03T15:43:06.5338429Z 2025-11-03T15:43:06.5338680Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-11-03T15:43:06.5339366Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-11-03T15:43:06.5339792Z 2025-11-03T15:43:06.5339956Z if valid: 2025-11-03T15:43:06.5340322Z return True 2025-11-03T15:43:06.5340552Z 2025-11-03T15:43:06.5340717Z log.error( 2025-11-03T15:43:06.5342133Z 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-11-03T15:43:06.5343714Z ) 2025-11-03T15:43:06.5344056Z return False 2025-11-03T15:43:06.5344283Z 2025-11-03T15:43:06.5344290Z 2025-11-03T15:43:06.5344587Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-11-03T15:43:06.5345786Z """ 2025-11-03T15:43:06.5346527Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-11-03T15:43:06.5347273Z """ 2025-11-03T15:43:06.5347636Z try: 2025-11-03T15:43:06.5347993Z if settings_text: 2025-11-03T15:43:06.5348707Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-11-03T15:43:06.5349475Z # for easy reading 2025-11-03T15:43:06.5350262Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-11-03T15:43:06.5351143Z # the backtick character in shell commands. 2025-11-03T15:43:06.5351761Z backtick = chr(96) # backtick character 2025-11-03T15:43:06.5352409Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-11-03T15:43:06.5353051Z settings = load_yaml(settings_text) 2025-11-03T15:43:06.5353408Z 2025-11-03T15:43:06.5353813Z # For now we just load experiments. We can expand this if/when we add more settings 2025-11-03T15:43:06.5354548Z experiments = {} 2025-11-03T15:43:06.5354838Z 2025-11-03T15:43:06.5355347Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-11-03T15:43:06.5356087Z if not is_valid_experiment_name(exp_name): 2025-11-03T15:43:06.5357215Z # 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-11-03T15:43:06.5358243Z continue 2025-11-03T15:43:06.5358514Z 2025-11-03T15:43:06.5358707Z valid_settings = {} 2025-11-03T15:43:06.5359213Z for setting in exp_settings: 2025-11-03T15:43:06.5359776Z if setting not in Experiment._fields: 2025-11-03T15:43:06.5360346Z log.warning( 2025-11-03T15:43:06.5361027Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-11-03T15:43:06.5361911Z ) 2025-11-03T15:43:06.5362339Z else: 2025-11-03T15:43:06.5362854Z valid_settings[setting] = exp_settings[setting] 2025-11-03T15:43:06.5363262Z 2025-11-03T15:43:06.5363539Z experiments[exp_name] = Experiment(**valid_settings) 2025-11-03T15:43:06.5364158Z return Settings(experiments) 2025-11-03T15:43:06.5364510Z 2025-11-03T15:43:06.5364673Z except Exception: 2025-11-03T15:43:06.5365313Z log.exception("Failed to parse settings") 2025-11-03T15:43:06.5365753Z 2025-11-03T15:43:06.5365933Z return Settings() 2025-11-03T15:43:06.5366184Z 2025-11-03T15:43:06.5366191Z 2025-11-03T15:43:06.5366443Z def parse_settings(rollout_state: str) -> Settings: 2025-11-03T15:43:06.5367014Z """ 2025-11-03T15:43:06.5367434Z Parse settings, if any, from the rollout state. 2025-11-03T15:43:06.5367826Z 2025-11-03T15:43:06.5368177Z If the issue body contains "---" then the text above that is the settings 2025-11-03T15:43:06.5368922Z and the text below is the list of opted in users. 2025-11-03T15:43:06.5369323Z 2025-11-03T15:43:06.5369719Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-11-03T15:43:06.5370425Z """ 2025-11-03T15:43:06.5370964Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.5371712Z return parse_settings_from_text(settings_text) 2025-11-03T15:43:06.5372108Z 2025-11-03T15:43:06.5372115Z 2025-11-03T15:43:06.5372353Z def parse_users(rollout_state: str) -> UserOptins: 2025-11-03T15:43:06.5372889Z """ 2025-11-03T15:43:06.5373299Z Parse users from the rollout state. 2025-11-03T15:43:06.5373640Z 2025-11-03T15:43:06.5373799Z """ 2025-11-03T15:43:06.5374335Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-11-03T15:43:06.5375173Z return parse_user_opt_in_from_text(users_text) 2025-11-03T15:43:06.5375564Z 2025-11-03T15:43:06.5375570Z 2025-11-03T15:43:06.5376110Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.5376843Z """ 2025-11-03T15:43:06.5377240Z Check if a user is opted into an experiment 2025-11-03T15:43:06.5377756Z """ 2025-11-03T15:43:06.5378193Z return experiment_name in user_optins.get(user, []) 2025-11-03T15:43:06.5378615Z 2025-11-03T15:43:06.5378621Z 2025-11-03T15:43:06.5379031Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-11-03T15:43:06.5379756Z """ 2025-11-03T15:43:06.5380208Z Check if a user explicitly opted out of an experiment 2025-11-03T15:43:06.5380775Z """ 2025-11-03T15:43:06.5381250Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-11-03T15:43:06.5381918Z experiment_optout = "-" + experiment_name 2025-11-03T15:43:06.5382548Z if experiment_optout not in user_optins.get(user, []): 2025-11-03T15:43:06.5383160Z return False 2025-11-03T15:43:06.5383402Z 2025-11-03T15:43:06.5383670Z if is_user_opted_in(user, user_optins, experiment_name): 2025-11-03T15:43:06.5384241Z log.warning( 2025-11-03T15:43:06.5385220Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-11-03T15:43:06.5386099Z ) 2025-11-03T15:43:06.5386305Z 2025-11-03T15:43:06.5386460Z return True 2025-11-03T15:43:06.5386684Z 2025-11-03T15:43:06.5386691Z 2025-11-03T15:43:06.5386870Z def get_runner_prefix( 2025-11-03T15:43:06.5387289Z rollout_state: str, 2025-11-03T15:43:06.5387734Z workflow_requestors: Iterable[str], 2025-11-03T15:43:06.5388227Z branch: str, 2025-11-03T15:43:06.5388716Z eligible_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.5389370Z opt_out_experiments: frozenset[str] = frozenset(), 2025-11-03T15:43:06.5389956Z is_canary: bool = False, 2025-11-03T15:43:06.5390384Z ) -> str: 2025-11-03T15:43:06.5390927Z settings = parse_settings(rollout_state) 2025-11-03T15:43:06.5391496Z user_optins = parse_users(rollout_state) 2025-11-03T15:43:06.5391854Z 2025-11-03T15:43:06.5392021Z fleet_prefix = "" 2025-11-03T15:43:06.5392430Z prefixes = [] 2025-11-03T15:43:06.5393031Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-11-03T15:43:06.5393942Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-11-03T15:43:06.5394633Z log.info( 2025-11-03T15:43:06.5395519Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-11-03T15:43:06.5396269Z ) 2025-11-03T15:43:06.5396636Z continue 2025-11-03T15:43:06.5396869Z 2025-11-03T15:43:06.5397058Z if opt_out_experiments: 2025-11-03T15:43:06.5397612Z if experiment_name in opt_out_experiments: 2025-11-03T15:43:06.5398228Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-11-03T15:43:06.5398825Z log.info( 2025-11-03T15:43:06.5399728Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-11-03T15:43:06.5400695Z ) 2025-11-03T15:43:06.5401086Z continue 2025-11-03T15:43:06.5401353Z 2025-11-03T15:43:06.5401539Z if eligible_experiments: 2025-11-03T15:43:06.5402084Z if experiment_name not in eligible_experiments: 2025-11-03T15:43:06.5402699Z exp_list = ", ".join(eligible_experiments) 2025-11-03T15:43:06.5403232Z log.info( 2025-11-03T15:43:06.5403990Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-11-03T15:43:06.5404830Z ) 2025-11-03T15:43:06.5405605Z continue 2025-11-03T15:43:06.5406083Z elif not experiment_settings.default: 2025-11-03T15:43:06.5406612Z log.info( 2025-11-03T15:43:06.5407463Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-11-03T15:43:06.5408209Z ) 2025-11-03T15:43:06.5408564Z continue 2025-11-03T15:43:06.5408812Z 2025-11-03T15:43:06.5409108Z # Is any workflow_requestor opted out to this experiment? 2025-11-03T15:43:06.5409715Z opted_out_users = [ 2025-11-03T15:43:06.5410150Z requestor 2025-11-03T15:43:06.5410583Z for requestor in workflow_requestors 2025-11-03T15:43:06.5411254Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.5411877Z ] 2025-11-03T15:43:06.5412087Z 2025-11-03T15:43:06.5412258Z if opted_out_users: 2025-11-03T15:43:06.5412699Z log.info( 2025-11-03T15:43:06.5413308Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-11-03T15:43:06.5414007Z ) 2025-11-03T15:43:06.5414376Z continue 2025-11-03T15:43:06.5414621Z 2025-11-03T15:43:06.5414889Z # Is any workflow_requestor opted in to this experiment? 2025-11-03T15:43:06.5415614Z opted_in_users = [ 2025-11-03T15:43:06.5416045Z requestor 2025-11-03T15:43:06.5416489Z for requestor in workflow_requestors 2025-11-03T15:43:06.5417145Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-11-03T15:43:06.5417736Z ] 2025-11-03T15:43:06.5417933Z 2025-11-03T15:43:06.5418099Z enabled = False 2025-11-03T15:43:06.5418522Z if opted_in_users: 2025-11-03T15:43:06.5418946Z log.info( 2025-11-03T15:43:06.5419529Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-11-03T15:43:06.5420211Z ) 2025-11-03T15:43:06.5420587Z enabled = True 2025-11-03T15:43:06.5420852Z 2025-11-03T15:43:06.5421061Z elif experiment_settings.rollout_perc: 2025-11-03T15:43:06.5421993Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-11-03T15:43:06.5422895Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-11-03T15:43:06.5423534Z log.info( 2025-11-03T15:43:06.5424375Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-11-03T15:43:06.5425505Z ) 2025-11-03T15:43:06.5425903Z enabled = True 2025-11-03T15:43:06.5426189Z 2025-11-03T15:43:06.5426347Z if enabled: 2025-11-03T15:43:06.5426761Z label = experiment_name 2025-11-03T15:43:06.5427301Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-11-03T15:43:06.5428121Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-11-03T15:43:06.5428972Z # - If it's enabled, then we always list it's prefix first 2025-11-03T15:43:06.5429719Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-11-03T15:43:06.5430358Z if is_canary: 2025-11-03T15:43:06.5430824Z label += CANARY_FLEET_SUFFIX 2025-11-03T15:43:06.5431350Z fleet_prefix = label 2025-11-03T15:43:06.5431823Z else: 2025-11-03T15:43:06.5432249Z prefixes.append(label) 2025-11-03T15:43:06.5432596Z 2025-11-03T15:43:06.5432772Z if len(prefixes) > 1: 2025-11-03T15:43:06.5433188Z log.error( 2025-11-03T15:43:06.5434188Z 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-11-03T15:43:06.5435416Z ) 2025-11-03T15:43:06.5435793Z prefixes = prefixes[:1] 2025-11-03T15:43:06.5436106Z 2025-11-03T15:43:06.5436289Z # Fleet always comes first 2025-11-03T15:43:06.5436737Z if fleet_prefix: 2025-11-03T15:43:06.5437164Z prefixes.insert(0, fleet_prefix) 2025-11-03T15:43:06.5437512Z 2025-11-03T15:43:06.5437897Z return ".".join(prefixes) + "." if prefixes else "" 2025-11-03T15:43:06.5438308Z 2025-11-03T15:43:06.5438316Z 2025-11-03T15:43:06.5438743Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-11-03T15:43:06.5439497Z """ 2025-11-03T15:43:06.5440062Z Gets the first comment of the issue, which contains the desired rollout state. 2025-11-03T15:43:06.5440599Z 2025-11-03T15:43:06.5440994Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-11-03T15:43:06.5441669Z """ 2025-11-03T15:43:06.5442038Z gh = get_gh_client(github_token) 2025-11-03T15:43:06.5442561Z issue = get_issue(gh, repo, issue_num) 2025-11-03T15:43:06.5443185Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-11-03T15:43:06.5443614Z 2025-11-03T15:43:06.5443621Z 2025-11-03T15:43:06.5444011Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-11-03T15:43:06.5444760Z for _ in range(num_retries): 2025-11-03T15:43:06.5445440Z try: 2025-11-03T15:43:06.5445861Z req = Request(url=url, headers=headers) 2025-11-03T15:43:06.5446504Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-11-03T15:43:06.5447131Z return json.loads(content) 2025-11-03T15:43:06.5447633Z except Exception as e: 2025-11-03T15:43:06.5448145Z log.warning(f"Could not download {url}: {e}") 2025-11-03T15:43:06.5448538Z 2025-11-03T15:43:06.5448902Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-11-03T15:43:06.5449616Z return {} 2025-11-03T15:43:06.5449832Z 2025-11-03T15:43:06.5449839Z 2025-11-03T15:43:06.5449988Z @cache 2025-11-03T15:43:06.5450588Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-11-03T15:43:06.5451305Z """ 2025-11-03T15:43:06.5451678Z Dynamically get PR information 2025-11-03T15:43:06.5452278Z """ 2025-11-03T15:43:06.5452769Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-11-03T15:43:06.5453384Z headers = { 2025-11-03T15:43:06.5453817Z "Accept": "application/vnd.github.v3+json", 2025-11-03T15:43:06.5454394Z "Authorization": f"token {github_token}", 2025-11-03T15:43:06.5455031Z } 2025-11-03T15:43:06.5455445Z json_response: dict[str, Any] = download_json( 2025-11-03T15:43:06.5456021Z url=f"{github_api}/issues/{pr_number}", 2025-11-03T15:43:06.5456552Z headers=headers, 2025-11-03T15:43:06.5456955Z ) 2025-11-03T15:43:06.5457152Z 2025-11-03T15:43:06.5457326Z if not json_response: 2025-11-03T15:43:06.5457877Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-11-03T15:43:06.5458462Z return {} 2025-11-03T15:43:06.5458689Z 2025-11-03T15:43:06.5458870Z return json_response 2025-11-03T15:43:06.5459136Z 2025-11-03T15:43:06.5459142Z 2025-11-03T15:43:06.5459531Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-11-03T15:43:06.5460252Z """ 2025-11-03T15:43:06.5460762Z Dynamically get the latest list of labels from the pull request 2025-11-03T15:43:06.5461400Z """ 2025-11-03T15:43:06.5461871Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-11-03T15:43:06.5462450Z return { 2025-11-03T15:43:06.5463012Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-11-03T15:43:06.5463691Z } 2025-11-03T15:43:06.5463888Z 2025-11-03T15:43:06.5463899Z 2025-11-03T15:43:06.5464068Z def main() -> None: 2025-11-03T15:43:06.5464468Z args = parse_args() 2025-11-03T15:43:06.5464733Z 2025-11-03T15:43:06.5465231Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-11-03T15:43:06.5465614Z 2025-11-03T15:43:06.5465808Z # Check if the PR is opt-out 2025-11-03T15:43:06.5466269Z if args.pr_number: 2025-11-03T15:43:06.5466897Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-11-03T15:43:06.5467801Z if OPT_OUT_LABEL in labels: 2025-11-03T15:43:06.5468306Z log.info( 2025-11-03T15:43:06.5468964Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-11-03T15:43:06.5469736Z ) 2025-11-03T15:43:06.5470277Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.5470926Z sys.exit() 2025-11-03T15:43:06.5471174Z 2025-11-03T15:43:06.5471334Z try: 2025-11-03T15:43:06.5471760Z rollout_state = get_rollout_state_from_issue( 2025-11-03T15:43:06.5472433Z args.github_token, args.github_issue_repo, args.github_issue 2025-11-03T15:43:06.5473043Z ) 2025-11-03T15:43:06.5473239Z 2025-11-03T15:43:06.5473433Z username = get_potential_pr_author( 2025-11-03T15:43:06.5473964Z args.github_token, 2025-11-03T15:43:06.5474430Z args.github_repo, 2025-11-03T15:43:06.5474883Z args.github_actor, 2025-11-03T15:43:06.5475593Z args.github_ref_type, 2025-11-03T15:43:06.5476078Z args.github_branch, 2025-11-03T15:43:06.5476503Z ) 2025-11-03T15:43:06.5476699Z 2025-11-03T15:43:06.5476987Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-11-03T15:43:06.5477434Z 2025-11-03T15:43:06.5477645Z runner_label_prefix = get_runner_prefix( 2025-11-03T15:43:06.5478173Z rollout_state, 2025-11-03T15:43:06.5478627Z (args.github_issue_owner, username), 2025-11-03T15:43:06.5479157Z args.github_branch, 2025-11-03T15:43:06.5479641Z args.eligible_experiments, 2025-11-03T15:43:06.5480155Z args.opt_out_experiments, 2025-11-03T15:43:06.5480632Z is_canary, 2025-11-03T15:43:06.5481019Z ) 2025-11-03T15:43:06.5481214Z 2025-11-03T15:43:06.5481398Z except Exception as e: 2025-11-03T15:43:06.5481831Z log.error( 2025-11-03T15:43:06.5482474Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-11-03T15:43:06.5483373Z ) 2025-11-03T15:43:06.5483575Z 2025-11-03T15:43:06.5483893Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-11-03T15:43:06.5484368Z 2025-11-03T15:43:06.5484374Z 2025-11-03T15:43:06.5484556Z if __name__ == "__main__": 2025-11-03T15:43:06.5485211Z main() 2025-11-03T15:43:06.5485440Z 2025-11-03T15:43:06.5572490Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:06.5573367Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-11-03T15:43:06.5606588Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:06.5607057Z env: 2025-11-03T15:43:06.5607634Z GITHUB_TOKEN: *** 2025-11-03T15:43:06.5608036Z ISSUE_NUMBER: 5132 2025-11-03T15:43:06.5608463Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:06.5608953Z ISSUE_OWNER: 2025-11-03T15:43:06.5609340Z CHECK_EXPERIMENTS: 2025-11-03T15:43:06.5609748Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:06.5610175Z PR_NUMBER: 2025-11-03T15:43:06.5610541Z ##[endgroup] 2025-11-03T15:43:07.5457105Z Defaulting to user installation because normal site-packages is not writeable 2025-11-03T15:43:08.2930995Z Collecting urllib3==1.26.18 2025-11-03T15:43:08.3611067Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-11-03T15:43:08.3900430Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.5 MB/s eta 0:00:00 2025-11-03T15:43:08.4269435Z Collecting PyGithub==2.3.0 2025-11-03T15:43:08.4477323Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-11-03T15:43:08.5078730Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-11-03T15:43:08.5229474Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-11-03T15:43:08.5271659Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-11-03T15:43:08.5295990Z 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-11-03T15:43:08.5318358Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-11-03T15:43:08.5809899Z Collecting Deprecated (from PyGithub==2.3.0) 2025-11-03T15:43:08.5961056Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-11-03T15:43:08.6184868Z 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-11-03T15:43:08.7756799Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:08.7911516Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-11-03T15:43:08.9622157Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-11-03T15:43:08.9780215Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (8.8 kB) 2025-11-03T15:43:09.0104029Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-11-03T15:43:09.0253204Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-11-03T15:43:09.0617280Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-11-03T15:43:09.0805543Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 8.0 MB/s eta 0:00:00 2025-11-03T15:43:09.0966455Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-11-03T15:43:09.1154518Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 20.3 MB/s eta 0:00:00 2025-11-03T15:43:09.1304266Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-11-03T15:43:09.1551624Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 60.8 MB/s eta 0:00:00 2025-11-03T15:43:09.1701807Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-11-03T15:43:09.1878425Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-11-03T15:43:09.1927644Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 63.6 MB/s eta 0:00:00 2025-11-03T15:43:09.2075989Z Downloading wrapt-2.0.0-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-11-03T15:43:09.2119631Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 kB 42.6 MB/s eta 0:00:00 2025-11-03T15:43:09.2271765Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-11-03T15:43:09.2315516Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 40.0 MB/s eta 0:00:00 2025-11-03T15:43:09.5244477Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-11-03T15:43:10.0596734Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-2.0.0 2025-11-03T15:43:10.1387718Z ##[group]Run curr_branch="main" 2025-11-03T15:43:10.1388025Z curr_branch="main" 2025-11-03T15:43:10.1388244Z curr_ref_type="branch" 2025-11-03T15:43:10.1388492Z echo "Current branch is '$curr_branch'" 2025-11-03T15:43:10.1388777Z  2025-11-03T15:43:10.1388957Z python3 runner_determinator.py \ 2025-11-03T15:43:10.1389235Z  --github-token "$GITHUB_TOKEN" \ 2025-11-03T15:43:10.1389508Z  --github-issue "$ISSUE_NUMBER" \ 2025-11-03T15:43:10.1389756Z  --github-branch "$curr_branch" \ 2025-11-03T15:43:10.1390023Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-11-03T15:43:10.1390295Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-11-03T15:43:10.1390573Z  --github-ref-type "$curr_ref_type" \ 2025-11-03T15:43:10.1390858Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-11-03T15:43:10.1391165Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-11-03T15:43:10.1391550Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-11-03T15:43:10.1391840Z  --pr-number "${PR_NUMBER}" 2025-11-03T15:43:10.1424672Z shell: /usr/bin/bash -e {0} 2025-11-03T15:43:10.1425082Z env: 2025-11-03T15:43:10.1425680Z GITHUB_TOKEN: *** 2025-11-03T15:43:10.1425879Z ISSUE_NUMBER: 5132 2025-11-03T15:43:10.1426086Z TRIGGERING_ACTOR: pytorchmergebot 2025-11-03T15:43:10.1426329Z ISSUE_OWNER: 2025-11-03T15:43:10.1426511Z CHECK_EXPERIMENTS: 2025-11-03T15:43:10.1426695Z OPT_OUT_EXPERIMENTS: 2025-11-03T15:43:10.1426887Z PR_NUMBER: 2025-11-03T15:43:10.1427049Z ##[endgroup] 2025-11-03T15:43:10.1477279Z Current branch is 'main' 2025-11-03T15:43:11.5492195Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-11-03T15:43:11.5493500Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-11-03T15:43:11.5494451Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-11-03T15:43:11.5495329Z INFO : Setting output: label-type='' 2025-11-03T15:43:11.5822155Z Evaluate and set job outputs 2025-11-03T15:43:11.5829028Z Cleaning up orphan processes