2025-10-10T00:01:08.3886625Z Current runner version: '2.328.0' 2025-10-10T00:01:08.3910093Z ##[group]Runner Image Provisioner 2025-10-10T00:01:08.3910898Z Hosted Compute Agent 2025-10-10T00:01:08.3911422Z Version: 20250912.392 2025-10-10T00:01:08.3912076Z Commit: d921fda672a98b64f4f82364647e2f10b2267d0b 2025-10-10T00:01:08.3912761Z Build Date: 2025-09-12T15:23:14Z 2025-10-10T00:01:08.3913319Z ##[endgroup] 2025-10-10T00:01:08.3913971Z ##[group]Operating System 2025-10-10T00:01:08.3914507Z Ubuntu 2025-10-10T00:01:08.3914995Z 24.04.3 2025-10-10T00:01:08.3915475Z LTS 2025-10-10T00:01:08.3915990Z ##[endgroup] 2025-10-10T00:01:08.3916441Z ##[group]Runner Image 2025-10-10T00:01:08.3917015Z Image: ubuntu-24.04 2025-10-10T00:01:08.3917593Z Version: 20250929.60.1 2025-10-10T00:01:08.3918704Z Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20250929.60/images/ubuntu/Ubuntu2404-Readme.md 2025-10-10T00:01:08.3920324Z Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20250929.60 2025-10-10T00:01:08.3921305Z ##[endgroup] 2025-10-10T00:01:08.3922427Z ##[group]GITHUB_TOKEN Permissions 2025-10-10T00:01:08.3924845Z Contents: read 2025-10-10T00:01:08.3925378Z Metadata: read 2025-10-10T00:01:08.3925885Z Packages: read 2025-10-10T00:01:08.3926323Z ##[endgroup] 2025-10-10T00:01:08.3928809Z Secret source: Actions 2025-10-10T00:01:08.3929654Z Prepare workflow directory 2025-10-10T00:01:08.4446131Z Prepare all required actions 2025-10-10T00:01:08.4501825Z Uses: pytorch/pytorch/.github/workflows/_runner-determinator.yml@refs/heads/main (344e6365a0068c2d2847fcec0c55dd53291d475e) 2025-10-10T00:01:08.4506737Z ##[group] Inputs 2025-10-10T00:01:08.4507326Z check_experiments: 2025-10-10T00:01:08.4507884Z opt_out_experiments: 2025-10-10T00:01:08.4508904Z triggering_actor: pytorchmergebot 2025-10-10T00:01:08.4509579Z issue_owner: 2025-10-10T00:01:08.4510095Z curr_branch: main 2025-10-10T00:01:08.4510667Z curr_ref_type: branch 2025-10-10T00:01:08.4511325Z issue_number: 5132 2025-10-10T00:01:08.4511839Z ##[endgroup] 2025-10-10T00:01:08.4512434Z Complete job name: get-label-type / runner-determinator 2025-10-10T00:01:08.5236094Z ##[group]Run cat < runner_determinator.py 2025-10-10T00:01:08.5239365Z cat < runner_determinator.py 2025-10-10T00:01:08.5240447Z # flake8: noqa: G004 2025-10-10T00:01:08.5241294Z  2025-10-10T00:01:08.5242584Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.5244423Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.5245952Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.5247284Z  2025-10-10T00:01:08.5247955Z """ 2025-10-10T00:01:08.5249279Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.5251115Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.5252998Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.5254713Z of which runners should be used to run which job. 2025-10-10T00:01:08.5255768Z  2025-10-10T00:01:08.5256918Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.5258981Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.5260644Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.5262123Z list, defined. 2025-10-10T00:01:08.5262974Z  2025-10-10T00:01:08.5264091Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.5265934Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.5267546Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.5269288Z  2025-10-10T00:01:08.5270503Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.5272502Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.5273977Z experiments which the user could be opted in to. 2025-10-10T00:01:08.5275112Z  2025-10-10T00:01:08.5275965Z The user list has the following rules: 2025-10-10T00:01:08.5276927Z  2025-10-10T00:01:08.5278280Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.5279902Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.5281408Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.5282636Z  2025-10-10T00:01:08.5283327Z Example config: 2025-10-10T00:01:08.5284275Z  # A list of experiments that can be opted into. 2025-10-10T00:01:08.5285767Z  # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.5287014Z  # Expected syntax is: 2025-10-10T00:01:08.5288532Z  # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.5290443Z  # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.5291909Z  2025-10-10T00:01:08.5292577Z  experiments: 2025-10-10T00:01:08.5293567Z  lf: 2025-10-10T00:01:08.5294361Z  rollout_percent: 25 2025-10-10T00:01:08.5295316Z  all_branches: false 2025-10-10T00:01:08.5296354Z  default: true 2025-10-10T00:01:08.5297222Z  --- 2025-10-10T00:01:08.5297968Z  2025-10-10T00:01:08.5299002Z  # Opt-ins: 2025-10-10T00:01:08.5300206Z  # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.5302086Z  # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.5303750Z  # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.5305098Z  # Experiments should be from the above list. 2025-10-10T00:01:08.5306130Z  2025-10-10T00:01:08.5307033Z  @User1,-lf,split_build 2025-10-10T00:01:08.5307953Z  @User2,lf 2025-10-10T00:01:08.5309249Z  @User3,split_build 2025-10-10T00:01:08.5310118Z """ 2025-10-10T00:01:08.5310894Z  2025-10-10T00:01:08.5311763Z import json 2025-10-10T00:01:08.5312561Z import logging 2025-10-10T00:01:08.5313504Z import os 2025-10-10T00:01:08.5314431Z import random 2025-10-10T00:01:08.5315295Z import re 2025-10-10T00:01:08.5316081Z import sys 2025-10-10T00:01:08.5317071Z from argparse import ArgumentParser 2025-10-10T00:01:08.5318411Z from collections.abc import Iterable 2025-10-10T00:01:08.5319447Z from functools import cache 2025-10-10T00:01:08.5320577Z from logging import LogRecord 2025-10-10T00:01:08.5321708Z from typing import Any, NamedTuple 2025-10-10T00:01:08.5322837Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.5324049Z  2025-10-10T00:01:08.5324750Z import yaml 2025-10-10T00:01:08.5325593Z from github import Auth, Github 2025-10-10T00:01:08.5326659Z from github.Issue import Issue 2025-10-10T00:01:08.5327686Z  2025-10-10T00:01:08.5328544Z  2025-10-10T00:01:08.5329516Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.5330909Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.5332522Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.5334277Z  2025-10-10T00:01:08.5335121Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.5336313Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.5337544Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.5338845Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.5339879Z  2025-10-10T00:01:08.5340756Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.5341738Z  2025-10-10T00:01:08.5342467Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.5343633Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.5344518Z  2025-10-10T00:01:08.5345220Z  2025-10-10T00:01:08.5346106Z class Experiment(NamedTuple): 2025-10-10T00:01:08.5347115Z  rollout_perc: float = ( 2025-10-10T00:01:08.5348654Z  0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.5350119Z  ) 2025-10-10T00:01:08.5350936Z  all_branches: bool = ( 2025-10-10T00:01:08.5352193Z  False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.5353578Z  ) 2025-10-10T00:01:08.5354347Z  default: bool = ( 2025-10-10T00:01:08.5355493Z  True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.5356906Z  ) 2025-10-10T00:01:08.5357595Z  2025-10-10T00:01:08.5358606Z  # Add more fields as needed 2025-10-10T00:01:08.5359748Z  2025-10-10T00:01:08.5360512Z  2025-10-10T00:01:08.5361226Z class Settings(NamedTuple): 2025-10-10T00:01:08.5362241Z  """ 2025-10-10T00:01:08.5363251Z  Settings for the experiments that can be opted into. 2025-10-10T00:01:08.5364350Z  """ 2025-10-10T00:01:08.5365182Z  2025-10-10T00:01:08.5365994Z  experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.5367151Z  2025-10-10T00:01:08.5368609Z  2025-10-10T00:01:08.5369606Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.5371013Z  """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.5372508Z  2025-10-10T00:01:08.5373410Z  COLORS = { 2025-10-10T00:01:08.5374389Z  "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.5375678Z  "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.5376712Z  "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.5377680Z  "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.5379618Z  "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.5380591Z  } 2025-10-10T00:01:08.5381324Z  2025-10-10T00:01:08.5382264Z  def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.5383816Z  log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.5385320Z  record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.5386605Z  return super().format(record) 2025-10-10T00:01:08.5387617Z  2025-10-10T00:01:08.5388572Z  2025-10-10T00:01:08.5389570Z handler = logging.StreamHandler() 2025-10-10T00:01:08.5390999Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.5392393Z  2025-10-10T00:01:08.5393433Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.5394618Z log.addHandler(handler) 2025-10-10T00:01:08.5395571Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.5396629Z  2025-10-10T00:01:08.5397400Z  2025-10-10T00:01:08.5398496Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.5399726Z  """ 2025-10-10T00:01:08.5400809Z  Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.5402287Z  """ 2025-10-10T00:01:08.5403266Z  if not GITHUB_OUTPUT: 2025-10-10T00:01:08.5405269Z  # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.5407366Z  log.warning( 2025-10-10T00:01:08.5409354Z  "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.5411060Z  ) 2025-10-10T00:01:08.5412082Z  print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.5413235Z  return 2025-10-10T00:01:08.5414061Z  2025-10-10T00:01:08.5414782Z  with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.5416145Z  log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.5417320Z  f.write(f"{key}={value}\n") 2025-10-10T00:01:08.5484229Z  2025-10-10T00:01:08.5484915Z  2025-10-10T00:01:08.5485854Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.5486959Z  return frozenset( 2025-10-10T00:01:08.5488248Z  filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.5489436Z  ) 2025-10-10T00:01:08.5490060Z  2025-10-10T00:01:08.5490611Z  2025-10-10T00:01:08.5491218Z def parse_args() -> Any: 2025-10-10T00:01:08.5492215Z  parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.5493727Z  parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.5495031Z  parser.add_argument( 2025-10-10T00:01:08.5495829Z  "--github-issue-repo", 2025-10-10T00:01:08.5496664Z  type=str, 2025-10-10T00:01:08.5497426Z  required=False, 2025-10-10T00:01:08.5498739Z  default="pytorch/test-infra", 2025-10-10T00:01:08.5499711Z  help="GitHub repo to get the issue", 2025-10-10T00:01:08.5500593Z  ) 2025-10-10T00:01:08.5501254Z  parser.add_argument( 2025-10-10T00:01:08.5502022Z  "--github-repo", 2025-10-10T00:01:08.5502782Z  type=str, 2025-10-10T00:01:08.5503493Z  required=True, 2025-10-10T00:01:08.5504349Z  help="GitHub repo where CI is running", 2025-10-10T00:01:08.5505244Z  ) 2025-10-10T00:01:08.5505880Z  parser.add_argument( 2025-10-10T00:01:08.5506962Z  "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.5508292Z  ) 2025-10-10T00:01:08.5508948Z  parser.add_argument( 2025-10-10T00:01:08.5510061Z  "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.5511250Z  ) 2025-10-10T00:01:08.5511911Z  parser.add_argument( 2025-10-10T00:01:08.5513049Z  "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.5514216Z  ) 2025-10-10T00:01:08.5514862Z  parser.add_argument( 2025-10-10T00:01:08.5516112Z  "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.5517337Z  ) 2025-10-10T00:01:08.5517964Z  parser.add_argument( 2025-10-10T00:01:08.5518980Z  "--github-ref-type", 2025-10-10T00:01:08.5519790Z  type=str, 2025-10-10T00:01:08.5520507Z  required=True, 2025-10-10T00:01:08.5521389Z  help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.5522334Z  ) 2025-10-10T00:01:08.5522986Z  parser.add_argument( 2025-10-10T00:01:08.5524051Z  "--eligible-experiments", 2025-10-10T00:01:08.5524957Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.5525857Z  required=False, 2025-10-10T00:01:08.5526648Z  default="", 2025-10-10T00:01:08.5528361Z  help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.5529965Z  ) 2025-10-10T00:01:08.5530619Z  parser.add_argument( 2025-10-10T00:01:08.5531464Z  "--opt-out-experiments", 2025-10-10T00:01:08.5532361Z  type=_str_comma_separated_to_set, 2025-10-10T00:01:08.5533258Z  required=False, 2025-10-10T00:01:08.5534041Z  default="", 2025-10-10T00:01:08.5534768Z  help=( 2025-10-10T00:01:08.5535940Z  "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.5537929Z  "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.5539550Z  ), 2025-10-10T00:01:08.5540206Z  ) 2025-10-10T00:01:08.5540857Z  parser.add_argument( 2025-10-10T00:01:08.5541644Z  "--pr-number", 2025-10-10T00:01:08.5542397Z  type=str, 2025-10-10T00:01:08.5543123Z  required=False, 2025-10-10T00:01:08.5543915Z  default="", 2025-10-10T00:01:08.5544791Z  help="the optional PR number where this is run", 2025-10-10T00:01:08.5545740Z  ) 2025-10-10T00:01:08.5546324Z  2025-10-10T00:01:08.5546958Z  return parser.parse_args() 2025-10-10T00:01:08.5547789Z  2025-10-10T00:01:08.5549011Z  2025-10-10T00:01:08.5550028Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.5551576Z  auth = Auth.Token(github_token) 2025-10-10T00:01:08.5552488Z  return Github(auth=auth) 2025-10-10T00:01:08.5553259Z  2025-10-10T00:01:08.5553813Z  2025-10-10T00:01:08.5554923Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.5556313Z  repo = gh.get_repo(repo) 2025-10-10T00:01:08.5557194Z  return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.5558300Z  2025-10-10T00:01:08.5558894Z  2025-10-10T00:01:08.5559509Z def get_potential_pr_author( 2025-10-10T00:01:08.5560658Z  github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.5561804Z ) -> str: 2025-10-10T00:01:08.5562746Z  # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.5564123Z  # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.5565456Z  # embedded in the tag name: ciflow// 2025-10-10T00:01:08.5566455Z  2025-10-10T00:01:08.5567101Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.5567928Z  2025-10-10T00:01:08.5568902Z  if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.5570017Z  split_tag = ref_name.split("/") 2025-10-10T00:01:08.5570883Z  if ( 2025-10-10T00:01:08.5571559Z  len(split_tag) == 3 2025-10-10T00:01:08.5572433Z  and split_tag[0] == "ciflow" 2025-10-10T00:01:08.5573355Z  and split_tag[2].isnumeric() 2025-10-10T00:01:08.5574194Z  ): 2025-10-10T00:01:08.5574885Z  pr_number = split_tag[2] 2025-10-10T00:01:08.5575717Z  try: 2025-10-10T00:01:08.5576518Z  repository = gh.get_repo(repo) 2025-10-10T00:01:08.5577811Z  pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.5579038Z  except Exception as e: 2025-10-10T00:01:08.5579949Z  raise Exception( # noqa: TRY002 2025-10-10T00:01:08.5581115Z  f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.5582207Z  ) from e 2025-10-10T00:01:08.5583202Z  return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.5584445Z  # In all other cases, return the original input username 2025-10-10T00:01:08.5585451Z  return username 2025-10-10T00:01:08.5586156Z  2025-10-10T00:01:08.5586728Z  2025-10-10T00:01:08.5587447Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.5588547Z  """ 2025-10-10T00:01:08.5589676Z  Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.5591049Z  """ 2025-10-10T00:01:08.5592010Z  return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.5593128Z  2025-10-10T00:01:08.5593699Z  2025-10-10T00:01:08.5594352Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.5595195Z  try: 2025-10-10T00:01:08.5595866Z  data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.5596740Z  return data 2025-10-10T00:01:08.5597522Z  except yaml.YAMLError: 2025-10-10T00:01:08.5598600Z  log.exception("Error loading YAML") 2025-10-10T00:01:08.5599481Z  raise 2025-10-10T00:01:08.5600118Z  2025-10-10T00:01:08.5600677Z  2025-10-10T00:01:08.5601730Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.5603019Z  """ 2025-10-10T00:01:08.5604323Z  Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.5605641Z  2025-10-10T00:01:08.5606554Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.5607856Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.5609010Z  2025-10-10T00:01:08.5609984Z  If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.5611152Z  """ 2025-10-10T00:01:08.5611954Z  rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.5612974Z  if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.5614021Z  return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.5615105Z  else: 2025-10-10T00:01:08.5615788Z  return "", rollout_state 2025-10-10T00:01:08.5616602Z  2025-10-10T00:01:08.5617149Z  2025-10-10T00:01:08.5617822Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.5618947Z  """ 2025-10-10T00:01:08.5619877Z  Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.5620968Z  """ 2025-10-10T00:01:08.5621558Z  2025-10-10T00:01:08.5622125Z  2025-10-10T00:01:08.5623034Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.5624154Z  """ 2025-10-10T00:01:08.5625383Z  Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.5626823Z  2025-10-10T00:01:08.5628367Z  Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.5630120Z  - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.5631530Z  - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.5632592Z  2025-10-10T00:01:08.5633156Z  2025-10-10T00:01:08.5633702Z  """ 2025-10-10T00:01:08.5634343Z  optins = UserOptins() 2025-10-10T00:01:08.5635203Z  for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.5636166Z  user = user.strip("\r\n\t -") 2025-10-10T00:01:08.5637128Z  if not user or not user.startswith("@"): 2025-10-10T00:01:08.5638250Z  # Not a valid user. Skip 2025-10-10T00:01:08.5639083Z  continue 2025-10-10T00:01:08.5639781Z  2025-10-10T00:01:08.5640361Z  if user: 2025-10-10T00:01:08.5641146Z  usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.5642319Z  optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.5643416Z  2025-10-10T00:01:08.5644017Z  return optins 2025-10-10T00:01:08.5644701Z  2025-10-10T00:01:08.5645238Z  2025-10-10T00:01:08.5646057Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.5647123Z  """ 2025-10-10T00:01:08.5647840Z  Check if the experiment name is valid. 2025-10-10T00:01:08.5648900Z  A valid name: 2025-10-10T00:01:08.5650041Z  - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.5651680Z  - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.5652892Z  - Cannot contain spaces 2025-10-10T00:01:08.5653698Z  """ 2025-10-10T00:01:08.5654301Z  2025-10-10T00:01:08.5655065Z  valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.5656281Z  valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.5657506Z  2025-10-10T00:01:08.5658375Z  if valid: 2025-10-10T00:01:08.5659062Z  return True 2025-10-10T00:01:08.5659748Z  2025-10-10T00:01:08.5660307Z  log.error( 2025-10-10T00:01:08.5662839Z  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-10-10T00:01:08.5665485Z  ) 2025-10-10T00:01:08.5666102Z  return False 2025-10-10T00:01:08.5666775Z  2025-10-10T00:01:08.5667318Z  2025-10-10T00:01:08.5668393Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.5669521Z  """ 2025-10-10T00:01:08.5670534Z  Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.5671796Z  """ 2025-10-10T00:01:08.5672404Z  try: 2025-10-10T00:01:08.5673038Z  if settings_text: 2025-10-10T00:01:08.5674298Z  # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.5675670Z  # for easy reading 2025-10-10T00:01:08.5677059Z  # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.5678789Z  # the backtick character in shell commands. 2025-10-10T00:01:08.5679855Z  backtick = chr(96) # backtick character 2025-10-10T00:01:08.5680983Z  settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.5682131Z  settings = load_yaml(settings_text) 2025-10-10T00:01:08.5683005Z  2025-10-10T00:01:08.5684228Z  # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.5685487Z  experiments = {} 2025-10-10T00:01:08.5686278Z  2025-10-10T00:01:08.5687219Z  for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.5688937Z  if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.5690815Z  # 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-10-10T00:01:08.5692595Z  continue 2025-10-10T00:01:08.5693374Z  2025-10-10T00:01:08.5694097Z  valid_settings = {} 2025-10-10T00:01:08.5694982Z  for setting in exp_settings: 2025-10-10T00:01:08.5695963Z  if setting not in Experiment._fields: 2025-10-10T00:01:08.5696938Z  log.warning( 2025-10-10T00:01:08.5698396Z  f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.5699616Z  ) 2025-10-10T00:01:08.5700378Z  else: 2025-10-10T00:01:08.5701302Z  valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.5702250Z  2025-10-10T00:01:08.5703037Z  experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.5704154Z  return Settings(experiments) 2025-10-10T00:01:08.5704991Z  2025-10-10T00:01:08.5705580Z  except Exception: 2025-10-10T00:01:08.5706437Z  log.exception("Failed to parse settings") 2025-10-10T00:01:08.5707365Z  2025-10-10T00:01:08.5707948Z  return Settings() 2025-10-10T00:01:08.5708855Z  2025-10-10T00:01:08.5709411Z  2025-10-10T00:01:08.5710377Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.5711391Z  """ 2025-10-10T00:01:08.5712157Z  Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.5713076Z  2025-10-10T00:01:08.5713977Z  If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.5715363Z  and the text below is the list of opted in users. 2025-10-10T00:01:08.5716294Z  2025-10-10T00:01:08.5717295Z  If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.5718735Z  """ 2025-10-10T00:01:08.5719712Z  settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.5721026Z  return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.5721961Z  2025-10-10T00:01:08.5722538Z  2025-10-10T00:01:08.5723280Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.5724238Z  """ 2025-10-10T00:01:08.5724944Z  Parse users from the rollout state. 2025-10-10T00:01:08.5725801Z  2025-10-10T00:01:08.5726354Z  """ 2025-10-10T00:01:08.5727282Z  _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.5728774Z  return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.5729697Z  2025-10-10T00:01:08.5730249Z  2025-10-10T00:01:08.5731281Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.5732565Z  """ 2025-10-10T00:01:08.5733304Z  Check if a user is opted into an experiment 2025-10-10T00:01:08.5734198Z  """ 2025-10-10T00:01:08.5735010Z  return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.5736220Z  2025-10-10T00:01:08.5736775Z  2025-10-10T00:01:08.5737834Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.5739626Z  """ 2025-10-10T00:01:08.5740448Z  Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.5741417Z  """ 2025-10-10T00:01:08.5742305Z  # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.5743492Z  experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.5744592Z  if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.5745596Z  return False 2025-10-10T00:01:08.5746313Z  2025-10-10T00:01:08.5747101Z  if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.5748315Z  log.warning( 2025-10-10T00:01:08.5749726Z  f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.5751251Z  ) 2025-10-10T00:01:08.5751873Z  2025-10-10T00:01:08.5752435Z  return True 2025-10-10T00:01:08.5753101Z  2025-10-10T00:01:08.5753665Z  2025-10-10T00:01:08.5754268Z def get_runner_prefix( 2025-10-10T00:01:08.5755039Z  rollout_state: str, 2025-10-10T00:01:08.5755870Z  workflow_requestors: Iterable[str], 2025-10-10T00:01:08.5756762Z  branch: str, 2025-10-10T00:01:08.5757677Z  eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.5759038Z  opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.5760028Z  is_canary: bool = False, 2025-10-10T00:01:08.5760830Z ) -> str: 2025-10-10T00:01:08.5761597Z  settings = parse_settings(rollout_state) 2025-10-10T00:01:08.5762591Z  user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.5763474Z  2025-10-10T00:01:08.5764284Z  fleet_prefix = "" 2025-10-10T00:01:08.5765084Z  prefixes = [] 2025-10-10T00:01:08.5766218Z  for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.5767841Z  if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.5769277Z  log.info( 2025-10-10T00:01:08.5770482Z  f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.5771767Z  ) 2025-10-10T00:01:08.5772448Z  continue 2025-10-10T00:01:08.5773138Z  2025-10-10T00:01:08.5773744Z  if opt_out_experiments: 2025-10-10T00:01:08.5774685Z  if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.5775814Z  opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.5776831Z  log.info( 2025-10-10T00:01:08.5778686Z  f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.5780369Z  ) 2025-10-10T00:01:08.5781086Z  continue 2025-10-10T00:01:08.5781811Z  2025-10-10T00:01:08.5782450Z  if eligible_experiments: 2025-10-10T00:01:08.5783436Z  if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.5784525Z  exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.5785457Z  log.info( 2025-10-10T00:01:08.5786842Z  f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.5788446Z  ) 2025-10-10T00:01:08.5789428Z  continue 2025-10-10T00:01:08.5790323Z  elif not experiment_settings.default: 2025-10-10T00:01:08.5791206Z  log.info( 2025-10-10T00:01:08.5792365Z  f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.5793629Z  ) 2025-10-10T00:01:08.5794302Z  continue 2025-10-10T00:01:08.5795000Z  2025-10-10T00:01:08.5795768Z  # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.5796848Z  opted_out_users = [ 2025-10-10T00:01:08.5797656Z  requestor 2025-10-10T00:01:08.5798675Z  for requestor in workflow_requestors 2025-10-10T00:01:08.5799840Z  if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.5800930Z  ] 2025-10-10T00:01:08.5801568Z  2025-10-10T00:01:08.5802158Z  if opted_out_users: 2025-10-10T00:01:08.5802950Z  log.info( 2025-10-10T00:01:08.5804063Z  f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.5805258Z  ) 2025-10-10T00:01:08.5805921Z  continue 2025-10-10T00:01:08.5806605Z  2025-10-10T00:01:08.5807389Z  # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.5808628Z  opted_in_users = [ 2025-10-10T00:01:08.5809423Z  requestor 2025-10-10T00:01:08.5810234Z  for requestor in workflow_requestors 2025-10-10T00:01:08.5811390Z  if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.5812448Z  ] 2025-10-10T00:01:08.5813056Z  2025-10-10T00:01:08.5813631Z  enabled = False 2025-10-10T00:01:08.5814432Z  if opted_in_users: 2025-10-10T00:01:08.5815512Z  log.info( 2025-10-10T00:01:08.5816609Z  f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.5817759Z  ) 2025-10-10T00:01:08.5818713Z  enabled = True 2025-10-10T00:01:08.5819478Z  2025-10-10T00:01:08.5820157Z  elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.5821557Z  # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.5823180Z  if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.5824274Z  log.info( 2025-10-10T00:01:08.5825807Z  f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.5827383Z  ) 2025-10-10T00:01:08.5828293Z  enabled = True 2025-10-10T00:01:08.5829109Z  2025-10-10T00:01:08.5829696Z  if enabled: 2025-10-10T00:01:08.5830453Z  label = experiment_name 2025-10-10T00:01:08.5831394Z  if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.5832821Z  # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.5834329Z  # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.5835612Z  # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.5836765Z  if is_canary: 2025-10-10T00:01:08.5837632Z  label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.5838740Z  fleet_prefix = label 2025-10-10T00:01:08.5839856Z  else: 2025-10-10T00:01:08.5840648Z  prefixes.append(label) 2025-10-10T00:01:08.5841504Z  2025-10-10T00:01:08.5842092Z  if len(prefixes) > 1: 2025-10-10T00:01:08.5842879Z  log.error( 2025-10-10T00:01:08.5844680Z  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-10-10T00:01:08.5846623Z  ) 2025-10-10T00:01:08.5847327Z  prefixes = prefixes[:1] 2025-10-10T00:01:08.5848328Z  2025-10-10T00:01:08.5848943Z  # Fleet always comes first 2025-10-10T00:01:08.5849755Z  if fleet_prefix: 2025-10-10T00:01:08.5850578Z  prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.5851434Z  2025-10-10T00:01:08.5852168Z  return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.5853115Z  2025-10-10T00:01:08.5853677Z  2025-10-10T00:01:08.5854770Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.5856058Z  """ 2025-10-10T00:01:08.5857072Z  Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.5858540Z  2025-10-10T00:01:08.5859529Z  The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.5860715Z  """ 2025-10-10T00:01:08.5861417Z  gh = get_gh_client(github_token) 2025-10-10T00:01:08.5862346Z  issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.5863421Z  return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.5864437Z  2025-10-10T00:01:08.5865002Z  2025-10-10T00:01:08.5865993Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.5867485Z  for _ in range(num_retries): 2025-10-10T00:01:08.5868556Z  try: 2025-10-10T00:01:08.5869317Z  req = Request(url=url, headers=headers) 2025-10-10T00:01:08.5870426Z  content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.5871537Z  return json.loads(content) 2025-10-10T00:01:08.5872441Z  except Exception as e: 2025-10-10T00:01:08.5873396Z  log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.5874305Z  2025-10-10T00:01:08.5875270Z  log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.5876500Z  return {} 2025-10-10T00:01:08.5877147Z  2025-10-10T00:01:08.5877692Z  2025-10-10T00:01:08.5878433Z @cache 2025-10-10T00:01:08.5879652Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.5880937Z  """ 2025-10-10T00:01:08.5881615Z  Dynamically get PR information 2025-10-10T00:01:08.5882450Z  """ 2025-10-10T00:01:08.5883325Z  github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.5884359Z  headers = { 2025-10-10T00:01:08.5885160Z  "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.5886216Z  "Authorization": f"token {github_token}", 2025-10-10T00:01:08.5887136Z  } 2025-10-10T00:01:08.5887883Z  json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.5889094Z  url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.5890002Z  headers=headers, 2025-10-10T00:01:08.5890775Z  ) 2025-10-10T00:01:08.5891366Z  2025-10-10T00:01:08.5891961Z  if not json_response: 2025-10-10T00:01:08.5893184Z  log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.5894264Z  return {} 2025-10-10T00:01:08.5894962Z  2025-10-10T00:01:08.5895557Z  return json_response 2025-10-10T00:01:08.5896290Z  2025-10-10T00:01:08.5896849Z  2025-10-10T00:01:08.5897861Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.5899334Z  """ 2025-10-10T00:01:08.5900246Z  Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.5901359Z  """ 2025-10-10T00:01:08.5902205Z  pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.5903218Z  return { 2025-10-10T00:01:08.5904226Z  label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.5905412Z  } 2025-10-10T00:01:08.5905999Z  2025-10-10T00:01:08.5906555Z  2025-10-10T00:01:08.5907138Z def main() -> None: 2025-10-10T00:01:08.5907907Z  args = parse_args() 2025-10-10T00:01:08.5908856Z  2025-10-10T00:01:08.5909564Z  runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.5910440Z  2025-10-10T00:01:08.5911066Z  # Check if the PR is opt-out 2025-10-10T00:01:08.5911974Z  if args.pr_number: 2025-10-10T00:01:08.5913122Z  labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.5914392Z  if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.5915307Z  log.info( 2025-10-10T00:01:08.5916516Z  f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.5917786Z  ) 2025-10-10T00:01:08.5918973Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.5920161Z  sys.exit() 2025-10-10T00:01:08.5921079Z  2025-10-10T00:01:08.5921650Z  try: 2025-10-10T00:01:08.5922411Z  rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.5923649Z  args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.5924714Z  ) 2025-10-10T00:01:08.5925330Z  2025-10-10T00:01:08.5926010Z  username = get_potential_pr_author( 2025-10-10T00:01:08.5926930Z  args.github_token, 2025-10-10T00:01:08.5927764Z  args.github_repo, 2025-10-10T00:01:08.5928778Z  args.github_actor, 2025-10-10T00:01:08.5929654Z  args.github_ref_type, 2025-10-10T00:01:08.5930523Z  args.github_branch, 2025-10-10T00:01:08.5931318Z  ) 2025-10-10T00:01:08.5931917Z  2025-10-10T00:01:08.5932750Z  is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.5933787Z  2025-10-10T00:01:08.5934474Z  runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.5935390Z  rollout_state, 2025-10-10T00:01:08.5936261Z  (args.github_issue_owner, username), 2025-10-10T00:01:08.5937195Z  args.github_branch, 2025-10-10T00:01:08.5938300Z  args.eligible_experiments, 2025-10-10T00:01:08.5939224Z  args.opt_out_experiments, 2025-10-10T00:01:08.5940230Z  is_canary, 2025-10-10T00:01:08.5940981Z  ) 2025-10-10T00:01:08.5941591Z  2025-10-10T00:01:08.5942188Z  except Exception as e: 2025-10-10T00:01:08.5942972Z  log.error( 2025-10-10T00:01:08.5944162Z  f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.5945683Z  ) 2025-10-10T00:01:08.5946295Z  2025-10-10T00:01:08.5947180Z  set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.5948493Z  2025-10-10T00:01:08.5949065Z  2025-10-10T00:01:08.5949647Z if __name__ == "__main__": 2025-10-10T00:01:08.5950396Z  main() 2025-10-10T00:01:08.5951036Z  2025-10-10T00:01:08.5951594Z EOF 2025-10-10T00:01:08.5952157Z  2025-10-10T00:01:08.5952761Z cat runner_determinator.py 2025-10-10T00:01:08.7306989Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:08.7307755Z env: 2025-10-10T00:01:08.7308615Z GITHUB_TOKEN: *** 2025-10-10T00:01:08.7309277Z ISSUE_NUMBER: 5132 2025-10-10T00:01:08.7309710Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:08.7310180Z ISSUE_OWNER: 2025-10-10T00:01:08.7310555Z CHECK_EXPERIMENTS: 2025-10-10T00:01:08.7310950Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:08.7311364Z PR_NUMBER: 2025-10-10T00:01:08.7311714Z ##[endgroup] 2025-10-10T00:01:08.7516319Z # flake8: noqa: G004 2025-10-10T00:01:08.7516628Z 2025-10-10T00:01:08.7517037Z # Note: Copies of this script in runner_determinator.py and _runner-determinator.yml 2025-10-10T00:01:08.7517918Z # must be kept in sync. You can do it easily by running the following command: 2025-10-10T00:01:08.7519002Z # python .github/scripts/update_runner_determinator.py 2025-10-10T00:01:08.7519409Z 2025-10-10T00:01:08.7519557Z """ 2025-10-10T00:01:08.7520094Z This runner determinator is used to determine which set of runners to run a 2025-10-10T00:01:08.7520903Z GitHub job on. It uses the first comment of a GitHub issue (by default 2025-10-10T00:01:08.7521733Z https://github.com/pytorch/test-infra/issues/5132) to define the configuration 2025-10-10T00:01:08.7522496Z of which runners should be used to run which job. 2025-10-10T00:01:08.7522874Z 2025-10-10T00:01:08.7523235Z The configuration has two parts, the settings and a list of opted-in users, 2025-10-10T00:01:08.7524283Z separated by a line containing "---". If the line is not present, the 2025-10-10T00:01:08.7525113Z settings are considered to be empty with only the second part, the user 2025-10-10T00:01:08.7525762Z list, defined. 2025-10-10T00:01:08.7525980Z 2025-10-10T00:01:08.7526328Z The first part is a YAML block that defines the rollout settings. This can be 2025-10-10T00:01:08.7527165Z used to define any settings that are needed to determine which runners to use. 2025-10-10T00:01:08.7527930Z It's fields are defined by the RolloutSettings class below. 2025-10-10T00:01:08.7528790Z 2025-10-10T00:01:08.7529140Z The second part is a list of users who are explicitly opted in to the LF fleet. 2025-10-10T00:01:08.7529939Z The user list is also a comma separated list of additional features or 2025-10-10T00:01:08.7530634Z experiments which the user could be opted in to. 2025-10-10T00:01:08.7531002Z 2025-10-10T00:01:08.7531185Z The user list has the following rules: 2025-10-10T00:01:08.7531517Z 2025-10-10T00:01:08.7531814Z - Users are GitHub usernames, which must start with the @ prefix 2025-10-10T00:01:08.7532605Z - Each user is also a comma-separated list of features/experiments to enable 2025-10-10T00:01:08.7533307Z - A "#" prefix opts the user out of all experiments 2025-10-10T00:01:08.7533675Z 2025-10-10T00:01:08.7533839Z Example config: 2025-10-10T00:01:08.7534250Z # A list of experiments that can be opted into. 2025-10-10T00:01:08.7534868Z # This defines the behavior they'll induce when opted into. 2025-10-10T00:01:08.7535440Z # Expected syntax is: 2025-10-10T00:01:08.7536039Z # [experiment_name]: # Name of the experiment. Also used for the label prefix. 2025-10-10T00:01:08.7536948Z # rollout_perc: [int] # % of workflows to run with this experiment when users are not opted in. 2025-10-10T00:01:08.7537512Z 2025-10-10T00:01:08.7537669Z experiments: 2025-10-10T00:01:08.7538175Z lf: 2025-10-10T00:01:08.7538613Z rollout_percent: 25 2025-10-10T00:01:08.7539206Z all_branches: false 2025-10-10T00:01:08.7539626Z default: true 2025-10-10T00:01:08.7540007Z --- 2025-10-10T00:01:08.7540232Z 2025-10-10T00:01:08.7540381Z # Opt-ins: 2025-10-10T00:01:08.7540919Z # Users can opt into the LF fleet by adding their GitHub username to this list 2025-10-10T00:01:08.7541733Z # and specifying experiments to enable in a comma-separated list. 2025-10-10T00:01:08.7542459Z # To always opt out of an experiment, prefix it with a "-". 2025-10-10T00:01:08.7543066Z # Experiments should be from the above list. 2025-10-10T00:01:08.7543415Z 2025-10-10T00:01:08.7543583Z @User1,-lf,split_build 2025-10-10T00:01:08.7543980Z @User2,lf 2025-10-10T00:01:08.7544328Z @User3,split_build 2025-10-10T00:01:08.7544703Z """ 2025-10-10T00:01:08.7544875Z 2025-10-10T00:01:08.7545024Z import json 2025-10-10T00:01:08.7545361Z import logging 2025-10-10T00:01:08.7545706Z import os 2025-10-10T00:01:08.7546050Z import random 2025-10-10T00:01:08.7546405Z import re 2025-10-10T00:01:08.7546730Z import sys 2025-10-10T00:01:08.7547100Z from argparse import ArgumentParser 2025-10-10T00:01:08.7547583Z from collections.abc import Iterable 2025-10-10T00:01:08.7548365Z from functools import cache 2025-10-10T00:01:08.7548813Z from logging import LogRecord 2025-10-10T00:01:08.7549277Z from typing import Any, NamedTuple 2025-10-10T00:01:08.7549765Z from urllib.request import Request, urlopen 2025-10-10T00:01:08.7550119Z 2025-10-10T00:01:08.7550269Z import yaml 2025-10-10T00:01:08.7550627Z from github import Auth, Github 2025-10-10T00:01:08.7551084Z from github.Issue import Issue 2025-10-10T00:01:08.7551362Z 2025-10-10T00:01:08.7551368Z 2025-10-10T00:01:08.7551576Z DEFAULT_LABEL_PREFIX = "" # use meta runners 2025-10-10T00:01:08.7552204Z WORKFLOW_LABEL_LF = "lf." # use runners from the linux foundation 2025-10-10T00:01:08.7553006Z WORKFLOW_LABEL_LF_CANARY = "lf.c." # use canary runners from the linux foundation 2025-10-10T00:01:08.7553527Z 2025-10-10T00:01:08.7553739Z GITHUB_OUTPUT = os.getenv("GITHUB_OUTPUT", "") 2025-10-10T00:01:08.7554389Z GH_OUTPUT_KEY_AMI = "runner-ami" 2025-10-10T00:01:08.7554860Z GH_OUTPUT_KEY_LABEL_TYPE = "label-type" 2025-10-10T00:01:08.7555365Z OPT_OUT_LABEL = "no-runner-experiments" 2025-10-10T00:01:08.7555686Z 2025-10-10T00:01:08.7555868Z SETTING_EXPERIMENTS = "experiments" 2025-10-10T00:01:08.7556172Z 2025-10-10T00:01:08.7556344Z LF_FLEET_EXPERIMENT = "lf" 2025-10-10T00:01:08.7556766Z CANARY_FLEET_SUFFIX = ".c" 2025-10-10T00:01:08.7557018Z 2025-10-10T00:01:08.7557023Z 2025-10-10T00:01:08.7557201Z class Experiment(NamedTuple): 2025-10-10T00:01:08.7557641Z rollout_perc: float = ( 2025-10-10T00:01:08.7558434Z 0 # Percentage of workflows to experiment on when user is not opted-in. 2025-10-10T00:01:08.7559069Z ) 2025-10-10T00:01:08.7559416Z all_branches: bool = ( 2025-10-10T00:01:08.7559997Z False # If True, the experiment is also enabled on the exception branches 2025-10-10T00:01:08.7560635Z ) 2025-10-10T00:01:08.7560957Z default: bool = ( 2025-10-10T00:01:08.7561490Z True # If True, the experiment is enabled by default for all queries 2025-10-10T00:01:08.7562091Z ) 2025-10-10T00:01:08.7562274Z 2025-10-10T00:01:08.7562442Z # Add more fields as needed 2025-10-10T00:01:08.7562718Z 2025-10-10T00:01:08.7562725Z 2025-10-10T00:01:08.7562904Z class Settings(NamedTuple): 2025-10-10T00:01:08.7563309Z """ 2025-10-10T00:01:08.7563733Z Settings for the experiments that can be opted into. 2025-10-10T00:01:08.7564260Z """ 2025-10-10T00:01:08.7564444Z 2025-10-10T00:01:08.7564645Z experiments: dict[str, Experiment] = {} 2025-10-10T00:01:08.7564977Z 2025-10-10T00:01:08.7564985Z 2025-10-10T00:01:08.7565181Z class ColorFormatter(logging.Formatter): 2025-10-10T00:01:08.7565762Z """Color codes the log messages based on the log level""" 2025-10-10T00:01:08.7566158Z 2025-10-10T00:01:08.7566312Z COLORS = { 2025-10-10T00:01:08.7566672Z "WARNING": "\033[33m", # Yellow 2025-10-10T00:01:08.7567290Z "ERROR": "\033[31m", # Red 2025-10-10T00:01:08.7567750Z "CRITICAL": "\033[31m", # Red 2025-10-10T00:01:08.7568382Z "INFO": "\033[0m", # Reset 2025-10-10T00:01:08.7568819Z "DEBUG": "\033[0m", # Reset 2025-10-10T00:01:08.7569247Z } 2025-10-10T00:01:08.7569424Z 2025-10-10T00:01:08.7569625Z def format(self, record: LogRecord) -> str: 2025-10-10T00:01:08.7570319Z log_color = self.COLORS.get(record.levelname, "\033[0m") # Default to reset 2025-10-10T00:01:08.7571040Z record.msg = f"{log_color}{record.msg}\033[0m" 2025-10-10T00:01:08.7571583Z return super().format(record) 2025-10-10T00:01:08.7571885Z 2025-10-10T00:01:08.7571892Z 2025-10-10T00:01:08.7572080Z handler = logging.StreamHandler() 2025-10-10T00:01:08.7572727Z handler.setFormatter(ColorFormatter(fmt="%(levelname)-8s: %(message)s")) 2025-10-10T00:01:08.7573237Z 2025-10-10T00:01:08.7573460Z log = logging.getLogger(os.path.basename(__file__)) 2025-10-10T00:01:08.7573989Z log.addHandler(handler) 2025-10-10T00:01:08.7574396Z log.setLevel(logging.INFO) 2025-10-10T00:01:08.7574650Z 2025-10-10T00:01:08.7574656Z 2025-10-10T00:01:08.7574889Z def set_github_output(key: str, value: str) -> None: 2025-10-10T00:01:08.7575396Z """ 2025-10-10T00:01:08.7575859Z Defines outputs of the github action that invokes this script 2025-10-10T00:01:08.7576437Z """ 2025-10-10T00:01:08.7576778Z if not GITHUB_OUTPUT: 2025-10-10T00:01:08.7577775Z # See https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ for deprecation notice 2025-10-10T00:01:08.7579023Z log.warning( 2025-10-10T00:01:08.7579817Z "No env var found for GITHUB_OUTPUT, you must be running this code locally. Falling back to the deprecated print method." 2025-10-10T00:01:08.7580670Z ) 2025-10-10T00:01:08.7590649Z print(f"::set-output name={key}::{value}") 2025-10-10T00:01:08.7591205Z return 2025-10-10T00:01:08.7591434Z 2025-10-10T00:01:08.7591798Z with open(GITHUB_OUTPUT, "a") as f: 2025-10-10T00:01:08.7592350Z log.info(f"Setting output: {key}='{value}'") 2025-10-10T00:01:08.7592884Z f.write(f"{key}={value}\n") 2025-10-10T00:01:08.7593176Z 2025-10-10T00:01:08.7593183Z 2025-10-10T00:01:08.7593466Z def _str_comma_separated_to_set(value: str) -> frozenset[str]: 2025-10-10T00:01:08.7594043Z return frozenset( 2025-10-10T00:01:08.7594608Z filter(lambda itm: itm != "", map(str.strip, value.strip(" \n\t").split(","))) 2025-10-10T00:01:08.7595241Z ) 2025-10-10T00:01:08.7595421Z 2025-10-10T00:01:08.7595427Z 2025-10-10T00:01:08.7595592Z def parse_args() -> Any: 2025-10-10T00:01:08.7596095Z parser = ArgumentParser("Get dynamic rollout settings") 2025-10-10T00:01:08.7596893Z parser.add_argument("--github-token", type=str, required=True, help="GitHub token") 2025-10-10T00:01:08.7597595Z parser.add_argument( 2025-10-10T00:01:08.7598196Z "--github-issue-repo", 2025-10-10T00:01:08.7598645Z type=str, 2025-10-10T00:01:08.7599011Z required=False, 2025-10-10T00:01:08.7599426Z default="pytorch/test-infra", 2025-10-10T00:01:08.7599971Z help="GitHub repo to get the issue", 2025-10-10T00:01:08.7600490Z ) 2025-10-10T00:01:08.7600862Z parser.add_argument( 2025-10-10T00:01:08.7601277Z "--github-repo", 2025-10-10T00:01:08.7601663Z type=str, 2025-10-10T00:01:08.7602026Z required=True, 2025-10-10T00:01:08.7602444Z help="GitHub repo where CI is running", 2025-10-10T00:01:08.7602929Z ) 2025-10-10T00:01:08.7603268Z parser.add_argument( 2025-10-10T00:01:08.7603835Z "--github-issue", type=int, required=True, help="GitHub issue number" 2025-10-10T00:01:08.7604436Z ) 2025-10-10T00:01:08.7604764Z parser.add_argument( 2025-10-10T00:01:08.7605336Z "--github-actor", type=str, required=True, help="GitHub triggering_actor" 2025-10-10T00:01:08.7605944Z ) 2025-10-10T00:01:08.7606430Z parser.add_argument( 2025-10-10T00:01:08.7607020Z "--github-issue-owner", type=str, required=True, help="GitHub issue owner" 2025-10-10T00:01:08.7607674Z ) 2025-10-10T00:01:08.7608011Z parser.add_argument( 2025-10-10T00:01:08.7608717Z "--github-branch", type=str, required=True, help="Current GitHub branch or tag" 2025-10-10T00:01:08.7609364Z ) 2025-10-10T00:01:08.7609690Z parser.add_argument( 2025-10-10T00:01:08.7610108Z "--github-ref-type", 2025-10-10T00:01:08.7610525Z type=str, 2025-10-10T00:01:08.7610888Z required=True, 2025-10-10T00:01:08.7611326Z help="Current GitHub ref type, branch or tag", 2025-10-10T00:01:08.7611830Z ) 2025-10-10T00:01:08.7612166Z parser.add_argument( 2025-10-10T00:01:08.7612586Z "--eligible-experiments", 2025-10-10T00:01:08.7613051Z type=_str_comma_separated_to_set, 2025-10-10T00:01:08.7613525Z required=False, 2025-10-10T00:01:08.7613907Z default="", 2025-10-10T00:01:08.7614700Z help="comma separated list of experiments to check, if omitted all experiments marked with default=True are checked", 2025-10-10T00:01:08.7615598Z ) 2025-10-10T00:01:08.7615934Z parser.add_argument( 2025-10-10T00:01:08.7616343Z "--opt-out-experiments", 2025-10-10T00:01:08.7616805Z type=_str_comma_separated_to_set, 2025-10-10T00:01:08.7617276Z required=False, 2025-10-10T00:01:08.7617653Z default="", 2025-10-10T00:01:08.7618006Z help=( 2025-10-10T00:01:08.7618877Z "comma separated list of experiments to opt-out of. If unset, no opt-outs will occur. " 2025-10-10T00:01:08.7619924Z "If the same experiment is listed both here and in '--eligible-experiments' opt-out will take priority." 2025-10-10T00:01:08.7620690Z ), 2025-10-10T00:01:08.7621015Z ) 2025-10-10T00:01:08.7621355Z parser.add_argument( 2025-10-10T00:01:08.7621742Z "--pr-number", 2025-10-10T00:01:08.7622121Z type=str, 2025-10-10T00:01:08.7622477Z required=False, 2025-10-10T00:01:08.7622854Z default="", 2025-10-10T00:01:08.7670793Z help="the optional PR number where this is run", 2025-10-10T00:01:08.7671469Z ) 2025-10-10T00:01:08.7671658Z 2025-10-10T00:01:08.7671839Z return parser.parse_args() 2025-10-10T00:01:08.7672150Z 2025-10-10T00:01:08.7672157Z 2025-10-10T00:01:08.7672544Z def get_gh_client(github_token: str) -> Github: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.7673251Z auth = Auth.Token(github_token) 2025-10-10T00:01:08.7673716Z return Github(auth=auth) 2025-10-10T00:01:08.7673996Z 2025-10-10T00:01:08.7674002Z 2025-10-10T00:01:08.7674425Z def get_issue(gh: Github, repo: str, issue_num: int) -> Issue: # type: ignore[no-any-unimported] 2025-10-10T00:01:08.7675155Z repo = gh.get_repo(repo) 2025-10-10T00:01:08.7675613Z return repo.get_issue(number=issue_num) 2025-10-10T00:01:08.7675949Z 2025-10-10T00:01:08.7675956Z 2025-10-10T00:01:08.7676132Z def get_potential_pr_author( 2025-10-10T00:01:08.7676729Z github_token: str, repo: str, username: str, ref_type: str, ref_name: str 2025-10-10T00:01:08.7677353Z ) -> str: 2025-10-10T00:01:08.7677820Z # If the trigger was a new tag added by a bot, this is a ciflow case 2025-10-10T00:01:08.7678689Z # Fetch the actual username from the original PR. The PR number is 2025-10-10T00:01:08.7679360Z # embedded in the tag name: ciflow// 2025-10-10T00:01:08.7679746Z 2025-10-10T00:01:08.7679919Z gh = get_gh_client(github_token) 2025-10-10T00:01:08.7680223Z 2025-10-10T00:01:08.7680472Z if username == "pytorch-bot[bot]" and ref_type == "tag": 2025-10-10T00:01:08.7681037Z split_tag = ref_name.split("/") 2025-10-10T00:01:08.7681497Z if ( 2025-10-10T00:01:08.7681845Z len(split_tag) == 3 2025-10-10T00:01:08.7682290Z and split_tag[0] == "ciflow" 2025-10-10T00:01:08.7682771Z and split_tag[2].isnumeric() 2025-10-10T00:01:08.7683219Z ): 2025-10-10T00:01:08.7683710Z pr_number = split_tag[2] 2025-10-10T00:01:08.7684150Z try: 2025-10-10T00:01:08.7684542Z repository = gh.get_repo(repo) 2025-10-10T00:01:08.7685097Z pull = repository.get_pull(number=int(pr_number)) 2025-10-10T00:01:08.7685647Z except Exception as e: 2025-10-10T00:01:08.7686118Z raise Exception( # noqa: TRY002 2025-10-10T00:01:08.7686726Z f"issue with pull request {pr_number} from repo {repository}" 2025-10-10T00:01:08.7687305Z ) from e 2025-10-10T00:01:08.7687798Z return pull.user.login # type: ignore[no-any-return] 2025-10-10T00:01:08.7688542Z # In all other cases, return the original input username 2025-10-10T00:01:08.7689083Z return username 2025-10-10T00:01:08.7689303Z 2025-10-10T00:01:08.7689309Z 2025-10-10T00:01:08.7689519Z def is_exception_branch(branch: str) -> bool: 2025-10-10T00:01:08.7690008Z """ 2025-10-10T00:01:08.7690608Z Branches that get opted out of experiments by default, until they're explicitly enabled. 2025-10-10T00:01:08.7691320Z """ 2025-10-10T00:01:08.7691830Z return branch.split("/")[0] in {"main", "nightly", "release", "landchecks"} 2025-10-10T00:01:08.7692312Z 2025-10-10T00:01:08.7692319Z 2025-10-10T00:01:08.7692508Z def load_yaml(yaml_text: str) -> Any: 2025-10-10T00:01:08.7692950Z try: 2025-10-10T00:01:08.7693305Z data = yaml.safe_load(yaml_text) 2025-10-10T00:01:08.7693769Z return data 2025-10-10T00:01:08.7694152Z except yaml.YAMLError: 2025-10-10T00:01:08.7694585Z log.exception("Error loading YAML") 2025-10-10T00:01:08.7695051Z raise 2025-10-10T00:01:08.7695249Z 2025-10-10T00:01:08.7695254Z 2025-10-10T00:01:08.7695636Z def extract_settings_user_opt_in_from_text(rollout_state: str) -> tuple[str, str]: 2025-10-10T00:01:08.7696317Z """ 2025-10-10T00:01:08.7696881Z Extracts the text with settings, if any, and the opted in users from the rollout state. 2025-10-10T00:01:08.7697436Z 2025-10-10T00:01:08.7697902Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.7698966Z and the text below is the list of opted in users. 2025-10-10T00:01:08.7699376Z 2025-10-10T00:01:08.7699741Z If it doesn't contain "---" then the settings are empty and the rest is the users. 2025-10-10T00:01:08.7700417Z """ 2025-10-10T00:01:08.7700815Z rollout_state_parts = rollout_state.split("---") 2025-10-10T00:01:08.7701361Z if len(rollout_state_parts) >= 2: 2025-10-10T00:01:08.7701910Z return rollout_state_parts[0], rollout_state_parts[1] 2025-10-10T00:01:08.7702448Z else: 2025-10-10T00:01:08.7702797Z return "", rollout_state 2025-10-10T00:01:08.7703078Z 2025-10-10T00:01:08.7703085Z 2025-10-10T00:01:08.7703269Z class UserOptins(dict[str, list[str]]): 2025-10-10T00:01:08.7703741Z """ 2025-10-10T00:01:08.7704215Z Dictionary of users with a list of features they have opted into 2025-10-10T00:01:08.7704804Z """ 2025-10-10T00:01:08.7704989Z 2025-10-10T00:01:08.7704996Z 2025-10-10T00:01:08.7705315Z def parse_user_opt_in_from_text(user_optin_text: str) -> UserOptins: 2025-10-10T00:01:08.7705906Z """ 2025-10-10T00:01:08.7706561Z Parse the user opt-in text into a key value pair of username and the list of features they have opted into 2025-10-10T00:01:08.7707190Z 2025-10-10T00:01:08.7707764Z Users are GitHub usernames with the @ prefix. Each user is also a comma-separated list of features/experiments to enable. 2025-10-10T00:01:08.7708820Z - Example line: "@User1,lf,split_build" 2025-10-10T00:01:08.7709439Z - A "#" prefix indicates the user is opted out of all experiments 2025-10-10T00:01:08.7709885Z 2025-10-10T00:01:08.7709891Z 2025-10-10T00:01:08.7710039Z """ 2025-10-10T00:01:08.7710374Z optins = UserOptins() 2025-10-10T00:01:08.7710812Z for user in user_optin_text.split("\n"): 2025-10-10T00:01:08.7711323Z user = user.strip("\r\n\t -") 2025-10-10T00:01:08.7711961Z if not user or not user.startswith("@"): 2025-10-10T00:01:08.7712480Z # Not a valid user. Skip 2025-10-10T00:01:08.7712916Z continue 2025-10-10T00:01:08.7713142Z 2025-10-10T00:01:08.7713287Z if user: 2025-10-10T00:01:08.7713687Z usr_name = user.split(",")[0].strip("@") 2025-10-10T00:01:08.7714314Z optins[usr_name] = [exp.strip(" ") for exp in user.split(",")[1:]] 2025-10-10T00:01:08.7714764Z 2025-10-10T00:01:08.7714922Z return optins 2025-10-10T00:01:08.7715138Z 2025-10-10T00:01:08.7715145Z 2025-10-10T00:01:08.7715408Z def is_valid_experiment_name(experiment_name: str) -> bool: 2025-10-10T00:01:08.7715953Z """ 2025-10-10T00:01:08.7716314Z Check if the experiment name is valid. 2025-10-10T00:01:08.7716793Z A valid name: 2025-10-10T00:01:08.7717363Z - Contains only alphanumeric characters and the special characters "_" & "-" 2025-10-10T00:01:08.7718338Z - The special characters "_" & "-" shouldn't be the first or last characters 2025-10-10T00:01:08.7719004Z - Cannot contain spaces 2025-10-10T00:01:08.7719419Z """ 2025-10-10T00:01:08.7719598Z 2025-10-10T00:01:08.7719841Z valid_char_regex = r"^[a-zA-Z0-9]([\w-]*[a-zA-Z0-9])?$" 2025-10-10T00:01:08.7720477Z valid = bool(re.match(valid_char_regex, experiment_name)) 2025-10-10T00:01:08.7720887Z 2025-10-10T00:01:08.7721038Z if valid: 2025-10-10T00:01:08.7721378Z return True 2025-10-10T00:01:08.7721599Z 2025-10-10T00:01:08.7721749Z log.error( 2025-10-10T00:01:08.7723083Z 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-10-10T00:01:08.7724548Z ) 2025-10-10T00:01:08.7724877Z return False 2025-10-10T00:01:08.7725087Z 2025-10-10T00:01:08.7725093Z 2025-10-10T00:01:08.7725372Z def parse_settings_from_text(settings_text: str) -> Settings: 2025-10-10T00:01:08.7725943Z """ 2025-10-10T00:01:08.7726606Z Parse the experiments from the issue body into a list of ExperimentSettings 2025-10-10T00:01:08.7727268Z """ 2025-10-10T00:01:08.7727594Z try: 2025-10-10T00:01:08.7727930Z if settings_text: 2025-10-10T00:01:08.7728707Z # Escape the backtick as well so that we can have the settings in a code block on the GH issue 2025-10-10T00:01:08.7729424Z # for easy reading 2025-10-10T00:01:08.7730144Z # Note: Using ascii for the backtick so that the cat step in _runner-determinator.yml doesn't choke on 2025-10-10T00:01:08.7730952Z # the backtick character in shell commands. 2025-10-10T00:01:08.7731492Z backtick = chr(96) # backtick character 2025-10-10T00:01:08.7732113Z settings_text = settings_text.strip(f"\r\n\t{backtick} ") 2025-10-10T00:01:08.7732711Z settings = load_yaml(settings_text) 2025-10-10T00:01:08.7733051Z 2025-10-10T00:01:08.7733422Z # For now we just load experiments. We can expand this if/when we add more settings 2025-10-10T00:01:08.7734115Z experiments = {} 2025-10-10T00:01:08.7734381Z 2025-10-10T00:01:08.7734736Z for exp_name, exp_settings in settings.get(SETTING_EXPERIMENTS).items(): 2025-10-10T00:01:08.7735428Z if not is_valid_experiment_name(exp_name): 2025-10-10T00:01:08.7736425Z # 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-10-10T00:01:08.7737391Z continue 2025-10-10T00:01:08.7737646Z 2025-10-10T00:01:08.7737811Z valid_settings = {} 2025-10-10T00:01:08.7738555Z for setting in exp_settings: 2025-10-10T00:01:08.7739088Z if setting not in Experiment._fields: 2025-10-10T00:01:08.7739593Z log.warning( 2025-10-10T00:01:08.7740270Z f"Unexpected setting in experiment: {setting} = {exp_settings[setting]}" 2025-10-10T00:01:08.7741072Z ) 2025-10-10T00:01:08.7741457Z else: 2025-10-10T00:01:08.7741923Z valid_settings[setting] = exp_settings[setting] 2025-10-10T00:01:08.7742315Z 2025-10-10T00:01:08.7742567Z experiments[exp_name] = Experiment(**valid_settings) 2025-10-10T00:01:08.7743180Z return Settings(experiments) 2025-10-10T00:01:08.7743495Z 2025-10-10T00:01:08.7743651Z except Exception: 2025-10-10T00:01:08.7744090Z log.exception("Failed to parse settings") 2025-10-10T00:01:08.7744439Z 2025-10-10T00:01:08.7744597Z return Settings() 2025-10-10T00:01:08.7744829Z 2025-10-10T00:01:08.7744836Z 2025-10-10T00:01:08.7745060Z def parse_settings(rollout_state: str) -> Settings: 2025-10-10T00:01:08.7745570Z """ 2025-10-10T00:01:08.7745963Z Parse settings, if any, from the rollout state. 2025-10-10T00:01:08.7746327Z 2025-10-10T00:01:08.7746660Z If the issue body contains "---" then the text above that is the settings 2025-10-10T00:01:08.7747343Z and the text below is the list of opted in users. 2025-10-10T00:01:08.7747720Z 2025-10-10T00:01:08.7748194Z If it doesn't contain "---" then the settings are empty and the default values are used. 2025-10-10T00:01:08.7748870Z """ 2025-10-10T00:01:08.7749375Z settings_text, _ = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.7750055Z return parse_settings_from_text(settings_text) 2025-10-10T00:01:08.7750420Z 2025-10-10T00:01:08.7750427Z 2025-10-10T00:01:08.7750652Z def parse_users(rollout_state: str) -> UserOptins: 2025-10-10T00:01:08.7751160Z """ 2025-10-10T00:01:08.7751506Z Parse users from the rollout state. 2025-10-10T00:01:08.7751828Z 2025-10-10T00:01:08.7751977Z """ 2025-10-10T00:01:08.7752451Z _, users_text = extract_settings_user_opt_in_from_text(rollout_state) 2025-10-10T00:01:08.7753120Z return parse_user_opt_in_from_text(users_text) 2025-10-10T00:01:08.7753484Z 2025-10-10T00:01:08.7753490Z 2025-10-10T00:01:08.7753998Z def is_user_opted_in(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.7754676Z """ 2025-10-10T00:01:08.7755062Z Check if a user is opted into an experiment 2025-10-10T00:01:08.7755580Z """ 2025-10-10T00:01:08.7756047Z return experiment_name in user_optins.get(user, []) 2025-10-10T00:01:08.7756458Z 2025-10-10T00:01:08.7756464Z 2025-10-10T00:01:08.7756868Z def is_user_opted_out(user: str, user_optins: UserOptins, experiment_name: str) -> bool: 2025-10-10T00:01:08.7757596Z """ 2025-10-10T00:01:08.7758177Z Check if a user explicitly opted out of an experiment 2025-10-10T00:01:08.7758705Z """ 2025-10-10T00:01:08.7759161Z # if the experiment is prefixed with a "-", then it's an opt-out 2025-10-10T00:01:08.7759773Z experiment_optout = "-" + experiment_name 2025-10-10T00:01:08.7760354Z if experiment_optout not in user_optins.get(user, []): 2025-10-10T00:01:08.7760896Z return False 2025-10-10T00:01:08.7761127Z 2025-10-10T00:01:08.7761366Z if is_user_opted_in(user, user_optins, experiment_name): 2025-10-10T00:01:08.7761906Z log.warning( 2025-10-10T00:01:08.7762626Z f"User {user} is opted into experiment {experiment_name}, but also opted out of it. Defaulting to opting out" 2025-10-10T00:01:08.7763420Z ) 2025-10-10T00:01:08.7763602Z 2025-10-10T00:01:08.7763756Z return True 2025-10-10T00:01:08.7763967Z 2025-10-10T00:01:08.7763973Z 2025-10-10T00:01:08.7764132Z def get_runner_prefix( 2025-10-10T00:01:08.7764510Z rollout_state: str, 2025-10-10T00:01:08.7764926Z workflow_requestors: Iterable[str], 2025-10-10T00:01:08.7765404Z branch: str, 2025-10-10T00:01:08.7765844Z eligible_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.7766442Z opt_out_experiments: frozenset[str] = frozenset(), 2025-10-10T00:01:08.7766962Z is_canary: bool = False, 2025-10-10T00:01:08.7767371Z ) -> str: 2025-10-10T00:01:08.7767885Z settings = parse_settings(rollout_state) 2025-10-10T00:01:08.7768514Z user_optins = parse_users(rollout_state) 2025-10-10T00:01:08.7768844Z 2025-10-10T00:01:08.7769005Z fleet_prefix = "" 2025-10-10T00:01:08.7769385Z prefixes = [] 2025-10-10T00:01:08.7769950Z for experiment_name, experiment_settings in settings.experiments.items(): 2025-10-10T00:01:08.7770843Z if not experiment_settings.all_branches and is_exception_branch(branch): 2025-10-10T00:01:08.7771548Z log.info( 2025-10-10T00:01:08.7772159Z f"Branch {branch} is an exception branch. Not enabling experiment {experiment_name}." 2025-10-10T00:01:08.7772839Z ) 2025-10-10T00:01:08.7773172Z continue 2025-10-10T00:01:08.7773398Z 2025-10-10T00:01:08.7773569Z if opt_out_experiments: 2025-10-10T00:01:08.7774040Z if experiment_name in opt_out_experiments: 2025-10-10T00:01:08.7774772Z opt_out_exp_list = ", ".join(opt_out_experiments) 2025-10-10T00:01:08.7775490Z log.info( 2025-10-10T00:01:08.7776341Z f"Skipping experiment '{experiment_name}', as this workflow has opted-out (opted out experiments are: {opt_out_exp_list})" 2025-10-10T00:01:08.7777260Z ) 2025-10-10T00:01:08.7777677Z continue 2025-10-10T00:01:08.7777922Z 2025-10-10T00:01:08.7778310Z if eligible_experiments: 2025-10-10T00:01:08.7778919Z if experiment_name not in eligible_experiments: 2025-10-10T00:01:08.7779495Z exp_list = ", ".join(eligible_experiments) 2025-10-10T00:01:08.7779998Z log.info( 2025-10-10T00:01:08.7780702Z f"Skipping experiment '{experiment_name}', as it is not in the eligible_experiments list: {exp_list}" 2025-10-10T00:01:08.7781466Z ) 2025-10-10T00:01:08.7781820Z continue 2025-10-10T00:01:08.7782255Z elif not experiment_settings.default: 2025-10-10T00:01:08.7782744Z log.info( 2025-10-10T00:01:08.7783496Z f"Skipping experiment '{experiment_name}', as it is not a default experiment" 2025-10-10T00:01:08.7784175Z ) 2025-10-10T00:01:08.7784522Z continue 2025-10-10T00:01:08.7784743Z 2025-10-10T00:01:08.7785008Z # Is any workflow_requestor opted out to this experiment? 2025-10-10T00:01:08.7785562Z opted_out_users = [ 2025-10-10T00:01:08.7785973Z requestor 2025-10-10T00:01:08.7786381Z for requestor in workflow_requestors 2025-10-10T00:01:08.7786995Z if is_user_opted_out(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.7787564Z ] 2025-10-10T00:01:08.7787757Z 2025-10-10T00:01:08.7787920Z if opted_out_users: 2025-10-10T00:01:08.7788457Z log.info( 2025-10-10T00:01:08.7789016Z f"{', '.join(opted_out_users)} have opted out of experiment {experiment_name}." 2025-10-10T00:01:08.7789635Z ) 2025-10-10T00:01:08.7789973Z continue 2025-10-10T00:01:08.7790191Z 2025-10-10T00:01:08.7790444Z # Is any workflow_requestor opted in to this experiment? 2025-10-10T00:01:08.7790987Z opted_in_users = [ 2025-10-10T00:01:08.7791388Z requestor 2025-10-10T00:01:08.7791785Z for requestor in workflow_requestors 2025-10-10T00:01:08.7792372Z if is_user_opted_in(requestor, user_optins, experiment_name) 2025-10-10T00:01:08.7792922Z ] 2025-10-10T00:01:08.7793103Z 2025-10-10T00:01:08.7793257Z enabled = False 2025-10-10T00:01:08.7793645Z if opted_in_users: 2025-10-10T00:01:08.7794042Z log.info( 2025-10-10T00:01:08.7794575Z f"{', '.join(opted_in_users)} have opted into experiment {experiment_name}." 2025-10-10T00:01:08.7795181Z ) 2025-10-10T00:01:08.7795523Z enabled = True 2025-10-10T00:01:08.7795777Z 2025-10-10T00:01:08.7795972Z elif experiment_settings.rollout_perc: 2025-10-10T00:01:08.7796851Z # If no user is opted in, then we randomly enable the experiment based on the rollout percentage 2025-10-10T00:01:08.7797684Z if random.uniform(0, 100) <= experiment_settings.rollout_perc: 2025-10-10T00:01:08.7798380Z log.info( 2025-10-10T00:01:08.7799164Z f"Based on rollout percentage of {experiment_settings.rollout_perc}%, enabling experiment {experiment_name}." 2025-10-10T00:01:08.7799993Z ) 2025-10-10T00:01:08.7800360Z enabled = True 2025-10-10T00:01:08.7800623Z 2025-10-10T00:01:08.7800770Z if enabled: 2025-10-10T00:01:08.7801148Z label = experiment_name 2025-10-10T00:01:08.7801630Z if experiment_name == LF_FLEET_EXPERIMENT: 2025-10-10T00:01:08.7802366Z # We give some special treatment to the "lf" experiment since determines the fleet we use 2025-10-10T00:01:08.7803164Z # - If it's enabled, then we always list it's prefix first 2025-10-10T00:01:08.7803846Z # - If we're in the canary branch, then we append ".c" to the lf prefix 2025-10-10T00:01:08.7804436Z if is_canary: 2025-10-10T00:01:08.7804873Z label += CANARY_FLEET_SUFFIX 2025-10-10T00:01:08.7805376Z fleet_prefix = label 2025-10-10T00:01:08.7805808Z else: 2025-10-10T00:01:08.7806188Z prefixes.append(label) 2025-10-10T00:01:08.7806501Z 2025-10-10T00:01:08.7806670Z if len(prefixes) > 1: 2025-10-10T00:01:08.7807057Z log.error( 2025-10-10T00:01:08.7807995Z 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-10-10T00:01:08.7809104Z ) 2025-10-10T00:01:08.7809452Z prefixes = prefixes[:1] 2025-10-10T00:01:08.7809728Z 2025-10-10T00:01:08.7809895Z # Fleet always comes first 2025-10-10T00:01:08.7810320Z if fleet_prefix: 2025-10-10T00:01:08.7810721Z prefixes.insert(0, fleet_prefix) 2025-10-10T00:01:08.7811048Z 2025-10-10T00:01:08.7811386Z return ".".join(prefixes) + "." if prefixes else "" 2025-10-10T00:01:08.7811765Z 2025-10-10T00:01:08.7811773Z 2025-10-10T00:01:08.7812181Z def get_rollout_state_from_issue(github_token: str, repo: str, issue_num: int) -> str: 2025-10-10T00:01:08.7812879Z """ 2025-10-10T00:01:08.7813413Z Gets the first comment of the issue, which contains the desired rollout state. 2025-10-10T00:01:08.7813919Z 2025-10-10T00:01:08.7814281Z The default issue we use - https://github.com/pytorch/test-infra/issues/5132 2025-10-10T00:01:08.7814913Z """ 2025-10-10T00:01:08.7815262Z gh = get_gh_client(github_token) 2025-10-10T00:01:08.7815746Z issue = get_issue(gh, repo, issue_num) 2025-10-10T00:01:08.7816315Z return str(issue.get_comments()[0].body.strip("\n\t ")) 2025-10-10T00:01:08.7816706Z 2025-10-10T00:01:08.7816713Z 2025-10-10T00:01:08.7817068Z def download_json(url: str, headers: dict[str, str], num_retries: int = 3) -> Any: 2025-10-10T00:01:08.7817752Z for _ in range(num_retries): 2025-10-10T00:01:08.7818487Z try: 2025-10-10T00:01:08.7818880Z req = Request(url=url, headers=headers) 2025-10-10T00:01:08.7819476Z content = urlopen(req, timeout=5).read().decode("utf-8") 2025-10-10T00:01:08.7820046Z return json.loads(content) 2025-10-10T00:01:08.7820515Z except Exception as e: 2025-10-10T00:01:08.7820995Z log.warning(f"Could not download {url}: {e}") 2025-10-10T00:01:08.7821360Z 2025-10-10T00:01:08.7821706Z log.warning(f"All {num_retries} retries exhausted, downloading {url} failed") 2025-10-10T00:01:08.7822340Z return {} 2025-10-10T00:01:08.7822550Z 2025-10-10T00:01:08.7822557Z 2025-10-10T00:01:08.7822697Z @cache 2025-10-10T00:01:08.7823244Z def get_pr_info(github_repo: str, github_token: str, pr_number: int) -> dict[str, Any]: 2025-10-10T00:01:08.7823917Z """ 2025-10-10T00:01:08.7824269Z Dynamically get PR information 2025-10-10T00:01:08.7824842Z """ 2025-10-10T00:01:08.7825293Z github_api = f"https://api.github.com/repos/{github_repo}" 2025-10-10T00:01:08.7825848Z headers = { 2025-10-10T00:01:08.7826255Z "Accept": "application/vnd.github.v3+json", 2025-10-10T00:01:08.7826797Z "Authorization": f"token {github_token}", 2025-10-10T00:01:08.7827275Z } 2025-10-10T00:01:08.7827662Z json_response: dict[str, Any] = download_json( 2025-10-10T00:01:08.7828319Z url=f"{github_api}/issues/{pr_number}", 2025-10-10T00:01:08.7828816Z headers=headers, 2025-10-10T00:01:08.7829199Z ) 2025-10-10T00:01:08.7829398Z 2025-10-10T00:01:08.7829589Z if not json_response: 2025-10-10T00:01:08.7830142Z log.warning(f"Failed to get the labels for #{pr_number}") 2025-10-10T00:01:08.7830747Z return {} 2025-10-10T00:01:08.7830956Z 2025-10-10T00:01:08.7831118Z return json_response 2025-10-10T00:01:08.7831367Z 2025-10-10T00:01:08.7831373Z 2025-10-10T00:01:08.7831738Z def get_labels(github_repo: str, github_token: str, pr_number: int) -> set[str]: 2025-10-10T00:01:08.7832415Z """ 2025-10-10T00:01:08.7832889Z Dynamically get the latest list of labels from the pull request 2025-10-10T00:01:08.7833473Z """ 2025-10-10T00:01:08.7833901Z pr_info = get_pr_info(github_repo, github_token, pr_number) 2025-10-10T00:01:08.7834445Z return { 2025-10-10T00:01:08.7834959Z label.get("name") for label in pr_info.get("labels", []) if label.get("name") 2025-10-10T00:01:08.7835586Z } 2025-10-10T00:01:08.7835765Z 2025-10-10T00:01:08.7835770Z 2025-10-10T00:01:08.7835929Z def main() -> None: 2025-10-10T00:01:08.7836296Z args = parse_args() 2025-10-10T00:01:08.7836533Z 2025-10-10T00:01:08.7836738Z runner_label_prefix = DEFAULT_LABEL_PREFIX 2025-10-10T00:01:08.7837086Z 2025-10-10T00:01:08.7837261Z # Check if the PR is opt-out 2025-10-10T00:01:08.7837702Z if args.pr_number: 2025-10-10T00:01:08.7838379Z labels = get_labels(args.github_repo, args.github_token, int(args.pr_number)) 2025-10-10T00:01:08.7839179Z if OPT_OUT_LABEL in labels: 2025-10-10T00:01:08.7839635Z log.info( 2025-10-10T00:01:08.7840276Z f"Opt-out runner determinator because #{args.pr_number} has {OPT_OUT_LABEL} label" 2025-10-10T00:01:08.7840961Z ) 2025-10-10T00:01:08.7841444Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.7842042Z sys.exit() 2025-10-10T00:01:08.7842277Z 2025-10-10T00:01:08.7842429Z try: 2025-10-10T00:01:08.7842821Z rollout_state = get_rollout_state_from_issue( 2025-10-10T00:01:08.7843449Z args.github_token, args.github_issue_repo, args.github_issue 2025-10-10T00:01:08.7844027Z ) 2025-10-10T00:01:08.7844226Z 2025-10-10T00:01:08.7844442Z username = get_potential_pr_author( 2025-10-10T00:01:08.7844930Z args.github_token, 2025-10-10T00:01:08.7845365Z args.github_repo, 2025-10-10T00:01:08.7845787Z args.github_actor, 2025-10-10T00:01:08.7846221Z args.github_ref_type, 2025-10-10T00:01:08.7846659Z args.github_branch, 2025-10-10T00:01:08.7847065Z ) 2025-10-10T00:01:08.7847243Z 2025-10-10T00:01:08.7847497Z is_canary = args.github_repo == "pytorch/pytorch-canary" 2025-10-10T00:01:08.7847905Z 2025-10-10T00:01:08.7848194Z runner_label_prefix = get_runner_prefix( 2025-10-10T00:01:08.7848691Z rollout_state, 2025-10-10T00:01:08.7849115Z (args.github_issue_owner, username), 2025-10-10T00:01:08.7849610Z args.github_branch, 2025-10-10T00:01:08.7850047Z args.eligible_experiments, 2025-10-10T00:01:08.7850525Z args.opt_out_experiments, 2025-10-10T00:01:08.7850966Z is_canary, 2025-10-10T00:01:08.7851338Z ) 2025-10-10T00:01:08.7851518Z 2025-10-10T00:01:08.7851683Z except Exception as e: 2025-10-10T00:01:08.7852089Z log.error( 2025-10-10T00:01:08.7852692Z f"Failed to get issue. Defaulting to Meta runners and no experiments. Exception: {e}" 2025-10-10T00:01:08.7853539Z ) 2025-10-10T00:01:08.7853718Z 2025-10-10T00:01:08.7854021Z set_github_output(GH_OUTPUT_KEY_LABEL_TYPE, runner_label_prefix) 2025-10-10T00:01:08.7854476Z 2025-10-10T00:01:08.7854481Z 2025-10-10T00:01:08.7854641Z if __name__ == "__main__": 2025-10-10T00:01:08.7855023Z main() 2025-10-10T00:01:08.7855208Z 2025-10-10T00:01:08.7941680Z ##[group]Run python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:08.7942487Z python3 -m pip install urllib3==1.26.18 PyGithub==2.3.0 2025-10-10T00:01:08.7973603Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:08.7974033Z env: 2025-10-10T00:01:08.7974575Z GITHUB_TOKEN: *** 2025-10-10T00:01:08.7974951Z ISSUE_NUMBER: 5132 2025-10-10T00:01:08.7975356Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:08.7975806Z ISSUE_OWNER: 2025-10-10T00:01:08.7976166Z CHECK_EXPERIMENTS: 2025-10-10T00:01:08.7976547Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:08.7976945Z PR_NUMBER: 2025-10-10T00:01:08.7977283Z ##[endgroup] 2025-10-10T00:01:11.2032643Z Defaulting to user installation because normal site-packages is not writeable 2025-10-10T00:01:12.5407048Z Collecting urllib3==1.26.18 2025-10-10T00:01:12.5947033Z Downloading urllib3-1.26.18-py2.py3-none-any.whl.metadata (48 kB) 2025-10-10T00:01:12.6198217Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.9/48.9 kB 3.3 MB/s eta 0:00:00 2025-10-10T00:01:12.6519533Z Collecting PyGithub==2.3.0 2025-10-10T00:01:12.6637176Z Downloading PyGithub-2.3.0-py3-none-any.whl.metadata (3.8 kB) 2025-10-10T00:01:12.7143959Z Collecting pynacl>=1.4.0 (from PyGithub==2.3.0) 2025-10-10T00:01:12.7245948Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl.metadata (9.4 kB) 2025-10-10T00:01:12.7288718Z Requirement already satisfied: requests>=2.14.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (2.31.0) 2025-10-10T00:01:12.7304617Z 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-10-10T00:01:12.7318854Z Requirement already satisfied: typing-extensions>=4.0.0 in /usr/lib/python3/dist-packages (from PyGithub==2.3.0) (4.10.0) 2025-10-10T00:01:12.7723200Z Collecting Deprecated (from PyGithub==2.3.0) 2025-10-10T00:01:12.7826257Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl.metadata (5.7 kB) 2025-10-10T00:01:12.8050832Z 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-10-10T00:01:12.9432568Z Collecting cffi>=1.4.1 (from pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:12.9539720Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (2.6 kB) 2025-10-10T00:01:13.0981628Z Collecting wrapt<2,>=1.10 (from Deprecated->PyGithub==2.3.0) 2025-10-10T00:01:13.1088909Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.metadata (6.4 kB) 2025-10-10T00:01:13.1346624Z Collecting pycparser (from cffi>=1.4.1->pynacl>=1.4.0->PyGithub==2.3.0) 2025-10-10T00:01:13.1447548Z Downloading pycparser-2.23-py3-none-any.whl.metadata (993 bytes) 2025-10-10T00:01:13.1748400Z Downloading urllib3-1.26.18-py2.py3-none-any.whl (143 kB) 2025-10-10T00:01:13.1872720Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 143.8/143.8 kB 12.8 MB/s eta 0:00:00 2025-10-10T00:01:13.2074434Z Downloading PyGithub-2.3.0-py3-none-any.whl (354 kB) 2025-10-10T00:01:13.2200556Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 354.4/354.4 kB 31.8 MB/s eta 0:00:00 2025-10-10T00:01:13.2304811Z Downloading pynacl-1.6.0-cp38-abi3-manylinux_2_34_x86_64.whl (1.4 MB) 2025-10-10T00:01:13.2473100Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.4/1.4 MB 91.8 MB/s eta 0:00:00 2025-10-10T00:01:13.2574247Z Downloading Deprecated-1.2.18-py2.py3-none-any.whl (10.0 kB) 2025-10-10T00:01:13.2696676Z Downloading cffi-2.0.0-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (219 kB) 2025-10-10T00:01:13.2740756Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 219.6/219.6 kB 74.3 MB/s eta 0:00:00 2025-10-10T00:01:13.2843209Z Downloading wrapt-1.17.3-cp312-cp312-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (88 kB) 2025-10-10T00:01:13.2888970Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.0/88.0 kB 26.7 MB/s eta 0:00:00 2025-10-10T00:01:13.3011451Z Downloading pycparser-2.23-py3-none-any.whl (118 kB) 2025-10-10T00:01:13.3051174Z ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 118.1/118.1 kB 45.4 MB/s eta 0:00:00 2025-10-10T00:01:13.6621104Z Installing collected packages: wrapt, urllib3, pycparser, Deprecated, cffi, pynacl, PyGithub 2025-10-10T00:01:14.1885784Z Successfully installed Deprecated-1.2.18 PyGithub-2.3.0 cffi-2.0.0 pycparser-2.23 pynacl-1.6.0 urllib3-1.26.18 wrapt-1.17.3 2025-10-10T00:01:14.2656538Z ##[group]Run curr_branch="main" 2025-10-10T00:01:14.2656845Z curr_branch="main" 2025-10-10T00:01:14.2657066Z curr_ref_type="branch" 2025-10-10T00:01:14.2657329Z echo "Current branch is '$curr_branch'" 2025-10-10T00:01:14.2657608Z  2025-10-10T00:01:14.2657812Z python3 runner_determinator.py \ 2025-10-10T00:01:14.2658301Z  --github-token "$GITHUB_TOKEN" \ 2025-10-10T00:01:14.2658580Z  --github-issue "$ISSUE_NUMBER" \ 2025-10-10T00:01:14.2658842Z  --github-branch "$curr_branch" \ 2025-10-10T00:01:14.2659100Z  --github-actor "$TRIGGERING_ACTOR" \ 2025-10-10T00:01:14.2659383Z  --github-issue-owner "$ISSUE_OWNER" \ 2025-10-10T00:01:14.2659652Z  --github-ref-type "$curr_ref_type" \ 2025-10-10T00:01:14.2659921Z  --github-repo "$GITHUB_REPOSITORY" \ 2025-10-10T00:01:14.2660224Z  --eligible-experiments "$CHECK_EXPERIMENTS" \ 2025-10-10T00:01:14.2660619Z  --opt-out-experiments "$OPT_OUT_EXPERIMENTS" \ 2025-10-10T00:01:14.2660914Z  --pr-number "${PR_NUMBER}" 2025-10-10T00:01:14.2693519Z shell: /usr/bin/bash -e {0} 2025-10-10T00:01:14.2693759Z env: 2025-10-10T00:01:14.2694223Z GITHUB_TOKEN: *** 2025-10-10T00:01:14.2694413Z ISSUE_NUMBER: 5132 2025-10-10T00:01:14.2694618Z TRIGGERING_ACTOR: pytorchmergebot 2025-10-10T00:01:14.2694852Z ISSUE_OWNER: 2025-10-10T00:01:14.2695034Z CHECK_EXPERIMENTS: 2025-10-10T00:01:14.2695227Z OPT_OUT_EXPERIMENTS: 2025-10-10T00:01:14.2695425Z PR_NUMBER: 2025-10-10T00:01:14.2695593Z ##[endgroup] 2025-10-10T00:01:14.2744493Z Current branch is 'main' 2025-10-10T00:01:16.4088953Z INFO : Based on rollout percentage of 60%, enabling experiment lf. 2025-10-10T00:01:16.4090465Z INFO : Branch main is an exception branch. Not enabling experiment ephemeral. 2025-10-10T00:01:16.4091730Z INFO : Branch main is an exception branch. Not enabling experiment wincanary. 2025-10-10T00:01:16.4092922Z INFO : Branch main is an exception branch. Not enabling experiment wincanarylf. 2025-10-10T00:01:16.4093888Z INFO : Setting output: label-type='lf.' 2025-10-10T00:01:16.4408646Z Evaluate and set job outputs 2025-10-10T00:01:16.4414870Z Set output 'label-type' 2025-10-10T00:01:16.4416655Z Cleaning up orphan processes