2025-12-04T07:56:46.6823157Z Current runner version: '2.329.0' 2025-12-04T07:56:46.6846632Z ##[group]Runner Image Provisioner 2025-12-04T07:56:46.6847449Z Hosted Compute Agent 2025-12-04T07:56:46.6847969Z Version: 20251124.448 2025-12-04T07:56:46.6848654Z Commit: fda5086b43ec66ade217e5fcd18146c879571177 2025-12-04T07:56:46.6849308Z Build Date: 2025-11-24T21:16:26Z 2025-12-04T07:56:46.6849903Z ##[endgroup] 2025-12-04T07:56:46.6850469Z ##[group]Operating System 2025-12-04T07:56:46.6851045Z Ubuntu 2025-12-04T07:56:46.6851495Z 24.04.3 2025-12-04T07:56:46.6851998Z LTS 2025-12-04T07:56:46.6852485Z ##[endgroup] 2025-12-04T07:56:46.6852945Z ##[group]Runner Image 2025-12-04T07:56:46.6853578Z Image: ubuntu-24.04 2025-12-04T07:56:46.6854087Z Version: 20251126.144.1 2025-12-04T07:56:46.6855548Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20251126.144/images/ubuntu/Ubuntu2404-Readme.md 2025-12-04T07:56:46.6857174Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20251126.144 2025-12-04T07:56:46.6858144Z ##[endgroup] 2025-12-04T07:56:46.6859194Z ##[group]GITHUB_TOKEN Permissions 2025-12-04T07:56:46.6861318Z Contents: read 2025-12-04T07:56:46.6861857Z Metadata: read 2025-12-04T07:56:46.6862427Z ##[endgroup] 2025-12-04T07:56:46.6864616Z Secret source: Actions 2025-12-04T07:56:46.6865293Z Prepare workflow directory 2025-12-04T07:56:46.7381389Z Prepare all required actions 2025-12-04T07:56:46.7435975Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (ffd9b0fb4355e97af82fc42cf185c3ffa0fc0a32) 2025-12-04T07:56:46.7442553Z ##[group] Inputs 2025-12-04T07:56:46.7443388Z check_experiments: 2025-12-04T07:56:46.7444132Z opt_out_experiments: lf 2025-12-04T07:56:46.7445345Z triggering_actor: pytorchmergebot 2025-12-04T07:56:46.7446200Z issue_owner: 2025-12-04T07:56:46.7446915Z curr_branch: main 2025-12-04T07:56:46.7447764Z curr_ref_type: branch 2025-12-04T07:56:46.7448667Z issue_number: 5132 2025-12-04T07:56:46.7449415Z ##[endgroup] 2025-12-04T07:56:46.7450465Z Complete job name: unit-test / get-label-type / runner-determinator 2025-12-04T07:56:47.3902359Z ##[group]Run cat < runner_determinator.py 2025-12-04T07:56:47.3905032Z cat < runner_determinator.py 2025-12-04T07:56:47.3905737Z # flake8: noqa: G004 2025-12-04T07:56:47.3906398Z  2025-12-04T07:56:47.3907210Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:47.3908356Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:47.3909441Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:47.3910196Z  2025-12-04T07:56:47.3910697Z """ 2025-12-04T07:56:47.3911426Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:47.3912580Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:47.3913827Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:47.3915314Z of which runners should be used to run which job. 2025-12-04T07:56:47.3916058Z  2025-12-04T07:56:47.3916771Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:47.3917938Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:47.3918958Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:47.3919862Z list, defined. 2025-12-04T07:56:47.3920490Z  2025-12-04T07:56:47.3921177Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:47.3922285Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:47.3923315Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:47.3924105Z  2025-12-04T07:56:47.3925641Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:47.3926764Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:47.3927729Z experiments which the user could be opted in to. 2025-12-04T07:56:47.3928409Z  2025-12-04T07:56:47.3928990Z The user list has the following rules: 2025-12-04T07:56:47.3929635Z  2025-12-04T07:56:47.3930389Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:47.3931488Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:47.3932424Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:47.3933126Z  2025-12-04T07:56:47.3933580Z Example config: 2025-12-04T07:56:47.3934510Z  # A list of experiments that can be opted into. 2025-12-04T07:56:47.3935389Z  # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:47.3936180Z  # Expected syntax is: 2025-12-04T07:56:47.3937109Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:47.3938228Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:47.3939107Z  2025-12-04T07:56:47.4028201Z  experiments: 2025-12-04T07:56:47.4028750Z  lf: 2025-12-04T07:56:47.4029253Z  rollout_percent: 25 2025-12-04T07:56:47.4029820Z  all_branches: false 2025-12-04T07:56:47.4030365Z  default: true 2025-12-04T07:56:47.4030861Z  --- 2025-12-04T07:56:47.4031288Z  2025-12-04T07:56:47.4031703Z  # Opt-ins: 2025-12-04T07:56:47.4032429Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:47.4033703Z  # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:47.4034801Z  # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:47.4035571Z  # Experiments should be from the above list. 2025-12-04T07:56:47.4036180Z  2025-12-04T07:56:47.4036618Z  @User1,-lf,split_build 2025-12-04T07:56:47.4037175Z  @User2,lf 2025-12-04T07:56:47.4037649Z  @User3,split_build 2025-12-04T07:56:47.4038162Z """ 2025-12-04T07:56:47.4038573Z  2025-12-04T07:56:47.4038975Z import json 2025-12-04T07:56:47.4039436Z import logging 2025-12-04T07:56:47.4039909Z import os 2025-12-04T07:56:47.4040352Z import random 2025-12-04T07:56:47.4040820Z import re 2025-12-04T07:56:47.4041256Z import sys 2025-12-04T07:56:47.4041762Z from argparse import ArgumentParser 2025-12-04T07:56:47.4042456Z from collections.abc import Iterable 2025-12-04T07:56:47.4043074Z from functools import cache 2025-12-04T07:56:47.4043641Z from logging import LogRecord 2025-12-04T07:56:47.4044504Z from typing import Any, NamedTuple 2025-12-04T07:56:47.4045264Z from urllib.request import Request, urlopen 2025-12-04T07:56:47.4045892Z  2025-12-04T07:56:47.4046306Z import yaml 2025-12-04T07:56:47.4046803Z from github import Auth, Github 2025-12-04T07:56:47.4047383Z from github.Issue import Issue 2025-12-04T07:56:47.4047934Z  2025-12-04T07:56:47.4048341Z  2025-12-04T07:56:47.4048838Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:47.4049637Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:47.4050637Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:47.4051424Z  2025-12-04T07:56:47.4052168Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:47.4052851Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:47.4053471Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:47.4054161Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:47.4054887Z  2025-12-04T07:56:47.4055346Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:47.4055922Z  2025-12-04T07:56:47.4056347Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:47.4056915Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:47.4057436Z  2025-12-04T07:56:47.4057824Z  2025-12-04T07:56:47.4058246Z class Experiment(NamedTuple): 2025-12-04T07:56:47.4058821Z  rollout_perc: float = ( 2025-12-04T07:56:47.4059594Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:47.4060351Z  ) 2025-12-04T07:56:47.4060798Z  all_branches: bool = ( 2025-12-04T07:56:47.4061554Z  False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:47.4062296Z  ) 2025-12-04T07:56:47.4062724Z  default: bool = ( 2025-12-04T07:56:47.4063406Z  True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:47.4064117Z  ) 2025-12-04T07:56:47.4064632Z  2025-12-04T07:56:47.4065066Z  # Add more fields as needed 2025-12-04T07:56:47.4065594Z  2025-12-04T07:56:47.4065985Z  2025-12-04T07:56:47.4066402Z class Settings(NamedTuple): 2025-12-04T07:56:47.4066928Z  """ 2025-12-04T07:56:47.4067476Z  Settings for the experiments that can be opted into. 2025-12-04T07:56:47.4068123Z  """ 2025-12-04T07:56:47.4068531Z  2025-12-04T07:56:47.4068993Z  experiments: dict[str, Experiment] = {} 2025-12-04T07:56:47.4069585Z  2025-12-04T07:56:47.4070095Z  2025-12-04T07:56:47.4070585Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:47.4071315Z  """Color codes the log messages based on the log level""" 2025-12-04T07:56:47.4071973Z  2025-12-04T07:56:47.4072381Z  COLORS = { 2025-12-04T07:56:47.4072886Z  "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:47.4073471Z  "ERROR": "\033[31m", # Red 2025-12-04T07:56:47.4074052Z  "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:47.4074739Z  "INFO": "\033[0m", # Reset 2025-12-04T07:56:47.4075312Z  "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:47.4075903Z  } 2025-12-04T07:56:47.4076314Z  2025-12-04T07:56:47.4076799Z  def format(self, record: LogRecord) -> str: 2025-12-04T07:56:47.4077640Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:47.4078510Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:47.4079173Z  return super().format(record) 2025-12-04T07:56:47.4079723Z  2025-12-04T07:56:47.4080109Z  2025-12-04T07:56:47.4080549Z handler = logging.StreamHandler() 2025-12-04T07:56:47.4081374Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:47.4082165Z  2025-12-04T07:56:47.4082683Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:47.4083351Z log.addHandler(handler) 2025-12-04T07:56:47.4083881Z log.setLevel(logging.INFO) 2025-12-04T07:56:47.4084697Z  2025-12-04T07:56:47.4085100Z  2025-12-04T07:56:47.4085621Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:47.4086270Z  """ 2025-12-04T07:56:47.4086876Z  Defines outputs of the github action that invokes this script 2025-12-04T07:56:47.4087739Z  """ 2025-12-04T07:56:47.4088180Z  if not GITHUB_OUTPUT: 2025-12-04T07:56:47.4089366Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:47.4090597Z  log.warning( 2025-12-04T07:56:47.4091571Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T07:56:47.4092569Z  ) 2025-12-04T07:56:47.4093085Z  print(f"::set-output name={key}::{value}") 2025-12-04T07:56:47.4093706Z  return 2025-12-04T07:56:47.4094157Z  2025-12-04T07:56:47.4094976Z  with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:47.4095646Z  log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:47.4096290Z  f.write(f"{key}={value}\n") 2025-12-04T07:56:47.4096851Z  2025-12-04T07:56:47.4097254Z  2025-12-04T07:56:47.4097830Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:47.4098578Z  return frozenset( 2025-12-04T07:56:47.4099308Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:47.4100063Z  ) 2025-12-04T07:56:47.4100495Z  2025-12-04T07:56:47.4100882Z  2025-12-04T07:56:47.4101303Z def parse_args() -> Any: 2025-12-04T07:56:47.4101986Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:47.4102953Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:47.4103793Z  parser.add_argument( 2025-12-04T07:56:47.4104487Z  "--github-issue-repo", 2025-12-04T07:56:47.4105055Z  type=str, 2025-12-04T07:56:47.4105567Z  required=False, 2025-12-04T07:56:47.4106278Z  default="pytorch/test-infra", 2025-12-04T07:56:47.4106939Z  help="GitHub repo to get the issue", 2025-12-04T07:56:47.4107522Z  ) 2025-12-04T07:56:47.4107968Z  parser.add_argument( 2025-12-04T07:56:47.4108515Z  "--github-repo", 2025-12-04T07:56:47.4109039Z  type=str, 2025-12-04T07:56:47.4109535Z  required=True, 2025-12-04T07:56:47.4110111Z  help="GitHub repo where CI is running", 2025-12-04T07:56:47.4110689Z  ) 2025-12-04T07:56:47.4111126Z  parser.add_argument( 2025-12-04T07:56:47.4111845Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:47.4112586Z  ) 2025-12-04T07:56:47.4113042Z  parser.add_argument( 2025-12-04T07:56:47.4113784Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:47.4114665Z  ) 2025-12-04T07:56:47.4115104Z  parser.add_argument( 2025-12-04T07:56:47.4115862Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:47.4116616Z  ) 2025-12-04T07:56:47.4117063Z  parser.add_argument( 2025-12-04T07:56:47.4117846Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:47.4118626Z  ) 2025-12-04T07:56:47.4119094Z  parser.add_argument( 2025-12-04T07:56:47.4119640Z  "--github-ref-type", 2025-12-04T07:56:47.4120189Z  type=str, 2025-12-04T07:56:47.4120691Z  required=True, 2025-12-04T07:56:47.4121308Z  help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:47.4121935Z  ) 2025-12-04T07:56:47.4122385Z  parser.add_argument( 2025-12-04T07:56:47.4123075Z  "--eligible-experiments", 2025-12-04T07:56:47.4123699Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:47.4124576Z  required=False, 2025-12-04T07:56:47.4125133Z  default="", 2025-12-04T07:56:47.4126096Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:47.4127100Z  ) 2025-12-04T07:56:47.4127543Z  parser.add_argument( 2025-12-04T07:56:47.4128094Z  "--opt-out-experiments", 2025-12-04T07:56:47.4128693Z  type=_str_comma_separated_to_set, 2025-12-04T07:56:47.4129279Z  required=False, 2025-12-04T07:56:47.4129795Z  default="", 2025-12-04T07:56:47.4130285Z  help=( 2025-12-04T07:56:47.4131060Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:47.4132284Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:47.4133197Z  ), 2025-12-04T07:56:47.4133635Z  ) 2025-12-04T07:56:47.4134083Z  parser.add_argument( 2025-12-04T07:56:47.4134735Z  "--pr-number", 2025-12-04T07:56:47.4135253Z  type=str, 2025-12-04T07:56:47.4135751Z  required=False, 2025-12-04T07:56:47.4136263Z  default="", 2025-12-04T07:56:47.4136861Z  help="the optional PR number where this is run", 2025-12-04T07:56:47.4137487Z  ) 2025-12-04T07:56:47.4137907Z  2025-12-04T07:56:47.4138348Z  return parser.parse_args() 2025-12-04T07:56:47.4138892Z  2025-12-04T07:56:47.4139286Z  2025-12-04T07:56:47.4139955Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:47.4140953Z  auth = Auth.Token(github_token) 2025-12-04T07:56:47.4141591Z  return Github(auth=auth) 2025-12-04T07:56:47.4142133Z  2025-12-04T07:56:47.4142529Z  2025-12-04T07:56:47.4143256Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:47.4144148Z  repo = gh.get_repo(repo) 2025-12-04T07:56:47.4144864Z  return repo.get_issue(number=issue_num) 2025-12-04T07:56:47.4145469Z  2025-12-04T07:56:47.4145855Z  2025-12-04T07:56:47.4146282Z def get_potential_pr_author( 2025-12-04T07:56:47.4147045Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:47.4147792Z ) -> str: 2025-12-04T07:56:47.4148410Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:47.4149334Z  # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:47.4150210Z  # embedded in the tag name: ciflow// 2025-12-04T07:56:47.4150858Z  2025-12-04T07:56:47.4151305Z  gh = get_gh_client(github_token) 2025-12-04T07:56:47.4151870Z  2025-12-04T07:56:47.4152404Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:47.4153127Z  split_tag = ref_name.split("/") 2025-12-04T07:56:47.4153711Z  if ( 2025-12-04T07:56:47.4154278Z  len(split_tag) == 3 2025-12-04T07:56:47.4154866Z  and split_tag[0] == "ciflow" 2025-12-04T07:56:47.4155483Z  and split_tag[2].isnumeric() 2025-12-04T07:56:47.4156055Z  ): 2025-12-04T07:56:47.4156531Z  pr_number = split_tag[2] 2025-12-04T07:56:47.4157103Z  try: 2025-12-04T07:56:47.4157634Z  repository = gh.get_repo(repo) 2025-12-04T07:56:47.4158491Z  pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:47.4159184Z  except Exception as e: 2025-12-04T07:56:47.4159807Z  raise Exception( # noqa: TRY002 2025-12-04T07:56:47.4160576Z  f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:47.4161306Z  ) from e 2025-12-04T07:56:47.4161964Z  return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:47.4162757Z  # In all other cases, return the original input username 2025-12-04T07:56:47.4163428Z  return username 2025-12-04T07:56:47.4163908Z  2025-12-04T07:56:47.4164586Z  2025-12-04T07:56:47.4165127Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:47.4165744Z  """ 2025-12-04T07:56:47.4166493Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:47.4167356Z  """ 2025-12-04T07:56:47.4167997Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:47.4168734Z  2025-12-04T07:56:47.4169132Z  2025-12-04T07:56:47.4169577Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:47.4170149Z  try: 2025-12-04T07:56:47.4170625Z  data = yaml.safe_load(yaml_text) 2025-12-04T07:56:47.4171209Z  return data 2025-12-04T07:56:47.4171725Z  except yaml.YAMLError: 2025-12-04T07:56:47.4172309Z  log.exception("Error loading YAML") 2025-12-04T07:56:47.4172897Z  raise 2025-12-04T07:56:47.4173345Z  2025-12-04T07:56:47.4173741Z  2025-12-04T07:56:47.4175055Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:47.4175935Z  """ 2025-12-04T07:56:47.4176815Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:47.4177650Z  2025-12-04T07:56:47.4178262Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:47.4179135Z  and the text below is the list of opted in users. 2025-12-04T07:56:47.4179776Z  2025-12-04T07:56:47.4180420Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:47.4181203Z  """ 2025-12-04T07:56:47.4181740Z  rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:47.4182415Z  if len(rollout_state_parts) >= 2: 2025-12-04T07:56:47.4183128Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:47.4183796Z  else: 2025-12-04T07:56:47.4184360Z  return "", rollout_state 2025-12-04T07:56:47.4185106Z  2025-12-04T07:56:47.4185540Z  2025-12-04T07:56:47.4186006Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:47.4186586Z  """ 2025-12-04T07:56:47.4187194Z  Dictionary of users with a list of features they have opted into 2025-12-04T07:56:47.4187903Z  """ 2025-12-04T07:56:47.4188321Z  2025-12-04T07:56:47.4188709Z  2025-12-04T07:56:47.4189311Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:47.4190035Z  """ 2025-12-04T07:56:47.4190843Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T07:56:47.4191757Z  2025-12-04T07:56:47.4192638Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:47.4193734Z  - Example line: "@User1,lf,split_build" 2025-12-04T07:56:47.4194753Z  - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:47.4195455Z  2025-12-04T07:56:47.4195839Z  2025-12-04T07:56:47.4196224Z  """ 2025-12-04T07:56:47.4196667Z  optins = UserOptins() 2025-12-04T07:56:47.4197249Z  for user in user_optin_text.split("\n"): 2025-12-04T07:56:47.4197893Z  user = user.strip("\r\n\t -") 2025-12-04T07:56:47.4198531Z  if not user or not user.startswith("@"): 2025-12-04T07:56:47.4199163Z  # Not a valid user. Skip 2025-12-04T07:56:47.4199737Z  continue 2025-12-04T07:56:47.4200219Z  2025-12-04T07:56:47.4200619Z  if user: 2025-12-04T07:56:47.4201178Z  usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:47.4201959Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:47.4202663Z  2025-12-04T07:56:47.4203083Z  return optins 2025-12-04T07:56:47.4203552Z  2025-12-04T07:56:47.4203941Z  2025-12-04T07:56:47.4204603Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:47.4205289Z  """ 2025-12-04T07:56:47.4205774Z  Check if the experiment name is valid. 2025-12-04T07:56:47.4206364Z  A valid name: 2025-12-04T07:56:47.4207122Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:47.4208142Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:47.4208935Z  - Cannot contain spaces 2025-12-04T07:56:47.4209480Z  """ 2025-12-04T07:56:47.4209892Z  2025-12-04T07:56:47.4210416Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:47.4211209Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:47.4212006Z  2025-12-04T07:56:47.4212410Z  if valid: 2025-12-04T07:56:47.4212877Z  return True 2025-12-04T07:56:47.4213343Z  2025-12-04T07:56:47.4213751Z  log.error( 2025-12-04T07:56:47.4215424Z  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-12-04T07:56:47.4217087Z  ) 2025-12-04T07:56:47.4217513Z  return False 2025-12-04T07:56:47.4217979Z  2025-12-04T07:56:47.4218365Z  2025-12-04T07:56:47.4218941Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:47.4219653Z  """ 2025-12-04T07:56:47.4220331Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:47.4221117Z  """ 2025-12-04T07:56:47.4221544Z  try: 2025-12-04T07:56:47.4221980Z  if settings_text: 2025-12-04T07:56:47.4222811Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:47.4223669Z  # for easy reading 2025-12-04T07:56:47.4224701Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:47.4225690Z  # the backtick character in shell commands. 2025-12-04T07:56:47.4226377Z  backtick = chr(96) # backtick character 2025-12-04T07:56:47.4227141Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:47.4227888Z  settings = load_yaml(settings_text) 2025-12-04T07:56:47.4228468Z  2025-12-04T07:56:47.4229139Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:47.4230120Z  experiments = {} 2025-12-04T07:56:47.4230645Z  2025-12-04T07:56:47.4231271Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:47.4232121Z  if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:47.4233318Z  # 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-12-04T07:56:47.4234538Z  continue 2025-12-04T07:56:47.4235059Z  2025-12-04T07:56:47.4235487Z  valid_settings = {} 2025-12-04T07:56:47.4236086Z  for setting in exp_settings: 2025-12-04T07:56:47.4236728Z  if setting not in Experiment._fields: 2025-12-04T07:56:47.4237377Z  log.warning( 2025-12-04T07:56:47.4238183Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:47.4238954Z  ) 2025-12-04T07:56:47.4239464Z  else: 2025-12-04T07:56:47.4240070Z  valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:47.4240712Z  2025-12-04T07:56:47.4241244Z  experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:47.4241967Z  return Settings(experiments) 2025-12-04T07:56:47.4242531Z  2025-12-04T07:56:47.4242942Z  except Exception: 2025-12-04T07:56:47.4243522Z  log.exception("Failed to parse settings") 2025-12-04T07:56:47.4244116Z  2025-12-04T07:56:47.4244626Z  return Settings() 2025-12-04T07:56:47.4245114Z  2025-12-04T07:56:47.4245516Z  2025-12-04T07:56:47.4246166Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:47.4246822Z  """ 2025-12-04T07:56:47.4247350Z  Parse settings, if any, from the rollout state. 2025-12-04T07:56:47.4247961Z  2025-12-04T07:56:47.4248566Z  If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:47.4249407Z  and the text below is the list of opted in users. 2025-12-04T07:56:47.4250028Z  2025-12-04T07:56:47.4250686Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:47.4251499Z  """ 2025-12-04T07:56:47.4252141Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:47.4252990Z  return parse_settings_from_text(settings_text) 2025-12-04T07:56:47.4253597Z  2025-12-04T07:56:47.4253984Z  2025-12-04T07:56:47.4254606Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:47.4255231Z  """ 2025-12-04T07:56:47.4255700Z  Parse users from the rollout state. 2025-12-04T07:56:47.4256276Z  2025-12-04T07:56:47.4256661Z  """ 2025-12-04T07:56:47.4257284Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:47.4258112Z  return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:47.4258728Z  2025-12-04T07:56:47.4259105Z  2025-12-04T07:56:47.4259791Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:47.4260605Z  """ 2025-12-04T07:56:47.4261108Z  Check if a user is opted into an experiment 2025-12-04T07:56:47.4261711Z  """ 2025-12-04T07:56:47.4262251Z  return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:47.4263018Z  2025-12-04T07:56:47.4263405Z  2025-12-04T07:56:47.4264107Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:47.4265040Z  """ 2025-12-04T07:56:47.4265590Z  Check if a user explicitly opted out of an experiment 2025-12-04T07:56:47.4266238Z  """ 2025-12-04T07:56:47.4266828Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:47.4267604Z  experiment_optout = "-" + experiment_name 2025-12-04T07:56:47.4268323Z  if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:47.4268991Z  return False 2025-12-04T07:56:47.4269467Z  2025-12-04T07:56:47.4269993Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:47.4270666Z  log.warning( 2025-12-04T07:56:47.4271589Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:47.4272549Z  ) 2025-12-04T07:56:47.4272974Z  2025-12-04T07:56:47.4273382Z  return True 2025-12-04T07:56:47.4273840Z  2025-12-04T07:56:47.4274322Z  2025-12-04T07:56:47.4274730Z def get_runner_prefix( 2025-12-04T07:56:47.4275266Z  rollout_state: str, 2025-12-04T07:56:47.4275862Z  workflow_requestors: Iterable[str], 2025-12-04T07:56:47.4276443Z  branch: str, 2025-12-04T07:56:47.4277039Z  eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:47.4277794Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:47.4278466Z  is_canary: bool = False, 2025-12-04T07:56:47.4278989Z ) -> str: 2025-12-04T07:56:47.4279507Z  settings = parse_settings(rollout_state) 2025-12-04T07:56:47.4280174Z  user_optins = parse_users(rollout_state) 2025-12-04T07:56:47.4280760Z  2025-12-04T07:56:47.4281299Z  fleet_prefix = "" 2025-12-04T07:56:47.4281817Z  prefixes = [] 2025-12-04T07:56:47.4282541Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:47.4283556Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:47.4284432Z  log.info( 2025-12-04T07:56:47.4285212Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:47.4286022Z  ) 2025-12-04T07:56:47.4286497Z  continue 2025-12-04T07:56:47.4286979Z  2025-12-04T07:56:47.4287408Z  if opt_out_experiments: 2025-12-04T07:56:47.4288031Z  if experiment_name in opt_out_experiments: 2025-12-04T07:56:47.4288772Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:47.4289442Z  log.info( 2025-12-04T07:56:47.4290467Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:47.4291514Z  ) 2025-12-04T07:56:47.4292019Z  continue 2025-12-04T07:56:47.4292527Z  2025-12-04T07:56:47.4292956Z  if eligible_experiments: 2025-12-04T07:56:47.4293600Z  if experiment_name not in eligible_experiments: 2025-12-04T07:56:47.4294416Z  exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:47.4295033Z  log.info( 2025-12-04T07:56:47.4295908Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:47.4296799Z  ) 2025-12-04T07:56:47.4297413Z  continue 2025-12-04T07:56:47.4297987Z  elif not experiment_settings.default: 2025-12-04T07:56:47.4298585Z  log.info( 2025-12-04T07:56:47.4299345Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:47.4300142Z  ) 2025-12-04T07:56:47.4300612Z  continue 2025-12-04T07:56:47.4301089Z  2025-12-04T07:56:47.4301620Z  # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:47.4302296Z  opted_out_users = [ 2025-12-04T07:56:47.4302844Z  requestor 2025-12-04T07:56:47.4303398Z  for requestor in workflow_requestors 2025-12-04T07:56:47.4304153Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:47.4304951Z  ] 2025-12-04T07:56:47.4305380Z  2025-12-04T07:56:47.4305809Z  if opted_out_users: 2025-12-04T07:56:47.4306365Z  log.info( 2025-12-04T07:56:47.4307090Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:47.4307846Z  ) 2025-12-04T07:56:47.4308300Z  continue 2025-12-04T07:56:47.4308784Z  2025-12-04T07:56:47.4309307Z  # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:47.4309997Z  opted_in_users = [ 2025-12-04T07:56:47.4310547Z  requestor 2025-12-04T07:56:47.4311108Z  for requestor in workflow_requestors 2025-12-04T07:56:47.4311859Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:47.4312542Z  ] 2025-12-04T07:56:47.4312975Z  2025-12-04T07:56:47.4313385Z  enabled = False 2025-12-04T07:56:47.4313918Z  if opted_in_users: 2025-12-04T07:56:47.4314678Z  log.info( 2025-12-04T07:56:47.4315398Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:47.4316141Z  ) 2025-12-04T07:56:47.4316621Z  enabled = True 2025-12-04T07:56:47.4317145Z  2025-12-04T07:56:47.4317604Z  elif experiment_settings.rollout_perc: 2025-12-04T07:56:47.4318517Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:47.4319536Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:47.4320261Z  log.info( 2025-12-04T07:56:47.4321225Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:47.4322207Z  ) 2025-12-04T07:56:47.4322718Z  enabled = True 2025-12-04T07:56:47.4323249Z  2025-12-04T07:56:47.4323658Z  if enabled: 2025-12-04T07:56:47.4324172Z  label = experiment_name 2025-12-04T07:56:47.4324918Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:47.4325822Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:47.4326767Z  # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:47.4327612Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:47.4328340Z  if is_canary: 2025-12-04T07:56:47.4328920Z  label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:47.4329533Z  fleet_prefix = label 2025-12-04T07:56:47.4330088Z  else: 2025-12-04T07:56:47.4330745Z  prefixes.append(label) 2025-12-04T07:56:47.4331305Z  2025-12-04T07:56:47.4331720Z  if len(prefixes) > 1: 2025-12-04T07:56:47.4332245Z  log.error( 2025-12-04T07:56:47.4333387Z  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-12-04T07:56:47.4334687Z  ) 2025-12-04T07:56:47.4335157Z  prefixes = prefixes[:1] 2025-12-04T07:56:47.4335697Z  2025-12-04T07:56:47.4336119Z  # Fleet always comes first 2025-12-04T07:56:47.4336678Z  if fleet_prefix: 2025-12-04T07:56:47.4337216Z  prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:47.4337786Z  2025-12-04T07:56:47.4338288Z  return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:47.4338928Z  2025-12-04T07:56:47.4339317Z  2025-12-04T07:56:47.4340019Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:47.4340861Z  """ 2025-12-04T07:56:47.4341521Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:47.4342299Z  2025-12-04T07:56:47.4342940Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:47.4343722Z  """ 2025-12-04T07:56:47.4344282Z  gh = get_gh_client(github_token) 2025-12-04T07:56:47.4344906Z  issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:47.4345641Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:47.4346298Z  2025-12-04T07:56:47.4346704Z  2025-12-04T07:56:47.4347371Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:47.4348335Z  for _ in range(num_retries): 2025-12-04T07:56:47.4348889Z  try: 2025-12-04T07:56:47.4349401Z  req = Request(url=url, headers=headers) 2025-12-04T07:56:47.4350139Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:47.4350854Z  return json.loads(content) 2025-12-04T07:56:47.4351441Z  except Exception as e: 2025-12-04T07:56:47.4352068Z  log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:47.4352688Z  2025-12-04T07:56:47.4353322Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:47.4354102Z  return {} 2025-12-04T07:56:47.4354654Z  2025-12-04T07:56:47.4355048Z  2025-12-04T07:56:47.4355443Z @cache 2025-12-04T07:56:47.4356149Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:47.4356982Z  """ 2025-12-04T07:56:47.4357438Z  Dynamically get PR information 2025-12-04T07:56:47.4357998Z  """ 2025-12-04T07:56:47.4358576Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:47.4359270Z  headers = { 2025-12-04T07:56:47.4359823Z  "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:47.4360502Z  "Authorization": f"token {github_token}", 2025-12-04T07:56:47.4361103Z  } 2025-12-04T07:56:47.4361607Z  json_response: dict[str, Any] = download_json( 2025-12-04T07:56:47.4362301Z  url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:47.4362908Z  headers=headers, 2025-12-04T07:56:47.4363423Z  ) 2025-12-04T07:56:47.4363831Z  2025-12-04T07:56:47.4364337Z  if not json_response: 2025-12-04T07:56:47.4365013Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:47.4365838Z  return {} 2025-12-04T07:56:47.4366314Z  2025-12-04T07:56:47.4366725Z  return json_response 2025-12-04T07:56:47.4367236Z  2025-12-04T07:56:47.4367617Z  2025-12-04T07:56:47.4368279Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:47.4369080Z  """ 2025-12-04T07:56:47.4369680Z  Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:47.4370393Z  """ 2025-12-04T07:56:47.4370955Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:47.4371631Z  return { 2025-12-04T07:56:47.4372294Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:47.4373047Z  } 2025-12-04T07:56:47.4373453Z  2025-12-04T07:56:47.4373849Z  2025-12-04T07:56:47.4374390Z def main() -> None: 2025-12-04T07:56:47.4374898Z  args = parse_args() 2025-12-04T07:56:47.4375412Z  2025-12-04T07:56:47.4375910Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:47.4376513Z  2025-12-04T07:56:47.4376939Z  # Check if the PR is opt-out 2025-12-04T07:56:47.4377504Z  if args.pr_number: 2025-12-04T07:56:47.4378259Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:47.4379082Z  if OPT_OUT_LABEL in labels: 2025-12-04T07:56:47.4379654Z  log.info( 2025-12-04T07:56:47.4380434Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:47.4381257Z  ) 2025-12-04T07:56:47.4381910Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:47.4382662Z  sys.exit() 2025-12-04T07:56:47.4383275Z  2025-12-04T07:56:47.4383683Z  try: 2025-12-04T07:56:47.4384298Z  rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:47.4385093Z  args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:47.4385803Z  ) 2025-12-04T07:56:47.4386221Z  2025-12-04T07:56:47.4386679Z  username = get_potential_pr_author( 2025-12-04T07:56:47.4387286Z  args.github_token, 2025-12-04T07:56:47.4387843Z  args.github_repo, 2025-12-04T07:56:47.4388401Z  args.github_actor, 2025-12-04T07:56:47.4388966Z  args.github_ref_type, 2025-12-04T07:56:47.4389547Z  args.github_branch, 2025-12-04T07:56:47.4390089Z  ) 2025-12-04T07:56:47.4390513Z  2025-12-04T07:56:47.4391056Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:47.4391724Z  2025-12-04T07:56:47.4392199Z  runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:47.4392811Z  rollout_state, 2025-12-04T07:56:47.4393391Z  (args.github_issue_owner, username), 2025-12-04T07:56:47.4394002Z  args.github_branch, 2025-12-04T07:56:47.4394690Z  args.eligible_experiments, 2025-12-04T07:56:47.4395300Z  args.opt_out_experiments, 2025-12-04T07:56:47.4395876Z  is_canary, 2025-12-04T07:56:47.4396373Z  ) 2025-12-04T07:56:47.4396798Z  2025-12-04T07:56:47.4397224Z  except Exception as e: 2025-12-04T07:56:47.4397757Z  log.error( 2025-12-04T07:56:47.4398532Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:47.4399477Z  ) 2025-12-04T07:56:47.4399919Z  2025-12-04T07:56:47.4400509Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:47.4401236Z  2025-12-04T07:56:47.4401624Z  2025-12-04T07:56:47.4402043Z if __name__ == "__main__": 2025-12-04T07:56:47.4402565Z  main() 2025-12-04T07:56:47.4403006Z  2025-12-04T07:56:47.4403406Z EOF 2025-12-04T07:56:47.4403802Z  2025-12-04T07:56:47.4404322Z cat runner_determinator.py 2025-12-04T07:56:47.5095855Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:47.5096774Z env: 2025-12-04T07:56:47.5097535Z GITHUB_TOKEN: *** 2025-12-04T07:56:47.5098001Z ISSUE_NUMBER: 5132 2025-12-04T07:56:47.5098496Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:47.5099044Z ISSUE_OWNER: 2025-12-04T07:56:47.5099478Z CHECK_EXPERIMENTS: 2025-12-04T07:56:47.5099951Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T07:56:47.5100430Z PR_NUMBER: 2025-12-04T07:56:47.5100870Z ##[endgroup] 2025-12-04T07:56:47.5313897Z # flake8: noqa: G004 2025-12-04T07:56:47.5314520Z 2025-12-04T07:56:47.5314996Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-12-04T07:56:47.5315999Z # must be kept in sync. You can do it easily by running the following command: 2025-12-04T07:56:47.5316812Z # python .github/scripts/update_runner_determinator.py 2025-12-04T07:56:47.5317273Z 2025-12-04T07:56:47.5317441Z """ 2025-12-04T07:56:47.5318035Z This runner determinator is used to determine which set of runners to run a 2025-12-04T07:56:47.5318922Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-12-04T07:56:47.5319852Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-12-04T07:56:47.5320695Z of which runners should be used to run which job. 2025-12-04T07:56:47.5321109Z 2025-12-04T07:56:47.5321502Z The configuration has two parts, the settings and a list of opted-in users, 2025-12-04T07:56:47.5322617Z separated by a line containing "---". If the line is not present, the 2025-12-04T07:56:47.5323535Z settings are considered to be empty with only the second part, the user 2025-12-04T07:56:47.5324516Z list, defined. 2025-12-04T07:56:47.5324788Z 2025-12-04T07:56:47.5325176Z The first part is a YAML block that defines the rollout settings. This can be 2025-12-04T07:56:47.5326151Z used to define any settings that are needed to determine which runners to use. 2025-12-04T07:56:47.5326996Z It's fields are defined by the RolloutSettings class below. 2025-12-04T07:56:47.5327455Z 2025-12-04T07:56:47.5327838Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-12-04T07:56:47.5328727Z The user list is also a comma separated list of additional features or 2025-12-04T07:56:47.5329479Z experiments which the user could be opted in to. 2025-12-04T07:56:47.5329887Z 2025-12-04T07:56:47.5330103Z The user list has the following rules: 2025-12-04T07:56:47.5330467Z 2025-12-04T07:56:47.5330800Z - Users are GitHub usernames, which must start with the @ prefix 2025-12-04T07:56:47.5331691Z - Each user is also a comma-separated list of features/experiments to enable 2025-12-04T07:56:47.5332470Z - A "#" prefix opts the user out of all experiments 2025-12-04T07:56:47.5332878Z 2025-12-04T07:56:47.5333057Z Example config: 2025-12-04T07:56:47.5333534Z # A list of experiments that can be opted into. 2025-12-04T07:56:47.5334471Z # This defines the behavior they'll induce when opted into. 2025-12-04T07:56:47.5335145Z # Expected syntax is: 2025-12-04T07:56:47.5335806Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-12-04T07:56:47.5336801Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-12-04T07:56:47.5337425Z 2025-12-04T07:56:47.5337606Z experiments: 2025-12-04T07:56:47.5338019Z lf: 2025-12-04T07:56:47.5338421Z rollout_percent: 25 2025-12-04T07:56:47.5339087Z all_branches: false 2025-12-04T07:56:47.5339602Z default: true 2025-12-04T07:56:47.5340039Z --- 2025-12-04T07:56:47.5340259Z 2025-12-04T07:56:47.5340437Z # Opt-ins: 2025-12-04T07:56:47.5341038Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-12-04T07:56:47.5341941Z # and specifying experiments to enable in a comma-separated list. 2025-12-04T07:56:47.5342729Z # To always opt out of an experiment, prefix it with a "-". 2025-12-04T07:56:47.5343423Z # Experiments should be from the above list. 2025-12-04T07:56:47.5343815Z 2025-12-04T07:56:47.5344014Z @User1,-lf,split_build 2025-12-04T07:56:47.5344677Z @User2,lf 2025-12-04T07:56:47.5345089Z @User3,split_build 2025-12-04T07:56:47.5345516Z """ 2025-12-04T07:56:47.5345727Z 2025-12-04T07:56:47.5345900Z import json 2025-12-04T07:56:47.5346295Z import logging 2025-12-04T07:56:47.5346706Z import os 2025-12-04T07:56:47.5347086Z import random 2025-12-04T07:56:47.5347498Z import re 2025-12-04T07:56:47.5347876Z import sys 2025-12-04T07:56:47.5348315Z from argparse import ArgumentParser 2025-12-04T07:56:47.5348876Z from collections.abc import Iterable 2025-12-04T07:56:47.5349430Z from functools import cache 2025-12-04T07:56:47.5349931Z from logging import LogRecord 2025-12-04T07:56:47.5350437Z from typing import Any, NamedTuple 2025-12-04T07:56:47.5350996Z from urllib.request import Request, urlopen 2025-12-04T07:56:47.5351373Z 2025-12-04T07:56:47.5351549Z import yaml 2025-12-04T07:56:47.5351960Z from github import Auth, Github 2025-12-04T07:56:47.5352453Z from github.Issue import Issue 2025-12-04T07:56:47.5352771Z 2025-12-04T07:56:47.5352778Z 2025-12-04T07:56:47.5352998Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-12-04T07:56:47.5353704Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-12-04T07:56:47.5354865Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-12-04T07:56:47.5355449Z 2025-12-04T07:56:47.5355703Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-12-04T07:56:47.5356451Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-12-04T07:56:47.5357002Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-12-04T07:56:47.5357574Z OPT_OUT_LABEL = "no-runner-experiments" 2025-12-04T07:56:47.5357948Z 2025-12-04T07:56:47.5358154Z SETTING_EXPERIMENTS = "experiments" 2025-12-04T07:56:47.5358494Z 2025-12-04T07:56:47.5358695Z LF_FLEET_EXPERIMENT = "lf" 2025-12-04T07:56:47.5359172Z CANARY_FLEET_SUFFIX = ".c" 2025-12-04T07:56:47.5359466Z 2025-12-04T07:56:47.5359479Z 2025-12-04T07:56:47.5359678Z class Experiment(NamedTuple): 2025-12-04T07:56:47.5360181Z rollout_perc: float = ( 2025-12-04T07:56:47.5360842Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-12-04T07:56:47.5361532Z ) 2025-12-04T07:56:47.5361930Z all_branches: bool = ( 2025-12-04T07:56:47.5362578Z False # If True, the experiment is also enabled on the exception branches 2025-12-04T07:56:47.5363268Z ) 2025-12-04T07:56:47.5363647Z default: bool = ( 2025-12-04T07:56:47.5364451Z True # If True, the experiment is enabled by default for all queries 2025-12-04T07:56:47.5365191Z ) 2025-12-04T07:56:47.5365400Z 2025-12-04T07:56:47.5365599Z # Add more fields as needed 2025-12-04T07:56:47.5365920Z 2025-12-04T07:56:47.5365927Z 2025-12-04T07:56:47.5366122Z class Settings(NamedTuple): 2025-12-04T07:56:47.5366587Z """ 2025-12-04T07:56:47.5367057Z Settings for the experiments that can be opted into. 2025-12-04T07:56:47.5367654Z """ 2025-12-04T07:56:47.5367858Z 2025-12-04T07:56:47.5368071Z experiments: dict[str, Experiment] = {} 2025-12-04T07:56:47.5368447Z 2025-12-04T07:56:47.5368460Z 2025-12-04T07:56:47.5368677Z class ColorFormatter(logging.Formatter): 2025-12-04T07:56:47.5369325Z """Color codes the log messages based on the log level""" 2025-12-04T07:56:47.5369777Z 2025-12-04T07:56:47.5369946Z COLORS = { 2025-12-04T07:56:47.5370373Z "WARNING": "\033[33m", # Yellow 2025-12-04T07:56:47.5371063Z "ERROR": "\033[31m", # Red 2025-12-04T07:56:47.5371621Z "CRITICAL": "\033[31m", # Red 2025-12-04T07:56:47.5372144Z "INFO": "\033[0m", # Reset 2025-12-04T07:56:47.5372648Z "DEBUG": "\033[0m", # Reset 2025-12-04T07:56:47.5373132Z } 2025-12-04T07:56:47.5373345Z 2025-12-04T07:56:47.5373571Z def format(self, record: LogRecord) -> str: 2025-12-04T07:56:47.5374578Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-12-04T07:56:47.5375410Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-12-04T07:56:47.5376016Z return super().format(record) 2025-12-04T07:56:47.5376368Z 2025-12-04T07:56:47.5376374Z 2025-12-04T07:56:47.5376576Z handler = logging.StreamHandler() 2025-12-04T07:56:47.5377310Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-12-04T07:56:47.5377883Z 2025-12-04T07:56:47.5378141Z log = logging.getLogger(os.path.basename(__file__)) 2025-12-04T07:56:47.5378758Z log.addHandler(handler) 2025-12-04T07:56:47.5379267Z log.setLevel(logging.INFO) 2025-12-04T07:56:47.5379571Z 2025-12-04T07:56:47.5379578Z 2025-12-04T07:56:47.5379832Z def set_github_output(key: str, value: str) -> None: 2025-12-04T07:56:47.5380420Z """ 2025-12-04T07:56:47.5380939Z Defines outputs of the github action that invokes this script 2025-12-04T07:56:47.5381585Z """ 2025-12-04T07:56:47.5381967Z if not GITHUB_OUTPUT: 2025-12-04T07:56:47.5383057Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-12-04T07:56:47.5384405Z log.warning( 2025-12-04T07:56:47.5385303Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-12-04T07:56:47.5386266Z ) 2025-12-04T07:56:47.5396000Z print(f"::set-output name={key}::{value}") 2025-12-04T07:56:47.5396648Z return 2025-12-04T07:56:47.5396902Z 2025-12-04T07:56:47.5397285Z with open(GITHUB_OUTPUT, "a") as f: 2025-12-04T07:56:47.5397919Z log.info(f"Setting output: {key}='{value}'") 2025-12-04T07:56:47.5398517Z f.write(f"{key}={value}\n") 2025-12-04T07:56:47.5398864Z 2025-12-04T07:56:47.5398871Z 2025-12-04T07:56:47.5399179Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-12-04T07:56:47.5399843Z return frozenset( 2025-12-04T07:56:47.5400473Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-12-04T07:56:47.5401178Z ) 2025-12-04T07:56:47.5401388Z 2025-12-04T07:56:47.5401395Z 2025-12-04T07:56:47.5401586Z def parse_args() -> Any: 2025-12-04T07:56:47.5402155Z parser = ArgumentParser("Get dynamic rollout settings") 2025-12-04T07:56:47.5403026Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-12-04T07:56:47.5403801Z parser.add_argument( 2025-12-04T07:56:47.5404502Z "--github-issue-repo", 2025-12-04T07:56:47.5405012Z type=str, 2025-12-04T07:56:47.5405442Z required=False, 2025-12-04T07:56:47.5405895Z default="pytorch/test-infra", 2025-12-04T07:56:47.5406445Z help="GitHub repo to get the issue", 2025-12-04T07:56:47.5406965Z ) 2025-12-04T07:56:47.5407354Z parser.add_argument( 2025-12-04T07:56:47.5407815Z "--github-repo", 2025-12-04T07:56:47.5408262Z type=str, 2025-12-04T07:56:47.5408673Z required=True, 2025-12-04T07:56:47.5409150Z help="GitHub repo where CI is running", 2025-12-04T07:56:47.5409682Z ) 2025-12-04T07:56:47.5410062Z parser.add_argument( 2025-12-04T07:56:47.5410680Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-12-04T07:56:47.5411340Z ) 2025-12-04T07:56:47.5411726Z parser.add_argument( 2025-12-04T07:56:47.5412357Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-12-04T07:56:47.5413041Z ) 2025-12-04T07:56:47.5468363Z parser.add_argument( 2025-12-04T07:56:47.5469444Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-12-04T07:56:47.5470171Z ) 2025-12-04T07:56:47.5470577Z parser.add_argument( 2025-12-04T07:56:47.5471281Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-12-04T07:56:47.5472042Z ) 2025-12-04T07:56:47.5472436Z parser.add_argument( 2025-12-04T07:56:47.5472921Z "--github-ref-type", 2025-12-04T07:56:47.5473401Z type=str, 2025-12-04T07:56:47.5473810Z required=True, 2025-12-04T07:56:47.5474452Z help="Current GitHub ref type, branch or tag", 2025-12-04T07:56:47.5475036Z ) 2025-12-04T07:56:47.5475424Z parser.add_argument( 2025-12-04T07:56:47.5475905Z "--eligible-experiments", 2025-12-04T07:56:47.5476440Z type=_str_comma_separated_to_set, 2025-12-04T07:56:47.5476979Z required=False, 2025-12-04T07:56:47.5477436Z default="", 2025-12-04T07:56:47.5478300Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-12-04T07:56:47.5479291Z ) 2025-12-04T07:56:47.5479699Z parser.add_argument( 2025-12-04T07:56:47.5480170Z "--opt-out-experiments", 2025-12-04T07:56:47.5480689Z type=_str_comma_separated_to_set, 2025-12-04T07:56:47.5481220Z required=False, 2025-12-04T07:56:47.5481668Z default="", 2025-12-04T07:56:47.5482079Z help=( 2025-12-04T07:56:47.5482764Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-12-04T07:56:47.5483911Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-12-04T07:56:47.5484858Z ), 2025-12-04T07:56:47.5485241Z ) 2025-12-04T07:56:47.5485622Z parser.add_argument( 2025-12-04T07:56:47.5486080Z "--pr-number", 2025-12-04T07:56:47.5486503Z type=str, 2025-12-04T07:56:47.5486925Z required=False, 2025-12-04T07:56:47.5487379Z default="", 2025-12-04T07:56:47.5488009Z help="the optional PR number where this is run", 2025-12-04T07:56:47.5488591Z ) 2025-12-04T07:56:47.5488806Z 2025-12-04T07:56:47.5489008Z return parser.parse_args() 2025-12-04T07:56:47.5489320Z 2025-12-04T07:56:47.5489327Z 2025-12-04T07:56:47.5489744Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-12-04T07:56:47.5490525Z auth = Auth.Token(github_token) 2025-12-04T07:56:47.5491063Z return Github(auth=auth) 2025-12-04T07:56:47.5491367Z 2025-12-04T07:56:47.5491374Z 2025-12-04T07:56:47.5491824Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-12-04T07:56:47.5492636Z repo = gh.get_repo(repo) 2025-12-04T07:56:47.5493154Z return repo.get_issue(number=issue_num) 2025-12-04T07:56:47.5493529Z 2025-12-04T07:56:47.5493536Z 2025-12-04T07:56:47.5493734Z def get_potential_pr_author( 2025-12-04T07:56:47.5494509Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-12-04T07:56:47.5495212Z ) -> str: 2025-12-04T07:56:47.5495746Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-12-04T07:56:47.5496558Z # Fetch the actual username from the original PR. The PR number is 2025-12-04T07:56:47.5497313Z # embedded in the tag name: ciflow// 2025-12-04T07:56:47.5497730Z 2025-12-04T07:56:47.5497926Z gh = get_gh_client(github_token) 2025-12-04T07:56:47.5498271Z 2025-12-04T07:56:47.5498544Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-12-04T07:56:47.5499187Z split_tag = ref_name.split("/") 2025-12-04T07:56:47.5499703Z if ( 2025-12-04T07:56:47.5500110Z len(split_tag) == 3 2025-12-04T07:56:47.5500605Z and split_tag[0] == "ciflow" 2025-12-04T07:56:47.5501150Z and split_tag[2].isnumeric() 2025-12-04T07:56:47.5501657Z ): 2025-12-04T07:56:47.5502054Z pr_number = split_tag[2] 2025-12-04T07:56:47.5502704Z try: 2025-12-04T07:56:47.5503158Z repository = gh.get_repo(repo) 2025-12-04T07:56:47.5503781Z pull = repository.get_pull(number=int(pr_number)) 2025-12-04T07:56:47.5504713Z except Exception as e: 2025-12-04T07:56:47.5505269Z raise Exception( # noqa: TRY002 2025-12-04T07:56:47.5505943Z f"issue with pull request {pr_number} from repo {repository}" 2025-12-04T07:56:47.5506602Z ) from e 2025-12-04T07:56:47.5507149Z return pull.user.login # type: ignore[no-any-return] 2025-12-04T07:56:47.5507856Z # In all other cases, return the original input username 2025-12-04T07:56:47.5508448Z return username 2025-12-04T07:56:47.5508702Z 2025-12-04T07:56:47.5508709Z 2025-12-04T07:56:47.5508938Z def is_exception_branch(branch: str) -> bool: 2025-12-04T07:56:47.5509483Z """ 2025-12-04T07:56:47.5510128Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-12-04T07:56:47.5510923Z """ 2025-12-04T07:56:47.5511487Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-12-04T07:56:47.5512015Z 2025-12-04T07:56:47.5512021Z 2025-12-04T07:56:47.5512227Z def load_yaml(yaml_text: str) -> Any: 2025-12-04T07:56:47.5512741Z try: 2025-12-04T07:56:47.5513140Z data = yaml.safe_load(yaml_text) 2025-12-04T07:56:47.5513668Z return data 2025-12-04T07:56:47.5514107Z except yaml.YAMLError: 2025-12-04T07:56:47.5514779Z log.exception("Error loading YAML") 2025-12-04T07:56:47.5515310Z raise 2025-12-04T07:56:47.5515541Z 2025-12-04T07:56:47.5515548Z 2025-12-04T07:56:47.5515978Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-12-04T07:56:47.5516729Z """ 2025-12-04T07:56:47.5517367Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-12-04T07:56:47.5517969Z 2025-12-04T07:56:47.5518485Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:47.5519258Z and the text below is the list of opted in users. 2025-12-04T07:56:47.5519674Z 2025-12-04T07:56:47.5520055Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-12-04T07:56:47.5520753Z """ 2025-12-04T07:56:47.5521209Z rollout_state_parts = rollout_state.split("---") 2025-12-04T07:56:47.5521849Z if len(rollout_state_parts) >= 2: 2025-12-04T07:56:47.5522467Z return rollout_state_parts[0], rollout_state_parts[1] 2025-12-04T07:56:47.5523080Z else: 2025-12-04T07:56:47.5523472Z return "", rollout_state 2025-12-04T07:56:47.5523788Z 2025-12-04T07:56:47.5523795Z 2025-12-04T07:56:47.5524012Z class UserOptins(dict[str, list[str]]): 2025-12-04T07:56:47.5524655Z """ 2025-12-04T07:56:47.5525200Z Dictionary of users with a list of features they have opted into 2025-12-04T07:56:47.5525868Z """ 2025-12-04T07:56:47.5526090Z 2025-12-04T07:56:47.5526097Z 2025-12-04T07:56:47.5526442Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-12-04T07:56:47.5527114Z """ 2025-12-04T07:56:47.5527834Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-12-04T07:56:47.5528517Z 2025-12-04T07:56:47.5529156Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-12-04T07:56:47.5530162Z - Example line: "@User1,lf,split_build" 2025-12-04T07:56:47.5530867Z - A "#" prefix indicates the user is opted out of all experiments 2025-12-04T07:56:47.5531356Z 2025-12-04T07:56:47.5531362Z 2025-12-04T07:56:47.5531537Z """ 2025-12-04T07:56:47.5531928Z optins = UserOptins() 2025-12-04T07:56:47.5532445Z for user in user_optin_text.split("\n"): 2025-12-04T07:56:47.5533018Z user = user.strip("\r\n\t -") 2025-12-04T07:56:47.5533589Z if not user or not user.startswith("@"): 2025-12-04T07:56:47.5534413Z # Not a valid user. Skip 2025-12-04T07:56:47.5534935Z continue 2025-12-04T07:56:47.5535189Z 2025-12-04T07:56:47.5535360Z if user: 2025-12-04T07:56:47.5535819Z usr_name = user.split(",")[0].strip("@") 2025-12-04T07:56:47.5536534Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-12-04T07:56:47.5537032Z 2025-12-04T07:56:47.5537203Z return optins 2025-12-04T07:56:47.5537452Z 2025-12-04T07:56:47.5537460Z 2025-12-04T07:56:47.5537763Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-12-04T07:56:47.5538377Z """ 2025-12-04T07:56:47.5538807Z Check if the experiment name is valid. 2025-12-04T07:56:47.5539351Z A valid name: 2025-12-04T07:56:47.5540002Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-12-04T07:56:47.5540985Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-12-04T07:56:47.5541731Z - Cannot contain spaces 2025-12-04T07:56:47.5542211Z """ 2025-12-04T07:56:47.5542418Z 2025-12-04T07:56:47.5542692Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-12-04T07:56:47.5543411Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-12-04T07:56:47.5543866Z 2025-12-04T07:56:47.5544034Z if valid: 2025-12-04T07:56:47.5544726Z return True 2025-12-04T07:56:47.5544990Z 2025-12-04T07:56:47.5545166Z log.error( 2025-12-04T07:56:47.5546657Z 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-12-04T07:56:47.5548226Z ) 2025-12-04T07:56:47.5548611Z return False 2025-12-04T07:56:47.5548861Z 2025-12-04T07:56:47.5548867Z 2025-12-04T07:56:47.5549175Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-12-04T07:56:47.5549824Z """ 2025-12-04T07:56:47.5550579Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-12-04T07:56:47.5551351Z """ 2025-12-04T07:56:47.5551723Z try: 2025-12-04T07:56:47.5552116Z if settings_text: 2025-12-04T07:56:47.5552847Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-12-04T07:56:47.5553674Z # for easy reading 2025-12-04T07:56:47.5554598Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-12-04T07:56:47.5555518Z # the backtick character in shell commands. 2025-12-04T07:56:47.5556139Z backtick = chr(96) # backtick character 2025-12-04T07:56:47.5556832Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-12-04T07:56:47.5557525Z settings = load_yaml(settings_text) 2025-12-04T07:56:47.5557911Z 2025-12-04T07:56:47.5558336Z # For now we just load experiments. We can expand this if/when we add more settings 2025-12-04T07:56:47.5559128Z experiments = {} 2025-12-04T07:56:47.5559433Z 2025-12-04T07:56:47.5559829Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-12-04T07:56:47.5560624Z if not is_valid_experiment_name(exp_name): 2025-12-04T07:56:47.5561753Z # 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-12-04T07:56:47.5562822Z continue 2025-12-04T07:56:47.5563120Z 2025-12-04T07:56:47.5563324Z valid_settings = {} 2025-12-04T07:56:47.5563856Z for setting in exp_settings: 2025-12-04T07:56:47.5564546Z if setting not in Experiment._fields: 2025-12-04T07:56:47.5565116Z log.warning( 2025-12-04T07:56:47.5565844Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-12-04T07:56:47.5566771Z ) 2025-12-04T07:56:47.5567220Z else: 2025-12-04T07:56:47.5567754Z valid_settings[setting] = exp_settings[setting] 2025-12-04T07:56:47.5568187Z 2025-12-04T07:56:47.5568477Z experiments[exp_name] = Experiment(**valid_settings) 2025-12-04T07:56:47.5569129Z return Settings(experiments) 2025-12-04T07:56:47.5569502Z 2025-12-04T07:56:47.5569687Z except Exception: 2025-12-04T07:56:47.5570183Z log.exception("Failed to parse settings") 2025-12-04T07:56:47.5570584Z 2025-12-04T07:56:47.5570768Z return Settings() 2025-12-04T07:56:47.5571032Z 2025-12-04T07:56:47.5571039Z 2025-12-04T07:56:47.5571291Z def parse_settings(rollout_state: str) -> Settings: 2025-12-04T07:56:47.5571890Z """ 2025-12-04T07:56:47.5572345Z Parse settings, if any, from the rollout state. 2025-12-04T07:56:47.5572763Z 2025-12-04T07:56:47.5573121Z If the issue body contains "---" then the text above that is the settings 2025-12-04T07:56:47.5573907Z and the text below is the list of opted in users. 2025-12-04T07:56:47.5574425Z 2025-12-04T07:56:47.5574850Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-12-04T07:56:47.5575606Z """ 2025-12-04T07:56:47.5576173Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:47.5576964Z return parse_settings_from_text(settings_text) 2025-12-04T07:56:47.5577372Z 2025-12-04T07:56:47.5577378Z 2025-12-04T07:56:47.5577626Z def parse_users(rollout_state: str) -> UserOptins: 2025-12-04T07:56:47.5578213Z """ 2025-12-04T07:56:47.5578618Z Parse users from the rollout state. 2025-12-04T07:56:47.5578993Z 2025-12-04T07:56:47.5579191Z """ 2025-12-04T07:56:47.5579741Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-12-04T07:56:47.5580507Z return parse_user_opt_in_from_text(users_text) 2025-12-04T07:56:47.5580926Z 2025-12-04T07:56:47.5580932Z 2025-12-04T07:56:47.5581502Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:47.5582283Z """ 2025-12-04T07:56:47.5582722Z Check if a user is opted into an experiment 2025-12-04T07:56:47.5583272Z """ 2025-12-04T07:56:47.5583741Z return experiment_name in user_optins.get(user, []) 2025-12-04T07:56:47.5584173Z 2025-12-04T07:56:47.5584365Z 2025-12-04T07:56:47.5584931Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-12-04T07:56:47.5585715Z """ 2025-12-04T07:56:47.5586293Z Check if a user explicitly opted out of an experiment 2025-12-04T07:56:47.5586897Z """ 2025-12-04T07:56:47.5587422Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-12-04T07:56:47.5588115Z experiment_optout = "-" + experiment_name 2025-12-04T07:56:47.5588773Z if experiment_optout not in user_optins.get(user, []): 2025-12-04T07:56:47.5589400Z return False 2025-12-04T07:56:47.5589659Z 2025-12-04T07:56:47.5589945Z if is_user_opted_in(user, user_optins, experiment_name): 2025-12-04T07:56:47.5590574Z log.warning( 2025-12-04T07:56:47.5591390Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-12-04T07:56:47.5592290Z ) 2025-12-04T07:56:47.5592508Z 2025-12-04T07:56:47.5592688Z return True 2025-12-04T07:56:47.5592941Z 2025-12-04T07:56:47.5592947Z 2025-12-04T07:56:47.5593133Z def get_runner_prefix( 2025-12-04T07:56:47.5593590Z rollout_state: str, 2025-12-04T07:56:47.5594073Z workflow_requestors: Iterable[str], 2025-12-04T07:56:47.5595094Z branch: str, 2025-12-04T07:56:47.5595611Z eligible_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:47.5596298Z opt_out_experiments: frozenset[str] = frozenset(), 2025-12-04T07:56:47.5596900Z is_canary: bool = False, 2025-12-04T07:56:47.5597384Z ) -> str: 2025-12-04T07:56:47.5597980Z settings = parse_settings(rollout_state) 2025-12-04T07:56:47.5598585Z user_optins = parse_users(rollout_state) 2025-12-04T07:56:47.5598960Z 2025-12-04T07:56:47.5599146Z fleet_prefix = "" 2025-12-04T07:56:47.5599583Z prefixes = [] 2025-12-04T07:56:47.5600218Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-12-04T07:56:47.5601169Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-12-04T07:56:47.5601902Z log.info( 2025-12-04T07:56:47.5602595Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-12-04T07:56:47.5603367Z ) 2025-12-04T07:56:47.5603761Z continue 2025-12-04T07:56:47.5604017Z 2025-12-04T07:56:47.5604321Z if opt_out_experiments: 2025-12-04T07:56:47.5604879Z if experiment_name in opt_out_experiments: 2025-12-04T07:56:47.5605529Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-12-04T07:56:47.5606144Z log.info( 2025-12-04T07:56:47.5607090Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-12-04T07:56:47.5608088Z ) 2025-12-04T07:56:47.5608497Z continue 2025-12-04T07:56:47.5608773Z 2025-12-04T07:56:47.5608970Z if eligible_experiments: 2025-12-04T07:56:47.5609566Z if experiment_name not in eligible_experiments: 2025-12-04T07:56:47.5610210Z exp_list = ", ".join(eligible_experiments) 2025-12-04T07:56:47.5610788Z log.info( 2025-12-04T07:56:47.5611580Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-12-04T07:56:47.5612438Z ) 2025-12-04T07:56:47.5612838Z continue 2025-12-04T07:56:47.5613324Z elif not experiment_settings.default: 2025-12-04T07:56:47.5613875Z log.info( 2025-12-04T07:56:47.5614766Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-12-04T07:56:47.5615539Z ) 2025-12-04T07:56:47.5615926Z continue 2025-12-04T07:56:47.5616185Z 2025-12-04T07:56:47.5616464Z # Is any workflow_requestor opted out to this experiment? 2025-12-04T07:56:47.5617096Z opted_out_users = [ 2025-12-04T07:56:47.5617556Z requestor 2025-12-04T07:56:47.5618023Z for requestor in workflow_requestors 2025-12-04T07:56:47.5618704Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-12-04T07:56:47.5619353Z ] 2025-12-04T07:56:47.5619563Z 2025-12-04T07:56:47.5619750Z if opted_out_users: 2025-12-04T07:56:47.5620214Z log.info( 2025-12-04T07:56:47.5620840Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-12-04T07:56:47.5621551Z ) 2025-12-04T07:56:47.5621945Z continue 2025-12-04T07:56:47.5622206Z 2025-12-04T07:56:47.5622505Z # Is any workflow_requestor opted in to this experiment? 2025-12-04T07:56:47.5623153Z opted_in_users = [ 2025-12-04T07:56:47.5623608Z requestor 2025-12-04T07:56:47.5624072Z for requestor in workflow_requestors 2025-12-04T07:56:47.5624853Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-12-04T07:56:47.5625482Z ] 2025-12-04T07:56:47.5625694Z 2025-12-04T07:56:47.5625870Z enabled = False 2025-12-04T07:56:47.5626312Z if opted_in_users: 2025-12-04T07:56:47.5626758Z log.info( 2025-12-04T07:56:47.5627381Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-12-04T07:56:47.5628072Z ) 2025-12-04T07:56:47.5628472Z enabled = True 2025-12-04T07:56:47.5628754Z 2025-12-04T07:56:47.5628979Z elif experiment_settings.rollout_perc: 2025-12-04T07:56:47.5629826Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-12-04T07:56:47.5630915Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-12-04T07:56:47.5631586Z log.info( 2025-12-04T07:56:47.5632465Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-12-04T07:56:47.5633406Z ) 2025-12-04T07:56:47.5633827Z enabled = True 2025-12-04T07:56:47.5634126Z 2025-12-04T07:56:47.5634402Z if enabled: 2025-12-04T07:56:47.5634838Z label = experiment_name 2025-12-04T07:56:47.5635407Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-12-04T07:56:47.5636261Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-12-04T07:56:47.5637170Z # - If it's enabled, then we always list it's prefix first 2025-12-04T07:56:47.5637960Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-12-04T07:56:47.5638653Z if is_canary: 2025-12-04T07:56:47.5639160Z label += CANARY_FLEET_SUFFIX 2025-12-04T07:56:47.5639715Z fleet_prefix = label 2025-12-04T07:56:47.5640225Z else: 2025-12-04T07:56:47.5640656Z prefixes.append(label) 2025-12-04T07:56:47.5641015Z 2025-12-04T07:56:47.5641201Z if len(prefixes) > 1: 2025-12-04T07:56:47.5641658Z log.error( 2025-12-04T07:56:47.5642706Z 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-12-04T07:56:47.5643846Z ) 2025-12-04T07:56:47.5644341Z prefixes = prefixes[:1] 2025-12-04T07:56:47.5644664Z 2025-12-04T07:56:47.5644867Z # Fleet always comes first 2025-12-04T07:56:47.5645350Z if fleet_prefix: 2025-12-04T07:56:47.5645811Z prefixes.insert(0, fleet_prefix) 2025-12-04T07:56:47.5646187Z 2025-12-04T07:56:47.5646558Z return ".".join(prefixes) + "." if prefixes else "" 2025-12-04T07:56:47.5646998Z 2025-12-04T07:56:47.5647006Z 2025-12-04T07:56:47.5647464Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-12-04T07:56:47.5648256Z """ 2025-12-04T07:56:47.5648859Z Gets the first comment of the issue, which contains the desired rollout state. 2025-12-04T07:56:47.5649427Z 2025-12-04T07:56:47.5649828Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-12-04T07:56:47.5650540Z """ 2025-12-04T07:56:47.5650946Z gh = get_gh_client(github_token) 2025-12-04T07:56:47.5651495Z issue = get_issue(gh, repo, issue_num) 2025-12-04T07:56:47.5652143Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-12-04T07:56:47.5652597Z 2025-12-04T07:56:47.5652605Z 2025-12-04T07:56:47.5653013Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-12-04T07:56:47.5653779Z for _ in range(num_retries): 2025-12-04T07:56:47.5654365Z try: 2025-12-04T07:56:47.5654818Z req = Request(url=url, headers=headers) 2025-12-04T07:56:47.5655501Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-12-04T07:56:47.5656163Z return json.loads(content) 2025-12-04T07:56:47.5656712Z except Exception as e: 2025-12-04T07:56:47.5657258Z log.warning(f"Could not download {url}: {e}") 2025-12-04T07:56:47.5657674Z 2025-12-04T07:56:47.5658058Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-12-04T07:56:47.5658783Z return {} 2025-12-04T07:56:47.5659016Z 2025-12-04T07:56:47.5659023Z 2025-12-04T07:56:47.5659194Z @cache 2025-12-04T07:56:47.5659822Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-12-04T07:56:47.5660596Z """ 2025-12-04T07:56:47.5661001Z Dynamically get PR information 2025-12-04T07:56:47.5661630Z """ 2025-12-04T07:56:47.5662150Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-12-04T07:56:47.5662795Z headers = { 2025-12-04T07:56:47.5663262Z "Accept": "application/vnd.github.v3+json", 2025-12-04T07:56:47.5663884Z "Authorization": f"token {github_token}", 2025-12-04T07:56:47.5664538Z } 2025-12-04T07:56:47.5664979Z json_response: dict[str, Any] = download_json( 2025-12-04T07:56:47.5665594Z url=f"{github_api}/issues/{pr_number}", 2025-12-04T07:56:47.5666156Z headers=headers, 2025-12-04T07:56:47.5666592Z ) 2025-12-04T07:56:47.5666805Z 2025-12-04T07:56:47.5666996Z if not json_response: 2025-12-04T07:56:47.5667569Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-12-04T07:56:47.5668197Z return {} 2025-12-04T07:56:47.5668444Z 2025-12-04T07:56:47.5668631Z return json_response 2025-12-04T07:56:47.5668910Z 2025-12-04T07:56:47.5668917Z 2025-12-04T07:56:47.5669317Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-12-04T07:56:47.5670077Z """ 2025-12-04T07:56:47.5670616Z Dynamically get the latest list of labels from the pull request 2025-12-04T07:56:47.5671288Z """ 2025-12-04T07:56:47.5671787Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-12-04T07:56:47.5672413Z return { 2025-12-04T07:56:47.5673031Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-12-04T07:56:47.5673756Z } 2025-12-04T07:56:47.5673960Z 2025-12-04T07:56:47.5673972Z 2025-12-04T07:56:47.5674151Z def main() -> None: 2025-12-04T07:56:47.5674679Z args = parse_args() 2025-12-04T07:56:47.5674965Z 2025-12-04T07:56:47.5675190Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-12-04T07:56:47.5675587Z 2025-12-04T07:56:47.5675791Z # Check if the PR is opt-out 2025-12-04T07:56:47.5676287Z if args.pr_number: 2025-12-04T07:56:47.5676961Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-12-04T07:56:47.5677865Z if OPT_OUT_LABEL in labels: 2025-12-04T07:56:47.5678400Z log.info( 2025-12-04T07:56:47.5679133Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-12-04T07:56:47.5679928Z ) 2025-12-04T07:56:47.5680488Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:47.5681180Z sys.exit() 2025-12-04T07:56:47.5681443Z 2025-12-04T07:56:47.5681619Z try: 2025-12-04T07:56:47.5682061Z rollout_state = get_rollout_state_from_issue( 2025-12-04T07:56:47.5682785Z args.github_token, args.github_issue_repo, args.github_issue 2025-12-04T07:56:47.5683436Z ) 2025-12-04T07:56:47.5683659Z 2025-12-04T07:56:47.5683871Z username = get_potential_pr_author( 2025-12-04T07:56:47.5684521Z args.github_token, 2025-12-04T07:56:47.5685018Z args.github_repo, 2025-12-04T07:56:47.5685508Z args.github_actor, 2025-12-04T07:56:47.5686008Z args.github_ref_type, 2025-12-04T07:56:47.5686525Z args.github_branch, 2025-12-04T07:56:47.5687000Z ) 2025-12-04T07:56:47.5687214Z 2025-12-04T07:56:47.5687510Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-12-04T07:56:47.5687970Z 2025-12-04T07:56:47.5688193Z runner_label_prefix = get_runner_prefix( 2025-12-04T07:56:47.5688776Z rollout_state, 2025-12-04T07:56:47.5689272Z (args.github_issue_owner, username), 2025-12-04T07:56:47.5689844Z args.github_branch, 2025-12-04T07:56:47.5690352Z args.eligible_experiments, 2025-12-04T07:56:47.5690914Z args.opt_out_experiments, 2025-12-04T07:56:47.5691438Z is_canary, 2025-12-04T07:56:47.5691862Z ) 2025-12-04T07:56:47.5692073Z 2025-12-04T07:56:47.5692268Z except Exception as e: 2025-12-04T07:56:47.5692729Z log.error( 2025-12-04T07:56:47.5693405Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-12-04T07:56:47.5694416Z ) 2025-12-04T07:56:47.5694645Z 2025-12-04T07:56:47.5694979Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-12-04T07:56:47.5695487Z 2025-12-04T07:56:47.5695493Z 2025-12-04T07:56:47.5695688Z if __name__ == "__main__": 2025-12-04T07:56:47.5696136Z main() 2025-12-04T07:56:47.5696352Z 2025-12-04T07:56:47.5788502Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:47.5789401Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-12-04T07:56:47.5822495Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:47.5822994Z env: 2025-12-04T07:56:47.5823620Z GITHUB_TOKEN: *** 2025-12-04T07:56:47.5824067Z ISSUE_NUMBER: 5132 2025-12-04T07:56:47.5824885Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:47.5825426Z ISSUE_OWNER: 2025-12-04T07:56:47.5825852Z CHECK_EXPERIMENTS: 2025-12-04T07:56:47.5826297Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T07:56:47.5826775Z PR_NUMBER: 2025-12-04T07:56:47.5827192Z ##[endgroup] 2025-12-04T07:56:48.4998659Z Defaulting to user installation because normal site-packages is not writeable 2025-12-04T07:56:49.2516077Z Collecting urllib3==1.26.18 2025-12-04T07:56:49.3483053Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-12-04T07:56:49.3836876Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 2.1 MB/s eta 0:00:00 2025-12-04T07:56:49.4190825Z Collecting PyGithub==2.3.0 2025-12-04T07:56:49.4381886Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-12-04T07:56:49.5040237Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-12-04T07:56:49.5231020Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.8 kB) 2025-12-04T07:56:49.5288627Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-12-04T07:56:49.5308996Z 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-12-04T07:56:49.5326249Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-12-04T07:56:49.5734504Z Collecting Deprecated (from PyGithub==2.3.0) 2025-12-04T07:56:49.5921947Z Downloading deprecated-1.3.1-py2.py3-none-any.whl.metadata (5.9 kB) 2025-12-04T07:56:49.6148480Z 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-12-04T07:56:49.7797507Z Collecting cffi>=2.0.0 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:49.7986658Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-12-04T07:56:49.9814744Z Collecting wrapt<3,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-12-04T07:56:50.0004015Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (9.0 kB) 2025-12-04T07:56:50.0369153Z Collecting pycparser (from cffi>=2.0.0->pynacl>=1.4.0->PyGithub==2.3.0) 2025-12-04T07:56:50.0554538Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-12-04T07:56:50.0958181Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-12-04T07:56:50.1191810Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 6.4 MB/s eta 0:00:00 2025-12-04T07:56:50.1389026Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-12-04T07:56:50.1614810Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 16.7 MB/s eta 0:00:00 2025-12-04T07:56:50.1801251Z Downloading pynacl-1.6.1-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-12-04T07:56:50.2099910Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 50.1 MB/s eta 0:00:00 2025-12-04T07:56:50.2289946Z Downloading deprecated-1.3.1-py2.py3-none-any.whl (11 kB) 2025-12-04T07:56:50.2501265Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-12-04T07:56:50.2554151Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 61.7 MB/s eta 0:00:00 2025-12-04T07:56:50.2740352Z Downloading wrapt-2.0.1-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (121 kB) 2025-12-04T07:56:50.2785336Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.5/121.5 kB 42.4 MB/s eta 0:00:00 2025-12-04T07:56:50.2972024Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-12-04T07:56:50.3033721Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 24.6 MB/s eta 0:00:00 2025-12-04T07:56:50.6025370Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-12-04T07:56:51.1373098Z Successfully installed Deprecated-1.3.1 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.1 urllib3-1.26.18 wrapt-2.0.1 2025-12-04T07:56:51.2257268Z ##[group]Run curr_branch="main" 2025-12-04T07:56:51.2257572Z curr_branch="main" 2025-12-04T07:56:51.2257781Z curr_ref_type="branch" 2025-12-04T07:56:51.2258030Z echo "Current branch is '$curr_branch'" 2025-12-04T07:56:51.2258324Z  2025-12-04T07:56:51.2258510Z python3 runner_determinator.py \ 2025-12-04T07:56:51.2258779Z  --github-token "$GITHUB_TOKEN" \ 2025-12-04T07:56:51.2259052Z  --github-issue "$ISSUE_NUMBER" \ 2025-12-04T07:56:51.2259308Z  --github-branch "$curr_branch" \ 2025-12-04T07:56:51.2259568Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-12-04T07:56:51.2259846Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-12-04T07:56:51.2260114Z  --github-ref-type "$curr_ref_type" \ 2025-12-04T07:56:51.2260386Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-12-04T07:56:51.2260677Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-12-04T07:56:51.2261042Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-12-04T07:56:51.2261333Z  --pr-number "${PR_NUMBER}" 2025-12-04T07:56:51.2295360Z shell: /usr/bin/bash -e {0} 2025-12-04T07:56:51.2295586Z env: 2025-12-04T07:56:51.2296155Z GITHUB_TOKEN: *** 2025-12-04T07:56:51.2296340Z ISSUE_NUMBER: 5132 2025-12-04T07:56:51.2296571Z TRIGGERING_ACTOR: pytorchmergebot 2025-12-04T07:56:51.2296792Z ISSUE_OWNER: 2025-12-04T07:56:51.2296966Z CHECK_EXPERIMENTS: 2025-12-04T07:56:51.2297155Z OPT_OUT_EXPERIMENTS: lf 2025-12-04T07:56:51.2297338Z PR_NUMBER: 2025-12-04T07:56:51.2297504Z ##[endgroup] 2025-12-04T07:56:51.2352087Z Current branch is 'main' 2025-12-04T07:56:52.9452525Z INFO : Skipping experiment 'lf', as this workflow has opted-out (opted out experiments are: lf) 2025-12-04T07:56:52.9453782Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-12-04T07:56:52.9454985Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-12-04T07:56:52.9455844Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-12-04T07:56:52.9456533Z INFO : Setting output: label-type='' 2025-12-04T07:56:52.9780182Z Evaluate and set job outputs 2025-12-04T07:56:52.9787144Z Cleaning up orphan processes